@magicx-eng/ai-autocomplete-vanilla 0.82.0 → 0.82.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- function H(t){return t==="date"||t==="date-range"}function F(t){return t!=="options"}function te(t){return t?.type?.kind==="date"?"date":t?.type?.kind==="date_range"?"date-range":t?.type?.kind==="time"?"time":t?.type?.kind==="location"&&!t.options?.length?"location":"options"}var Dt=/[\p{L}\p{N}]/u,Ol=/['\u2019-]/;function mr(t,e,n){let i=t[e];if(i===void 0)return!1;if(Dt.test(i))return!0;let o=t[e+n];return Ol.test(i)&&o!==void 0&&Dt.test(o)}function kl(t,e,n){let i=e+n.length;return!(Dt.test(n[0])&&mr(t,e-1,-1)||Dt.test(n[n.length-1])&&mr(t,i,1))}function oe(t,e,n=0,i=()=>!0){if(e.length===0)return t.indexOf(e,n);let o=-1,r=t.indexOf(e,n);for(;r!==-1;){if(i(r)){if(kl(t,r,e))return r;o===-1&&(o=r)}r=t.indexOf(e,r+1)}return o}function R(t,e){let n=t,i={},o=[],r=[],s=0;for(let a of e){let l=(i[a.parameter]??0)+1;i[a.parameter]=l;let u=`{{${a.parameter.toUpperCase().replace(/\s+/g,"_")}_${l}}}`,d=p=>oe(n,a.text,p,m=>!r.some(g=>m<g.end&&m+a.text.length>g.start)),f=d(s);if(f===-1&&(f=d(0)),f!==-1){n=n.slice(0,f)+u+n.slice(f+a.text.length);let p=u.length-a.text.length;for(let m of r)m.start>=f+a.text.length&&(m.start+=p,m.end+=p);r.push({start:f,end:f+u.length}),s=f>=s?f+u.length:s+p}o.push({...a,placeholder:u})}return{rawQuery:n,completedParams:o}}var pr="skipped";function we(t,e){if(t.some(o=>"group"in o)&&(t=t.map(o=>{let{group:r,...s}=o;return s})),e.length===0)return t;let n=new Set(t.map(o=>o.parameter)),i=e.filter(o=>!n.has(o.parameter)).map(o=>({placeholder:"",parameter:o.parameter,text:pr,kind:null}));return i.length>0?[...t,...i]:t}function Ht(t,e,n){return JSON.stringify([t,we(e,n).map(i=>[i.placeholder,i.parameter,i.value??i.text??""])])}function Re(t){let{rawQuery:e,completedParams:n}=R(t.text,t.completedParams);return Ht(e,n,t.skippedParams)}var Ml="https://api.ai-autocomplete.com",Rl="/api/suggest",gr=`${Ml}${Rl}`,_l="/telemetry/events",Dl="/starting-state",Hl="/locations/autocomplete",hr=new Map([["api.ai-autocomplete.com","cdn.ai-autocomplete.com"],["dev-api.ai-autocomplete.com","dev-cdn.ai-autocomplete.com"]]),fr=/\/suggest(?=[?#]|$)/;function Nt(t){return t?.endpoint??gr}function br(t,e){let n=Nt(t);return fr.test(n)?n.replace(fr,e):null}function yr(t){return t?.telemetryEndpoint||br(t,_l)}function Sr(t){if(t?.locationEndpoint)return t.locationEndpoint;let e=Nt(t),n=e.indexOf("?"),i=n<0?e:e.slice(0,n),o=n<0?"":e.slice(n+1);if(!/\/suggest\/?$/.test(i))return null;let r=i.replace(/\/suggest\/?$/,Hl);return o?`${r}?${o}`:r}function Tr(t){if(t?.startingStateEndpoint)return t.startingStateEndpoint;let e=br(t,Dl);return e===null?null:Nl(e)}function vr(t,e){let n=t.search(/[?#]/),i=n<0?t:t.slice(0,n),o=n<0?"":t.slice(n);return`${i.replace(/\/+$/,"")}${e}${o}`}function xr(t){let e;try{e=new URL(t??gr).host}catch{return null}let n=hr.get(e);return n?`https://${n}`:null}function Nl(t){return t.replace(/^https:\/\/([^/?#]+)/,(e,n)=>{let i=hr.get(n);return i?`https://${i}`:e})}var Xn="aiaPlace",Ft=2,Pr=250,Er=new Set("new san los las santa saint st fort port north south east west lake mount el la rio de palm long grand cape salt hong".split(" ")),wr=new Set("city beach springs falls island park heights valley bay".split(" ")),Fl=new Set("a an the in at to off on of from for by near into onto around via toward towards up out and or with within".split(" "));function Lr(t){let e=Wl(t);for(;e.length>0&&Fl.has(e[0].toLowerCase().replace(/[.,]+$/,""));)e.shift();return e.join(" ")}function Wl(t){let e=t.trim().split(/\s+/).filter(Boolean);if(e.length===0)return[];let n=e[e.length-1].replace(/[.,]+$/,"");if(!n)return[];let i=e.length>1?e[e.length-2]:void 0,o=e.length>2?e[e.length-3]:void 0,r=s=>s.toLowerCase().replace(/[.,]+$/,"");return i&&o&&Er.has(r(o))&&wr.has(r(n))?[o,i,n]:i&&(Er.has(r(i))||wr.has(r(n)))?[i,n]:[n]}function Cr(t){let e=t.secondary?.split(",")[0]?.trim();return e?`${t.name}, ${e}`:t.name}function jn(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/\s+/g," ").trim()}function Jn(t,e){let n=jn(e);if(!n)return!1;if(jn(t.name)===n)return!0;for(let[,i]of t.name.matchAll(/\(([^()]*)\)/g))if(jn(i)===n)return!0;return!1}function Ar(t,e){let n=e.metadata?.[Xn];if(typeof n?.name!="string")return 0;let i={id:"",name:n.name},o=[...t.matchAll(/\S+/g)];for(let r of o){let s=r.index??0,a=t.slice(s).trim().replace(/[.,]+$/,"");if(Jn(i,a))return t.length-s}return 0}function Zn(t){return typeof t=="string"?{text:t,is_tappable:!0,kind:null}:{text:Cr(t),is_tappable:!0,kind:null,metadata:{[Xn]:{id:t.id,name:t.name}}}}function ei(t){return Sr(t)}function Ir(t){let e=t?.places;if(!Array.isArray(e))return[];let n=[];for(let i of e){let{id:o,name:r,secondary:s}=i??{};typeof o!="string"||!o||typeof r!="string"||!r.trim()||n.push({id:o,name:r.trim(),...typeof s=="string"&&s.trim()?{secondary:s.trim()}:{}})}return n}var Wt=class{constructor(e){this.config=e;this.current=null;this.expiresAt=null;this.inFlightRefresh=null;e.accessToken&&(this.current=e.accessToken)}async getToken(e=!1){if(!e&&this.current&&!this.isExpired())return this.current;if(!e&&this.inFlightRefresh)return this.inFlightRefresh;this.inFlightRefresh=this.refresh();try{return await this.inFlightRefresh}finally{this.inFlightRefresh=null}}async refresh(){let e=await this.config.getAccessToken();return this.current=e.accessToken,this.expiresAt=e.expiresAt??null,this.current}isExpired(){return this.expiresAt==null?!1:Date.now()>=this.expiresAt-3e4}};var Or=new WeakMap;function rt(t){return t?.type==="accessToken"}function Bl(t){if(!(!t||rt(t)))return t}function Bt(t){let e=Or.get(t.getAccessToken);return e||(e=new Wt(t),Or.set(t.getAccessToken,e)),e}function Vt(t){return{"Content-Type":"application/json",...t?.appIdentifier&&{"X-App-Identifier":t.appIdentifier},...t?.headers}}function Ut(t){let e=Bl(t),n=e?.apiKey;return n?(e?.authScheme??"Bearer")==="Basic"?`Basic ${btoa(n)}`:`Bearer ${n}`:null}function st(t){return t.map(e=>({parameter:e.parameter,text:e.text}))}var Vl="0.82.0",Rr="1.0",kr=!1;function Ul(t,e){return{placeholder:t.placeholder,parameter:t.parameter,...e&&{text:t.value??t.text},kind:t.kind}}function re(t){return t??(typeof navigator<"u"?navigator.language:"en-US")}function $l(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}catch{return}}function ql(t,e,n,i,o,r,s,a,l,c,u,d,f,p,m,g){let b=e.find(E=>E.parameter==="contact"&&E.metadata?.contact_account_count)?.metadata?.contact_account_count,T=typeof b=="number"?b:void 0,S=$l();return{data:{raw_query:t,...!g&&{accepts_traditional_autocomplete:!0},...p&&{traditional_autocomplete_only:!0},client_option_parameters:f??[],completed_params:we(e.map(E=>Ul(E,n)),l??[]),...s&&s.length>0&&{identified_params:st(s)},...a&&a.length>0&&{recently_suggested:a},...T!=null&&{contact_account_count:T},...c!==void 0&&{additional_context:c}},meta:{request_id:o,request_at:new Date().toISOString(),language:re(u),...S&&{timezone:S},...d?.code&&Number.isFinite(d.rate)&&d.rate>0&&{currency:d.code,currency_rate:d.rate,...d.country!==void 0&&{country:d.country}},client_version:Vl,session_id:i,...m&&{search_id:m},source:r,schema_version:Rr}}}async function Mr(t,e,n,i,o){return fetch(t,{method:"POST",headers:{...e,Authorization:`Bearer ${n}`},body:i,signal:o})}async function ti(t,e,n){let i=n.apiConfig,o=!n.maskCompletedText,r=ql(t,e,o,n.sessionId,n.requestId??crypto.randomUUID(),n.source,n.identifiedParams,n.recentlySuggested,n.skippedParams,n.additionalContext,n.language,n.currency,n.clientOptionParameters,n.traditionalAutocompleteOnly,n.searchId,n.fullAnswer),s=Nt(i),a=await _r(s,JSON.stringify(r),i,n.signal);if(!a.ok)throw new Error(`API error: ${a.status} ${a.statusText}`);return a.json()}async function _r(t,e,n,i){let o=Vt(n);if(rt(n)){let s=Bt(n),a=await s.getToken(),l=await Mr(t,o,a,e,i);if(l.status===401){let c=await s.getToken(!0);l=await Mr(t,o,c,e,i)}return l}let r=Ut(n);return!r&&!kr&&(kr=!0,console.warn("[Intent-1] No apiKey in apiConfig. Requests will be sent without an Authorization header.")),r&&(o.Authorization=r),fetch(t,{method:"POST",headers:o,body:e,signal:i})}var at=class extends Error{constructor(n){super(`Location search error: ${n}`);this.status=n;this.name="LocationSearchError"}};async function Dr(t,e,n){let i=JSON.stringify({query:e,session_token:n.sessionToken,language:re(n.language)}),o=await _r(t,i,n.apiConfig,n.signal);if(!o.ok)throw new at(o.status);return Ir(await o.json())}function fe(t,e,n){return e>0||!n?e:t.toLowerCase().startsWith(n.toLowerCase())?n.length:e}function _e(t,e){return e===!1?"":t}function lt(t,e,n){return e===0&&t.length>0&&n.length>0&&n.toLowerCase().startsWith(t.toLowerCase())}function ct(t,e,n){let i=t.slice(e);if(n||e===0||t[e-1]===" ")return i;let o=i.indexOf(" ");return o===-1?"":i.slice(o+1)}function Hr(t,e){let n=t.trimEnd().replace(/\s+/g," ");if(n.length===0||e.length===0)return 0;let i=n.split(" "),o=e.toLowerCase();for(let r=0;r<i.length;r++){let s=i.slice(r).join(" ");if(o.startsWith(s.toLowerCase())){let a=n.length-s.length;return t.length-a}}return 0}function Nr(t){return t.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase().replace(/[_\-\s]+/g," ")}function Gl(t,e){let n=Nr(t).trim();return n.startsWith(e)||n.includes(` ${e}`)}function ge(t,e,n=!1){if(!t)return[];let i=e.trimStart();if(!i)return t;let o=n?Nr(i).trimStart():"";if(o)return t.filter(s=>!s.is_tappable||Gl(s.text,o));let r=i.toLowerCase();return t.filter(s=>!s.is_tappable||s.text.toLowerCase().includes(r))}function $t(t,e){if(!t)return null;let n=e.trim();if(!n)return null;let i=n.toLowerCase();return t.find(o=>o.is_tappable&&o.text.toLowerCase()===i)??null}function ut(t,e,n,i,o){let r=ct(e,n,i),s=$t(t,r);if(s||!o||!r.trim())return s;if(r===e.slice(n))return null;let a=e.lastIndexOf(" ",n-1)+1;return $t(t,e.slice(a))}function Fr(t,e){let n=e.replace(/^\s+/,"").toLowerCase();for(let i=0;i<n.length;){let o=n.slice(i);if(o.trim().length>=2){let s=t.findIndex(a=>a.is_tappable&&!a.selectsAll&&a.text.toLowerCase().startsWith(o));if(s>=0)return t.map((a,l)=>l===s?{...a,liveMatch:!0}:a)}let r=n.indexOf(" ",i);if(r<0)break;i=r+1}return t}function Br(t,e){return e?t.map(n=>e[n.parameter]?{...n,options:[]}:n):t}function Vr(t,e){let{icon:n,icon_svg:i}=e;return!i||t.every(Wr)?t:t.map(o=>Wr(o)?o:{...o,icon:n,icon_svg:i})}function Wr(t){return!!(t.icon_svg||t.image_url)}function Kl(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.toLowerCase())}function se(t){let e=Kl(t);return e.length>0?e.join(" "):t}function ne(t,e){return t.parameter||e}function dt(t,e,n){return{parameter:t,suggestionParameter:t,suggestionValueType:{kind:"traditional_autocomplete"},suggestionPlaceholder:n?.trim()||se(t),...e?{suggestionHeader:e}:{}}}function mt(t){return t.suggestionValueType?.kind==="traditional_autocomplete"?{parameter:t.suggestionParameter,text:t.suggestionHeader??"",required:!0,type:t.suggestionValueType,options:t.options}:{parameter:t.suggestionParameter,text:t.suggestionPlaceholder,required:!0,options:t.options}}function qt(t,e){let n=ne(e,t.suggestionParameter);return t.suggestionValueType?.kind==="traditional_autocomplete"?dt(n,t.suggestionHeader,e.parameter_label):{parameter:n,suggestionParameter:t.suggestionParameter,suggestionValueType:t.suggestionValueType,suggestionPlaceholder:t.suggestionPlaceholder,suggestionIcon:t.suggestionIcon,suggestionIconSvg:t.suggestionIconSvg}}function A(t){return t?.type?.kind==="traditional_autocomplete"}function zl(t){let e=t?.replace(/[_\-\s]+/g," ").trim();return e?e.charAt(0).toUpperCase()+e.slice(1):void 0}function ni(t){return t.parameter_label?.trim()||zl(t.parameter)}function De(t){return A(t)||t?.smart_suggestion===!0}function ii(t){return t.some(A)?t.filter(e=>!A(e)):t}function oi(t,e){return t.some(n=>A(n)&&!n.text)?t.map(n=>A(n)&&!n.text?{...n,text:e}:n):t}var ri='<svg viewBox="0 0 20 20" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false"><path class="aia-sparkle-large" d="M8 5C8.5 9.5 10.5 11.5 15 12C10.5 12.5 8.5 14.5 8 19C7.5 14.5 5.5 12.5 1 12C5.5 11.5 7.5 9.5 8 5Z"/><path class="aia-sparkle-small" d="M16 1C16.2 3 17 3.8 19 4C17 4.2 16.2 5 16 7C15.8 5 15 4.2 13 4C15 3.8 15.8 3 16 1Z"/></svg>';function si(t){return t.some(e=>!A(e))}function Ur(t,e){let n=0,i=e;for(let o of t)n+=o.value.length,o.type!=="text"&&(i=Math.max(i,n));return i}function $r(t,e){let n=0;for(let i of t){let o=n+i.value.length;if(i.type==="text"&&o>e&&i.value.slice(Math.max(e-n,0)).trim().length>0)return!1;n=o}return!0}function qr(t,e){let n=[],i=new Map;for(let o of[...t,...e]){if(o.parameter==="placeholder"||A(o))continue;let r=i.get(o.parameter);r||(r={parameter:o.parameter,text:o.text},i.set(o.parameter,r),n.push(r));for(let s of o.options??[])!s.is_tappable||r.options?.includes(s.text)||(r.options??(r.options=[]),r.options.push(s.text))}return n}function Gr(t,e,n){if(t===e)return n;let i=Math.min(t.length,e.length),o=0;for(;o<i&&t[o]===e[o];)o++;if(o>=n)return n;let r=0;for(;r<i-o&&t[t.length-1-r]===e[e.length-1-r];)r++;return t.length-r<=n?n+(e.length-t.length):null}function Gt(t,e){let n=[],i=[],o=0;for(let r of e){let s=oe(t,r.text,o);if(s===-1){i.push(r);continue}n.push({start:s,end:s+r.text.length,param:r}),o=s+r.text.length}return{located:n,missing:i}}function Pe(t,e){let{located:n}=Gt(t,e);return n.length>0?n[n.length-1].end:0}function Kr(t,e,n){let i=[],o=[],r=0;for(let s of n){let a=oe(t,s.text,r,l=>!e.some(c=>l<c.end&&l+s.text.length>c.start));if(a===-1){o.push(s);continue}i.push({start:a,end:a+s.text.length,param:s}),r=a+s.text.length}return{located:i,missing:o}}function Kt(t,e,n=[]){let i=Gt(t,e).located,o=[];for(let u of i){let d=o[o.length-1];u.param.group&&d?.param.group===u.param.group?(d.end=u.end,d.params?.push(u.param)):o.push({...u,...u.param.group?{params:[u.param]}:{}})}let r=Kr(t,o,n).located,s=[...o.map(u=>({start:u.start,end:u.end,segment:{type:"completed",value:t.slice(u.start,u.end),param:u.param,...u.params?{params:u.params}:{}}})),...r.map(u=>({start:u.start,end:u.end,segment:{type:"identified",value:u.param.text,param:u.param}}))].sort((u,d)=>u.start-d.start),a=[],l=0;for(let u of s)u.start>l&&a.push({type:"text",value:t.slice(l,u.start)}),a.push(u.segment),l=u.end;let c=t.slice(l);return c&&a.push({type:"text",value:c}),a}function zr(t,e){let{located:n,missing:i}=Gt(t,e),o=new Set(i.map(s=>s.group).filter(Boolean)),r=n.map(s=>s.param).filter(s=>!o.has(s.group));return{valid:r,invalid:e.filter(s=>!r.includes(s))}}function pt(t,e,n){let i=Gt(t,e).located,{located:o,missing:r}=Kr(t,i,n);return{valid:o.map(s=>s.param),invalid:r}}function Qr(t,e,n){let i=Tr(e);if(i!==null)return vr(i,`/${encodeURIComponent(t)}${Ql(n)}`)}function Ql(t){let e=t?.replace(/_/g,"-").toLowerCase()??"",[n,i=""]=e.split("-");return n!=="zh"?/^[a-z]{2,3}$/.test(n)?`/${n}`:"":/^[a-z]{4}$/.test(i)?i==="hant"?"/zh-TW":"/zh":["tw","hk","mo"].includes(i)?"/zh-TW":"/zh"}async function Yr(t){try{let e=await t;if(!e.ok)return null;let n=await e.json();return Array.isArray(n?.data?.suggestions)?n:null}catch{return null}}function Yl(t){if(t instanceof Error)return t;try{return new Error(String(t))}catch{return new Error("Unknown error")}}var jr=100,jl=300,Xl=2;function Jl(t,e){return e===0&&t.trim()===""}var zt=class{constructor(e,n,i,o,r,s,a,l,c,u={}){this.store=e;this.getApiConfig=n;this.getOptionOverrides=i;this.getMaskCompletedText=o;this.getOnError=r;this.getSessionId=s;this.getSource=a;this.getAdditionalContext=l;this.getLanguage=c;this.callbacks=u;this.fetchVersion=0;this.abortController=null;this.debounceTimer=null;this.slowDebounceTimer=null;this.unsubscribe=null;this.phraseExactMatch=!1;this.previewTimer=null;this.previewAbort=null;this.previewVersion=0;this.previewPending=!1;this.shownPreview=null;this.forceNextFetch=!1;this.inFlight=null;this.answered=null;this.committing=!1}start(){this.startingStateOff()||this.doFetch("",[]);let e=this.store.get().text,n=this.store.get().completedParams;this.unsubscribe=this.store.subscribe(i=>{if(i.text!==e||i.completedParams!==n){if(e=i.text,n=i.completedParams,this.asksNothing(i.text,i.completedParams.length)){this.standDown();return}this.scheduleFetch()}})}startingStateOff(){return this.callbacks.getStartingState?.()===!1}asksNothing(e,n){return this.startingStateOff()&&Jl(e,n)}standDown(){this.abortController?.abort(),this.abortController=null,this.clearTimers(),this.clearPreview(),this.forceNextFetch=!1,this.fetchVersion++,this.inFlight=null,this.forgetAnswer();let e=this.store.get();e.suggestions.length===0&&e.products.length===0&&e.customFields===null&&!e.traditionalAutocomplete&&!e.isLoading&&!e.isReady&&e.error===null&&e.lastRawQuery===""&&e.filterBase===0&&!e.filterInProgress&&e.activeDropdownIndex===-1&&!e.skipNextFetch||this.store.set({suggestions:[],products:[],customFields:null,traditionalAutocomplete:!1,isLoading:!1,isReady:!1,error:null,lastRawQuery:"",filterBase:0,filterInProgress:!1,activeDropdownIndex:-1,skipNextFetch:!1})}isPhraseExactMatch(){return this.phraseExactMatch}answersState(e){return this.answered!==null&&this.answered.customFields===e.customFields&&this.answered.key===this.requestKey(Re(e))}forgetAnswer(){this.answered=null}requestKey(e){let n;try{n=JSON.stringify([re(this.getLanguage()),this.callbacks.getCurrency?.()??null,this.getAdditionalContext()??null])}catch{n=""}return`${e}\0${n}`}isCommitting(){return this.committing}answerCurrent(){let e=this.store.get(),{rawQuery:n,completedParams:i}=R(e.text,e.completedParams);if(this.asksNothing(n,i.length))return this.standDown(),Promise.resolve("unasked");let o=this.requestKey(Ht(n,i,e.skippedParams));return this.inFlight?.key===o?this.inFlight.settled:(this.clearTimers(),e.skipNextFetch&&this.store.set({skipNextFetch:!1}),this.doFetch(n,i,{fullAnswer:!0}),this.inFlight?.settled??Promise.resolve("superseded"))}dispose(){this.abortController?.abort(),this.clearTimers(),this.clearPreview(),this.unsubscribe?.()}previewComposition(e){this.previewTimer&&clearTimeout(this.previewTimer),this.previewPending=!0,this.previewTimer=setTimeout(()=>{this.previewTimer=null,this.doPreview(e)},jr)}endPreview(){this.shownPreview=null,this.previewPending&&(this.clearPreview(),this.forceNextFetch=!0,this.scheduleFetch())}clearPreview(){this.previewTimer&&clearTimeout(this.previewTimer),this.previewTimer=null,this.previewAbort?.abort(),this.previewAbort=null,this.previewPending=!1,this.shownPreview=null}async doPreview(e){this.previewAbort?.abort();let n=new AbortController;this.previewAbort=n;let i=++this.previewVersion;this.previewPending=!0;let o=this.fetchVersion,r=this.store.get(),{rawQuery:s,completedParams:a}=R(e,r.completedParams);try{let l=await ti(s,a,{...this.requestOptions(r,n.signal,crypto.randomUUID()),traditionalAutocompleteOnly:!0});if(i!==this.previewVersion||o!==this.fetchVersion)return;let c=(l.data.suggestions??[]).find(A);if(!c)return;let u=l.meta?.traditional_autocomplete===!0;this.shownPreview={answer:c,traditionalAutocomplete:u},this.store.set({suggestions:[c],traditionalAutocomplete:u,activeDropdownIndex:-1})}catch{}}requestOptions(e,n,i){let o=e.pendingSpan?qr(e.pendingSpan.snapshot,e.actionableSuggestions):void 0;return{sessionId:this.getSessionId(),requestId:i,source:this.getSource(),maskCompletedText:this.getMaskCompletedText(),signal:n,apiConfig:this.getApiConfig(),identifiedParams:e.identifiedParams,recentlySuggested:o,skippedParams:e.skippedParams,additionalContext:this.getAdditionalContext(),language:this.getLanguage(),currency:this.callbacks.getCurrency?.(),clientOptionParameters:Object.keys(this.getOptionOverrides()??{}),searchId:this.callbacks.getSearchId?.()}}async doFetch(e,n,{fullAnswer:i=!1}={}){if(this.asksNothing(e,n.length)){this.standDown();return}this.abortController?.abort(),this.previewAbort?.abort(),this.previewAbort=null,this.previewPending=!1,this.shownPreview=null,this.forceNextFetch=!1;let o=new AbortController;this.abortController=o;let r=++this.fetchVersion,s="superseded",a=()=>{},l={key:this.requestKey(Ht(e,n,this.store.get().skippedParams)),settled:new Promise(d=>{a=d})};this.inFlight=l;let c=this.store.get().text.length,u=this.store.get().text;try{this.callbacks.onRequest?.({query:this.store.get().text,signal:o.signal,isCurrent:()=>r===this.fetchVersion})}catch{}try{this.store.set({isLoading:!0,error:null});let d=this.store.get(),f=crypto.randomUUID(),p=e===""&&n.length===0&&d.skippedParams.length===0&&d.identifiedParams.length===0,m=p?this.startingStateUrl():void 0,g=m?await Yr(fetch(m,{signal:o.signal})):null;if(r!==this.fetchVersion)return;let b=g??await ti(e,n,{...this.requestOptions(d,o.signal,f),fullAnswer:i});if(r!==this.fetchVersion)return;this.phraseExactMatch=b.meta?.phrase_exact_match===!0;let T=(b.data.suggestions??[]).find(A),S=T?[]:b.data.input??[],E=w=>({id:crypto.randomUUID(),parameter:w.parameter,text:w.text,...w.type?{type:w.type}:{},...w.iso_date?{isoDate:w.iso_date}:{},...w.iso_date_end?{isoDateEnd:w.iso_date_end}:{}}),y=S.filter(w=>w.source==="identified");this.callbacks.waitIdentified?.(y.filter(w=>w.state==="need_confirmation").map(E),u);let h=y.filter(w=>w.state!=="need_confirmation").map(E),x=this.callbacks.isWordOpen?.()??!1,P=this.store.get().text.toLowerCase(),v=w=>x&&P.endsWith(w.text.toLowerCase()),L=h.filter(w=>!v(w));x&&this.callbacks.holdIdentified?.(h.filter(v));let O=T?[T]:Br(b.data.suggestions??[],this.getOptionOverrides());this.startingStateOff()&&(O=O.filter(w=>w.parameter!=="placeholder"));let I=S,K=I[I.length-1],M=this.store.get().text,z,Z;if(K?.state==="in_progress"){Z=!0;let w=M.toLowerCase().lastIndexOf(K.text.toLowerCase());z=w!==-1?w:c}else Z=!1,z=c;let C=O.filter(w=>w.parameter!=="placeholder")[0],de=null;if(C&&!A(C)&&!x&&C.type?.kind!=="multi_select"&&!F(te(C))){let w=ut(C.options,M,z,Z,this.phraseExactMatch);w&&(de={id:crypto.randomUUID(),placeholder:"",parameter:ne(w,C.parameter),text:w.text,value:w.value,kind:w.kind,suggestionParameter:C.parameter,suggestionValueType:C.type,suggestionPlaceholder:C.text,suggestionIcon:C.icon,suggestionIconSvg:C.icon_svg,options:C.options??[],metadata:w.metadata,icon:w.icon,icon_svg:w.icon_svg,image_url:w.image_url},O=O.filter(Ee=>Ee!==C),this.callbacks.onAutoMatch?.({active:C,matched:w,rawQuery:e}))}let ve=b.data.custom_fields??null,xe=this.callbacks.productsForResponse?.(ve);this.answered=T?null:{key:l.key,customFields:ve};let kt=w=>{let Ee=de?[...w.completedParams,de]:w.completedParams;de&&this.answered&&w.text===u&&(this.answered={...this.answered,key:this.requestKey(Re({text:w.text,completedParams:Ee,skippedParams:w.skippedParams}))});let ke=new Set,dr=pt(w.text,Ee,L).valid.map(D=>{let it=w.identifiedParams.find(Me=>!ke.has(Me.id)&&Me.parameter===D.parameter&&Me.text===D.text);return it?(ke.add(it.id),{...D,id:it.id}):D}),Mt=new Set(d.skippedParams.map(D=>D.id)),Rt=new Set(w.skippedParams.filter(D=>!Mt.has(D.id)).map(D=>D.parameter)),nt=Rt.size>0?O.filter(D=>D.parameter==="placeholder"||!Rt.has(D.parameter)):O,_t=this.callbacks.getAllOption?.()===!0&&!p,me=w.composing?this.shownPreview:null;return{suggestions:me?[me.answer]:_t?nt.map(D=>D.parameter==="placeholder"?D:{...D,leadsWithAll:!0}):nt,isLoading:!1,isReady:b.data.is_ready??!1,lastRawQuery:e,activeDropdownIndex:-1,filterBase:z,filterInProgress:Z,identifiedParams:dr,customFields:ve,traditionalAutocomplete:me?me.traditionalAutocomplete:b.meta?.traditional_autocomplete===!0,...xe!==void 0?{products:xe}:{},...de?{completedParams:Ee}:{}}};this.committing=!0;try{this.store.set(kt)}finally{this.committing=!1}s="committed",this.callbacks.onResponse?.({requestId:f,funnelTelemetry:b.meta?.funnel_telemetry===!0,visibleImpression:b.meta?.visible_impression===!0,sdkVisitorId:b.meta?.sdk_visitor_id===!0,searchIds:b.meta?.search_ids===!0})}catch(d){let f=Yl(d);s!=="committed"&&r===this.fetchVersion&&(s="failed"),r===this.fetchVersion&&(this.store.set({error:f,isLoading:!1}),this.getOnError()?.(f))}finally{if(r===this.fetchVersion&&this.store.get().isLoading)try{this.store.set({isLoading:!1})}catch{}this.inFlight===l&&(this.inFlight=null),a(s)}}startingStateUrl(){let e=this.callbacks.getProductId?.();return e?Qr(e,this.getApiConfig(),re(this.getLanguage())):void 0}attemptNow(){if(this.clearTimers(),this.store.get().skipNextFetch){this.store.set({skipNextFetch:!1});return}this.attemptFetch(1,!0)}scheduleFetch(){if(this.clearTimers(),this.store.get().skipNextFetch){this.store.set({skipNextFetch:!1});return}this.debounceTimer=setTimeout(()=>{this.attemptFetch(Xl)&&this.slowDebounceTimer&&clearTimeout(this.slowDebounceTimer)},jr),this.slowDebounceTimer=setTimeout(()=>this.attemptFetch(1,!0,!0),jl)}attemptFetch(e,n=!1,i=!1){let o=this.store.get();if(!o.text&&o.completedParams.length===0)return this.doFetch("",[]),!0;let r=this.callbacks.consumerTick?.(o,e)??"no";if(r==="asked")return!0;if(r==="owns")return!1;if(this.forceNextFetch){let{rawQuery:x,completedParams:P}=R(o.text,o.completedParams);return this.doFetch(x,P),!0}let s=_e(o.suggestions.filter(x=>x.parameter==="placeholder").map(x=>x.text).join(" "),this.callbacks.getPrependPlaceholder?.()),a=fe(o.text,o.filterBase,s),l=ct(o.text,a,o.filterInProgress),c=o.suggestions.filter(x=>x.parameter!=="placeholder"),u=A(c[0])?void 0:c[0],d=F(o.activeFormatType),f=u&&!d?ge(u.options,l,o.traditionalAutocomplete):[];if(o.multiSelectView&&l.trim().length>0&&f.length>0)return!1;let p=f.filter(x=>x.is_tappable),m=u&&!d&&!this.callbacks.isWordOpen?.()?ut(u.options,o.text,a,o.filterInProgress,this.phraseExactMatch)!==null:!1,g=l.trim().length>0,b=i&&o.products.length>0;if(p.length>0&&!m&&g&&!b||lt(o.text,o.completedParams.length,s))return!1;let{rawQuery:T,completedParams:S}=R(o.text,o.completedParams),E=T.length<o.lastRawQuery.length,y=Math.abs(T.length-o.lastRawQuery.length),h=n&&T!==o.lastRawQuery;return E||y>=e||h?(this.doFetch(T,S),!0):!1}clearTimers(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.slowDebounceTimer&&clearTimeout(this.slowDebounceTimer),this.debounceTimer=null,this.slowDebounceTimer=null}};function Zl(t){return t.nodeType===Node.DOCUMENT_NODE?!0:t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in t}function he(t){let e=typeof t.getRootNode=="function"?t.getRootNode():null;return e&&Zl(e)?e:t.ownerDocument??t}function He(t){return he(t).activeElement??null}function N(t){return t.ownerDocument??t}function ec(t){return t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Xr(t){let e=he(t);return!ec(e)||typeof e.getSelection=="function"?null:e}function Jr(t){let e=Xr(t);if(!e)return null;let n=N(t).getSelection?.();return!n||typeof n.getComposedRanges!="function"?null:e}function Zr(t,e){let n=t,i;try{i=n.getComposedRanges({shadowRoots:[e]})}catch{i=n.getComposedRanges(e)}return i.length>0?i[0]:null}function Le(t){let n=he(t).getSelection?.();return n||(N(t).getSelection?.()??null)}function Q(t){let e=Le(t);if(!e||e.rangeCount===0)return null;let n=Jr(t);if(n){let i=Zr(e,n);return i?{node:i.startContainer,offset:i.startOffset,collapsed:i.startContainer===i.endContainer&&i.startOffset===i.endOffset}:null}return e.anchorNode?{node:e.anchorNode,offset:e.anchorOffset,collapsed:e.isCollapsed}:null}function Ce(t){let e=Le(t);if(!e||e.rangeCount===0)return null;let n=Jr(t);if(!n)return e.getRangeAt(0);let i=Zr(e,n);if(!i)return null;let o=N(t).createRange();return o.setStart(i.startContainer,i.startOffset),o.setEnd(i.endContainer,i.endOffset),o}function ft(t,e,n){let i=Le(t);if(!i)return null;if(Xr(t))return i.collapse(e,n),i;let o=N(t).createRange();return o.setStart(e,n),o.collapse(!0),i.removeAllRanges(),i.addRange(o),i}function Qt(t,e){let n=t?he(t):typeof document<"u"?document:null;return n?typeof n.getElementById=="function"?n.getElementById(e):typeof document<"u"?document.getElementById(e):null:null}var Yt=2,tc="magicx-aia";function es(t){return t==="auto"||t==="scroll"||t==="hidden"||t==="overlay"}function nc(t){let e=N(t),n=e.defaultView;if(!n?.getComputedStyle)return null;let i=t;for(;i&&i!==e.body&&i!==e.documentElement;){let o=i.scrollWidth>i.clientWidth,r=i.scrollHeight>i.clientHeight;if(o||r){let s=n.getComputedStyle(i);if(o&&es(s.overflowX)||r&&es(s.overflowY))return i}if(i.classList.contains(tc))return null;i=i.parentElement}return null}function ai(t){let e=Ce(t);if(!e||!e.collapsed||!t.contains(e.startContainer))return;let n=nc(t);if(!n||typeof e.getBoundingClientRect!="function")return;let i=e.getBoundingClientRect();if(i.height===0)return;let o=n.getBoundingClientRect();if(n.scrollWidth>n.clientWidth){let r=o.left+n.clientLeft,s=r+n.clientWidth;i.right>s?n.scrollLeft+=i.right-s+Yt:i.left<r&&(n.scrollLeft-=r-i.left+Yt)}if(n.scrollHeight>n.clientHeight){let r=o.top+n.clientTop,s=r+n.clientHeight;i.bottom>s?n.scrollTop+=i.bottom-s+Yt:i.top<r&&(n.scrollTop-=r-i.top+Yt)}}var ns='[contenteditable="false"]',ci="strong[data-param-id]",Ne;function ic(){if(Ne!==void 0)return Ne;let t=globalThis.Intl.Segmenter;if(!t)return Ne=null,null;try{Ne=new t(void 0,{granularity:"grapheme"})}catch{Ne=null}return Ne??null}function jt(t,e){let n=t;for(;n&&n!==e;){if(n.nodeType===Node.ELEMENT_NODE&&n.matches(ns))return!0;n=n.parentNode}return!1}function Xt(t){return N(t).createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(e){return jt(e,t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}})}function Fe(t){let e=Xt(t),n="",i=e.nextNode();for(;i;)n+=i.data,i=e.nextNode();return n}function gt(t){let e=Xt(t),n=0,i=e.nextNode();for(;i;)n+=i.data.length,i=e.nextNode();return n}function Y(t){let e=Q(t);if(!e)return null;let n=e.node,i=e.offset;if(!t.contains(n))return null;if(n.nodeType===Node.ELEMENT_NODE){let o=n;if(jt(o,t)&&o!==t)return null;let r=0;for(let s=0;s<i&&s<o.childNodes.length;s++)r+=ui(o.childNodes[s],t);return r+li(o,t)}return n.nodeType!==Node.TEXT_NODE||jt(n,t)?null:li(n,t)+i}function ui(t,e){if(t.nodeType===Node.TEXT_NODE)return jt(t,e)?0:t.data.length;if(t.nodeType!==Node.ELEMENT_NODE)return 0;let n=t;if(n.matches(ns))return 0;let i=0;for(let o of Array.from(n.childNodes))i+=ui(o,e);return i}function li(t,e){let n=Xt(e),i=0,o=n.nextNode();for(;o;){if(o===t||t.nodeType===Node.ELEMENT_NODE&&t.contains(o))return i;i+=o.data.length,o=n.nextNode()}return i}function W(t,e){let n=N(t),i=Math.max(0,Math.min(e,gt(t))),o=Xt(t),r=0,s=null,a=0,l=o.nextNode(),c=null;for(;l;){let d=l.data.length;if(i<r+d){s=l,a=i-r;break}if(i===r+d){let f=o.nextNode();f?(s=f,a=0):(s=l,a=d);break}r+=d,c=l,l=o.nextNode()}let u=n.createRange();if(s){let d=s.parentElement?.closest('strong[data-seg="completed"]');d&&d!==t&&t.contains(d)?a===0?u.setStartBefore(d):a===s.data.length?u.setStartAfter(d):u.setStart(s,a):u.setStart(s,a)}else c?u.setStart(c,c.data.length):u.setStart(t,0);u.collapse(!0),ft(t,u.startContainer,u.startOffset)&&(oc(t,u,i),ai(t))}function ts(t,e){if(!t||!e.contains(t))return null;let i=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest(ci)??null;return i&&e.contains(i)?i:null}function oc(t,e,n){let i=ts(Q(t)?.node??null,t);if(i&&i!==ts(e.startContainer,t)){t.dataset.aiaCaretEscapedChip=`${n}:${i.dataset.paramId}`;return}delete t.dataset.aiaCaretEscapedChip}function is(t,e){let n=t.dataset.aiaCaretEscapedChip;if(!n)return!1;let i=Y(t);return i!==null&&n===`${i}:${e}`}function os(t){return he(t).activeElement===t}function di(t,e){if(!e||e.nodeType===void 0)return null;let n=e,i=n.nodeType===Node.ELEMENT_NODE?n:n.parentElement;if(i?.closest("[data-aia-chip-remove]"))return null;let o=i?.closest(ci);if(!o||!t.contains(o))return null;let r=Q(t);return r&&!r.collapsed?null:o.dataset.paramId??null}function mi(t,e){let n=null;for(let s of t.querySelectorAll(ci))if(s.dataset.paramId===e){n=s;break}if(!n)return;let i=li(n,t),o=i+ui(n,t),r=Y(t);r!=null&&r>=i&&r<=o||W(t,i)}function pi(t){let e=Y(t);return e==null?!1:e>=gt(t)}function fi(t,e){if(e<=0)return 0;let n=ic();if(!n)return e-1;let i=t.slice(0,e),o=0;for(let{index:r}of n.segment(i))r<e&&(o=r);return o}var rc="(hover: none) and (pointer: coarse)";function be(){try{if(typeof window>"u")return!1;let t=window.matchMedia;return typeof t!="function"?!1:(gi?.source!==t&&(gi={source:t,list:window.matchMedia(rc)}),gi.list.matches===!0)}catch{return!1}}function sc(t){let e=He(t);return e===t||!!e?.closest("[data-aia-location]")}function hi(t){let e=Q(t);e&&t.contains(e.node)&&Le(t)?.removeAllRanges()}var gi=null;function ht(t){return t==="always"?!0:t==="never"?!1:!be()}function bt(t,e,n){if(!n&&!sc(t)){hi(t);return}t.focus(),W(t,e)}function bi(t){let e=Q(t),n=e!==null&&t.contains(e.node);t.focus(),!n&&be()&&W(t,gt(t))}var rs=150,ac="[data-aia-dropdown], [data-aia-input-wrapper]",lc=["a[href]","button","input","select","textarea","label","summary","[contenteditable]:not([contenteditable='false'])","[role='button']","[role='link']","[tabindex]:not([tabindex='-1'])"].join(", "),Jt=class{constructor(e,n){this.store=e;this.container=n;this.listening=!1;this.declined=!1;this.pressOutside=!1;this.pressWhileFocused=!1;this.recheckTimer=null;this.releaseTimer=null;this.picking=0;this.onPointerDown=e=>{let n=e.composedPath(),i=this.isInside(n);this.pressOutside=!i;let o=this.store.get();this.pressWhileFocused=o.isFocused,!(i||!o.isFocused)&&(this.declined=n.some(r=>r instanceof Element&&r.matches(lc)),this.declined&&o.dropdownHeld?this.store.set({dropdownHeld:!1}):!this.declined&&!o.dropdownHeld&&o.isDropdownOpen&&this.store.set({dropdownHeld:!0}))};this.onPointerCancel=()=>{this.pressOutside=!1,this.pressWhileFocused&&this.declined&&this.scheduleRecheck(),this.pressWhileFocused=!1};this.onPointerUp=e=>{let n=this.pressOutside&&!this.isInside(e.composedPath()),i=this.pressWhileFocused;if(this.pressOutside=!1,this.pressWhileFocused=!1,i){this.declined&&this.scheduleRecheck();return}!n||this.store.get().isFocused||(this.cancelRelease(),this.releaseTimer=setTimeout(()=>{this.releaseTimer=null;let o=this.store.get();o.dropdownHeld&&!o.isFocused&&this.store.set({dropdownHeld:!1})},rs))};this.unsubscribe=e.subscribe(()=>this.sync())}dispose(){this.unsubscribe(),this.listen(!1),this.cancelRelease(),this.recheckTimer!==null&&clearTimeout(this.recheckTimer),this.recheckTimer=null}through(e){this.picking++;try{return e()}finally{this.picking--,this.picking===0&&this.sync()}}holdThroughBlur(){let e=this.store.get();!be()||!e.isDropdownOpen||e.dropdownHeld||(this.declined=!1,this.store.set({dropdownHeld:!0}))}sync(){let e=this.store.get(),n=be();e.isFocused||(this.declined=!1),e.isDropdownOpen?e.isFocused&&!e.dropdownHeld&&!this.declined&&n&&this.store.set({dropdownHeld:!0}):e.dropdownHeld&&this.picking===0&&this.store.set({dropdownHeld:!1});let i=this.store.get();this.listen(n&&i.isDropdownOpen),i.isFocused&&this.cancelRelease()}listen(e){if(!(e===this.listening||typeof document>"u")){if(this.listening=e,e){document.addEventListener("pointerdown",this.onPointerDown,!0),document.addEventListener("pointerup",this.onPointerUp,!0),document.addEventListener("pointercancel",this.onPointerCancel,!0);return}document.removeEventListener("pointerdown",this.onPointerDown,!0),document.removeEventListener("pointerup",this.onPointerUp,!0),document.removeEventListener("pointercancel",this.onPointerCancel,!0),this.pressOutside=!1}}scheduleRecheck(){this.recheckTimer!==null&&clearTimeout(this.recheckTimer),this.recheckTimer=setTimeout(()=>{this.recheckTimer=null,!(!this.declined||!this.store.get().isFocused)&&(this.declined=!1,this.sync())},rs)}cancelRelease(){this.releaseTimer!==null&&(clearTimeout(this.releaseTimer),this.releaseTimer=null)}isInside(e){let n=this.container,i=n?.getRootNode(),o=typeof ShadowRoot<"u"&&i instanceof ShadowRoot?i.host:null;for(let r of e)if(r===n||r===o||r instanceof Element&&r.matches(ac))return!0;return!1}};var We=["January","February","March","April","May","June","July","August","September","October","November","December"],Zt=["S","M","T","W","T","F","S"],ls=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],en="aiaDate",cs="aiaDay",ss=t=>String(t).padStart(2,"0");function V(t){return`${t.getFullYear()}-${ss(t.getMonth()+1)}-${ss(t.getDate())}`}function yi(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function cc(t){let e=yi(t).getTime()-yi(new Date).getTime();return Math.round(e/864e5)}function us(t){let e=cc(t);return e>=0&&e<7?ls[t.getDay()]:Be(t)}function Be(t){return t.getFullYear()===new Date().getFullYear()?`${We[t.getMonth()]} ${t.getDate()}`:`${We[t.getMonth()]} ${t.getDate()} ${t.getFullYear()}`}function tn(t){if(!t)return null;let e=ls.findIndex(a=>a.toLowerCase()===t.trim().toLowerCase());if(e>=0){let a=yi(new Date),l=(e-a.getDay()+7)%7;return new Date(a.getFullYear(),a.getMonth(),a.getDate()+l)}let n=/^\s*([A-Za-z]+)\s+(\d{1,2})(?:\s+(\d{4}))?\s*$/.exec(t);if(!n)return null;let i=We.findIndex(a=>a.toLowerCase()===n[1].toLowerCase());if(i<0)return null;let o=Number(n[2]),r=n[3]?Number(n[3]):new Date().getFullYear(),s=new Date(r,i,o);return s.getMonth()!==i||s.getDate()!==o?null:s}function Si(t){return`${We[t.month]} ${t.year}`}function Ti(){let t=new Date;return{year:t.getFullYear(),month:t.getMonth()}}function ds(t){return{year:t.getFullYear(),month:t.getMonth()}}function vi(t,e){let n=new Date(t.year,t.month+e,1);return{year:n.getFullYear(),month:n.getMonth()}}function as(){return{text:"",is_tappable:!1,kind:null}}function xi(t){let e=new Date(t.year,t.month,1).getDay(),n=new Date(t.year,t.month+1,0).getDate(),i=[];for(let o=0;o<e;o++)i.push(as());for(let o=1;o<=n;o++){let r=new Date(t.year,t.month,o);i.push({text:us(r),is_tappable:!0,kind:null,metadata:{[en]:V(r),[cs]:o}})}for(;i.length%Zt.length!==0;)i.push(as());return i}function yt(t){let e=tn(t);return e?V(e):null}function j(t){let e=t?.metadata?.[en];return typeof e=="string"?e:null}function Ei(t){let e=t?.metadata?.[cs];return typeof e=="number"?e:null}var ms="aiaTime",Pi=5;var Li=[12,1,2,3,4,5,6,7,8,9,10,11],Ci=Array.from({length:60/5},(t,e)=>e*5),Ai=["AM","PM"];function Ue(t){return(Math.round(t)%1440+1440)%1440}function Ii(t){let e=Ue(t),n=Math.floor(e/60);return{hour:n%12===0?12:n%12,minute:e%60,period:n<12?"AM":"PM"}}function nn(t){let e=t.hour%12+(t.period==="PM"?12:0);return Ue(e*60+t.minute)}function on(t){let{hour:e,minute:n,period:i}=Ii(t);return`${e}:${String(n).padStart(2,"0")} ${i}`}function ps(t){let e=Ue(t);return`${String(Math.floor(e/60)).padStart(2,"0")}:${String(e%60).padStart(2,"0")}`}function Ve(t){return Ue(Math.round(t/5)*5)}function fs(t,e){return Ue(t+e)}var uc=/^(\d{1,2})(?::(\d{2}))?\s*([ap])\.?\s*m?\.?$/i,dc=/^(\d{1,2}):(\d{2})$/;function wi(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="noon"||e==="midday")return 720;if(e==="midnight")return 0;let n=uc.exec(e);if(n){let o=Number(n[1]),r=n[2]===void 0?0:Number(n[2]);return o<1||o>12||r>59?null:nn({hour:o,minute:r,period:n[3]==="a"?"AM":"PM"})}let i=dc.exec(e);if(i){let o=Number(i[1]),r=Number(i[2]);return o>23||r>59?null:o*60+r}return null}function gs(t){let e=wi(t.editingText);if(e!=null)return Ve(e);let n=(t.options??[]).filter(o=>o.is_tappable).map(o=>wi(o.text)).filter(o=>o!=null);if(n.length>0)return Ve(n[Math.floor((n.length-1)/2)]);let i=t.now??new Date;return Ue((i.getHours()+1)*60)}function Oi(t){return{text:on(t),is_tappable:!0,kind:null,metadata:{[ms]:ps(t)}}}var rn=30,sn=["hour","minute","period"],ki={hour:Li.map(t=>({label:String(t)})),minute:Ci.map(t=>({label:String(t).padStart(2,"0")})),period:Ai.map(t=>({label:t}))};function Mi(t){return ki[t]}function an(t,e){let n=Ii(Ve(e));return t==="hour"?Li.indexOf(n.hour):t==="minute"?Ci.indexOf(n.minute):Ai.indexOf(n.period)}function ln(t,e,n){let i=ki[t],o=Math.min(Math.max(n,0),i.length-1),r=Ii(Ve(e));return nn(t==="hour"?{...r,hour:Li[o]}:t==="minute"?{...r,minute:Ci[o]}:{...r,period:Ai[o]})}function Ri(t,e){let n=ki[t].length-1;return Math.min(Math.max(Math.round(e/rn),0),n)}function cn(t,e){return t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement?t.selectionStart!=null&&t.selectionStart===t.value.length:t instanceof HTMLElement&&t.hasAttribute("data-aia-input")?pi(t):e?.caretOffset!=null?e.caretOffset>=e.text.length:!1}function _i(t){return t instanceof HTMLElement&&t.hasAttribute("data-aia-input")?Y(t):null}var un=class{constructor(e,n){this.store=e;this.ctx=n}handleKeyDown(e){let n=this.store.get();this.handleKey(e),n.highlightByPointer&&this.store.get().activeDropdownIndex!==n.activeDropdownIndex&&this.store.set({highlightByPointer:!1})}handleKey(e){if(e.isComposing||e.keyCode===229)return;let n=this.store.get(),{listboxId:i,getOnSubmit:o}=this.ctx,r=e.target instanceof Node?e.target:null,s=this.getEffectiveColumns(r),a=o(),l=this.getTappableIndices(s);if((e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)&&(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight"))return;let c=this.ctx.getOptionsPosition()==="above";if(n.multiSelectView&&n.isDropdownOpen){let u=n.highlightByPointer?void 0:n.filteredOptions[n.activeDropdownIndex];if(e.key===" "&&!n.optionQuery&&u?.is_tappable){e.preventDefault(),this.ctx.selectOption(u);return}if(e.key==="Enter"){e.preventDefault(),n.multiSelectView.picked.length===0&&u?.is_tappable&&this.ctx.selectOption(u),this.ctx.commitMultiSelect?.();return}}if(!this.handleTimeWheelKey(e,n))switch(e.key){case"ArrowDown":{let u=cn(e.target,n),d=!!n.editingParam;if(!u&&!d&&n.activeDropdownIndex<0)break;if(n.activeDropdownIndex<0){if(c)break;e.preventDefault();let m=H(n.activeFormatType)?this.dateEntryIndex(n,!1):l[0]??0;if(!n.isDropdownOpen&&n.actionableSuggestions.length>0){this.store.set({pillTapped:!0,activeDropdownIndex:m});break}if(l.length===0)return;this.store.set({activeDropdownIndex:m});break}if(e.preventDefault(),l.length===0)return;if(H(n.activeFormatType)){this.stepDateWeek(n,7);break}if(n.filteredOptions.length>0){let m=Math.floor((n.filteredOptions.length-1)/s);if(Math.floor(n.activeDropdownIndex/s)===m){this.store.set({activeDropdownIndex:-1});break}}let f=l.indexOf(n.activeDropdownIndex),p=f<l.length-1?f+1:0;this.store.set({activeDropdownIndex:l[p]});break}case"ArrowUp":{if(n.activeDropdownIndex<0){if(!c)break;let f=cn(e.target,n),p=!!n.editingParam;if(!f&&!p)break;e.preventDefault();let m=H(n.activeFormatType)?this.dateEntryIndex(n,!0):this.firstTappableInBottomRow(s)??l[0]??0;if(!n.isDropdownOpen&&n.actionableSuggestions.length>0){this.store.set({pillTapped:!0,activeDropdownIndex:m});break}if(l.length===0)return;this.store.set({activeDropdownIndex:m});break}if(l.length===0)break;if(e.preventDefault(),H(n.activeFormatType)){this.stepDateWeek(n,-7);break}if(n.activeDropdownIndex<s){this.store.set({activeDropdownIndex:-1});break}let u=l.indexOf(n.activeDropdownIndex),d=u>0?u-1:l.length-1;this.store.set({activeDropdownIndex:l[d]});break}case"ArrowRight":{if(n.activeDropdownIndex>=0){if(e.preventDefault(),H(n.activeFormatType)){this.stepDateDay(n,1);break}if(n.activeDropdownIndex%s<s-1){let f=n.activeDropdownIndex+1;f<n.filteredOptions.length&&n.filteredOptions[f]?.is_tappable&&this.store.set({activeDropdownIndex:f})}break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingTail!=null){e.preventDefault();let d=e.target.closest("[data-aia-input]")??e.target,f=n.editingTail;this.ctx.exitEditMode?.(),W(d,f);break}cn(e.target,n)&&n.actionableSuggestions.length>=1&&(e.preventDefault(),this.ctx.skipActivePill());break}case"ArrowLeft":{if(n.activeDropdownIndex>=0){if(e.preventDefault(),H(n.activeFormatType)){this.stepDateDay(n,-1);break}if(n.activeDropdownIndex%s>0){let u=n.activeDropdownIndex-1;u>=0&&n.filteredOptions[u]?.is_tappable&&this.store.set({activeDropdownIndex:u});break}if(!n.editingParam&&this.ctx.startEditingParamAtCaret){let u=_i(e.target);u!=null&&this.ctx.startEditingParamAtCaret(u)}break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingAnchor!=null){e.preventDefault();let u=e.target.closest("[data-aia-input]")??e.target,d=n.editingAnchor;this.ctx.exitEditMode?.(),W(u,d);break}if(this.ctx.startEditingParamAtCaret){let u=_i(e.target);u!=null&&this.ctx.startEditingParamAtCaret(u)&&e.preventDefault()}break}case"Backspace":{if(n.editingParam||!this.ctx.removeParamAtCaret)break;let u=_i(e.target);if(u==null)break;this.ctx.removeParamAtCaret(u)&&e.preventDefault();break}case"Enter":{e.preventDefault(),n.activeDropdownIndex>=0&&n.filteredOptions[n.activeDropdownIndex]?.is_tappable?this.clickOrSelect(n.activeDropdownIndex,n.filteredOptions,i,r):a&&this.ctx.submit();break}case"Tab":{if(this.ctx.endTypedWord?.()){e.preventDefault();break}let u=n.filteredOptions.map((p,m)=>p.is_tappable?m:-1).filter(p=>p!==-1);if(u.length===0)break;if(!n.isDropdownOpen){if(n.actionableSuggestions.length===0)break;e.preventDefault();let p=e.shiftKey?u[u.length-1]:u[0];this.store.set({pillTapped:!0,activeDropdownIndex:p});break}e.preventDefault();let d=u.indexOf(n.activeDropdownIndex);if(!e.shiftKey&&!H(n.activeFormatType)&&!n.multiSelectView){let p=d>=0?u[d]:u.find(m=>!n.filteredOptions[m]?.selectsAll);if(p===void 0)break;this.clickOrSelect(p,n.filteredOptions,i,r);break}let f;if(d<0)f=e.shiftKey?u.length-1:0;else{let p=e.shiftKey?-1:1;f=(d+p+u.length)%u.length}this.store.set({activeDropdownIndex:u[f]});break}case"Escape":{if(n.dateRangeStart){this.store.set({pendingRangeStart:null});break}if(n.editingIdentified){this.ctx.exitEditingIdentified?.(),this.store.set({activeDropdownIndex:-1});break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingTail!=null){let u=e.target.closest("[data-aia-input]")??e.target,d=n.editingTail;this.ctx.exitEditMode?.(),W(u,d)}this.store.set({activeDropdownIndex:-1});break}}}handleTimeWheelKey(e,n){let i=n.timeView;if(n.activeFormatType!=="time"||!i||!n.isDropdownOpen)return!1;switch(e.key){case"ArrowDown":case"ArrowUp":return!cn(e.target,n)&&!n.editingParam?!1:(e.preventDefault(),this.ctx.stepTime?.(e.key==="ArrowDown"?5:-5),!0);case"Enter":return i.touched?(e.preventDefault(),this.ctx.commitTime?.(),!0):!1;case"Escape":return i.touched?(this.store.set({timeDraft:null}),!0):!1;default:return!1}}firstTappableInBottomRow(e){let n=this.store.get();if(n.filteredOptions.length===0)return null;let o=Math.floor((n.filteredOptions.length-1)/e)*e;for(let r=o;r<n.filteredOptions.length;r++)if(n.filteredOptions[r]?.is_tappable)return r;return null}dateEntryIndex(e,n){if(e.dateFloor){let s=e.filteredOptions.findIndex(a=>j(a)===e.dateFloor);if(s>=0)return s}let i=V(new Date),o=e.filteredOptions.findIndex(s=>j(s)===i);if(o>=0)return o;let r=e.filteredOptions.map((s,a)=>s.is_tappable?a:-1).filter(s=>s!==-1);return(n?r[r.length-1]:r[0])??0}stepDateDay(e,n){for(let i=e.activeDropdownIndex+n;i>=0&&i<e.filteredOptions.length;i+=n)if(e.filteredOptions[i]?.is_tappable){this.store.set({activeDropdownIndex:i});return}}stepDateWeek(e,n){let i=e.activeDropdownIndex+n;this.store.set({activeDropdownIndex:e.filteredOptions[i]?.is_tappable?i:-1})}getTappableIndices(e){let i=this.store.get().filteredOptions.map((r,s)=>r.is_tappable?s:-1).filter(r=>r!==-1),o=Array.from({length:e},()=>[]);for(let r of i)o[r%e].push(r);return o.flat()}getEffectiveColumns(e){let n=Qt(e,this.ctx.listboxId);if(!n)return this.store.get().multiSelectView?1:this.ctx.columns;let o=Qt(e,`${this.ctx.listboxId}-option-0`)?.parentElement??null;for(;o;){let r=getComputedStyle(o).gridTemplateColumns;if(r&&r!=="none"){let s=r.split(" ").filter(Boolean).length;if(s>0)return s}if(o===n)break;o=o.parentElement}return this.ctx.columns}clickOrSelect(e,n,i,o){let r=Qt(o,`${i}-option-${e}`);r?r.click():this.ctx.selectOption(n[e])}};var dn=class{constructor(e,n,i={}){this.store=e;this.getOverrides=n;this.callbacks=i;this.unsubscribe=null;this.current=null;this.version=0;this.lastMiss=null;this.hasLoggedError=!1}start(){this.unsubscribe=this.store.subscribe(e=>this.sync(e)),this.sync(this.store.get())}dispose(){this.unsubscribe?.(),this.unsubscribe=null,this.cancel(),this.current=null}reset(){this.cancel(),this.current=null,this.lastMiss=null}refresh(){this.reset(),this.sync(this.store.get())}hasOverride(e){return!!this.getOverrides()?.[e]}owns(e,n){return this.hasOverride(e)&&!this.missCovers(e,n)}tick(e,n){let i=this.resolveTarget(e);if(!i||this.missCovers(i.parameter,i.query))return"no";let o=this.current;if(o&&o.key===i.key){if(o.query===i.query)return"owns";let r=Math.abs(i.query.length-o.query.length),s=i.query.length<o.query.length;if(n>1&&!s&&r<n)return"owns"}return this.ask(i),"asked"}sync(e){let n=this.resolveTarget(e);if(!n){this.current&&(this.cancel(),this.current=null),e.optionSearch&&this.store.set({optionSearch:null});return}this.current&&this.current.key===n.key||this.ask(n)}resolveTarget(e){if(F(e.activeFormatType)||e.editingIdentified)return null;let n=e.editingParam;if(n&&e.editingAnchor!=null)return this.hasOverride(n.suggestionParameter)?{mode:"edit",key:n.id,parameter:n.suggestionParameter,suggestion:{parameter:n.suggestionParameter,text:n.suggestionPlaceholder,required:!0,options:n.options,icon:n.suggestionIcon,icon_svg:n.suggestionIconSvg},query:e.optionQuery}:null;let i=e.actionableSuggestions[0];return!i||!this.hasOverride(i.parameter)?null:{mode:"pill",key:i,parameter:i.parameter,suggestion:i,query:e.optionQuery}}missCovers(e,n){return this.lastMiss!=null&&this.lastMiss.parameter===e&&this.lastMiss.query===n}ask(e){this.cancel();let n=this.getOverrides()?.[e.parameter],i=++this.version;if(!n||this.missCovers(e.parameter,e.query)){this.current={key:e.key,parameter:e.parameter,query:e.query,abort:null},this.setSearch(e,"done");return}let o=new AbortController;this.current={key:e.key,parameter:e.parameter,query:e.query,abort:o};let r;try{r=n(e.query,o.signal,e.suggestion)}catch(s){this.logOnce(s),this.commit(e,[],i);return}if(Array.isArray(r)){this.commit(e,r,i);return}this.setSearch(e,"loading"),this.await(e,r,o.signal,i)}async await(e,n,i,o){let r;try{let s=await n;if(i.aborted||o!==this.version)return;r=Array.isArray(s)?s:[]}catch(s){if(i.aborted||o!==this.version||mc(s))return;this.logOnce(s),r=[]}this.commit(e,r,o)}commit(e,n,i){if(i!==this.version)return;let o=Vr(n,e.suggestion),r=this.resolveTarget(this.store.get());if(!r||r.key!==e.key)return;o.length===0?this.lastMiss={parameter:e.parameter,query:e.query}:this.lastMiss?.parameter===e.parameter&&(this.lastMiss=null);let s={parameter:e.parameter,query:e.query,status:"done"};if(e.mode==="edit")this.store.set(a=>({editingParam:a.editingParam&&a.editingParam.id===e.key?{...a.editingParam,options:o}:a.editingParam,optionSearch:s}));else{let a={...e.suggestion,options:o};this.current&&this.current.key===e.key&&(this.current.key=a),this.store.set(l=>({suggestions:l.suggestions.map(c=>c===e.suggestion?a:c),optionSearch:s}))}o.length===0?this.callbacks.onMiss?.(e.mode,e.query):this.callbacks.onAnswer?.(e.mode,e.query)}setSearch(e,n){let i=this.store.get().optionSearch;i&&i.parameter===e.parameter&&i.query===e.query&&i.status===n||this.store.set({optionSearch:{parameter:e.parameter,query:e.query,status:n}})}cancel(){this.current?.abort?.abort(),this.version++}logOnce(e){this.hasLoggedError||(this.hasLoggedError=!0,console.warn("[Intent-1] an optionOverrides entry threw or rejected \u2014 treated as no options. Later failures on this instance are not logged.",e))}};function mc(t){return t instanceof Error&&t.name==="AbortError"}var mn=class{constructor(e,n={}){this.store=e;this.callbacks=n}setActivePill(e){let n=this.store.get(),i=n.suggestions.filter(c=>c.parameter!=="placeholder");if(e<0||e>=i.length)return;let o=i[e];if(A(o))return;let r=i.filter((c,u)=>u!==e),s=n.suggestions.filter(c=>c.parameter==="placeholder");if(this.callbacks.onPillSelected){let{rawQuery:c}=R(n.text,n.completedParams);this.callbacks.onPillSelected({rawQuery:c,selectedPill:o.text,otherPills:r.map(u=>u.text)})}let a=[...s,o,...r],l=this.store.peek({suggestions:a}).filteredOptions.findIndex(c=>c.is_tappable&&!c.selectsAll);this.store.set({suggestions:a,pillTapped:!0,activeDropdownIndex:l})}removeLastParam(){this.store.get().completedParams.length!==0&&this.store.set(n=>({completedParams:n.completedParams.slice(0,-1),activeDropdownIndex:-1}))}};var ys="/products/",hs="https://relative.invalid";function pc(t){if(!t)return;let e;try{e=new URL(t,`${hs}/`)}catch{return}if(!(e.protocol!=="http:"&&e.protocol!=="https:"))return t.startsWith("/")?e.origin===hs?t:void 0:/^https?:\/\//i.test(t)?t:void 0}function Ss(t,e){let n=pc(t.item_url)??gc(t);return{id:t.source_id,title:t.title,...n&&{url:n},imageUrl:t.image_url||null,...t.price&&{price:bs(t.price,t.currency,e)},...fc(t)&&{compareAtPrice:bs(t.compare_at_price,t.currency,e)},...t.vendor&&{vendor:t.vendor},...typeof t.available=="boolean"&&{available:t.available}}}function fc(t){if(!t.price||!t.compare_at_price)return!1;let e=Number(t.price),n=Number(t.compare_at_price);return Number.isFinite(e)&&Number.isFinite(n)&&n>e}function bs(t,e,n){if(n===void 0||!e||!/^\d+(\.\d+)?$/.test(t))return t;try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(Number(t))}catch{return t}}function gc(t){if(!t.handle)return;let e=`${ys}${encodeURIComponent(t.handle)}`;return t.variant_id?`${e}?variant=${encodeURIComponent(t.variant_id)}`:e}function Di(t,e){return(t?.items.matched??[]).map(n=>Ss(n,e))}var pn=class{constructor(e,n,i=()=>!0,o=()=>{},r=()=>{}){this.store=e;this.getConfig=n;this.isEnabled=i;this.getLanguage=o;this.getMapper=r;this.hasLoggedError=!1;this.hasLoggedMapperError=!1}forResponse(e){if(!this.isEnabled())return[];if(this.getConfig())return;let n=Di(e,re(this.getLanguage())),i=this.getMapper();if(!i)return n;try{let o=i(n,e?.items.matched??[]);if(Array.isArray(o))return o}catch(o){this.hasLoggedMapperError||(this.hasLoggedMapperError=!0,console.warn("[Intent-1] mapProducts failed. The original cards are shown.",o))}return n}async run(e,n,i){if(!this.isEnabled())return;let o=this.getConfig();if(!o)return;if(e.trim().length===0){this.clear(i);return}let r=()=>n.aborted||!i()||!this.owns(o);try{let s=await o.fetch(e,n);if(r())return;let a=o.transform(s),l=Array.isArray(a)?a:[],c=o.limit!=null?l.slice(0,o.limit):l;if(r())return;this.commit(c)}catch(s){if(n.aborted||hc(s)||(this.logOnce(s),r()))return;this.clear(i)}}owns(e){return this.isEnabled()&&this.getConfig()===e}resync(){let e=this.forResponse(this.store.get().customFields);this.commit(e??[])}refresh(){if(this.getConfig())return;let e=this.forResponse(this.store.get().customFields);e!==void 0&&this.commit(e)}clear(e){e()&&this.commit([])}commit(e){e.length===0&&this.store.get().products.length===0||this.store.set({products:e})}logOnce(e){this.hasLoggedError||(this.hasLoggedError=!0,console.warn("[Intent-1] products.fetch/transform failed \u2014 the product strip is hidden. Later failures on this instance are not logged.",e))}};function hc(t){return t instanceof Error&&t.name==="AbortError"}function bc(t){return t.replace(/(\d+)(?:st|nd|rd|th)\b/g,"$1")}function Ts(t){let e=t.toLowerCase().replace(/\.$/,"");return e.length<3?-1:We.findIndex(n=>n.toLowerCase().startsWith(e))}function yc(t,e,n){let i=new Date(n.getFullYear(),t,e);if(i.getMonth()!==t||i.getDate()!==e)return null;let o=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(i>=o)return i;let r=new Date(n.getFullYear()+1,t,e);return r.getMonth()===t&&r.getDate()===e?r:null}var Sc=/^(?:(?:on|from) )?(?:the )?(\d{1,2})(?:st|nd|rd|th)$/;function Hi(t){let e=Sc.exec(t.trim().toLowerCase().replace(/\s+/g," "));if(!e)return null;let n=Number(e[1]);return n>=1&&n<=31?n:null}function Tc(t,e){if(!Number.isFinite(e.getTime()))return null;let n=new Date(e.getFullYear(),e.getMonth(),e.getDate());for(let i=0;i<12;i++){let o=new Date(e.getFullYear(),e.getMonth()+i,t);if(o.getDate()===t&&o>=n)return o}return null}function vs(t,e,n){let i=new Date(t,e,n);return i.getMonth()===e&&i.getDate()===n?i:null}function $e(t,e={}){if(!t)return null;let n=e.today??new Date,i=Hi(t);if(i!==null){let c=Tc(i,n);return c?V(c):null}let o=bc(t.trim().toLowerCase()).replace(/\s+/g," "),r=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(o);if(r){let c=vs(Number(r[1]),Number(r[2])-1,Number(r[3]));return c?V(c):null}let s=/^([a-z]+)\.? (\d{1,2})(?:,? (\d{4}))?$/.exec(o);if(s){let c=Ts(s[1]);if(c>=0)return fn(c,Number(s[2]),s[3],n)}let a=/^(\d{1,2}) (?:of )?([a-z]+)\.?(?:,? (\d{4}))?$/.exec(o);if(a){let c=Ts(a[2]);if(c>=0)return fn(c,Number(a[1]),a[3],n)}let l=/^(\d{1,2})[/\-.](\d{1,2})(?:[/\-.](\d{2,4}))?$/.exec(o);if(l){let c=Number(l[1]),u=Number(l[2]);return c>12&&u<=12?fn(u-1,c,l[3],n):u>12&&c<=12?fn(c-1,u,l[3],n):null}return null}function fn(t,e,n,i){if(n){if(n.length!==4)return null;let r=vs(Number(n),t,e);return r?V(r):null}let o=yc(t,e,i);return o?V(o):null}var vc=/^\d{4}-\d{2}-\d{2}$/;function St(t){return typeof t=="string"&&vc.test(t)?t:null}function Ni(t,e={}){return St(t.isoDate)??$e(t.text,e)}function Tt(t){let e=St(t.isoDate);return e?{start:e,end:St(t.isoDateEnd)}:null}var xs=" - ",Bi="aiaDateRangeStart",Vi="aiaDateRangeEnd";function vt(t,e){return t<=e?{start:t,end:e}:{start:e,end:t}}var Fi=/^\d{4}-\d{2}-\d{2}$/;function Wi(t){if(!Fi.test(t))return null;let[e,n,i]=t.split("-").map(Number),o=new Date(e,n-1,i);return o.getMonth()===n-1&&o.getDate()===i?o:null}var xc=/\s+(?:to|through|thru|until|til|till)\s+/g,Ec=/[-–—]/g;function wc(t){let e=[];for(let n of[xc,Ec]){n.lastIndex=0;let i=n.exec(t);for(;i!==null;)e.push([t.slice(0,i.index),t.slice(i.index+i[0].length)]),i=n.exec(t)}return e}function gn(t,e={}){if(!t)return null;let n=new Set,i=null;for(let[o,r]of wc(t.trim())){let s=$e(o.trim(),e);if(!s)continue;let a=Hi(r)!==null?$e(r.trim(),{...e,today:Wi(s)??e.today}):$e(r.trim(),e);!a||a<s||(n.add(`${s}|${a}`),i={start:s,end:a})}return n.size===1?i:null}function Es(t){let e=Wi(t.start),n=Wi(t.end);return!e||!n?"":t.start===t.end?Be(e):`${Be(e)}${xs}${Be(n)}`}function ws(t,e){let n=vt(t,e);return{text:Es(n),is_tappable:!0,kind:null,metadata:{[Bi]:n.start,[Vi]:n.end}}}function qe(t,e={}){let n=t?.metadata?.[Bi],i=t?.metadata?.[Vi];return typeof n=="string"&&typeof i=="string"&&Fi.test(n)&&Fi.test(i)?vt(n,i):gn(t?.text,e)}var hn="(max-width: 768px)";var Pc="var(--aia-option-row-height, 37px)",Lc="var(--aia-grid-scroll-top, 0px) + var(--aia-grid-scroll-bottom, 0px)",Cc="max(0, var(--aia-option-peek, 0))";function Ps(t,e){let n=e?5:4;return Ls(1,Math.min(t,n),t>n)}function Ls(t,e,n){let i=n?`(${e} + ${Cc})`:`${e}`;return{cols:t,rows:e,maxHeight:`calc(${i} * ${Pc} + ${Lc})`}}function $i(t,e){return!e&&t>=5}function qi(t,e,n,i){if(!(!e&&t>=5&&Ac(n,i))){let s=Ps(t,e);return{...s,template:Ui(s.cols),scrollHintIndices:!e&&t>s.rows?[s.rows-1]:[]}}let r=6;return{...Ls(2,3,t>r),template:Ui(2),scrollHintIndices:t>r?[r-2,r-1]:[]}}function Ac(t,e){return!t||t.length===0||e==null||e<=0||t.some(i=>i<=0)?!1:Math.ceil(Math.max(...t))*2<=e}function xt(t){if(typeof document>"u")return null;let e=Array.from(t.querySelectorAll("[data-aia-option]"));if(e.length===0)return null;let n=document.createElement("div");n.style.cssText="position:absolute;visibility:hidden;left:-9999px;top:0;";for(let s of e){let a=s.cloneNode(!0);a.removeAttribute("id"),a.removeAttribute("role"),a.removeAttribute("aria-selected"),a.style.whiteSpace="nowrap",a.style.width="max-content",n.appendChild(a)}t.appendChild(n);let i=Array.from(n.children).map(s=>s.offsetWidth);n.remove();let o=getComputedStyle(t),r=t.clientWidth-(Number.parseFloat(o.paddingLeft)||0)-(Number.parseFloat(o.paddingRight)||0)-(Number.parseFloat(o.columnGap)||0);return{rowWidths:i,gridWidth:r}}var Gi="data-aia-glide-width",Ki="--aia-glide-content-width";function Ui(t){return Array.from({length:t},()=>"minmax(0,1fr)").join(" ")}function Et(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(hn).matches}function zi(t,e){return!t||t.length!==e.length?!1:t.every((n,i)=>n.text===e[i].text)}function Cs(t,e){return t.trim().toLowerCase()===e.trim().toLowerCase()}function Qi(t,e){let n=[];for(let i of e?.blocking_filters??[])for(let o of t)o.type==="text"||n.some(r=>r.paramId===o.param.id)||Cs(o.param.parameter,i.parameter)&&(o.type==="completed"&&!(o.params??[o.param]).map(s=>s.value??s.text).some(s=>Cs(s,i.value))||n.push({paramId:o.param.id,text:o.value,total:i.total}));return n}var As={language:"en",and:"and",proceed:"to proceed",select:"to select",skipHint:"to skip",skip:"skip",skipLabel:"Skip",products:"Items",soldOut:"Sold out",addToCart:"Add to cart",submit:"Submit",seeAllResults:"See all results",scrollArrow:"Scroll down for more options",keepTyping:"Keep typing",done:"Done",allOption:"All",timeLabel:"Time",locationSearch:"Say a location",locationNoResults:"No places found",locationUseTyped:"Press Enter to use what you typed"},Ic={language:"es",and:"y",proceed:"para continuar",select:"para seleccionar",skipHint:"para omitir",skip:"omitir",skipLabel:"Omitir",products:"Mejor coincidencia",soldOut:"Agotado",addToCart:"A\xF1adir al carrito",submit:"Buscar",seeAllResults:"Ver todos los resultados",scrollArrow:"Despl\xE1zate para ver m\xE1s opciones",keepTyping:"Sigue escribiendo",done:"Listo",allOption:"Todo",timeLabel:"Hora",locationSearch:"Di una ubicaci\xF3n",locationNoResults:"No se encontraron lugares",locationUseTyped:"Pulsa Intro para usar lo que escribiste"},Yi={en:As,es:Ic,fr:{language:"fr",and:"et",proceed:"pour continuer",select:"pour s\xE9lectionner",skipHint:"pour passer",skip:"passer",skipLabel:"Passer",products:"Meilleure correspondance",soldOut:"\xC9puis\xE9",addToCart:"Ajouter au panier",submit:"Rechercher",seeAllResults:"Voir tous les r\xE9sultats",scrollArrow:"Faites d\xE9filer pour voir plus d\u2019options",keepTyping:"Continuez \xE0 taper",done:"Termin\xE9",allOption:"Tout",timeLabel:"Heure",locationSearch:"Dites un lieu",locationNoResults:"Aucun lieu trouv\xE9",locationUseTyped:"Appuyez sur Entr\xE9e pour utiliser votre saisie"},"pt-BR":{language:"pt-BR",and:"e",proceed:"para continuar",select:"para selecionar",skipHint:"para pular",skip:"pular",skipLabel:"Pular",products:"Melhor correspond\xEAncia",soldOut:"Esgotado",addToCart:"Adicionar ao carrinho",submit:"Buscar",seeAllResults:"Ver todos os resultados",scrollArrow:"Role para ver mais op\xE7\xF5es",keepTyping:"Continue digitando",done:"Conclu\xEDdo",allOption:"Tudo",timeLabel:"Hor\xE1rio",locationSearch:"Diga um local",locationNoResults:"Nenhum lugar encontrado",locationUseTyped:"Pressione Enter para usar o que voc\xEA digitou"},it:{language:"it",and:"e",proceed:"per continuare",select:"per selezionare",skipHint:"per saltare",skip:"salta",skipLabel:"Salta",products:"Migliore corrispondenza",soldOut:"Esaurito",addToCart:"Aggiungi al carrello",submit:"Cerca",seeAllResults:"Vedi tutti i risultati",scrollArrow:"Scorri per vedere altre opzioni",keepTyping:"Continua a scrivere",done:"Fatto",allOption:"Tutto",timeLabel:"Ora",locationSearch:"Di' un luogo",locationNoResults:"Nessun luogo trovato",locationUseTyped:"Premi Invio per usare ci\xF2 che hai scritto"},tr:{language:"tr",and:"ve",proceed:"devam etmek i\xE7in",select:"se\xE7mek i\xE7in",skipHint:"atlamak i\xE7in",skip:"atla",skipLabel:"Atla",products:"En iyi e\u015Fle\u015Fme",soldOut:"T\xFCkendi",addToCart:"Sepete ekle",submit:"Ara",seeAllResults:"T\xFCm sonu\xE7lar\u0131 g\xF6r",scrollArrow:"Daha fazla se\xE7enek i\xE7in kayd\u0131r",keepTyping:"Yazmaya devam et",done:"Tamam",allOption:"T\xFCm\xFC",timeLabel:"Saat",locationSearch:"Bir konum s\xF6yleyin",locationNoResults:"Yer bulunamad\u0131",locationUseTyped:"Yazd\u0131\u011F\u0131n\u0131z\u0131 kullanmak i\xE7in Enter'a bas\u0131n"},id:{language:"id",and:"dan",proceed:"untuk melanjutkan",select:"untuk memilih",skipHint:"untuk melewati",skip:"lewati",skipLabel:"Lewati",products:"Paling cocok",soldOut:"Habis",addToCart:"Tambah ke keranjang",submit:"Cari",seeAllResults:"Lihat semua hasil",scrollArrow:"Gulir untuk melihat opsi lainnya",keepTyping:"Teruskan mengetik",done:"Selesai",allOption:"Semua",timeLabel:"Waktu",locationSearch:"Sebutkan lokasi",locationNoResults:"Tempat tidak ditemukan",locationUseTyped:"Tekan Enter untuk memakai yang Anda ketik"},pl:{language:"pl",and:"i",proceed:"aby kontynuowa\u0107",select:"aby wybra\u0107",skipHint:"aby pomin\u0105\u0107",skip:"pomi\u0144",skipLabel:"Pomi\u0144",products:"Najlepsze dopasowanie",soldOut:"Wyprzedane",addToCart:"Dodaj do koszyka",submit:"Szukaj",seeAllResults:"Zobacz wszystkie wyniki",scrollArrow:"Przewi\u0144, aby zobaczy\u0107 wi\u0119cej opcji",keepTyping:"Pisz dalej",done:"Gotowe",allOption:"Wszystko",timeLabel:"Godzina",locationSearch:"Podaj lokalizacj\u0119",locationNoResults:"Nie znaleziono miejsc",locationUseTyped:"Naci\u015Bnij Enter, aby u\u017Cy\u0107 wpisanego tekstu"},de:{language:"de",and:"und",proceed:"zum Fortfahren",select:"zum Ausw\xE4hlen",skipHint:"zum \xDCberspringen",skip:"\xFCberspringen",skipLabel:"\xDCberspringen",products:"Beste Treffer",soldOut:"Ausverkauft",addToCart:"In den Warenkorb",submit:"Suchen",seeAllResults:"Alle Ergebnisse anzeigen",scrollArrow:"Scrolle f\xFCr weitere Optionen",keepTyping:"Weitertippen",done:"Fertig",allOption:"Alle",timeLabel:"Uhrzeit",locationSearch:"Nenne einen Ort",locationNoResults:"Keine Orte gefunden",locationUseTyped:"Dr\xFCcke Enter, um deine Eingabe zu verwenden"},nl:{language:"nl",and:"en",proceed:"om door te gaan",select:"om te selecteren",skipHint:"om over te slaan",skip:"overslaan",skipLabel:"Overslaan",products:"Beste match",soldOut:"Uitverkocht",addToCart:"In winkelwagen",submit:"Zoeken",seeAllResults:"Alle resultaten bekijken",scrollArrow:"Scrol voor meer opties",keepTyping:"Blijf typen",done:"Klaar",allOption:"Alles",timeLabel:"Tijd",locationSearch:"Noem een locatie",locationNoResults:"Geen plaatsen gevonden",locationUseTyped:"Druk op Enter om je invoer te gebruiken"},sv:{language:"sv",and:"och",proceed:"f\xF6r att forts\xE4tta",select:"f\xF6r att v\xE4lja",skipHint:"f\xF6r att hoppa \xF6ver",skip:"hoppa \xF6ver",skipLabel:"Hoppa \xF6ver",products:"B\xE4sta matchning",soldOut:"Sluts\xE5ld",addToCart:"L\xE4gg i varukorgen",submit:"S\xF6k",seeAllResults:"Visa alla resultat",scrollArrow:"Skrolla f\xF6r fler alternativ",keepTyping:"Forts\xE4tt skriva",done:"Klar",allOption:"Alla",timeLabel:"Tid",locationSearch:"S\xE4g en plats",locationNoResults:"Inga platser hittades",locationUseTyped:"Tryck p\xE5 Enter f\xF6r att anv\xE4nda det du skrev"},nb:{language:"nb",and:"og",proceed:"for \xE5 fortsette",select:"for \xE5 velge",skipHint:"for \xE5 hoppe over",skip:"hopp over",skipLabel:"Hopp over",products:"Beste treff",soldOut:"Utsolgt",addToCart:"Legg i handlekurven",submit:"S\xF8k",seeAllResults:"Se alle resultater",scrollArrow:"Rull ned for \xE5 se flere alternativer",keepTyping:"Fortsett \xE5 skrive",done:"Ferdig",allOption:"Alle",timeLabel:"Tid",locationSearch:"Si et sted",locationNoResults:"Fant ingen steder",locationUseTyped:"Trykk Enter for \xE5 bruke det du skrev"},da:{language:"da",and:"og",proceed:"for at forts\xE6tte",select:"for at v\xE6lge",skipHint:"for at springe over",skip:"spring over",skipLabel:"Spring over",products:"Bedste match",soldOut:"Udsolgt",addToCart:"L\xE6g i kurv",submit:"S\xF8g",seeAllResults:"Se alle resultater",scrollArrow:"Rul for flere muligheder",keepTyping:"Forts\xE6t med at skrive",done:"F\xE6rdig",allOption:"Alle",timeLabel:"Tidspunkt",locationSearch:"Sig et sted",locationNoResults:"Ingen steder fundet",locationUseTyped:"Tryk p\xE5 Enter for at bruge det, du skrev"},fi:{language:"fi",and:"ja",proceed:"jatkaaksesi",select:"valitaksesi",skipHint:"ohittaaksesi",skip:"ohita",skipLabel:"Ohita",products:"Paras vastaavuus",soldOut:"Loppuunmyyty",addToCart:"Lis\xE4\xE4 ostoskoriin",submit:"Hae",seeAllResults:"N\xE4yt\xE4 kaikki tulokset",scrollArrow:"Vierit\xE4 n\xE4hd\xE4ksesi lis\xE4\xE4 vaihtoehtoja",keepTyping:"Jatka kirjoittamista",done:"Valmis",allOption:"Kaikki",timeLabel:"Aika",locationSearch:"Sano sijainti",locationNoResults:"Paikkoja ei l\xF6ytynyt",locationUseTyped:"Paina Enteri\xE4 k\xE4ytt\xE4\xE4ksesi kirjoittamaasi"},ja:{language:"ja",and:"\u3068",proceed:"\u3067\u6B21\u3078",select:"\u3067\u9078\u629E",skipHint:"\u3067\u30B9\u30AD\u30C3\u30D7",skip:"\u30B9\u30AD\u30C3\u30D7",skipLabel:"\u30B9\u30AD\u30C3\u30D7",products:"\u30D9\u30B9\u30C8\u30DE\u30C3\u30C1",soldOut:"\u58F2\u308A\u5207\u308C",addToCart:"\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0",submit:"\u691C\u7D22",seeAllResults:"\u3059\u3079\u3066\u306E\u7D50\u679C\u3092\u898B\u308B",scrollArrow:"\u30B9\u30AF\u30ED\u30FC\u30EB\u3057\u3066\u4ED6\u306E\u5019\u88DC\u3092\u898B\u308B",keepTyping:"\u5165\u529B\u3092\u7D9A\u3051\u308B",done:"\u5B8C\u4E86",allOption:"\u3059\u3079\u3066",timeLabel:"\u6642\u523B",locationSearch:"\u5834\u6240\u3092\u8A00\u3063\u3066\u304F\u3060\u3055\u3044",locationNoResults:"\u5834\u6240\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",locationUseTyped:"\u5165\u529B\u3057\u305F\u5185\u5BB9\u3092\u4F7F\u3046\u306B\u306F Enter \u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044"},ko:{language:"ko",and:"\uBC0F",proceed:"\uACC4\uC18D",select:"\uC120\uD0DD",skipHint:"\uAC74\uB108\uB6F0\uAE30",skip:"\uAC74\uB108\uB6F0\uAE30",skipLabel:"\uAC74\uB108\uB6F0\uAE30",products:"\uCD94\uCC9C \uC0C1\uD488",soldOut:"\uD488\uC808",addToCart:"\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uB2F4\uAE30",submit:"\uAC80\uC0C9",seeAllResults:"\uBAA8\uB4E0 \uACB0\uACFC \uBCF4\uAE30",scrollArrow:"\uB354 \uB9CE\uC740 \uC635\uC158\uC744 \uBCF4\uB824\uBA74 \uC2A4\uD06C\uB864\uD558\uC138\uC694",keepTyping:"\uACC4\uC18D \uC785\uB825\uD558\uC138\uC694",done:"\uC644\uB8CC",allOption:"\uC804\uCCB4",timeLabel:"\uC2DC\uAC04",locationSearch:"\uC704\uCE58\uB97C \uB9D0\uD558\uC138\uC694",locationNoResults:"\uC7A5\uC18C\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",locationUseTyped:"\uC785\uB825\uD55C \uB0B4\uC6A9\uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 Enter\uB97C \uB204\uB974\uC138\uC694"},"zh-CN":{language:"zh-CN",and:"\u548C",proceed:"\u7EE7\u7EED",select:"\u9009\u62E9",skipHint:"\u8DF3\u8FC7",skip:"\u8DF3\u8FC7",skipLabel:"\u8DF3\u8FC7",products:"\u6700\u4F73\u5339\u914D",soldOut:"\u552E\u7F44",addToCart:"\u52A0\u5165\u8D2D\u7269\u8F66",submit:"\u641C\u7D22",seeAllResults:"\u67E5\u770B\u5168\u90E8\u7ED3\u679C",scrollArrow:"\u5411\u4E0B\u6EDA\u52A8\u67E5\u770B\u66F4\u591A\u9009\u9879",keepTyping:"\u7EE7\u7EED\u8F93\u5165",done:"\u5B8C\u6210",allOption:"\u5168\u90E8",timeLabel:"\u65F6\u95F4",locationSearch:"\u8BF4\u51FA\u5730\u70B9",locationNoResults:"\u672A\u627E\u5230\u5730\u70B9",locationUseTyped:"\u6309 Enter \u4F7F\u7528\u4F60\u8F93\u5165\u7684\u5185\u5BB9"},"zh-TW":{language:"zh-TW",and:"\u548C",proceed:"\u7E7C\u7E8C",select:"\u9078\u64C7",skipHint:"\u7565\u904E",skip:"\u7565\u904E",skipLabel:"\u7565\u904E",products:"\u6700\u4F73\u5339\u914D",soldOut:"\u552E\u5B8C",addToCart:"\u52A0\u5165\u8CFC\u7269\u8ECA",submit:"\u641C\u5C0B",seeAllResults:"\u67E5\u770B\u5168\u90E8\u7D50\u679C",scrollArrow:"\u5411\u4E0B\u6372\u52D5\u67E5\u770B\u66F4\u591A\u9078\u9805",keepTyping:"\u7E7C\u7E8C\u8F38\u5165",done:"\u5B8C\u6210",allOption:"\u5168\u90E8",timeLabel:"\u6642\u9593",locationSearch:"\u8AAA\u51FA\u5730\u9EDE",locationNoResults:"\u627E\u4E0D\u5230\u5730\u9EDE",locationUseTyped:"\u6309 Enter \u4F7F\u7528\u4F60\u8F38\u5165\u7684\u5167\u5BB9"}},Oc={pt:"pt-BR",no:"nb",nn:"nb"};function _(t){let[e,...n]=t?.toLowerCase().split("-")??[];if(e==="zh"){let o=n.some(r=>["hant","tw","hk","mo"].includes(r));return Yi[o?"zh-TW":"zh-CN"]}let i=Oc[e]??e;return Object.prototype.hasOwnProperty.call(Yi,i)?Yi[i]:As}function Is(t,e){let n=e.dropdownTrigger??"auto",i=e.closeDropdownOnBlur??!0,s=t.filteredOptionsLength>0||t.activePillHasNoOptions||t.hasProducts;if(t.inEditMode){let a=i?t.isFocused||t.dropdownHeld:!0;return s&&a}if(n==="auto"){let a=i?t.isFocused||t.dropdownHeld:!0,l=t.text.replace(/\s+$/,"").length,c=t.caretOffset==null||t.caretOffset>=l;return(s||t.isLoading)&&a&&c}return n==="manual"?(s||t.isLoading)&&t.pillTapped:!1}function B(t){if(t.editingIdentified){let{parameter:n,anchor:i}=t.editingIdentified;return`identified:${n}@${i}`}return t.editingParam!=null&&t.editingAnchor!=null?`edit:${t.editingParam?.id}`:`pill:${t.actionableSuggestions[0]?.parameter??""}`}function bn(t){if(!t)return Ti();let[e,n]=t.split("-").map(Number);return{year:e,month:n-1}}function kc(t){let e=tn(t);return e?ds(e):Ti()}function Mc(t,e){if(!t)return null;for(let n of e){if(n.parameter!==t||n.type?.kind!=="date_range")continue;let i=Tt(n);if(i&&i.end==null)return i.start}return null}function Rc(t){let e=new Set,n=i=>{i&&e.add(i)};for(let i of t.completedParams??[]){if(i.id===t.editingParam?.id)continue;let o=i.suggestionValueType?.kind;if(o==="date"&&n(St(i.metadata?.[en])??yt(i.text)),o==="date_range"){let r=qe(i);n(r?.start),n(r?.end)}}for(let i of t.identifiedParams??[]){if(i.id===t.editingIdentified?.id)continue;let o=i.type?.kind;if(o!=="date"&&o!=="date_range")continue;let r=Tt(i);n(r?.start),n(r?.end)}return[...e].sort()}function ji(t,e){return t.editingParam!=null&&t.editingAnchor!=null?e:t.text.slice(Pe(t.text,t.completedParams))}var _c=/price/i;function Dc(t){return!t||De(t)||F(te(t))||t.type?.kind==="multi_select"||_c.test(t.parameter)?!1:(t.options??[]).filter(e=>e.is_tappable).length>=2}function Ge(t,e,n){if(e>0)return!1;let i=t.trim();return i===""||i.toLowerCase()===n.trim().toLowerCase()||lt(i,0,n)}var Hc=4;function Nc(t,e){let n={text:e,kind:null,is_tappable:!0,selectsAll:!0},i=[...new Set(t.filter(r=>r.is_tappable&&r.image_url).map(r=>r.image_url))].slice(0,Hc);if(i.length>0)return n.image_url=i[0],i.length>1&&(n.imageCollage=i),[n,...t];let o;for(let r of t)r.is_tappable&&(o=r);return o?.icon&&(n.icon=o.icon),o?.icon_svg&&(n.icon_svg=o.icon_svg),[n,...t]}function Fc(t,e){let{composing:n}=t,i=n?.over===t.text?n.text:t.text,o=i.slice(Pe(i,t.completedParams));return e?.completes_word!==!0?o:o.match(/\S+(?=\s*$)/)?.[0]??""}function Os(t,e){let n=Kt(t.text,t.completedParams,t.identifiedParams),i=t.suggestions.filter(k=>k.parameter!=="placeholder"),o=i[0],r=e.startingState===!1,s=r?"":t.suggestions.filter(k=>k.parameter==="placeholder").map(k=>k.text).join(" "),a=_e(s,e.prependPlaceholder),l=fe(t.text,Math.min(t.filterBase,t.text.length),a),u=l===0&&lt(t.text,t.completedParams.length,a)?"":ct(t.text,l,t.filterInProgress),d=o?.options??[],f=t.editingParam!=null&&t.editingAnchor!=null,p=!t.editingIdentified&&(f?t.editingParam?.group!=null:o?.type?.kind==="multi_select"),m,g,b,T;if(f&&t.editingParam&&t.editingAnchor!=null){let k=t.editingParam.id,q=t.completedParams.some(pe=>pe.id===k),ot=t.caretOffset??t.editingAnchor,ee=q?"":t.text.slice(t.editingAnchor,ot);g=ee.trim(),b=t.editingParam.options,T=t.editingParam.suggestionParameter,m=t.editingParam.suggestionValueType?.kind==="traditional_autocomplete"?ge(t.editingParam.options,ee).map(pe=>({...pe,matchedText:g,parameterLabel:ni(pe)})):ge(t.editingParam.options,ee)}else g=u.trim(),b=d,T=o?.parameter,m=A(o)?d.map(k=>({...k,matchedText:Fc(t,o),parameterLabel:ni(k)})):ge(d,u,t.traditionalAutocomplete);let S=t.optionSearch,E=S!=null&&T!=null&&S.parameter===T;E&&S.status==="done"&&S.query===g&&(m=b);let y=E&&S.status==="loading",h=e.showNonTappableOptions===!1;h&&(m=m.filter(k=>k.is_tappable));let x=Ge(t.text,t.completedParams.length,a);e.allOption===!0&&o?.leadsWithAll===!0&&!x&&!f&&!t.editingIdentified&&u.trim()===""&&Dc(o)&&(m=Nc(m,_(e.language).allOption));let P=ji(t,g),v=f?t.editingParam?.suggestionValueType?.kind==="traditional_autocomplete":A(o);!p&&!v&&(m=Fr(m,P));let L=t.editingIdentified,O=f?t.editingParam&&{type:t.editingParam.suggestionValueType,options:t.editingParam.options}:o,I=L?L.format:te(O),K=f?t.editingParam?.suggestionParameter:o?.parameter,M=I==="location"&&K&&e.optionOverrides?.[K]?"options":I,z=f&&M==="date-range"?qe(t.editingParam):null,Z=!f&&!L&&M==="date"?Mc(o?.parameter,t.identifiedParams):null,ue=null,C=null,de=H(M)?Rc(t):[];if(H(M)){let k=V(new Date),q=de.find(Il=>Il>=k)??null,ot=B({...t,actionableSuggestions:i}),ee=t.dateViewMonth;ue=ee&&ee.key===ot?{year:ee.year,month:ee.month}:L?bn(L.iso):z?bn(z.start):Z?bn(Z):q&&!f?bn(q):kc(t.editingParam?.text),m=xi(ue);let pe=t.pendingRangeStart;M==="date-range"&&pe&&pe.key===ot&&(C=pe.iso)}let ve=null;if(M==="time"){let k=B({...t,actionableSuggestions:i}),q=t.timeDraft;ve=q&&q.key===k?{minutes:q.minutes,touched:!0}:{minutes:gs({editingText:f?t.editingParam?.text:null,options:f?t.editingParam?.options:o?.options}),touched:!1},m=[]}let xe=null;if(M==="location"){let k=B({...t,actionableSuggestions:i}),q=t.locationSearch;if(q&&q.key===k){let{key:ot,...ee}=q;xe=ee}else xe={query:f?t.editingParam?.text??"":"",places:[],status:t.locationAutocomplete&&e.locationSearch!==!1?"idle":"unavailable",highlighted:-1};m=[]}let kt=k=>h?k.is_tappable:!0,w;if(f){let k=t.editingParam?.options??[];w=t.editingParam!=null&&k.filter(kt).length===0}else w=o!=null&&d.filter(kt).length===0;ve&&(w=!0),xe&&(w=!0);let Ee=t.composing?.over===t.text?t.composing.text:t.text,ke=r&&Ge(Ee,t.completedParams.length,a),Mt=Is({inEditMode:f||L!=null,filteredOptionsLength:m.length,isFocused:t.isFocused||t.locationFieldFocused,dropdownHeld:t.dropdownHeld,text:t.text,caretOffset:t.caretOffset,isLoading:t.isLoading||y,pillTapped:t.pillTapped,activePillHasNoOptions:w,hasProducts:t.products.length>0},{dropdownTrigger:e.dropdownTrigger,closeDropdownOnBlur:e.closeDropdownOnBlur})&&!ke,Rt=Mt&&t.activeDropdownIndex>=0&&!!m[t.activeDropdownIndex]?.is_tappable,nt=!ke&&t.skeletonOptions!==null&&t.skeletonRequested&&!t.isLoading&&!t.editingParam&&!t.inSelectionAnimation,_t=!ke&&(t.isLoading&&!t.editingParam&&!t.inSelectionAnimation||y||nt),me=_t&&t.skeletonOptions!==null,D=me&&t.skeletonOptions?t.skeletonOptions:m,it=me?t.skeletonSuggestion:null,Me=p?{picked:t.multiSelectDraft?.key===B({...t,actionableSuggestions:i})?t.multiSelectDraft.picked:[]}:null,Al=Me??(me&&t.skeletonSuggestion?.type?.kind==="multi_select"?{picked:t.skeletonPicked??[]}:null);return{segments:n,actionableSuggestions:i,filteredOptions:m,dropdownLoading:_t,dropdownOptions:D,dropdownSuggestion:it,skeletonExiting:nt,activeFormatType:M,dateView:ue,dateRangeStart:C,dateFloor:Z,dateReferences:de,timeView:ve,multiSelectView:Me,dropdownMultiSelect:Al,locationView:xe,placeholderText:s,leadInText:a,optionQuery:g,isSearchingOptions:y,isDropdownOpen:Mt,isActivePillSelected:Rt,blockingChips:Qi(n,t.customFields)}}function yn(t){return t.mode!=="edit"?Bc(t):Vc(t)}function Wc(t,e,n){let i=t.find(A);if(!i?.options)return null;let o=e.slice(Pe(e,n)).trim().toLowerCase();if(!o)return null;let r=i.completes_word===!0?o.split(/\s+/).pop()??"":o,s=i.options.filter(c=>c.is_tappable&&c.text.trim().toLowerCase()===r);if(new Set(s.map(c=>ne(c,i.parameter))).size!==1)return null;let l=s[0];return{suggestion:i,option:l,matchText:l.text.trim()}}function ks(t){let{text:e,suggestions:n,filterBase:i,filterInProgress:o,phraseExactMatch:r}=t,s=n.find(u=>u.parameter!=="placeholder"&&!A(u));if(!s?.options||s.type?.kind==="multi_select")return null;let a=n.filter(u=>u.parameter==="placeholder").map(u=>u.text).join(" "),l=fe(e,i,_e(a,t.prependPlaceholder)),c=ut(s.options,e,l,o,r===!0);return c?{suggestion:s,option:c,matchText:c.text}:null}function Bc(t){let{text:e,completedParams:n,suggestions:i}=t,o=t.mode==="submit"?(t.finishWord?ks(t):null)??Wc(i,e,n):ks(t);if(!o)return null;let{suggestion:r,option:s,matchText:a}=o,l=a.toLowerCase(),c=e.toLowerCase().lastIndexOf(l),u=c>=0?c:Math.max(0,e.length-s.text.length),d=u+a.length,f=e.slice(u,d),m=d<e.length&&e[d]===" "?d+1:d,g={id:crypto.randomUUID(),placeholder:"",parameter:ne(s,r.parameter),text:f,value:s.value,kind:s.kind,suggestionParameter:r.parameter,suggestionValueType:r.type,suggestionPlaceholder:r.text,suggestionIcon:r.icon,suggestionIconSvg:r.icon_svg,...t.mode==="submit"&&A(r)?dt(ne(s,r.parameter),r.text,s.parameter_label):{},options:r.options??[],metadata:s.metadata,icon:s.icon,icon_svg:s.icon_svg,image_url:s.image_url};return{patch:{text:e,completedParams:[...n,g],suggestions:i.filter(b=>b!==r),filterBase:m,newParamId:g.id,caretOffset:m,activeDropdownIndex:-1},caretPos:m,option:s,suggestion:r}}function Vc(t){let{text:e,completedParams:n,editingParam:i,editingAnchor:o,editingTail:r}=t;if(n.some(E=>E.id===i.id))return null;let s=e.slice(o,r),a=$t(i.options,s);if(!a)return null;let l=a.text.toLowerCase(),c=s.toLowerCase().lastIndexOf(l),u=o+Math.max(0,c),d=u+a.text.length,f=e.slice(u,d),p=d<e.length&&e[d]===" "?d+1:d,m=e.length,g={id:crypto.randomUUID(),placeholder:"",...qt(i,a),text:f,value:a.value,kind:a.kind,options:i.options,metadata:a.metadata,icon:a.icon,icon_svg:a.icon_svg,image_url:a.image_url},b=n.length,T=0;for(let E=0;E<n.length;E++){let y=oe(e,n[E].text,T);if(y!==-1){if(y>=p){b=E;break}T=y+n[E].text.length}}let S=[...n];return S.splice(b,0,g),{patch:{text:e,completedParams:S,newParamId:g.id,filterBase:m,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:m,activeDropdownIndex:-1},caretPos:m,option:a}}function Rs(t){return t.slice(t.search(/\S*$/))}function _s(t){return t.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase()}function Ji(t,e){let n="",i=0;for(let o of t){let r=i;if(n+=_s(o),i+=o.length,n.length>=e.length){if(!n.startsWith(e))return null;let s=i+(t.slice(i).match(/^\p{M}*/u)?.[0].length??0),a=n.length>e.length;return{length:s,partialStart:a?r:s}}if(!e.startsWith(n))return null}return null}function Ds(t,e,n,i){let o=[];return e<i&&o.push({text:t.slice(e,i),bold:!0}),i<n&&o.push({text:t.slice(i,n),bold:!0,partial:!0}),o}function Xi(t){return[...t].map(_s).join("")}function Sn(t,e){if(/\s$/.test(e))return null;let n=e.split(/\s+/).filter(Boolean).map(Xi),i=[...t.matchAll(/\S+/g)].map(o=>({index:o.index??0,text:o[0],folded:Xi(o[0])}));for(let o=n.length;o>=1;o--){let r=n.slice(n.length-o),s=r[o-1];for(let a=0;a+o<=i.length;a++){if(!r.slice(0,-1).every((d,f)=>i[a+f].folded===d))continue;let c=i[a+o-1],u=Ji(c.text,s);if(u)return{typedWords:o,start:i[a].index,end:c.index+u.length,partialStart:c.index+u.partialStart}}}return null}function Ms(t,e,n,i){return[{text:t.slice(0,e),bold:!1},...Ds(t,e,n,i),{text:t.slice(n),bold:!1}].filter(o=>o.text!=="")}function Uc(t,e){let n=0;for(let i of t){if(!/^\p{M}/u.test(i)){let o=Ji(t.slice(n),e);if(o)return{start:n,end:n+o.length,partialStart:n+o.partialStart}}n+=i.length}return null}var $c=/\p{Script=Hangul}/u;function Zi(t,e){let n=e?Sn(t,e):null;if(n&&n.typedWords>1)return Ms(t,n.start,n.end,n.partialStart);let i=e?Rs(e):"",o=Xi(i);if(!o)return[{text:t,bold:!1}];let r=[],s=!1;for(let l of t.split(/(\s+)/)){if(l==="")continue;let c=/^\s/.test(l)?null:Ji(l,o);if(c){s=!0;let{length:d,partialStart:f}=c;r.push(...Ds(l,0,d,f))}let u=c?l.slice(c.length):l;u&&r.push({text:u,bold:!1})}if(s||!$c.test(i))return r;let a=Uc(t,o);return a?Ms(t,a.start,a.end,a.partialStart):r}var qc=6e4;function Gc(t){return typeof TextEncoder>"u"?t.length*3:new TextEncoder().encode(t).length}async function Kc(t){return rt(t)?`Bearer ${await Bt(t).getToken()}`:Ut(t)}async function Hs(t){let e=yr(t.apiConfig);if(e)try{let n=Vt(t.apiConfig),i=await Kc(t.apiConfig);i&&(n.Authorization=i);let o=JSON.stringify({source:t.source,session_id:t.sessionId,...t.visitorId&&{visitor_id:t.visitorId},...t.searchId&&{search_id:t.searchId},...t.requestId&&{request_id:t.requestId},type:t.type,...t.language&&{language:t.language},at:new Date().toISOString(),query_data:t.queryData});await fetch(e,{method:"POST",headers:n,body:o,...t.keepalive&&Gc(o)<=qc&&{keepalive:!0}})}catch{}}function ae(t,e){let n=t.findIndex(i=>i.text===e);return n>=0?n+1:null}var eo=t=>t.toLowerCase().split(/\s+/).filter(Boolean);function zc(t,e,n){let i=eo(t??"");if(i.length===0)return"";let r=eo(e).slice(-i.length),s=eo(n).slice(0,i.length);return r.join(" ")===i.join(" ")||s.join(" ")===i.join(" ")?"":(t??"").trim().split(/\s+/).join(" ")}function Ns(t,e){let n=t.actionableSuggestions[0];if(!n)return null;let i=A(n),o=e.parameter;if(i&&!o)return null;let r=i&&o?o:ne(e,n.parameter),s=i?t.text.length:t.filterBase,a=t.text.slice(0,s),l=a.length===0&&t.text.length===0,c=a.length===0&&t.text.length>0&&t.placeholderText.length>0&&t.placeholderText.toLowerCase().startsWith(t.text.toLowerCase());(l||c)&&t.placeholderText&&(a=`${t.placeholderText} `);let u=Math.min(Pe(t.text,t.completedParams),a.length),d=!1;if(i&&n.completes_word!==!0){let v=[...a.slice(u).matchAll(/\S+/g)],L=Sn(e.text,a.slice(u)),O=v[v.length-(L?.typedWords??1)];a=a.slice(0,O?u+(O.index??0):Math.max(a.lastIndexOf(" ")+1,u))}else if(n.completes_word===!0){let v=[...a.slice(u).matchAll(/\S+/g)],L=v[v.length-1];a=a.slice(0,L?u+(L.index??0):Math.max(a.lastIndexOf(" ")+1,u))}else if(n.completes_word!==!1){let v=a.slice(u),L=Math.max(Hr(v,e.text),Ar(v,e));L>0&&(a=a.slice(0,a.length-L)),d=L>0}let f=a.length>0&&a[a.length-1]!==" ",p=i||n.completes_word===!0||d,m=t.activeFormatType!==void 0&&!F(t.activeFormatType)&&F(te({type:n.type})),g=p||m?"":zc(n.lead_in,a,e.text),b=`${a}${f?" ":""}${g?`${g} `:""}${e.text} `,S=(l||c||i&&a.length===0)&&b.length>0?b[0].toUpperCase()+b.slice(1):b,E=S.toLowerCase().lastIndexOf(e.text.toLowerCase()),y=E>=0?S.slice(E,E+e.text.length):e.text,h=i?dt(r,n.text,e.parameter_label):{parameter:r,suggestionParameter:n.parameter,suggestionValueType:n.type,suggestionPlaceholder:n.text,suggestionIcon:n.icon,suggestionIconSvg:n.icon_svg},x={id:crypto.randomUUID(),placeholder:"",...h,text:y,value:e.value,kind:e.kind,options:n.options??[],metadata:e.metadata,icon:e.icon,icon_svg:e.icon_svg,image_url:e.image_url},P=t.actionableSuggestions.length-1;return{patch:{text:S,filterBase:S.length,completedParams:[...t.completedParams,x],newParamId:x.id,caretOffset:S.length,pillTapped:!1,activeDropdownIndex:-1,skipNextFetch:!0,inSelectionAnimation:!0,pendingSpan:null},telemetry:{selectedOption:e.text,otherOptions:t.filteredOptions.filter(v=>v.text!==e.text).map(v=>v.text),key:i?r:n.parameter,position:ae(n.options??[],e.text)},consumedSuggestion:n,remainingActionable:P}}function Ke(t,e){let n=F(t.activeFormatType)||t.filteredOptions.length===0?null:t.filteredOptions,i=t.editingParam,o=i?mt(i):t.actionableSuggestions[0]??null;return{skeletonOptions:n,skeletonSuggestion:n?o:null,skeletonPicked:n?e??null:null,skeletonRequested:!1}}function Tn(t,e,n){let i=t.slice(0,e),o=t.slice(n),r=(i===""||i.endsWith(" "))&&o.startsWith(" ");return r&&(o=o.slice(1)),{text:i+o,removed:n-e+(r?1:0)}}var vn=class{constructor(e){this.deps=e}start(e){let n=this.deps.store.get(),i=n.completedParams.find(c=>c.id===e);if(!i)return null;let o=i.group?n.completedParams.filter(c=>c.group===i.group):[i],r=o[0];if(n.editingParam?.id===r.id)return r.id;let s=0,a=-1,l=-1;for(let c of n.completedParams){let u=oe(n.text,c.text,s);if(u!==-1&&(s=u+c.text.length,!!o.includes(c)&&(a<0&&(a=u),l=s,c===o[o.length-1])))break}return a<0?null:(this.deps.store.set({editingParam:r,editingAnchor:a,editingTail:l,caretOffset:l,activeDropdownIndex:-1,...i.group?{multiSelectDraft:{key:B({...n,editingParam:r,editingAnchor:a,editingIdentified:null}),picked:o.map(c=>r.options.find(u=>u.text.toLowerCase()===c.text.toLowerCase())?.text??c.text)}}:{},editingIdentified:null}),r.id)}exit(){this.deps.store.get().editingParam&&this.deps.store.set({editingParam:null,editingAnchor:null,editingTail:null,activeDropdownIndex:-1})}replaceRange(e){let n=this.deps.store.get(),i=n.editingParam,o=n.editingAnchor,r=n.editingTail;if(!i||o==null||r==null||!n.completedParams.some(l=>l.id===i.id))return!1;let{text:s}=e===""?Tn(n.text,o,r):{text:n.text.slice(0,o)+e+n.text.slice(r)},a=o+e.length;return this.deps.store.set(l=>({text:s,completedParams:l.completedParams.filter(c=>c.id!==i.id&&(!i.group||c.group!==i.group)),...i.group&&l.multiSelectDraft?{multiSelectDraft:{...l.multiSelectDraft,picked:[]}}:{},editingTail:a,caretOffset:a,activeDropdownIndex:-1})),this.deps.scheduleSetCursor(a),this.promoteIfExact(),!0}caretAfterInput(e){let n=this.deps.store.get(),i={caretOffset:e};n.editingParam&&n.editingAnchor!=null&&e!=null&&(e<n.editingAnchor?(i.editingParam=null,i.editingAnchor=null,i.editingTail=null,i.activeDropdownIndex=-1):n.editingTail!=null&&(i.editingTail=Math.max(n.editingTail,e))),this.deps.store.set(i),this.promoteIfExact()}caretMove(e){let n=this.deps.store.get();if(n.editingParam&&n.editingAnchor!=null&&n.editingTail!=null&&e!=null&&(e<n.editingAnchor||e>n.editingTail)){this.deps.store.set({caretOffset:e,editingParam:null,editingAnchor:null,editingTail:null,activeDropdownIndex:-1});return}this.deps.store.set({caretOffset:e})}selectOption(e){let n=this.deps.store.get(),i=n.editingParam,o=n.editingAnchor,r=n.editingTail;if(!i||o==null||r==null)return;let s=qt(i,e);this.deps.fireTelemetry("option",{raw_query:R(n.text,n.completedParams).rawQuery,selected_option:e.text,other_options:i.options.filter(S=>S.text!==e.text).map(S=>S.text),key:s.suggestionParameter,position:ae(i.options,e.text),chip_origin:"tap"});let a=n.text.slice(0,o),l=n.text.slice(r),c=o===0&&e.text.length>0?e.text[0].toUpperCase()+e.text.slice(1):e.text,d=l.length===0||l[0]!==" "?`${c} `:c,f=a+d+l,p=f.length,m={id:crypto.randomUUID(),placeholder:"",...s,text:c,value:e.value,kind:e.kind,options:i.options,metadata:e.metadata,icon:e.icon,icon_svg:e.icon_svg,image_url:e.image_url},g=n.completedParams.findIndex(S=>S.id===i.id),b=n.completedParams.filter(S=>S.id!==i.id),T=g>=0?Math.min(g,b.length):b.length;b.splice(T,0,m),this.deps.store.set({text:f,completedParams:b,newParamId:m.id,filterBase:p,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:p,activeDropdownIndex:-1,pillTapped:!1,skipNextFetch:!0,inSelectionAnimation:!0,...Ke(n)}),this.deps.startSelectionAnimationTimer(),this.deps.schedulePickCursor(p),this.deps.fetchNow()}selectMultiple(e,n){let i=this.deps.store.get(),o=i.editingParam,r=i.editingAnchor,s=i.editingTail;if(!o||r==null||s==null||e.length===0)return;let a=R(i.text,i.completedParams).rawQuery;for(let y of e)this.deps.fireTelemetry("option",{raw_query:a,selected_option:y.text,other_options:o.options.filter(h=>h.text!==y.text).map(h=>h.text),key:o.suggestionParameter,position:ae(o.options,y.text),chip_origin:"tap"});let l=i.text.slice(0,r),c=i.text.slice(s),u=r===0?n[0].toUpperCase()+n.slice(1):n,d=c.length===0||c[0]!==" ",f=l+u+(d?" ":"")+c,p=f.length,m=crypto.randomUUID(),g=0,b=e.map(y=>{let h=u.toLowerCase().indexOf(y.text.toLowerCase(),g);return g=h+y.text.length,{...o,id:crypto.randomUUID(),group:m,text:u.slice(h,g),value:y.value,kind:y.kind,metadata:y.metadata,icon:y.icon,icon_svg:y.icon_svg,image_url:y.image_url}}),T=y=>y.id===o.id||o.group!=null&&y.group===o.group,S=i.completedParams.findIndex(T),E=i.completedParams.filter(y=>!T(y));E.splice(S>=0?Math.min(S,E.length):E.length,0,...b),this.deps.store.set({text:f,completedParams:E,newParamId:b[0].id,filterBase:p,editingParam:null,editingAnchor:null,editingTail:null,multiSelectDraft:null,caretOffset:p,activeDropdownIndex:-1,pillTapped:!1,skipNextFetch:!0,inSelectionAnimation:!1,...Ke(i,e.map(y=>y.text))}),this.deps.schedulePickCursor(p),this.deps.fetchNow()}promoteIfExact(){let e=this.deps.store.get();if(!e.editingParam||e.editingAnchor==null||e.editingTail==null||e.editingParam.group)return;let n=yn({mode:"edit",text:e.text,completedParams:e.completedParams,editingParam:e.editingParam,editingAnchor:e.editingAnchor,editingTail:e.editingTail});n&&(this.deps.store.set(n.patch),this.deps.scheduleSetCursor(n.caretPos))}};var Qc=33,Yc=70,jc=120,Xc=50,ze="data-aia-placeholder-leaving",Qe=new WeakMap;function xn(t){t.timer!==null&&(clearTimeout(t.timer),t.timer=null)}function Jc(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Ws(t,e,n){e.shown=n,t.dataset.placeholder=e.target.slice(0,n)}function Bs(t,e){if(e.timer=null,!t.isConnected||e.shown>=e.target.length||(Ws(t,e,e.shown+1),e.shown>=e.target.length))return;let n=e.target[e.shown-1],i=n===" "||n==="-"?70:0;e.timer=setTimeout(()=>Bs(t,e),33+i)}function Fs(t,e){Ws(t,e,0),e.timer=setTimeout(()=>Bs(t,e),33)}function Vs(t,e){let n=Qe.get(t);if(e===""){n&&(xn(n),Qe.delete(t)),t.removeAttribute(ze),delete t.dataset.placeholder;return}if(n?.target===e)return;if(Jc(t)){n&&xn(n),t.removeAttribute(ze),Qe.set(t,{target:e,shown:e.length,timer:null}),t.dataset.placeholder=e;return}let i={target:e,shown:0,timer:null},o=n&&n.shown>0?n:null;if(n&&xn(n),Qe.set(t,i),o){t.setAttribute(ze,""),i.timer=setTimeout(()=>{i.timer=null,t.removeAttribute(ze),t.isConnected&&Fs(t,i)},170);return}t.removeAttribute(ze),Fs(t,i)}function Us(t){let e=Qe.get(t);e&&(xn(e),Qe.delete(t))}var Zc={selectedIso:null,selectedRange:null,rangeStart:null};function wt(t){if(!H(t.activeFormatType))return Zc;let e=t.editingIdentified;if(e){let{iso:i,isoEnd:o}=e;return{selectedIso:o?null:i,selectedRange:i&&o?vt(i,o):null,rangeStart:t.dateRangeStart,references:t.dateReferences??[]}}let n=qe(t.editingParam);return{selectedIso:n?null:yt(t.editingParam?.text),selectedRange:n,rangeStart:t.dateRangeStart??t.dateFloor??null,floor:t.dateFloor??null,references:t.dateReferences??[]}}function to(t){let e=t.floor!=null&&t.highlightedIso!=null&&t.highlightedIso<t.floor?null:t.highlightedIso;return t.pendingStart?vt(t.pendingStart,e??t.pendingStart):t.selected}function no(t,e){if(t==null)return{selected:!1,inRange:!1,reference:!1};let{selectedIso:n,range:i}=e,o=t===n||i!=null&&(t===i.start||t===i.end),r=i!=null&&t>i.start&&t<i.end,s=!o&&!r&&(e.references?.includes(t)??!1);return{selected:o,inRange:r,reference:s}}function io(t,e,n){return t==null?!1:t<e||n!=null&&t<n}function oo(t,e){return t==="date"?e??null:null}var $s="https://magicx.ai/intent-1";function ro(t=$s){try{if(typeof window>"u"||!window.location)return t;let e=window.location.hostname;if(!e)return t;let n=new URL(t);return n.searchParams.set("utm_source",e),n.toString()}catch{return t}}function so(t,e,n=_()){return t?{key:"enter",hint:n.proceed}:e?{key:"tab",hint:n.select}:{key:"\u2192",hint:n.skipHint}}function ao(t){let e=s=>{s.ctrlKey||qs(s.target,t,s.deltaX,s.deltaY)||s.preventDefault()},n=0,i=0,o=s=>{let a=s.touches[0];a&&(n=a.clientX,i=a.clientY)},r=s=>{if(s.touches.length!==1)return;let a=s.touches[0],l=n-a.clientX,c=i-a.clientY;n=a.clientX,i=a.clientY,s.cancelable&&!qs(s.target,t,l,c)&&s.preventDefault()};return t.addEventListener("wheel",e,{passive:!1}),t.addEventListener("touchstart",o,{passive:!0}),t.addEventListener("touchmove",r,{passive:!1}),()=>{t.removeEventListener("wheel",e),t.removeEventListener("touchstart",o),t.removeEventListener("touchmove",r)}}function qs(t,e,n,i){let o=t instanceof Element?t:null;for(;o;){if(i!==0&&eu(o,i)||n!==0&&tu(o,n))return!0;if(o===e)break;o=o.parentElement}return!1}var Gs=/^(auto|scroll|overlay)$/;function eu(t,e){return t.scrollHeight<=t.clientHeight||!Gs.test(getComputedStyle(t).overflowY)?!1:e>0?t.scrollTop+t.clientHeight<t.scrollHeight-1:t.scrollTop>0}function tu(t,e){if(t.scrollWidth<=t.clientWidth)return!1;let n=getComputedStyle(t);if(!Gs.test(n.overflowX))return!1;let i=Math.abs(t.scrollLeft),o=t.scrollWidth-t.clientWidth;return(n.direction==="rtl"?e<0:e>0)?i<o-1:i>0}function Ye(t,e,n){n?(t.getAttribute(e)!=="busy"&&t.setAttribute(e,"busy"),t.getAttribute("aria-busy")!=="true"&&t.setAttribute("aria-busy","true")):t.hasAttribute(e)&&(t.removeAttribute(e),t.removeAttribute("aria-busy"))}var Ks=new WeakMap,zs=new WeakSet;function U(t,e,n){if(Ks.set(t,n),zs.has(t))return;zs.add(t);let i=()=>Ks.get(t),o=r=>{if(!(r instanceof Element))return null;let s=r.closest(e.itemSelector);return s&&t.contains(s)?s:null};e.onClick&&t.addEventListener("click",r=>{let s=o(r.target);s&&e.onClick?.(s,i(),r)}),e.onEnter&&t.addEventListener("mouseenter",r=>{let s=r.target;s instanceof HTMLElement&&s.matches(e.itemSelector)&&e.onEnter?.(s,i(),r)},!0),e.onLeave&&t.addEventListener("mouseleave",r=>{let s=r.target;s instanceof HTMLElement&&s.matches(e.itemSelector)&&e.onLeave?.(s,i(),r)},!0),e.preventMousedown&&t.addEventListener("mousedown",r=>r.preventDefault())}function ye(t){return Number.parseInt(t.dataset.aiaIndex??"-1",10)}function G(t){t.offsetWidth}var X="magicx-aia-panel-ghost";function je(t){return t.closest(`.${X}`)!==null}function $(t,e){for(let n of t.querySelectorAll(e))if(!je(n))return n;return null}var lo="--aia-multi-done-fit";function nu(t){return $(t,"[data-aia-multi-done]")}function co(t,e){if(!e?.isConnected)return;let n=e.ownerDocument,i=n.defaultView?.getComputedStyle(e).direction==="rtl";if(typeof n.createRange().getBoundingClientRect!="function")return;let o=e.getBoundingClientRect(),r=0;for(let s of t.querySelectorAll("[data-aia-option]")){if(je(s))continue;let a=n.defaultView?.getComputedStyle(s),l=Number.parseFloat(i?a?.paddingRight??"0":a?.paddingLeft??"0")||0,c=n.createTreeWalker(s,NodeFilter.SHOW_TEXT),u=n.createRange();for(let d=c.nextNode();d;d=c.nextNode()){if(!d.textContent?.trim())continue;u.selectNodeContents(d);let f=u.getBoundingClientRect();if(f.width===0)continue;let p=i?o.right-f.left:f.right-o.left;r=Math.max(r,p+l)}}r>0?e.style.setProperty(lo,`${Math.ceil(r)}px`):e.style.removeProperty(lo)}var iu=40,ou=340,ru=340,su=7,uo="--aia-option-enter-delay";function mo(t,e,n,i="below"){let o=Math.max(1,Math.floor(e)),r=Math.floor(Math.max(0,t)/o);if(i!=="above")return r*40;let s=Math.max(1,Math.ceil(Math.max(0,n)/o));return Math.max(0,s-1-r)*40}function po(t,e){let n=Math.max(1,Math.floor(e));return(Math.max(1,Math.ceil(Math.max(0,t)/n))-1)*40+340}function En(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function wn(t,e,n,i){let o=t.scrollTop,r=n?.requestAnimationFrame,s=t.ownerDocument?.visibilityState==="hidden";if(!r||s||En(t))return t.scrollTop=o+e,i(),()=>{};let a=!1,l=n.performance?.now?.()??Date.now(),c=()=>n.performance?.now?.()??Date.now(),u=()=>{if(a)return;let d=Math.min(1,(c()-l)/240),f=1-(1-d)*(1-d);t.scrollTop=o+e*f,d<1?r.call(n,u):i()};return r.call(n,u),()=>{a=!0}}var Ys="magicx-aia-scroll-arrow",Pn="data-aia-scroll-arrow",Xe="data-aia-visible",js=1e3,Xs=160,Js="--aia-scroll-arrow-bottom",au="Scroll down for more options",fo="data-aia-scrollable",lu="--aia-scroll-track-top",cu="--aia-scroll-track-height",uu="--aia-scroll-track-right",du="--aia-scroll-thumb-top",mu="--aia-scroll-thumb-height",pu=12,fu=.5,gu="[data-aia-products-label]",hu="--aia-option-peek",bu=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;function yu(t){let e=t?.trim()??"";if(!bu.test(e))return 0;let n=Number(e);return Number.isFinite(n)&&n>0?n:0}function Su(t){let e=t.ownerDocument.createElement("div");e.style.cssText="position:absolute;visibility:hidden;pointer-events:none;padding:0;border:0;height:var(--aia-option-row-height, 37px);",t.appendChild(e);let n=e.offsetHeight;if(e.remove(),Number.isFinite(n)&&n>0)return n;let i=t.querySelector("[data-aia-option]")?.offsetHeight??0;return Number.isFinite(i)&&i>0?i:0}var Qs=4,Tu=8;function vu(t=document){let e="http://www.w3.org/2000/svg",n=t.createElementNS(e,"svg");n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("width","18"),n.setAttribute("height","18"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.75"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false");let i=t.createElementNS(e,"path");return i.setAttribute("d","M4 6.5 8 10.5l4-4"),n.appendChild(i),n}function Zs(t=document,e=_()){let n=t.createElement("button");return n.type="button",n.tabIndex=-1,n.className=Ys,n.setAttribute(Pn,""),n.setAttribute("aria-label",e.scrollArrow),n.setAttribute("aria-hidden","true"),n.disabled=!0,n.appendChild(vu(t)),n}function xu(t){return Math.max(1,ho(t.style.gridTemplateColumns))}function go({dropdown:t,grid:e,button:n}){let i=e.ownerDocument?.defaultView??(typeof window<"u"?window:null),o=!1;n.disabled=!0;let r=null,s=null,a=null,l=null,c=x=>{if(x){if(n.hasAttribute(Xe))return;if(n.setAttribute(Xe,""),n.setAttribute("aria-hidden","false"),l!==null&&clearTimeout(l),En(e)){n.disabled=!1;return}l=setTimeout(()=>{l=null,!o&&n.hasAttribute(Xe)&&(n.disabled=!1)},js)}else n.removeAttribute(Xe),n.setAttribute("aria-hidden","true"),l!==null&&clearTimeout(l),l=null,n.disabled=!0},u=x=>{let P=0,v=x;for(;v&&v!==t;)P+=v.offsetTop,v=v.offsetParent instanceof HTMLElement?v.offsetParent:null;return P},d=()=>{let x=$(t,gu),P;if(x){let v=u(x)+x.offsetHeight/2;P=t.clientHeight-v-n.offsetHeight/2}else{let v=u(e),L=i&&Number.parseFloat(i.getComputedStyle(e).paddingBottom)||0;P=t.clientHeight-(v+e.offsetHeight)+(L>0?0:Tu)}n.style.setProperty(Js,`${Math.max(0,Math.round(P))}px`)},f=x=>{let P=0,v=x;for(;v&&v!==t;)P+=v.offsetLeft,v=v.offsetParent instanceof HTMLElement?v.offsetParent:null;return P},p=null,m=(x,P)=>{let v=Math.min(1,Math.max(0,e.scrollTop/x));n.style.setProperty(du,`${Math.round(P*v)}px`)},g=()=>{let x=e.scrollHeight-e.clientHeight,P=e.querySelector("[data-aia-option][data-aia-loading]")!==null;if(x<=Qs||P){p=null,n.removeAttribute(fo);return}let v=e.clientHeight,L=Math.round(v*fu),O=u(e)+(v-L)/2,I=t.clientWidth-(f(e)+e.offsetWidth),K=Math.min(L,Math.max(pu,Math.round(L*v/e.scrollHeight)));p={overflow:x,travel:L-K},n.style.setProperty(lu,`${Math.round(O)}px`),n.style.setProperty(cu,`${L}px`),n.style.setProperty(uu,`${Math.max(0,Math.round(I))}px`),n.style.setProperty(mu,`${K}px`),m(x,p.travel),n.setAttribute(fo,"")},b=()=>{if(o||s!==null||a!==null)return;let x=e.querySelector("[data-aia-option][data-aia-loading]")!==null,P=e.scrollHeight-e.clientHeight-e.scrollTop;c(!x&&P>Qs)},T=()=>{if(o)return;d(),g();let x=e.getAttribute("data-aia-group")??"";if(x!==r){r=x,c(!1),s!==null&&clearTimeout(s);let P=e.querySelectorAll("[data-aia-option]").length,v=En(e)?0:po(P,xu(e));s=setTimeout(()=>{s=null,b()},v);return}b()},S=()=>{o||(p&&m(p.overflow,p.travel),s===null&&(c(!1),a!==null&&clearTimeout(a),a=setTimeout(()=>{a=null,b()},Xs)))};e.addEventListener("scroll",S,{passive:!0});let E=x=>x.preventDefault(),y=()=>{let x=i?i.getComputedStyle(e):null,P=x?(Number.parseFloat(x.paddingTop)||0)+(Number.parseFloat(x.paddingBottom)||0):0,v=yu(x?.getPropertyValue(hu)),L=v>0?Su(e):0,O=Math.max(1,e.clientHeight-P-v*L);wn(e,O,i,S)};n.addEventListener("mousedown",E),n.addEventListener("click",y);let h=null;return i&&typeof i.ResizeObserver=="function"&&(h=new i.ResizeObserver(()=>{d(),g(),b()}),h.observe(e),h.observe(t)),T(),{update:T,destroy(){o||(o=!0,s!==null&&clearTimeout(s),s=null,a!==null&&clearTimeout(a),a=null,l!==null&&clearTimeout(l),l=null,n.disabled=!0,e.removeEventListener("scroll",S),n.removeEventListener("mousedown",E),n.removeEventListener("click",y),h?.disconnect(),n.removeAttribute(Xe),n.removeAttribute(fo),n.setAttribute("aria-hidden","true"))}}}var na="cubic-bezier(0.25, 0.1, 0.25, 1)",Eu="cubic-bezier(0.32, 0.72, 0, 1)",ia=360,oa=280,ra=320,sa=40,aa="blur(2px)",wu=160,Pu=.05,la=/pressed/i;function ca(){return typeof performance<"u"?performance.now():Date.now()}function Lu(t){for(let e of t.querySelectorAll("[data-aia-loading]"))if(!e.closest(`.${X}`))return!0;return!1}function Cu(t){return t===null?1:1-Math.min(1,Math.max(0,(ca()-t)/wu))**1.7}function To(t){return t.hasAttribute(Pn)}function yo(t){let e=0;for(let n of Array.from(t.children))n.classList.contains(X)||To(n)||(e+=n.offsetHeight||0);return e}var J=new WeakMap;function Au(t){return(Number.parseFloat(t.borderLeftWidth)||0)+(Number.parseFloat(t.borderRightWidth)||0)}function Iu(t){let e=(t.ownerDocument.defaultView??window).getComputedStyle(t);return(Number.parseFloat(e.paddingLeft)||0)+(Number.parseFloat(e.paddingRight)||0)+(Number.parseFloat(e.borderLeftWidth)||0)+(Number.parseFloat(e.borderRightWidth)||0)}var bo=new WeakMap;function Ou(t,e){return!e||typeof t.animate!="function"||t.closest('[data-animations="off"]')||t.closest('[data-aia-options-style="classic"]')?!1:!(t.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)")??null)?.matches}function ku(t,e){let n=0,i="";for(let o of Array.from(t.children))o.classList.contains(X)||(n+=1+o.getElementsByTagName("*").length,i+=`${o.textContent??""}\0`);return`${e??""}${n}${i}`}function So(t){return Array.from(t.classList).some(e=>la.test(e))}function ea(t){return Array.from(t.querySelectorAll("*")).some(e=>So(e)&&!e.closest(`.${X}`))}function Mu(t,e){let n=Array.from(t.querySelectorAll("*")).filter(r=>So(r)&&!r.closest(`.${X}`));if(n.length===0)return;let i=Array.from(e.querySelectorAll("*")).filter(So),o=t.ownerDocument.defaultView;i.forEach((r,s)=>{let a=n[s];if(a&&o){let l=o.getComputedStyle(a);r.style.backgroundColor=l.backgroundColor,r.style.color=l.color,r.style.fontWeight=l.fontWeight,r.setAttribute(Ln,"")}for(let l of Array.from(r.parentElement?.children??[]))l!==r&&l instanceof HTMLElement&&(l.style.opacity="0.35",l.setAttribute(Ln,""))})}var Ln="data-aia-press-baked";function vo(t){let e=t?J.get(t)?.snapshot:null;if(e)for(let n of Array.from(e.querySelectorAll(`[${Ln}]`)))n.style.opacity="",n.style.backgroundColor="",n.style.color="",n.style.fontWeight="",n.removeAttribute(Ln)}function ta(t){let e=t.ownerDocument.createElement("div");e.className=X,e.setAttribute("aria-hidden","true"),e.inert=!0;for(let n of Array.from(t.children))n.classList.contains(X)||To(n)||e.appendChild(n.cloneNode(!0));Mu(t,e);for(let n of[e,...Array.from(e.querySelectorAll("*"))]){n.removeAttribute("id"),n.removeAttribute("role"),n.removeAttribute("tabindex");for(let i of Array.from(n.classList))la.test(i)&&n.classList.remove(i);n.tagName==="A"&&n.removeAttribute("href"),n.tagName==="BUTTON"&&(n.disabled=!0);for(let i of Array.from(n.attributes))i.name.startsWith("aria-")&&i.name!=="aria-hidden"&&n.removeAttribute(i.name)}return e}function Ru(t,e,n,i,o){for(let s of Array.from(t.children))s.classList.contains(X)&&s.remove();let r=Array.from(t.children).filter(s=>!To(s));i>Pu&&Du(t,e,n,i,o);for(let s of r)_u(s),s.animate([{opacity:0,filter:aa},{opacity:1,filter:"blur(0px)"}],{duration:ra,delay:sa,easing:na,fill:"backwards"})}function _u(t){for(let e of t.querySelectorAll("[data-aia-pill]"))if(!(e.hasAttribute("data-aia-loading")||typeof e.getAnimations!="function"))for(let n of e.getAnimations())n.cancel()}function Du(t,e,n,i,o){let r=(t.ownerDocument.defaultView??window).getComputedStyle(t);e.style.cssText=["position:absolute","left:0",o>0?`width:${o-Au(r)}px`:"right:0",n?"bottom:0":"top:0",`padding:${r.padding}`,"pointer-events:none","box-sizing:border-box"].join(";"),t.appendChild(e),e.animate([{opacity:i,filter:"blur(0px)"},{opacity:0,filter:aa}],{duration:oa*i,easing:na,fill:"forwards"}).finished.then(()=>e.remove(),()=>e.remove())}function xo(t){let e=t[0]?.text;return e==null||e===""?null:e}function Cn(t,e,n){let i=n.visible,o=Ou(t,n.enabled??!0),r=J.get(t);if(!i||!o){o||r?.glide?.cancel(),J.set(t,{height:0,width:0,key:i?e:null,signature:"",snapshot:null,glide:o?r?.glide??null:null,loadingSince:null,contentHeight:0});return}let s=ku(t,e),a=Lu(t)?r?.loadingSince??ca():null;if(r&&r.height>0&&r.glide&&r.signature===s){r.loadingSince=a,r.snapshot&&ea(t)&&(r.snapshot=ta(t));return}let l=Se(t),c=t.getBoundingClientRect(),u=c.height;r?.glide?.cancel();let d=t.getBoundingClientRect(),f=d.height,p=d.width||0,m=null,g=r?l?u:r.height:0,b=r?l?c.width||0:r.width:0;r&&g>0&&(e!==r.key&&r.snapshot&&Ru(t,r.snapshot,n.anchorBottom??!1,Cu(r.loadingSince),b),m=ua(t,{height:g,width:b},{height:f,width:p}));let T=null;e!==null&&(T=r&&r.signature===s&&r.snapshot&&!r.snapshot.isConnected&&!ea(t)?r.snapshot:ta(t)),J.set(t,{height:f,width:p,key:e,signature:s,snapshot:T,glide:m,loadingSince:a,contentHeight:m?yo(t):0})}function ua(t,e,n){let i=e.width>0&&n.width>0&&Math.abs(e.width-n.width)>1;if(Math.abs(e.height-n.height)<=1&&!i)return null;let o=i?[{height:`${e.height}px`,width:`${e.width}px`},{height:`${n.height}px`,width:`${n.width}px`}]:[{height:`${e.height}px`},{height:`${n.height}px`}],r=t.animate(o,{duration:ia,easing:Eu});i&&(t.setAttribute(Gi,String(n.width)),t.style.setProperty(Ki,`${n.width-Iu(t)}px`),bo.set(t,r));let s=()=>{bo.get(t)===r&&(bo.delete(t),t.removeAttribute(Gi),t.style.removeProperty(Ki))};return r.finished.then(()=>{s();let a=J.get(t);if(a?.glide!==r||(a.glide=null,a.height<=0))return;let l=t.getBoundingClientRect();l.height>0&&(a.height=l.height),l.width>0&&(a.width=l.width)},s),r}function Se(t){let e=J.get(t)?.glide??null;return e&&(e.playState==="running"||e.pending)?e:null}function Eo(t){if(!Se(t))return null;let e=J.get(t)?.height??0;return e>0?e:null}function wo(t,e){let n=J.get(t);n&&n.height>0&&!Se(t)&&e>0&&(n.height=e)}function da(t,{widthChanged:e}){let n=J.get(t);if(!n||n.height<=0)return;let i=Se(t);if(!i||!e&&(t.hasAttribute("data-aia-fit")||Math.abs(yo(t)-n.contentHeight)<=1))return;let o=t.getBoundingClientRect();i.cancel();let r=t.getBoundingClientRect();n.width=r.width||0,n.height=r.height,n.glide=ua(t,{height:o.height,width:o.width||0},{height:r.height,width:n.width}),n.contentHeight=n.glide?yo(t):0}function Po(t){J.get(t)?.glide?.cancel(),J.delete(t)}var Lo="data-aia-hug",Je="--aia-panel-fit-width",Co="data-aia-full-width",Hu=36;function Pt(t){t.removeAttribute(Lo)}function Ao(t,e,{eligible:n,loading:i}){let o=t.style.getPropertyValue(Je);Nu(t,e,n,i),da(t,{widthChanged:t.style.getPropertyValue(Je)!==o})}function Nu(t,e,n,i){if(!n){t.style.removeProperty(Je),Pt(t);return}if(i){t.style.getPropertyValue(Je)&&t.setAttribute(Lo,"");return}let o=Fu(t,e);if(o==null){t.style.removeProperty(Je);return}t.style.setProperty(Je,`${o}px`),t.setAttribute(Lo,"")}var ma=new WeakMap;function Fu(t,e){if(Et())return null;let n=$(e,".aia-grid");if(!n||t.offsetWidth===0)return null;let i=$(e,"[data-aia-pillbar]"),o=[n.style.gridTemplateColumns,i?.textContent??"",...Array.from(n.querySelectorAll("[data-aia-option]"),a=>a.textContent)].join("\0"),r=ma.get(t);if(r?.key===o)return r.width;let s=Wu(t,e,n);return ma.set(t,{key:o,width:s}),s}function Wu(t,e,n){let i=xt(n);if(!i||i.rowWidths.some(a=>a<=0))return null;let o=Math.ceil(Math.max(...i.rowWidths)),r=Math.max(1,ho(n.style.gridTemplateColumns)),s=pa(n,t,r-1)+r*(o+Hu);return Math.ceil(Math.max(s,Bu(e,t)))}function Bu(t,e){let n=$(t,"[data-aia-pillbar]");if(!n)return 0;let i=n.querySelector("[data-aia-pill-scroll]")?.scrollWidth??0,o=n.querySelector("[data-aia-skip]")?.offsetWidth??0;return i+o===0?0:pa(n,e,i>0&&o>0?1:0)+i+o}function ho(t){let e=0,n=0,i=!1;for(let o of t)o==="("?e++:o===")"&&e--,e===0&&/\s/.test(o)?i=!1:i||(i=!0,n++);return n}function pa(t,e,n){let i=0;for(let o=t;o;o=o.parentElement){let r=getComputedStyle(o);if(i+=(Number.parseFloat(r.paddingLeft)||0)+(Number.parseFloat(r.paddingRight)||0)+(Number.parseFloat(r.borderLeftWidth)||0)+(Number.parseFloat(r.borderRightWidth)||0),o===t&&(i+=n*(Number.parseFloat(r.columnGap)||0)),o===e)break}return i}var Vu="[data-aia-products], [data-aia-datepicker], [data-aia-date-grid], [data-aia-time-wheel], [data-aia-location], [data-aia-see-all]";function Uu(t){let e=!t.hasAttribute("data-aia-has-products")&&!t.hasAttribute(Co)&&$(t,".aia-grid [data-aia-option]")!==null&&$(t,Vu)===null,n=$(t,".aia-grid [data-aia-option][data-aia-loading]")!==null;e||Pt(t),Ao(t,t,{eligible:e,loading:n})}var fa="data-aia-key";function ie(t,e,n){let i=new Map;for(let s of Array.from(t.children)){let a=s.getAttribute(fa);a!=null&&i.set(a,s)}let o=new Set,r=[];for(let s=0;s<e.length;s++){let a=e[s],l=n.keyOf(a,s);o.add(l);let c=i.get(l);c||(c=n.create(a,s),c.setAttribute(fa,l)),n.update?.(c,a,s),t.children[s]!==c&&t.insertBefore(c,t.children[s]??null),r.push(c)}for(let[s,a]of i)o.has(s)||a.remove();return r}function ga(t,e){if(!e.interactive)return null;let n=e.options[ye(t)];return n?.is_tappable?n:null}var $u={itemSelector:"[data-aia-date-cell], [data-aia-date-prev], [data-aia-date-next]",onClick:(t,e)=>{if(t.hasAttribute("data-aia-date-prev")){e.callbacks.onPreviousMonth();return}if(t.hasAttribute("data-aia-date-next")){e.callbacks.onNextMonth();return}let n=ga(t,e);n&&(t.classList.add("magicx-aia-date-cell--pressed"),e.callbacks.onSelect(n),setTimeout(()=>t.classList.remove("magicx-aia-date-cell--pressed"),170))},onEnter:(t,e)=>{t.hasAttribute("data-aia-date-cell")&&ga(t,e)&&e.callbacks.onHighlight(ye(t))},onLeave:(t,e)=>{t.hasAttribute("data-aia-date-cell")&&e.callbacks.onHighlight(-1,ye(t))}};function ba(t,e,n,i,o,r,s,a=!0){let l=t.querySelector(".magicx-aia-datepicker");if(!o||e.length===0){l?.remove();return}if(!l){l=Ku(),t.appendChild(l),G(l);for(let d of l.querySelectorAll(".magicx-aia-datepicker-nav"))d.disabled=!1}U(l,$u,{options:e,callbacks:s,interactive:a});let c=l.querySelector(".magicx-aia-datepicker-month");c&&(c.textContent=Si(o));let u=l.querySelector(".magicx-aia-datepicker-grid");u&&qu(u,e,n,i,r)}function qu(t,e,n,i,o){let r=V(new Date),s=to({pendingStart:o.rangeStart,highlightedIso:j(e[n]),selected:o.selectedRange,floor:o.floor});ie(t,e,{keyOf:(a,l)=>j(a)??`pad-${l}`,create:a=>Gu(a),update:(a,l,c)=>{let u=j(l),d=no(u,{selectedIso:o.selectedIso,range:s,references:o.references}),f=c===n&&l.is_tappable;a.id=`${i}-option-${c}`,a.dataset.aiaIndex=String(c),a.setAttribute("aria-selected",String(f)),a.classList.toggle("magicx-aia-date-cell--past",io(u,r,o.floor)),a.classList.toggle("magicx-aia-date-cell--highlighted",f),a.classList.toggle("magicx-aia-date-cell--today",u!=null&&u===r),a.classList.toggle("magicx-aia-date-cell--selected",d.selected),a.classList.toggle("magicx-aia-date-cell--in-range",d.inRange),a.classList.toggle("magicx-aia-date-cell--reference",d.reference)}})}function Gu(t){let e=document.createElement("div");e.setAttribute("role","option"),e.setAttribute("data-aia-option",""),e.setAttribute("data-aia-date-cell","");let n=Ei(t);if(n==null)return e.className="magicx-aia-date-cell magicx-aia-date-cell--blank",e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e;e.className="magicx-aia-date-cell magicx-aia-date-cell--day",e.tabIndex=0,e.setAttribute("aria-label",t.text);let i=document.createElement("span");return i.className="magicx-aia-date-cell-number",i.textContent=String(n),e.appendChild(i),e}function Ku(){let t=document.createElement("div");t.className="magicx-aia-datepicker",t.setAttribute("data-aia-datepicker","");let e=document.createElement("div");e.className="magicx-aia-datepicker-header";let n=document.createElement("span");n.className="magicx-aia-datepicker-month",n.setAttribute("data-aia-date-month",""),n.setAttribute("aria-live","polite"),e.append(ha("prev","Previous month","\u2039"),n,ha("next","Next month","\u203A"));let i=document.createElement("div");i.className="magicx-aia-datepicker-weekdays",i.setAttribute("aria-hidden","true");for(let r of Zt){let s=document.createElement("span");s.className="magicx-aia-datepicker-weekday",s.textContent=r,i.appendChild(s)}let o=document.createElement("div");return o.className="magicx-aia-datepicker-grid",o.setAttribute("data-aia-date-grid",""),t.append(e,i,o),t}function ha(t,e,n){let i=document.createElement("button");return i.type="button",i.tabIndex=-1,i.className="magicx-aia-datepicker-nav",i.setAttribute(`data-aia-date-${t}`,""),i.setAttribute("aria-label",e),i.textContent=n,i.disabled=!0,i}var zu='<svg class="magicx-aia-location-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"/><circle cx="12" cy="9.5" r="2.5"/></svg>',ya="data-aia-location-body";function Qu(t){let e=document.createElement("div");e.className="magicx-aia-location-row",e.setAttribute("data-aia-location-row",""),e.setAttribute("role","option");let n=document.createElement("span");n.className="magicx-aia-location-pin",n.innerHTML=zu;let i=document.createElement("span");i.className="magicx-aia-location-text";let o=document.createElement("span");if(o.className="magicx-aia-location-name",o.textContent=t.name,i.appendChild(o),t.secondary){let r=document.createElement("span");r.className="magicx-aia-location-secondary",r.textContent=t.secondary,i.appendChild(r)}return e.append(n,i),e}function Yu(t,e){if(t==="loading"){let o=document.createElement("div");o.className="magicx-aia-location-loading",o.setAttribute("data-aia-location-loading","");for(let r=0;r<3;r++)o.appendChild(document.createElement("span")).className="magicx-aia-location-loading-bar";return o}if(t==="")return null;let n=document.createElement("div");if(n.className="magicx-aia-location-note",n.setAttribute("data-aia-location-note",""),t==="note-empty"){let o=document.createElement("span");o.className="magicx-aia-location-empty",o.textContent=e.locationNoResults,n.appendChild(o)}let i=document.createElement("span");return i.textContent=e.locationUseTyped,n.appendChild(i),n}function Sa(t,e,n,i){let o=e.places,r="";if(o.length===0&&(e.status==="loading"?r="loading":e.query.trim()&&(r=e.status==="done"?"note-empty":"note")),t.getAttribute(ya)!==r){for(let a of Array.from(t.children))a.hasAttribute("data-aia-location-row")||a.remove();let s=Yu(r,n);s&&t.appendChild(s),t.setAttribute(ya,r)}ie(t,o,{keyOf:(s,a)=>`${a}:${s.id}`,create:s=>Qu(s),update:(s,a,l)=>{let c=l===e.highlighted;s.classList.toggle("magicx-aia-location-row--highlighted",c),s.setAttribute("aria-selected",String(c)),s.setAttribute("data-aia-index",String(l)),s.id=i(l)}})}var le=new WeakMap,ju=0,Ae=new WeakMap,Xu='<svg class="magicx-aia-location-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>',Ie=t=>He(t.input)===t.input;function Ta(t,e){let n=He(t);if(n instanceof HTMLElement&&n!==e.input&&n!==N(t).body&&!t.contains(n)&&(e.returnTo=n,e.returnRange=null,n.isContentEditable)){let i=Ce(n);i&&n.contains(i.startContainer)&&(e.returnRange=i.cloneRange())}}function Ju(t,e,n){if(!(!(n instanceof HTMLElement)||n===e.returnTo||t.contains(n))&&n!==N(t).body&&(e.returnTo=n,e.returnRange=null,n.isContentEditable)){let i=Ce(n);i&&n.contains(i.startContainer)&&(e.returnRange=i.cloneRange())}}function Zu(t,e){if(t.focus({preventScroll:!0}),!t.isContentEditable)return;let n=Le(t);if(!n)return;let i=e;(!i||!i.startContainer.isConnected||!t.contains(i.startContainer))&&(i=N(t).createRange(),i.selectNodeContents(t),i.collapse(!1)),n.removeAllRanges(),n.addRange(i)}var ed={itemSelector:"[data-aia-location-row]",onClick:(t,e)=>{if(!e.interactive)return;let n=t.closest("[data-aia-location]");n&&Ze(n,!0),e.callbacks.onLocationCommit(Number(t.dataset.aiaIndex))}};function Ze(t,e=!1){let n=Ae.get(t),i=le.get(t);if(!n||!i)return;e&&(n.declined=!0);let o=n.returnTo;o?.isConnected&&Ie(n)&&(n.returning=!0,Zu(o,n.returnRange),n.returning=!1),i.callbacks.onLocationFocusChange(!1)}function td(t){let e=Ae.get(t),n=le.get(t);if(!(!e||!n||Ie(e))){if(Ta(t,e),n.callbacks.onLocationFocusChange(!0),e.input.focus({preventScroll:!0}),!Ie(e)){e.declined=!0,n.callbacks.onLocationFocusChange(!1);return}e.input.value&&e.input.select()}}function nd(t,e){t.className="magicx-aia-location",t.setAttribute("data-aia-location",""),t.id=`magicx-aia-location-${++ju}`;let n=document.createElement("label");n.className="magicx-aia-location-field",n.innerHTML=Xu;let i=document.createElement("input");i.type="text",i.className="magicx-aia-location-input",i.setAttribute("data-aia-location-input",""),i.setAttribute("autocomplete","off"),i.setAttribute("autocapitalize","words"),i.setAttribute("enterkeyhint","done"),i.spellcheck=!1,i.placeholder=e.locationSearch,i.setAttribute("aria-label",e.locationSearch),n.appendChild(i);let o=document.createElement("div");o.className="magicx-aia-location-results",o.setAttribute("data-aia-location-results",""),o.setAttribute("aria-live","polite"),t.append(n,o);let r={input:i,field:n,results:o,returnTo:null,returnRange:null,returning:!1,declined:!1,widgetFocused:!1,wasReediting:!1};return t.addEventListener("mousedown",s=>{!(s.target instanceof Node)||!n.contains(s.target)||(s.stopPropagation(),Ta(t,r),le.get(t)?.callbacks.onLocationFocusChange(!0))}),i.addEventListener("input",()=>le.get(t)?.callbacks.onLocationQuery(i.value)),i.addEventListener("focus",s=>{Ju(t,r,s.relatedTarget),le.get(t)?.callbacks.onLocationFocusChange(!0)}),i.addEventListener("blur",()=>{r.returning||(r.declined=!0,le.get(t)?.callbacks.onLocationFocusChange(!1))}),i.addEventListener("keydown",s=>{let a=le.get(t);if(!(!a||s.isComposing))switch(s.key){case"ArrowDown":case"ArrowUp":s.preventDefault(),a.callbacks.onLocationMove(s.key==="ArrowDown"?1:-1);return;case"Enter":if(s.preventDefault(),!a.interactive)return;Ze(t,!0),a.callbacks.onLocationCommit();return;case"Escape":s.preventDefault(),s.stopPropagation(),r.declined=!0,Ze(t);return;case"Backspace":if(i.value!=="")return;s.preventDefault(),r.declined=!0,Ze(t);return}}),Ae.set(t,r),r}function va(t){for(let e of t.querySelectorAll("[data-aia-location]")){let n=Ae.get(e);n&&(Ie(n)&&Ze(e),n.declined=!1,n.input.tabIndex=-1)}}function xa(t,e,n,i,o={}){let r=Array.from(t.children).find(l=>l.hasAttribute("data-aia-location"))??null;if(!e){if(r){let l=Ae.get(r);l&&Ie(l)&&Ze(r),r.remove()}return}r||(r=document.createElement("div"),t.appendChild(r));let s=Ae.get(r)??nd(r,n);s.input.tabIndex=0,le.set(r,{view:e,callbacks:i,interactive:o.interactive??!0}),U(s.results,ed,le.get(r)),s.input.value!==e.query&&!Ie(s)&&(s.input.value=e.query);let a=l=>`${r?.id}-row-${l}`;if(Sa(s.results,e,n,a),e.highlighted>=0&&e.highlighted<e.places.length?s.input.setAttribute("aria-activedescendant",a(e.highlighted)):s.input.removeAttribute("aria-activedescendant"),o.inputFocused){let l=o.reediting??!1;l&&!s.wasReediting&&(s.declined=!1),s.wasReediting=l}if(s.widgetFocused=o.inputFocused??!1,o.inputFocused){if(o.reediting&&!s.declined&&o.interactive!==!1&&!Ie(s)){let l=r;queueMicrotask(()=>{l.isConnected&&!Ae.get(l)?.declined&&td(l)})}}else{let l=s;setTimeout(()=>{if(l.widgetFocused)return;let c=l.returnTo;c&&He(c)===c||(l.declined=!1)},0)}}var id={itemSelector:"[data-aia-pill]",onClick:(t,e)=>{if(e.loading||t.disabled)return;let n=Number.parseInt(t.dataset.aiaPillIndex??"-1",10);n>=0&&e.onSelectPill(n)},preventMousedown:!0},Ea=[125,69];function wa(t,e){return e?1:t===0?.7:t===1?.4:.2}function An(t,e,n,i,o=!1,r=!1,s=!1){let a=t.querySelector(".magicx-aia-pill-list");if(a||(a=document.createElement("span"),a.className="magicx-aia-pill-list",t.appendChild(a)),U(a,id,{onSelectPill:i,loading:r}),r&&e.length===0){a.setAttribute("data-aia-pill-list-loading",""),a.innerHTML="";for(let l=0;l<Ea.length;l++){let c=Ea[l],u=document.createElement("span");u.setAttribute("data-aia-pill-skeleton",""),u.className=`magicx-aia-pill magicx-aia-pill--skeleton${o?" magicx-aia-pill--rounded":""}`,u.style.width=`${c}px`,u.style.setProperty("--aia-pill-opacity",String(wa(l,!1))),a.appendChild(u)}return}r?a.setAttribute("data-aia-pill-list-loading",""):a.removeAttribute("data-aia-pill-list-loading");for(let l of a.querySelectorAll("[data-aia-pill-skeleton]"))l.remove();ie(a,e,{keyOf:l=>`${l.type?.kind??""}|${De(l)?1:0}|${l.parameter}|${l.text}`,create:l=>{let c=document.createElement("button");if(c.type="button",c.tabIndex=-1,c.setAttribute("data-aia-pill",""),c.setAttribute("contenteditable","false"),De(l)){c.setAttribute("data-aia-smart-suggestion",A(l)?"header":"");let u=document.createElement("span");u.className="magicx-aia-smart-suggestion-text",u.textContent=l.text;let d=document.createElement("span");d.className="magicx-aia-smart-suggestion-sparkle",d.innerHTML=ri,c.append(u,d)}else c.textContent=l.text;return c.disabled=!0,c},update:(l,c,u)=>{let d=l,f=s&&u===n&&!r,p=["magicx-aia-pill"];o&&p.push("magicx-aia-pill--rounded"),r&&p.push("magicx-aia-pill--skeleton"),d.className=p.join(" "),d.style.width="",d.style.setProperty("--aia-pill-opacity",String(wa(u,f))),d.dataset.aiaPillIndex=String(u),d.toggleAttribute("data-aia-pill-active",u===n),r?d.setAttribute("data-aia-loading",""):d.removeAttribute("data-aia-loading")}}),G(a);for(let l of a.querySelectorAll("[data-aia-pill]"))l.disabled=r}function Io(t){t.querySelector(".magicx-aia-pill-list")?.remove()}var od=32;function Pa(t,e){if(e.ctrlKey)return null;let n=e.deltaY||0,i=e.deltaX||0;if(!n||Math.abs(i)>=Math.abs(n))return null;let o=t.scrollWidth-t.clientWidth;if(o<=1)return null;let r=t.scrollLeft,s=n;return e.deltaMode===1?s*=32:e.deltaMode===2&&(s*=t.clientWidth),Math.max(0,Math.min(o,r+s))}function Oo(t){let e=n=>{let i=Pa(t,n);i!==null&&(n.preventDefault(),t.scrollLeft=i)};return t.addEventListener("wheel",e,{passive:!1}),()=>t.removeEventListener("wheel",e)}var La=Intl.Segmenter,Ca=La?new La(void 0,{granularity:"grapheme"}):null;function ko(t){let e=t.trim().normalize("NFC").toUpperCase();if(Ca)for(let n of Ca.segment(e))return n.segment;return Array.from(e)[0]??"?"}var Mo=120,rd=360;function sd(t){let e=t.pathname;return t.hostname==="cdn.shopify.com"&&e.startsWith("/s/files/")||e.startsWith("/cdn/shop/")?/\.png$/i.test(e)?{format:"pjpg"}:/\.webp$/i.test(e)?{format:null}:null:null}function Aa(t,e){let n;try{n=new URL(t,typeof document>"u"?void 0:document.baseURI)}catch{return t}let i=sd(n);return i?(n.searchParams.set("width",String(e)),i.format&&n.searchParams.set("format",i.format),t.startsWith("/")&&!t.startsWith("//")?`${n.pathname}${n.search}${n.hash}`:n.href):t}function Ro(t,e){let n=Aa(t,e);return n===t?[t]:[n,t]}function _o(t,e){if(!(t>0)||!(e>0))return null;let n=t/e,i=o=>Math.round(o*1e3)/1e3;return{x:i(Math.min(n,1)),y:i(Math.min(1/n,1))}}function In(t){let e=t?.trim();return e?Ro(e,360):[]}function ad(t){return In(t)[0]}var On=new WeakMap,Ho=new WeakMap,Oa=new WeakMap;function ka(t,e,n,i,o,r="row",s="image",a=_(),l,c=!0,u=null){let d=t.querySelector(".magicx-aia-products");if(e.length===0){d?.remove();return}if(!d){d=document.createElement("section"),d.className="magicx-aia-products",d.setAttribute("data-aia-products",""),d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${n}-products-label`);let m=document.createElement("div");m.className="magicx-aia-products-label",m.id=`${n}-products-label`,m.setAttribute("data-aia-products-label",""),m.textContent=a.products;let g=document.createElement("div");g.className="magicx-aia-products-row",g.setAttribute("data-aia-products-row",""),Oo(g),d.append(m,g),t.appendChild(d)}d.setAttribute("data-aia-products-layout",r);let f=d.querySelector(".magicx-aia-products-label");f&&f.textContent!==a.products&&(f.textContent=a.products);let p=d.querySelector(".magicx-aia-products-row");if(p){ie(p,e,{keyOf:m=>md(m,!!l),create:m=>pd(m,i,o,s,a,l),update:(m,g,b)=>{On.set(m,g),ld(m,c?g.vendor:void 0),cd(m,g.price,g.compareAtPrice),m.id=`${n}-product-${b}`,m.dataset.aiaIndex=String(b),Oa.get(m)?.(s),Ye(m,"data-aia-product-state",g.id===u);let T=m.querySelector(".magicx-aia-product-badge");T&&T.textContent!==a.soldOut&&(T.textContent=a.soldOut);let S=m.querySelector(".magicx-aia-product-cart");S&&S.setAttribute("aria-label",Ma(g,a))}}),G(p);for(let m of p.querySelectorAll("[data-aia-product]")){let g=Ho.get(m);g&&(Ho.delete(m),g())}}}function No(t,e){let n=t.querySelectorAll("[data-aia-product], [data-aia-product-cart]");for(let i of n)je(i)||(i.tabIndex=e?0:-1)}function ld(t,e){let n=t.querySelector(".magicx-aia-product-vendor");if(!e){n?.remove();return}n||(n=document.createElement("span"),n.className="magicx-aia-product-vendor",t.querySelector(".magicx-aia-product-title")?.before(n)),n.textContent!==e&&(n.textContent=e)}function cd(t,e,n){let i=t.querySelector(".magicx-aia-product-price");if(!e){i?.remove();return}i||(i=document.createElement("span"),i.className="magicx-aia-product-price",i.append(document.createTextNode("")),t.querySelector(".magicx-aia-product-title")?.after(i));let o=i.firstChild;o.data!==e&&(o.data=e);let r=i.querySelector(".magicx-aia-product-compare-at");if(!n){r?.remove();return}r||(r=document.createElement("s"),r.className="magicx-aia-product-compare-at",i.append(r)),r.textContent!==n&&(r.textContent=n)}function Ia(t,e){e?(t.style.setProperty("--aia-product-photo-fill-x",String(e.x)),t.style.setProperty("--aia-product-photo-fill-y",String(e.y))):(t.style.removeProperty("--aia-product-photo-fill-x"),t.style.removeProperty("--aia-product-photo-fill-y"))}function Ma(t,e){return`${e.addToCart}: ${t.title}`}var Do="http://www.w3.org/2000/svg";function ud(){let t=document.createElementNS(Do,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false");let e=[["magicx-aia-product-cart-glyph","M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"],["magicx-aia-product-cart-glyph","M13.5 6.5v-4M11.5 4.5h4"],["magicx-aia-product-cart-check","M5 12.5l4.5 4.5L19 7.5"],["magicx-aia-product-cart-spinner","M12 4a8 8 0 1 0 8 8"]];for(let[n,i]of e){let o=document.createElementNS(Do,"path");o.setAttribute("class",n),o.setAttribute("d",i),t.appendChild(o)}for(let n of["9","17.5"]){let i=document.createElementNS(Do,"circle");i.setAttribute("class","magicx-aia-product-cart-glyph"),i.setAttribute("cx",n),i.setAttribute("cy","20"),i.setAttribute("r","1.3"),t.appendChild(i)}return t}function dd(t,e,n,i,o){let r=document.createElement("span");r.className="magicx-aia-product-cart",r.setAttribute("data-aia-product-cart",""),r.setAttribute("role","button"),r.setAttribute("aria-label",Ma(e,o)),r.tabIndex=0,r.appendChild(ud());let s=a=>{a.preventDefault(),a.stopPropagation(),r.getAttribute("data-aia-cart-state")!=="adding"&&(r.setAttribute("data-aia-cart-state","adding"),r.setAttribute("aria-busy","true"),n(On.get(t)??e).then(()=>{r.removeAttribute("aria-busy"),r.setAttribute("data-aia-cart-state","added")},()=>{r.removeAttribute("aria-busy"),r.removeAttribute("data-aia-cart-state")}))};return r.addEventListener("keydown",a=>{a.key!=="Enter"&&a.key!==" "||s(a)}),r.addEventListener("focus",()=>i(!0)),r.addEventListener("blur",a=>{a.relatedTarget?.closest("[data-aia-dropdown]")||i(!1)}),{el:r,arm:()=>r.addEventListener("click",s)}}function md(t,e){return[e?"cart":"",t.id,t.title,t.url,t.imageUrl,t.vendor,t.available===!1?"sold-out":""].map(n=>n??"").join("\0")}function pd(t,e,n,i,o,r){let s=document.createElement("a");s.className="magicx-aia-product",s.setAttribute("data-aia-product",""),s.setAttribute("role","option"),s.setAttribute("aria-selected","false"),s.tabIndex=0;let a=document.createElement("span");a.className="magicx-aia-product-media",a.setAttribute("data-aia-product-media",""),a.setAttribute("aria-hidden","true");let l=In(t.imageUrl),c=l[0],u=!!c,d=()=>{a.replaceChildren(),a.removeAttribute("data-aia-image-loaded"),a.toggleAttribute("data-aia-product-placeholder",i==="image"),a.toggleAttribute("data-aia-product-initial",i==="initial"),i==="initial"&&(a.textContent=ko(t.title))};if(Oa.set(s,g=>{g!==i&&(i=g,u||d())}),c){let g=document.createElement("img"),b=0;g.onload=()=>{a.setAttribute("data-aia-image-loaded",""),Ia(s,_o(g.naturalWidth,g.naturalHeight))},g.onerror=()=>{let T=l[++b];if(T){g.src=T;return}u=!1,Ia(s,null),d()},g.className="magicx-aia-product-image",g.src=c,g.alt="",g.loading="lazy",g.decoding="async",a.appendChild(g)}else d();s.appendChild(a);let f=document.createElement("span");f.className="magicx-aia-product-body";let p=document.createElement("span");if(p.className="magicx-aia-product-title",p.textContent=t.title,f.appendChild(p),t.available===!1){s.setAttribute("data-aia-product-sold-out","");let g=document.createElement("span");g.className="magicx-aia-product-badge",g.textContent=o.soldOut,f.appendChild(g)}s.appendChild(f);let m=r&&t.available!==!1?dd(s,t,r,n,o):null;return m&&(s.setAttribute("data-aia-product-has-cart",""),s.appendChild(m.el)),Ho.set(s,()=>{m?.arm(),t.url&&(s.href=t.url),s.addEventListener("click",g=>{g.metaKey||g.ctrlKey||g.shiftKey||g.altKey||g.button!==0||(g.preventDefault(),e(On.get(s)??t))})}),s.addEventListener("keydown",g=>{g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),e(On.get(s)??t))}),s.addEventListener("focus",()=>n(!0)),s.addEventListener("blur",g=>{g.relatedTarget?.closest("[data-aia-dropdown]")||n(!1)}),s}var fd=10,gd=44;function Fo(t,e,n){if(!e||n.detail===0)return!0;let i=t.getBoundingClientRect(),o=e.getBoundingClientRect();if(t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl"){let a=Math.min(o.left-10,i.right-44);return n.clientX>=a}let s=Math.max(o.right+10,i.left+44);return n.clientX<=s}var Te="data-aia-fit",kn="--aia-dropdown-fit-height",Ra=8,hd=160;function Wo({dropdown:t,isOpen:e}){let n=t.ownerDocument?.defaultView??null,i=!1,o=!1,r=null,s=null,a=null,l=null,c=!1,u=()=>{t.removeAttribute(Te),t.style.removeProperty(kn)},d=()=>{if(Se(t)){c=!0;return}c=!1,wo(t,t.getBoundingClientRect().height)},f=S=>`${r}|${(S??t).scrollHeight}|${t.offsetWidth}`,p=S=>a?.key===f(S)?a.height:null,m=S=>{let E=f(S);if(a?.key===E)return a.height;let y=S?.scrollTop??0;t.removeAttribute(Te);let h=t.offsetHeight;return t.setAttribute(Te,""),S&&y&&(S.scrollTop=y),a={key:E,height:h},h},g=()=>{if(i)return;if(!e()){o=!1;return}let S=Se(t),E=S?Eo(t):null;S&&l!==S&&(l=S,S.finished.then(b,b)),!S&&c&&d(),o||(o=!0,u());let y=t.hasAttribute(Te),h=$(t,".aia-grid")?.getAttribute("data-aia-group")??null,x=h!==r;r=h;let P=yd(t,n);if(P===null)return;let v=bd(t);if(y){let I=S?p(v):m(v);if(I!==null&&I<=P){u(),d();return}}else if((E??t.offsetHeight)<=P)return;let L=`${Math.max(hd,Math.floor(P))}px`,O=t.style.getPropertyValue(kn)!==L;O&&t.style.setProperty(kn,L),y?x&&v&&(v.scrollTop=0):t.setAttribute(Te,""),(O||!y)&&d()},b=()=>{i||s!==null||!n||(s=n.requestAnimationFrame(()=>{s=null,g()}))},T=n?.visualViewport??null;return T?.addEventListener("resize",b),T?.addEventListener("scroll",b),n?.addEventListener("resize",b),n?.addEventListener("scroll",b,{capture:!0,passive:!0}),g(),{update:g,destroy(){i||(i=!0,s!==null&&n?.cancelAnimationFrame(s),T?.removeEventListener("resize",b),T?.removeEventListener("scroll",b),n?.removeEventListener("resize",b),n?.removeEventListener("scroll",b,{capture:!0}))}}}function bd(t){for(let e of Array.from(t.children))if(e.classList.contains("aia-stack"))return e;return null}function yd(t,e){if(!e)return null;let n=e.visualViewport,i=n?n.offsetTop:0,o=n?n.height:e.innerHeight;if(!o)return null;let r=t.offsetParent,s=r?r.getBoundingClientRect().top:0,a=r?s+t.offsetTop:t.getBoundingClientRect().top;return t.closest("[data-options-position]")?.getAttribute("data-options-position")==="above"?(r?a+t.offsetHeight:t.getBoundingClientRect().bottom)-i-Ra:i+o-a-Ra}var Mn=.5;function Sd(t,e){let n=Math.max(0,t.scrollHeight-t.clientHeight),i=t.clientHeight-t.coverTop-t.coverBottom,o=t.scrollTop+t.coverTop,r=e.top+e.height,s=t.scrollTop;return e.top<o-Mn||e.height>i+Mn?s=Math.floor(e.top-t.coverTop):r>o+i+Mn&&(s=Math.ceil(r-t.coverTop-i)),Math.min(n,Math.max(0,s))}var _a=new WeakMap;function Da(t){let e=_a.get(t);if(e)return e;let n={shown:-1,byPointer:-1,held:!1,x:null,y:null,cancel:null};_a.set(t,n);let i=o=>Ha(n,o);for(let o of["mouseover","mouseout","mousemove"])t.addEventListener(o,i,{capture:!0,passive:!0});return n}function Ha(t,e){e.screenX===t.x&&e.screenY===t.y||(t.held=!1,t.x=e.screenX,t.y=e.screenY)}function Rn(t,e,n){if(!t)return!0;let i=Da(t);return Ha(i,n),i.held?!1:(i.byPointer=e,!0)}function Td(t){if(t.scrollHeight-t.clientHeight>1)return t;let e=t.closest(".aia-stack");return e?.parentElement?.hasAttribute(Te)&&e.scrollHeight-e.clientHeight>1?e:null}function vd(t,e){let n=t.getBoundingClientRect(),i=e.getBoundingClientRect();if(!(n.height>0)||!(i.height>0))return null;let o=t.offsetHeight>0?n.height/t.offsetHeight:1,r=t.ownerDocument.defaultView?.getComputedStyle(t);return{box:{scrollTop:t.scrollTop,clientHeight:t.clientHeight,scrollHeight:t.scrollHeight,coverTop:Number.parseFloat(r?.paddingTop??"")||0,coverBottom:Number.parseFloat(r?.paddingBottom??"")||0},row:{top:(i.top-n.top)/o-t.clientTop+t.scrollTop,height:i.height/o}}}function Bo(t,e){let n=Da(t);if(e===n.shown)return;let i=e===n.byPointer;if(n.byPointer=-1,e<0||i){n.shown=e;return}let o=t.querySelectorAll("[data-aia-option]")[e];if(!o||!(t.getBoundingClientRect().height>0))return;n.shown=e,n.cancel?.(),n.cancel=null;let r=Td(t),s=r?vd(r,o):null;if(!r||!s)return;let a=Sd(s.box,s.row);Math.abs(a-r.scrollTop)<Mn||(n.held=!0,n.cancel=wn(r,a-r.scrollTop,r.ownerDocument.defaultView,()=>{n.cancel=null}))}var Na="http://www.w3.org/2000/svg",xd=new Set(["svg","g","path","circle","ellipse","line","polyline","polygon","rect"]);function Ed(t,e){let n=t.toLowerCase();return n.startsWith("on")||n.includes("href")||n==="style"||n==="xml:base"||n==="id"||n==="name"||/^\s*javascript:/i.test(e)||/url\s*\(\s*['"]?\s*[^#'"\s)]/i.test(e)}var wd=["fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","fill-rule","clip-rule","opacity","fill-opacity","stroke-opacity"],Pd=/^[a-zA-Z0-9#.,%\s()-]+$/;function Ld(t){let e=[];for(let n of wd){let i=t.getAttribute(n);i===null||!Pd.test(i)||/url\s*\(/i.test(i)||e.push(`${n}: ${i.trim()}`)}e.length>0&&t.setAttribute("style",e.join("; "))}function Fa(t){for(let e of Array.from(t.attributes))Ed(e.name,e.value)&&t.removeAttribute(e.name);Ld(t);for(let e of Array.from(t.childNodes))if(e.nodeType===Node.ELEMENT_NODE){let n=e;!xd.has(n.localName)||n.namespaceURI!==Na?n.remove():Fa(n)}else e.remove()}function ce(t){if(typeof DOMParser>"u"||typeof XMLSerializer>"u")return null;let e=new DOMParser().parseFromString(t,"image/svg+xml"),n=e.documentElement;return!n||n.localName!=="svg"||n.namespaceURI!==Na||e.getElementsByTagName("parsererror").length>0?null:(Fa(n),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),new XMLSerializer().serializeToString(n))}function _n(t){return t.text}function Oe(t){return Lt(t)[0]??null}function Lt(t){let e=Cd(t);return e?Ro(e,120):[]}function Cd(t){if(!t)return null;let e=t.trim();if(e==="")return null;let n;try{n=new URL(e,typeof document>"u"?void 0:document.baseURI)}catch{return null}return n.protocol!=="http:"&&n.protocol!=="https:"?null:n.href}function Ct(t){return t===void 0||!Number.isInteger(t)||t<0?null:t.toLocaleString()}var Wa={one:"item",other:"items"};function Ad(t,e=Wa){let n=Ct(t);if(n===null)return null;let i=typeof e=="string"?e:t===1?e.one:e.other;return i===""?n:`${n} ${i}`}function Ba(t){return Oe(t.image_url)!==null}var Dn=new Map;function Id(t){let e=t.icon_svg;if(!e)return!1;let n=Dn.get(e);return n===void 0&&(n=ce(e)!==null,Dn.size>=256&&Dn.clear(),Dn.set(e,n)),n}function Vo(t,e,n){return!e&&!n?!1:t.every(i=>!i.is_tappable||n&&Ba(i)||e&&Id(i))}var Va=new WeakMap;function Od(t,e,n){let i=e.length,o=Et(),r=Va.get(t),s=n&&r&&zi(r.options,e)?r.plan:null,a=!s&&!n&&$i(i,o)?xt(t):null,l=s??qi(i,o,a?.rowWidths??null,a?.gridWidth??null);return n||Va.set(t,{options:e,plan:l}),t.style.gridTemplateColumns=l.template,t.style.setProperty("--aia-grid-max-height",l.maxHeight),t.querySelectorAll("[data-aia-option]").forEach((c,u)=>{c.classList.toggle("magicx-aia-option--scroll-hint",!n&&l.scrollHintIndices.includes(u))}),l.cols}function Ua(t,e){if(e.loading||!e.interactive)return null;let n=e.options[ye(t)];return n?.is_tappable?n:null}var kd=2e3,At=new WeakMap;function Md(t,e){t.classList.add("magicx-aia-option--pressed");let n=t.closest(".aia-grid");if(!n)return;let i=`${Date.now()}:${e}`;n.dataset.aiaPress=e,n.dataset.aiaPressToken=i,clearTimeout(At.get(n)),At.set(n,setTimeout(()=>{At.delete(n),n.dataset.aiaPressToken===i&&$a(n,!0)},kd))}function $a(t,e=!1){clearTimeout(At.get(t)),At.delete(t),delete t.dataset.aiaPress,delete t.dataset.aiaPressToken;for(let n of t.querySelectorAll(".magicx-aia-option--pressed"))n.classList.remove("magicx-aia-option--pressed");e&&vo(t.closest("[data-aia-dropdown]"))}var Rd={itemSelector:"[data-aia-option]",onClick:(t,e,n)=>{let i=Ua(t,e);if(!i)return;let o=t.querySelector(".magicx-aia-checkbox"),r=o!==null&&!Fo(t,o,n);if((!o||r)&&Md(t,i.text),o){let s=r||t.getAttribute("aria-selected")!=="true";t.setAttribute("aria-selected",String(s)),o.dataset.checked=String(s)}r?e.onSelect(i,{commit:!0}):e.onSelect(i)},onEnter:(t,e,n)=>{if(!Ua(t,e))return;let i=ye(t);Rn(t.closest(".aia-grid"),i,n)&&e.onHighlight(i)},onLeave:(t,e,n)=>{Rn(t.closest(".aia-grid"),-1,n)&&e.onHighlight(-1,ye(t))}};function qa(t,e,n,i,o,r,s,a="",l="below",c=!0,u=!0,d=!0,f=!0,p){let m=t.querySelector(".aia-grid");if(e.length===0){m?.remove();return}m||(m=document.createElement("div"),m.className="aia-grid magicx-aia-grid",m.setAttribute("data-scroll",""),m.style.setProperty("--aia-grid-min","250px"),m.style.setProperty("--aia-grid-max","1fr"),m.style.setProperty("--aia-grid-gap","0"),t.appendChild(m)),U(m,Rd,{options:e,onSelect:i,onHighlight:o,loading:s,interactive:f});let g=m.dataset.aiaGroup!==a;m.dataset.aiaGroup=a,g&&$a(m);let b=Vo(e,c,u);_d(m,e,n,r,s,{showIcons:c&&b,showImages:u&&b,showCounts:d,picked:p});let T=Od(m,e,s);Dd(m,e.length,T,s,l),g&&(m.scrollTop=0),Bo(m,s?-1:n)}function _d(t,e,n,i,o,r){let s=o?"1":"0",a=t.dataset.aiaGroup??"",{showIcons:l,showImages:c,showCounts:u}=r,d=l?m=>m.icon??m.icon_svg??"":()=>"",f=c?m=>`${Oe(m.image_url)??""}${(m.imageCollage??[]).join("")}`:()=>"",p=u?m=>Ct(m.item_count)??"":()=>"";ie(t,e,{keyOf:m=>`${m.text}\0${m.parameter??""}\0${m.parameterLabel??""}\0${d(m)}\0${f(m)}\0${p(m)}\0${s}\0${a}`,create:(m,g)=>{let b=Hd(m,o,r);return t.dataset.aiaPress===m.text&&b.classList.add("magicx-aia-option--pressed"),o||(b.dataset.aiaEntering=""),b},update:(m,g,b)=>{if(Uo.get(m)!==(g.matchedText??"")){let E=m.querySelector(".magicx-aia-option-text");E&&Ga(E,g),Uo.set(m,g.matchedText??"")}let T=b===n&&!o;m.id=`${i}-option-${b}`,m.dataset.aiaIndex=String(b),m.setAttribute("aria-selected",String(r.picked?r.picked.includes(g.text):T));let S=m.querySelector(".magicx-aia-checkbox");r.picked&&g.is_tappable?(S||(S=document.createElement("span"),S.className="magicx-aia-checkbox",S.setAttribute("aria-hidden","true"),m.querySelector(".magicx-aia-option-content")?.prepend(S)),S.dataset.checked=String(r.picked.includes(g.text))):S?.remove(),m.classList.toggle("magicx-aia-option--highlighted",T),m.classList.toggle("magicx-aia-option--live-match",!!g.liveMatch&&!o)}})}function Dd(t,e,n,i,o){for(let r of t.querySelectorAll("[data-aia-entering]")){if(!i){let s=Number.parseInt(r.dataset.aiaIndex??"-1",10);s>=0&&r.style.setProperty(uo,`${mo(s,n,e,o)}ms`)}delete r.dataset.aiaEntering}}var Uo=new WeakMap;function Ga(t,e){if(t.replaceChildren(),e.matchedText)for(let n of Zi(_n(e),e.matchedText))if(n.bold){let i=document.createElement("strong");i.className="magicx-aia-option-match",n.partial&&i.setAttribute("data-aia-match-partial",""),i.textContent=n.text,t.appendChild(i)}else t.appendChild(document.createTextNode(n.text));else t.appendChild(document.createTextNode(_n(e)));if(e.parameterLabel){t.appendChild(document.createTextNode(" "));let n=document.createElement("span");n.className="magicx-aia-option-parameter",n.textContent=e.parameterLabel,t.appendChild(n)}}function Hd(t,e,{showIcons:n,showImages:i,showCounts:o}){let r=document.createElement("div");r.setAttribute("role","option"),r.setAttribute("data-aia-option",""),e&&r.setAttribute("data-aia-loading",""),r.tabIndex=e||!t.is_tappable?-1:0;let s=["magicx-aia-option"];t.is_tappable?s.push("magicx-aia-option--tappable"):s.push("magicx-aia-option--non-tappable"),r.className=s.join(" ");let a=document.createElement("span");a.className="magicx-aia-option-content";let l=i?Lt(t.image_url):[],c=l[0];if(c){let p=document.createElement("span");p.className="magicx-aia-option-image",p.setAttribute("aria-hidden","true");let m=(t.imageCollage??[]).map(g=>Lt(g)).filter(g=>g.length>0);m.length>1&&p.setAttribute("data-aia-collage",String(m.length));for(let g of m.length>1?m:[l]){let b=document.createElement("img");b.setAttribute("alt",""),b.setAttribute("loading","lazy"),b.setAttribute("decoding","async"),b.setAttribute("referrerpolicy","no-referrer"),b.setAttribute("draggable","false");let T=0;b.onload=()=>p.setAttribute("data-aia-image-loaded",""),b.onerror=()=>{let S=g[++T];S?b.src=S:b.hidden=!0},b.src=g[0],p.appendChild(b)}a.appendChild(p),r.dataset.aiaImage=""}let u=!c&&n&&t.icon_svg?ce(t.icon_svg):null;if(u){let p=document.createElement("span");p.className="magicx-aia-option-icon",p.setAttribute("aria-hidden","true"),p.innerHTML=u,a.appendChild(p),t.icon&&(r.dataset.aiaIcon=t.icon)}let d=document.createElement("span");if(d.className="magicx-aia-option-text",Ga(d,t),Uo.set(r,t.matchedText??""),a.appendChild(d),t.tag){let p=document.createElement("span");p.className="magicx-aia-option-tag",p.textContent=t.tag,a.appendChild(p)}let f=o?Ct(t.item_count):null;if(f!==null){let p=document.createElement("span");p.className="magicx-aia-option-count",p.textContent=f,a.appendChild(p),r.dataset.aiaItemCount=String(t.item_count)}return r.appendChild(a),r}var Nd=120,Fd={itemSelector:"[data-aia-time-row], [data-aia-time-done]",onClick:(t,e)=>{if(!e.interactive)return;if(t.hasAttribute("data-aia-time-done")){e.callbacks.onTimeCommit();return}let n=t.dataset.aiaTimeColumn;n&&e.callbacks.onTimeChange(ln(n,e.view.minutes,Number(t.dataset.aiaIndex)))}},za=new WeakMap,Ka=new WeakMap;function Qa(t,e,n,i,o=!0){let r=t.querySelector(".magicx-aia-time-wheel");if(!e){r?.remove();return}if(!r){r=Vd(),t.appendChild(r),G(r);let c=r.querySelector("[data-aia-time-done]");c&&(c.disabled=!1)}let s={view:e,callbacks:i,interactive:o};za.set(r,s),U(r,Fd,s),r.setAttribute("aria-label",n.timeLabel);let a=r.querySelector("[data-aia-time-done]");a&&(a.textContent=n.done);let l=r.querySelector("[data-aia-time-value]");l&&(l.textContent=on(e.minutes));for(let c of sn){let u=r.querySelector(`[data-aia-time-column="${c}"]`);u&&Wd(u,c,e.minutes)}}function Wd(t,e,n){let i=an(e,n);for(let s of t.querySelectorAll("[data-aia-time-row]")){let a=Number(s.dataset.aiaIndex)===i;s.classList.toggle("magicx-aia-time-wheel-row--selected",a),s.setAttribute("aria-selected",String(a))}let o=Hn(t);if(o.settle)return;let r=i*rn;Math.abs(t.scrollTop-r)<1||(o.syncedTop=r,t.scrollTop=r)}function Hn(t){let e=Ka.get(t);return e||(e={syncedTop:null,settle:null},Ka.set(t,e)),e}function Bd(t,e,n){let i=Hn(e);if(i.syncedTop!=null&&Math.abs(e.scrollTop-i.syncedTop)<1){i.syncedTop=null;return}i.syncedTop=null,i.settle&&clearTimeout(i.settle),i.settle=setTimeout(()=>Ya(t,e,n),Nd)}function Ya(t,e,n){let i=Hn(e);i.settle&&clearTimeout(i.settle),i.settle=null;let o=za.get(t);if(!o||!o.interactive)return;let r=Ri(n,e.scrollTop);r!==an(n,o.view.minutes)&&o.callbacks.onTimeChange(ln(n,o.view.minutes,r))}function Vd(){let t=document.createElement("div");t.className="magicx-aia-time-wheel",t.setAttribute("data-aia-time-wheel",""),t.setAttribute("role","group");let e=document.createElement("span");e.className="magicx-aia-time-wheel-value",e.setAttribute("data-aia-time-value",""),e.setAttribute("aria-live","polite");let n=document.createElement("div");n.className="magicx-aia-time-wheel-columns",n.setAttribute("aria-hidden","true");let i=document.createElement("div");i.className="magicx-aia-time-wheel-band",n.appendChild(i);for(let r of sn){if(r==="minute"){let s=document.createElement("span");s.className="magicx-aia-time-wheel-separator",s.textContent=":",n.appendChild(s)}n.appendChild(Ud(t,r))}let o=document.createElement("button");return o.type="button",o.tabIndex=-1,o.className="magicx-aia-time-wheel-done",o.setAttribute("data-aia-time-done",""),o.disabled=!0,t.append(e,n,o),t}function Ud(t,e){let n=document.createElement("div");return n.className="magicx-aia-time-wheel-column",n.setAttribute("data-aia-time-column",e),Mi(e).forEach((i,o)=>{let r=document.createElement("div");r.className="magicx-aia-time-wheel-row",r.setAttribute("data-aia-time-row",""),r.dataset.aiaTimeColumn=e,r.dataset.aiaIndex=String(o),r.textContent=i.label,n.appendChild(r)}),n.addEventListener("scroll",()=>Bd(t,n,e),{passive:!0}),n.addEventListener("scrollend",()=>{Hn(n).settle&&Ya(t,n,e)}),n}var $d=[159,119,164];function Wn(t){let e=document.createElement("div");return e.id=t,e.setAttribute("role","listbox"),e.setAttribute("data-aia-dropdown",""),e.className="magicx-aia-dropdown",e.addEventListener("mousedown",n=>n.preventDefault()),ao(e),e}var Nn=new WeakMap;function qd(t,e,n){let i=Nn.get(t);if(i||(i={button:Zs(t.ownerDocument,n),grid:null,controller:null},t.appendChild(i.button),Nn.set(t,i)),i.button.getAttribute("aria-label")!==n.scrollArrow&&i.button.setAttribute("aria-label",n.scrollArrow),i.grid!==e&&(i.controller?.destroy(),i.controller=null,i.grid=e,e)){i.controller=go({dropdown:t,grid:e,button:i.button});return}i.controller?.update()}var Fn=new WeakMap;function ja(t){let e=Fn.get(t);if(e){e.update();return}Fn.set(t,Wo({dropdown:t,isOpen:()=>t.classList.contains("magicx-aia-dropdown--visible")}))}function $o(t){Fn.get(t)?.destroy(),Fn.delete(t),Po(t);let e=Nn.get(t);e&&(e.controller?.destroy(),Nn.delete(t))}function Bn(t,e){let n=e.strings??_(),{filteredOptions:i,activeIndex:o,isOpen:r,isLoading:s,showPills:a,isActivePillSelected:l,onSelect:c,onHighlight:u,onPillClick:d,onSkip:f}=e,p=oi(e.pills,n.keepTyping),m=si(p),g=a&&p.length>0,b=i.length>0,T=e.products.length>0,S=e.formatType==="time"&&e.timeView!=null,E=e.formatType==="location"&&e.locationView!=null,y=r&&(b||g||s||T||S||E);if(y?t.classList.add("magicx-aia-dropdown--visible"):t.classList.remove("magicx-aia-dropdown--visible"),s?t.setAttribute("data-aia-loading",""):t.removeAttribute("data-aia-loading"),!y){No(t,!1),va(t),ja(t),Cn(t,null,{visible:!1});return}T?t.setAttribute("data-aia-has-products",""):t.removeAttribute("data-aia-has-products"),t.toggleAttribute(Co,e.fullWidth===!0),Pt(t),t.toggleAttribute("data-aia-skeleton-exiting",!!e.skeletonExiting);let h=t.querySelector(".aia-stack");h||(h=document.createElement("div"),h.className="aia-stack",h.style.setProperty("--aia-stack-space","8px"),t.appendChild(h));let x=e.showSkipButton&&m&&!e.isInputEmpty,P=g||s&&a||x,v=h.querySelector(".magicx-aia-pill-bar");if(P){v||(v=document.createElement("div"),v.className="magicx-aia-pill-bar aia-cluster",v.setAttribute("data-nowrap",""),v.setAttribute("data-aia-pillbar",""),h.insertBefore(v,h.firstChild));let ue=g||s&&a,C=v.querySelector(".magicx-aia-pill-scroll");ue?(C||(C=document.createElement("span"),C.className="magicx-aia-pill-scroll",C.setAttribute("data-aia-pill-scroll",""),v.insertBefore(C,v.firstChild)),An(C,p,0,d,!0,s,l)):C&&C.remove(),zd(v,x,s||e.skipDisabled,p[0],f,n)}else v&&v.remove();let L=e.suggestions[0],O=L?`${L.parameter} ${L.text}`:"",I=H(e.formatType),K=I&&!s;qa(h,I?[]:i,o,c,u,e.listboxId,s,O,e.optionsPosition??"below",e.showOptionIcons??!0,e.showOptionImages??!0,e.showOptionCounts??!0,!e.skipDisabled,e.multiSelectView?.picked),t.setAttribute("aria-multiselectable",String(!!e.multiSelectView)),Zd(h,!!e.multiSelectView,e.skipDisabled||s,e.onMultiSelectCommit,n.done),qd(t,h.querySelector(".aia-grid"),n),ba(h,K?i:[],o,e.listboxId,K?e.dateView:null,{selectedIso:e.selectedDateIso,selectedRange:e.selectedDateRange,rangeStart:e.dateRangeStart,floor:oo(e.formatType,e.dateRangeStart),references:e.dateReferences??[]},{onSelect:c,onHighlight:u,onPreviousMonth:e.onPreviousMonth,onNextMonth:e.onNextMonth},!e.skipDisabled),Qa(h,e.formatType==="time"&&!s?e.timeView:null,n,{onTimeChange:e.onTimeChange,onTimeCommit:e.onTimeCommit},!e.skipDisabled),xa(h,e.formatType==="location"&&!s?e.locationView:null,n,{onLocationQuery:e.onLocationQuery,onLocationMove:e.onLocationMove,onLocationCommit:e.onLocationCommit,onLocationFocusChange:e.onLocationFocusChange},{interactive:!e.skipDisabled,inputFocused:e.isFocused??!1,reediting:e.isReediting??!1});let M=h.querySelector(".magicx-aia-skeleton-bars");if(s&&(!b||F(e.formatType))){if(!M){M=document.createElement("div"),M.className="magicx-aia-skeleton-bars",M.setAttribute("data-aia-skeleton-bars","");for(let ue of $d){let C=document.createElement("span");C.className="magicx-aia-skeleton-bar",C.style.width=`${ue}px`,M.appendChild(C)}h.appendChild(M)}}else M&&M.remove();ka(h,e.products,e.listboxId,e.onProductSelect,e.onProductFocusChange,e.productsLayout??"row",e.productImageFallback??"image",n,e.onProductAddToCart,e.showProductVendor??!0,e.busyProductId??null),No(t,!s),Xd(h,e.onSeeAllResults,n.seeAllResults,e.seeAllBusy===!0);let z=h.querySelector(".magicx-aia-footer")??Yd(n),Z=o>=0&&!!i[o]?.is_tappable;Qd(z,so(Z,e.isInputEmpty,n)),z.isConnected||h.appendChild(z),Gd(h,[".magicx-aia-pill-bar",".aia-grid","[data-aia-multi-actions]",".magicx-aia-datepicker",".magicx-aia-time-wheel","[data-aia-location]",".magicx-aia-skeleton-bars",".magicx-aia-products","[data-aia-see-all]",".magicx-aia-footer"]),co(h,h.querySelector(".magicx-aia-multi-done")),Ao(t,h,{eligible:b&&!T&&!I&&!S&&!E&&!e.onSeeAllResults&&!e.fullWidth,loading:s}),ja(t),Cn(t,xo(a?p:[]),{visible:!0,anchorBottom:e.optionsPosition==="above"})}function Gd(t,e){let n=e.map(i=>t.querySelector(`:scope > ${i}`)).filter(i=>i!==null);for(let i=0;i<n.length;i++)t.children[i]!==n[i]&&t.insertBefore(n[i],t.children[i]??null)}var Kd={itemSelector:".magicx-aia-skip",onClick:(t,e)=>{e.loading||e.onSkip()}};function zd(t,e,n,i,o,r){U(t,Kd,{onSkip:o,loading:n});let s=t.querySelector(".magicx-aia-skip");if(!e){s?.remove();return}s||(s=document.createElement("button"),s.type="button",s.tabIndex=-1,s.className="magicx-aia-skip",s.setAttribute("data-aia-skip",""),s.textContent=r.skip,s.disabled=!0,t.appendChild(s),G(s)),s.textContent!==r.skip&&(s.textContent=r.skip),s.setAttribute("aria-label",i?`${r.skipLabel} ${i.text}`:r.skipLabel),s.disabled=n}function Qd(t,{key:e,hint:n}){let i=t.querySelector(".magicx-aia-footer-key"),o=t.querySelector(".magicx-aia-footer-hint");!i||!o||(i.textContent!==e&&(i.textContent=e),o.textContent!==n&&(o.textContent=n))}function Yd(t){let e=document.createElement("footer");e.className="magicx-aia-footer",e.setAttribute("data-aia-footer","");let n=document.createElement("div");n.className="aia-cluster magicx-aia-footer-row",n.setAttribute("data-align","center"),n.setAttribute("data-justify","between"),n.setAttribute("data-nowrap","");let i=document.createElement("div");i.className="aia-cluster magicx-aia-footer-hint-group",i.setAttribute("data-align","center"),i.style.setProperty("--aia-cluster-gap","5px");let o=document.createElement("kbd");o.className="magicx-aia-footer-key",o.textContent="tab";let r=document.createElement("span");r.className="magicx-aia-footer-hint",r.textContent=t.select,i.append(o,r);let s=document.createElement("a");s.className="aia-cluster magicx-aia-footer-brand-link",s.setAttribute("data-align","center"),s.href=ro(),s.target="_blank",s.rel="noopener noreferrer",s.style.setProperty("--aia-cluster-gap","2px");let a=document.createElement("span");a.className="magicx-aia-footer-brand",a.textContent="Powered by Intent-1";let l=document.createElement("span");return l.className="magicx-aia-footer-badge",l.append(a),s.append(l),n.append(i,s),e.append(n),e}var jd={itemSelector:".magicx-aia-see-all",onClick:(t,e,n)=>{e.submit&&(n.stopPropagation(),e.submit())}};function Xd(t,e,n,i){let o=t.querySelector(":scope > [data-aia-see-all]");if(!e){o?.remove();return}if(!o){o=document.createElement("div"),o.className="magicx-aia-see-all-row",o.dataset.aiaSeeAll="";let s=document.createElement("button");s.type="button",s.tabIndex=-1,s.className="magicx-aia-see-all",s.disabled=!0,o.appendChild(s),t.appendChild(o),G(s)}U(o,jd,{submit:e});let r=o.querySelector("button");r&&(r.textContent!==n&&(r.textContent=n),r.disabled=!1,Ye(r,"data-aia-see-all-state",i))}var Jd={itemSelector:".magicx-aia-multi-done",onClick:(t,e)=>{e.disabled||e.commit?.()}};function Zd(t,e,n,i,o){let r=t.querySelector("[data-aia-multi-actions]");if(!e){r?.remove();return}if(!r){r=document.createElement("div"),r.dataset.aiaMultiActions="";let a=document.createElement("button");a.type="button",a.tabIndex=-1,a.className="magicx-aia-multi-done",a.setAttribute("data-aia-multi-done",""),a.disabled=!0,r.appendChild(a),t.appendChild(r),G(a)}U(r,Jd,{commit:i,disabled:n});let s=r.querySelector("button");s&&(s.textContent=o,s.disabled=n)}function It(t,e,n){if(e)return[e];if(!t)return n;let i=n.filter(o=>o.parameter!==t.parameter||o.text!==t.text);return[t,...i]}function Xa(t,e){let n=Wn(e.listboxId);return t.appendChild(n),{dropdown:n}}function qo(t,e,n){let i=wt(e);Bn(t.dropdown,{strings:n.strings,suggestions:e.editingIdentified?[{parameter:e.editingIdentified.parameter,text:se(e.editingIdentified.parameter),required:!0,options:e.filteredOptions}]:e.dropdownSuggestion??e.actionableSuggestions[0]?[{...e.dropdownSuggestion??e.actionableSuggestions[0],options:e.dropdownOptions}]:[],filteredOptions:e.dropdownOptions,activeIndex:e.activeDropdownIndex,isOpen:e.isDropdownOpen,isLoading:e.dropdownLoading,skeletonExiting:e.skeletonExiting,listboxId:n.listboxId,pills:It(e.dropdownSuggestion,null,e.actionableSuggestions),showPills:!0,showSkipButton:n.showSkipButton&&!e.editingParam&&!e.editingIdentified,skipDisabled:e.inSelectionAnimation,showOptionIcons:n.showOptionIcons??!0,showOptionImages:n.showOptionImages??!0,showOptionCounts:n.showOptionCounts??!0,isActivePillSelected:e.isActivePillSelected,isInputEmpty:e.text.trim().length===0,products:e.products,productsLayout:n.productsLayout??"row",productImageFallback:n.productImageFallback??"image",showProductVendor:n.showProductVendor??!0,onProductAddToCart:n.addProductToCart,formatType:e.activeFormatType,dateView:e.dateView,selectedDateIso:i.selectedIso,selectedDateRange:i.selectedRange,dateRangeStart:i.rangeStart,dateReferences:i.references,timeView:e.timeView,multiSelectView:e.dropdownMultiSelect,locationView:e.locationView,isReediting:e.editingParam!=null,isFocused:e.isFocused||e.locationFieldFocused,optionsPosition:n.optionsPosition??"below",onSelect:n.selectOption,onHighlight:(o,r)=>{r!==void 0&&n.store.get().activeDropdownIndex!==r||n.store.set({activeDropdownIndex:o,highlightByPointer:o>=0})},onPillClick:n.setActivePill,onSkip:n.skipActivePill,onPreviousMonth:n.showPreviousMonth,onNextMonth:n.showNextMonth,onTimeChange:n.setTime,onTimeCommit:n.commitTime,onMultiSelectCommit:n.commitMultiSelect,onLocationQuery:n.setLocationQuery,onLocationMove:n.moveLocationHighlight,onLocationCommit:n.commitLocation,onLocationFocusChange:n.setLocationFieldFocused,busyProductId:e.selectingProductId,onProductSelect:n.selectProduct,onProductFocusChange:o=>n.store.set({isFocused:o})})}var em="[data-aia-chip-remove]";function Go(t,e){let n=e;if(!n||n.nodeType===void 0)return null;let o=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(em)??null;return o&&t.contains(o)?o:null}function Ko(t,e){let n=null,i=!1,o=d=>{if(n=null,i){u();return}let f=d;if(f.button)return;let p=Go(t,d.target);if(!p)return;d.preventDefault(),d.stopPropagation();let m=p.dataset.aiaChipRemove,g=f.pointerType==="touch"||f.pointerType==="pen";n={id:m,x:f.clientX,y:f.clientY,pending:g},!g&&m&&e(m)},r=d=>{if(!n?.pending)return;n.pending=!1;let f=d;if(Math.hypot(f.clientX-n.x,f.clientY-n.y)>10)return;let m=t.getRootNode().elementFromPoint?.(f.clientX,f.clientY)??d.target,g=Go(t,m)?.dataset.aiaChipRemove;g&&g===n.id&&e(g)},s=()=>{n&&(n.pending=!1)},a=d=>{!n&&!Go(t,d.target)||(d.cancelable&&d.preventDefault(),d.type==="click"&&(d.stopImmediatePropagation(),n=null,i&&u()))},l={capture:!0},c={capture:!0,passive:!1};t.addEventListener("pointerdown",o,l),t.addEventListener("pointerup",r,l),t.addEventListener("pointercancel",s,l),t.addEventListener("touchstart",a,c),t.addEventListener("mousedown",a,l),t.addEventListener("click",a,l);let u=()=>{t.removeEventListener("pointerdown",o,l),t.removeEventListener("pointerup",r,l),t.removeEventListener("pointercancel",s,l),t.removeEventListener("touchstart",a,c),t.removeEventListener("mousedown",a,l),t.removeEventListener("click",a,l)};return()=>{if(n){i=!0;return}u()}}var tm=340;function zo(t){let e=t.ownerDocument.defaultView;if(!e||typeof e.MutationObserver!="function")return()=>{};let n=()=>{if(!t.isConnected)return;let u=t.style.height?t.getBoundingClientRect().height:0;t.style.height="";let d=t.getBoundingClientRect().height;if(d!==0){if(u===0||Math.abs(d-u)<.5){t.style.height=`${d}px`;return}t.style.height=`${u}px`,t.getBoundingClientRect(),t.style.height=`${d}px`}},i=-1,o=typeof e.ResizeObserver=="function"?new e.ResizeObserver(u=>{for(let f of u)if(f.target!==t){n();return}let d=t.getBoundingClientRect().width;Math.abs(d-i)<.5||(i=d,n())}):null,r=()=>{for(let u of Array.from(t.children))o?.observe(u)},s=0,a=()=>{r(),n(),e.clearTimeout(s),s=e.setTimeout(n,340)},l=new e.MutationObserver(a);l.observe(t,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:["data-placeholder","data-aia-empty"]}),o?.observe(t),r(),t.addEventListener("load",a,!0);let c=!1;return t.ownerDocument.fonts?.ready.then(()=>{c||n()}),n(),()=>{c=!0,t.removeEventListener("load",a,!0),l.disconnect(),o?.disconnect(),e.clearTimeout(s),t.style.height=""}}var tl=2600,nm=3,Xo="data-aia-hint",jo="magicx-aia-hint",nl="data-aia-hint-el",im={position:"absolute",pointerEvents:"none",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--aia-hint-color, #999)",userSelect:"none"},om=280,rm=320,sm=380,Qo="cubic-bezier(0.25, 0.1, 0.25, 1)",Ja=new Set(["a","an","the","some","my"]),$n=new WeakMap;function am(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Za(t,e){let n=t.text.trim(),i=e.trim(),o=[];i&&n.toLowerCase().startsWith(`${i.toLowerCase()} `)&&(n=n.slice(i.length+1).trim());let r=i?i.split(/\s+/):[],s=null;r.length>1&&Ja.has(r[r.length-1].toLowerCase())&&(s=r.pop()??null);let a=r.join(" ");a&&o.push({key:`w:${a.toLowerCase()}`,text:a,icon:null});let l=null,[c,...u]=n.split(/\s+/);u.length&&c&&Ja.has(c.toLowerCase())&&(l=c,n=u.join(" "));let d=l??s;d&&o.push({key:`w:${d.toLowerCase()}`,text:d,icon:null});let f=t.icon_svg?ce(t.icon_svg):null;return o.push({key:`c:${f??""}:${n}`,text:n,icon:f}),o}function lm(t,e){let n=t.createElement("span");if(n.className=`${jo}__word`,n.dataset.key=e.key,n.style.display="inline-block",e.icon){let i=t.createElement("span");i.className=`${jo}__icon`,Object.assign(i.style,{display:"inline-flex",width:"1em",height:"1em",marginRight:"0.25em",verticalAlign:"-0.125em",opacity:"var(--aia-hint-icon-opacity, 0.7)"}),i.innerHTML=e.icon;let o=i.querySelector("svg");o&&(o.style.width="100%",o.style.height="100%"),n.appendChild(i)}return n.appendChild(t.createTextNode(e.text)),n}function Yo(t,e,n){return typeof t.animate=="function"?t.animate(e,n):null}function Vn(t,e){let n=t.ownerDocument?.defaultView;if(!n)return;let i=n.getComputedStyle(t),o=u=>Number.parseFloat(u)||0,r=t.offsetLeft+o(i.borderLeftWidth)+o(i.paddingLeft),s=t.offsetTop+o(i.borderTopWidth)+o(i.paddingTop),a=t.clientWidth-o(i.paddingLeft)-o(i.paddingRight),l=t.offsetParent instanceof HTMLElement?t.offsetParent.clientWidth-r:0,c=Math.max(a,l);e.style.left=`${r}px`,e.style.top=`${s}px`,c>0&&(e.style.maxWidth=`${c}px`),e.style.font=i.font,e.style.lineHeight=i.lineHeight,e.style.letterSpacing=i.letterSpacing,e.style.fontWeight="var(--aia-hint-font-weight, 300)"}function el(t,e,n,i){let{el:o}=t,r=o.ownerDocument,s=new Map;for(let p of Array.from(o.children))p.dataset.leaving===void 0&&p.dataset.key&&s.set(p.dataset.key,p);let a=new Map;for(let[p,m]of s)a.set(p,m.offsetLeft);let l=new Set(e.map(p=>p.key));for(let[p,m]of s){if(l.has(p))continue;if(!n){m.remove();continue}m.dataset.leaving="",m.style.position="absolute",m.style.left=`${a.get(p)??0}px`,m.style.top=`${m.offsetTop}px`;let g=Yo(m,[{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:om,easing:Qo,fill:"forwards"});g?g.onfinish=()=>m.remove():m.remove()}let c=Array.from(o.children).filter(p=>p.dataset.leaving!==void 0),u=[];if(e.forEach((p,m)=>{m>0&&u.push(r.createTextNode(" ")),u.push(s.get(p.key)??lm(r,p))}),o.replaceChildren(...u,...c),!n)return;let d=new Map;for(let p of u)p instanceof HTMLElement&&p.dataset.key&&d.set(p.dataset.key,p);let f=0;for(let p of e){let m=d.get(p.key);if(m)if(!s.has(p.key))Yo(m,[{opacity:0,filter:"blur(2px)"},{opacity:1,filter:"blur(0)"}],{duration:rm,delay:i?80*f++:180+60*f++,easing:Qo,fill:"backwards"});else{let b=(a.get(p.key)??m.offsetLeft)-m.offsetLeft;Math.abs(b)>.5&&Yo(m,[{transform:`translateX(${b}px)`},{transform:"none"}],{duration:sm,easing:Qo})}}}function Un(t){let e=$n.get(t);e&&(e.timer!==null&&clearInterval(e.timer),e.resize?.disconnect(),e.el.remove(),$n.delete(t),t.removeAttribute(Xo),t.removeAttribute("aria-placeholder"))}function il(t,e,n,i){let o=i.filter(m=>m.text.trim()!=="").slice(0,nm),r=t.parentElement;if(!e||o.length<2||!r){Un(t);return}let s=`${n}\0${o.map(m=>`${m.text}${m.icon_svg??""}`).join("\0")}`,a=$n.get(t);if(a&&a.key===s&&a.el.isConnected){Vn(t,a.el);return}Un(t);let l=t.ownerDocument,c=l.createElement("span");c.className=jo,c.setAttribute(nl,""),c.setAttribute("aria-hidden","true"),Object.assign(c.style,im),r.insertBefore(c,t),t.setAttribute(Xo,""),n.trim()&&t.setAttribute("aria-placeholder",n.trim()),Vn(t,c);let u=l.defaultView,d=u?.ResizeObserver?new u.ResizeObserver(()=>{c.isConnected&&Vn(t,c)}):null;d?.observe(r);let f=am(t),p={key:s,lead:n,options:o,index:0,el:c,timer:null,resize:d};$n.set(t,p),el(p,Za(o[0],n),!f,!0),!f&&(p.timer=setInterval(()=>{if(!t.isConnected||!c.isConnected){Un(t);return}t.ownerDocument?.hidden||(p.index=(p.index+1)%p.options.length,Vn(t,c),el(p,Za(p.options[p.index],p.lead),!0,!1))},tl))}function Jo(t){Un(t)}function Zo(t){return(t.find(n=>n.type?.kind!=="traditional_autocomplete")?.options??[]).filter(n=>n.is_tappable!==!1).map(n=>({text:n.text,icon_svg:n.icon_svg}))}var cm=6,um=.3;function ol(t){return t<=0?"0px":`${(-Math.min(um,2*cm/t)).toFixed(3)}px`}var rl=new Map;function dm(t,e,n){let i=rl.get(e);if(i!==void 0){t.style.setProperty("--aia-chip-image-fit",i),t.setAttribute("data-aia-image-loaded","");return}let o=n.createElement("img");o.setAttribute("referrerpolicy","no-referrer"),o.onload=()=>{if(!t.isConnected)return;t.setAttribute("data-aia-image-loaded","");let r=t.getBoundingClientRect().height,s=Number.parseFloat(getComputedStyle(t).fontSize);if(!(r>0&&s>0&&o.naturalWidth>0&&o.naturalHeight>0))return;let a=`${(r/s*(o.naturalWidth/o.naturalHeight)).toFixed(3)}em`;rl.set(e,a),t.style.setProperty("--aia-chip-image-fit",a)},o.src=e}function tr(t){pm(t),mm(t.input,t.blockingParamIds??[])}function mm(t,e){for(let n of t.querySelectorAll("strong[data-param-id]")){let i=n.dataset.paramId??"",o=e.includes(i);n.classList.toggle("magicx-aia-segment--blocking",o);let r=Array.from(n.children),s=r.find(l=>l.hasAttribute("data-aia-blocking-remove"));if(!o){s?.remove();continue}if(r.some(l=>l.hasAttribute("data-aia-chip-remove")))continue;let a=er(N(t),i);a.dataset.aiaBlockingRemove="",n.appendChild(a)}}function pm(t){let{input:e,segments:n,newParamId:i,editingParamId:o,placeholderText:r}=t,s=t.showChipIcons??!0,a=t.showChipImages??!0,l=t.showChipRemove??!1,c=n.length===0;e.dataset.aiaEmpty=c?"true":"false",Vs(e,c?r:""),il(e,c,r,t.hintOptions??[]);let u=n.map(y=>y.type==="completed"?`${y.type}:${y.value}${s?y.param.icon??y.param.icon_svg??"":""}${a?Oe(y.param.image_url)??"":""}${l?"x":""}`:y.type==="identified"?`${y.type}:${y.value}${y.param.id}${l?"x":""}`:`${y.type}:${y.value}`).join("\0"),d=e.dataset.segKey??"",f=e.dataset.newParamId??"",p=e.dataset.editingParamId??"";if(u===d&&(i??"")===f&&(o??"")===p)return;if(u===d){e.dataset.newParamId=i??"",e.dataset.editingParamId=o??"";for(let y of e.querySelectorAll("strong[data-param-id]")){let h=y.dataset.paramId,x=y.dataset.seg==="completed"&&h===i;y.classList.toggle("magicx-aia-shimmer-revealed",x),y.classList.toggle("magicx-aia-shimmer-sweep",x),y.classList.toggle("magicx-aia-segment--editing",h===o)}return}let m=e.getAttribute("data-aia-composing")==="true"?fm(e,n):null;if(m==="unsafe")return;let g=os(e),b=g&&!m?Y(e):null;e.dataset.segKey=u,e.dataset.newParamId=i??"",e.dataset.editingParamId=o??"";let T=N(e),S=T.createDocumentFragment(),E=0;for(let y of n)if(E+=y.value.length,y.type==="completed"){let h=T.createElement("strong");h.dataset.seg="completed",h.dataset.paramId=y.param.id;let x=y.param.id===i,P=y.param.id===o,v=["magicx-aia-segment","magicx-aia-segment--completed"];x&&v.push("magicx-aia-shimmer-revealed","magicx-aia-shimmer-sweep"),P&&v.push("magicx-aia-segment--editing"),h.className=v.join(" "),h.style.letterSpacing=ol(y.value.length);let L=a?Oe(y.param.image_url):null;if(L){let I=T.createElement("span");I.className="magicx-aia-segment-image",I.setAttribute("contenteditable","false"),I.setAttribute("aria-hidden","true"),I.style.setProperty("--aia-chip-image",`url("${L}")`),dm(I,L,T),h.appendChild(I),h.dataset.aiaImage=""}let O=!L&&s&&y.param.icon_svg?ce(y.param.icon_svg):null;if(O){let I=T.createElement("span");I.className="magicx-aia-segment-icon",I.setAttribute("contenteditable","false"),I.setAttribute("aria-hidden","true"),I.innerHTML=O,h.appendChild(I),y.param.icon&&(h.dataset.aiaIcon=y.param.icon)}h.appendChild(T.createTextNode(y.value)),l&&h.appendChild(er(T,y.param.id)),S.appendChild(h)}else if(y.type==="identified"){let h=T.createElement("strong");h.dataset.seg="identified",h.dataset.paramId=y.param.id;let x=["magicx-aia-segment","magicx-aia-segment--completed"];y.param.id===o&&x.push("magicx-aia-segment--editing"),h.className=x.join(" "),h.style.letterSpacing=ol(y.value.length),h.textContent=y.value,l&&h.appendChild(er(T,y.param.id)),S.appendChild(h)}else S.appendChild(T.createTextNode(y.value));if(m){m.node.deleteData(0,m.node.data.length-m.syllable.length);for(let y of Array.from(e.childNodes))y!==m.node&&y.remove();e.insertBefore(S,m.node),e.dataset.aiaTextLength=String(E+m.syllable.length);return}e.replaceChildren(S),e.dataset.aiaTextLength=String(E),b!=null?W(e,Math.max(0,Math.min(b,E))):g&&W(e,E)}function fm(t,e){let n=e.map(s=>s.value).join(""),i=Fe(t);if(i===n)return null;if(!i.startsWith(n))return"unsafe";let o=i.slice(n.length),r=t.lastChild;return r?.nodeType!==Node.TEXT_NODE||!r.data.endsWith(o)?"unsafe":{node:r,syllable:o}}function er(t,e){let n=t.createElement("span");return n.className="magicx-aia-segment-remove",n.setAttribute("contenteditable","false"),n.setAttribute("aria-hidden","true"),n.dataset.aiaChipRemove=e,n.innerHTML='<svg viewBox="0 0 10 10" aria-hidden="true"><path d="M2.5 2.5l5 5M7.5 2.5l-5 5"/></svg>',n}var gm='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" role="img" aria-label="Submit"><path d="M9 14V4M9 4L4 9M9 4L14 9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';function sl(t=_()){let e=document.createElement("button");return e.type="button",e.className="magicx-aia-submit",e.setAttribute("aria-label",t.submit),e.setAttribute("data-aia-submit",""),e.innerHTML=gm.replace('aria-label="Submit"',`aria-label="${t.submit}"`),e}function al(t){let e=t.store.get();return(!!e.text||e.completedParams.length>0)&&!!t.onSubmit}function hm(){let t=document.createElement("div");return t.setAttribute("contenteditable","plaintext-only"),t.contentEditable==="plaintext-only"}function ll(t,e){let n=e.firstElementChild;if(!n){e.removeAttribute("data-aia-pill-wrapped");return}let i=n.getBoundingClientRect(),o=t.getBoundingClientRect();i.top>=o.bottom-2?e.setAttribute("data-aia-pill-wrapped",""):e.removeAttribute("data-aia-pill-wrapped")}function cl(t,e){let{listboxId:n}=e,i=Wn(n);t.appendChild(i);let o=document.createElement("div");o.className="magicx-aia-input-wrapper",o.setAttribute("data-aia-input-wrapper",""),t.appendChild(o);let r=document.createElement("div");r.className="magicx-aia-editor",r.setAttribute("data-aia-editor",""),o.appendChild(r);let s=document.createElement("div");s.className="magicx-aia-input",s.setAttribute("data-aia-input",""),s.setAttribute("contenteditable",hm()?"plaintext-only":"true"),s.setAttribute("role","combobox"),s.setAttribute("aria-autocomplete","list"),s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-controls",n),s.setAttribute("aria-expanded","false"),s.setAttribute("spellcheck","true"),s.setAttribute("enterkeyhint","send"),r.appendChild(s);let a=document.createElement("span");a.className="magicx-aia-pill-list-container",a.setAttribute("data-aia-pill-list-container",""),r.appendChild(a);let l=null,c=null;e.submitButton===void 0?(l=sl(e.strings),o.appendChild(l),c=l):e.submitButton!==null&&(c=e.submitButton,c.hasAttribute("data-aia-submit")||c.setAttribute("data-aia-submit",""),c.setAttribute("data-aia-submit-slot",""),o.appendChild(c));let u=new AbortController,{signal:d}=u,f=!1,p=0,m=()=>{let h=Fe(s);return h.length>0&&h[0]!==h[0].toUpperCase()?h[0].toUpperCase()+h.slice(1):h},g=()=>e.handleChange(m()),b=()=>{let h=Q(s)?.node??null;if(!h||!s.contains(h))return null;let v=(h.nodeType===Node.ELEMENT_NODE?h:h.parentElement)?.closest("strong[data-param-id]")?.dataset.paramId??null;return v&&is(s,v)?null:v};o.addEventListener("click",h=>{h.target?.closest("[data-aia-pill]")||s.getRootNode().activeElement?.closest("[data-aia-location]")||bi(s)},{signal:d});let T=null,S=h=>{let x=(e.showChipRemove??!1)||h;x!==(T!==null)&&(T?.(),T=x?Ko(s,P=>e.removeParam(P)):null)};if(S(!1),d.addEventListener("abort",()=>{T?.(),T=null}),s.addEventListener("input",()=>{if(f){e.handleCompositionText(m());return}p=performance.now(),g(),e.handleCaretAfterInput(Y(s))},{signal:d}),N(s).addEventListener("selectionchange",()=>{let h=Q(s);if(!h||!s.contains(h.node))return;let x=h.collapsed?b():null,P=e.store.get(),v=P.editingParam?.id??P.editingIdentified?.id??null;if(x&&x!==v){e.startEditingParam(x);return}performance.now()-p<50||e.handleCaretMove(Y(s))},{signal:d}),s.addEventListener("click",h=>{let x=di(s,h.target);x&&(e.startEditingParam(x),mi(s,x))},{signal:d}),s.addEventListener("compositionstart",()=>{f=!0,s.setAttribute("data-aia-composing","true")},{signal:d}),s.addEventListener("compositionend",()=>{f=!1,s.removeAttribute("data-aia-composing"),g()},{signal:d}),s.addEventListener("beforeinput",h=>{let x=h,P=x.inputType;if(P==="insertParagraph"||P==="insertLineBreak"||P==="insertFromDrop"){h.preventDefault();return}if(P.startsWith("insert")||P.startsWith("delete")){let v=P.startsWith("delete")?"":x.data??"";e.replaceEditingRange(v)&&h.preventDefault()}},{signal:d}),s.addEventListener("paste",h=>{h.preventDefault();let x=(h.clipboardData?.getData("text/plain")??"").replace(/\r?\n/g," ");if(!x)return;let P=N(s),v=Ce(s);if(!v||!s.contains(v.startContainer))return;v.deleteContents();let L=P.createTextNode(x);v.insertNode(L),v.setStartAfter(L),ft(s,v.startContainer,v.startOffset),g()},{signal:d}),s.addEventListener("keydown",h=>e.handleKeyDown(h),{signal:d}),s.addEventListener("focus",()=>e.store.set({isFocused:!0}),{signal:d}),s.addEventListener("blur",()=>e.store.set({isFocused:!1}),{signal:d}),c&&c.addEventListener("click",h=>{al(e)&&(h.stopPropagation(),e.submit?.())},{signal:d}),e.autoFocus!==!1){s.focus();let h=Q(s);(!h||!s.contains(h.node))&&ft(s,s,0)}if(typeof ResizeObserver<"u"){let h=new ResizeObserver(()=>ll(s,a));h.observe(s),u.signal.addEventListener("abort",()=>h.disconnect(),{once:!0})}let y=zo(r);return u.signal.addEventListener("abort",y,{once:!0}),{input:s,inlinePillContainer:a,dropdown:i,submitButton:l,submitTarget:c,abort:u,syncChipRemove:S}}function nr(t,e,n){let{input:i,inlinePillContainer:o,dropdown:r,submitButton:s}=t,{pillPlacement:a,setActivePill:l,selectOption:c,store:u}=n;t.syncChipRemove(e.blockingChips.length>0),i.setAttribute("aria-expanded",String(e.isDropdownOpen));let d=e.activeDropdownIndex>=0?`${n.listboxId}-option-${e.activeDropdownIndex}`:"";if(d?i.setAttribute("aria-activedescendant",d):i.removeAttribute("aria-activedescendant"),s){let T=n.strings??_();s.getAttribute("aria-label")!==T.submit&&s.setAttribute("aria-label",T.submit);let S=s.querySelector("svg");S&&S.getAttribute("aria-label")!==T.submit&&S.setAttribute("aria-label",T.submit);let E=!!e.text||e.completedParams.length>0;s.disabled=!E,s.toggleAttribute("data-aia-ready",E&&e.isReady)}t.submitTarget&&Ye(t.submitTarget,"data-aia-submit-state",e.isSubmitting);let f=i.dataset.newParamId??"",p=e.newParamId!==null&&e.newParamId!==f;if(tr({input:i,segments:e.segments,newParamId:e.newParamId,editingParamId:e.editingParam?.id??null,placeholderText:e.placeholderText,isFocused:e.isFocused,showChipIcons:n.showChipIcons??!0,showChipImages:n.showChipImages??!0,hintOptions:a==="inline"?[]:Zo(e.actionableSuggestions),showChipRemove:n.showChipRemove??!1,blockingParamIds:e.blockingChips.map(T=>T.paramId)}),a==="inline"){let T=e.isLoading&&!e.editingParam&&!e.inSelectionAnimation,S=ii(e.actionableSuggestions);T||S.length>0?An(o,S,0,l,!1,T,e.isActivePillSelected):Io(o)}else Io(o);ll(i,o),p?bt(i,e.caretOffset??e.text.length,ht(n.focusInputOnSelect)):e.isFocused&&Fe(i)!==e.text&&!i.hasAttribute("data-aia-composing")&&W(i,e.text.length);let m=e.editingParam?mt(e.editingParam):e.editingIdentified?{parameter:e.editingIdentified.parameter,text:se(e.editingIdentified.parameter),required:!0,options:[]}:null,g=e.dropdownSuggestion??m??e.actionableSuggestions[0],b=wt(e);Bn(r,{strings:n.strings,suggestions:g?[{...g,options:e.dropdownOptions}]:[],filteredOptions:e.dropdownOptions,activeIndex:e.activeDropdownIndex,isOpen:e.isDropdownOpen,isLoading:e.dropdownLoading,skeletonExiting:e.skeletonExiting,listboxId:n.listboxId,pills:It(e.dropdownSuggestion,m,e.actionableSuggestions),showPills:a==="dropdown",showSkipButton:n.showSkipButton&&!e.editingParam&&!e.editingIdentified,skipDisabled:e.inSelectionAnimation,showOptionIcons:n.showOptionIcons??!0,showOptionImages:n.showOptionImages??!0,showOptionCounts:n.showOptionCounts??!0,isActivePillSelected:e.isActivePillSelected,isInputEmpty:e.text.trim().length===0,products:e.products,productsLayout:n.productsLayout??"row",productImageFallback:n.productImageFallback??"image",showProductVendor:n.showProductVendor??!0,onProductAddToCart:n.addProductToCart,formatType:e.activeFormatType,dateView:e.dateView,selectedDateIso:b.selectedIso,selectedDateRange:b.selectedRange,dateRangeStart:b.rangeStart,dateReferences:b.references,timeView:e.timeView,multiSelectView:e.dropdownMultiSelect,locationView:e.locationView,isReediting:e.editingParam!=null,isFocused:e.isFocused||e.locationFieldFocused,optionsPosition:n.optionsPosition??"below",onSelect:c,onHighlight:(T,S)=>{S!==void 0&&u.get().activeDropdownIndex!==S||u.set({activeDropdownIndex:T,highlightByPointer:T>=0})},onPillClick:l,onSkip:n.skipActivePill,onPreviousMonth:n.showPreviousMonth,onNextMonth:n.showNextMonth,onTimeChange:n.setTime,onTimeCommit:n.commitTime,onMultiSelectCommit:n.commitMultiSelect,onLocationQuery:n.setLocationQuery,onLocationMove:n.moveLocationHighlight,onLocationCommit:n.commitLocation,onLocationFocusChange:n.setLocationFieldFocused,onProductSelect:n.selectProduct,onProductFocusChange:T=>u.set({isFocused:T}),seeAllBusy:e.isSubmitting,busyProductId:e.selectingProductId,onSeeAllResults:n.seeAllResults&&e.text.trim().length>0&&al(n)?()=>n.submit?.():void 0,fullWidth:n.seeAllResults===!0})}function ir(t){let e=t,n=new Set,i=[],o=!1;return{get:()=>e,set:r=>{let s=typeof r=="function"?r(e):r,a=e;if(e={...e,...s},i.push([e,a]),!o){o=!0;try{let l=0;for(let c=i.shift();c;c=i.shift()){if(++l>1e4)throw i.length=0,new Error("createStore: notifications did not settle after 10000 deliveries \u2014 a listener is likely calling set() on every notification");let[u,d]=c;for(let f of n)f(u,d)}}catch(l){throw i.length=0,l}finally{o=!1}}},subscribe:r=>(n.add(r),()=>{n.delete(r)})}}function ul(t,e){let n,i,o=r=>(r!==n&&(n=r,i=e(r)),i);return{get:()=>{let r=t.get();return{...r,...o(r)}},set:r=>{typeof r=="function"?t.set(s=>{let a={...s,...o(s)};return r(a)}):t.set(r)},peek:r=>{let s={...t.get(),...r};return{...s,...e(s)}},subscribe:r=>t.subscribe((s,a)=>{let l={...a,...o(a)},c={...s,...o(s)};r(c,l)})}}var or=new WeakSet,dl=new WeakMap;function pl(t){return t.nodeType===Node.DOCUMENT_NODE}function bm(t){return pl(t)?t:t.ownerDocument}function ym(t){let e=dl.get(t);if(e)return e;let n=t.defaultView?.CSSStyleSheet;if(typeof n!="function")return null;try{let i=new n;return typeof i.replaceSync!="function"?null:(i.replaceSync(gl),dl.set(t,i),i)}catch{return null}}function ml(t,e){if(e.querySelector("style[data-magicx-aia]"))return;let n=t.createElement("style");n.setAttribute("data-magicx-aia",""),n.textContent=gl,e.appendChild(n)}function fl(t){if(typeof document>"u")return;let e=t??document;if(or.has(e))return;let n=bm(e);if(pl(e)){let r=e.head??e.documentElement;if(!r)return;ml(n,r),or.add(e);return}let i=ym(n),o=e.adoptedStyleSheets;i&&Array.isArray(o)?o.includes(i)||(e.adoptedStyleSheets=[...o,i]):ml(n,e),or.add(e)}var gl=`.aia-stack {
1
+ function H(t){return t==="date"||t==="date-range"}function F(t){return t!=="options"}function te(t){return t?.type?.kind==="date"?"date":t?.type?.kind==="date_range"?"date-range":t?.type?.kind==="time"?"time":t?.type?.kind==="location"&&!t.options?.length?"location":"options"}var Dt=/[\p{L}\p{N}]/u,Ol=/['\u2019-]/;function mr(t,e,n){let i=t[e];if(i===void 0)return!1;if(Dt.test(i))return!0;let o=t[e+n];return Ol.test(i)&&o!==void 0&&Dt.test(o)}function kl(t,e,n){let i=e+n.length;return!(Dt.test(n[0])&&mr(t,e-1,-1)||Dt.test(n[n.length-1])&&mr(t,i,1))}function oe(t,e,n=0,i=()=>!0){if(e.length===0)return t.indexOf(e,n);let o=-1,r=t.indexOf(e,n);for(;r!==-1;){if(i(r)){if(kl(t,r,e))return r;o===-1&&(o=r)}r=t.indexOf(e,r+1)}return o}function R(t,e){let n=t,i={},o=[],r=[],s=0;for(let a of e){let l=(i[a.parameter]??0)+1;i[a.parameter]=l;let u=`{{${a.parameter.toUpperCase().replace(/\s+/g,"_")}_${l}}}`,d=p=>oe(n,a.text,p,m=>!r.some(g=>m<g.end&&m+a.text.length>g.start)),f=d(s);if(f===-1&&(f=d(0)),f!==-1){n=n.slice(0,f)+u+n.slice(f+a.text.length);let p=u.length-a.text.length;for(let m of r)m.start>=f+a.text.length&&(m.start+=p,m.end+=p);r.push({start:f,end:f+u.length}),s=f>=s?f+u.length:s+p}o.push({...a,placeholder:u})}return{rawQuery:n,completedParams:o}}var pr="skipped";function we(t,e){if(t.some(o=>"group"in o)&&(t=t.map(o=>{let{group:r,...s}=o;return s})),e.length===0)return t;let n=new Set(t.map(o=>o.parameter)),i=e.filter(o=>!n.has(o.parameter)).map(o=>({placeholder:"",parameter:o.parameter,text:pr,kind:null}));return i.length>0?[...t,...i]:t}function Ht(t,e,n){return JSON.stringify([t,we(e,n).map(i=>[i.placeholder,i.parameter,i.value??i.text??""])])}function Re(t){let{rawQuery:e,completedParams:n}=R(t.text,t.completedParams);return Ht(e,n,t.skippedParams)}var Ml="https://api.ai-autocomplete.com",Rl="/api/suggest",gr=`${Ml}${Rl}`,_l="/telemetry/events",Dl="/starting-state",Hl="/locations/autocomplete",hr=new Map([["api.ai-autocomplete.com","cdn.ai-autocomplete.com"],["dev-api.ai-autocomplete.com","dev-cdn.ai-autocomplete.com"]]),fr=/\/suggest(?=[?#]|$)/;function Nt(t){return t?.endpoint??gr}function br(t,e){let n=Nt(t);return fr.test(n)?n.replace(fr,e):null}function yr(t){return t?.telemetryEndpoint||br(t,_l)}function Sr(t){if(t?.locationEndpoint)return t.locationEndpoint;let e=Nt(t),n=e.indexOf("?"),i=n<0?e:e.slice(0,n),o=n<0?"":e.slice(n+1);if(!/\/suggest\/?$/.test(i))return null;let r=i.replace(/\/suggest\/?$/,Hl);return o?`${r}?${o}`:r}function Tr(t){if(t?.startingStateEndpoint)return t.startingStateEndpoint;let e=br(t,Dl);return e===null?null:Nl(e)}function vr(t,e){let n=t.search(/[?#]/),i=n<0?t:t.slice(0,n),o=n<0?"":t.slice(n);return`${i.replace(/\/+$/,"")}${e}${o}`}function xr(t){let e;try{e=new URL(t??gr).host}catch{return null}let n=hr.get(e);return n?`https://${n}`:null}function Nl(t){return t.replace(/^https:\/\/([^/?#]+)/,(e,n)=>{let i=hr.get(n);return i?`https://${i}`:e})}var Xn="aiaPlace",Ft=2,Pr=250,Er=new Set("new san los las santa saint st fort port north south east west lake mount el la rio de palm long grand cape salt hong".split(" ")),wr=new Set("city beach springs falls island park heights valley bay".split(" ")),Fl=new Set("a an the in at to off on of from for by near into onto around via toward towards up out and or with within".split(" "));function Lr(t){let e=Wl(t);for(;e.length>0&&Fl.has(e[0].toLowerCase().replace(/[.,]+$/,""));)e.shift();return e.join(" ")}function Wl(t){let e=t.trim().split(/\s+/).filter(Boolean);if(e.length===0)return[];let n=e[e.length-1].replace(/[.,]+$/,"");if(!n)return[];let i=e.length>1?e[e.length-2]:void 0,o=e.length>2?e[e.length-3]:void 0,r=s=>s.toLowerCase().replace(/[.,]+$/,"");return i&&o&&Er.has(r(o))&&wr.has(r(n))?[o,i,n]:i&&(Er.has(r(i))||wr.has(r(n)))?[i,n]:[n]}function Cr(t){let e=t.secondary?.split(",")[0]?.trim();return e?`${t.name}, ${e}`:t.name}function jn(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/\s+/g," ").trim()}function Jn(t,e){let n=jn(e);if(!n)return!1;if(jn(t.name)===n)return!0;for(let[,i]of t.name.matchAll(/\(([^()]*)\)/g))if(jn(i)===n)return!0;return!1}function Ar(t,e){let n=e.metadata?.[Xn];if(typeof n?.name!="string")return 0;let i={id:"",name:n.name},o=[...t.matchAll(/\S+/g)];for(let r of o){let s=r.index??0,a=t.slice(s).trim().replace(/[.,]+$/,"");if(Jn(i,a))return t.length-s}return 0}function Zn(t){return typeof t=="string"?{text:t,is_tappable:!0,kind:null}:{text:Cr(t),is_tappable:!0,kind:null,metadata:{[Xn]:{id:t.id,name:t.name}}}}function ei(t){return Sr(t)}function Ir(t){let e=t?.places;if(!Array.isArray(e))return[];let n=[];for(let i of e){let{id:o,name:r,secondary:s}=i??{};typeof o!="string"||!o||typeof r!="string"||!r.trim()||n.push({id:o,name:r.trim(),...typeof s=="string"&&s.trim()?{secondary:s.trim()}:{}})}return n}var Wt=class{constructor(e){this.config=e;this.current=null;this.expiresAt=null;this.inFlightRefresh=null;e.accessToken&&(this.current=e.accessToken)}async getToken(e=!1){if(!e&&this.current&&!this.isExpired())return this.current;if(!e&&this.inFlightRefresh)return this.inFlightRefresh;this.inFlightRefresh=this.refresh();try{return await this.inFlightRefresh}finally{this.inFlightRefresh=null}}async refresh(){let e=await this.config.getAccessToken();return this.current=e.accessToken,this.expiresAt=e.expiresAt??null,this.current}isExpired(){return this.expiresAt==null?!1:Date.now()>=this.expiresAt-3e4}};var Or=new WeakMap;function rt(t){return t?.type==="accessToken"}function Bl(t){if(!(!t||rt(t)))return t}function Bt(t){let e=Or.get(t.getAccessToken);return e||(e=new Wt(t),Or.set(t.getAccessToken,e)),e}function Vt(t){return{"Content-Type":"application/json",...t?.appIdentifier&&{"X-App-Identifier":t.appIdentifier},...t?.headers}}function Ut(t){let e=Bl(t),n=e?.apiKey;return n?(e?.authScheme??"Bearer")==="Basic"?`Basic ${btoa(n)}`:`Bearer ${n}`:null}function st(t){return t.map(e=>({parameter:e.parameter,text:e.text}))}var Vl="0.82.1",Rr="1.0",kr=!1;function Ul(t,e){return{placeholder:t.placeholder,parameter:t.parameter,...e&&{text:t.value??t.text},kind:t.kind}}function re(t){return t??(typeof navigator<"u"?navigator.language:"en-US")}function $l(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}catch{return}}function ql(t,e,n,i,o,r,s,a,l,c,u,d,f,p,m,g){let b=e.find(E=>E.parameter==="contact"&&E.metadata?.contact_account_count)?.metadata?.contact_account_count,T=typeof b=="number"?b:void 0,S=$l();return{data:{raw_query:t,...!g&&{accepts_traditional_autocomplete:!0},...p&&{traditional_autocomplete_only:!0},client_option_parameters:f??[],completed_params:we(e.map(E=>Ul(E,n)),l??[]),...s&&s.length>0&&{identified_params:st(s)},...a&&a.length>0&&{recently_suggested:a},...T!=null&&{contact_account_count:T},...c!==void 0&&{additional_context:c}},meta:{request_id:o,request_at:new Date().toISOString(),language:re(u),...S&&{timezone:S},...d?.code&&Number.isFinite(d.rate)&&d.rate>0&&{currency:d.code,currency_rate:d.rate,...d.country!==void 0&&{country:d.country}},client_version:Vl,session_id:i,...m&&{search_id:m},source:r,schema_version:Rr}}}async function Mr(t,e,n,i,o){return fetch(t,{method:"POST",headers:{...e,Authorization:`Bearer ${n}`},body:i,signal:o})}async function ti(t,e,n){let i=n.apiConfig,o=!n.maskCompletedText,r=ql(t,e,o,n.sessionId,n.requestId??crypto.randomUUID(),n.source,n.identifiedParams,n.recentlySuggested,n.skippedParams,n.additionalContext,n.language,n.currency,n.clientOptionParameters,n.traditionalAutocompleteOnly,n.searchId,n.fullAnswer),s=Nt(i),a=await _r(s,JSON.stringify(r),i,n.signal);if(!a.ok)throw new Error(`API error: ${a.status} ${a.statusText}`);return a.json()}async function _r(t,e,n,i){let o=Vt(n);if(rt(n)){let s=Bt(n),a=await s.getToken(),l=await Mr(t,o,a,e,i);if(l.status===401){let c=await s.getToken(!0);l=await Mr(t,o,c,e,i)}return l}let r=Ut(n);return!r&&!kr&&(kr=!0,console.warn("[Intent-1] No apiKey in apiConfig. Requests will be sent without an Authorization header.")),r&&(o.Authorization=r),fetch(t,{method:"POST",headers:o,body:e,signal:i})}var at=class extends Error{constructor(n){super(`Location search error: ${n}`);this.status=n;this.name="LocationSearchError"}};async function Dr(t,e,n){let i=JSON.stringify({query:e,session_token:n.sessionToken,language:re(n.language)}),o=await _r(t,i,n.apiConfig,n.signal);if(!o.ok)throw new at(o.status);return Ir(await o.json())}function fe(t,e,n){return e>0||!n?e:t.toLowerCase().startsWith(n.toLowerCase())?n.length:e}function _e(t,e){return e===!1?"":t}function lt(t,e,n){return e===0&&t.length>0&&n.length>0&&n.toLowerCase().startsWith(t.toLowerCase())}function ct(t,e,n){let i=t.slice(e);if(n||e===0||t[e-1]===" ")return i;let o=i.indexOf(" ");return o===-1?"":i.slice(o+1)}function Hr(t,e){let n=t.trimEnd().replace(/\s+/g," ");if(n.length===0||e.length===0)return 0;let i=n.split(" "),o=e.toLowerCase();for(let r=0;r<i.length;r++){let s=i.slice(r).join(" ");if(o.startsWith(s.toLowerCase())){let a=n.length-s.length;return t.length-a}}return 0}function Nr(t){return t.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase().replace(/[_\-\s]+/g," ")}function Gl(t,e){let n=Nr(t).trim();return n.startsWith(e)||n.includes(` ${e}`)}function ge(t,e,n=!1){if(!t)return[];let i=e.trimStart();if(!i)return t;let o=n?Nr(i).trimStart():"";if(o)return t.filter(s=>!s.is_tappable||Gl(s.text,o));let r=i.toLowerCase();return t.filter(s=>!s.is_tappable||s.text.toLowerCase().includes(r))}function $t(t,e){if(!t)return null;let n=e.trim();if(!n)return null;let i=n.toLowerCase();return t.find(o=>o.is_tappable&&o.text.toLowerCase()===i)??null}function ut(t,e,n,i,o){let r=ct(e,n,i),s=$t(t,r);if(s||!o||!r.trim())return s;if(r===e.slice(n))return null;let a=e.lastIndexOf(" ",n-1)+1;return $t(t,e.slice(a))}function Fr(t,e){let n=e.replace(/^\s+/,"").toLowerCase();for(let i=0;i<n.length;){let o=n.slice(i);if(o.trim().length>=2){let s=t.findIndex(a=>a.is_tappable&&!a.selectsAll&&a.text.toLowerCase().startsWith(o));if(s>=0)return t.map((a,l)=>l===s?{...a,liveMatch:!0}:a)}let r=n.indexOf(" ",i);if(r<0)break;i=r+1}return t}function Br(t,e){return e?t.map(n=>e[n.parameter]?{...n,options:[]}:n):t}function Vr(t,e){let{icon:n,icon_svg:i}=e;return!i||t.every(Wr)?t:t.map(o=>Wr(o)?o:{...o,icon:n,icon_svg:i})}function Wr(t){return!!(t.icon_svg||t.image_url)}function Kl(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.toLowerCase())}function se(t){let e=Kl(t);return e.length>0?e.join(" "):t}function ne(t,e){return t.parameter||e}function dt(t,e,n){return{parameter:t,suggestionParameter:t,suggestionValueType:{kind:"traditional_autocomplete"},suggestionPlaceholder:n?.trim()||se(t),...e?{suggestionHeader:e}:{}}}function mt(t){return t.suggestionValueType?.kind==="traditional_autocomplete"?{parameter:t.suggestionParameter,text:t.suggestionHeader??"",required:!0,type:t.suggestionValueType,options:t.options}:{parameter:t.suggestionParameter,text:t.suggestionPlaceholder,required:!0,options:t.options}}function qt(t,e){let n=ne(e,t.suggestionParameter);return t.suggestionValueType?.kind==="traditional_autocomplete"?dt(n,t.suggestionHeader,e.parameter_label):{parameter:n,suggestionParameter:t.suggestionParameter,suggestionValueType:t.suggestionValueType,suggestionPlaceholder:t.suggestionPlaceholder,suggestionIcon:t.suggestionIcon,suggestionIconSvg:t.suggestionIconSvg}}function A(t){return t?.type?.kind==="traditional_autocomplete"}function zl(t){let e=t?.replace(/[_\-\s]+/g," ").trim();return e?e.charAt(0).toUpperCase()+e.slice(1):void 0}function ni(t){return t.parameter_label?.trim()||zl(t.parameter)}function De(t){return A(t)||t?.smart_suggestion===!0}function ii(t){return t.some(A)?t.filter(e=>!A(e)):t}function oi(t,e){return t.some(n=>A(n)&&!n.text)?t.map(n=>A(n)&&!n.text?{...n,text:e}:n):t}var ri='<svg viewBox="0 0 20 20" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false"><path class="aia-sparkle-large" d="M8 5C8.5 9.5 10.5 11.5 15 12C10.5 12.5 8.5 14.5 8 19C7.5 14.5 5.5 12.5 1 12C5.5 11.5 7.5 9.5 8 5Z"/><path class="aia-sparkle-small" d="M16 1C16.2 3 17 3.8 19 4C17 4.2 16.2 5 16 7C15.8 5 15 4.2 13 4C15 3.8 15.8 3 16 1Z"/></svg>';function si(t){return t.some(e=>!A(e))}function Ur(t,e){let n=0,i=e;for(let o of t)n+=o.value.length,o.type!=="text"&&(i=Math.max(i,n));return i}function $r(t,e){let n=0;for(let i of t){let o=n+i.value.length;if(i.type==="text"&&o>e&&i.value.slice(Math.max(e-n,0)).trim().length>0)return!1;n=o}return!0}function qr(t,e){let n=[],i=new Map;for(let o of[...t,...e]){if(o.parameter==="placeholder"||A(o))continue;let r=i.get(o.parameter);r||(r={parameter:o.parameter,text:o.text},i.set(o.parameter,r),n.push(r));for(let s of o.options??[])!s.is_tappable||r.options?.includes(s.text)||(r.options??(r.options=[]),r.options.push(s.text))}return n}function Gr(t,e,n){if(t===e)return n;let i=Math.min(t.length,e.length),o=0;for(;o<i&&t[o]===e[o];)o++;if(o>=n)return n;let r=0;for(;r<i-o&&t[t.length-1-r]===e[e.length-1-r];)r++;return t.length-r<=n?n+(e.length-t.length):null}function Gt(t,e){let n=[],i=[],o=0;for(let r of e){let s=oe(t,r.text,o);if(s===-1){i.push(r);continue}n.push({start:s,end:s+r.text.length,param:r}),o=s+r.text.length}return{located:n,missing:i}}function Pe(t,e){let{located:n}=Gt(t,e);return n.length>0?n[n.length-1].end:0}function Kr(t,e,n){let i=[],o=[],r=0;for(let s of n){let a=oe(t,s.text,r,l=>!e.some(c=>l<c.end&&l+s.text.length>c.start));if(a===-1){o.push(s);continue}i.push({start:a,end:a+s.text.length,param:s}),r=a+s.text.length}return{located:i,missing:o}}function Kt(t,e,n=[]){let i=Gt(t,e).located,o=[];for(let u of i){let d=o[o.length-1];u.param.group&&d?.param.group===u.param.group?(d.end=u.end,d.params?.push(u.param)):o.push({...u,...u.param.group?{params:[u.param]}:{}})}let r=Kr(t,o,n).located,s=[...o.map(u=>({start:u.start,end:u.end,segment:{type:"completed",value:t.slice(u.start,u.end),param:u.param,...u.params?{params:u.params}:{}}})),...r.map(u=>({start:u.start,end:u.end,segment:{type:"identified",value:u.param.text,param:u.param}}))].sort((u,d)=>u.start-d.start),a=[],l=0;for(let u of s)u.start>l&&a.push({type:"text",value:t.slice(l,u.start)}),a.push(u.segment),l=u.end;let c=t.slice(l);return c&&a.push({type:"text",value:c}),a}function zr(t,e){let{located:n,missing:i}=Gt(t,e),o=new Set(i.map(s=>s.group).filter(Boolean)),r=n.map(s=>s.param).filter(s=>!o.has(s.group));return{valid:r,invalid:e.filter(s=>!r.includes(s))}}function pt(t,e,n){let i=Gt(t,e).located,{located:o,missing:r}=Kr(t,i,n);return{valid:o.map(s=>s.param),invalid:r}}function Qr(t,e,n){let i=Tr(e);if(i!==null)return vr(i,`/${encodeURIComponent(t)}${Ql(n)}`)}function Ql(t){let e=t?.replace(/_/g,"-").toLowerCase()??"",[n,i=""]=e.split("-");return n!=="zh"?/^[a-z]{2,3}$/.test(n)?`/${n}`:"":/^[a-z]{4}$/.test(i)?i==="hant"?"/zh-TW":"/zh":["tw","hk","mo"].includes(i)?"/zh-TW":"/zh"}async function Yr(t){try{let e=await t;if(!e.ok)return null;let n=await e.json();return Array.isArray(n?.data?.suggestions)?n:null}catch{return null}}function Yl(t){if(t instanceof Error)return t;try{return new Error(String(t))}catch{return new Error("Unknown error")}}var jr=100,jl=300,Xl=2;function Jl(t,e){return e===0&&t.trim()===""}var zt=class{constructor(e,n,i,o,r,s,a,l,c,u={}){this.store=e;this.getApiConfig=n;this.getOptionOverrides=i;this.getMaskCompletedText=o;this.getOnError=r;this.getSessionId=s;this.getSource=a;this.getAdditionalContext=l;this.getLanguage=c;this.callbacks=u;this.fetchVersion=0;this.abortController=null;this.debounceTimer=null;this.slowDebounceTimer=null;this.unsubscribe=null;this.phraseExactMatch=!1;this.previewTimer=null;this.previewAbort=null;this.previewVersion=0;this.previewPending=!1;this.shownPreview=null;this.forceNextFetch=!1;this.inFlight=null;this.answered=null;this.committing=!1}start(){this.startingStateOff()||this.doFetch("",[]);let e=this.store.get().text,n=this.store.get().completedParams;this.unsubscribe=this.store.subscribe(i=>{if(i.text!==e||i.completedParams!==n){if(e=i.text,n=i.completedParams,this.asksNothing(i.text,i.completedParams.length)){this.standDown();return}this.scheduleFetch()}})}startingStateOff(){return this.callbacks.getStartingState?.()===!1}asksNothing(e,n){return this.startingStateOff()&&Jl(e,n)}standDown(){this.abortController?.abort(),this.abortController=null,this.clearTimers(),this.clearPreview(),this.forceNextFetch=!1,this.fetchVersion++,this.inFlight=null,this.forgetAnswer();let e=this.store.get();e.suggestions.length===0&&e.products.length===0&&e.customFields===null&&!e.traditionalAutocomplete&&!e.isLoading&&!e.isReady&&e.error===null&&e.lastRawQuery===""&&e.filterBase===0&&!e.filterInProgress&&e.activeDropdownIndex===-1&&!e.skipNextFetch||this.store.set({suggestions:[],products:[],customFields:null,traditionalAutocomplete:!1,isLoading:!1,isReady:!1,error:null,lastRawQuery:"",filterBase:0,filterInProgress:!1,activeDropdownIndex:-1,skipNextFetch:!1})}isPhraseExactMatch(){return this.phraseExactMatch}answersState(e){return this.answered!==null&&this.answered.customFields===e.customFields&&this.answered.key===this.requestKey(Re(e))}forgetAnswer(){this.answered=null}requestKey(e){let n;try{n=JSON.stringify([re(this.getLanguage()),this.callbacks.getCurrency?.()??null,this.getAdditionalContext()??null])}catch{n=""}return`${e}\0${n}`}isCommitting(){return this.committing}answerCurrent(){let e=this.store.get(),{rawQuery:n,completedParams:i}=R(e.text,e.completedParams);if(this.asksNothing(n,i.length))return this.standDown(),Promise.resolve("unasked");let o=this.requestKey(Ht(n,i,e.skippedParams));return this.inFlight?.key===o?this.inFlight.settled:(this.clearTimers(),e.skipNextFetch&&this.store.set({skipNextFetch:!1}),this.doFetch(n,i,{fullAnswer:!0}),this.inFlight?.settled??Promise.resolve("superseded"))}dispose(){this.abortController?.abort(),this.clearTimers(),this.clearPreview(),this.unsubscribe?.()}previewComposition(e){this.previewTimer&&clearTimeout(this.previewTimer),this.previewPending=!0,this.previewTimer=setTimeout(()=>{this.previewTimer=null,this.doPreview(e)},jr)}endPreview(){this.shownPreview=null,this.previewPending&&(this.clearPreview(),this.forceNextFetch=!0,this.scheduleFetch())}clearPreview(){this.previewTimer&&clearTimeout(this.previewTimer),this.previewTimer=null,this.previewAbort?.abort(),this.previewAbort=null,this.previewPending=!1,this.shownPreview=null}async doPreview(e){this.previewAbort?.abort();let n=new AbortController;this.previewAbort=n;let i=++this.previewVersion;this.previewPending=!0;let o=this.fetchVersion,r=this.store.get(),{rawQuery:s,completedParams:a}=R(e,r.completedParams);try{let l=await ti(s,a,{...this.requestOptions(r,n.signal,crypto.randomUUID()),traditionalAutocompleteOnly:!0});if(i!==this.previewVersion||o!==this.fetchVersion)return;let c=(l.data.suggestions??[]).find(A);if(!c)return;let u=l.meta?.traditional_autocomplete===!0;this.shownPreview={answer:c,traditionalAutocomplete:u},this.store.set({suggestions:[c],traditionalAutocomplete:u,activeDropdownIndex:-1})}catch{}}requestOptions(e,n,i){let o=e.pendingSpan?qr(e.pendingSpan.snapshot,e.actionableSuggestions):void 0;return{sessionId:this.getSessionId(),requestId:i,source:this.getSource(),maskCompletedText:this.getMaskCompletedText(),signal:n,apiConfig:this.getApiConfig(),identifiedParams:e.identifiedParams,recentlySuggested:o,skippedParams:e.skippedParams,additionalContext:this.getAdditionalContext(),language:this.getLanguage(),currency:this.callbacks.getCurrency?.(),clientOptionParameters:Object.keys(this.getOptionOverrides()??{}),searchId:this.callbacks.getSearchId?.()}}async doFetch(e,n,{fullAnswer:i=!1}={}){if(this.asksNothing(e,n.length)){this.standDown();return}this.abortController?.abort(),this.previewAbort?.abort(),this.previewAbort=null,this.previewPending=!1,this.shownPreview=null,this.forceNextFetch=!1;let o=new AbortController;this.abortController=o;let r=++this.fetchVersion,s="superseded",a=()=>{},l={key:this.requestKey(Ht(e,n,this.store.get().skippedParams)),settled:new Promise(d=>{a=d})};this.inFlight=l;let c=this.store.get().text.length,u=this.store.get().text;try{this.callbacks.onRequest?.({query:this.store.get().text,signal:o.signal,isCurrent:()=>r===this.fetchVersion})}catch{}try{this.store.set({isLoading:!0,error:null});let d=this.store.get(),f=crypto.randomUUID(),p=e===""&&n.length===0&&d.skippedParams.length===0&&d.identifiedParams.length===0,m=p?this.startingStateUrl():void 0,g=m?await Yr(fetch(m,{signal:o.signal})):null;if(r!==this.fetchVersion)return;let b=g??await ti(e,n,{...this.requestOptions(d,o.signal,f),fullAnswer:i});if(r!==this.fetchVersion)return;this.phraseExactMatch=b.meta?.phrase_exact_match===!0;let T=(b.data.suggestions??[]).find(A),S=T?[]:b.data.input??[],E=w=>({id:crypto.randomUUID(),parameter:w.parameter,text:w.text,...w.type?{type:w.type}:{},...w.iso_date?{isoDate:w.iso_date}:{},...w.iso_date_end?{isoDateEnd:w.iso_date_end}:{}}),y=S.filter(w=>w.source==="identified");this.callbacks.waitIdentified?.(y.filter(w=>w.state==="need_confirmation").map(E),u);let h=y.filter(w=>w.state!=="need_confirmation").map(E),x=this.callbacks.isWordOpen?.()??!1,P=this.store.get().text.toLowerCase(),v=w=>x&&P.endsWith(w.text.toLowerCase()),L=h.filter(w=>!v(w));x&&this.callbacks.holdIdentified?.(h.filter(v));let O=T?[T]:Br(b.data.suggestions??[],this.getOptionOverrides());this.startingStateOff()&&(O=O.filter(w=>w.parameter!=="placeholder"));let I=S,K=I[I.length-1],M=this.store.get().text,z,Z;if(K?.state==="in_progress"){Z=!0;let w=M.toLowerCase().lastIndexOf(K.text.toLowerCase());z=w!==-1?w:c}else Z=!1,z=c;let C=O.filter(w=>w.parameter!=="placeholder")[0],de=null;if(C&&!A(C)&&!x&&C.type?.kind!=="multi_select"&&!F(te(C))){let w=ut(C.options,M,z,Z,this.phraseExactMatch);w&&(de={id:crypto.randomUUID(),placeholder:"",parameter:ne(w,C.parameter),text:w.text,value:w.value,kind:w.kind,suggestionParameter:C.parameter,suggestionValueType:C.type,suggestionPlaceholder:C.text,suggestionIcon:C.icon,suggestionIconSvg:C.icon_svg,options:C.options??[],metadata:w.metadata,icon:w.icon,icon_svg:w.icon_svg,image_url:w.image_url},O=O.filter(Ee=>Ee!==C),this.callbacks.onAutoMatch?.({active:C,matched:w,rawQuery:e}))}let ve=b.data.custom_fields??null,xe=this.callbacks.productsForResponse?.(ve);this.answered=T?null:{key:l.key,customFields:ve};let kt=w=>{let Ee=de?[...w.completedParams,de]:w.completedParams;de&&this.answered&&w.text===u&&(this.answered={...this.answered,key:this.requestKey(Re({text:w.text,completedParams:Ee,skippedParams:w.skippedParams}))});let ke=new Set,dr=pt(w.text,Ee,L).valid.map(D=>{let it=w.identifiedParams.find(Me=>!ke.has(Me.id)&&Me.parameter===D.parameter&&Me.text===D.text);return it?(ke.add(it.id),{...D,id:it.id}):D}),Mt=new Set(d.skippedParams.map(D=>D.id)),Rt=new Set(w.skippedParams.filter(D=>!Mt.has(D.id)).map(D=>D.parameter)),nt=Rt.size>0?O.filter(D=>D.parameter==="placeholder"||!Rt.has(D.parameter)):O,_t=this.callbacks.getAllOption?.()===!0&&!p,me=w.composing?this.shownPreview:null;return{suggestions:me?[me.answer]:_t?nt.map(D=>D.parameter==="placeholder"?D:{...D,leadsWithAll:!0}):nt,isLoading:!1,isReady:b.data.is_ready??!1,lastRawQuery:e,activeDropdownIndex:-1,filterBase:z,filterInProgress:Z,identifiedParams:dr,customFields:ve,traditionalAutocomplete:me?me.traditionalAutocomplete:b.meta?.traditional_autocomplete===!0,...xe!==void 0?{products:xe}:{},...de?{completedParams:Ee}:{}}};this.committing=!0;try{this.store.set(kt)}finally{this.committing=!1}s="committed",this.callbacks.onResponse?.({requestId:f,funnelTelemetry:b.meta?.funnel_telemetry===!0,visibleImpression:b.meta?.visible_impression===!0,sdkVisitorId:b.meta?.sdk_visitor_id===!0,searchIds:b.meta?.search_ids===!0})}catch(d){let f=Yl(d);s!=="committed"&&r===this.fetchVersion&&(s="failed"),r===this.fetchVersion&&(this.store.set({error:f,isLoading:!1}),this.getOnError()?.(f))}finally{if(r===this.fetchVersion&&this.store.get().isLoading)try{this.store.set({isLoading:!1})}catch{}this.inFlight===l&&(this.inFlight=null),a(s)}}startingStateUrl(){let e=this.callbacks.getProductId?.();return e?Qr(e,this.getApiConfig(),re(this.getLanguage())):void 0}attemptNow(){if(this.clearTimers(),this.store.get().skipNextFetch){this.store.set({skipNextFetch:!1});return}this.attemptFetch(1,!0)}scheduleFetch(){if(this.clearTimers(),this.store.get().skipNextFetch){this.store.set({skipNextFetch:!1});return}this.debounceTimer=setTimeout(()=>{this.attemptFetch(Xl)&&this.slowDebounceTimer&&clearTimeout(this.slowDebounceTimer)},jr),this.slowDebounceTimer=setTimeout(()=>this.attemptFetch(1,!0,!0),jl)}attemptFetch(e,n=!1,i=!1){let o=this.store.get();if(!o.text&&o.completedParams.length===0)return this.doFetch("",[]),!0;let r=this.callbacks.consumerTick?.(o,e)??"no";if(r==="asked")return!0;if(r==="owns")return!1;if(this.forceNextFetch){let{rawQuery:x,completedParams:P}=R(o.text,o.completedParams);return this.doFetch(x,P),!0}let s=_e(o.suggestions.filter(x=>x.parameter==="placeholder").map(x=>x.text).join(" "),this.callbacks.getPrependPlaceholder?.()),a=fe(o.text,o.filterBase,s),l=ct(o.text,a,o.filterInProgress),c=o.suggestions.filter(x=>x.parameter!=="placeholder"),u=A(c[0])?void 0:c[0],d=F(o.activeFormatType),f=u&&!d?ge(u.options,l,o.traditionalAutocomplete):[];if(o.multiSelectView&&l.trim().length>0&&f.length>0)return!1;let p=f.filter(x=>x.is_tappable),m=u&&!d&&!this.callbacks.isWordOpen?.()?ut(u.options,o.text,a,o.filterInProgress,this.phraseExactMatch)!==null:!1,g=l.trim().length>0,b=i&&o.products.length>0;if(p.length>0&&!m&&g&&!b||lt(o.text,o.completedParams.length,s))return!1;let{rawQuery:T,completedParams:S}=R(o.text,o.completedParams),E=T.length<o.lastRawQuery.length,y=Math.abs(T.length-o.lastRawQuery.length),h=n&&T!==o.lastRawQuery;return E||y>=e||h?(this.doFetch(T,S),!0):!1}clearTimers(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.slowDebounceTimer&&clearTimeout(this.slowDebounceTimer),this.debounceTimer=null,this.slowDebounceTimer=null}};function Zl(t){return t.nodeType===Node.DOCUMENT_NODE?!0:t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in t}function he(t){let e=typeof t.getRootNode=="function"?t.getRootNode():null;return e&&Zl(e)?e:t.ownerDocument??t}function He(t){return he(t).activeElement??null}function N(t){return t.ownerDocument??t}function ec(t){return t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Xr(t){let e=he(t);return!ec(e)||typeof e.getSelection=="function"?null:e}function Jr(t){let e=Xr(t);if(!e)return null;let n=N(t).getSelection?.();return!n||typeof n.getComposedRanges!="function"?null:e}function Zr(t,e){let n=t,i;try{i=n.getComposedRanges({shadowRoots:[e]})}catch{i=n.getComposedRanges(e)}return i.length>0?i[0]:null}function Le(t){let n=he(t).getSelection?.();return n||(N(t).getSelection?.()??null)}function Q(t){let e=Le(t);if(!e||e.rangeCount===0)return null;let n=Jr(t);if(n){let i=Zr(e,n);return i?{node:i.startContainer,offset:i.startOffset,collapsed:i.startContainer===i.endContainer&&i.startOffset===i.endOffset}:null}return e.anchorNode?{node:e.anchorNode,offset:e.anchorOffset,collapsed:e.isCollapsed}:null}function Ce(t){let e=Le(t);if(!e||e.rangeCount===0)return null;let n=Jr(t);if(!n)return e.getRangeAt(0);let i=Zr(e,n);if(!i)return null;let o=N(t).createRange();return o.setStart(i.startContainer,i.startOffset),o.setEnd(i.endContainer,i.endOffset),o}function ft(t,e,n){let i=Le(t);if(!i)return null;if(Xr(t))return i.collapse(e,n),i;let o=N(t).createRange();return o.setStart(e,n),o.collapse(!0),i.removeAllRanges(),i.addRange(o),i}function Qt(t,e){let n=t?he(t):typeof document<"u"?document:null;return n?typeof n.getElementById=="function"?n.getElementById(e):typeof document<"u"?document.getElementById(e):null:null}var Yt=2,tc="magicx-aia";function es(t){return t==="auto"||t==="scroll"||t==="hidden"||t==="overlay"}function nc(t){let e=N(t),n=e.defaultView;if(!n?.getComputedStyle)return null;let i=t;for(;i&&i!==e.body&&i!==e.documentElement;){let o=i.scrollWidth>i.clientWidth,r=i.scrollHeight>i.clientHeight;if(o||r){let s=n.getComputedStyle(i);if(o&&es(s.overflowX)||r&&es(s.overflowY))return i}if(i.classList.contains(tc))return null;i=i.parentElement}return null}function ai(t){let e=Ce(t);if(!e||!e.collapsed||!t.contains(e.startContainer))return;let n=nc(t);if(!n||typeof e.getBoundingClientRect!="function")return;let i=e.getBoundingClientRect();if(i.height===0)return;let o=n.getBoundingClientRect();if(n.scrollWidth>n.clientWidth){let r=o.left+n.clientLeft,s=r+n.clientWidth;i.right>s?n.scrollLeft+=i.right-s+Yt:i.left<r&&(n.scrollLeft-=r-i.left+Yt)}if(n.scrollHeight>n.clientHeight){let r=o.top+n.clientTop,s=r+n.clientHeight;i.bottom>s?n.scrollTop+=i.bottom-s+Yt:i.top<r&&(n.scrollTop-=r-i.top+Yt)}}var ns='[contenteditable="false"]',ci="strong[data-param-id]",Ne;function ic(){if(Ne!==void 0)return Ne;let t=globalThis.Intl.Segmenter;if(!t)return Ne=null,null;try{Ne=new t(void 0,{granularity:"grapheme"})}catch{Ne=null}return Ne??null}function jt(t,e){let n=t;for(;n&&n!==e;){if(n.nodeType===Node.ELEMENT_NODE&&n.matches(ns))return!0;n=n.parentNode}return!1}function Xt(t){return N(t).createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(e){return jt(e,t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}})}function Fe(t){let e=Xt(t),n="",i=e.nextNode();for(;i;)n+=i.data,i=e.nextNode();return n}function gt(t){let e=Xt(t),n=0,i=e.nextNode();for(;i;)n+=i.data.length,i=e.nextNode();return n}function Y(t){let e=Q(t);if(!e)return null;let n=e.node,i=e.offset;if(!t.contains(n))return null;if(n.nodeType===Node.ELEMENT_NODE){let o=n;if(jt(o,t)&&o!==t)return null;let r=0;for(let s=0;s<i&&s<o.childNodes.length;s++)r+=ui(o.childNodes[s],t);return r+li(o,t)}return n.nodeType!==Node.TEXT_NODE||jt(n,t)?null:li(n,t)+i}function ui(t,e){if(t.nodeType===Node.TEXT_NODE)return jt(t,e)?0:t.data.length;if(t.nodeType!==Node.ELEMENT_NODE)return 0;let n=t;if(n.matches(ns))return 0;let i=0;for(let o of Array.from(n.childNodes))i+=ui(o,e);return i}function li(t,e){let n=Xt(e),i=0,o=n.nextNode();for(;o;){if(o===t||t.nodeType===Node.ELEMENT_NODE&&t.contains(o))return i;i+=o.data.length,o=n.nextNode()}return i}function W(t,e){let n=N(t),i=Math.max(0,Math.min(e,gt(t))),o=Xt(t),r=0,s=null,a=0,l=o.nextNode(),c=null;for(;l;){let d=l.data.length;if(i<r+d){s=l,a=i-r;break}if(i===r+d){let f=o.nextNode();f?(s=f,a=0):(s=l,a=d);break}r+=d,c=l,l=o.nextNode()}let u=n.createRange();if(s){let d=s.parentElement?.closest('strong[data-seg="completed"]');d&&d!==t&&t.contains(d)?a===0?u.setStartBefore(d):a===s.data.length?u.setStartAfter(d):u.setStart(s,a):u.setStart(s,a)}else c?u.setStart(c,c.data.length):u.setStart(t,0);u.collapse(!0),ft(t,u.startContainer,u.startOffset)&&(oc(t,u,i),ai(t))}function ts(t,e){if(!t||!e.contains(t))return null;let i=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest(ci)??null;return i&&e.contains(i)?i:null}function oc(t,e,n){let i=ts(Q(t)?.node??null,t);if(i&&i!==ts(e.startContainer,t)){t.dataset.aiaCaretEscapedChip=`${n}:${i.dataset.paramId}`;return}delete t.dataset.aiaCaretEscapedChip}function is(t,e){let n=t.dataset.aiaCaretEscapedChip;if(!n)return!1;let i=Y(t);return i!==null&&n===`${i}:${e}`}function os(t){return he(t).activeElement===t}function di(t,e){if(!e||e.nodeType===void 0)return null;let n=e,i=n.nodeType===Node.ELEMENT_NODE?n:n.parentElement;if(i?.closest("[data-aia-chip-remove]"))return null;let o=i?.closest(ci);if(!o||!t.contains(o))return null;let r=Q(t);return r&&!r.collapsed?null:o.dataset.paramId??null}function mi(t,e){let n=null;for(let s of t.querySelectorAll(ci))if(s.dataset.paramId===e){n=s;break}if(!n)return;let i=li(n,t),o=i+ui(n,t),r=Y(t);r!=null&&r>=i&&r<=o||W(t,i)}function pi(t){let e=Y(t);return e==null?!1:e>=gt(t)}function fi(t,e){if(e<=0)return 0;let n=ic();if(!n)return e-1;let i=t.slice(0,e),o=0;for(let{index:r}of n.segment(i))r<e&&(o=r);return o}var rc="(hover: none) and (pointer: coarse)";function be(){try{if(typeof window>"u")return!1;let t=window.matchMedia;return typeof t!="function"?!1:(gi?.source!==t&&(gi={source:t,list:window.matchMedia(rc)}),gi.list.matches===!0)}catch{return!1}}function sc(t){let e=He(t);return e===t||!!e?.closest("[data-aia-location]")}function hi(t){let e=Q(t);e&&t.contains(e.node)&&Le(t)?.removeAllRanges()}var gi=null;function ht(t){return t==="always"?!0:t==="never"?!1:!be()}function bt(t,e,n){if(!n&&!sc(t)){hi(t);return}t.focus(),W(t,e)}function bi(t){let e=Q(t),n=e!==null&&t.contains(e.node);t.focus(),!n&&be()&&W(t,gt(t))}var rs=150,ac="[data-aia-dropdown], [data-aia-input-wrapper]",lc=["a[href]","button","input","select","textarea","label","summary","[contenteditable]:not([contenteditable='false'])","[role='button']","[role='link']","[tabindex]:not([tabindex='-1'])"].join(", "),Jt=class{constructor(e,n){this.store=e;this.container=n;this.listening=!1;this.declined=!1;this.pressOutside=!1;this.pressWhileFocused=!1;this.recheckTimer=null;this.releaseTimer=null;this.picking=0;this.onPointerDown=e=>{let n=e.composedPath(),i=this.isInside(n);this.pressOutside=!i;let o=this.store.get();this.pressWhileFocused=o.isFocused,!(i||!o.isFocused)&&(this.declined=n.some(r=>r instanceof Element&&r.matches(lc)),this.declined&&o.dropdownHeld?this.store.set({dropdownHeld:!1}):!this.declined&&!o.dropdownHeld&&o.isDropdownOpen&&this.store.set({dropdownHeld:!0}))};this.onPointerCancel=()=>{this.pressOutside=!1,this.pressWhileFocused&&this.declined&&this.scheduleRecheck(),this.pressWhileFocused=!1};this.onPointerUp=e=>{let n=this.pressOutside&&!this.isInside(e.composedPath()),i=this.pressWhileFocused;if(this.pressOutside=!1,this.pressWhileFocused=!1,i){this.declined&&this.scheduleRecheck();return}!n||this.store.get().isFocused||(this.cancelRelease(),this.releaseTimer=setTimeout(()=>{this.releaseTimer=null;let o=this.store.get();o.dropdownHeld&&!o.isFocused&&this.store.set({dropdownHeld:!1})},rs))};this.unsubscribe=e.subscribe(()=>this.sync())}dispose(){this.unsubscribe(),this.listen(!1),this.cancelRelease(),this.recheckTimer!==null&&clearTimeout(this.recheckTimer),this.recheckTimer=null}through(e){this.picking++;try{return e()}finally{this.picking--,this.picking===0&&this.sync()}}holdThroughBlur(){let e=this.store.get();!be()||!e.isDropdownOpen||e.dropdownHeld||(this.declined=!1,this.store.set({dropdownHeld:!0}))}sync(){let e=this.store.get(),n=be();e.isFocused||(this.declined=!1),e.isDropdownOpen?e.isFocused&&!e.dropdownHeld&&!this.declined&&n&&this.store.set({dropdownHeld:!0}):e.dropdownHeld&&this.picking===0&&this.store.set({dropdownHeld:!1});let i=this.store.get();this.listen(n&&i.isDropdownOpen),i.isFocused&&this.cancelRelease()}listen(e){if(!(e===this.listening||typeof document>"u")){if(this.listening=e,e){document.addEventListener("pointerdown",this.onPointerDown,!0),document.addEventListener("pointerup",this.onPointerUp,!0),document.addEventListener("pointercancel",this.onPointerCancel,!0);return}document.removeEventListener("pointerdown",this.onPointerDown,!0),document.removeEventListener("pointerup",this.onPointerUp,!0),document.removeEventListener("pointercancel",this.onPointerCancel,!0),this.pressOutside=!1}}scheduleRecheck(){this.recheckTimer!==null&&clearTimeout(this.recheckTimer),this.recheckTimer=setTimeout(()=>{this.recheckTimer=null,!(!this.declined||!this.store.get().isFocused)&&(this.declined=!1,this.sync())},rs)}cancelRelease(){this.releaseTimer!==null&&(clearTimeout(this.releaseTimer),this.releaseTimer=null)}isInside(e){let n=this.container,i=n?.getRootNode(),o=typeof ShadowRoot<"u"&&i instanceof ShadowRoot?i.host:null;for(let r of e)if(r===n||r===o||r instanceof Element&&r.matches(ac))return!0;return!1}};var We=["January","February","March","April","May","June","July","August","September","October","November","December"],Zt=["S","M","T","W","T","F","S"],ls=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],en="aiaDate",cs="aiaDay",ss=t=>String(t).padStart(2,"0");function V(t){return`${t.getFullYear()}-${ss(t.getMonth()+1)}-${ss(t.getDate())}`}function yi(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function cc(t){let e=yi(t).getTime()-yi(new Date).getTime();return Math.round(e/864e5)}function us(t){let e=cc(t);return e>=0&&e<7?ls[t.getDay()]:Be(t)}function Be(t){return t.getFullYear()===new Date().getFullYear()?`${We[t.getMonth()]} ${t.getDate()}`:`${We[t.getMonth()]} ${t.getDate()} ${t.getFullYear()}`}function tn(t){if(!t)return null;let e=ls.findIndex(a=>a.toLowerCase()===t.trim().toLowerCase());if(e>=0){let a=yi(new Date),l=(e-a.getDay()+7)%7;return new Date(a.getFullYear(),a.getMonth(),a.getDate()+l)}let n=/^\s*([A-Za-z]+)\s+(\d{1,2})(?:\s+(\d{4}))?\s*$/.exec(t);if(!n)return null;let i=We.findIndex(a=>a.toLowerCase()===n[1].toLowerCase());if(i<0)return null;let o=Number(n[2]),r=n[3]?Number(n[3]):new Date().getFullYear(),s=new Date(r,i,o);return s.getMonth()!==i||s.getDate()!==o?null:s}function Si(t){return`${We[t.month]} ${t.year}`}function Ti(){let t=new Date;return{year:t.getFullYear(),month:t.getMonth()}}function ds(t){return{year:t.getFullYear(),month:t.getMonth()}}function vi(t,e){let n=new Date(t.year,t.month+e,1);return{year:n.getFullYear(),month:n.getMonth()}}function as(){return{text:"",is_tappable:!1,kind:null}}function xi(t){let e=new Date(t.year,t.month,1).getDay(),n=new Date(t.year,t.month+1,0).getDate(),i=[];for(let o=0;o<e;o++)i.push(as());for(let o=1;o<=n;o++){let r=new Date(t.year,t.month,o);i.push({text:us(r),is_tappable:!0,kind:null,metadata:{[en]:V(r),[cs]:o}})}for(;i.length%Zt.length!==0;)i.push(as());return i}function yt(t){let e=tn(t);return e?V(e):null}function j(t){let e=t?.metadata?.[en];return typeof e=="string"?e:null}function Ei(t){let e=t?.metadata?.[cs];return typeof e=="number"?e:null}var ms="aiaTime",Pi=5;var Li=[12,1,2,3,4,5,6,7,8,9,10,11],Ci=Array.from({length:60/5},(t,e)=>e*5),Ai=["AM","PM"];function Ue(t){return(Math.round(t)%1440+1440)%1440}function Ii(t){let e=Ue(t),n=Math.floor(e/60);return{hour:n%12===0?12:n%12,minute:e%60,period:n<12?"AM":"PM"}}function nn(t){let e=t.hour%12+(t.period==="PM"?12:0);return Ue(e*60+t.minute)}function on(t){let{hour:e,minute:n,period:i}=Ii(t);return`${e}:${String(n).padStart(2,"0")} ${i}`}function ps(t){let e=Ue(t);return`${String(Math.floor(e/60)).padStart(2,"0")}:${String(e%60).padStart(2,"0")}`}function Ve(t){return Ue(Math.round(t/5)*5)}function fs(t,e){return Ue(t+e)}var uc=/^(\d{1,2})(?::(\d{2}))?\s*([ap])\.?\s*m?\.?$/i,dc=/^(\d{1,2}):(\d{2})$/;function wi(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="noon"||e==="midday")return 720;if(e==="midnight")return 0;let n=uc.exec(e);if(n){let o=Number(n[1]),r=n[2]===void 0?0:Number(n[2]);return o<1||o>12||r>59?null:nn({hour:o,minute:r,period:n[3]==="a"?"AM":"PM"})}let i=dc.exec(e);if(i){let o=Number(i[1]),r=Number(i[2]);return o>23||r>59?null:o*60+r}return null}function gs(t){let e=wi(t.editingText);if(e!=null)return Ve(e);let n=(t.options??[]).filter(o=>o.is_tappable).map(o=>wi(o.text)).filter(o=>o!=null);if(n.length>0)return Ve(n[Math.floor((n.length-1)/2)]);let i=t.now??new Date;return Ue((i.getHours()+1)*60)}function Oi(t){return{text:on(t),is_tappable:!0,kind:null,metadata:{[ms]:ps(t)}}}var rn=30,sn=["hour","minute","period"],ki={hour:Li.map(t=>({label:String(t)})),minute:Ci.map(t=>({label:String(t).padStart(2,"0")})),period:Ai.map(t=>({label:t}))};function Mi(t){return ki[t]}function an(t,e){let n=Ii(Ve(e));return t==="hour"?Li.indexOf(n.hour):t==="minute"?Ci.indexOf(n.minute):Ai.indexOf(n.period)}function ln(t,e,n){let i=ki[t],o=Math.min(Math.max(n,0),i.length-1),r=Ii(Ve(e));return nn(t==="hour"?{...r,hour:Li[o]}:t==="minute"?{...r,minute:Ci[o]}:{...r,period:Ai[o]})}function Ri(t,e){let n=ki[t].length-1;return Math.min(Math.max(Math.round(e/rn),0),n)}function cn(t,e){return t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement?t.selectionStart!=null&&t.selectionStart===t.value.length:t instanceof HTMLElement&&t.hasAttribute("data-aia-input")?pi(t):e?.caretOffset!=null?e.caretOffset>=e.text.length:!1}function _i(t){return t instanceof HTMLElement&&t.hasAttribute("data-aia-input")?Y(t):null}var un=class{constructor(e,n){this.store=e;this.ctx=n}handleKeyDown(e){let n=this.store.get();this.handleKey(e),n.highlightByPointer&&this.store.get().activeDropdownIndex!==n.activeDropdownIndex&&this.store.set({highlightByPointer:!1})}handleKey(e){if(e.isComposing||e.keyCode===229)return;let n=this.store.get(),{listboxId:i,getOnSubmit:o}=this.ctx,r=e.target instanceof Node?e.target:null,s=this.getEffectiveColumns(r),a=o(),l=this.getTappableIndices(s);if((e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)&&(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight"))return;let c=this.ctx.getOptionsPosition()==="above";if(n.multiSelectView&&n.isDropdownOpen){let u=n.highlightByPointer?void 0:n.filteredOptions[n.activeDropdownIndex];if(e.key===" "&&!n.optionQuery&&u?.is_tappable){e.preventDefault(),this.ctx.selectOption(u);return}if(e.key==="Enter"){e.preventDefault(),n.multiSelectView.picked.length===0&&u?.is_tappable&&this.ctx.selectOption(u),this.ctx.commitMultiSelect?.();return}}if(!this.handleTimeWheelKey(e,n))switch(e.key){case"ArrowDown":{let u=cn(e.target,n),d=!!n.editingParam;if(!u&&!d&&n.activeDropdownIndex<0)break;if(n.activeDropdownIndex<0){if(c)break;e.preventDefault();let m=H(n.activeFormatType)?this.dateEntryIndex(n,!1):l[0]??0;if(!n.isDropdownOpen&&n.actionableSuggestions.length>0){this.store.set({pillTapped:!0,activeDropdownIndex:m});break}if(l.length===0)return;this.store.set({activeDropdownIndex:m});break}if(e.preventDefault(),l.length===0)return;if(H(n.activeFormatType)){this.stepDateWeek(n,7);break}if(n.filteredOptions.length>0){let m=Math.floor((n.filteredOptions.length-1)/s);if(Math.floor(n.activeDropdownIndex/s)===m){this.store.set({activeDropdownIndex:-1});break}}let f=l.indexOf(n.activeDropdownIndex),p=f<l.length-1?f+1:0;this.store.set({activeDropdownIndex:l[p]});break}case"ArrowUp":{if(n.activeDropdownIndex<0){if(!c)break;let f=cn(e.target,n),p=!!n.editingParam;if(!f&&!p)break;e.preventDefault();let m=H(n.activeFormatType)?this.dateEntryIndex(n,!0):this.firstTappableInBottomRow(s)??l[0]??0;if(!n.isDropdownOpen&&n.actionableSuggestions.length>0){this.store.set({pillTapped:!0,activeDropdownIndex:m});break}if(l.length===0)return;this.store.set({activeDropdownIndex:m});break}if(l.length===0)break;if(e.preventDefault(),H(n.activeFormatType)){this.stepDateWeek(n,-7);break}if(n.activeDropdownIndex<s){this.store.set({activeDropdownIndex:-1});break}let u=l.indexOf(n.activeDropdownIndex),d=u>0?u-1:l.length-1;this.store.set({activeDropdownIndex:l[d]});break}case"ArrowRight":{if(n.activeDropdownIndex>=0){if(e.preventDefault(),H(n.activeFormatType)){this.stepDateDay(n,1);break}if(n.activeDropdownIndex%s<s-1){let f=n.activeDropdownIndex+1;f<n.filteredOptions.length&&n.filteredOptions[f]?.is_tappable&&this.store.set({activeDropdownIndex:f})}break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingTail!=null){e.preventDefault();let d=e.target.closest("[data-aia-input]")??e.target,f=n.editingTail;this.ctx.exitEditMode?.(),W(d,f);break}cn(e.target,n)&&n.actionableSuggestions.length>=1&&(e.preventDefault(),this.ctx.skipActivePill());break}case"ArrowLeft":{if(n.activeDropdownIndex>=0){if(e.preventDefault(),H(n.activeFormatType)){this.stepDateDay(n,-1);break}if(n.activeDropdownIndex%s>0){let u=n.activeDropdownIndex-1;u>=0&&n.filteredOptions[u]?.is_tappable&&this.store.set({activeDropdownIndex:u});break}if(!n.editingParam&&this.ctx.startEditingParamAtCaret){let u=_i(e.target);u!=null&&this.ctx.startEditingParamAtCaret(u)}break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingAnchor!=null){e.preventDefault();let u=e.target.closest("[data-aia-input]")??e.target,d=n.editingAnchor;this.ctx.exitEditMode?.(),W(u,d);break}if(this.ctx.startEditingParamAtCaret){let u=_i(e.target);u!=null&&this.ctx.startEditingParamAtCaret(u)&&e.preventDefault()}break}case"Backspace":{if(n.editingParam||!this.ctx.removeParamAtCaret)break;let u=_i(e.target);if(u==null)break;this.ctx.removeParamAtCaret(u)&&e.preventDefault();break}case"Enter":{e.preventDefault(),n.activeDropdownIndex>=0&&n.filteredOptions[n.activeDropdownIndex]?.is_tappable?this.clickOrSelect(n.activeDropdownIndex,n.filteredOptions,i,r):a&&this.ctx.submit();break}case"Tab":{if(this.ctx.endTypedWord?.()){e.preventDefault();break}let u=n.filteredOptions.map((p,m)=>p.is_tappable?m:-1).filter(p=>p!==-1);if(u.length===0)break;if(!n.isDropdownOpen){if(n.actionableSuggestions.length===0)break;e.preventDefault();let p=e.shiftKey?u[u.length-1]:u[0];this.store.set({pillTapped:!0,activeDropdownIndex:p});break}e.preventDefault();let d=u.indexOf(n.activeDropdownIndex);if(!e.shiftKey&&!H(n.activeFormatType)&&!n.multiSelectView){let p=d>=0?u[d]:u.find(m=>!n.filteredOptions[m]?.selectsAll);if(p===void 0)break;this.clickOrSelect(p,n.filteredOptions,i,r);break}let f;if(d<0)f=e.shiftKey?u.length-1:0;else{let p=e.shiftKey?-1:1;f=(d+p+u.length)%u.length}this.store.set({activeDropdownIndex:u[f]});break}case"Escape":{if(n.dateRangeStart){this.store.set({pendingRangeStart:null});break}if(n.editingIdentified){this.ctx.exitEditingIdentified?.(),this.store.set({activeDropdownIndex:-1});break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingTail!=null){let u=e.target.closest("[data-aia-input]")??e.target,d=n.editingTail;this.ctx.exitEditMode?.(),W(u,d)}this.store.set({activeDropdownIndex:-1});break}}}handleTimeWheelKey(e,n){let i=n.timeView;if(n.activeFormatType!=="time"||!i||!n.isDropdownOpen)return!1;switch(e.key){case"ArrowDown":case"ArrowUp":return!cn(e.target,n)&&!n.editingParam?!1:(e.preventDefault(),this.ctx.stepTime?.(e.key==="ArrowDown"?5:-5),!0);case"Enter":return i.touched?(e.preventDefault(),this.ctx.commitTime?.(),!0):!1;case"Escape":return i.touched?(this.store.set({timeDraft:null}),!0):!1;default:return!1}}firstTappableInBottomRow(e){let n=this.store.get();if(n.filteredOptions.length===0)return null;let o=Math.floor((n.filteredOptions.length-1)/e)*e;for(let r=o;r<n.filteredOptions.length;r++)if(n.filteredOptions[r]?.is_tappable)return r;return null}dateEntryIndex(e,n){if(e.dateFloor){let s=e.filteredOptions.findIndex(a=>j(a)===e.dateFloor);if(s>=0)return s}let i=V(new Date),o=e.filteredOptions.findIndex(s=>j(s)===i);if(o>=0)return o;let r=e.filteredOptions.map((s,a)=>s.is_tappable?a:-1).filter(s=>s!==-1);return(n?r[r.length-1]:r[0])??0}stepDateDay(e,n){for(let i=e.activeDropdownIndex+n;i>=0&&i<e.filteredOptions.length;i+=n)if(e.filteredOptions[i]?.is_tappable){this.store.set({activeDropdownIndex:i});return}}stepDateWeek(e,n){let i=e.activeDropdownIndex+n;this.store.set({activeDropdownIndex:e.filteredOptions[i]?.is_tappable?i:-1})}getTappableIndices(e){let i=this.store.get().filteredOptions.map((r,s)=>r.is_tappable?s:-1).filter(r=>r!==-1),o=Array.from({length:e},()=>[]);for(let r of i)o[r%e].push(r);return o.flat()}getEffectiveColumns(e){let n=Qt(e,this.ctx.listboxId);if(!n)return this.store.get().multiSelectView?1:this.ctx.columns;let o=Qt(e,`${this.ctx.listboxId}-option-0`)?.parentElement??null;for(;o;){let r=getComputedStyle(o).gridTemplateColumns;if(r&&r!=="none"){let s=r.split(" ").filter(Boolean).length;if(s>0)return s}if(o===n)break;o=o.parentElement}return this.ctx.columns}clickOrSelect(e,n,i,o){let r=Qt(o,`${i}-option-${e}`);r?r.click():this.ctx.selectOption(n[e])}};var dn=class{constructor(e,n,i={}){this.store=e;this.getOverrides=n;this.callbacks=i;this.unsubscribe=null;this.current=null;this.version=0;this.lastMiss=null;this.hasLoggedError=!1}start(){this.unsubscribe=this.store.subscribe(e=>this.sync(e)),this.sync(this.store.get())}dispose(){this.unsubscribe?.(),this.unsubscribe=null,this.cancel(),this.current=null}reset(){this.cancel(),this.current=null,this.lastMiss=null}refresh(){this.reset(),this.sync(this.store.get())}hasOverride(e){return!!this.getOverrides()?.[e]}owns(e,n){return this.hasOverride(e)&&!this.missCovers(e,n)}tick(e,n){let i=this.resolveTarget(e);if(!i||this.missCovers(i.parameter,i.query))return"no";let o=this.current;if(o&&o.key===i.key){if(o.query===i.query)return"owns";let r=Math.abs(i.query.length-o.query.length),s=i.query.length<o.query.length;if(n>1&&!s&&r<n)return"owns"}return this.ask(i),"asked"}sync(e){let n=this.resolveTarget(e);if(!n){this.current&&(this.cancel(),this.current=null),e.optionSearch&&this.store.set({optionSearch:null});return}this.current&&this.current.key===n.key||this.ask(n)}resolveTarget(e){if(F(e.activeFormatType)||e.editingIdentified)return null;let n=e.editingParam;if(n&&e.editingAnchor!=null)return this.hasOverride(n.suggestionParameter)?{mode:"edit",key:n.id,parameter:n.suggestionParameter,suggestion:{parameter:n.suggestionParameter,text:n.suggestionPlaceholder,required:!0,options:n.options,icon:n.suggestionIcon,icon_svg:n.suggestionIconSvg},query:e.optionQuery}:null;let i=e.actionableSuggestions[0];return!i||!this.hasOverride(i.parameter)?null:{mode:"pill",key:i,parameter:i.parameter,suggestion:i,query:e.optionQuery}}missCovers(e,n){return this.lastMiss!=null&&this.lastMiss.parameter===e&&this.lastMiss.query===n}ask(e){this.cancel();let n=this.getOverrides()?.[e.parameter],i=++this.version;if(!n||this.missCovers(e.parameter,e.query)){this.current={key:e.key,parameter:e.parameter,query:e.query,abort:null},this.setSearch(e,"done");return}let o=new AbortController;this.current={key:e.key,parameter:e.parameter,query:e.query,abort:o};let r;try{r=n(e.query,o.signal,e.suggestion)}catch(s){this.logOnce(s),this.commit(e,[],i);return}if(Array.isArray(r)){this.commit(e,r,i);return}this.setSearch(e,"loading"),this.await(e,r,o.signal,i)}async await(e,n,i,o){let r;try{let s=await n;if(i.aborted||o!==this.version)return;r=Array.isArray(s)?s:[]}catch(s){if(i.aborted||o!==this.version||mc(s))return;this.logOnce(s),r=[]}this.commit(e,r,o)}commit(e,n,i){if(i!==this.version)return;let o=Vr(n,e.suggestion),r=this.resolveTarget(this.store.get());if(!r||r.key!==e.key)return;o.length===0?this.lastMiss={parameter:e.parameter,query:e.query}:this.lastMiss?.parameter===e.parameter&&(this.lastMiss=null);let s={parameter:e.parameter,query:e.query,status:"done"};if(e.mode==="edit")this.store.set(a=>({editingParam:a.editingParam&&a.editingParam.id===e.key?{...a.editingParam,options:o}:a.editingParam,optionSearch:s}));else{let a={...e.suggestion,options:o};this.current&&this.current.key===e.key&&(this.current.key=a),this.store.set(l=>({suggestions:l.suggestions.map(c=>c===e.suggestion?a:c),optionSearch:s}))}o.length===0?this.callbacks.onMiss?.(e.mode,e.query):this.callbacks.onAnswer?.(e.mode,e.query)}setSearch(e,n){let i=this.store.get().optionSearch;i&&i.parameter===e.parameter&&i.query===e.query&&i.status===n||this.store.set({optionSearch:{parameter:e.parameter,query:e.query,status:n}})}cancel(){this.current?.abort?.abort(),this.version++}logOnce(e){this.hasLoggedError||(this.hasLoggedError=!0,console.warn("[Intent-1] an optionOverrides entry threw or rejected \u2014 treated as no options. Later failures on this instance are not logged.",e))}};function mc(t){return t instanceof Error&&t.name==="AbortError"}var mn=class{constructor(e,n={}){this.store=e;this.callbacks=n}setActivePill(e){let n=this.store.get(),i=n.suggestions.filter(c=>c.parameter!=="placeholder");if(e<0||e>=i.length)return;let o=i[e];if(A(o))return;let r=i.filter((c,u)=>u!==e),s=n.suggestions.filter(c=>c.parameter==="placeholder");if(this.callbacks.onPillSelected){let{rawQuery:c}=R(n.text,n.completedParams);this.callbacks.onPillSelected({rawQuery:c,selectedPill:o.text,otherPills:r.map(u=>u.text)})}let a=[...s,o,...r],l=this.store.peek({suggestions:a}).filteredOptions.findIndex(c=>c.is_tappable&&!c.selectsAll);this.store.set({suggestions:a,pillTapped:!0,activeDropdownIndex:l})}removeLastParam(){this.store.get().completedParams.length!==0&&this.store.set(n=>({completedParams:n.completedParams.slice(0,-1),activeDropdownIndex:-1}))}};var ys="/products/",hs="https://relative.invalid";function pc(t){if(!t)return;let e;try{e=new URL(t,`${hs}/`)}catch{return}if(!(e.protocol!=="http:"&&e.protocol!=="https:"))return t.startsWith("/")?e.origin===hs?t:void 0:/^https?:\/\//i.test(t)?t:void 0}function Ss(t,e){let n=pc(t.item_url)??gc(t);return{id:t.source_id,title:t.title,...n&&{url:n},imageUrl:t.image_url||null,...t.price&&{price:bs(t.price,t.currency,e)},...fc(t)&&{compareAtPrice:bs(t.compare_at_price,t.currency,e)},...t.vendor&&{vendor:t.vendor},...typeof t.available=="boolean"&&{available:t.available}}}function fc(t){if(!t.price||!t.compare_at_price)return!1;let e=Number(t.price),n=Number(t.compare_at_price);return Number.isFinite(e)&&Number.isFinite(n)&&n>e}function bs(t,e,n){if(n===void 0||!e||!/^\d+(\.\d+)?$/.test(t))return t;try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(Number(t))}catch{return t}}function gc(t){if(!t.handle)return;let e=`${ys}${encodeURIComponent(t.handle)}`;return t.variant_id?`${e}?variant=${encodeURIComponent(t.variant_id)}`:e}function Di(t,e){return(t?.items.matched??[]).map(n=>Ss(n,e))}var pn=class{constructor(e,n,i=()=>!0,o=()=>{},r=()=>{}){this.store=e;this.getConfig=n;this.isEnabled=i;this.getLanguage=o;this.getMapper=r;this.hasLoggedError=!1;this.hasLoggedMapperError=!1}forResponse(e){if(!this.isEnabled())return[];if(this.getConfig())return;let n=Di(e,re(this.getLanguage())),i=this.getMapper();if(!i)return n;try{let o=i(n,e?.items.matched??[]);if(Array.isArray(o))return o}catch(o){this.hasLoggedMapperError||(this.hasLoggedMapperError=!0,console.warn("[Intent-1] mapProducts failed. The original cards are shown.",o))}return n}async run(e,n,i){if(!this.isEnabled())return;let o=this.getConfig();if(!o)return;if(e.trim().length===0){this.clear(i);return}let r=()=>n.aborted||!i()||!this.owns(o);try{let s=await o.fetch(e,n);if(r())return;let a=o.transform(s),l=Array.isArray(a)?a:[],c=o.limit!=null?l.slice(0,o.limit):l;if(r())return;this.commit(c)}catch(s){if(n.aborted||hc(s)||(this.logOnce(s),r()))return;this.clear(i)}}owns(e){return this.isEnabled()&&this.getConfig()===e}resync(){let e=this.forResponse(this.store.get().customFields);this.commit(e??[])}refresh(){if(this.getConfig())return;let e=this.forResponse(this.store.get().customFields);e!==void 0&&this.commit(e)}clear(e){e()&&this.commit([])}commit(e){e.length===0&&this.store.get().products.length===0||this.store.set({products:e})}logOnce(e){this.hasLoggedError||(this.hasLoggedError=!0,console.warn("[Intent-1] products.fetch/transform failed \u2014 the product strip is hidden. Later failures on this instance are not logged.",e))}};function hc(t){return t instanceof Error&&t.name==="AbortError"}function bc(t){return t.replace(/(\d+)(?:st|nd|rd|th)\b/g,"$1")}function Ts(t){let e=t.toLowerCase().replace(/\.$/,"");return e.length<3?-1:We.findIndex(n=>n.toLowerCase().startsWith(e))}function yc(t,e,n){let i=new Date(n.getFullYear(),t,e);if(i.getMonth()!==t||i.getDate()!==e)return null;let o=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(i>=o)return i;let r=new Date(n.getFullYear()+1,t,e);return r.getMonth()===t&&r.getDate()===e?r:null}var Sc=/^(?:(?:on|from) )?(?:the )?(\d{1,2})(?:st|nd|rd|th)$/;function Hi(t){let e=Sc.exec(t.trim().toLowerCase().replace(/\s+/g," "));if(!e)return null;let n=Number(e[1]);return n>=1&&n<=31?n:null}function Tc(t,e){if(!Number.isFinite(e.getTime()))return null;let n=new Date(e.getFullYear(),e.getMonth(),e.getDate());for(let i=0;i<12;i++){let o=new Date(e.getFullYear(),e.getMonth()+i,t);if(o.getDate()===t&&o>=n)return o}return null}function vs(t,e,n){let i=new Date(t,e,n);return i.getMonth()===e&&i.getDate()===n?i:null}function $e(t,e={}){if(!t)return null;let n=e.today??new Date,i=Hi(t);if(i!==null){let c=Tc(i,n);return c?V(c):null}let o=bc(t.trim().toLowerCase()).replace(/\s+/g," "),r=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(o);if(r){let c=vs(Number(r[1]),Number(r[2])-1,Number(r[3]));return c?V(c):null}let s=/^([a-z]+)\.? (\d{1,2})(?:,? (\d{4}))?$/.exec(o);if(s){let c=Ts(s[1]);if(c>=0)return fn(c,Number(s[2]),s[3],n)}let a=/^(\d{1,2}) (?:of )?([a-z]+)\.?(?:,? (\d{4}))?$/.exec(o);if(a){let c=Ts(a[2]);if(c>=0)return fn(c,Number(a[1]),a[3],n)}let l=/^(\d{1,2})[/\-.](\d{1,2})(?:[/\-.](\d{2,4}))?$/.exec(o);if(l){let c=Number(l[1]),u=Number(l[2]);return c>12&&u<=12?fn(u-1,c,l[3],n):u>12&&c<=12?fn(c-1,u,l[3],n):null}return null}function fn(t,e,n,i){if(n){if(n.length!==4)return null;let r=vs(Number(n),t,e);return r?V(r):null}let o=yc(t,e,i);return o?V(o):null}var vc=/^\d{4}-\d{2}-\d{2}$/;function St(t){return typeof t=="string"&&vc.test(t)?t:null}function Ni(t,e={}){return St(t.isoDate)??$e(t.text,e)}function Tt(t){let e=St(t.isoDate);return e?{start:e,end:St(t.isoDateEnd)}:null}var xs=" - ",Bi="aiaDateRangeStart",Vi="aiaDateRangeEnd";function vt(t,e){return t<=e?{start:t,end:e}:{start:e,end:t}}var Fi=/^\d{4}-\d{2}-\d{2}$/;function Wi(t){if(!Fi.test(t))return null;let[e,n,i]=t.split("-").map(Number),o=new Date(e,n-1,i);return o.getMonth()===n-1&&o.getDate()===i?o:null}var xc=/\s+(?:to|through|thru|until|til|till)\s+/g,Ec=/[-–—]/g;function wc(t){let e=[];for(let n of[xc,Ec]){n.lastIndex=0;let i=n.exec(t);for(;i!==null;)e.push([t.slice(0,i.index),t.slice(i.index+i[0].length)]),i=n.exec(t)}return e}function gn(t,e={}){if(!t)return null;let n=new Set,i=null;for(let[o,r]of wc(t.trim())){let s=$e(o.trim(),e);if(!s)continue;let a=Hi(r)!==null?$e(r.trim(),{...e,today:Wi(s)??e.today}):$e(r.trim(),e);!a||a<s||(n.add(`${s}|${a}`),i={start:s,end:a})}return n.size===1?i:null}function Es(t){let e=Wi(t.start),n=Wi(t.end);return!e||!n?"":t.start===t.end?Be(e):`${Be(e)}${xs}${Be(n)}`}function ws(t,e){let n=vt(t,e);return{text:Es(n),is_tappable:!0,kind:null,metadata:{[Bi]:n.start,[Vi]:n.end}}}function qe(t,e={}){let n=t?.metadata?.[Bi],i=t?.metadata?.[Vi];return typeof n=="string"&&typeof i=="string"&&Fi.test(n)&&Fi.test(i)?vt(n,i):gn(t?.text,e)}var hn="(max-width: 768px)";var Pc="var(--aia-option-row-height, 37px)",Lc="var(--aia-grid-scroll-top, 0px) + var(--aia-grid-scroll-bottom, 0px)",Cc="max(0, var(--aia-option-peek, 0))";function Ps(t,e){let n=e?5:4;return Ls(1,Math.min(t,n),t>n)}function Ls(t,e,n){let i=n?`(${e} + ${Cc})`:`${e}`;return{cols:t,rows:e,maxHeight:`calc(${i} * ${Pc} + ${Lc})`}}function $i(t,e){return!e&&t>=5}function qi(t,e,n,i){if(!(!e&&t>=5&&Ac(n,i))){let s=Ps(t,e);return{...s,template:Ui(s.cols),scrollHintIndices:!e&&t>s.rows?[s.rows-1]:[]}}let r=6;return{...Ls(2,3,t>r),template:Ui(2),scrollHintIndices:t>r?[r-2,r-1]:[]}}function Ac(t,e){return!t||t.length===0||e==null||e<=0||t.some(i=>i<=0)?!1:Math.ceil(Math.max(...t))*2<=e}function xt(t){if(typeof document>"u")return null;let e=Array.from(t.querySelectorAll("[data-aia-option]"));if(e.length===0)return null;let n=document.createElement("div");n.style.cssText="position:absolute;visibility:hidden;left:-9999px;top:0;";for(let s of e){let a=s.cloneNode(!0);a.removeAttribute("id"),a.removeAttribute("role"),a.removeAttribute("aria-selected"),a.style.whiteSpace="nowrap",a.style.width="max-content",n.appendChild(a)}t.appendChild(n);let i=Array.from(n.children).map(s=>s.offsetWidth);n.remove();let o=getComputedStyle(t),r=t.clientWidth-(Number.parseFloat(o.paddingLeft)||0)-(Number.parseFloat(o.paddingRight)||0)-(Number.parseFloat(o.columnGap)||0);return{rowWidths:i,gridWidth:r}}var Gi="data-aia-glide-width",Ki="--aia-glide-content-width";function Ui(t){return Array.from({length:t},()=>"minmax(0,1fr)").join(" ")}function Et(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(hn).matches}function zi(t,e){return!t||t.length!==e.length?!1:t.every((n,i)=>n.text===e[i].text)}function Cs(t,e){return t.trim().toLowerCase()===e.trim().toLowerCase()}function Qi(t,e){let n=[];for(let i of e?.blocking_filters??[])for(let o of t)o.type==="text"||n.some(r=>r.paramId===o.param.id)||Cs(o.param.parameter,i.parameter)&&(o.type==="completed"&&!(o.params??[o.param]).map(s=>s.value??s.text).some(s=>Cs(s,i.value))||n.push({paramId:o.param.id,text:o.value,total:i.total}));return n}var As={language:"en",and:"and",proceed:"to proceed",select:"to select",skipHint:"to skip",skip:"skip",skipLabel:"Skip",products:"Items",soldOut:"Sold out",addToCart:"Add to cart",submit:"Submit",seeAllResults:"See all results",scrollArrow:"Scroll down for more options",keepTyping:"Keep typing",done:"Done",allOption:"All",timeLabel:"Time",locationSearch:"Say a location",locationNoResults:"No places found",locationUseTyped:"Press Enter to use what you typed"},Ic={language:"es",and:"y",proceed:"para continuar",select:"para seleccionar",skipHint:"para omitir",skip:"omitir",skipLabel:"Omitir",products:"Mejor coincidencia",soldOut:"Agotado",addToCart:"A\xF1adir al carrito",submit:"Buscar",seeAllResults:"Ver todos los resultados",scrollArrow:"Despl\xE1zate para ver m\xE1s opciones",keepTyping:"Sigue escribiendo",done:"Listo",allOption:"Todo",timeLabel:"Hora",locationSearch:"Di una ubicaci\xF3n",locationNoResults:"No se encontraron lugares",locationUseTyped:"Pulsa Intro para usar lo que escribiste"},Yi={en:As,es:Ic,fr:{language:"fr",and:"et",proceed:"pour continuer",select:"pour s\xE9lectionner",skipHint:"pour passer",skip:"passer",skipLabel:"Passer",products:"Meilleure correspondance",soldOut:"\xC9puis\xE9",addToCart:"Ajouter au panier",submit:"Rechercher",seeAllResults:"Voir tous les r\xE9sultats",scrollArrow:"Faites d\xE9filer pour voir plus d\u2019options",keepTyping:"Continuez \xE0 taper",done:"Termin\xE9",allOption:"Tout",timeLabel:"Heure",locationSearch:"Dites un lieu",locationNoResults:"Aucun lieu trouv\xE9",locationUseTyped:"Appuyez sur Entr\xE9e pour utiliser votre saisie"},"pt-BR":{language:"pt-BR",and:"e",proceed:"para continuar",select:"para selecionar",skipHint:"para pular",skip:"pular",skipLabel:"Pular",products:"Melhor correspond\xEAncia",soldOut:"Esgotado",addToCart:"Adicionar ao carrinho",submit:"Buscar",seeAllResults:"Ver todos os resultados",scrollArrow:"Role para ver mais op\xE7\xF5es",keepTyping:"Continue digitando",done:"Conclu\xEDdo",allOption:"Tudo",timeLabel:"Hor\xE1rio",locationSearch:"Diga um local",locationNoResults:"Nenhum lugar encontrado",locationUseTyped:"Pressione Enter para usar o que voc\xEA digitou"},it:{language:"it",and:"e",proceed:"per continuare",select:"per selezionare",skipHint:"per saltare",skip:"salta",skipLabel:"Salta",products:"Migliore corrispondenza",soldOut:"Esaurito",addToCart:"Aggiungi al carrello",submit:"Cerca",seeAllResults:"Vedi tutti i risultati",scrollArrow:"Scorri per vedere altre opzioni",keepTyping:"Continua a scrivere",done:"Fatto",allOption:"Tutto",timeLabel:"Ora",locationSearch:"Di' un luogo",locationNoResults:"Nessun luogo trovato",locationUseTyped:"Premi Invio per usare ci\xF2 che hai scritto"},tr:{language:"tr",and:"ve",proceed:"devam etmek i\xE7in",select:"se\xE7mek i\xE7in",skipHint:"atlamak i\xE7in",skip:"atla",skipLabel:"Atla",products:"En iyi e\u015Fle\u015Fme",soldOut:"T\xFCkendi",addToCart:"Sepete ekle",submit:"Ara",seeAllResults:"T\xFCm sonu\xE7lar\u0131 g\xF6r",scrollArrow:"Daha fazla se\xE7enek i\xE7in kayd\u0131r",keepTyping:"Yazmaya devam et",done:"Tamam",allOption:"T\xFCm\xFC",timeLabel:"Saat",locationSearch:"Bir konum s\xF6yleyin",locationNoResults:"Yer bulunamad\u0131",locationUseTyped:"Yazd\u0131\u011F\u0131n\u0131z\u0131 kullanmak i\xE7in Enter'a bas\u0131n"},id:{language:"id",and:"dan",proceed:"untuk melanjutkan",select:"untuk memilih",skipHint:"untuk melewati",skip:"lewati",skipLabel:"Lewati",products:"Paling cocok",soldOut:"Habis",addToCart:"Tambah ke keranjang",submit:"Cari",seeAllResults:"Lihat semua hasil",scrollArrow:"Gulir untuk melihat opsi lainnya",keepTyping:"Teruskan mengetik",done:"Selesai",allOption:"Semua",timeLabel:"Waktu",locationSearch:"Sebutkan lokasi",locationNoResults:"Tempat tidak ditemukan",locationUseTyped:"Tekan Enter untuk memakai yang Anda ketik"},pl:{language:"pl",and:"i",proceed:"aby kontynuowa\u0107",select:"aby wybra\u0107",skipHint:"aby pomin\u0105\u0107",skip:"pomi\u0144",skipLabel:"Pomi\u0144",products:"Najlepsze dopasowanie",soldOut:"Wyprzedane",addToCart:"Dodaj do koszyka",submit:"Szukaj",seeAllResults:"Zobacz wszystkie wyniki",scrollArrow:"Przewi\u0144, aby zobaczy\u0107 wi\u0119cej opcji",keepTyping:"Pisz dalej",done:"Gotowe",allOption:"Wszystko",timeLabel:"Godzina",locationSearch:"Podaj lokalizacj\u0119",locationNoResults:"Nie znaleziono miejsc",locationUseTyped:"Naci\u015Bnij Enter, aby u\u017Cy\u0107 wpisanego tekstu"},de:{language:"de",and:"und",proceed:"zum Fortfahren",select:"zum Ausw\xE4hlen",skipHint:"zum \xDCberspringen",skip:"\xFCberspringen",skipLabel:"\xDCberspringen",products:"Beste Treffer",soldOut:"Ausverkauft",addToCart:"In den Warenkorb",submit:"Suchen",seeAllResults:"Alle Ergebnisse anzeigen",scrollArrow:"Scrolle f\xFCr weitere Optionen",keepTyping:"Weitertippen",done:"Fertig",allOption:"Alle",timeLabel:"Uhrzeit",locationSearch:"Nenne einen Ort",locationNoResults:"Keine Orte gefunden",locationUseTyped:"Dr\xFCcke Enter, um deine Eingabe zu verwenden"},nl:{language:"nl",and:"en",proceed:"om door te gaan",select:"om te selecteren",skipHint:"om over te slaan",skip:"overslaan",skipLabel:"Overslaan",products:"Beste match",soldOut:"Uitverkocht",addToCart:"In winkelwagen",submit:"Zoeken",seeAllResults:"Alle resultaten bekijken",scrollArrow:"Scrol voor meer opties",keepTyping:"Blijf typen",done:"Klaar",allOption:"Alles",timeLabel:"Tijd",locationSearch:"Noem een locatie",locationNoResults:"Geen plaatsen gevonden",locationUseTyped:"Druk op Enter om je invoer te gebruiken"},sv:{language:"sv",and:"och",proceed:"f\xF6r att forts\xE4tta",select:"f\xF6r att v\xE4lja",skipHint:"f\xF6r att hoppa \xF6ver",skip:"hoppa \xF6ver",skipLabel:"Hoppa \xF6ver",products:"B\xE4sta matchning",soldOut:"Sluts\xE5ld",addToCart:"L\xE4gg i varukorgen",submit:"S\xF6k",seeAllResults:"Visa alla resultat",scrollArrow:"Skrolla f\xF6r fler alternativ",keepTyping:"Forts\xE4tt skriva",done:"Klar",allOption:"Alla",timeLabel:"Tid",locationSearch:"S\xE4g en plats",locationNoResults:"Inga platser hittades",locationUseTyped:"Tryck p\xE5 Enter f\xF6r att anv\xE4nda det du skrev"},nb:{language:"nb",and:"og",proceed:"for \xE5 fortsette",select:"for \xE5 velge",skipHint:"for \xE5 hoppe over",skip:"hopp over",skipLabel:"Hopp over",products:"Beste treff",soldOut:"Utsolgt",addToCart:"Legg i handlekurven",submit:"S\xF8k",seeAllResults:"Se alle resultater",scrollArrow:"Rull ned for \xE5 se flere alternativer",keepTyping:"Fortsett \xE5 skrive",done:"Ferdig",allOption:"Alle",timeLabel:"Tid",locationSearch:"Si et sted",locationNoResults:"Fant ingen steder",locationUseTyped:"Trykk Enter for \xE5 bruke det du skrev"},da:{language:"da",and:"og",proceed:"for at forts\xE6tte",select:"for at v\xE6lge",skipHint:"for at springe over",skip:"spring over",skipLabel:"Spring over",products:"Bedste match",soldOut:"Udsolgt",addToCart:"L\xE6g i kurv",submit:"S\xF8g",seeAllResults:"Se alle resultater",scrollArrow:"Rul for flere muligheder",keepTyping:"Forts\xE6t med at skrive",done:"F\xE6rdig",allOption:"Alle",timeLabel:"Tidspunkt",locationSearch:"Sig et sted",locationNoResults:"Ingen steder fundet",locationUseTyped:"Tryk p\xE5 Enter for at bruge det, du skrev"},fi:{language:"fi",and:"ja",proceed:"jatkaaksesi",select:"valitaksesi",skipHint:"ohittaaksesi",skip:"ohita",skipLabel:"Ohita",products:"Paras vastaavuus",soldOut:"Loppuunmyyty",addToCart:"Lis\xE4\xE4 ostoskoriin",submit:"Hae",seeAllResults:"N\xE4yt\xE4 kaikki tulokset",scrollArrow:"Vierit\xE4 n\xE4hd\xE4ksesi lis\xE4\xE4 vaihtoehtoja",keepTyping:"Jatka kirjoittamista",done:"Valmis",allOption:"Kaikki",timeLabel:"Aika",locationSearch:"Sano sijainti",locationNoResults:"Paikkoja ei l\xF6ytynyt",locationUseTyped:"Paina Enteri\xE4 k\xE4ytt\xE4\xE4ksesi kirjoittamaasi"},ja:{language:"ja",and:"\u3068",proceed:"\u3067\u6B21\u3078",select:"\u3067\u9078\u629E",skipHint:"\u3067\u30B9\u30AD\u30C3\u30D7",skip:"\u30B9\u30AD\u30C3\u30D7",skipLabel:"\u30B9\u30AD\u30C3\u30D7",products:"\u30D9\u30B9\u30C8\u30DE\u30C3\u30C1",soldOut:"\u58F2\u308A\u5207\u308C",addToCart:"\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0",submit:"\u691C\u7D22",seeAllResults:"\u3059\u3079\u3066\u306E\u7D50\u679C\u3092\u898B\u308B",scrollArrow:"\u30B9\u30AF\u30ED\u30FC\u30EB\u3057\u3066\u4ED6\u306E\u5019\u88DC\u3092\u898B\u308B",keepTyping:"\u5165\u529B\u3092\u7D9A\u3051\u308B",done:"\u5B8C\u4E86",allOption:"\u3059\u3079\u3066",timeLabel:"\u6642\u523B",locationSearch:"\u5834\u6240\u3092\u8A00\u3063\u3066\u304F\u3060\u3055\u3044",locationNoResults:"\u5834\u6240\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",locationUseTyped:"\u5165\u529B\u3057\u305F\u5185\u5BB9\u3092\u4F7F\u3046\u306B\u306F Enter \u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044"},ko:{language:"ko",and:"\uBC0F",proceed:"\uACC4\uC18D",select:"\uC120\uD0DD",skipHint:"\uAC74\uB108\uB6F0\uAE30",skip:"\uAC74\uB108\uB6F0\uAE30",skipLabel:"\uAC74\uB108\uB6F0\uAE30",products:"\uCD94\uCC9C \uC0C1\uD488",soldOut:"\uD488\uC808",addToCart:"\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uB2F4\uAE30",submit:"\uAC80\uC0C9",seeAllResults:"\uBAA8\uB4E0 \uACB0\uACFC \uBCF4\uAE30",scrollArrow:"\uB354 \uB9CE\uC740 \uC635\uC158\uC744 \uBCF4\uB824\uBA74 \uC2A4\uD06C\uB864\uD558\uC138\uC694",keepTyping:"\uACC4\uC18D \uC785\uB825\uD558\uC138\uC694",done:"\uC644\uB8CC",allOption:"\uC804\uCCB4",timeLabel:"\uC2DC\uAC04",locationSearch:"\uC704\uCE58\uB97C \uB9D0\uD558\uC138\uC694",locationNoResults:"\uC7A5\uC18C\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",locationUseTyped:"\uC785\uB825\uD55C \uB0B4\uC6A9\uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 Enter\uB97C \uB204\uB974\uC138\uC694"},"zh-CN":{language:"zh-CN",and:"\u548C",proceed:"\u7EE7\u7EED",select:"\u9009\u62E9",skipHint:"\u8DF3\u8FC7",skip:"\u8DF3\u8FC7",skipLabel:"\u8DF3\u8FC7",products:"\u6700\u4F73\u5339\u914D",soldOut:"\u552E\u7F44",addToCart:"\u52A0\u5165\u8D2D\u7269\u8F66",submit:"\u641C\u7D22",seeAllResults:"\u67E5\u770B\u5168\u90E8\u7ED3\u679C",scrollArrow:"\u5411\u4E0B\u6EDA\u52A8\u67E5\u770B\u66F4\u591A\u9009\u9879",keepTyping:"\u7EE7\u7EED\u8F93\u5165",done:"\u5B8C\u6210",allOption:"\u5168\u90E8",timeLabel:"\u65F6\u95F4",locationSearch:"\u8BF4\u51FA\u5730\u70B9",locationNoResults:"\u672A\u627E\u5230\u5730\u70B9",locationUseTyped:"\u6309 Enter \u4F7F\u7528\u4F60\u8F93\u5165\u7684\u5185\u5BB9"},"zh-TW":{language:"zh-TW",and:"\u548C",proceed:"\u7E7C\u7E8C",select:"\u9078\u64C7",skipHint:"\u7565\u904E",skip:"\u7565\u904E",skipLabel:"\u7565\u904E",products:"\u6700\u4F73\u5339\u914D",soldOut:"\u552E\u5B8C",addToCart:"\u52A0\u5165\u8CFC\u7269\u8ECA",submit:"\u641C\u5C0B",seeAllResults:"\u67E5\u770B\u5168\u90E8\u7D50\u679C",scrollArrow:"\u5411\u4E0B\u6372\u52D5\u67E5\u770B\u66F4\u591A\u9078\u9805",keepTyping:"\u7E7C\u7E8C\u8F38\u5165",done:"\u5B8C\u6210",allOption:"\u5168\u90E8",timeLabel:"\u6642\u9593",locationSearch:"\u8AAA\u51FA\u5730\u9EDE",locationNoResults:"\u627E\u4E0D\u5230\u5730\u9EDE",locationUseTyped:"\u6309 Enter \u4F7F\u7528\u4F60\u8F38\u5165\u7684\u5167\u5BB9"}},Oc={pt:"pt-BR",no:"nb",nn:"nb"};function _(t){let[e,...n]=t?.toLowerCase().split("-")??[];if(e==="zh"){let o=n.some(r=>["hant","tw","hk","mo"].includes(r));return Yi[o?"zh-TW":"zh-CN"]}let i=Oc[e]??e;return Object.prototype.hasOwnProperty.call(Yi,i)?Yi[i]:As}function Is(t,e){let n=e.dropdownTrigger??"auto",i=e.closeDropdownOnBlur??!0,s=t.filteredOptionsLength>0||t.activePillHasNoOptions||t.hasProducts;if(t.inEditMode){let a=i?t.isFocused||t.dropdownHeld:!0;return s&&a}if(n==="auto"){let a=i?t.isFocused||t.dropdownHeld:!0,l=t.text.replace(/\s+$/,"").length,c=t.caretOffset==null||t.caretOffset>=l;return(s||t.isLoading)&&a&&c}return n==="manual"?(s||t.isLoading)&&t.pillTapped:!1}function B(t){if(t.editingIdentified){let{parameter:n,anchor:i}=t.editingIdentified;return`identified:${n}@${i}`}return t.editingParam!=null&&t.editingAnchor!=null?`edit:${t.editingParam?.id}`:`pill:${t.actionableSuggestions[0]?.parameter??""}`}function bn(t){if(!t)return Ti();let[e,n]=t.split("-").map(Number);return{year:e,month:n-1}}function kc(t){let e=tn(t);return e?ds(e):Ti()}function Mc(t,e){if(!t)return null;for(let n of e){if(n.parameter!==t||n.type?.kind!=="date_range")continue;let i=Tt(n);if(i&&i.end==null)return i.start}return null}function Rc(t){let e=new Set,n=i=>{i&&e.add(i)};for(let i of t.completedParams??[]){if(i.id===t.editingParam?.id)continue;let o=i.suggestionValueType?.kind;if(o==="date"&&n(St(i.metadata?.[en])??yt(i.text)),o==="date_range"){let r=qe(i);n(r?.start),n(r?.end)}}for(let i of t.identifiedParams??[]){if(i.id===t.editingIdentified?.id)continue;let o=i.type?.kind;if(o!=="date"&&o!=="date_range")continue;let r=Tt(i);n(r?.start),n(r?.end)}return[...e].sort()}function ji(t,e){return t.editingParam!=null&&t.editingAnchor!=null?e:t.text.slice(Pe(t.text,t.completedParams))}var _c=/price/i;function Dc(t){return!t||De(t)||F(te(t))||t.type?.kind==="multi_select"||_c.test(t.parameter)?!1:(t.options??[]).filter(e=>e.is_tappable).length>=2}function Ge(t,e,n){if(e>0)return!1;let i=t.trim();return i===""||i.toLowerCase()===n.trim().toLowerCase()||lt(i,0,n)}var Hc=4;function Nc(t,e){let n={text:e,kind:null,is_tappable:!0,selectsAll:!0},i=[...new Set(t.filter(r=>r.is_tappable&&r.image_url).map(r=>r.image_url))].slice(0,Hc);if(i.length>0)return n.image_url=i[0],i.length>1&&(n.imageCollage=i),[n,...t];let o;for(let r of t)r.is_tappable&&(o=r);return o?.icon&&(n.icon=o.icon),o?.icon_svg&&(n.icon_svg=o.icon_svg),[n,...t]}function Fc(t,e){let{composing:n}=t,i=n?.over===t.text?n.text:t.text,o=i.slice(Pe(i,t.completedParams));return e?.completes_word!==!0?o:o.match(/\S+(?=\s*$)/)?.[0]??""}function Os(t,e){let n=Kt(t.text,t.completedParams,t.identifiedParams),i=t.suggestions.filter(k=>k.parameter!=="placeholder"),o=i[0],r=e.startingState===!1,s=r?"":t.suggestions.filter(k=>k.parameter==="placeholder").map(k=>k.text).join(" "),a=_e(s,e.prependPlaceholder),l=fe(t.text,Math.min(t.filterBase,t.text.length),a),u=l===0&&lt(t.text,t.completedParams.length,a)?"":ct(t.text,l,t.filterInProgress),d=o?.options??[],f=t.editingParam!=null&&t.editingAnchor!=null,p=!t.editingIdentified&&(f?t.editingParam?.group!=null:o?.type?.kind==="multi_select"),m,g,b,T;if(f&&t.editingParam&&t.editingAnchor!=null){let k=t.editingParam.id,q=t.completedParams.some(pe=>pe.id===k),ot=t.caretOffset??t.editingAnchor,ee=q?"":t.text.slice(t.editingAnchor,ot);g=ee.trim(),b=t.editingParam.options,T=t.editingParam.suggestionParameter,m=t.editingParam.suggestionValueType?.kind==="traditional_autocomplete"?ge(t.editingParam.options,ee).map(pe=>({...pe,matchedText:g,parameterLabel:ni(pe)})):ge(t.editingParam.options,ee)}else g=u.trim(),b=d,T=o?.parameter,m=A(o)?d.map(k=>({...k,matchedText:Fc(t,o),parameterLabel:ni(k)})):ge(d,u,t.traditionalAutocomplete);let S=t.optionSearch,E=S!=null&&T!=null&&S.parameter===T;E&&S.status==="done"&&S.query===g&&(m=b);let y=E&&S.status==="loading",h=e.showNonTappableOptions===!1;h&&(m=m.filter(k=>k.is_tappable));let x=Ge(t.text,t.completedParams.length,a);e.allOption===!0&&o?.leadsWithAll===!0&&!x&&!f&&!t.editingIdentified&&u.trim()===""&&Dc(o)&&(m=Nc(m,_(e.language).allOption));let P=ji(t,g),v=f?t.editingParam?.suggestionValueType?.kind==="traditional_autocomplete":A(o);!p&&!v&&(m=Fr(m,P));let L=t.editingIdentified,O=f?t.editingParam&&{type:t.editingParam.suggestionValueType,options:t.editingParam.options}:o,I=L?L.format:te(O),K=f?t.editingParam?.suggestionParameter:o?.parameter,M=I==="location"&&K&&e.optionOverrides?.[K]?"options":I,z=f&&M==="date-range"?qe(t.editingParam):null,Z=!f&&!L&&M==="date"?Mc(o?.parameter,t.identifiedParams):null,ue=null,C=null,de=H(M)?Rc(t):[];if(H(M)){let k=V(new Date),q=de.find(Il=>Il>=k)??null,ot=B({...t,actionableSuggestions:i}),ee=t.dateViewMonth;ue=ee&&ee.key===ot?{year:ee.year,month:ee.month}:L?bn(L.iso):z?bn(z.start):Z?bn(Z):q&&!f?bn(q):kc(t.editingParam?.text),m=xi(ue);let pe=t.pendingRangeStart;M==="date-range"&&pe&&pe.key===ot&&(C=pe.iso)}let ve=null;if(M==="time"){let k=B({...t,actionableSuggestions:i}),q=t.timeDraft;ve=q&&q.key===k?{minutes:q.minutes,touched:!0}:{minutes:gs({editingText:f?t.editingParam?.text:null,options:f?t.editingParam?.options:o?.options}),touched:!1},m=[]}let xe=null;if(M==="location"){let k=B({...t,actionableSuggestions:i}),q=t.locationSearch;if(q&&q.key===k){let{key:ot,...ee}=q;xe=ee}else xe={query:f?t.editingParam?.text??"":"",places:[],status:t.locationAutocomplete&&e.locationSearch!==!1?"idle":"unavailable",highlighted:-1};m=[]}let kt=k=>h?k.is_tappable:!0,w;if(f){let k=t.editingParam?.options??[];w=t.editingParam!=null&&k.filter(kt).length===0}else w=o!=null&&d.filter(kt).length===0;ve&&(w=!0),xe&&(w=!0);let Ee=t.composing?.over===t.text?t.composing.text:t.text,ke=r&&Ge(Ee,t.completedParams.length,a),Mt=Is({inEditMode:f||L!=null,filteredOptionsLength:m.length,isFocused:t.isFocused||t.locationFieldFocused,dropdownHeld:t.dropdownHeld,text:t.text,caretOffset:t.caretOffset,isLoading:t.isLoading||y,pillTapped:t.pillTapped,activePillHasNoOptions:w,hasProducts:t.products.length>0},{dropdownTrigger:e.dropdownTrigger,closeDropdownOnBlur:e.closeDropdownOnBlur})&&!ke,Rt=Mt&&t.activeDropdownIndex>=0&&!!m[t.activeDropdownIndex]?.is_tappable,nt=!ke&&t.skeletonOptions!==null&&t.skeletonRequested&&!t.isLoading&&!t.editingParam&&!t.inSelectionAnimation,_t=!ke&&(t.isLoading&&!t.editingParam&&!t.inSelectionAnimation||y||nt),me=_t&&t.skeletonOptions!==null,D=me&&t.skeletonOptions?t.skeletonOptions:m,it=me?t.skeletonSuggestion:null,Me=p?{picked:t.multiSelectDraft?.key===B({...t,actionableSuggestions:i})?t.multiSelectDraft.picked:[]}:null,Al=Me??(me&&t.skeletonSuggestion?.type?.kind==="multi_select"?{picked:t.skeletonPicked??[]}:null);return{segments:n,actionableSuggestions:i,filteredOptions:m,dropdownLoading:_t,dropdownOptions:D,dropdownSuggestion:it,skeletonExiting:nt,activeFormatType:M,dateView:ue,dateRangeStart:C,dateFloor:Z,dateReferences:de,timeView:ve,multiSelectView:Me,dropdownMultiSelect:Al,locationView:xe,placeholderText:s,leadInText:a,optionQuery:g,isSearchingOptions:y,isDropdownOpen:Mt,isActivePillSelected:Rt,blockingChips:Qi(n,t.customFields)}}function yn(t){return t.mode!=="edit"?Bc(t):Vc(t)}function Wc(t,e,n){let i=t.find(A);if(!i?.options)return null;let o=e.slice(Pe(e,n)).trim().toLowerCase();if(!o)return null;let r=i.completes_word===!0?o.split(/\s+/).pop()??"":o,s=i.options.filter(c=>c.is_tappable&&c.text.trim().toLowerCase()===r);if(new Set(s.map(c=>ne(c,i.parameter))).size!==1)return null;let l=s[0];return{suggestion:i,option:l,matchText:l.text.trim()}}function ks(t){let{text:e,suggestions:n,filterBase:i,filterInProgress:o,phraseExactMatch:r}=t,s=n.find(u=>u.parameter!=="placeholder"&&!A(u));if(!s?.options||s.type?.kind==="multi_select")return null;let a=n.filter(u=>u.parameter==="placeholder").map(u=>u.text).join(" "),l=fe(e,i,_e(a,t.prependPlaceholder)),c=ut(s.options,e,l,o,r===!0);return c?{suggestion:s,option:c,matchText:c.text}:null}function Bc(t){let{text:e,completedParams:n,suggestions:i}=t,o=t.mode==="submit"?(t.finishWord?ks(t):null)??Wc(i,e,n):ks(t);if(!o)return null;let{suggestion:r,option:s,matchText:a}=o,l=a.toLowerCase(),c=e.toLowerCase().lastIndexOf(l),u=c>=0?c:Math.max(0,e.length-s.text.length),d=u+a.length,f=e.slice(u,d),m=d<e.length&&e[d]===" "?d+1:d,g={id:crypto.randomUUID(),placeholder:"",parameter:ne(s,r.parameter),text:f,value:s.value,kind:s.kind,suggestionParameter:r.parameter,suggestionValueType:r.type,suggestionPlaceholder:r.text,suggestionIcon:r.icon,suggestionIconSvg:r.icon_svg,...t.mode==="submit"&&A(r)?dt(ne(s,r.parameter),r.text,s.parameter_label):{},options:r.options??[],metadata:s.metadata,icon:s.icon,icon_svg:s.icon_svg,image_url:s.image_url};return{patch:{text:e,completedParams:[...n,g],suggestions:i.filter(b=>b!==r),filterBase:m,newParamId:g.id,caretOffset:m,activeDropdownIndex:-1},caretPos:m,option:s,suggestion:r}}function Vc(t){let{text:e,completedParams:n,editingParam:i,editingAnchor:o,editingTail:r}=t;if(n.some(E=>E.id===i.id))return null;let s=e.slice(o,r),a=$t(i.options,s);if(!a)return null;let l=a.text.toLowerCase(),c=s.toLowerCase().lastIndexOf(l),u=o+Math.max(0,c),d=u+a.text.length,f=e.slice(u,d),p=d<e.length&&e[d]===" "?d+1:d,m=e.length,g={id:crypto.randomUUID(),placeholder:"",...qt(i,a),text:f,value:a.value,kind:a.kind,options:i.options,metadata:a.metadata,icon:a.icon,icon_svg:a.icon_svg,image_url:a.image_url},b=n.length,T=0;for(let E=0;E<n.length;E++){let y=oe(e,n[E].text,T);if(y!==-1){if(y>=p){b=E;break}T=y+n[E].text.length}}let S=[...n];return S.splice(b,0,g),{patch:{text:e,completedParams:S,newParamId:g.id,filterBase:m,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:m,activeDropdownIndex:-1},caretPos:m,option:a}}function Rs(t){return t.slice(t.search(/\S*$/))}function _s(t){return t.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase()}function Ji(t,e){let n="",i=0;for(let o of t){let r=i;if(n+=_s(o),i+=o.length,n.length>=e.length){if(!n.startsWith(e))return null;let s=i+(t.slice(i).match(/^\p{M}*/u)?.[0].length??0),a=n.length>e.length;return{length:s,partialStart:a?r:s}}if(!e.startsWith(n))return null}return null}function Ds(t,e,n,i){let o=[];return e<i&&o.push({text:t.slice(e,i),bold:!0}),i<n&&o.push({text:t.slice(i,n),bold:!0,partial:!0}),o}function Xi(t){return[...t].map(_s).join("")}function Sn(t,e){if(/\s$/.test(e))return null;let n=e.split(/\s+/).filter(Boolean).map(Xi),i=[...t.matchAll(/\S+/g)].map(o=>({index:o.index??0,text:o[0],folded:Xi(o[0])}));for(let o=n.length;o>=1;o--){let r=n.slice(n.length-o),s=r[o-1];for(let a=0;a+o<=i.length;a++){if(!r.slice(0,-1).every((d,f)=>i[a+f].folded===d))continue;let c=i[a+o-1],u=Ji(c.text,s);if(u)return{typedWords:o,start:i[a].index,end:c.index+u.length,partialStart:c.index+u.partialStart}}}return null}function Ms(t,e,n,i){return[{text:t.slice(0,e),bold:!1},...Ds(t,e,n,i),{text:t.slice(n),bold:!1}].filter(o=>o.text!=="")}function Uc(t,e){let n=0;for(let i of t){if(!/^\p{M}/u.test(i)){let o=Ji(t.slice(n),e);if(o)return{start:n,end:n+o.length,partialStart:n+o.partialStart}}n+=i.length}return null}var $c=/\p{Script=Hangul}/u;function Zi(t,e){let n=e?Sn(t,e):null;if(n&&n.typedWords>1)return Ms(t,n.start,n.end,n.partialStart);let i=e?Rs(e):"",o=Xi(i);if(!o)return[{text:t,bold:!1}];let r=[],s=!1;for(let l of t.split(/(\s+)/)){if(l==="")continue;let c=/^\s/.test(l)?null:Ji(l,o);if(c){s=!0;let{length:d,partialStart:f}=c;r.push(...Ds(l,0,d,f))}let u=c?l.slice(c.length):l;u&&r.push({text:u,bold:!1})}if(s||!$c.test(i))return r;let a=Uc(t,o);return a?Ms(t,a.start,a.end,a.partialStart):r}var qc=6e4;function Gc(t){return typeof TextEncoder>"u"?t.length*3:new TextEncoder().encode(t).length}async function Kc(t){return rt(t)?`Bearer ${await Bt(t).getToken()}`:Ut(t)}async function Hs(t){let e=yr(t.apiConfig);if(e)try{let n=Vt(t.apiConfig),i=await Kc(t.apiConfig);i&&(n.Authorization=i);let o=JSON.stringify({source:t.source,session_id:t.sessionId,...t.visitorId&&{visitor_id:t.visitorId},...t.searchId&&{search_id:t.searchId},...t.requestId&&{request_id:t.requestId},type:t.type,...t.language&&{language:t.language},at:new Date().toISOString(),query_data:t.queryData});await fetch(e,{method:"POST",headers:n,body:o,...t.keepalive&&Gc(o)<=qc&&{keepalive:!0}})}catch{}}function ae(t,e){let n=t.findIndex(i=>i.text===e);return n>=0?n+1:null}var eo=t=>t.toLowerCase().split(/\s+/).filter(Boolean);function zc(t,e,n){let i=eo(t??"");if(i.length===0)return"";let r=eo(e).slice(-i.length),s=eo(n).slice(0,i.length);return r.join(" ")===i.join(" ")||s.join(" ")===i.join(" ")?"":(t??"").trim().split(/\s+/).join(" ")}function Ns(t,e){let n=t.actionableSuggestions[0];if(!n)return null;let i=A(n),o=e.parameter;if(i&&!o)return null;let r=i&&o?o:ne(e,n.parameter),s=i?t.text.length:t.filterBase,a=t.text.slice(0,s),l=a.length===0&&t.text.length===0,c=a.length===0&&t.text.length>0&&t.placeholderText.length>0&&t.placeholderText.toLowerCase().startsWith(t.text.toLowerCase());(l||c)&&t.placeholderText&&(a=`${t.placeholderText} `);let u=Math.min(Pe(t.text,t.completedParams),a.length),d=!1;if(i&&n.completes_word!==!0){let v=[...a.slice(u).matchAll(/\S+/g)],L=Sn(e.text,a.slice(u)),O=v[v.length-(L?.typedWords??1)];a=a.slice(0,O?u+(O.index??0):Math.max(a.lastIndexOf(" ")+1,u))}else if(n.completes_word===!0){let v=[...a.slice(u).matchAll(/\S+/g)],L=v[v.length-1];a=a.slice(0,L?u+(L.index??0):Math.max(a.lastIndexOf(" ")+1,u))}else if(n.completes_word!==!1){let v=a.slice(u),L=Math.max(Hr(v,e.text),Ar(v,e));L>0&&(a=a.slice(0,a.length-L)),d=L>0}let f=a.length>0&&a[a.length-1]!==" ",p=i||n.completes_word===!0||d,m=t.activeFormatType!==void 0&&!F(t.activeFormatType)&&F(te({type:n.type})),g=p||m?"":zc(n.lead_in,a,e.text),b=`${a}${f?" ":""}${g?`${g} `:""}${e.text} `,S=(l||c||i&&a.length===0)&&b.length>0?b[0].toUpperCase()+b.slice(1):b,E=S.toLowerCase().lastIndexOf(e.text.toLowerCase()),y=E>=0?S.slice(E,E+e.text.length):e.text,h=i?dt(r,n.text,e.parameter_label):{parameter:r,suggestionParameter:n.parameter,suggestionValueType:n.type,suggestionPlaceholder:n.text,suggestionIcon:n.icon,suggestionIconSvg:n.icon_svg},x={id:crypto.randomUUID(),placeholder:"",...h,text:y,value:e.value,kind:e.kind,options:n.options??[],metadata:e.metadata,icon:e.icon,icon_svg:e.icon_svg,image_url:e.image_url},P=t.actionableSuggestions.length-1;return{patch:{text:S,filterBase:S.length,completedParams:[...t.completedParams,x],newParamId:x.id,caretOffset:S.length,pillTapped:!1,activeDropdownIndex:-1,skipNextFetch:!0,inSelectionAnimation:!0,pendingSpan:null},telemetry:{selectedOption:e.text,otherOptions:t.filteredOptions.filter(v=>v.text!==e.text).map(v=>v.text),key:i?r:n.parameter,position:ae(n.options??[],e.text)},consumedSuggestion:n,remainingActionable:P}}function Ke(t,e){let n=F(t.activeFormatType)||t.filteredOptions.length===0?null:t.filteredOptions,i=t.editingParam,o=i?mt(i):t.actionableSuggestions[0]??null;return{skeletonOptions:n,skeletonSuggestion:n?o:null,skeletonPicked:n?e??null:null,skeletonRequested:!1}}function Tn(t,e,n){let i=t.slice(0,e),o=t.slice(n),r=(i===""||i.endsWith(" "))&&o.startsWith(" ");return r&&(o=o.slice(1)),{text:i+o,removed:n-e+(r?1:0)}}var vn=class{constructor(e){this.deps=e}start(e){let n=this.deps.store.get(),i=n.completedParams.find(c=>c.id===e);if(!i)return null;let o=i.group?n.completedParams.filter(c=>c.group===i.group):[i],r=o[0];if(n.editingParam?.id===r.id)return r.id;let s=0,a=-1,l=-1;for(let c of n.completedParams){let u=oe(n.text,c.text,s);if(u!==-1&&(s=u+c.text.length,!!o.includes(c)&&(a<0&&(a=u),l=s,c===o[o.length-1])))break}return a<0?null:(this.deps.store.set({editingParam:r,editingAnchor:a,editingTail:l,caretOffset:l,activeDropdownIndex:-1,...i.group?{multiSelectDraft:{key:B({...n,editingParam:r,editingAnchor:a,editingIdentified:null}),picked:o.map(c=>r.options.find(u=>u.text.toLowerCase()===c.text.toLowerCase())?.text??c.text)}}:{},editingIdentified:null}),r.id)}exit(){this.deps.store.get().editingParam&&this.deps.store.set({editingParam:null,editingAnchor:null,editingTail:null,activeDropdownIndex:-1})}replaceRange(e){let n=this.deps.store.get(),i=n.editingParam,o=n.editingAnchor,r=n.editingTail;if(!i||o==null||r==null||!n.completedParams.some(l=>l.id===i.id))return!1;let{text:s}=e===""?Tn(n.text,o,r):{text:n.text.slice(0,o)+e+n.text.slice(r)},a=o+e.length;return this.deps.store.set(l=>({text:s,completedParams:l.completedParams.filter(c=>c.id!==i.id&&(!i.group||c.group!==i.group)),...i.group&&l.multiSelectDraft?{multiSelectDraft:{...l.multiSelectDraft,picked:[]}}:{},editingTail:a,caretOffset:a,activeDropdownIndex:-1})),this.deps.scheduleSetCursor(a),this.promoteIfExact(),!0}caretAfterInput(e){let n=this.deps.store.get(),i={caretOffset:e};n.editingParam&&n.editingAnchor!=null&&e!=null&&(e<n.editingAnchor?(i.editingParam=null,i.editingAnchor=null,i.editingTail=null,i.activeDropdownIndex=-1):n.editingTail!=null&&(i.editingTail=Math.max(n.editingTail,e))),this.deps.store.set(i),this.promoteIfExact()}caretMove(e){let n=this.deps.store.get();if(n.editingParam&&n.editingAnchor!=null&&n.editingTail!=null&&e!=null&&(e<n.editingAnchor||e>n.editingTail)){this.deps.store.set({caretOffset:e,editingParam:null,editingAnchor:null,editingTail:null,activeDropdownIndex:-1});return}this.deps.store.set({caretOffset:e})}selectOption(e){let n=this.deps.store.get(),i=n.editingParam,o=n.editingAnchor,r=n.editingTail;if(!i||o==null||r==null)return;let s=qt(i,e);this.deps.fireTelemetry("option",{raw_query:R(n.text,n.completedParams).rawQuery,selected_option:e.text,other_options:i.options.filter(S=>S.text!==e.text).map(S=>S.text),key:s.suggestionParameter,position:ae(i.options,e.text),chip_origin:"tap"});let a=n.text.slice(0,o),l=n.text.slice(r),c=o===0&&e.text.length>0?e.text[0].toUpperCase()+e.text.slice(1):e.text,d=l.length===0||l[0]!==" "?`${c} `:c,f=a+d+l,p=f.length,m={id:crypto.randomUUID(),placeholder:"",...s,text:c,value:e.value,kind:e.kind,options:i.options,metadata:e.metadata,icon:e.icon,icon_svg:e.icon_svg,image_url:e.image_url},g=n.completedParams.findIndex(S=>S.id===i.id),b=n.completedParams.filter(S=>S.id!==i.id),T=g>=0?Math.min(g,b.length):b.length;b.splice(T,0,m),this.deps.store.set({text:f,completedParams:b,newParamId:m.id,filterBase:p,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:p,activeDropdownIndex:-1,pillTapped:!1,skipNextFetch:!0,inSelectionAnimation:!0,...Ke(n)}),this.deps.startSelectionAnimationTimer(),this.deps.schedulePickCursor(p),this.deps.fetchNow()}selectMultiple(e,n){let i=this.deps.store.get(),o=i.editingParam,r=i.editingAnchor,s=i.editingTail;if(!o||r==null||s==null||e.length===0)return;let a=R(i.text,i.completedParams).rawQuery;for(let y of e)this.deps.fireTelemetry("option",{raw_query:a,selected_option:y.text,other_options:o.options.filter(h=>h.text!==y.text).map(h=>h.text),key:o.suggestionParameter,position:ae(o.options,y.text),chip_origin:"tap"});let l=i.text.slice(0,r),c=i.text.slice(s),u=r===0?n[0].toUpperCase()+n.slice(1):n,d=c.length===0||c[0]!==" ",f=l+u+(d?" ":"")+c,p=f.length,m=crypto.randomUUID(),g=0,b=e.map(y=>{let h=u.toLowerCase().indexOf(y.text.toLowerCase(),g);return g=h+y.text.length,{...o,id:crypto.randomUUID(),group:m,text:u.slice(h,g),value:y.value,kind:y.kind,metadata:y.metadata,icon:y.icon,icon_svg:y.icon_svg,image_url:y.image_url}}),T=y=>y.id===o.id||o.group!=null&&y.group===o.group,S=i.completedParams.findIndex(T),E=i.completedParams.filter(y=>!T(y));E.splice(S>=0?Math.min(S,E.length):E.length,0,...b),this.deps.store.set({text:f,completedParams:E,newParamId:b[0].id,filterBase:p,editingParam:null,editingAnchor:null,editingTail:null,multiSelectDraft:null,caretOffset:p,activeDropdownIndex:-1,pillTapped:!1,skipNextFetch:!0,inSelectionAnimation:!1,...Ke(i,e.map(y=>y.text))}),this.deps.schedulePickCursor(p),this.deps.fetchNow()}promoteIfExact(){let e=this.deps.store.get();if(!e.editingParam||e.editingAnchor==null||e.editingTail==null||e.editingParam.group)return;let n=yn({mode:"edit",text:e.text,completedParams:e.completedParams,editingParam:e.editingParam,editingAnchor:e.editingAnchor,editingTail:e.editingTail});n&&(this.deps.store.set(n.patch),this.deps.scheduleSetCursor(n.caretPos))}};var Qc=33,Yc=70,jc=120,Xc=50,ze="data-aia-placeholder-leaving",Qe=new WeakMap;function xn(t){t.timer!==null&&(clearTimeout(t.timer),t.timer=null)}function Jc(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Ws(t,e,n){e.shown=n,t.dataset.placeholder=e.target.slice(0,n)}function Bs(t,e){if(e.timer=null,!t.isConnected||e.shown>=e.target.length||(Ws(t,e,e.shown+1),e.shown>=e.target.length))return;let n=e.target[e.shown-1],i=n===" "||n==="-"?70:0;e.timer=setTimeout(()=>Bs(t,e),33+i)}function Fs(t,e){Ws(t,e,0),e.timer=setTimeout(()=>Bs(t,e),33)}function Vs(t,e){let n=Qe.get(t);if(e===""){n&&(xn(n),Qe.delete(t)),t.removeAttribute(ze),delete t.dataset.placeholder;return}if(n?.target===e)return;if(Jc(t)){n&&xn(n),t.removeAttribute(ze),Qe.set(t,{target:e,shown:e.length,timer:null}),t.dataset.placeholder=e;return}let i={target:e,shown:0,timer:null},o=n&&n.shown>0?n:null;if(n&&xn(n),Qe.set(t,i),o){t.setAttribute(ze,""),i.timer=setTimeout(()=>{i.timer=null,t.removeAttribute(ze),t.isConnected&&Fs(t,i)},170);return}t.removeAttribute(ze),Fs(t,i)}function Us(t){let e=Qe.get(t);e&&(xn(e),Qe.delete(t))}var Zc={selectedIso:null,selectedRange:null,rangeStart:null};function wt(t){if(!H(t.activeFormatType))return Zc;let e=t.editingIdentified;if(e){let{iso:i,isoEnd:o}=e;return{selectedIso:o?null:i,selectedRange:i&&o?vt(i,o):null,rangeStart:t.dateRangeStart,references:t.dateReferences??[]}}let n=qe(t.editingParam);return{selectedIso:n?null:yt(t.editingParam?.text),selectedRange:n,rangeStart:t.dateRangeStart??t.dateFloor??null,floor:t.dateFloor??null,references:t.dateReferences??[]}}function to(t){let e=t.floor!=null&&t.highlightedIso!=null&&t.highlightedIso<t.floor?null:t.highlightedIso;return t.pendingStart?vt(t.pendingStart,e??t.pendingStart):t.selected}function no(t,e){if(t==null)return{selected:!1,inRange:!1,reference:!1};let{selectedIso:n,range:i}=e,o=t===n||i!=null&&(t===i.start||t===i.end),r=i!=null&&t>i.start&&t<i.end,s=!o&&!r&&(e.references?.includes(t)??!1);return{selected:o,inRange:r,reference:s}}function io(t,e,n){return t==null?!1:t<e||n!=null&&t<n}function oo(t,e){return t==="date"?e??null:null}var $s="https://magicx.ai/intent-1";function ro(t=$s){try{if(typeof window>"u"||!window.location)return t;let e=window.location.hostname;if(!e)return t;let n=new URL(t);return n.searchParams.set("utm_source",e),n.toString()}catch{return t}}function so(t,e,n=_()){return t?{key:"enter",hint:n.proceed}:e?{key:"tab",hint:n.select}:{key:"\u2192",hint:n.skipHint}}function ao(t){let e=s=>{s.ctrlKey||qs(s.target,t,s.deltaX,s.deltaY)||s.preventDefault()},n=0,i=0,o=s=>{let a=s.touches[0];a&&(n=a.clientX,i=a.clientY)},r=s=>{if(s.touches.length!==1)return;let a=s.touches[0],l=n-a.clientX,c=i-a.clientY;n=a.clientX,i=a.clientY,s.cancelable&&!qs(s.target,t,l,c)&&s.preventDefault()};return t.addEventListener("wheel",e,{passive:!1}),t.addEventListener("touchstart",o,{passive:!0}),t.addEventListener("touchmove",r,{passive:!1}),()=>{t.removeEventListener("wheel",e),t.removeEventListener("touchstart",o),t.removeEventListener("touchmove",r)}}function qs(t,e,n,i){let o=t instanceof Element?t:null;for(;o;){if(i!==0&&eu(o,i)||n!==0&&tu(o,n))return!0;if(o===e)break;o=o.parentElement}return!1}var Gs=/^(auto|scroll|overlay)$/;function eu(t,e){return t.scrollHeight<=t.clientHeight||!Gs.test(getComputedStyle(t).overflowY)?!1:e>0?t.scrollTop+t.clientHeight<t.scrollHeight-1:t.scrollTop>0}function tu(t,e){if(t.scrollWidth<=t.clientWidth)return!1;let n=getComputedStyle(t);if(!Gs.test(n.overflowX))return!1;let i=Math.abs(t.scrollLeft),o=t.scrollWidth-t.clientWidth;return(n.direction==="rtl"?e<0:e>0)?i<o-1:i>0}function Ye(t,e,n){n?(t.getAttribute(e)!=="busy"&&t.setAttribute(e,"busy"),t.getAttribute("aria-busy")!=="true"&&t.setAttribute("aria-busy","true")):t.hasAttribute(e)&&(t.removeAttribute(e),t.removeAttribute("aria-busy"))}var Ks=new WeakMap,zs=new WeakSet;function U(t,e,n){if(Ks.set(t,n),zs.has(t))return;zs.add(t);let i=()=>Ks.get(t),o=r=>{if(!(r instanceof Element))return null;let s=r.closest(e.itemSelector);return s&&t.contains(s)?s:null};e.onClick&&t.addEventListener("click",r=>{let s=o(r.target);s&&e.onClick?.(s,i(),r)}),e.onEnter&&t.addEventListener("mouseenter",r=>{let s=r.target;s instanceof HTMLElement&&s.matches(e.itemSelector)&&e.onEnter?.(s,i(),r)},!0),e.onLeave&&t.addEventListener("mouseleave",r=>{let s=r.target;s instanceof HTMLElement&&s.matches(e.itemSelector)&&e.onLeave?.(s,i(),r)},!0),e.preventMousedown&&t.addEventListener("mousedown",r=>r.preventDefault())}function ye(t){return Number.parseInt(t.dataset.aiaIndex??"-1",10)}function G(t){t.offsetWidth}var X="magicx-aia-panel-ghost";function je(t){return t.closest(`.${X}`)!==null}function $(t,e){for(let n of t.querySelectorAll(e))if(!je(n))return n;return null}var lo="--aia-multi-done-fit";function nu(t){return $(t,"[data-aia-multi-done]")}function co(t,e){if(!e?.isConnected)return;let n=e.ownerDocument,i=n.defaultView?.getComputedStyle(e).direction==="rtl";if(typeof n.createRange().getBoundingClientRect!="function")return;let o=e.getBoundingClientRect(),r=0;for(let s of t.querySelectorAll("[data-aia-option]")){if(je(s))continue;let a=n.defaultView?.getComputedStyle(s),l=Number.parseFloat(i?a?.paddingRight??"0":a?.paddingLeft??"0")||0,c=n.createTreeWalker(s,NodeFilter.SHOW_TEXT),u=n.createRange();for(let d=c.nextNode();d;d=c.nextNode()){if(!d.textContent?.trim())continue;u.selectNodeContents(d);let f=u.getBoundingClientRect();if(f.width===0)continue;let p=i?o.right-f.left:f.right-o.left;r=Math.max(r,p+l)}}r>0?e.style.setProperty(lo,`${Math.ceil(r)}px`):e.style.removeProperty(lo)}var iu=40,ou=340,ru=340,su=7,uo="--aia-option-enter-delay";function mo(t,e,n,i="below"){let o=Math.max(1,Math.floor(e)),r=Math.floor(Math.max(0,t)/o);if(i!=="above")return r*40;let s=Math.max(1,Math.ceil(Math.max(0,n)/o));return Math.max(0,s-1-r)*40}function po(t,e){let n=Math.max(1,Math.floor(e));return(Math.max(1,Math.ceil(Math.max(0,t)/n))-1)*40+340}function En(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function wn(t,e,n,i){let o=t.scrollTop,r=n?.requestAnimationFrame,s=t.ownerDocument?.visibilityState==="hidden";if(!r||s||En(t))return t.scrollTop=o+e,i(),()=>{};let a=!1,l=n.performance?.now?.()??Date.now(),c=()=>n.performance?.now?.()??Date.now(),u=()=>{if(a)return;let d=Math.min(1,(c()-l)/240),f=1-(1-d)*(1-d);t.scrollTop=o+e*f,d<1?r.call(n,u):i()};return r.call(n,u),()=>{a=!0}}var Ys="magicx-aia-scroll-arrow",Pn="data-aia-scroll-arrow",Xe="data-aia-visible",js=1e3,Xs=160,Js="--aia-scroll-arrow-bottom",au="Scroll down for more options",fo="data-aia-scrollable",lu="--aia-scroll-track-top",cu="--aia-scroll-track-height",uu="--aia-scroll-track-right",du="--aia-scroll-thumb-top",mu="--aia-scroll-thumb-height",pu=12,fu=.5,gu="[data-aia-products-label]",hu="--aia-option-peek",bu=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;function yu(t){let e=t?.trim()??"";if(!bu.test(e))return 0;let n=Number(e);return Number.isFinite(n)&&n>0?n:0}function Su(t){let e=t.ownerDocument.createElement("div");e.style.cssText="position:absolute;visibility:hidden;pointer-events:none;padding:0;border:0;height:var(--aia-option-row-height, 37px);",t.appendChild(e);let n=e.offsetHeight;if(e.remove(),Number.isFinite(n)&&n>0)return n;let i=t.querySelector("[data-aia-option]")?.offsetHeight??0;return Number.isFinite(i)&&i>0?i:0}var Qs=4,Tu=8;function vu(t=document){let e="http://www.w3.org/2000/svg",n=t.createElementNS(e,"svg");n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("width","18"),n.setAttribute("height","18"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.75"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false");let i=t.createElementNS(e,"path");return i.setAttribute("d","M4 6.5 8 10.5l4-4"),n.appendChild(i),n}function Zs(t=document,e=_()){let n=t.createElement("button");return n.type="button",n.tabIndex=-1,n.className=Ys,n.setAttribute(Pn,""),n.setAttribute("aria-label",e.scrollArrow),n.setAttribute("aria-hidden","true"),n.disabled=!0,n.appendChild(vu(t)),n}function xu(t){return Math.max(1,ho(t.style.gridTemplateColumns))}function go({dropdown:t,grid:e,button:n}){let i=e.ownerDocument?.defaultView??(typeof window<"u"?window:null),o=!1;n.disabled=!0;let r=null,s=null,a=null,l=null,c=x=>{if(x){if(n.hasAttribute(Xe))return;if(n.setAttribute(Xe,""),n.setAttribute("aria-hidden","false"),l!==null&&clearTimeout(l),En(e)){n.disabled=!1;return}l=setTimeout(()=>{l=null,!o&&n.hasAttribute(Xe)&&(n.disabled=!1)},js)}else n.removeAttribute(Xe),n.setAttribute("aria-hidden","true"),l!==null&&clearTimeout(l),l=null,n.disabled=!0},u=x=>{let P=0,v=x;for(;v&&v!==t;)P+=v.offsetTop,v=v.offsetParent instanceof HTMLElement?v.offsetParent:null;return P},d=()=>{let x=$(t,gu),P;if(x){let v=u(x)+x.offsetHeight/2;P=t.clientHeight-v-n.offsetHeight/2}else{let v=u(e),L=i&&Number.parseFloat(i.getComputedStyle(e).paddingBottom)||0;P=t.clientHeight-(v+e.offsetHeight)+(L>0?0:Tu)}n.style.setProperty(Js,`${Math.max(0,Math.round(P))}px`)},f=x=>{let P=0,v=x;for(;v&&v!==t;)P+=v.offsetLeft,v=v.offsetParent instanceof HTMLElement?v.offsetParent:null;return P},p=null,m=(x,P)=>{let v=Math.min(1,Math.max(0,e.scrollTop/x));n.style.setProperty(du,`${Math.round(P*v)}px`)},g=()=>{let x=e.scrollHeight-e.clientHeight,P=e.querySelector("[data-aia-option][data-aia-loading]")!==null;if(x<=Qs||P){p=null,n.removeAttribute(fo);return}let v=e.clientHeight,L=Math.round(v*fu),O=u(e)+(v-L)/2,I=t.clientWidth-(f(e)+e.offsetWidth),K=Math.min(L,Math.max(pu,Math.round(L*v/e.scrollHeight)));p={overflow:x,travel:L-K},n.style.setProperty(lu,`${Math.round(O)}px`),n.style.setProperty(cu,`${L}px`),n.style.setProperty(uu,`${Math.max(0,Math.round(I))}px`),n.style.setProperty(mu,`${K}px`),m(x,p.travel),n.setAttribute(fo,"")},b=()=>{if(o||s!==null||a!==null)return;let x=e.querySelector("[data-aia-option][data-aia-loading]")!==null,P=e.scrollHeight-e.clientHeight-e.scrollTop;c(!x&&P>Qs)},T=()=>{if(o)return;d(),g();let x=e.getAttribute("data-aia-group")??"";if(x!==r){r=x,c(!1),s!==null&&clearTimeout(s);let P=e.querySelectorAll("[data-aia-option]").length,v=En(e)?0:po(P,xu(e));s=setTimeout(()=>{s=null,b()},v);return}b()},S=()=>{o||(p&&m(p.overflow,p.travel),s===null&&(c(!1),a!==null&&clearTimeout(a),a=setTimeout(()=>{a=null,b()},Xs)))};e.addEventListener("scroll",S,{passive:!0});let E=x=>x.preventDefault(),y=()=>{let x=i?i.getComputedStyle(e):null,P=x?(Number.parseFloat(x.paddingTop)||0)+(Number.parseFloat(x.paddingBottom)||0):0,v=yu(x?.getPropertyValue(hu)),L=v>0?Su(e):0,O=Math.max(1,e.clientHeight-P-v*L);wn(e,O,i,S)};n.addEventListener("mousedown",E),n.addEventListener("click",y);let h=null;return i&&typeof i.ResizeObserver=="function"&&(h=new i.ResizeObserver(()=>{d(),g(),b()}),h.observe(e),h.observe(t)),T(),{update:T,destroy(){o||(o=!0,s!==null&&clearTimeout(s),s=null,a!==null&&clearTimeout(a),a=null,l!==null&&clearTimeout(l),l=null,n.disabled=!0,e.removeEventListener("scroll",S),n.removeEventListener("mousedown",E),n.removeEventListener("click",y),h?.disconnect(),n.removeAttribute(Xe),n.removeAttribute(fo),n.setAttribute("aria-hidden","true"))}}}var na="cubic-bezier(0.25, 0.1, 0.25, 1)",Eu="cubic-bezier(0.32, 0.72, 0, 1)",ia=360,oa=280,ra=320,sa=40,aa="blur(2px)",wu=160,Pu=.05,la=/pressed/i;function ca(){return typeof performance<"u"?performance.now():Date.now()}function Lu(t){for(let e of t.querySelectorAll("[data-aia-loading]"))if(!e.closest(`.${X}`))return!0;return!1}function Cu(t){return t===null?1:1-Math.min(1,Math.max(0,(ca()-t)/wu))**1.7}function To(t){return t.hasAttribute(Pn)}function yo(t){let e=0;for(let n of Array.from(t.children))n.classList.contains(X)||To(n)||(e+=n.offsetHeight||0);return e}var J=new WeakMap;function Au(t){return(Number.parseFloat(t.borderLeftWidth)||0)+(Number.parseFloat(t.borderRightWidth)||0)}function Iu(t){let e=(t.ownerDocument.defaultView??window).getComputedStyle(t);return(Number.parseFloat(e.paddingLeft)||0)+(Number.parseFloat(e.paddingRight)||0)+(Number.parseFloat(e.borderLeftWidth)||0)+(Number.parseFloat(e.borderRightWidth)||0)}var bo=new WeakMap;function Ou(t,e){return!e||typeof t.animate!="function"||t.closest('[data-animations="off"]')||t.closest('[data-aia-options-style="classic"]')?!1:!(t.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)")??null)?.matches}function ku(t,e){let n=0,i="";for(let o of Array.from(t.children))o.classList.contains(X)||(n+=1+o.getElementsByTagName("*").length,i+=`${o.textContent??""}\0`);return`${e??""}${n}${i}`}function So(t){return Array.from(t.classList).some(e=>la.test(e))}function ea(t){return Array.from(t.querySelectorAll("*")).some(e=>So(e)&&!e.closest(`.${X}`))}function Mu(t,e){let n=Array.from(t.querySelectorAll("*")).filter(r=>So(r)&&!r.closest(`.${X}`));if(n.length===0)return;let i=Array.from(e.querySelectorAll("*")).filter(So),o=t.ownerDocument.defaultView;i.forEach((r,s)=>{let a=n[s];if(a&&o){let l=o.getComputedStyle(a);r.style.backgroundColor=l.backgroundColor,r.style.color=l.color,r.style.fontWeight=l.fontWeight,r.setAttribute(Ln,"")}for(let l of Array.from(r.parentElement?.children??[]))l!==r&&l instanceof HTMLElement&&(l.style.opacity="0.35",l.setAttribute(Ln,""))})}var Ln="data-aia-press-baked";function vo(t){let e=t?J.get(t)?.snapshot:null;if(e)for(let n of Array.from(e.querySelectorAll(`[${Ln}]`)))n.style.opacity="",n.style.backgroundColor="",n.style.color="",n.style.fontWeight="",n.removeAttribute(Ln)}function ta(t){let e=t.ownerDocument.createElement("div");e.className=X,e.setAttribute("aria-hidden","true"),e.inert=!0;for(let n of Array.from(t.children))n.classList.contains(X)||To(n)||e.appendChild(n.cloneNode(!0));Mu(t,e);for(let n of[e,...Array.from(e.querySelectorAll("*"))]){n.removeAttribute("id"),n.removeAttribute("role"),n.removeAttribute("tabindex");for(let i of Array.from(n.classList))la.test(i)&&n.classList.remove(i);n.tagName==="A"&&n.removeAttribute("href"),n.tagName==="BUTTON"&&(n.disabled=!0);for(let i of Array.from(n.attributes))i.name.startsWith("aria-")&&i.name!=="aria-hidden"&&n.removeAttribute(i.name)}return e}function Ru(t,e,n,i,o){for(let s of Array.from(t.children))s.classList.contains(X)&&s.remove();let r=Array.from(t.children).filter(s=>!To(s));i>Pu&&Du(t,e,n,i,o);for(let s of r)_u(s),s.animate([{opacity:0,filter:aa},{opacity:1,filter:"blur(0px)"}],{duration:ra,delay:sa,easing:na,fill:"backwards"})}function _u(t){for(let e of t.querySelectorAll("[data-aia-pill]"))if(!(e.hasAttribute("data-aia-loading")||typeof e.getAnimations!="function"))for(let n of e.getAnimations())n.cancel()}function Du(t,e,n,i,o){let r=(t.ownerDocument.defaultView??window).getComputedStyle(t);e.style.cssText=["position:absolute","left:0",o>0?`width:${o-Au(r)}px`:"right:0",n?"bottom:0":"top:0",`padding:${r.padding}`,"pointer-events:none","box-sizing:border-box"].join(";"),t.appendChild(e),e.animate([{opacity:i,filter:"blur(0px)"},{opacity:0,filter:aa}],{duration:oa*i,easing:na,fill:"forwards"}).finished.then(()=>e.remove(),()=>e.remove())}function xo(t){let e=t[0]?.text;return e==null||e===""?null:e}function Cn(t,e,n){let i=n.visible,o=Ou(t,n.enabled??!0),r=J.get(t);if(!i||!o){o||r?.glide?.cancel(),J.set(t,{height:0,width:0,key:i?e:null,signature:"",snapshot:null,glide:o?r?.glide??null:null,loadingSince:null,contentHeight:0});return}let s=ku(t,e),a=Lu(t)?r?.loadingSince??ca():null;if(r&&r.height>0&&r.glide&&r.signature===s){r.loadingSince=a,r.snapshot&&ea(t)&&(r.snapshot=ta(t));return}let l=Se(t),c=t.getBoundingClientRect(),u=c.height;r?.glide?.cancel();let d=t.getBoundingClientRect(),f=d.height,p=d.width||0,m=null,g=r?l?u:r.height:0,b=r?l?c.width||0:r.width:0;r&&g>0&&(e!==r.key&&r.snapshot&&Ru(t,r.snapshot,n.anchorBottom??!1,Cu(r.loadingSince),b),m=ua(t,{height:g,width:b},{height:f,width:p}));let T=null;e!==null&&(T=r&&r.signature===s&&r.snapshot&&!r.snapshot.isConnected&&!ea(t)?r.snapshot:ta(t)),J.set(t,{height:f,width:p,key:e,signature:s,snapshot:T,glide:m,loadingSince:a,contentHeight:m?yo(t):0})}function ua(t,e,n){let i=e.width>0&&n.width>0&&Math.abs(e.width-n.width)>1;if(Math.abs(e.height-n.height)<=1&&!i)return null;let o=i?[{height:`${e.height}px`,width:`${e.width}px`},{height:`${n.height}px`,width:`${n.width}px`}]:[{height:`${e.height}px`},{height:`${n.height}px`}],r=t.animate(o,{duration:ia,easing:Eu});i&&(t.setAttribute(Gi,String(n.width)),t.style.setProperty(Ki,`${n.width-Iu(t)}px`),bo.set(t,r));let s=()=>{bo.get(t)===r&&(bo.delete(t),t.removeAttribute(Gi),t.style.removeProperty(Ki))};return r.finished.then(()=>{s();let a=J.get(t);if(a?.glide!==r||(a.glide=null,a.height<=0))return;let l=t.getBoundingClientRect();l.height>0&&(a.height=l.height),l.width>0&&(a.width=l.width)},s),r}function Se(t){let e=J.get(t)?.glide??null;return e&&(e.playState==="running"||e.pending)?e:null}function Eo(t){if(!Se(t))return null;let e=J.get(t)?.height??0;return e>0?e:null}function wo(t,e){let n=J.get(t);n&&n.height>0&&!Se(t)&&e>0&&(n.height=e)}function da(t,{widthChanged:e}){let n=J.get(t);if(!n||n.height<=0)return;let i=Se(t);if(!i||!e&&(t.hasAttribute("data-aia-fit")||Math.abs(yo(t)-n.contentHeight)<=1))return;let o=t.getBoundingClientRect();i.cancel();let r=t.getBoundingClientRect();n.width=r.width||0,n.height=r.height,n.glide=ua(t,{height:o.height,width:o.width||0},{height:r.height,width:n.width}),n.contentHeight=n.glide?yo(t):0}function Po(t){J.get(t)?.glide?.cancel(),J.delete(t)}var Lo="data-aia-hug",Je="--aia-panel-fit-width",Co="data-aia-full-width",Hu=36;function Pt(t){t.removeAttribute(Lo)}function Ao(t,e,{eligible:n,loading:i}){let o=t.style.getPropertyValue(Je);Nu(t,e,n,i),da(t,{widthChanged:t.style.getPropertyValue(Je)!==o})}function Nu(t,e,n,i){if(!n){t.style.removeProperty(Je),Pt(t);return}if(i){t.style.getPropertyValue(Je)&&t.setAttribute(Lo,"");return}let o=Fu(t,e);if(o==null){t.style.removeProperty(Je);return}t.style.setProperty(Je,`${o}px`),t.setAttribute(Lo,"")}var ma=new WeakMap;function Fu(t,e){if(Et())return null;let n=$(e,".aia-grid");if(!n||t.offsetWidth===0)return null;let i=$(e,"[data-aia-pillbar]"),o=[n.style.gridTemplateColumns,i?.textContent??"",...Array.from(n.querySelectorAll("[data-aia-option]"),a=>a.textContent)].join("\0"),r=ma.get(t);if(r?.key===o)return r.width;let s=Wu(t,e,n);return ma.set(t,{key:o,width:s}),s}function Wu(t,e,n){let i=xt(n);if(!i||i.rowWidths.some(a=>a<=0))return null;let o=Math.ceil(Math.max(...i.rowWidths)),r=Math.max(1,ho(n.style.gridTemplateColumns)),s=pa(n,t,r-1)+r*(o+Hu);return Math.ceil(Math.max(s,Bu(e,t)))}function Bu(t,e){let n=$(t,"[data-aia-pillbar]");if(!n)return 0;let i=n.querySelector("[data-aia-pill-scroll]")?.scrollWidth??0,o=n.querySelector("[data-aia-skip]")?.offsetWidth??0;return i+o===0?0:pa(n,e,i>0&&o>0?1:0)+i+o}function ho(t){let e=0,n=0,i=!1;for(let o of t)o==="("?e++:o===")"&&e--,e===0&&/\s/.test(o)?i=!1:i||(i=!0,n++);return n}function pa(t,e,n){let i=0;for(let o=t;o;o=o.parentElement){let r=getComputedStyle(o);if(i+=(Number.parseFloat(r.paddingLeft)||0)+(Number.parseFloat(r.paddingRight)||0)+(Number.parseFloat(r.borderLeftWidth)||0)+(Number.parseFloat(r.borderRightWidth)||0),o===t&&(i+=n*(Number.parseFloat(r.columnGap)||0)),o===e)break}return i}var Vu="[data-aia-products], [data-aia-datepicker], [data-aia-date-grid], [data-aia-time-wheel], [data-aia-location], [data-aia-see-all]";function Uu(t){let e=!t.hasAttribute("data-aia-has-products")&&!t.hasAttribute(Co)&&$(t,".aia-grid [data-aia-option]")!==null&&$(t,Vu)===null,n=$(t,".aia-grid [data-aia-option][data-aia-loading]")!==null;e||Pt(t),Ao(t,t,{eligible:e,loading:n})}var fa="data-aia-key";function ie(t,e,n){let i=new Map;for(let s of Array.from(t.children)){let a=s.getAttribute(fa);a!=null&&i.set(a,s)}let o=new Set,r=[];for(let s=0;s<e.length;s++){let a=e[s],l=n.keyOf(a,s);o.add(l);let c=i.get(l);c||(c=n.create(a,s),c.setAttribute(fa,l)),n.update?.(c,a,s),t.children[s]!==c&&t.insertBefore(c,t.children[s]??null),r.push(c)}for(let[s,a]of i)o.has(s)||a.remove();return r}function ga(t,e){if(!e.interactive)return null;let n=e.options[ye(t)];return n?.is_tappable?n:null}var $u={itemSelector:"[data-aia-date-cell], [data-aia-date-prev], [data-aia-date-next]",onClick:(t,e)=>{if(t.hasAttribute("data-aia-date-prev")){e.callbacks.onPreviousMonth();return}if(t.hasAttribute("data-aia-date-next")){e.callbacks.onNextMonth();return}let n=ga(t,e);n&&(t.classList.add("magicx-aia-date-cell--pressed"),e.callbacks.onSelect(n),setTimeout(()=>t.classList.remove("magicx-aia-date-cell--pressed"),170))},onEnter:(t,e)=>{t.hasAttribute("data-aia-date-cell")&&ga(t,e)&&e.callbacks.onHighlight(ye(t))},onLeave:(t,e)=>{t.hasAttribute("data-aia-date-cell")&&e.callbacks.onHighlight(-1,ye(t))}};function ba(t,e,n,i,o,r,s,a=!0){let l=t.querySelector(".magicx-aia-datepicker");if(!o||e.length===0){l?.remove();return}if(!l){l=Ku(),t.appendChild(l),G(l);for(let d of l.querySelectorAll(".magicx-aia-datepicker-nav"))d.disabled=!1}U(l,$u,{options:e,callbacks:s,interactive:a});let c=l.querySelector(".magicx-aia-datepicker-month");c&&(c.textContent=Si(o));let u=l.querySelector(".magicx-aia-datepicker-grid");u&&qu(u,e,n,i,r)}function qu(t,e,n,i,o){let r=V(new Date),s=to({pendingStart:o.rangeStart,highlightedIso:j(e[n]),selected:o.selectedRange,floor:o.floor});ie(t,e,{keyOf:(a,l)=>j(a)??`pad-${l}`,create:a=>Gu(a),update:(a,l,c)=>{let u=j(l),d=no(u,{selectedIso:o.selectedIso,range:s,references:o.references}),f=c===n&&l.is_tappable;a.id=`${i}-option-${c}`,a.dataset.aiaIndex=String(c),a.setAttribute("aria-selected",String(f)),a.classList.toggle("magicx-aia-date-cell--past",io(u,r,o.floor)),a.classList.toggle("magicx-aia-date-cell--highlighted",f),a.classList.toggle("magicx-aia-date-cell--today",u!=null&&u===r),a.classList.toggle("magicx-aia-date-cell--selected",d.selected),a.classList.toggle("magicx-aia-date-cell--in-range",d.inRange),a.classList.toggle("magicx-aia-date-cell--reference",d.reference)}})}function Gu(t){let e=document.createElement("div");e.setAttribute("role","option"),e.setAttribute("data-aia-option",""),e.setAttribute("data-aia-date-cell","");let n=Ei(t);if(n==null)return e.className="magicx-aia-date-cell magicx-aia-date-cell--blank",e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e;e.className="magicx-aia-date-cell magicx-aia-date-cell--day",e.tabIndex=0,e.setAttribute("aria-label",t.text);let i=document.createElement("span");return i.className="magicx-aia-date-cell-number",i.textContent=String(n),e.appendChild(i),e}function Ku(){let t=document.createElement("div");t.className="magicx-aia-datepicker",t.setAttribute("data-aia-datepicker","");let e=document.createElement("div");e.className="magicx-aia-datepicker-header";let n=document.createElement("span");n.className="magicx-aia-datepicker-month",n.setAttribute("data-aia-date-month",""),n.setAttribute("aria-live","polite"),e.append(ha("prev","Previous month","\u2039"),n,ha("next","Next month","\u203A"));let i=document.createElement("div");i.className="magicx-aia-datepicker-weekdays",i.setAttribute("aria-hidden","true");for(let r of Zt){let s=document.createElement("span");s.className="magicx-aia-datepicker-weekday",s.textContent=r,i.appendChild(s)}let o=document.createElement("div");return o.className="magicx-aia-datepicker-grid",o.setAttribute("data-aia-date-grid",""),t.append(e,i,o),t}function ha(t,e,n){let i=document.createElement("button");return i.type="button",i.tabIndex=-1,i.className="magicx-aia-datepicker-nav",i.setAttribute(`data-aia-date-${t}`,""),i.setAttribute("aria-label",e),i.textContent=n,i.disabled=!0,i}var zu='<svg class="magicx-aia-location-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"/><circle cx="12" cy="9.5" r="2.5"/></svg>',ya="data-aia-location-body";function Qu(t){let e=document.createElement("div");e.className="magicx-aia-location-row",e.setAttribute("data-aia-location-row",""),e.setAttribute("role","option");let n=document.createElement("span");n.className="magicx-aia-location-pin",n.innerHTML=zu;let i=document.createElement("span");i.className="magicx-aia-location-text";let o=document.createElement("span");if(o.className="magicx-aia-location-name",o.textContent=t.name,i.appendChild(o),t.secondary){let r=document.createElement("span");r.className="magicx-aia-location-secondary",r.textContent=t.secondary,i.appendChild(r)}return e.append(n,i),e}function Yu(t,e){if(t==="loading"){let o=document.createElement("div");o.className="magicx-aia-location-loading",o.setAttribute("data-aia-location-loading","");for(let r=0;r<3;r++)o.appendChild(document.createElement("span")).className="magicx-aia-location-loading-bar";return o}if(t==="")return null;let n=document.createElement("div");if(n.className="magicx-aia-location-note",n.setAttribute("data-aia-location-note",""),t==="note-empty"){let o=document.createElement("span");o.className="magicx-aia-location-empty",o.textContent=e.locationNoResults,n.appendChild(o)}let i=document.createElement("span");return i.textContent=e.locationUseTyped,n.appendChild(i),n}function Sa(t,e,n,i){let o=e.places,r="";if(o.length===0&&(e.status==="loading"?r="loading":e.query.trim()&&(r=e.status==="done"?"note-empty":"note")),t.getAttribute(ya)!==r){for(let a of Array.from(t.children))a.hasAttribute("data-aia-location-row")||a.remove();let s=Yu(r,n);s&&t.appendChild(s),t.setAttribute(ya,r)}ie(t,o,{keyOf:(s,a)=>`${a}:${s.id}`,create:s=>Qu(s),update:(s,a,l)=>{let c=l===e.highlighted;s.classList.toggle("magicx-aia-location-row--highlighted",c),s.setAttribute("aria-selected",String(c)),s.setAttribute("data-aia-index",String(l)),s.id=i(l)}})}var le=new WeakMap,ju=0,Ae=new WeakMap,Xu='<svg class="magicx-aia-location-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>',Ie=t=>He(t.input)===t.input;function Ta(t,e){let n=He(t);if(n instanceof HTMLElement&&n!==e.input&&n!==N(t).body&&!t.contains(n)&&(e.returnTo=n,e.returnRange=null,n.isContentEditable)){let i=Ce(n);i&&n.contains(i.startContainer)&&(e.returnRange=i.cloneRange())}}function Ju(t,e,n){if(!(!(n instanceof HTMLElement)||n===e.returnTo||t.contains(n))&&n!==N(t).body&&(e.returnTo=n,e.returnRange=null,n.isContentEditable)){let i=Ce(n);i&&n.contains(i.startContainer)&&(e.returnRange=i.cloneRange())}}function Zu(t,e){if(t.focus({preventScroll:!0}),!t.isContentEditable)return;let n=Le(t);if(!n)return;let i=e;(!i||!i.startContainer.isConnected||!t.contains(i.startContainer))&&(i=N(t).createRange(),i.selectNodeContents(t),i.collapse(!1)),n.removeAllRanges(),n.addRange(i)}var ed={itemSelector:"[data-aia-location-row]",onClick:(t,e)=>{if(!e.interactive)return;let n=t.closest("[data-aia-location]");n&&Ze(n,!0),e.callbacks.onLocationCommit(Number(t.dataset.aiaIndex))}};function Ze(t,e=!1){let n=Ae.get(t),i=le.get(t);if(!n||!i)return;e&&(n.declined=!0);let o=n.returnTo;o?.isConnected&&Ie(n)&&(n.returning=!0,Zu(o,n.returnRange),n.returning=!1),i.callbacks.onLocationFocusChange(!1)}function td(t){let e=Ae.get(t),n=le.get(t);if(!(!e||!n||Ie(e))){if(Ta(t,e),n.callbacks.onLocationFocusChange(!0),e.input.focus({preventScroll:!0}),!Ie(e)){e.declined=!0,n.callbacks.onLocationFocusChange(!1);return}e.input.value&&e.input.select()}}function nd(t,e){t.className="magicx-aia-location",t.setAttribute("data-aia-location",""),t.id=`magicx-aia-location-${++ju}`;let n=document.createElement("label");n.className="magicx-aia-location-field",n.innerHTML=Xu;let i=document.createElement("input");i.type="text",i.className="magicx-aia-location-input",i.setAttribute("data-aia-location-input",""),i.setAttribute("autocomplete","off"),i.setAttribute("autocapitalize","words"),i.setAttribute("enterkeyhint","done"),i.spellcheck=!1,i.placeholder=e.locationSearch,i.setAttribute("aria-label",e.locationSearch),n.appendChild(i);let o=document.createElement("div");o.className="magicx-aia-location-results",o.setAttribute("data-aia-location-results",""),o.setAttribute("aria-live","polite"),t.append(n,o);let r={input:i,field:n,results:o,returnTo:null,returnRange:null,returning:!1,declined:!1,widgetFocused:!1,wasReediting:!1};return t.addEventListener("mousedown",s=>{!(s.target instanceof Node)||!n.contains(s.target)||(s.stopPropagation(),Ta(t,r),le.get(t)?.callbacks.onLocationFocusChange(!0))}),i.addEventListener("input",()=>le.get(t)?.callbacks.onLocationQuery(i.value)),i.addEventListener("focus",s=>{Ju(t,r,s.relatedTarget),le.get(t)?.callbacks.onLocationFocusChange(!0)}),i.addEventListener("blur",()=>{r.returning||(r.declined=!0,le.get(t)?.callbacks.onLocationFocusChange(!1))}),i.addEventListener("keydown",s=>{let a=le.get(t);if(!(!a||s.isComposing))switch(s.key){case"ArrowDown":case"ArrowUp":s.preventDefault(),a.callbacks.onLocationMove(s.key==="ArrowDown"?1:-1);return;case"Enter":if(s.preventDefault(),!a.interactive)return;Ze(t,!0),a.callbacks.onLocationCommit();return;case"Escape":s.preventDefault(),s.stopPropagation(),r.declined=!0,Ze(t);return;case"Backspace":if(i.value!=="")return;s.preventDefault(),r.declined=!0,Ze(t);return}}),Ae.set(t,r),r}function va(t){for(let e of t.querySelectorAll("[data-aia-location]")){let n=Ae.get(e);n&&(Ie(n)&&Ze(e),n.declined=!1,n.input.tabIndex=-1)}}function xa(t,e,n,i,o={}){let r=Array.from(t.children).find(l=>l.hasAttribute("data-aia-location"))??null;if(!e){if(r){let l=Ae.get(r);l&&Ie(l)&&Ze(r),r.remove()}return}r||(r=document.createElement("div"),t.appendChild(r));let s=Ae.get(r)??nd(r,n);s.input.tabIndex=0,le.set(r,{view:e,callbacks:i,interactive:o.interactive??!0}),U(s.results,ed,le.get(r)),s.input.value!==e.query&&!Ie(s)&&(s.input.value=e.query);let a=l=>`${r?.id}-row-${l}`;if(Sa(s.results,e,n,a),e.highlighted>=0&&e.highlighted<e.places.length?s.input.setAttribute("aria-activedescendant",a(e.highlighted)):s.input.removeAttribute("aria-activedescendant"),o.inputFocused){let l=o.reediting??!1;l&&!s.wasReediting&&(s.declined=!1),s.wasReediting=l}if(s.widgetFocused=o.inputFocused??!1,o.inputFocused){if(o.reediting&&!s.declined&&o.interactive!==!1&&!Ie(s)){let l=r;queueMicrotask(()=>{l.isConnected&&!Ae.get(l)?.declined&&td(l)})}}else{let l=s;setTimeout(()=>{if(l.widgetFocused)return;let c=l.returnTo;c&&He(c)===c||(l.declined=!1)},0)}}var id={itemSelector:"[data-aia-pill]",onClick:(t,e)=>{if(e.loading||t.disabled)return;let n=Number.parseInt(t.dataset.aiaPillIndex??"-1",10);n>=0&&e.onSelectPill(n)},preventMousedown:!0},Ea=[125,69];function wa(t,e){return e?1:t===0?.7:t===1?.4:.2}function An(t,e,n,i,o=!1,r=!1,s=!1){let a=t.querySelector(".magicx-aia-pill-list");if(a||(a=document.createElement("span"),a.className="magicx-aia-pill-list",t.appendChild(a)),U(a,id,{onSelectPill:i,loading:r}),r&&e.length===0){a.setAttribute("data-aia-pill-list-loading",""),a.innerHTML="";for(let l=0;l<Ea.length;l++){let c=Ea[l],u=document.createElement("span");u.setAttribute("data-aia-pill-skeleton",""),u.className=`magicx-aia-pill magicx-aia-pill--skeleton${o?" magicx-aia-pill--rounded":""}`,u.style.width=`${c}px`,u.style.setProperty("--aia-pill-opacity",String(wa(l,!1))),a.appendChild(u)}return}r?a.setAttribute("data-aia-pill-list-loading",""):a.removeAttribute("data-aia-pill-list-loading");for(let l of a.querySelectorAll("[data-aia-pill-skeleton]"))l.remove();ie(a,e,{keyOf:l=>`${l.type?.kind??""}|${De(l)?1:0}|${l.parameter}|${l.text}`,create:l=>{let c=document.createElement("button");if(c.type="button",c.tabIndex=-1,c.setAttribute("data-aia-pill",""),c.setAttribute("contenteditable","false"),De(l)){c.setAttribute("data-aia-smart-suggestion",A(l)?"header":"");let u=document.createElement("span");u.className="magicx-aia-smart-suggestion-text",u.textContent=l.text;let d=document.createElement("span");d.className="magicx-aia-smart-suggestion-sparkle",d.innerHTML=ri,c.append(u,d)}else c.textContent=l.text;return c.disabled=!0,c},update:(l,c,u)=>{let d=l,f=s&&u===n&&!r,p=["magicx-aia-pill"];o&&p.push("magicx-aia-pill--rounded"),r&&p.push("magicx-aia-pill--skeleton"),d.className=p.join(" "),d.style.width="",d.style.setProperty("--aia-pill-opacity",String(wa(u,f))),d.dataset.aiaPillIndex=String(u),d.toggleAttribute("data-aia-pill-active",u===n),r?d.setAttribute("data-aia-loading",""):d.removeAttribute("data-aia-loading")}}),G(a);for(let l of a.querySelectorAll("[data-aia-pill]"))l.disabled=r}function Io(t){t.querySelector(".magicx-aia-pill-list")?.remove()}var od=32;function Pa(t,e){if(e.ctrlKey)return null;let n=e.deltaY||0,i=e.deltaX||0;if(!n||Math.abs(i)>=Math.abs(n))return null;let o=t.scrollWidth-t.clientWidth;if(o<=1)return null;let r=t.scrollLeft,s=n;return e.deltaMode===1?s*=32:e.deltaMode===2&&(s*=t.clientWidth),Math.max(0,Math.min(o,r+s))}function Oo(t){let e=n=>{let i=Pa(t,n);i!==null&&(n.preventDefault(),t.scrollLeft=i)};return t.addEventListener("wheel",e,{passive:!1}),()=>t.removeEventListener("wheel",e)}var La=Intl.Segmenter,Ca=La?new La(void 0,{granularity:"grapheme"}):null;function ko(t){let e=t.trim().normalize("NFC").toUpperCase();if(Ca)for(let n of Ca.segment(e))return n.segment;return Array.from(e)[0]??"?"}var Mo=120,rd=360;function sd(t){let e=t.pathname;return t.hostname==="cdn.shopify.com"&&e.startsWith("/s/files/")||e.startsWith("/cdn/shop/")?/\.png$/i.test(e)?{format:"pjpg"}:/\.webp$/i.test(e)?{format:null}:null:null}function Aa(t,e){let n;try{n=new URL(t,typeof document>"u"?void 0:document.baseURI)}catch{return t}let i=sd(n);return i?(n.searchParams.set("width",String(e)),i.format&&n.searchParams.set("format",i.format),t.startsWith("/")&&!t.startsWith("//")?`${n.pathname}${n.search}${n.hash}`:n.href):t}function Ro(t,e){let n=Aa(t,e);return n===t?[t]:[n,t]}function _o(t,e){if(!(t>0)||!(e>0))return null;let n=t/e,i=o=>Math.round(o*1e3)/1e3;return{x:i(Math.min(n,1)),y:i(Math.min(1/n,1))}}function In(t){let e=t?.trim();return e?Ro(e,360):[]}function ad(t){return In(t)[0]}var On=new WeakMap,Ho=new WeakMap,Oa=new WeakMap;function ka(t,e,n,i,o,r="row",s="image",a=_(),l,c=!0,u=null){let d=t.querySelector(".magicx-aia-products");if(e.length===0){d?.remove();return}if(!d){d=document.createElement("section"),d.className="magicx-aia-products",d.setAttribute("data-aia-products",""),d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${n}-products-label`);let m=document.createElement("div");m.className="magicx-aia-products-label",m.id=`${n}-products-label`,m.setAttribute("data-aia-products-label",""),m.textContent=a.products;let g=document.createElement("div");g.className="magicx-aia-products-row",g.setAttribute("data-aia-products-row",""),Oo(g),d.append(m,g),t.appendChild(d)}d.setAttribute("data-aia-products-layout",r);let f=d.querySelector(".magicx-aia-products-label");f&&f.textContent!==a.products&&(f.textContent=a.products);let p=d.querySelector(".magicx-aia-products-row");if(p){ie(p,e,{keyOf:m=>md(m,!!l),create:m=>pd(m,i,o,s,a,l),update:(m,g,b)=>{On.set(m,g),ld(m,c?g.vendor:void 0),cd(m,g.price,g.compareAtPrice),m.id=`${n}-product-${b}`,m.dataset.aiaIndex=String(b),Oa.get(m)?.(s),Ye(m,"data-aia-product-state",g.id===u);let T=m.querySelector(".magicx-aia-product-badge");T&&T.textContent!==a.soldOut&&(T.textContent=a.soldOut);let S=m.querySelector(".magicx-aia-product-cart");S&&S.setAttribute("aria-label",Ma(g,a))}}),G(p);for(let m of p.querySelectorAll("[data-aia-product]")){let g=Ho.get(m);g&&(Ho.delete(m),g())}}}function No(t,e){let n=t.querySelectorAll("[data-aia-product], [data-aia-product-cart]");for(let i of n)je(i)||(i.tabIndex=e?0:-1)}function ld(t,e){let n=t.querySelector(".magicx-aia-product-vendor");if(!e){n?.remove();return}n||(n=document.createElement("span"),n.className="magicx-aia-product-vendor",t.querySelector(".magicx-aia-product-title")?.before(n)),n.textContent!==e&&(n.textContent=e)}function cd(t,e,n){let i=t.querySelector(".magicx-aia-product-price");if(!e){i?.remove();return}i||(i=document.createElement("span"),i.className="magicx-aia-product-price",i.append(document.createTextNode("")),t.querySelector(".magicx-aia-product-title")?.after(i));let o=i.firstChild;o.data!==e&&(o.data=e);let r=i.querySelector(".magicx-aia-product-compare-at");if(!n){r?.remove();return}r||(r=document.createElement("s"),r.className="magicx-aia-product-compare-at",i.append(r)),r.textContent!==n&&(r.textContent=n)}function Ia(t,e){e?(t.style.setProperty("--aia-product-photo-fill-x",String(e.x)),t.style.setProperty("--aia-product-photo-fill-y",String(e.y))):(t.style.removeProperty("--aia-product-photo-fill-x"),t.style.removeProperty("--aia-product-photo-fill-y"))}function Ma(t,e){return`${e.addToCart}: ${t.title}`}var Do="http://www.w3.org/2000/svg";function ud(){let t=document.createElementNS(Do,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false");let e=[["magicx-aia-product-cart-glyph","M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"],["magicx-aia-product-cart-glyph","M13.5 6.5v-4M11.5 4.5h4"],["magicx-aia-product-cart-check","M5 12.5l4.5 4.5L19 7.5"],["magicx-aia-product-cart-spinner","M12 4a8 8 0 1 0 8 8"]];for(let[n,i]of e){let o=document.createElementNS(Do,"path");o.setAttribute("class",n),o.setAttribute("d",i),t.appendChild(o)}for(let n of["9","17.5"]){let i=document.createElementNS(Do,"circle");i.setAttribute("class","magicx-aia-product-cart-glyph"),i.setAttribute("cx",n),i.setAttribute("cy","20"),i.setAttribute("r","1.3"),t.appendChild(i)}return t}function dd(t,e,n,i,o){let r=document.createElement("span");r.className="magicx-aia-product-cart",r.setAttribute("data-aia-product-cart",""),r.setAttribute("role","button"),r.setAttribute("aria-label",Ma(e,o)),r.tabIndex=0,r.appendChild(ud());let s=a=>{a.preventDefault(),a.stopPropagation(),r.getAttribute("data-aia-cart-state")!=="adding"&&(r.setAttribute("data-aia-cart-state","adding"),r.setAttribute("aria-busy","true"),n(On.get(t)??e).then(()=>{r.removeAttribute("aria-busy"),r.setAttribute("data-aia-cart-state","added")},()=>{r.removeAttribute("aria-busy"),r.removeAttribute("data-aia-cart-state")}))};return r.addEventListener("keydown",a=>{a.key!=="Enter"&&a.key!==" "||s(a)}),r.addEventListener("focus",()=>i(!0)),r.addEventListener("blur",a=>{a.relatedTarget?.closest("[data-aia-dropdown]")||i(!1)}),{el:r,arm:()=>r.addEventListener("click",s)}}function md(t,e){return[e?"cart":"",t.id,t.title,t.url,t.imageUrl,t.vendor,t.available===!1?"sold-out":""].map(n=>n??"").join("\0")}function pd(t,e,n,i,o,r){let s=document.createElement("a");s.className="magicx-aia-product",s.setAttribute("data-aia-product",""),s.setAttribute("role","option"),s.setAttribute("aria-selected","false"),s.tabIndex=0;let a=document.createElement("span");a.className="magicx-aia-product-media",a.setAttribute("data-aia-product-media",""),a.setAttribute("aria-hidden","true");let l=In(t.imageUrl),c=l[0],u=!!c,d=()=>{a.replaceChildren(),a.removeAttribute("data-aia-image-loaded"),a.toggleAttribute("data-aia-product-placeholder",i==="image"),a.toggleAttribute("data-aia-product-initial",i==="initial"),i==="initial"&&(a.textContent=ko(t.title))};if(Oa.set(s,g=>{g!==i&&(i=g,u||d())}),c){let g=document.createElement("img"),b=0;g.onload=()=>{a.setAttribute("data-aia-image-loaded",""),Ia(s,_o(g.naturalWidth,g.naturalHeight))},g.onerror=()=>{let T=l[++b];if(T){g.src=T;return}u=!1,Ia(s,null),d()},g.className="magicx-aia-product-image",g.src=c,g.alt="",g.loading="lazy",g.decoding="async",a.appendChild(g)}else d();s.appendChild(a);let f=document.createElement("span");f.className="magicx-aia-product-body";let p=document.createElement("span");if(p.className="magicx-aia-product-title",p.textContent=t.title,f.appendChild(p),t.available===!1){s.setAttribute("data-aia-product-sold-out","");let g=document.createElement("span");g.className="magicx-aia-product-badge",g.textContent=o.soldOut,f.appendChild(g)}s.appendChild(f);let m=r&&t.available!==!1?dd(s,t,r,n,o):null;return m&&(s.setAttribute("data-aia-product-has-cart",""),s.appendChild(m.el)),Ho.set(s,()=>{m?.arm(),t.url&&(s.href=t.url),s.addEventListener("click",g=>{g.metaKey||g.ctrlKey||g.shiftKey||g.altKey||g.button!==0||(g.preventDefault(),e(On.get(s)??t))})}),s.addEventListener("keydown",g=>{g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),e(On.get(s)??t))}),s.addEventListener("focus",()=>n(!0)),s.addEventListener("blur",g=>{g.relatedTarget?.closest("[data-aia-dropdown]")||n(!1)}),s}var fd=10,gd=44;function Fo(t,e,n){if(!e||n.detail===0)return!0;let i=t.getBoundingClientRect(),o=e.getBoundingClientRect();if(t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl"){let a=Math.min(o.left-10,i.right-44);return n.clientX>=a}let s=Math.max(o.right+10,i.left+44);return n.clientX<=s}var Te="data-aia-fit",kn="--aia-dropdown-fit-height",Ra=8,hd=160;function Wo({dropdown:t,isOpen:e}){let n=t.ownerDocument?.defaultView??null,i=!1,o=!1,r=null,s=null,a=null,l=null,c=!1,u=()=>{t.removeAttribute(Te),t.style.removeProperty(kn)},d=()=>{if(Se(t)){c=!0;return}c=!1,wo(t,t.getBoundingClientRect().height)},f=S=>`${r}|${(S??t).scrollHeight}|${t.offsetWidth}`,p=S=>a?.key===f(S)?a.height:null,m=S=>{let E=f(S);if(a?.key===E)return a.height;let y=S?.scrollTop??0;t.removeAttribute(Te);let h=t.offsetHeight;return t.setAttribute(Te,""),S&&y&&(S.scrollTop=y),a={key:E,height:h},h},g=()=>{if(i)return;if(!e()){o=!1;return}let S=Se(t),E=S?Eo(t):null;S&&l!==S&&(l=S,S.finished.then(b,b)),!S&&c&&d(),o||(o=!0,u());let y=t.hasAttribute(Te),h=$(t,".aia-grid")?.getAttribute("data-aia-group")??null,x=h!==r;r=h;let P=yd(t,n);if(P===null)return;let v=bd(t);if(y){let I=S?p(v):m(v);if(I!==null&&I<=P){u(),d();return}}else if((E??t.offsetHeight)<=P)return;let L=`${Math.max(hd,Math.floor(P))}px`,O=t.style.getPropertyValue(kn)!==L;O&&t.style.setProperty(kn,L),y?x&&v&&(v.scrollTop=0):t.setAttribute(Te,""),(O||!y)&&d()},b=()=>{i||s!==null||!n||(s=n.requestAnimationFrame(()=>{s=null,g()}))},T=n?.visualViewport??null;return T?.addEventListener("resize",b),T?.addEventListener("scroll",b),n?.addEventListener("resize",b),n?.addEventListener("scroll",b,{capture:!0,passive:!0}),g(),{update:g,destroy(){i||(i=!0,s!==null&&n?.cancelAnimationFrame(s),T?.removeEventListener("resize",b),T?.removeEventListener("scroll",b),n?.removeEventListener("resize",b),n?.removeEventListener("scroll",b,{capture:!0}))}}}function bd(t){for(let e of Array.from(t.children))if(e.classList.contains("aia-stack"))return e;return null}function yd(t,e){if(!e)return null;let n=e.visualViewport,i=n?n.offsetTop:0,o=n?n.height:e.innerHeight;if(!o)return null;let r=t.offsetParent,s=r?r.getBoundingClientRect().top:0,a=r?s+t.offsetTop:t.getBoundingClientRect().top;return t.closest("[data-options-position]")?.getAttribute("data-options-position")==="above"?(r?a+t.offsetHeight:t.getBoundingClientRect().bottom)-i-Ra:i+o-a-Ra}var Mn=.5;function Sd(t,e){let n=Math.max(0,t.scrollHeight-t.clientHeight),i=t.clientHeight-t.coverTop-t.coverBottom,o=t.scrollTop+t.coverTop,r=e.top+e.height,s=t.scrollTop;return e.top<o-Mn||e.height>i+Mn?s=Math.floor(e.top-t.coverTop):r>o+i+Mn&&(s=Math.ceil(r-t.coverTop-i)),Math.min(n,Math.max(0,s))}var _a=new WeakMap;function Da(t){let e=_a.get(t);if(e)return e;let n={shown:-1,byPointer:-1,held:!1,x:null,y:null,cancel:null};_a.set(t,n);let i=o=>Ha(n,o);for(let o of["mouseover","mouseout","mousemove"])t.addEventListener(o,i,{capture:!0,passive:!0});return n}function Ha(t,e){e.screenX===t.x&&e.screenY===t.y||(t.held=!1,t.x=e.screenX,t.y=e.screenY)}function Rn(t,e,n){if(!t)return!0;let i=Da(t);return Ha(i,n),i.held?!1:(i.byPointer=e,!0)}function Td(t){if(t.scrollHeight-t.clientHeight>1)return t;let e=t.closest(".aia-stack");return e?.parentElement?.hasAttribute(Te)&&e.scrollHeight-e.clientHeight>1?e:null}function vd(t,e){let n=t.getBoundingClientRect(),i=e.getBoundingClientRect();if(!(n.height>0)||!(i.height>0))return null;let o=t.offsetHeight>0?n.height/t.offsetHeight:1,r=t.ownerDocument.defaultView?.getComputedStyle(t);return{box:{scrollTop:t.scrollTop,clientHeight:t.clientHeight,scrollHeight:t.scrollHeight,coverTop:Number.parseFloat(r?.paddingTop??"")||0,coverBottom:Number.parseFloat(r?.paddingBottom??"")||0},row:{top:(i.top-n.top)/o-t.clientTop+t.scrollTop,height:i.height/o}}}function Bo(t,e){let n=Da(t);if(e===n.shown)return;let i=e===n.byPointer;if(n.byPointer=-1,e<0||i){n.shown=e;return}let o=t.querySelectorAll("[data-aia-option]")[e];if(!o||!(t.getBoundingClientRect().height>0))return;n.shown=e,n.cancel?.(),n.cancel=null;let r=Td(t),s=r?vd(r,o):null;if(!r||!s)return;let a=Sd(s.box,s.row);Math.abs(a-r.scrollTop)<Mn||(n.held=!0,n.cancel=wn(r,a-r.scrollTop,r.ownerDocument.defaultView,()=>{n.cancel=null}))}var Na="http://www.w3.org/2000/svg",xd=new Set(["svg","g","path","circle","ellipse","line","polyline","polygon","rect"]);function Ed(t,e){let n=t.toLowerCase();return n.startsWith("on")||n.includes("href")||n==="style"||n==="xml:base"||n==="id"||n==="name"||/^\s*javascript:/i.test(e)||/url\s*\(\s*['"]?\s*[^#'"\s)]/i.test(e)}var wd=["fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","fill-rule","clip-rule","opacity","fill-opacity","stroke-opacity"],Pd=/^[a-zA-Z0-9#.,%\s()-]+$/;function Ld(t){let e=[];for(let n of wd){let i=t.getAttribute(n);i===null||!Pd.test(i)||/url\s*\(/i.test(i)||e.push(`${n}: ${i.trim()}`)}e.length>0&&t.setAttribute("style",e.join("; "))}function Fa(t){for(let e of Array.from(t.attributes))Ed(e.name,e.value)&&t.removeAttribute(e.name);Ld(t);for(let e of Array.from(t.childNodes))if(e.nodeType===Node.ELEMENT_NODE){let n=e;!xd.has(n.localName)||n.namespaceURI!==Na?n.remove():Fa(n)}else e.remove()}function ce(t){if(typeof DOMParser>"u"||typeof XMLSerializer>"u")return null;let e=new DOMParser().parseFromString(t,"image/svg+xml"),n=e.documentElement;return!n||n.localName!=="svg"||n.namespaceURI!==Na||e.getElementsByTagName("parsererror").length>0?null:(Fa(n),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),new XMLSerializer().serializeToString(n))}function _n(t){return t.text}function Oe(t){return Lt(t)[0]??null}function Lt(t){let e=Cd(t);return e?Ro(e,120):[]}function Cd(t){if(!t)return null;let e=t.trim();if(e==="")return null;let n;try{n=new URL(e,typeof document>"u"?void 0:document.baseURI)}catch{return null}return n.protocol!=="http:"&&n.protocol!=="https:"?null:n.href}function Ct(t){return t===void 0||!Number.isInteger(t)||t<0?null:t.toLocaleString()}var Wa={one:"item",other:"items"};function Ad(t,e=Wa){let n=Ct(t);if(n===null)return null;let i=typeof e=="string"?e:t===1?e.one:e.other;return i===""?n:`${n} ${i}`}function Ba(t){return Oe(t.image_url)!==null}var Dn=new Map;function Id(t){let e=t.icon_svg;if(!e)return!1;let n=Dn.get(e);return n===void 0&&(n=ce(e)!==null,Dn.size>=256&&Dn.clear(),Dn.set(e,n)),n}function Vo(t,e,n){return!e&&!n?!1:t.every(i=>!i.is_tappable||n&&Ba(i)||e&&Id(i))}var Va=new WeakMap;function Od(t,e,n){let i=e.length,o=Et(),r=Va.get(t),s=n&&r&&zi(r.options,e)?r.plan:null,a=!s&&!n&&$i(i,o)?xt(t):null,l=s??qi(i,o,a?.rowWidths??null,a?.gridWidth??null);return n||Va.set(t,{options:e,plan:l}),t.style.gridTemplateColumns=l.template,t.style.setProperty("--aia-grid-max-height",l.maxHeight),t.querySelectorAll("[data-aia-option]").forEach((c,u)=>{c.classList.toggle("magicx-aia-option--scroll-hint",!n&&l.scrollHintIndices.includes(u))}),l.cols}function Ua(t,e){if(e.loading||!e.interactive)return null;let n=e.options[ye(t)];return n?.is_tappable?n:null}var kd=2e3,At=new WeakMap;function Md(t,e){t.classList.add("magicx-aia-option--pressed");let n=t.closest(".aia-grid");if(!n)return;let i=`${Date.now()}:${e}`;n.dataset.aiaPress=e,n.dataset.aiaPressToken=i,clearTimeout(At.get(n)),At.set(n,setTimeout(()=>{At.delete(n),n.dataset.aiaPressToken===i&&$a(n,!0)},kd))}function $a(t,e=!1){clearTimeout(At.get(t)),At.delete(t),delete t.dataset.aiaPress,delete t.dataset.aiaPressToken;for(let n of t.querySelectorAll(".magicx-aia-option--pressed"))n.classList.remove("magicx-aia-option--pressed");e&&vo(t.closest("[data-aia-dropdown]"))}var Rd={itemSelector:"[data-aia-option]",onClick:(t,e,n)=>{let i=Ua(t,e);if(!i)return;let o=t.querySelector(".magicx-aia-checkbox"),r=o!==null&&!Fo(t,o,n);if((!o||r)&&Md(t,i.text),o){let s=r||t.getAttribute("aria-selected")!=="true";t.setAttribute("aria-selected",String(s)),o.dataset.checked=String(s)}r?e.onSelect(i,{commit:!0}):e.onSelect(i)},onEnter:(t,e,n)=>{if(!Ua(t,e))return;let i=ye(t);Rn(t.closest(".aia-grid"),i,n)&&e.onHighlight(i)},onLeave:(t,e,n)=>{Rn(t.closest(".aia-grid"),-1,n)&&e.onHighlight(-1,ye(t))}};function qa(t,e,n,i,o,r,s,a="",l="below",c=!0,u=!0,d=!0,f=!0,p){let m=t.querySelector(".aia-grid");if(e.length===0){m?.remove();return}m||(m=document.createElement("div"),m.className="aia-grid magicx-aia-grid",m.setAttribute("data-scroll",""),m.style.setProperty("--aia-grid-min","250px"),m.style.setProperty("--aia-grid-max","1fr"),m.style.setProperty("--aia-grid-gap","0"),t.appendChild(m)),U(m,Rd,{options:e,onSelect:i,onHighlight:o,loading:s,interactive:f});let g=m.dataset.aiaGroup!==a;m.dataset.aiaGroup=a,g&&$a(m);let b=Vo(e,c,u);_d(m,e,n,r,s,{showIcons:c&&b,showImages:u&&b,showCounts:d,picked:p});let T=Od(m,e,s);Dd(m,e.length,T,s,l),g&&(m.scrollTop=0),Bo(m,s?-1:n)}function _d(t,e,n,i,o,r){let s=o?"1":"0",a=t.dataset.aiaGroup??"",{showIcons:l,showImages:c,showCounts:u}=r,d=l?m=>m.icon??m.icon_svg??"":()=>"",f=c?m=>`${Oe(m.image_url)??""}${(m.imageCollage??[]).join("")}`:()=>"",p=u?m=>Ct(m.item_count)??"":()=>"";ie(t,e,{keyOf:m=>`${m.text}\0${m.parameter??""}\0${m.parameterLabel??""}\0${d(m)}\0${f(m)}\0${p(m)}\0${s}\0${a}`,create:(m,g)=>{let b=Hd(m,o,r);return t.dataset.aiaPress===m.text&&b.classList.add("magicx-aia-option--pressed"),o||(b.dataset.aiaEntering=""),b},update:(m,g,b)=>{if(Uo.get(m)!==(g.matchedText??"")){let E=m.querySelector(".magicx-aia-option-text");E&&Ga(E,g),Uo.set(m,g.matchedText??"")}let T=b===n&&!o;m.id=`${i}-option-${b}`,m.dataset.aiaIndex=String(b),m.setAttribute("aria-selected",String(r.picked?r.picked.includes(g.text):T));let S=m.querySelector(".magicx-aia-checkbox");r.picked&&g.is_tappable?(S||(S=document.createElement("span"),S.className="magicx-aia-checkbox",S.setAttribute("aria-hidden","true"),m.querySelector(".magicx-aia-option-content")?.prepend(S)),S.dataset.checked=String(r.picked.includes(g.text))):S?.remove(),m.classList.toggle("magicx-aia-option--highlighted",T),m.classList.toggle("magicx-aia-option--live-match",!!g.liveMatch&&!o)}})}function Dd(t,e,n,i,o){for(let r of t.querySelectorAll("[data-aia-entering]")){if(!i){let s=Number.parseInt(r.dataset.aiaIndex??"-1",10);s>=0&&r.style.setProperty(uo,`${mo(s,n,e,o)}ms`)}delete r.dataset.aiaEntering}}var Uo=new WeakMap;function Ga(t,e){if(t.replaceChildren(),e.matchedText)for(let n of Zi(_n(e),e.matchedText))if(n.bold){let i=document.createElement("strong");i.className="magicx-aia-option-match",n.partial&&i.setAttribute("data-aia-match-partial",""),i.textContent=n.text,t.appendChild(i)}else t.appendChild(document.createTextNode(n.text));else t.appendChild(document.createTextNode(_n(e)));if(e.parameterLabel){t.appendChild(document.createTextNode(" "));let n=document.createElement("span");n.className="magicx-aia-option-parameter",n.textContent=e.parameterLabel,t.appendChild(n)}}function Hd(t,e,{showIcons:n,showImages:i,showCounts:o}){let r=document.createElement("div");r.setAttribute("role","option"),r.setAttribute("data-aia-option",""),e&&r.setAttribute("data-aia-loading",""),r.tabIndex=e||!t.is_tappable?-1:0;let s=["magicx-aia-option"];t.is_tappable?s.push("magicx-aia-option--tappable"):s.push("magicx-aia-option--non-tappable"),r.className=s.join(" ");let a=document.createElement("span");a.className="magicx-aia-option-content";let l=i?Lt(t.image_url):[],c=l[0];if(c){let p=document.createElement("span");p.className="magicx-aia-option-image",p.setAttribute("aria-hidden","true");let m=(t.imageCollage??[]).map(g=>Lt(g)).filter(g=>g.length>0);m.length>1&&p.setAttribute("data-aia-collage",String(m.length));for(let g of m.length>1?m:[l]){let b=document.createElement("img");b.setAttribute("alt",""),b.setAttribute("loading","lazy"),b.setAttribute("decoding","async"),b.setAttribute("referrerpolicy","no-referrer"),b.setAttribute("draggable","false");let T=0;b.onload=()=>p.setAttribute("data-aia-image-loaded",""),b.onerror=()=>{let S=g[++T];S?b.src=S:b.hidden=!0},b.src=g[0],p.appendChild(b)}a.appendChild(p),r.dataset.aiaImage=""}let u=!c&&n&&t.icon_svg?ce(t.icon_svg):null;if(u){let p=document.createElement("span");p.className="magicx-aia-option-icon",p.setAttribute("aria-hidden","true"),p.innerHTML=u,a.appendChild(p),t.icon&&(r.dataset.aiaIcon=t.icon)}let d=document.createElement("span");if(d.className="magicx-aia-option-text",Ga(d,t),Uo.set(r,t.matchedText??""),a.appendChild(d),t.tag){let p=document.createElement("span");p.className="magicx-aia-option-tag",p.textContent=t.tag,a.appendChild(p)}let f=o?Ct(t.item_count):null;if(f!==null){let p=document.createElement("span");p.className="magicx-aia-option-count",p.textContent=f,a.appendChild(p),r.dataset.aiaItemCount=String(t.item_count)}return r.appendChild(a),r}var Nd=120,Fd={itemSelector:"[data-aia-time-row], [data-aia-time-done]",onClick:(t,e)=>{if(!e.interactive)return;if(t.hasAttribute("data-aia-time-done")){e.callbacks.onTimeCommit();return}let n=t.dataset.aiaTimeColumn;n&&e.callbacks.onTimeChange(ln(n,e.view.minutes,Number(t.dataset.aiaIndex)))}},za=new WeakMap,Ka=new WeakMap;function Qa(t,e,n,i,o=!0){let r=t.querySelector(".magicx-aia-time-wheel");if(!e){r?.remove();return}if(!r){r=Vd(),t.appendChild(r),G(r);let c=r.querySelector("[data-aia-time-done]");c&&(c.disabled=!1)}let s={view:e,callbacks:i,interactive:o};za.set(r,s),U(r,Fd,s),r.setAttribute("aria-label",n.timeLabel);let a=r.querySelector("[data-aia-time-done]");a&&(a.textContent=n.done);let l=r.querySelector("[data-aia-time-value]");l&&(l.textContent=on(e.minutes));for(let c of sn){let u=r.querySelector(`[data-aia-time-column="${c}"]`);u&&Wd(u,c,e.minutes)}}function Wd(t,e,n){let i=an(e,n);for(let s of t.querySelectorAll("[data-aia-time-row]")){let a=Number(s.dataset.aiaIndex)===i;s.classList.toggle("magicx-aia-time-wheel-row--selected",a),s.setAttribute("aria-selected",String(a))}let o=Hn(t);if(o.settle)return;let r=i*rn;Math.abs(t.scrollTop-r)<1||(o.syncedTop=r,t.scrollTop=r)}function Hn(t){let e=Ka.get(t);return e||(e={syncedTop:null,settle:null},Ka.set(t,e)),e}function Bd(t,e,n){let i=Hn(e);if(i.syncedTop!=null&&Math.abs(e.scrollTop-i.syncedTop)<1){i.syncedTop=null;return}i.syncedTop=null,i.settle&&clearTimeout(i.settle),i.settle=setTimeout(()=>Ya(t,e,n),Nd)}function Ya(t,e,n){let i=Hn(e);i.settle&&clearTimeout(i.settle),i.settle=null;let o=za.get(t);if(!o||!o.interactive)return;let r=Ri(n,e.scrollTop);r!==an(n,o.view.minutes)&&o.callbacks.onTimeChange(ln(n,o.view.minutes,r))}function Vd(){let t=document.createElement("div");t.className="magicx-aia-time-wheel",t.setAttribute("data-aia-time-wheel",""),t.setAttribute("role","group");let e=document.createElement("span");e.className="magicx-aia-time-wheel-value",e.setAttribute("data-aia-time-value",""),e.setAttribute("aria-live","polite");let n=document.createElement("div");n.className="magicx-aia-time-wheel-columns",n.setAttribute("aria-hidden","true");let i=document.createElement("div");i.className="magicx-aia-time-wheel-band",n.appendChild(i);for(let r of sn){if(r==="minute"){let s=document.createElement("span");s.className="magicx-aia-time-wheel-separator",s.textContent=":",n.appendChild(s)}n.appendChild(Ud(t,r))}let o=document.createElement("button");return o.type="button",o.tabIndex=-1,o.className="magicx-aia-time-wheel-done",o.setAttribute("data-aia-time-done",""),o.disabled=!0,t.append(e,n,o),t}function Ud(t,e){let n=document.createElement("div");return n.className="magicx-aia-time-wheel-column",n.setAttribute("data-aia-time-column",e),Mi(e).forEach((i,o)=>{let r=document.createElement("div");r.className="magicx-aia-time-wheel-row",r.setAttribute("data-aia-time-row",""),r.dataset.aiaTimeColumn=e,r.dataset.aiaIndex=String(o),r.textContent=i.label,n.appendChild(r)}),n.addEventListener("scroll",()=>Bd(t,n,e),{passive:!0}),n.addEventListener("scrollend",()=>{Hn(n).settle&&Ya(t,n,e)}),n}var $d=[159,119,164];function Wn(t){let e=document.createElement("div");return e.id=t,e.setAttribute("role","listbox"),e.setAttribute("data-aia-dropdown",""),e.className="magicx-aia-dropdown",e.addEventListener("mousedown",n=>n.preventDefault()),ao(e),e}var Nn=new WeakMap;function qd(t,e,n){let i=Nn.get(t);if(i||(i={button:Zs(t.ownerDocument,n),grid:null,controller:null},t.appendChild(i.button),Nn.set(t,i)),i.button.getAttribute("aria-label")!==n.scrollArrow&&i.button.setAttribute("aria-label",n.scrollArrow),i.grid!==e&&(i.controller?.destroy(),i.controller=null,i.grid=e,e)){i.controller=go({dropdown:t,grid:e,button:i.button});return}i.controller?.update()}var Fn=new WeakMap;function ja(t){let e=Fn.get(t);if(e){e.update();return}Fn.set(t,Wo({dropdown:t,isOpen:()=>t.classList.contains("magicx-aia-dropdown--visible")}))}function $o(t){Fn.get(t)?.destroy(),Fn.delete(t),Po(t);let e=Nn.get(t);e&&(e.controller?.destroy(),Nn.delete(t))}function Bn(t,e){let n=e.strings??_(),{filteredOptions:i,activeIndex:o,isOpen:r,isLoading:s,showPills:a,isActivePillSelected:l,onSelect:c,onHighlight:u,onPillClick:d,onSkip:f}=e,p=oi(e.pills,n.keepTyping),m=si(p),g=a&&p.length>0,b=i.length>0,T=e.products.length>0,S=e.formatType==="time"&&e.timeView!=null,E=e.formatType==="location"&&e.locationView!=null,y=r&&(b||g||s||T||S||E);if(y?t.classList.add("magicx-aia-dropdown--visible"):t.classList.remove("magicx-aia-dropdown--visible"),s?t.setAttribute("data-aia-loading",""):t.removeAttribute("data-aia-loading"),!y){No(t,!1),va(t),ja(t),Cn(t,null,{visible:!1});return}T?t.setAttribute("data-aia-has-products",""):t.removeAttribute("data-aia-has-products"),t.toggleAttribute(Co,e.fullWidth===!0),Pt(t),t.toggleAttribute("data-aia-skeleton-exiting",!!e.skeletonExiting);let h=t.querySelector(".aia-stack");h||(h=document.createElement("div"),h.className="aia-stack",h.style.setProperty("--aia-stack-space","8px"),t.appendChild(h));let x=e.showSkipButton&&m&&!e.isInputEmpty,P=g||s&&a||x,v=h.querySelector(".magicx-aia-pill-bar");if(P){v||(v=document.createElement("div"),v.className="magicx-aia-pill-bar aia-cluster",v.setAttribute("data-nowrap",""),v.setAttribute("data-aia-pillbar",""),h.insertBefore(v,h.firstChild));let ue=g||s&&a,C=v.querySelector(".magicx-aia-pill-scroll");ue?(C||(C=document.createElement("span"),C.className="magicx-aia-pill-scroll",C.setAttribute("data-aia-pill-scroll",""),v.insertBefore(C,v.firstChild)),An(C,p,0,d,!0,s,l)):C&&C.remove(),zd(v,x,s||e.skipDisabled,p[0],f,n)}else v&&v.remove();let L=e.suggestions[0],O=L?`${L.parameter} ${L.text}`:"",I=H(e.formatType),K=I&&!s;qa(h,I?[]:i,o,c,u,e.listboxId,s,O,e.optionsPosition??"below",e.showOptionIcons??!0,e.showOptionImages??!0,e.showOptionCounts??!0,!e.skipDisabled,e.multiSelectView?.picked),t.setAttribute("aria-multiselectable",String(!!e.multiSelectView)),Zd(h,!!e.multiSelectView,e.skipDisabled||s,e.onMultiSelectCommit,n.done),qd(t,h.querySelector(".aia-grid"),n),ba(h,K?i:[],o,e.listboxId,K?e.dateView:null,{selectedIso:e.selectedDateIso,selectedRange:e.selectedDateRange,rangeStart:e.dateRangeStart,floor:oo(e.formatType,e.dateRangeStart),references:e.dateReferences??[]},{onSelect:c,onHighlight:u,onPreviousMonth:e.onPreviousMonth,onNextMonth:e.onNextMonth},!e.skipDisabled),Qa(h,e.formatType==="time"&&!s?e.timeView:null,n,{onTimeChange:e.onTimeChange,onTimeCommit:e.onTimeCommit},!e.skipDisabled),xa(h,e.formatType==="location"&&!s?e.locationView:null,n,{onLocationQuery:e.onLocationQuery,onLocationMove:e.onLocationMove,onLocationCommit:e.onLocationCommit,onLocationFocusChange:e.onLocationFocusChange},{interactive:!e.skipDisabled,inputFocused:e.isFocused??!1,reediting:e.isReediting??!1});let M=h.querySelector(".magicx-aia-skeleton-bars");if(s&&(!b||F(e.formatType))){if(!M){M=document.createElement("div"),M.className="magicx-aia-skeleton-bars",M.setAttribute("data-aia-skeleton-bars","");for(let ue of $d){let C=document.createElement("span");C.className="magicx-aia-skeleton-bar",C.style.width=`${ue}px`,M.appendChild(C)}h.appendChild(M)}}else M&&M.remove();ka(h,e.products,e.listboxId,e.onProductSelect,e.onProductFocusChange,e.productsLayout??"row",e.productImageFallback??"image",n,e.onProductAddToCart,e.showProductVendor??!0,e.busyProductId??null),No(t,!s),Xd(h,e.onSeeAllResults,n.seeAllResults,e.seeAllBusy===!0);let z=h.querySelector(".magicx-aia-footer")??Yd(n),Z=o>=0&&!!i[o]?.is_tappable;Qd(z,so(Z,e.isInputEmpty,n)),z.isConnected||h.appendChild(z),Gd(h,[".magicx-aia-pill-bar",".aia-grid","[data-aia-multi-actions]",".magicx-aia-datepicker",".magicx-aia-time-wheel","[data-aia-location]",".magicx-aia-skeleton-bars",".magicx-aia-products","[data-aia-see-all]",".magicx-aia-footer"]),co(h,h.querySelector(".magicx-aia-multi-done")),Ao(t,h,{eligible:b&&!T&&!I&&!S&&!E&&!e.onSeeAllResults&&!e.fullWidth,loading:s}),ja(t),Cn(t,xo(a?p:[]),{visible:!0,anchorBottom:e.optionsPosition==="above"})}function Gd(t,e){let n=e.map(i=>t.querySelector(`:scope > ${i}`)).filter(i=>i!==null);for(let i=0;i<n.length;i++)t.children[i]!==n[i]&&t.insertBefore(n[i],t.children[i]??null)}var Kd={itemSelector:".magicx-aia-skip",onClick:(t,e)=>{e.loading||e.onSkip()}};function zd(t,e,n,i,o,r){U(t,Kd,{onSkip:o,loading:n});let s=t.querySelector(".magicx-aia-skip");if(!e){s?.remove();return}s||(s=document.createElement("button"),s.type="button",s.tabIndex=-1,s.className="magicx-aia-skip",s.setAttribute("data-aia-skip",""),s.textContent=r.skip,s.disabled=!0,t.appendChild(s),G(s)),s.textContent!==r.skip&&(s.textContent=r.skip),s.setAttribute("aria-label",i?`${r.skipLabel} ${i.text}`:r.skipLabel),s.disabled=n}function Qd(t,{key:e,hint:n}){let i=t.querySelector(".magicx-aia-footer-key"),o=t.querySelector(".magicx-aia-footer-hint");!i||!o||(i.textContent!==e&&(i.textContent=e),o.textContent!==n&&(o.textContent=n))}function Yd(t){let e=document.createElement("footer");e.className="magicx-aia-footer",e.setAttribute("data-aia-footer","");let n=document.createElement("div");n.className="aia-cluster magicx-aia-footer-row",n.setAttribute("data-align","center"),n.setAttribute("data-justify","between"),n.setAttribute("data-nowrap","");let i=document.createElement("div");i.className="aia-cluster magicx-aia-footer-hint-group",i.setAttribute("data-align","center"),i.style.setProperty("--aia-cluster-gap","5px");let o=document.createElement("kbd");o.className="magicx-aia-footer-key",o.textContent="tab";let r=document.createElement("span");r.className="magicx-aia-footer-hint",r.textContent=t.select,i.append(o,r);let s=document.createElement("a");s.className="aia-cluster magicx-aia-footer-brand-link",s.setAttribute("data-align","center"),s.href=ro(),s.target="_blank",s.rel="noopener noreferrer",s.style.setProperty("--aia-cluster-gap","2px");let a=document.createElement("span");a.className="magicx-aia-footer-brand",a.textContent="Powered by Intent-1";let l=document.createElement("span");return l.className="magicx-aia-footer-badge",l.append(a),s.append(l),n.append(i,s),e.append(n),e}var jd={itemSelector:".magicx-aia-see-all",onClick:(t,e,n)=>{e.submit&&(n.stopPropagation(),e.submit())}};function Xd(t,e,n,i){let o=t.querySelector(":scope > [data-aia-see-all]");if(!e){o?.remove();return}if(!o){o=document.createElement("div"),o.className="magicx-aia-see-all-row",o.dataset.aiaSeeAll="";let s=document.createElement("button");s.type="button",s.tabIndex=-1,s.className="magicx-aia-see-all",s.disabled=!0,o.appendChild(s),t.appendChild(o),G(s)}U(o,jd,{submit:e});let r=o.querySelector("button");r&&(r.textContent!==n&&(r.textContent=n),r.disabled=!1,Ye(r,"data-aia-see-all-state",i))}var Jd={itemSelector:".magicx-aia-multi-done",onClick:(t,e)=>{e.disabled||e.commit?.()}};function Zd(t,e,n,i,o){let r=t.querySelector("[data-aia-multi-actions]");if(!e){r?.remove();return}if(!r){r=document.createElement("div"),r.dataset.aiaMultiActions="";let a=document.createElement("button");a.type="button",a.tabIndex=-1,a.className="magicx-aia-multi-done",a.setAttribute("data-aia-multi-done",""),a.disabled=!0,r.appendChild(a),t.appendChild(r),G(a)}U(r,Jd,{commit:i,disabled:n});let s=r.querySelector("button");s&&(s.textContent=o,s.disabled=n)}function It(t,e,n){if(e)return[e];if(!t)return n;let i=n.filter(o=>o.parameter!==t.parameter||o.text!==t.text);return[t,...i]}function Xa(t,e){let n=Wn(e.listboxId);return t.appendChild(n),{dropdown:n}}function qo(t,e,n){let i=wt(e);Bn(t.dropdown,{strings:n.strings,suggestions:e.editingIdentified?[{parameter:e.editingIdentified.parameter,text:se(e.editingIdentified.parameter),required:!0,options:e.filteredOptions}]:e.dropdownSuggestion??e.actionableSuggestions[0]?[{...e.dropdownSuggestion??e.actionableSuggestions[0],options:e.dropdownOptions}]:[],filteredOptions:e.dropdownOptions,activeIndex:e.activeDropdownIndex,isOpen:e.isDropdownOpen,isLoading:e.dropdownLoading,skeletonExiting:e.skeletonExiting,listboxId:n.listboxId,pills:It(e.dropdownSuggestion,null,e.actionableSuggestions),showPills:!0,showSkipButton:n.showSkipButton&&!e.editingParam&&!e.editingIdentified,skipDisabled:e.inSelectionAnimation,showOptionIcons:n.showOptionIcons??!0,showOptionImages:n.showOptionImages??!0,showOptionCounts:n.showOptionCounts??!0,isActivePillSelected:e.isActivePillSelected,isInputEmpty:e.text.trim().length===0,products:e.products,productsLayout:n.productsLayout??"row",productImageFallback:n.productImageFallback??"image",showProductVendor:n.showProductVendor??!0,onProductAddToCart:n.addProductToCart,formatType:e.activeFormatType,dateView:e.dateView,selectedDateIso:i.selectedIso,selectedDateRange:i.selectedRange,dateRangeStart:i.rangeStart,dateReferences:i.references,timeView:e.timeView,multiSelectView:e.dropdownMultiSelect,locationView:e.locationView,isReediting:e.editingParam!=null,isFocused:e.isFocused||e.locationFieldFocused,optionsPosition:n.optionsPosition??"below",onSelect:n.selectOption,onHighlight:(o,r)=>{r!==void 0&&n.store.get().activeDropdownIndex!==r||n.store.set({activeDropdownIndex:o,highlightByPointer:o>=0})},onPillClick:n.setActivePill,onSkip:n.skipActivePill,onPreviousMonth:n.showPreviousMonth,onNextMonth:n.showNextMonth,onTimeChange:n.setTime,onTimeCommit:n.commitTime,onMultiSelectCommit:n.commitMultiSelect,onLocationQuery:n.setLocationQuery,onLocationMove:n.moveLocationHighlight,onLocationCommit:n.commitLocation,onLocationFocusChange:n.setLocationFieldFocused,busyProductId:e.selectingProductId,onProductSelect:n.selectProduct,onProductFocusChange:o=>n.store.set({isFocused:o})})}var em="[data-aia-chip-remove]";function Go(t,e){let n=e;if(!n||n.nodeType===void 0)return null;let o=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(em)??null;return o&&t.contains(o)?o:null}function Ko(t,e){let n=null,i=!1,o=d=>{if(n=null,i){u();return}let f=d;if(f.button)return;let p=Go(t,d.target);if(!p)return;d.preventDefault(),d.stopPropagation();let m=p.dataset.aiaChipRemove,g=f.pointerType==="touch"||f.pointerType==="pen";n={id:m,x:f.clientX,y:f.clientY,pending:g},!g&&m&&e(m)},r=d=>{if(!n?.pending)return;n.pending=!1;let f=d;if(Math.hypot(f.clientX-n.x,f.clientY-n.y)>10)return;let m=t.getRootNode().elementFromPoint?.(f.clientX,f.clientY)??d.target,g=Go(t,m)?.dataset.aiaChipRemove;g&&g===n.id&&e(g)},s=()=>{n&&(n.pending=!1)},a=d=>{!n&&!Go(t,d.target)||(d.cancelable&&d.preventDefault(),d.type==="click"&&(d.stopImmediatePropagation(),n=null,i&&u()))},l={capture:!0},c={capture:!0,passive:!1};t.addEventListener("pointerdown",o,l),t.addEventListener("pointerup",r,l),t.addEventListener("pointercancel",s,l),t.addEventListener("touchstart",a,c),t.addEventListener("mousedown",a,l),t.addEventListener("click",a,l);let u=()=>{t.removeEventListener("pointerdown",o,l),t.removeEventListener("pointerup",r,l),t.removeEventListener("pointercancel",s,l),t.removeEventListener("touchstart",a,c),t.removeEventListener("mousedown",a,l),t.removeEventListener("click",a,l)};return()=>{if(n){i=!0;return}u()}}var tm=340;function zo(t){let e=t.ownerDocument.defaultView;if(!e||typeof e.MutationObserver!="function")return()=>{};let n=()=>{if(!t.isConnected)return;let u=t.style.height?t.getBoundingClientRect().height:0;t.style.height="";let d=t.getBoundingClientRect().height;if(d!==0){if(u===0||Math.abs(d-u)<.5){t.style.height=`${d}px`;return}t.style.height=`${u}px`,t.getBoundingClientRect(),t.style.height=`${d}px`}},i=-1,o=typeof e.ResizeObserver=="function"?new e.ResizeObserver(u=>{for(let f of u)if(f.target!==t){n();return}let d=t.getBoundingClientRect().width;Math.abs(d-i)<.5||(i=d,n())}):null,r=()=>{for(let u of Array.from(t.children))o?.observe(u)},s=0,a=()=>{r(),n(),e.clearTimeout(s),s=e.setTimeout(n,340)},l=new e.MutationObserver(a);l.observe(t,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:["data-placeholder","data-aia-empty"]}),o?.observe(t),r(),t.addEventListener("load",a,!0);let c=!1;return t.ownerDocument.fonts?.ready.then(()=>{c||n()}),n(),()=>{c=!0,t.removeEventListener("load",a,!0),l.disconnect(),o?.disconnect(),e.clearTimeout(s),t.style.height=""}}var tl=2600,nm=3,Xo="data-aia-hint",jo="magicx-aia-hint",nl="data-aia-hint-el",im={position:"absolute",pointerEvents:"none",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--aia-hint-color, #999)",userSelect:"none"},om=280,rm=320,sm=380,Qo="cubic-bezier(0.25, 0.1, 0.25, 1)",Ja=new Set(["a","an","the","some","my"]),$n=new WeakMap;function am(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Za(t,e){let n=t.text.trim(),i=e.trim(),o=[];i&&n.toLowerCase().startsWith(`${i.toLowerCase()} `)&&(n=n.slice(i.length+1).trim());let r=i?i.split(/\s+/):[],s=null;r.length>1&&Ja.has(r[r.length-1].toLowerCase())&&(s=r.pop()??null);let a=r.join(" ");a&&o.push({key:`w:${a.toLowerCase()}`,text:a,icon:null});let l=null,[c,...u]=n.split(/\s+/);u.length&&c&&Ja.has(c.toLowerCase())&&(l=c,n=u.join(" "));let d=l??s;d&&o.push({key:`w:${d.toLowerCase()}`,text:d,icon:null});let f=t.icon_svg?ce(t.icon_svg):null;return o.push({key:`c:${f??""}:${n}`,text:n,icon:f}),o}function lm(t,e){let n=t.createElement("span");if(n.className=`${jo}__word`,n.dataset.key=e.key,n.style.display="inline-block",e.icon){let i=t.createElement("span");i.className=`${jo}__icon`,Object.assign(i.style,{display:"inline-flex",width:"1em",height:"1em",marginRight:"0.25em",verticalAlign:"-0.125em",opacity:"var(--aia-hint-icon-opacity, 0.7)"}),i.innerHTML=e.icon;let o=i.querySelector("svg");o&&(o.style.width="100%",o.style.height="100%"),n.appendChild(i)}return n.appendChild(t.createTextNode(e.text)),n}function Yo(t,e,n){return typeof t.animate=="function"?t.animate(e,n):null}function Vn(t,e){let n=t.ownerDocument?.defaultView;if(!n)return;let i=n.getComputedStyle(t),o=u=>Number.parseFloat(u)||0,r=t.offsetLeft+o(i.borderLeftWidth)+o(i.paddingLeft),s=t.offsetTop+o(i.borderTopWidth)+o(i.paddingTop),a=t.clientWidth-o(i.paddingLeft)-o(i.paddingRight),l=t.offsetParent instanceof HTMLElement?t.offsetParent.clientWidth-r:0,c=Math.max(a,l);e.style.left=`${r}px`,e.style.top=`${s}px`,c>0&&(e.style.maxWidth=`${c}px`),e.style.font=i.font,e.style.lineHeight=i.lineHeight,e.style.letterSpacing=i.letterSpacing,e.style.fontWeight="var(--aia-hint-font-weight, 300)"}function el(t,e,n,i){let{el:o}=t,r=o.ownerDocument,s=new Map;for(let p of Array.from(o.children))p.dataset.leaving===void 0&&p.dataset.key&&s.set(p.dataset.key,p);let a=new Map;for(let[p,m]of s)a.set(p,m.offsetLeft);let l=new Set(e.map(p=>p.key));for(let[p,m]of s){if(l.has(p))continue;if(!n){m.remove();continue}m.dataset.leaving="",m.style.position="absolute",m.style.left=`${a.get(p)??0}px`,m.style.top=`${m.offsetTop}px`;let g=Yo(m,[{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:om,easing:Qo,fill:"forwards"});g?g.onfinish=()=>m.remove():m.remove()}let c=Array.from(o.children).filter(p=>p.dataset.leaving!==void 0),u=[];if(e.forEach((p,m)=>{m>0&&u.push(r.createTextNode(" ")),u.push(s.get(p.key)??lm(r,p))}),o.replaceChildren(...u,...c),!n)return;let d=new Map;for(let p of u)p instanceof HTMLElement&&p.dataset.key&&d.set(p.dataset.key,p);let f=0;for(let p of e){let m=d.get(p.key);if(m)if(!s.has(p.key))Yo(m,[{opacity:0,filter:"blur(2px)"},{opacity:1,filter:"blur(0)"}],{duration:rm,delay:i?80*f++:180+60*f++,easing:Qo,fill:"backwards"});else{let b=(a.get(p.key)??m.offsetLeft)-m.offsetLeft;Math.abs(b)>.5&&Yo(m,[{transform:`translateX(${b}px)`},{transform:"none"}],{duration:sm,easing:Qo})}}}function Un(t){let e=$n.get(t);e&&(e.timer!==null&&clearInterval(e.timer),e.resize?.disconnect(),e.el.remove(),$n.delete(t),t.removeAttribute(Xo),t.removeAttribute("aria-placeholder"))}function il(t,e,n,i){let o=i.filter(m=>m.text.trim()!=="").slice(0,nm),r=t.parentElement;if(!e||o.length<2||!r){Un(t);return}let s=`${n}\0${o.map(m=>`${m.text}${m.icon_svg??""}`).join("\0")}`,a=$n.get(t);if(a&&a.key===s&&a.el.isConnected){Vn(t,a.el);return}Un(t);let l=t.ownerDocument,c=l.createElement("span");c.className=jo,c.setAttribute(nl,""),c.setAttribute("aria-hidden","true"),Object.assign(c.style,im),r.insertBefore(c,t),t.setAttribute(Xo,""),n.trim()&&t.setAttribute("aria-placeholder",n.trim()),Vn(t,c);let u=l.defaultView,d=u?.ResizeObserver?new u.ResizeObserver(()=>{c.isConnected&&Vn(t,c)}):null;d?.observe(r);let f=am(t),p={key:s,lead:n,options:o,index:0,el:c,timer:null,resize:d};$n.set(t,p),el(p,Za(o[0],n),!f,!0),!f&&(p.timer=setInterval(()=>{if(!t.isConnected||!c.isConnected){Un(t);return}t.ownerDocument?.hidden||(p.index=(p.index+1)%p.options.length,Vn(t,c),el(p,Za(p.options[p.index],p.lead),!0,!1))},tl))}function Jo(t){Un(t)}function Zo(t){return(t.find(n=>n.type?.kind!=="traditional_autocomplete")?.options??[]).filter(n=>n.is_tappable!==!1).map(n=>({text:n.text,icon_svg:n.icon_svg}))}var cm=6,um=.3;function ol(t){return t<=0?"0px":`${(-Math.min(um,2*cm/t)).toFixed(3)}px`}var rl=new Map;function dm(t,e,n){let i=rl.get(e);if(i!==void 0){t.style.setProperty("--aia-chip-image-fit",i),t.setAttribute("data-aia-image-loaded","");return}let o=n.createElement("img");o.setAttribute("referrerpolicy","no-referrer"),o.onload=()=>{if(!t.isConnected)return;t.setAttribute("data-aia-image-loaded","");let r=t.getBoundingClientRect().height,s=Number.parseFloat(getComputedStyle(t).fontSize);if(!(r>0&&s>0&&o.naturalWidth>0&&o.naturalHeight>0))return;let a=`${(r/s*(o.naturalWidth/o.naturalHeight)).toFixed(3)}em`;rl.set(e,a),t.style.setProperty("--aia-chip-image-fit",a)},o.src=e}function tr(t){pm(t),mm(t.input,t.blockingParamIds??[])}function mm(t,e){for(let n of t.querySelectorAll("strong[data-param-id]")){let i=n.dataset.paramId??"",o=e.includes(i);n.classList.toggle("magicx-aia-segment--blocking",o);let r=Array.from(n.children),s=r.find(l=>l.hasAttribute("data-aia-blocking-remove"));if(!o){s?.remove();continue}if(r.some(l=>l.hasAttribute("data-aia-chip-remove")))continue;let a=er(N(t),i);a.dataset.aiaBlockingRemove="",n.appendChild(a)}}function pm(t){let{input:e,segments:n,newParamId:i,editingParamId:o,placeholderText:r}=t,s=t.showChipIcons??!0,a=t.showChipImages??!0,l=t.showChipRemove??!1,c=n.length===0;e.dataset.aiaEmpty=c?"true":"false",Vs(e,c?r:""),il(e,c,r,t.hintOptions??[]);let u=n.map(y=>y.type==="completed"?`${y.type}:${y.value}${s?y.param.icon??y.param.icon_svg??"":""}${a?Oe(y.param.image_url)??"":""}${l?"x":""}`:y.type==="identified"?`${y.type}:${y.value}${y.param.id}${l?"x":""}`:`${y.type}:${y.value}`).join("\0"),d=e.dataset.segKey??"",f=e.dataset.newParamId??"",p=e.dataset.editingParamId??"";if(u===d&&(i??"")===f&&(o??"")===p)return;if(u===d){e.dataset.newParamId=i??"",e.dataset.editingParamId=o??"";for(let y of e.querySelectorAll("strong[data-param-id]")){let h=y.dataset.paramId,x=y.dataset.seg==="completed"&&h===i;y.classList.toggle("magicx-aia-shimmer-revealed",x),y.classList.toggle("magicx-aia-shimmer-sweep",x),y.classList.toggle("magicx-aia-segment--editing",h===o)}return}let m=e.getAttribute("data-aia-composing")==="true"?fm(e,n):null;if(m==="unsafe")return;let g=os(e),b=g&&!m?Y(e):null;e.dataset.segKey=u,e.dataset.newParamId=i??"",e.dataset.editingParamId=o??"";let T=N(e),S=T.createDocumentFragment(),E=0;for(let y of n)if(E+=y.value.length,y.type==="completed"){let h=T.createElement("strong");h.dataset.seg="completed",h.dataset.paramId=y.param.id;let x=y.param.id===i,P=y.param.id===o,v=["magicx-aia-segment","magicx-aia-segment--completed"];x&&v.push("magicx-aia-shimmer-revealed","magicx-aia-shimmer-sweep"),P&&v.push("magicx-aia-segment--editing"),h.className=v.join(" "),h.style.letterSpacing=ol(y.value.length);let L=a?Oe(y.param.image_url):null;if(L){let I=T.createElement("span");I.className="magicx-aia-segment-image",I.setAttribute("contenteditable","false"),I.setAttribute("aria-hidden","true"),I.style.setProperty("--aia-chip-image",`url("${L}")`),dm(I,L,T),h.appendChild(I),h.dataset.aiaImage=""}let O=!L&&s&&y.param.icon_svg?ce(y.param.icon_svg):null;if(O){let I=T.createElement("span");I.className="magicx-aia-segment-icon",I.setAttribute("contenteditable","false"),I.setAttribute("aria-hidden","true"),I.innerHTML=O,h.appendChild(I),y.param.icon&&(h.dataset.aiaIcon=y.param.icon)}h.appendChild(T.createTextNode(y.value)),l&&h.appendChild(er(T,y.param.id)),S.appendChild(h)}else if(y.type==="identified"){let h=T.createElement("strong");h.dataset.seg="identified",h.dataset.paramId=y.param.id;let x=["magicx-aia-segment","magicx-aia-segment--completed"];y.param.id===o&&x.push("magicx-aia-segment--editing"),h.className=x.join(" "),h.style.letterSpacing=ol(y.value.length),h.textContent=y.value,l&&h.appendChild(er(T,y.param.id)),S.appendChild(h)}else S.appendChild(T.createTextNode(y.value));if(m){m.node.deleteData(0,m.node.data.length-m.syllable.length);for(let y of Array.from(e.childNodes))y!==m.node&&y.remove();e.insertBefore(S,m.node),e.dataset.aiaTextLength=String(E+m.syllable.length);return}e.replaceChildren(S),e.dataset.aiaTextLength=String(E),b!=null?W(e,Math.max(0,Math.min(b,E))):g&&W(e,E)}function fm(t,e){let n=e.map(s=>s.value).join(""),i=Fe(t);if(i===n)return null;if(!i.startsWith(n))return"unsafe";let o=i.slice(n.length),r=t.lastChild;return r?.nodeType!==Node.TEXT_NODE||!r.data.endsWith(o)?"unsafe":{node:r,syllable:o}}function er(t,e){let n=t.createElement("span");return n.className="magicx-aia-segment-remove",n.setAttribute("contenteditable","false"),n.setAttribute("aria-hidden","true"),n.dataset.aiaChipRemove=e,n.innerHTML='<svg viewBox="0 0 10 10" aria-hidden="true"><path d="M2.5 2.5l5 5M7.5 2.5l-5 5"/></svg>',n}var gm='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" role="img" aria-label="Submit"><path d="M9 14V4M9 4L4 9M9 4L14 9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';function sl(t=_()){let e=document.createElement("button");return e.type="button",e.className="magicx-aia-submit",e.setAttribute("aria-label",t.submit),e.setAttribute("data-aia-submit",""),e.innerHTML=gm.replace('aria-label="Submit"',`aria-label="${t.submit}"`),e}function al(t){let e=t.store.get();return(!!e.text||e.completedParams.length>0)&&!!t.onSubmit}function hm(){let t=document.createElement("div");return t.setAttribute("contenteditable","plaintext-only"),t.contentEditable==="plaintext-only"}function ll(t,e){let n=e.firstElementChild;if(!n){e.removeAttribute("data-aia-pill-wrapped");return}let i=n.getBoundingClientRect(),o=t.getBoundingClientRect();i.top>=o.bottom-2?e.setAttribute("data-aia-pill-wrapped",""):e.removeAttribute("data-aia-pill-wrapped")}function cl(t,e){let{listboxId:n}=e,i=Wn(n);t.appendChild(i);let o=document.createElement("div");o.className="magicx-aia-input-wrapper",o.setAttribute("data-aia-input-wrapper",""),t.appendChild(o);let r=document.createElement("div");r.className="magicx-aia-editor",r.setAttribute("data-aia-editor",""),o.appendChild(r);let s=document.createElement("div");s.className="magicx-aia-input",s.setAttribute("data-aia-input",""),s.setAttribute("contenteditable",hm()?"plaintext-only":"true"),s.setAttribute("role","combobox"),s.setAttribute("aria-autocomplete","list"),s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-controls",n),s.setAttribute("aria-expanded","false"),s.setAttribute("spellcheck","true"),s.setAttribute("enterkeyhint","send"),r.appendChild(s);let a=document.createElement("span");a.className="magicx-aia-pill-list-container",a.setAttribute("data-aia-pill-list-container",""),r.appendChild(a);let l=null,c=null;e.submitButton===void 0?(l=sl(e.strings),o.appendChild(l),c=l):e.submitButton!==null&&(c=e.submitButton,c.hasAttribute("data-aia-submit")||c.setAttribute("data-aia-submit",""),c.setAttribute("data-aia-submit-slot",""),o.appendChild(c));let u=new AbortController,{signal:d}=u,f=!1,p=0,m=()=>{let h=Fe(s);return h.length>0&&h[0]!==h[0].toUpperCase()?h[0].toUpperCase()+h.slice(1):h},g=()=>e.handleChange(m()),b=()=>{let h=Q(s)?.node??null;if(!h||!s.contains(h))return null;let v=(h.nodeType===Node.ELEMENT_NODE?h:h.parentElement)?.closest("strong[data-param-id]")?.dataset.paramId??null;return v&&is(s,v)?null:v};o.addEventListener("click",h=>{h.target?.closest("[data-aia-pill]")||s.getRootNode().activeElement?.closest("[data-aia-location]")||bi(s)},{signal:d});let T=null,S=h=>{let x=(e.showChipRemove??!1)||h;x!==(T!==null)&&(T?.(),T=x?Ko(s,P=>e.removeParam(P)):null)};if(S(!1),d.addEventListener("abort",()=>{T?.(),T=null}),s.addEventListener("input",()=>{if(f){e.handleCompositionText(m());return}p=performance.now(),g(),e.handleCaretAfterInput(Y(s))},{signal:d}),N(s).addEventListener("selectionchange",()=>{let h=Q(s);if(!h||!s.contains(h.node))return;let x=h.collapsed?b():null,P=e.store.get(),v=P.editingParam?.id??P.editingIdentified?.id??null;if(x&&x!==v){e.startEditingParam(x);return}performance.now()-p<50||e.handleCaretMove(Y(s))},{signal:d}),s.addEventListener("click",h=>{let x=di(s,h.target);x&&(e.startEditingParam(x),mi(s,x))},{signal:d}),s.addEventListener("compositionstart",()=>{f=!0,s.setAttribute("data-aia-composing","true")},{signal:d}),s.addEventListener("compositionend",()=>{f=!1,s.removeAttribute("data-aia-composing"),g()},{signal:d}),s.addEventListener("beforeinput",h=>{let x=h,P=x.inputType;if(P==="insertParagraph"||P==="insertLineBreak"||P==="insertFromDrop"){h.preventDefault();return}if(P.startsWith("insert")||P.startsWith("delete")){let v=P.startsWith("delete")?"":x.data??"";e.replaceEditingRange(v)&&h.preventDefault()}},{signal:d}),s.addEventListener("paste",h=>{h.preventDefault();let x=(h.clipboardData?.getData("text/plain")??"").replace(/\r?\n/g," ");if(!x)return;let P=N(s),v=Ce(s);if(!v||!s.contains(v.startContainer))return;v.deleteContents();let L=P.createTextNode(x);v.insertNode(L),v.setStartAfter(L),ft(s,v.startContainer,v.startOffset),g()},{signal:d}),s.addEventListener("keydown",h=>e.handleKeyDown(h),{signal:d}),s.addEventListener("focus",()=>e.store.set({isFocused:!0}),{signal:d}),s.addEventListener("blur",()=>e.store.set({isFocused:!1}),{signal:d}),c&&c.addEventListener("click",h=>{al(e)&&(h.stopPropagation(),e.submit?.())},{signal:d}),e.autoFocus!==!1){s.focus();let h=Q(s);(!h||!s.contains(h.node))&&ft(s,s,0)}if(typeof ResizeObserver<"u"){let h=new ResizeObserver(()=>ll(s,a));h.observe(s),u.signal.addEventListener("abort",()=>h.disconnect(),{once:!0})}let y=zo(r);return u.signal.addEventListener("abort",y,{once:!0}),{input:s,inlinePillContainer:a,dropdown:i,submitButton:l,submitTarget:c,abort:u,syncChipRemove:S}}function nr(t,e,n){let{input:i,inlinePillContainer:o,dropdown:r,submitButton:s}=t,{pillPlacement:a,setActivePill:l,selectOption:c,store:u}=n;t.syncChipRemove(e.blockingChips.length>0),i.setAttribute("aria-expanded",String(e.isDropdownOpen));let d=e.activeDropdownIndex>=0?`${n.listboxId}-option-${e.activeDropdownIndex}`:"";if(d?i.setAttribute("aria-activedescendant",d):i.removeAttribute("aria-activedescendant"),s){let T=n.strings??_();s.getAttribute("aria-label")!==T.submit&&s.setAttribute("aria-label",T.submit);let S=s.querySelector("svg");S&&S.getAttribute("aria-label")!==T.submit&&S.setAttribute("aria-label",T.submit);let E=!!e.text||e.completedParams.length>0;s.disabled=!E,s.toggleAttribute("data-aia-ready",E&&e.isReady)}t.submitTarget&&Ye(t.submitTarget,"data-aia-submit-state",e.isSubmitting);let f=i.dataset.newParamId??"",p=e.newParamId!==null&&e.newParamId!==f;if(tr({input:i,segments:e.segments,newParamId:e.newParamId,editingParamId:e.editingParam?.id??null,placeholderText:e.placeholderText,isFocused:e.isFocused,showChipIcons:n.showChipIcons??!0,showChipImages:n.showChipImages??!0,hintOptions:a==="inline"?[]:Zo(e.actionableSuggestions),showChipRemove:n.showChipRemove??!1,blockingParamIds:e.blockingChips.map(T=>T.paramId)}),a==="inline"){let T=e.isLoading&&!e.editingParam&&!e.inSelectionAnimation,S=ii(e.actionableSuggestions);T||S.length>0?An(o,S,0,l,!1,T,e.isActivePillSelected):Io(o)}else Io(o);ll(i,o),p?bt(i,e.caretOffset??e.text.length,ht(n.focusInputOnSelect)):e.isFocused&&Fe(i)!==e.text&&!i.hasAttribute("data-aia-composing")&&W(i,e.text.length);let m=e.editingParam?mt(e.editingParam):e.editingIdentified?{parameter:e.editingIdentified.parameter,text:se(e.editingIdentified.parameter),required:!0,options:[]}:null,g=e.dropdownSuggestion??m??e.actionableSuggestions[0],b=wt(e);Bn(r,{strings:n.strings,suggestions:g?[{...g,options:e.dropdownOptions}]:[],filteredOptions:e.dropdownOptions,activeIndex:e.activeDropdownIndex,isOpen:e.isDropdownOpen,isLoading:e.dropdownLoading,skeletonExiting:e.skeletonExiting,listboxId:n.listboxId,pills:It(e.dropdownSuggestion,m,e.actionableSuggestions),showPills:a==="dropdown",showSkipButton:n.showSkipButton&&!e.editingParam&&!e.editingIdentified,skipDisabled:e.inSelectionAnimation,showOptionIcons:n.showOptionIcons??!0,showOptionImages:n.showOptionImages??!0,showOptionCounts:n.showOptionCounts??!0,isActivePillSelected:e.isActivePillSelected,isInputEmpty:e.text.trim().length===0,products:e.products,productsLayout:n.productsLayout??"row",productImageFallback:n.productImageFallback??"image",showProductVendor:n.showProductVendor??!0,onProductAddToCart:n.addProductToCart,formatType:e.activeFormatType,dateView:e.dateView,selectedDateIso:b.selectedIso,selectedDateRange:b.selectedRange,dateRangeStart:b.rangeStart,dateReferences:b.references,timeView:e.timeView,multiSelectView:e.dropdownMultiSelect,locationView:e.locationView,isReediting:e.editingParam!=null,isFocused:e.isFocused||e.locationFieldFocused,optionsPosition:n.optionsPosition??"below",onSelect:c,onHighlight:(T,S)=>{S!==void 0&&u.get().activeDropdownIndex!==S||u.set({activeDropdownIndex:T,highlightByPointer:T>=0})},onPillClick:l,onSkip:n.skipActivePill,onPreviousMonth:n.showPreviousMonth,onNextMonth:n.showNextMonth,onTimeChange:n.setTime,onTimeCommit:n.commitTime,onMultiSelectCommit:n.commitMultiSelect,onLocationQuery:n.setLocationQuery,onLocationMove:n.moveLocationHighlight,onLocationCommit:n.commitLocation,onLocationFocusChange:n.setLocationFieldFocused,onProductSelect:n.selectProduct,onProductFocusChange:T=>u.set({isFocused:T}),seeAllBusy:e.isSubmitting,busyProductId:e.selectingProductId,onSeeAllResults:n.seeAllResults&&e.text.trim().length>0&&al(n)?()=>n.submit?.():void 0,fullWidth:n.seeAllResults===!0})}function ir(t){let e=t,n=new Set,i=[],o=!1;return{get:()=>e,set:r=>{let s=typeof r=="function"?r(e):r,a=e;if(e={...e,...s},i.push([e,a]),!o){o=!0;try{let l=0;for(let c=i.shift();c;c=i.shift()){if(++l>1e4)throw i.length=0,new Error("createStore: notifications did not settle after 10000 deliveries \u2014 a listener is likely calling set() on every notification");let[u,d]=c;for(let f of n)f(u,d)}}catch(l){throw i.length=0,l}finally{o=!1}}},subscribe:r=>(n.add(r),()=>{n.delete(r)})}}function ul(t,e){let n,i,o=r=>(r!==n&&(n=r,i=e(r)),i);return{get:()=>{let r=t.get();return{...r,...o(r)}},set:r=>{typeof r=="function"?t.set(s=>{let a={...s,...o(s)};return r(a)}):t.set(r)},peek:r=>{let s={...t.get(),...r};return{...s,...e(s)}},subscribe:r=>t.subscribe((s,a)=>{let l={...a,...o(a)},c={...s,...o(s)};r(c,l)})}}var or=new WeakSet,dl=new WeakMap;function pl(t){return t.nodeType===Node.DOCUMENT_NODE}function bm(t){return pl(t)?t:t.ownerDocument}function ym(t){let e=dl.get(t);if(e)return e;let n=t.defaultView?.CSSStyleSheet;if(typeof n!="function")return null;try{let i=new n;return typeof i.replaceSync!="function"?null:(i.replaceSync(gl),dl.set(t,i),i)}catch{return null}}function ml(t,e){if(e.querySelector("style[data-magicx-aia]"))return;let n=t.createElement("style");n.setAttribute("data-magicx-aia",""),n.textContent=gl,e.appendChild(n)}function fl(t){if(typeof document>"u")return;let e=t??document;if(or.has(e))return;let n=bm(e);if(pl(e)){let r=e.head??e.documentElement;if(!r)return;ml(n,r),or.add(e);return}let i=ym(n),o=e.adoptedStyleSheets;i&&Array.isArray(o)?o.includes(i)||(e.adoptedStyleSheets=[...o,i]):ml(n,e),or.add(e)}var gl=`.aia-stack {
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: var(--aia-stack-space, 0.5rem);
@@ -275,28 +275,6 @@ function H(t){return t==="date"||t==="date-range"}function F(t){return t!=="opti
275
275
  background: var(--aia-completed-pill-bg-active, rgba(189, 189, 189, 0.35));
276
276
  }
277
277
 
278
- /* A chip whose removal finds items when the search found none (custom_fields.blocking_filters).
279
- Greyed out at half opacity. After the hover rule, so it stays greyed while pointed at. */
280
- :where(.magicx-aia-input) strong.magicx-aia-segment--blocking {
281
- opacity: var(--aia-blocking-chip-opacity, 0.5);
282
- }
283
-
284
- /* The \xD7 of a greyed chip keeps its normal weight: its opacity multiplies with the chip's, so it is divided back out. */
285
- :where(.magicx-aia-input) strong.magicx-aia-segment--blocking span.magicx-aia-segment-remove {
286
- opacity: calc(var(--aia-chip-remove-opacity, 0.32) / var(--aia-blocking-chip-opacity, 0.5));
287
- }
288
-
289
- @media (hover: hover) {
290
- :where(.magicx-aia-input)
291
- strong.magicx-aia-segment--blocking
292
- span.magicx-aia-segment-remove:hover {
293
- opacity: calc(
294
- var(--aia-chip-remove-opacity-hover, 0.7) /
295
- var(--aia-blocking-chip-opacity, 0.5)
296
- );
297
- }
298
- }
299
-
300
278
  /* The picked option's icon inside a completed chip (see \`icon_svg\` on
301
279
  CompletedParamState). Inline-block, one em square and sat on the text
302
280
  baseline; the chip is one inline-block, so the icon never ends a line
@@ -2925,7 +2903,17 @@ function H(t){return t==="date"||t==="date-range"}function F(t){return t!=="opti
2925
2903
  flex: 0 0 18px;
2926
2904
  width: 18px;
2927
2905
  height: 18px;
2928
- border: 1px solid var(--aia-border);
2906
+ /* Its own border, not the dropdown's: stores often set --aia-border
2907
+ faint or transparent, which left the box visible only on hover. */
2908
+ border: 1.5px solid
2909
+ var(
2910
+ --aia-checkbox-border,
2911
+ color-mix(
2912
+ in srgb,
2913
+ var(--aia-option-color, var(--aia-color-text-default, #262626)) 65%,
2914
+ transparent
2915
+ )
2916
+ );
2929
2917
  border-radius: 6px;
2930
2918
  background: var(--aia-surface);
2931
2919
  color: transparent;