1import{handleClaritySearchOrchestration}from"@theme/clarity-search-orchestration";const searchModalComponent=document.getElementById("search-modal"),dialogEl=searchModalComponent?.querySelector("dialog"),modalSearchInput=dialogEl?.querySelector('[ref="searchInput"]');let isClosing=!1,previousScrollY=0,activeClickHandler=null,activeKeyDownHandler=null,activeBarInput=null;if(dialogEl){const nativeClose=dialogEl.close.bind(dialogEl);dialogEl.close=function(...args){isClosing=!0,nativeClose(...args),requestAnimationFrame(()=>{isClosing=!1})}}dialogEl?.addEventListener("close",()=>{activeClickHandler&&(document.removeEventListener("click",activeClickHandler,{capture:!0}),activeClickHandler=null),activeKeyDownHandler&&(document.removeEventListener("keydown",activeKeyDownHandler),activeKeyDownHandler=null),activeBarInput?.blur(),activeBarInput=null,modalSearchInput?.blur(),document.documentElement.removeAttribute("scroll-lock"),document.body.style.position==="fixed"?(document.body.style.width="",document.body.style.position="",document.body.style.top="",window.scrollTo({top:previousScrollY,behavior:"instant"})):document.documentElement.style.overflow=""});function openModal(barInput,handleDocumentClick,handleDocumentKeyDown){if(!(dialogEl?.open||isClosing)){if(previousScrollY=window.scrollY,activeBarInput=barInput,window.innerWidth>=750){const headerGroup=document.querySelector(".header-section, header");headerGroup&&dialogEl&&(dialogEl.style.top=`${window.scrollY+headerGroup.getBoundingClientRect().bottom}px`)}dialogEl?.show(),document.documentElement.setAttribute("scroll-lock",""),requestAnimationFrame(()=>{document.body.style.width="100%",document.body.style.position="fixed",document.body.style.top=`-${previousScrollY}px`}),barInput.focus({preventScroll:!0}),searchModalComponent?.dispatchEvent(new CustomEvent("dialog:open")),setTimeout(()=>{activeClickHandler=handleDocumentClick,activeKeyDownHandler=handleDocumentKeyDown,document.addEventListener("click",handleDocumentClick,{capture:!0}),document.addEventListener("keydown",handleDocumentKeyDown)},0)}}async function closeModal(handleDocumentClick,handleDocumentKeyDown){if(!dialogEl?.open||isClosing)return;isClosing=!0,document.removeEventListener("click",handleDocumentClick,{capture:!0}),document.removeEventListener("keydown",handleDocumentKeyDown),activeClickHandler=null,activeKeyDownHandler=null,activeBarInput?.blur(),activeBarInput=null,modalSearchInput?.blur(),document.documentElement.removeAttribute("scroll-lock"),dialogEl.style.animation="none",dialogEl.offsetWidth,dialogEl.classList.add("dialog-closing"),dialogEl.style.animation="";const animations=dialogEl.getAnimations({subtree:!1}).filter(a=>a.timeline instanceof DocumentTimeline).map(a=>a.finished);await Promise.allSettled(animations.length?animations:[Promise.resolve()]),document.body.style.position==="fixed"?(document.body.style.width="",document.body.style.position="",document.body.style.top="",window.scrollTo({top:previousScrollY,behavior:"instant"})):document.documentElement.style.overflow="",dialogEl.close(),dialogEl.classList.remove("dialog-closing"),isClosing=!1,searchModalComponent?.dispatchEvent(new CustomEvent("dialog:close"))}document.addEventListener("br:close-search-modal",()=>{activeClickHandler&&activeKeyDownHandler&&closeModal(activeClickHandler,activeKeyDownHandler)});function delay(ms){return new Promise(resolve=>{setTimeout(resolve,ms)})}class SearchBar extends HTMLElement{#dialogOpen=!1;#animationCancelled=!1;#placeholderConfig=null;#placeholderSpan=null;#barInput=null;disconnectedCallback(){this.#animationCancelled=!0,searchModalComponent&&(searchModalComponent.removeEventListener("dialog:open",this.#onDialogOpen),searchModalComponent.removeEventListener("dialog:close",this.#onDialogClose))}#onDialogOpen=()=>{this.#dialogOpen=!0,this.#barInput&&this.#syncFauxPlaceholder(this.#barInput)};#onDialogClose=()=>{this.#dialogOpen=!1,this.#barInput&&this.#syncFauxPlaceholder(this.#barInput)};#syncFauxPlaceholder(barInput){const hide=this.#dialogOpen||!!barInput.value?.trim()||document.activeElement===barInput;this.classList.toggle("search-bar--faux-placeholder-hidden",hide),hide||(barInput.placeholder="")}async#runPlaceholderLoop(barInput){const span=this.#placeholderSpan,config=this.#placeholderConfig;if(!span||!config?.prefix||!config.variants?.length)return;const{prefix,variants}=config;for(;!this.#animationCancelled;)for(const variant of variants){if(this.#animationCancelled||(span.textContent=prefix,await delay(280),this.#animationCancelled))return;for(let d=1;d<=3;d++)if(span.textContent=`${prefix}${".".repeat(d)}`,await delay(220),this.#animationCancelled)return;const target=`${span.textContent} ${variant}`;for(let i=span.textContent.length;i<target.length;i++){if(this.#animationCancelled)return;span.textContent=target.slice(0,i+1),await delay(42)}if(await delay(2600),this.#animationCancelled)return}}#syncClearButton(barInput){this.classList.toggle("search-bar--has-value",!!barInput.value)}connectedCallback(){const barInput=this.querySelector(".search-bar__input");if(!barInput)return;this.#barInput=barInput,this.#placeholderSpan=this.querySelector(".search-bar__typed-placeholder"),barInput.addEventListener("invalid",event=>{event.preventDefault()}),this.querySelector(".search-bar__form")?.addEventListener("submit",event=>{event.preventDefault(),handleClaritySearchOrchestration(barInput.value).then(handled=>{if(handled)return;const searchUrl=new URL(Theme.routes.search_url,location.origin);searchUrl.searchParams.set("q",barInput.value),window.location.href=searchUrl.toString()})});const clearButton=this.querySelector(".search-bar__clear");clearButton&&clearButton.addEventListener("click",()=>{barInput.value="",this.#syncClearButton(barInput),barInput.focus(),barInput.dispatchEvent(new InputEvent("input",{bubbles:!0,inputType:"deleteContentBackward"}))});const configEl=this.querySelector(".search-bar__placeholder-config");if(configEl?.textContent)try{this.#placeholderConfig=JSON.parse(configEl.textContent.trim())}catch{this.#placeholderConfig=null}const reducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)").matches,hasAnimatedPlaceholder=!reducedMotion&&!!this.#placeholderConfig?.prefix&&Array.isArray(this.#placeholderConfig?.variants)&&this.#placeholderConfig.variants.length>0,sync=()=>this.#syncFauxPlaceholder(barInput),syncClear=()=>this.#syncClearButton(barInput);if(barInput.addEventListener("input",syncClear),hasAnimatedPlaceholder?(barInput.placeholder="",this.#placeholderSpan?.classList.remove("visually-hidden"),searchModalComponent?.addEventListener("dialog:open",this.#onDialogOpen),searchModalComponent?.addEventListener("dialog:close",this.#onDialogClose),barInput.addEventListener("focus",sync),barInput.addEventListener("blur",sync),barInput.addEventListener("input",sync),this.#runPlaceholderLoop(barInput)):(reducedMotion&&this.dataset.staticPlaceholder&&(barInput.placeholder=this.dataset.staticPlaceholder),this.#placeholderSpan?.classList.add("visually-hidden")),!searchModalComponent||!dialogEl)return;const handleDocumentClick=event=>{if(!dialogEl?.open)return;const target=event.target;dialogEl.contains(target)||target.closest("search-bar")||closeModal(handleDocumentClick,handleDocumentKeyDown)},handleDocumentKeyDown=event=>{event.key==="Escape"&&(event.preventDefault(),closeModal(handleDocumentClick,handleDocumentKeyDown))};this.dataset.bloomreachAutosuggest==="true"&&barInput.addEventListener("focus",()=>{openModal(barInput,handleDocumentClick,handleDocumentKeyDown)}),modalSearchInput&&barInput.addEventListener("input",event=>{modalSearchInput.value=barInput.value,modalSearchInput.dispatchEvent(new InputEvent("input",{bubbles:!0,inputType:event.inputType||"insertText"}))}),hasAnimatedPlaceholder&&sync()}}customElements.define("search-bar",SearchBar); 2//# sourceMappingURL=/cdn/shop/t/190/assets/search-bar.js.map?v=39723663465348734891790739911
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.