(()=>{var Ue=Object.defineProperty,Ce=Object.defineProperties;var $e=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var Q=(t,e,r)=>e in t?Ue(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g=(t,e)=>{for(var r in e||(e={}))Pe.call(e,r)&&Q(t,r,e[r]);if(z)for(var r of z(e))Re.call(e,r)&&Q(t,r,e[r]);return t},J=(t,e)=>Ce(t,$e(e));var c=(t,e,r)=>new Promise((n,o)=>{var i=m=>{try{u(r.next(m))}catch(l){o(l)}},s=m=>{try{u(r.throw(m))}catch(l){o(l)}},u=m=>m.done?n(m.value):Promise.resolve(m.value).then(i,s);u((r=r.apply(t,e)).next())});var T=class{constructor(e={}){e=Object.assign({resolveTimeout:null,resolveValue:!0,rejectTimeout:null,rejectValue:!1},e),this._promise=new Promise((s,u)=>{this.resolve=s,this.reject=u}),this.then=this._promise.then.bind(this._promise),this.catch=this._promise.catch.bind(this._promise),this.finally=this._promise.finally.bind(this._promise),this[Symbol.toStringTag]="Promise";let{resolveTimeout:r,resolveValue:n,rejectTimeout:o,rejectValue:i}=e;r&&setTimeout(()=>this.resolve(n),r),o&&setTimeout(()=>this.reject(i),o)}};var U="layer",G="quiz";function W(t){return t.reduce(function(e,r){return e[r]=new T,e},{})}function X(t){return function(e,r){return c(this,null,function*(){if(!t[e])throw new Error(`unknown "${e}" app!`);r(yield t[e])})}}var C="__DF_DEBUG_MODE__",Z="true",_=window.sessionStorage;function ee(){_.setItem(C,Z)}function te(){_.removeItem(C)}function $(){return _.getItem(C)===Z}function S(t){return _.getItem(t)||window[t]}function E(t,e){_.setItem(t,e)}function h(...t){$()&&console.log("[doofinder]",...t)}var ke=10,Ae=500;function re(t,e={}){let r=document.querySelector(t);return r?Promise.resolve(r):new Promise((n,o)=>{let i=0,s=null,u=e.interval||Ae,m=e.times||ke;s=setInterval(function(){i++r.offsetWidth>0&&r.offsetHeight>0)}updateQuery(e=""){return c(this,null,function*(){let r=yield this.getElement();r instanceof HTMLInputElement&&(r.value=e)})}focus(){return c(this,null,function*(){let e=yield this.getElement();e instanceof HTMLInputElement&&e.focus()})}setCaptureLength(e){this._minCaptureLength=e||oe}getElement(){return c(this,null,function*(){if(!(!this._enabled||!this._elementSelector)){if(!this._element)try{this._element=yield re(this._elementSelector)}catch(e){this._element=void 0}return this._element}})}get enabled(){return this._enabled}set enabled(e){if(this._enabled!==!!e){this._enabled=!!e;let r=document[`${this._enabled?"add":"remove"}EventListener`];this._events.forEach(n=>r(...n))}}get captureSubmit(){return this._handleSubmit}set captureSubmit(e){this._handleSubmit=!!e}get redirection(){return this._redirection}set redirection(e){this._redirection=e}setEventBus(e){this._eventBus=e}flushMessages(){var e;if(this._eventsQueue=[...new Map(this._eventsQueue).entries()],this._eventsQueue.length>0){let r=this._eventsQueue.shift();for(;r&&r.length===2;)h("trigger:emit",r),(e=this._eventBus)==null||e.emit(...r),r=this._eventsQueue.shift()}else document.activeElement===this._element&&this.notify(ie,this.getPayload())}destroy(){this._events.forEach(e=>window.removeEventListener(...e))}shouldHandle(e){let r=this.getElementFromEvent(e);return r?(this._element=r,!0):!1}getPayload(e){let r={source:this._element,originalEvent:e};if(this._element instanceof HTMLInputElement){let n=this._element.value.trim();(n.length>=this._minCaptureLength||(e==null?void 0:e.type)==="keydown"||(e==null?void 0:e.type)==="keyup")&&(r.query=n)}return r}getElementFromEvent(e){if(!e.target||e.target===document||e.target===window)return;let r=e.type==="submit"?"querySelector":"closest",n=e.target[r](this._elementSelector);if(n&&!n.closest("[dfd-hook]"))return n}charLimitReached(e){let r=this.getElementFromEvent(e);return!r||!r.value||e.type!=="keydown"||r.value.length<50||ne.includes(e.key)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),!0)}handleClick(e){this.shouldHandle(e)&&(e.preventDefault(),e.stopImmediatePropagation(),this.notify(ie,this.getPayload(e)))}handleFocus(e){this.shouldHandle(e)&&(e.stopImmediatePropagation(),this.notify(je,this.getPayload(e)))}handleInput(e){this.shouldHandle(e)&&this.notify(Oe,this.getPayload(e))}handleSubmit(e){this._handleSubmit&&this.shouldHandle(e)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.notify(se,this.getPayload(e)))}handleKeypress(e){this.charLimitReached(e)||e.key==="Enter"&&this.shouldHandle(e)&&(!!this._redirection||this._handleSubmit)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this._redirection?window.location=this._redirection.url:e.type==="keyup"&&this.notify(se,this.getPayload(e)))}notify(e,r){this._eventBus?this._eventBus.emit(e,r):this._eventsQueue.push([e,r]),h("[trigger]",this._eventBus?"[emit]":"[queue]",e,r)}};function le(t){let e=document.cookie.match(new RegExp("(?:^|; )"+t.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));if(e)return decodeURIComponent(e[1])}var R=Object.freeze({language(t){let e=(t==null?void 0:t.replaceAll("_","-").trim().split("-"))||[];function r(n){return n?`-${n.toUpperCase()}`:""}if(e.length<3){let[n,o]=e;return`${n==null?void 0:n.toLowerCase()}${r(o)}`}else{let[n,o,i]=e;return`${n==null?void 0:n.toLowerCase()}-${o.toUpperCase()}${r(i)}`}},currency(t){return t==null?void 0:t.trim().toUpperCase()}});function k(){return S("__DF_CDN_PREFIX__")}function ae(t,e=!1){let r=S("__DF_LAYER_SERVER__")||`https://${t.toLowerCase()}-layer.doofinder.com`;return e?r.replace(/^http/,"ws"):r}var ue=1;function d(t,e,r){r!=null&&(typeof r!="string"||!!r.trim())&&t.push(`${e}=${r}`)}function Ne(t,e){var b;let{installationId:r,hashid:n,language:o,currency:i,zone:s}=t,m=`${ae(s)}/api/${ue}/installation/${r}`,l=[];return d(l,"source_url",encodeURIComponent(window.location.href)),d(l,"session_id",Doofinder.Session.getSessionId()),d(l,"session_alive",Doofinder.Session.isLive("layer","quiz")),d(l,"last_used_apps",Doofinder.Session.getLastUsedApps()),d(l,"user_id",Doofinder.Session.getUserId()),d(l,"language",R.language(o||document.documentElement.getAttribute("lang")||"")),d(l,"currency",R.currency(i)||""),d(l,"hashid",n||""),d(l,"ga_client_id",(b=le("_ga"))==null?void 0:b.substring(6)),d(l,"vsn","1.6.22"),d(l,"layer_type",e),d(l,"zone",s),`${m}?${l.join("&")}`}function Ve(t){let e=k()||t.cdn_prefix;e=="https://cdn.doofinder.com/livelayer"&&(e+="/1");let r=t.vsn;return ce(t,o=>({url:`${e}${o}?vsn=${r}`}))}function He(t){if(!t.cdn_fallback_prefix)return Ve(t);let e=t.vsn,r=k()||t.cdn_prefix+"/"+e;return ce(t,o=>{let i=`${r}${o}`;i=r.includes("staging")?`${i}?vsn=${e}`:i;let s=`${t.cdn_fallback_prefix}${o}`;return{url:i,fallbackUrl:s}})}function ce(t,e){return $()&&(t.js=t.js.map(r=>r.replace(/\.min\.js/i,".js"))),t.css=t.css.map(e),t.js=t.js.map(e),t}function de(t,e){return new Promise(function(r,n){fetch(Ne(t,e),{redirect:"follow"}).then(function(o){o.ok?o.json().then(function(i){r(He(i))}):n(`HTTP ${o.status} error response from server`)}).catch(o=>n(o))})}function A(t){return c(this,null,function*(){let{url:e,fallbackUrl:r}=t;if(!document.querySelector(`script[src="${e}"]`)){let n=document.createElement("script");n.src=e,n.async=1,r&&(n.onerror=()=>A({url:r})),document.head.appendChild(n)}})}function j(t){return c(this,null,function*(){let{url:e,fallbackUrl:r}=t;if(!document.querySelector(`link[rel="stylesheet"][href="${e}"]`)){let n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",e),r&&(n.onerror=()=>j({url:r})),document.head.appendChild(n)}})}function O(t){return c(this,null,function*(){let e=document.createElement("style");e.appendChild(document.createTextNode((t||"").trim())),document.head.appendChild(e)})}function me(t,e){let r=e.options,{autoload:n,insertion_point:o,is_checkout:i}=e,s="urlHash"in t?!!t.urlHash:!!r.url_hash,u=e.layer_type;return delete t.urlHash,delete r.url_hash,t.hashid&&t.hashid!=r.hashid&&h(`[resources] The script provided this hashid ${t.hashid} but the server resolved ${r.hashid}. The search engine doesn't exist or the settings may be wrong.`),J(g(g({},t),r),{autoload:n,urlHash:s,layerType:u,insertion_point:o,is_checkout:i})}var he=new Promise((t,e)=>{document.readyState!="loading"?t():document.addEventListener("DOMContentLoaded",()=>{t()})});function fe(t){return E("__DF_CDN_PREFIX__",t)}function pe(t){return E("__DF_LAYER_SERVER__",t)}function ge(){try{decodeURIComponent(location.href)}catch(t){throw new Error("invalid UTF-8 on url-encoded query params")}}var N="df-cookies-allowed",V=window.localStorage;function H(){V.setItem(N,"true")}function _e(){V.removeItem(N)}function ye(){return JSON.parse(V.getItem(N)||"false")}var a=[];for(v=0;v<256;++v)a.push((v+256).toString(16).slice(1));var v;function be(t,e=0){return(a[t[e+0]]+a[t[e+1]]+a[t[e+2]]+a[t[e+3]]+"-"+a[t[e+4]]+a[t[e+5]]+"-"+a[t[e+6]]+a[t[e+7]]+"-"+a[t[e+8]]+a[t[e+9]]+"-"+a[t[e+10]]+a[t[e+11]]+a[t[e+12]]+a[t[e+13]]+a[t[e+14]]+a[t[e+15]]).toLowerCase()}var x,Me=new Uint8Array(16);function M(){if(!x&&(x=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!x))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return x(Me)}var Ke=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),K={randomUUID:Ke};function Fe(t,e,r){if(K.randomUUID&&!e&&!t)return K.randomUUID();t=t||{};var n=t.random||(t.rng||M)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return be(n)}var y=Fe;var Se={canPushState(){return typeof history.pushState!="undefined"},dropLocal(t,e,r){return t.removeItem(this.localKey(e,r))},updateLocal(t,e,r,n,o){let i=this.getLocal(t,e,r),s=this.localKey(e,r),u=i===null?n:o(i);return t.setItem(s,JSON.stringify(u)),u},getLocal(t,e,r){return JSON.parse(t.getItem(this.localKey(e,r)))},updateCurrentState(t){!this.canPushState()||history.replaceState(t(history.state||{}),"",window.location.href)},pushState(t,e,r){if(this.canPushState()){if(r!==window.location.href){if(e.type=="redirect"&&e.scroll){let o=history.state||{};o.scroll=e.scroll,history.replaceState(o,"",window.location.href)}delete e.scroll,history[t+"State"](e,"",r||null);let n=this.getHashTargetEl(window.location.hash);n?n.scrollIntoView():e.type==="redirect"&&window.scroll(0,0)}}else this.redirect(r)},setCookie(t,e){document.cookie=`${t}=${e}`},getCookie(t){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${t}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(t,e){e&&Se.setCookie("__phoenix_flash__",e+"; max-age=60000; path=/"),window.location=t},localKey(t,e){return`${t}-${e}`},getHashTargetEl(t){let e=t.toString().substring(1);if(e!=="")return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},F=Se;var Ee=24*60*60*1e3,ve="df",xe="random-userid",w="session",B="apps",we="tab-id",Ie=window.localStorage,De=window.sessionStorage;function I(t,e=Ie){return F.getLocal(e,ve,t)}function p(t,e,r=Ie){return ye()?F.updateLocal(r,ve,t,e,()=>e):null}function Be(){return{id:y().replaceAll("-",""),expiry:new Date().getTime()+Ee,live:[]}}function D(){let t=I(w);return(!t||Ye(t))&&(t=Be()),p(w,t)}function Ye({expiry:t}){return tr!==t),p(w,e),p(B,e.live.join())},getLastUsedApps(){return I(B)||""},isLive(...t){let e=D();return e===null?!1:t.some(n=>e.live.includes(n))}};function qe(){return{"content-type":"application/json"}}function L(r){return c(this,arguments,function*(t,e={}){return(yield fetch(t,g({method:"GET",cache:"no-cache",mode:"cors",headers:qe()},e))).json()})}var Y=class{constructor(e){this.zone=e}add(u,m,l){return c(this,arguments,function*(e,r,{id:n,title:o,price:i},s=1){let b=`${this.url(e)}/cart/${f.getSessionId()||""}`,Te=JSON.stringify({amount:s,id:n,title:o,price:i,index:r});return L(b,{method:"PUT",body:Te})})}remove(e,r,n,o=1){return c(this,null,function*(){let i=`${this.url(e)}/cart/${f.getSessionId()||""}`,s=JSON.stringify({amount:o,id:n,index:r});return L(i,{method:"PATCH",body:s})})}clear(e){return c(this,null,function*(){let r=`${this.url(e)}/cart/${f.getSessionId()||""}`;return L(r,{method:"DELETE"})})}checkout(e){return c(this,null,function*(){let r=JSON.stringify({session_id:f.getSessionId(),user_id:f.getUserId(),sources:f.getLastUsedApps().split(",")});return L(`${this.url(e)}/checkout`,{method:"PUT",body:r})})}url(e){return`https://${this.zone}-search.doofinder.com/6/${e}/stats`}};var ze={get Session(){return f},buildCart(t){return new Y(t)}},Le=ze;var q=W([U,G]),Qe=X(q);document.addEventListener("doofinder.register",t=>{let{name:e,entrypoint:r}=t.detail;q[e].resolve(r)});var Je={vsn:"1.6.22",getRegistry(t){return q[t]},load(t,e){ge(),H(),Ge(t,e,"search")},enableDebug:ee,disableDebug:te,setLayerServerUrl:pe,setCDNServerUrl:fe,enableCookies:H,disableCookies:_e};function Ge(t,e,r){de(t,r).then(n=>{var i;n.css.forEach(j),n.custom_css.forEach(O);let o=(i=n.custom_properties)==null?void 0:i.join(` `);t=me(t,n),t.trigger=We(t),Qe(U,function(s){he.then(()=>{let u=s.create(t);O(`#${u.mount.id} { ${o||""} }`),typeof e=="function"&&e(u)})}),n.js.forEach(A)}).catch(n=>{console.error("[Doofinder] error retrieving resources:",n)})}function We(t){let{autoload:e,trigger:r}=t,n=new P(r);return n.enabled=!e||e.trigger,n}Object.defineProperty(window,"Doofinder",{value:Le,writable:!1});Object.defineProperty(window,"doofinderLoader",{value:Je,writable:!1});})();