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