1(()=>{"use strict";const t=t=>t.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[t]));const{customElements:e,HTMLElement:i}=window;e.define("et-form-hero-search-keyword-search",class extends i{constructor(){var t,e,i,s,r,o,n,u,h;super(),this.activeSuggestionIndex=-1,this.requestCounter=0,this.currentAbortController=null,this.currentQuery="",this.keywordSearchInput=this.querySelector(".form-hero-search__keyword-search-input"),this.suggestedSearches=this.querySelector(".form-hero-search__popular-searches"),this.suggestionsList=this.querySelector(".form-hero-search__suggestions"),this.suggestionsItems=this.querySelector(".form-hero-search__suggestions-items"),this.viewMoreAnchor=this.querySelector(".form-hero-search__view-more"),this.suggestUrl=null!==(t=this.getAttribute("suggest-url"))&&void 0!==t?t:"",this.searchUrl=null!==(e=this.getAttribute("search-url"))&&void 0!==e?e:"",this.useAI="true"===this.getAttribute("use-ai"),this.aiThresholdScore=Number(null!==(i=this.getAttribute("ai-threshold-score"))&&void 0!==i?i:"0.7"),this.suggestMinChars=Number(null!==(s=this.getAttribute("suggest-min-chars"))&&void 0!==s?s:"2"),this.suggestLimit=Number(null!==(r=this.getAttribute("suggest-limit"))&&void 0!==r?r:"3");const a=Number(null!==(o=this.getAttribute("suggest-debounce"))&&void 0!==o?o:"350");this.debouncedFetch=((t,e)=>{let i=null;const s=(...s)=>{i&&clearTimeout(i),i=setTimeout(()=>{i=null,t(...s)},e)};return s.cancel=()=>{i&&(clearTimeout(i),i=null)},s})(this.fetchAndRender.bind(this),a),null===(n=this.keywordSearchInput)||void 0===n||n.addEventListener("focus",this.showSuggestedSearches.bind(this)),null===(u=this.keywordSearchInput)||void 0===u||u.addEventListener("input",this.handleInput.bind(this)),null===(h=this.keywordSearchInput)||void 0===h||h.addEventListener("keydown",this.handleKeydown.bind(this)),document.addEventListener("click",this.hideSuggestedSearches.bind(this))}showSuggestedSearches(){var t;null===(t=this.suggestedSearches)||void 0===t||t.setAttribute("active","true")}hideSuggestedSearches(t){var e;const i=t.target;i.closest(".form-hero-search__keyword-search-input")||i.closest(".form-hero-search__popular-searches")||null===(e=this.suggestedSearches)||void 0===e||e.removeAttribute("active")}handleInput(){var t,e,i;if(!this.suggestUrl)return;const s=(null!==(e=null===(t=this.keywordSearchInput)||void 0===t?void 0:t.value)&&void 0!==e?e:"").trim();if(this.currentQuery=s,s.length<this.suggestMinChars)return this.debouncedFetch.cancel(),null===(i=this.currentAbortController)||void 0===i||i.abort(),this.currentAbortController=null,this.removeAttribute("loading"),this.removeAttribute("query-active"),void this.renderSuggestions([]);this.setAttribute("query-active","true"),this.setAttribute("loading","true"),this.debouncedFetch(s)}handleKeydown(t){var e;if(!this.suggestionsList||"true"!==this.suggestionsList.getAttribute("active"))return;const i=Array.from(this.suggestionsList.querySelectorAll('[role="option"]'));if(0!==i.length)if("ArrowDown"===t.key)t.preventDefault(),this.activeSuggestionIndex=Math.min(this.activeSuggestionIndex+1,i.length-1),this.highlightActiveSuggestion(i);else if("ArrowUp"===t.key)t.preventDefault(),this.activeSuggestionIndex=Math.max(this.activeSuggestionIndex-1,-1),this.highlightActiveSuggestion(i);else if("Enter"===t.key&&this.activeSuggestionIndex>=0){t.preventDefault();const e=i[this.activeSuggestionIndex];e instanceof HTMLAnchorElement&&(window.location.href=e.href)}else"Escape"===t.key&&(this.renderSuggestions([]),null===(e=this.suggestedSearches)||void 0===e||e.removeAttribute("active"))}highlightActiveSuggestion(t){t.forEach((t,e)=>{e===this.activeSuggestionIndex?t.setAttribute("aria-selected","true"):t.removeAttribute("aria-selected")})}fetchAndRender(t){return e=this,i=void 0,r=function*(){var e;null===(e=this.currentAbortController)||void 0===e||e.abort();const i=new AbortController;this.currentAbortController=i;const s=++this.requestCounter,r=yield((t,e,...i)=>{return s=void 0,r=[t,e,...i],n=function*(t,e,i=6,s,r={}){const o=t.trim();if(!o||!e)return[];const n=new URLSearchParams({q:o,limit:String(i)});"boolean"==typeof r.useAI&&(n.set("use_ai",r.useAI?"1":"0"),r.useAI&&"number"==typeof r.aiThresholdScore&&n.set("ai_threshold_score",String(r.aiThresholdScore)));const u=e.includes("?")?"&":"?",h=`${e}${u}${n.toString()}`;try{const t=yield fetch(h,s?{signal:s}:void 0);if(!t.ok)return[];const e=yield t.json();return Array.isArray(null==e?void 0:e.suggestions)?e.suggestions:[]}catch(t){return[]}},new((o=void 0)||(o=Promise))(function(t,e){function i(t){try{h(n.next(t))}catch(t){e(t)}}function u(t){try{h(n.throw(t))}catch(t){e(t)}}function h(e){var s;e.done?t(e.value):(s=e.value,s instanceof o?s:new o(function(t){t(s)})).then(i,u)}h((n=n.apply(s,r||[])).next())});var s,r,o,n})(t,this.suggestUrl,this.suggestLimit,i.signal,{useAI:this.useAI,aiThresholdScore:this.aiThresholdScore});s===this.requestCounter&&(this.currentAbortController=null,this.removeAttribute("loading"),this.renderSuggestions(r))}
1,new((s=void 0)||(s=Promise))(function(t,o){function n(t){try{h(r.next(t))}catch(t){o(t)}}function u(t){try{h(r.throw(t))}catch(t){o(t)}}function h(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s(function(t){t(i)})).then(n,u)}h((r=r.apply(e,i||[])).next())});var e,i,s,r}renderSuggestions(e){if(this.activeSuggestionIndex=-1,this.suggestionsList&&this.suggestionsItems){if(!e.length)return this.suggestionsItems.innerHTML="",void this.suggestionsList.removeAttribute("active");if(this.suggestionsItems.innerHTML=(e=>e.length?e.map(e=>{const i=t(e.title);return`<a href="${t(e.url)}" class="form-hero-search__suggested_search body-text-large" role="option">${e.image_url?`<img src="${t(e.image_url)}" alt="" loading="lazy" width="60" height="60" />`:""}<span>${i}</span></a>`}).join(""):"")(e),this.suggestionsList.setAttribute("active","true"),this.viewMoreAnchor){const t=((t,e)=>{if(!t)return"";const i=e.trim();try{const e=new URL(t,window.location.origin);return e.searchParams.set("keywords",i),e.toString()}catch(e){const s=t.includes("?")?"&":"?";return`${t}${s}keywords=${encodeURIComponent(i)}`}})(this.searchUrl,this.currentQuery);t&&(this.viewMoreAnchor.href=t)}}}}),e.define("et-form-hero-search-video",class extends i{constructor(){var t;super(),this.video=this.querySelector("video"),this.toggleButton=this.querySelector(".form-hero-search__video-action-btn"),this.video&&(this.loadVideo(),this.video.addEventListener("canplaythrough",this.playVideo.bind(this)),this.video.addEventListener("play",this.syncButtonToPlaying.bind(this)),this.video.addEventListener("pause",this.syncButtonToPaused.bind(this)),window.addEventListener("resize",this.loadVideo.bind(this)),null===(t=this.toggleButton)||void 0===t||t.addEventListener("click",this.togglePlayPause.bind(this)),this.syncButtonToVideoState())}syncButtonToVideoState(){var t;(null===(t=this.video)||void 0===t?void 0:t.paused)?this.syncButtonToPaused():this.syncButtonToPlaying()}loadVideo(){var t;if(!this.video)return;const e=null===(t=this.video)||void 0===t?void 0:t.querySelectorAll("source");this.setVideoSource(e),this.video.load()}setVideoSource(t){if(!t||0===t.length)return;const e=window.innerWidth;t.forEach(t=>{const i=t.getAttribute("media");if(i&&window.matchMedia(i).matches){const i=t.getAttribute("data-src-desktop"),s=t.getAttribute("data-src-mobile")||i,r=e<=768?s:i;r&&t.setAttribute("src",r)}})}updateToggleButtonState(t){var e,i;if(!this.toggleButton)return;const s=null!==(e=this.toggleButton.getAttribute("data-pause-label"))&&void 0!==e?e:"Pause video",r=null!==(i=this.toggleButton.getAttribute("data-play-label"))&&void 0!==i?i:"Play video";t?(this.toggleButton.setAttribute("aria-label",s),this.toggleButton.setAttribute("title",s),this.toggleButton.setAttribute("data-state","playing")):(this.toggleButton.setAttribute("aria-label",r),this.toggleButton.setAttribute("title",r),this.toggleButton.setAttribute("data-state","paused"))}syncButtonToPlaying(){var t;null===(t=this.video)||void 0===t||t.setAttribute("active","true"),this.updateToggleButtonState(!0)}syncButtonToPaused(){var t;null===(t=this.video)||void 0===t||t.removeAttribute("active"),this.updateToggleButtonState(!1)}togglePlayPause(){this.video&&(this.video.paused?this.video.play():this.video.pause())}playVideo(){var t;null===(t=this.video)||void 0===t||t.play()}})})();
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.