1(function(){if(customElements.get("anchor-nav"))return;const SELECTOR_ITEM=".anchor-nav__item",SELECTOR_ITEMS=".anchor-nav__items",SELECTOR_SECTION=".anchor-nav";class AnchorNav extends HTMLElement{constructor(){super(),this.navItems=[],this.activeIndex=0,this.isScrolling=!1,this.observer=null,this._stickyObserver=null,this._scrollEndTimer=null}connectedCallback(){this.navItems=[...this.querySelectorAll(SELECTOR_ITEM)],this.navWrapper=this.querySelector(SELECTOR_ITEMS),!(!this.navItems.length||!this.navWrapper)&&(this.sectionEl=this.closest(SELECTOR_SECTION),this.headerSelector=this.dataset.headerSelector||".t4s-section-header",this.mainSelector=this.dataset.mainSelector||"#MainContent",this.rootMarginBottom=this.dataset.rootMarginBottom||"-60%",this.scrollBehavior=this.dataset.scrollBehavior==="auto"?"auto":"smooth",this._ensureSlider(),this.updateSlider(this.navItems[this.activeIndex]),this._bindClick(),this._bindGlobalScroll(),this._bindResize(),this._bindHeaderEvents(),this._initStickyDetect(),this._initBottomMode(),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this._initObserver(),{once:!0}):this._initObserver())}disconnectedCallback(){this.observer?.disconnect(),this._stickyObserver?.disconnect(),this._handleBottomMode&&document.removeEventListener("scroll",this._handleBottomMode),this._handleGlobalScroll&&document.removeEventListener("scroll",this._handleGlobalScroll),this._handleResize&&window.removeEventListener("resize",this._handleResize),this._handleHeaderResize&&window.removeEventListener("resize",this._handleHeaderResize),this._sentinel&&this._sentinel.remove()}setActive(index){if(index<0||index>=this.navItems.length)return;const next=this.navItems[index];index===this.activeIndex&&next?.classList.contains("active")||(this.navItems.forEach(item=>{item.classList.remove("active"),item.removeAttribute("aria-current")}),this.activeIndex=index,next?.classList.add("active"),next?.setAttribute("aria-current","true"),this.updateSlider(next),this.dispatchEvent(new CustomEvent("anchor-nav:change",{detail:{index,item:next,id:next?.getAttribute("href")?.substring(1)},bubbles:!0})))}scrollToIndex(index){const item=this.navItems[index],id=item?.getAttribute("href")?.substring(1),el=id?document.getElementById(id):null;if(!el)return;this.isScrolling=!0,this.setActive(index),this._centerActiveItem(),this._headerEl?.dispatchEvent(new Event("preventHeaderReveal"));const offset=item.hasAttribute("data-no-offset")?0:this._getOffset();window.scrollTo({top:el.getBoundingClientRect().top+window.scrollY-offset,behavior:this.scrollBehavior})}_ensureSlider(){let slider=this.navWrapper.querySelector(".anchor-nav__slider");slider||(slider=document.createElement("div"),slider.classList.add("anchor-nav__slider"),this.navWrapper.appendChild(slider)),this.slider=slider}_getOffset(){return this.sectionEl?this.sectionEl.offsetHeight+(parseInt(getComputedStyle(this.sectionEl).top,10)||0):0}updateSlider(button){if(!button||!this.slider||!this.navWrapper)return;const wrapperWidth=this.navWrapper.offsetWidth;if(!wrapperWidth)return;const left=(button.offsetLeft/wrapperWidth*100).toFixed(2),right=(100-(button.offsetLeft+button.offsetWidth)/wrapperWidth*100).toFixed(2);this.slider.style.clipPath=`inset(0 ${right}% 0 ${left}%)`}_centerActiveItem(){const active=this.navItems[this.activeIndex];if(!active)return;const target=active.offsetLeft-(this.clientWidth-active.offsetWidth)/2;this.scrollTo({left:Math.max(0,target),behavior:this.scrollBehavior})}_initObserver(){this.observer?.disconnect();const offset=this._getOffset();this.observer=new IntersectionObserver(entries=>{if(!this.isScrolling)for(const entry of entries){if(!entry.isIntersecting)continue;const index=this.navItems.findIndex(i=>i.getAttribute("href")===`#${entry.target.id}`);index!==-1&&(this.setActive(index),this._centerActiveItem())}},{rootMargin:`-${offset}px 0px ${this.rootMarginBottom} 0px`,threshold:0}),this.navItems.forEach(item=>{const id=item.getAttribute("href")?.substring(1),el=id?document.getElementById(id):null;el&&this.observer.observe(el)})}_bindClick(){this.navWrapper.addEventListener("click",e=>{const item=e.target.closest(SELECTOR_ITEM);if(!item)return;const index=this.navItems.indexOf(item);index!==-1&&(e.preventDefault(),this.scrollToIndex(index))})}_bindGlobalScroll(){this._handleGlobalScroll=()=>{this.isScrolling&&(clearTimeout(this._scrollEndTimer),this._scrollEndTimer=setTimeout(()=>{this.isScrolling=!1},150))},document.addEventListener("scroll",this._handleGlobalScroll,{passive:!0})}_bindResize(){this._handleResize=()=>
1{this._initObserver(),this.updateSlider(this.navItems[this.activeIndex])},window.addEventListener("resize",this._handleResize,{passive:!0})}_bindHeaderEvents(){this._headerEl=document.querySelector(this.headerSelector);const readHeaderHeight=()=>{this.headerHeight=getComputedStyle(document.documentElement).getPropertyValue("--header-height")||"0px"};window.luteUtil?.lazyLoad?window.luteUtil.lazyLoad(readHeaderHeight):readHeaderHeight(),!(!this._headerEl||!this.sectionEl)&&(this._headerEl.addEventListener("T4sHeaderHide",()=>{this.sectionEl.style.setProperty("--sticky-top","0px"),requestAnimationFrame(()=>{this._initObserver(),this._refreshBottomModeCache?.()})}),this._headerEl.addEventListener("T4sHeaderReveal",()=>{this.sectionEl.style.setProperty("--sticky-top",this.headerHeight),requestAnimationFrame(()=>{this._initObserver(),this._refreshBottomModeCache?.()})}),this._handleHeaderResize=readHeaderHeight,window.addEventListener("resize",this._handleHeaderResize,{passive:!0}))}_initStickyDetect(){if(!this.sectionEl)return;const sentinel=document.createElement("div");sentinel.style.cssText="height:0;width:0;pointer-events:none;visibility:hidden",this.sectionEl.parentNode.insertBefore(sentinel,this.sectionEl),this._sentinel=sentinel,this._stickyObserver=new IntersectionObserver(([entry])=>{this.sectionEl.classList.toggle("is-stuck",!entry.isIntersecting)},{threshold:0}),this._stickyObserver.observe(sentinel)}_initBottomMode(){this.isFixedTop=!1;const mainContent=document.querySelector(this.mainSelector);if(!mainContent||!this.sectionEl)return;let navHeight=this.sectionEl.offsetHeight,stickyTop=parseInt(getComputedStyle(this.sectionEl).getPropertyValue("--sticky-top"),10)||0;const refreshCache=()=>{navHeight=this.sectionEl.offsetHeight,stickyTop=parseInt(getComputedStyle(this.sectionEl).getPropertyValue("--sticky-top"),10)||0};this._refreshBottomModeCache=refreshCache;let rafId=0;this._handleBottomMode=()=>{rafId||(rafId=requestAnimationFrame(()=>{rafId=0;const shouldPin=mainContent.getBoundingClientRect().bottom<stickyTop+navHeight;shouldPin!==this.isFixedTop&&(this.isFixedTop=shouldPin,this.sectionEl.classList.toggle("is-fixed-top",shouldPin))}))},document.addEventListener("scroll",this._handleBottomMode,{passive:!0}),window.addEventListener("resize",refreshCache,{passive:!0}),this._handleBottomMode()}}customElements.define("anchor-nav",AnchorNav)})(),(function(){if(customElements.get("task-event-tracker"))return;const DEFAULT_ENDPOINT=`${window.luteUtil?.getApiUrl()}/api/station/activity/task/shopify/taskEventReport`;class TaskEventTracker extends HTMLElement{#atcHandler=null;#cartSuccessHandler=null;#loginHandler=null;#pendingCart=!1;#pendingReports=[];connectedCallback(){this.dataset.customer&&(window.__taskEventTrackerListenerAttached||(this.#initAtcTracking(),window.__taskEventTrackerListenerAttached=!0),window.taskEventTracker||(window.taskEventTracker={report:(eventType,extra)=>this.report(eventType,extra),instance:this}),this.#loginHandler=()=>this.#flushPending(),document.addEventListener("LUTE:AUTH:LOGIN",this.#loginHandler),this.#reportPageView())}disconnectedCallback(){this.#atcHandler&&(document.removeEventListener("click",this.#atcHandler,!0),this.#atcHandler=null),this.#cartSuccessHandler&&((window.jQuery_T4NT||window.jQuery)?.(document).off("add:cart:success",this.#cartSuccessHandler),this.#cartSuccessHandler=null),this.#loginHandler&&(document.removeEventListener("LUTE:AUTH:LOGIN",this.#loginHandler),this.#loginHandler=null),window.__taskEventTrackerListenerAttached=!1,window.taskEventTracker?.instance===this&&delete window.taskEventTracker}get isLoggedIn(){return!!(window.__MOMCOZY_USER_INFO__&&window.__MOMCOZY_USER_INFO__.email)}#flushPending(){if(!this.isLoggedIn||!this.#pendingReports.length)return;this.#pendingReports.splice(0).forEach(({eventType,extra})=>this.report(eventType,extra))}get endpoint(){return this.dataset.endpoint||DEFAULT_ENDPOINT}get email(){return this.dataset.email||window?.__MOMCOZY_USER_INFO__?.email}report(eventType,extra={}){if(!eventType)return;if(!this.isLoggedIn){this.#pendingReports.push({eventType,extra});return}const body={eventType,url:extra.url??window.location.href,email:extra.email??this.email??void 0,orderId:extra.orderId??void 0};return this.#send(body)}#send(body){return fetch(this.endpoint,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${window.__MOMCOZY_USER_INFO__?.token||""}`},body:JSON.stringify(body)}).catch(err=>{console.warn("[task-event-tracker] report failed:",err)})}#reportPageView(){const eventType=this.dataset.pageView;eventType&&this.report(eventType)}#initAtcTracking(){this.#atcHandler=e=>{e.target.closest("[data-action-atc], [data-atc-form]")&&(this.#pendingCart=!0)},document.addEventListener("click",this.#atcHandler,!0);const $=window.jQuery_T4NT||window.jQuery;$&&(this.#cartSuccessHandler=()=>{if(!this.#pendingCart)return;this.#pendingCart=!1,this.report(2)},$(document).on("add:cart:success",this.#cartSuccessHandler))}}customElements.define("task-event-tracker",TaskEventTracker)})();class ExternalVideo extends HTMLElement{#hasLoaded=!1;#isVisible=!1;#isPlaying=!1;#shouldPlay=!1;#setupPromise=void 0;#removeClickListener=void 0;#visibilityObserver=void 0;connectedCallback(){if(this.#observePlaybackVisibility(),this.autoPlay)return;const playOnClick=()=>{this.play()};this.addEventListener("click",playOnClick,{once:!0}),this.#removeClickListener=()=>this.removeEventListener("click",playOnClick)}disconnectedCallback(){this.#removeClickListener?.(),this.#visibilityObserver?.disconnect(),this.#messageListener&&window.removeEventListener("message",this.#messageListener)}get autoPlay(){return this.hasAttribute("autoplay")}get playing(){return this.#isPlaying}get wantsPlayback(){return this.#shouldPlay}get visible(){return this.#isVisible}get provider(){return this.getAttribute("provider")??"video"}preload(){this.#hasLoaded||this.#setupPlayer()}static#YOUTUBE_ORIGIN="https://www.youtube.com";#youtubeReady=!1;#hasInitializedYouTubeListener=!1;#pendingAction=null;#messageListener=void 0;async play(){if(this.#shouldPlay=!0,this.#hasLoaded||await this.#setupPlayer(),!!this.#shouldPlay&&this.#isVisible){if(this.provider==="youtube"){if(!this.#youtubeReady){this.#pendingAction="play";return}this.#isPlaying=!0,this.querySelector("iframe")?.contentWindow?.postMessage(JSON.stringify({event:"command",func:"playVideo",args:""}),ExternalVideo.#YOUTUBE_ORIGIN);return}if(this.#isVisible){if(this.#isPlaying=!0,this.provider==="vimeo"){this.querySelector("iframe")?.contentWindow?.postMessage(JSON.stringify({method:"play"}),"*");return}await this.querySelector("video")?.play().catch(()=>{})}}}pause(){if(this.#shouldPlay=!1,this.#isPlaying=!1,!!this.#hasLoaded){if(this.provider==="youtube"){if(!this.#youtubeReady){this.#pendingAction="pause";return}this.querySelector("iframe")?.contentWindow?.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),ExternalVideo.#YOUTUBE_ORIGIN);return}if(this.provider==="vimeo"){this.querySelector("iframe")?.contentWindow?.postMessage(JSON.stringify({method:"pause"}),"*");return}this.querySelector("video")?.pause()}}#flushPendingAction(){if(!this.#youtubeReady||!this.#pendingAction)return;const action=this.#pendingAction;this.#pendingAction=null,action==="play"?this.play():this.pause()}#observePlaybackVisibility(){this.#visibilityObserver?.disconnect(),this.#visibilityObserver=new IntersectionObserver(([entry])=>{if(entry){if(this.#isVisible=entry.isIntersecting,!entry.isIntersecting){this.pause();return}this.#hasLoaded||this.#setupPlayer(),this.autoPlay&&this.play()}},{threshold:0}),this.#visibilityObserver.observe(this)}#setupPlayer(){return this.#setupPromise?this.#setupPromise:(this.#setupPromise=new Promise(resolve=>{const template=this.querySelector("template"),node=template?.content.firstElementChild?.cloneNode(!0);if(!template||!node){resolve();return}const player=node;if(player instanceof HTMLIFrameElement&&this.provider==="youtube"){const playerUrl=new URL(player.src);playerUrl.searchParams.set("origin",location.origin),player.src=playerUrl.toString()}const markLoaded=()=>{this.#hasLoaded=!0,resolve()},initYouTubeApi=()=>{!(player instanceof HTMLIFrameElement)||this.provider!=="youtube"||(this.#hasInitializedYouTubeListener||(this.#hasInitializedYouTubeListener=!0,this.#messageListener=event=>{if(event.source!==player.contentWindow)return;let data;try{data=JSON.parse(event.data)}catch{return}data.event==="onReady"&&(this.#youtubeReady=!0,this.#flushPendingAction())},window.addEventListener("message",this.#messageListener)),player.contentWindow?.postMessage(JSON.stringify({event:"listening"}),ExternalVideo.#YOUTUBE_ORIGIN))};player instanceof HTMLIFrameElement||player instanceof HTMLVideoElement?(player.addEventListener(player instanceof HTMLVideoElement?"loadedmetadata":"load",()=>{initYouTubeApi(),markLoaded()},{once:!0}),player.addEventListener("error",markLoaded,{once:!0})):queueMicrotask(markLoaded),this.autoPlay?template.replaceWith(player):this.replaceChildren(player),initYouTubeApi()}),this.#setupPromise)}}customElements.get("external-video")||customElements.define("external-video",ExternalVideo); 2//# sourceMappingURL=/cdn/shop/t/375/assets/common-component.js.map?v=32984287943296760951784544585
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.