class qe{constructor(i,t){this.platformId=i;this.service=t;a(this,"destroyRef",S(z));a(this,"sEOService",S(V));a(this,"hiddenTags",f([]));a(this,"isBrowser",f(!1));a(this,"onLoading",f(!1));a(this,"mappingId",k(""));a(this,"data",f({}));a(this,"realIndex",f(0));a(this,"readyToshow",f(!1));a(this,"firstImageLoaded",f(!1));a(this,"remainingLoaded",f(!1));a(this,"carouselActivated",f(!1));a(this,"customOptions",f({loop:!0,items:1,autoplay:!0,autoplayTimeout:3e3,autoplayHoverPause:!1,dots:!0,nav:!1}));a(this,"lcpGateStarted",!1);a(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(n=>n.isOn&&n.pcImageUrl&&n.mbImageUrl);return ue(ne({},i),{bannerSettingBase:t})}),w(i=>{var e;let t=(e=i.carouselInterval)!=null?e:5;this.customOptions.update(n=>ue(ne({},n),{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 n=new PerformanceObserver(o=>{o.getEntries().length&&(t(),clearTimeout(e),n.disconnect())});n.observe({type:"largest-contentful-paint",buffered:!0})}}catch{}}loadRestImages(){this.remainingLoaded()||this.remainingLoaded.set(!0)}preloadFirstImage(){var n;if(!this.isBrowser())return;let i=(n=this.data().bannerSettingBase)==null?void 0:n[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分鐘。
立即申請