class Ze{constructor(i,t){this.platformId=i;this.service=t;n(this,"destroyRef",y(P));n(this,"sEOService",y(W));n(this,"hiddenTags",f([]));n(this,"isBrowser",f(!1));n(this,"onLoading",f(!1));n(this,"mappingId",B(""));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(A(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(r=>r.isOn&&r.pcImageUrl&&r.mbImageUrl);return be(ne({},i),{bannerSettingBase:t})}),I(i=>{var e;let t=(e=i.carouselInterval)!=null?e:5;this.customOptions.update(r=>be(ne({},r),{autoplayTimeout:t*1e3})),this.data.set(i),this.preloadFirstImage()}),Y(()=>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 r=new PerformanceObserver(o=>{o.getEntries().length&&(t(),clearTimeout(e),r.disconnect())});r.observe({type:"largest-contentful-paint",buffered:!0})}}catch{}}loadRestImages(){this.remainingLoaded()||this.remainingLoaded.set(!0)}preloadFirstImage(){var r;if(!this.isBrowser())return;let i=(r=this.data().bannerSettingBase)==null?void 0:r[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))}}
車輛融資
機車、手機資金額度
小額融資免出門,線上申辦只要3分鐘。
立即申請