class qe{constructor(i,t){this.platformId=i;this.service=t;n(this,"destroyRef",S(z));n(this,"sEOService",S(V));n(this,"hiddenTags",f([]));n(this,"isBrowser",f(!1));n(this,"onLoading",f(!1));n(this,"mappingId",E(""));n(this,"data",f({}));n(this,"realIndex",f(0));n(this,"readyToshow",f(!1));n(this,"firstImageLoaded",f(!1));n(this,"remainingLoaded",f(!1));n(this,"carouselActivated",f(!1));n(this,"customOptions",f({loop:!0,items:1,autoplay:!0,autoplayTimeout:3e3,autoplayHoverPause:!1,dots:!0,nav:!1}));n(this,"lcpGateStarted",!1);n(this,"setHiddenTags",(i="")=>{i&&this.sEOService.apiSEOSEOTitleGet(i).pipe(T(this.destroyRef)).subscribe(t=>{this.hiddenTags.set(t)})});this.isBrowser.set(R(this.platformId))}ngOnInit(){this.onLoading.set(!0),this.setHiddenTags(this.mappingId()),this.service.getBanner$(this.mappingId()).pipe(T(this.destroyRef),re(i=>{var e;let t=((e=i.bannerSettingBase)!=null?e:[]).filter(a=>a.isOn&&a.pcImageUrl&&a.mbImageUrl);return ue(ne({},i),{bannerSettingBase:t})}),w(i=>{var e;let t=(e=i.carouselInterval)!=null?e:5;this.customOptions.update(a=>ue(ne({},a),{autoplayTimeout:t*1e3})),this.data.set(i),this.preloadFirstImage()}),K(()=>this.onLoading.set(!1))).subscribe()}ngAfterViewInit(){this.isBrowser()&&this.readyToshow.set(!0)}onFirstImageLoad(){if(!this.firstImageLoaded()&&(this.firstImageLoaded.set(!0),this.isBrowser())){let i=()=>this.carouselActivated.set(!0);try{typeof window<"u"&&"requestIdleCallback"in window?window.requestIdleCallback(()=>{i()},{timeout:800}):setTimeout(()=>{i()},120)}catch{setTimeout(()=>{i()},120)}this.startLCPGate()}}startLCPGate(){if(this.lcpGateStarted||(this.lcpGateStarted=!0,!this.isBrowser()))return;let i=!1,t=()=>{i||(i=!0,this.loadRestImages())},e=setTimeout(t,1800);try{if("PerformanceObserver"in window){let a=new PerformanceObserver(o=>{o.getEntries().length&&(t(),clearTimeout(e),a.disconnect())});a.observe({type:"largest-contentful-paint",buffered:!0})}}catch{}}loadRestImages(){this.remainingLoaded()||this.remainingLoaded.set(!0)}preloadFirstImage(){var a;if(!this.isBrowser())return;let i=(a=this.data().bannerSettingBase)==null?void 0:a[0];if(!(i!=null&&i.pcImageUrl))return;let t=i.pcImageUrl;if(document.querySelector(`link[rel=preload][href="${t}"]`))return;let e=document.createElement("link");e.rel="preload",e.as="image",e.href=t,e.fetchPriority="high",document.head.appendChild(e)}onTranslated(i){(i==null?void 0:i.startPosition)!==void 0&&(this.realIndex.set(i.startPosition),!this.remainingLoaded()&&i.startPosition>=1&&this.remainingLoaded.set(!0))}}
同時支援實體商店、線上電商
免裝機、免年費
商家收款
銀角零卡商家
商家收款首選
不論實體店面、網路電商都可支援
了解更多