@magicx-eng/ai-autocomplete-react 0.64.0 → 0.65.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
- import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END as Is,DATE_RANGE_META_START as As,DEFAULT_OPTION_COUNT_UNIT as Es,dateCellMarks as zs,formatDate as Rs,formatDateRange as Os,formatOptionCount as Ls,formatPlace as Ds,formatTime as Ms,isoDate as Ns,LOCATION_META_KEY as Hs,monthLabel as Fs,optionCountLabel as Bs,optionHasImage as Ws,optionImageSources as Gs,optionImageSrc as Ks,optionLabel as qs,optionsShowLeadingVisuals as Vs,PRODUCT_PATH_PREFIX as _s,parseDate as Us,parseLooseDate as Qs,parseLooseDateRange as Ys,parseTime as js,productFromMatchedItem as $s,productImageSources as Zs,productsFromCustomFields as Xs,sanitizeOptionIconSvg as Js,selectedRangeFor as el,TIME_META_KEY as tl,visibleDateRange as al,WEEKDAY_LABELS as il,withSkippedParams as ol}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as dn,useCallback as zt,useEffect as Qt,useImperativeHandle as cn,useLayoutEffect as pn,useRef as ct}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
1
+ import{buildSubmitResult as Ts,cellDay as Ps,cellIso as Is,DATE_RANGE_META_END as As,DATE_RANGE_META_START as Es,DEFAULT_OPTION_COUNT_UNIT as zs,dateCellMarks as Rs,formatDate as Os,formatDateRange as Ls,formatOptionCount as Ds,formatPlace as Ms,formatTime as Ns,isoDate as Hs,LOCATION_META_KEY as Fs,monthLabel as Bs,optionCountLabel as Ws,optionHasImage as Gs,optionImageSources as Ks,optionImageSrc as qs,optionLabel as Vs,optionsShowLeadingVisuals as _s,PRODUCT_PATH_PREFIX as Us,parseDate as Qs,parseLooseDate as Ys,parseLooseDateRange as js,parseTime as $s,productFromMatchedItem as Zs,productImageSources as Xs,productsFromCustomFields as Js,sanitizeOptionIconSvg as el,selectedRangeFor as tl,TIME_META_KEY as al,visibleDateRange as il,WEEKDAY_LABELS as ol,withSkippedParams as nl}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as cn,useCallback as zt,useEffect as Ut,useImperativeHandle as pn,useLayoutEffect as hn,useRef as pt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
2
2
  position: relative;
3
3
  /* Inherits the host page's font by default. Consumers can pin a specific
4
4
  font on the library via \`--aia-font-family: 'Custom Font'\` without
@@ -439,7 +439,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
439
439
  transition: none;
440
440
  }
441
441
  }
442
- `,document.head.appendChild(e)}var Ye={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};import{attachScrollArrow as fo,attachViewportFit as bo,containScroll as wo,dateFloorFor as vo,destroyPanelMorph as xo,findMultiSelectDone as yo,fitMultiSelectDone as ko,hasSkippablePill as So,isCalendarFormat as Co,labelTraditionalAutocomplete as To,panelMorphKey as Po,queryLive as Io,settlePanelMorph as Ao,syncPanelHug as Eo,uiStringsFor as zo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as $e,useLayoutEffect as Kt,useRef as st,useState as Ro}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
442
+ `,document.head.appendChild(e)}var Ye={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};import{attachScrollArrow as bo,attachViewportFit as wo,containScroll as vo,dateFloorFor as xo,destroyPanelMorph as yo,findMultiSelectDone as ko,fitMultiSelectDone as So,hasSkippablePill as Co,isCalendarFormat as To,labelTraditionalAutocomplete as Po,panelMorphKey as Io,queryLive as Ao,settlePanelMorph as Eo,syncPanelHug as zo,uiStringsFor as Ro}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as $e,useLayoutEffect as Gt,useRef as lt,useState as Oo}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
443
443
  * Built-in appearance defaults \u2014 zero specificity via :where().
444
444
  * Consumer CSS always wins without !important.
445
445
  *
@@ -1811,7 +1811,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
1811
1811
  opacity: 1;
1812
1812
  }
1813
1813
  }
1814
- `,document.head.appendChild(e)}var pe={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",seeAllSpin:"aia-seeAllSpin-jlsZP",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as Za,cellIso as wt,dateCellMarks as Xa,isDimmedDay as Ja,isoDate as ei,monthLabel as ti,visibleDateRange as ai,WEEKDAY_LABELS as ii}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as oi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1814
+ `,document.head.appendChild(e)}var pe={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",seeAllSpin:"aia-seeAllSpin-jlsZP",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as Xa,cellIso as vt,dateCellMarks as Ja,isDimmedDay as ei,isoDate as ti,monthLabel as ai,visibleDateRange as ii,WEEKDAY_LABELS as oi}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as ni}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1815
1815
 
1816
1816
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1817
1817
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -2008,7 +2008,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
2008
2008
  opacity: 0.8;
2009
2009
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
2010
2010
  }
2011
- `,document.head.appendChild(e)}var K={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};import{jsx as Se,jsxs as ia}from"react/jsx-runtime";var ni=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function oa({options:e,activeIndex:n,listboxId:t,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:d,onPreviousMonth:w,onNextMonth:v}){let x=ei(new Date),m=ai({pendingStart:o.rangeStart,highlightedIso:wt(e[n]),selected:o.selectedRange,floor:o.floor});return ia("div",{className:K.datepicker,"data-aia-datepicker":"",children:[ia("div",{className:K.header,children:[Se("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:w,children:"\u2039"}),Se("span",{className:K.month,"data-aia-date-month":"","aria-live":"polite",children:ti(i)}),Se("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:v,children:"\u203A"})]}),Se("div",{className:K.weekdays,"aria-hidden":"true",children:ii.map((p,h)=>Se("span",{className:K.weekday,children:p},ni[h]))}),Se("div",{className:K.grid,"data-aia-date-grid":"",children:e.map((p,h)=>Se(ri,{option:p,id:`${t}-option-${h}`,index:h,isHighlighted:h===n&&p.is_tappable,isToday:wt(p)===x,isPast:Ja(wt(p),x,o.floor),marks:Xa(wt(p),{selectedIso:o.selectedIso,range:m,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:d},wt(p)??`pad-${h}`))})]})}function ri({option:e,id:n,index:t,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:d,onHighlight:w,onUnhighlight:v}){let[x,m]=oi(!1),p=Za(e);if(p==null)return Se("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${K.cell} ${K.blank}`});let h=()=>{m(!0),d(e),setTimeout(()=>m(!1),170)},y=[K.cell,K.day,s?K.past:"",i?K.highlighted:"",o?K.today:"",r.inRange?K.inRange:"",r.selected?K.selected:"",r.reference?K.reference:"",x?K.pressed:""].filter(Boolean).join(" ");return Se("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:y,onClick:h,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),h())},onMouseEnter:()=>w(t),onMouseLeave:v?()=>v(t):void 0,children:Se("span",{className:K.number,children:p})})}import{ATTRIBUTION_URL as si,buildAttributionUrl as li,getFooterHint as di,uiStringsFor as ci}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as pi,useState as hi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
2011
+ `,document.head.appendChild(e)}var K={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};import{jsx as Se,jsxs as ia}from"react/jsx-runtime";var ri=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function oa({options:e,activeIndex:n,listboxId:t,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:d,onPreviousMonth:w,onNextMonth:v}){let x=ti(new Date),m=ii({pendingStart:o.rangeStart,highlightedIso:vt(e[n]),selected:o.selectedRange,floor:o.floor});return ia("div",{className:K.datepicker,"data-aia-datepicker":"",children:[ia("div",{className:K.header,children:[Se("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:w,children:"\u2039"}),Se("span",{className:K.month,"data-aia-date-month":"","aria-live":"polite",children:ai(i)}),Se("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:v,children:"\u203A"})]}),Se("div",{className:K.weekdays,"aria-hidden":"true",children:oi.map((p,h)=>Se("span",{className:K.weekday,children:p},ri[h]))}),Se("div",{className:K.grid,"data-aia-date-grid":"",children:e.map((p,h)=>Se(si,{option:p,id:`${t}-option-${h}`,index:h,isHighlighted:h===n&&p.is_tappable,isToday:vt(p)===x,isPast:ei(vt(p),x,o.floor),marks:Ja(vt(p),{selectedIso:o.selectedIso,range:m,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:d},vt(p)??`pad-${h}`))})]})}function si({option:e,id:n,index:t,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:d,onHighlight:w,onUnhighlight:v}){let[x,m]=ni(!1),p=Xa(e);if(p==null)return Se("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${K.cell} ${K.blank}`});let h=()=>{m(!0),d(e),setTimeout(()=>m(!1),170)},y=[K.cell,K.day,s?K.past:"",i?K.highlighted:"",o?K.today:"",r.inRange?K.inRange:"",r.selected?K.selected:"",r.reference?K.reference:"",x?K.pressed:""].filter(Boolean).join(" ");return Se("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:y,onClick:h,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),h())},onMouseEnter:()=>w(t),onMouseLeave:v?()=>v(t):void 0,children:Se("span",{className:K.number,children:p})})}import{ATTRIBUTION_URL as li,buildAttributionUrl as di,getFooterHint as ci,uiStringsFor as pi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as hi,useState as ui}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
2012
2012
  display: flex;
2013
2013
  flex-wrap: wrap;
2014
2014
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -2048,7 +2048,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
2048
2048
  .aia-cluster[data-justify="around"] {
2049
2049
  justify-content: space-around;
2050
2050
  }
2051
- `,document.head.appendChild(e)}import{jsx as na}from"react/jsx-runtime";function vt({gap:e,align:n="center",justify:t="start",noWrap:i=!1,inline:o=!1,className:s,children:r,...d}){let w=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":n,"data-justify":t,"data-nowrap":i||void 0,"data-inline":o||void 0,style:w,...d};return o?na("span",{...v,children:r}):na("div",{...v,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
2051
+ `,document.head.appendChild(e)}import{jsx as na}from"react/jsx-runtime";function xt({gap:e,align:n="center",justify:t="start",noWrap:i=!1,inline:o=!1,className:s,children:r,...d}){let w=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":n,"data-justify":t,"data-nowrap":i||void 0,"data-inline":o||void 0,style:w,...d};return o?na("span",{...v,children:r}):na("div",{...v,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
2052
2052
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
2053
2053
  room above the hint/branding row so the footer doesn't butt against the last
2054
2054
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -2174,6 +2174,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
2174
2174
  .aia-badge-Fk9vg {
2175
2175
  display: inline-flex;
2176
2176
  align-items: center;
2177
+ white-space: nowrap;
2177
2178
  height: var(--aia-footer-row-height, 23px);
2178
2179
  padding: 2.5px 5.5px;
2179
2180
  border: 0.5px solid var(--aia-footer-badge-border, rgba(189, 189, 189, 0.51));
@@ -2195,7 +2196,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
2195
2196
  justify-content: flex-end;
2196
2197
  }
2197
2198
  }
2198
- `,document.head.appendChild(e)}var Le={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};import{jsx as xt,jsxs as Lt}from"react/jsx-runtime";function ra({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:t=ci()}){let{key:i,hint:o}=di(e,n,t),[s,r]=hi(si);return pi(()=>{r(li())},[]),xt("footer",{className:Le.footer,"data-aia-footer":"",children:Lt(vt,{justify:"between",noWrap:!0,className:Le.row,children:[Lt(vt,{gap:"5px",className:Le.hintGroup,children:[xt("kbd",{className:Le.key,children:i}),xt("span",{className:Le.hint,children:o})]}),Lt("a",{className:Le.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[xt("span",{className:Le.brand,children:"AI"}),xt("span",{className:Le.badge,children:"Autocomplete"})]})]})})}import{useEffect as sa,useLayoutEffect as ui,useRef as he}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
2199
+ `,document.head.appendChild(e)}var Le={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};import{jsx as rt,jsxs as ra}from"react/jsx-runtime";function sa({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:t=pi()}){let{key:i,hint:o}=ci(e,n,t),[s,r]=ui(li);return hi(()=>{r(di())},[]),rt("footer",{className:Le.footer,"data-aia-footer":"",children:ra(xt,{justify:"between",noWrap:!0,className:Le.row,children:[ra(xt,{gap:"5px",className:Le.hintGroup,children:[rt("kbd",{className:Le.key,children:i}),rt("span",{className:Le.hint,children:o})]}),rt("a",{className:Le.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:rt("span",{className:Le.badge,children:rt("span",{className:Le.brand,children:"Powered by Intent-1"})})})]})})}import{useEffect as la,useLayoutEffect as mi,useRef as he}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
2199
2200
  Angular copy). The three are kept identical by
2200
2201
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
2201
2202
  .aia-location-6-fsr {
@@ -2329,7 +2330,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
2329
2330
  .aia-loadingBar-OLCr4:nth-child(3) {
2330
2331
  width: 60%;
2331
2332
  }
2332
- `,document.head.appendChild(e)}var Q={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};import{jsx as se,jsxs as Be}from"react/jsx-runtime";var mi=0;function yt(e){return e.getRootNode().activeElement??null}function ca(e){return e.getRootNode().getSelection?.()??document.getSelection()}function la(e){if(!e.isContentEditable)return null;let n=ca(e);if(!n||n.rangeCount===0)return null;let t=n.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function da(e,n){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=ca(e);if(!t)return;let i=n;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}var gi=Be("svg",{className:Q.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[se("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),se("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),fi=Be("svg",{className:Q.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[se("circle",{cx:"11",cy:"11",r:"7"}),se("path",{d:"m20 20-3.5-3.5"})]});function pa({view:e,searchLabel:n,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:d=!0,onQuery:w,onMove:v,onCommit:x,onFocusChange:m}){let p=he(null),h=he(null),y=he(null),k=he(null),T=he(null),L=he(!1),O=he(!1),X=he(!1),W=he(!1),z=he(o);z.current=o;let N=he(m);N.current=m;let H=c=>{W.current=c,m(c)},G=()=>{let c=p.current;return c!=null&&yt(c)===c},j=()=>{let c=h.current;if(!c)return;let A=yt(c);A instanceof HTMLElement&&A!==p.current&&A!==document.body&&!c.contains(A)&&(k.current=A,T.current=la(A))},E=c=>{let A=h.current;!A||!(c instanceof HTMLElement)||c===k.current||c===document.body||A.contains(c)||(k.current=c,T.current=la(c))},ae=he(null);ae.current===null&&(ae.current=`aia-location-${++mi}`);let ne=`${ae.current}-row-`;sa(()=>{let c=p.current;c&&c.value!==e.query&&yt(c)!==c&&(c.value=e.query)},[e.query]),sa(()=>{o&&(s&&!X.current&&(O.current=!1),X.current=s);let c=p.current;if(c){if(!r&&G()){O.current=!0,V();return}if(!o){setTimeout(()=>{if(z.current)return;let A=k.current;A&&yt(A)===A||(O.current=!1)},0);return}if(!(!s||O.current||!d||G())){if(j(),H(!0),c.focus({preventScroll:!0}),!G()){O.current=!0,H(!1);return}c.value&&c.select()}}}),ui(()=>()=>{if(!W.current)return;let c=p.current,A=k.current;A?.isConnected&&c&&yt(c)===c&&(L.current=!0,da(A,T.current),L.current=!1),W.current=!1,N.current(!1)},[]);let V=(c=!1)=>{c&&(O.current=!0);let A=k.current;A?.isConnected&&G()&&(L.current=!0,da(A,T.current),L.current=!1),H(!1)},ie=e.query.trim(),S=e.highlighted>=0&&e.highlighted<e.places.length?`${ne}${e.highlighted}`:void 0,F=null;return e.places.length>0?F=e.places.map((c,A)=>Be("div",{id:`${ne}${A}`,role:"option","aria-selected":A===e.highlighted,className:A===e.highlighted?`${Q.row} ${Q.highlighted}`:Q.row,"data-aia-location-row":"","data-aia-index":A,onClick:()=>{d&&(V(!0),x(A))},children:[se("span",{className:Q.pin,children:gi}),Be("span",{className:Q.text,children:[se("span",{className:Q.name,children:c.name}),c.secondary&&se("span",{className:Q.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?F=Be("div",{className:Q.loading,"data-aia-location-loading":"",children:[se("span",{className:Q.loadingBar}),se("span",{className:Q.loadingBar}),se("span",{className:Q.loadingBar})]}):ie&&(F=Be("div",{className:Q.note,"data-aia-location-note":"",children:[e.status==="done"&&se("span",{className:Q.empty,children:t}),se("span",{children:i})]})),Be("div",{ref:h,className:Q.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!y.current?.contains(c.target)||(c.stopPropagation(),j(),H(!0))},children:[Be("label",{ref:y,className:Q.field,children:[fi,se("input",{ref:p,type:"text",className:Q.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:n,"aria-label":n,"aria-activedescendant":S,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>w(c.target.value),onFocus:c=>{E(c.relatedTarget),H(!0)},onBlur:()=>{L.current||(O.current=!0,H(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!d)return;V(!0),x();return;case"Escape":c.preventDefault(),c.stopPropagation(),O.current=!0,V();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),O.current=!0,V();return}}})]}),se("div",{className:Q.results,"data-aia-location-results":"","aria-live":"polite",children:F})]})}import{isSmartSuggestion as xi,isTraditionalAutocompleteSuggestion as yi}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as bi}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
2333
+ `,document.head.appendChild(e)}var Q={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};import{jsx as se,jsxs as Be}from"react/jsx-runtime";var gi=0;function yt(e){return e.getRootNode().activeElement??null}function pa(e){return e.getRootNode().getSelection?.()??document.getSelection()}function da(e){if(!e.isContentEditable)return null;let n=pa(e);if(!n||n.rangeCount===0)return null;let t=n.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function ca(e,n){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=pa(e);if(!t)return;let i=n;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}var fi=Be("svg",{className:Q.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[se("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),se("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),bi=Be("svg",{className:Q.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[se("circle",{cx:"11",cy:"11",r:"7"}),se("path",{d:"m20 20-3.5-3.5"})]});function ha({view:e,searchLabel:n,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:d=!0,onQuery:w,onMove:v,onCommit:x,onFocusChange:m}){let p=he(null),h=he(null),y=he(null),k=he(null),T=he(null),L=he(!1),O=he(!1),X=he(!1),W=he(!1),z=he(o);z.current=o;let N=he(m);N.current=m;let H=c=>{W.current=c,m(c)},G=()=>{let c=p.current;return c!=null&&yt(c)===c},j=()=>{let c=h.current;if(!c)return;let A=yt(c);A instanceof HTMLElement&&A!==p.current&&A!==document.body&&!c.contains(A)&&(k.current=A,T.current=da(A))},E=c=>{let A=h.current;!A||!(c instanceof HTMLElement)||c===k.current||c===document.body||A.contains(c)||(k.current=c,T.current=da(c))},ae=he(null);ae.current===null&&(ae.current=`aia-location-${++gi}`);let ne=`${ae.current}-row-`;la(()=>{let c=p.current;c&&c.value!==e.query&&yt(c)!==c&&(c.value=e.query)},[e.query]),la(()=>{o&&(s&&!X.current&&(O.current=!1),X.current=s);let c=p.current;if(c){if(!r&&G()){O.current=!0,V();return}if(!o){setTimeout(()=>{if(z.current)return;let A=k.current;A&&yt(A)===A||(O.current=!1)},0);return}if(!(!s||O.current||!d||G())){if(j(),H(!0),c.focus({preventScroll:!0}),!G()){O.current=!0,H(!1);return}c.value&&c.select()}}}),mi(()=>()=>{if(!W.current)return;let c=p.current,A=k.current;A?.isConnected&&c&&yt(c)===c&&(L.current=!0,ca(A,T.current),L.current=!1),W.current=!1,N.current(!1)},[]);let V=(c=!1)=>{c&&(O.current=!0);let A=k.current;A?.isConnected&&G()&&(L.current=!0,ca(A,T.current),L.current=!1),H(!1)},ie=e.query.trim(),S=e.highlighted>=0&&e.highlighted<e.places.length?`${ne}${e.highlighted}`:void 0,F=null;return e.places.length>0?F=e.places.map((c,A)=>Be("div",{id:`${ne}${A}`,role:"option","aria-selected":A===e.highlighted,className:A===e.highlighted?`${Q.row} ${Q.highlighted}`:Q.row,"data-aia-location-row":"","data-aia-index":A,onClick:()=>{d&&(V(!0),x(A))},children:[se("span",{className:Q.pin,children:fi}),Be("span",{className:Q.text,children:[se("span",{className:Q.name,children:c.name}),c.secondary&&se("span",{className:Q.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?F=Be("div",{className:Q.loading,"data-aia-location-loading":"",children:[se("span",{className:Q.loadingBar}),se("span",{className:Q.loadingBar}),se("span",{className:Q.loadingBar})]}):ie&&(F=Be("div",{className:Q.note,"data-aia-location-note":"",children:[e.status==="done"&&se("span",{className:Q.empty,children:t}),se("span",{children:i})]})),Be("div",{ref:h,className:Q.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!y.current?.contains(c.target)||(c.stopPropagation(),j(),H(!0))},children:[Be("label",{ref:y,className:Q.field,children:[bi,se("input",{ref:p,type:"text",className:Q.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:n,"aria-label":n,"aria-activedescendant":S,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>w(c.target.value),onFocus:c=>{E(c.relatedTarget),H(!0)},onBlur:()=>{L.current||(O.current=!0,H(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!d)return;V(!0),x();return;case"Escape":c.preventDefault(),c.stopPropagation(),O.current=!0,V();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),O.current=!0,V();return}}})]}),se("div",{className:Q.results,"data-aia-location-results":"","aria-live":"polite",children:F})]})}import{isSmartSuggestion as yi,isTraditionalAutocompleteSuggestion as ki}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as wi}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
2333
2334
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
2334
2335
  The border is kept as a 1px transparent line so the box stays the same size
2335
2336
  as it was when the outline was dashed. */
@@ -2487,7 +2488,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
2487
2488
  opacity: 0;
2488
2489
  }
2489
2490
  }
2490
- `,document.head.appendChild(e)}var Ce={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};import{Fragment as wi,jsx as Dt,jsxs as vi}from"react/jsx-runtime";var Mt={selected:1,first:.7,next:.4,last:.2};function ha({label:e,state:n,active:t,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:d}){let w=[Ce.pill,i?Ce.rounded:"",o?Ce.skeleton:""].filter(Boolean).join(" ");return Dt("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:w,style:{"--aia-pill-opacity":Mt[n]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:d,disabled:o,children:s?vi(wi,{children:[Dt("span",{className:`${Ce.smartText} magicx-aia-smart-suggestion-text`,children:e}),Dt("span",{className:`${Ce.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:bi}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
2491
+ `,document.head.appendChild(e)}var Ce={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};import{Fragment as vi,jsx as Lt,jsxs as xi}from"react/jsx-runtime";var Dt={selected:1,first:.7,next:.4,last:.2};function ua({label:e,state:n,active:t,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:d}){let w=[Ce.pill,i?Ce.rounded:"",o?Ce.skeleton:""].filter(Boolean).join(" ");return Lt("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:w,style:{"--aia-pill-opacity":Dt[n]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:d,disabled:o,children:s?xi(vi,{children:[Lt("span",{className:`${Ce.smartText} magicx-aia-smart-suggestion-text`,children:e}),Lt("span",{className:`${Ce.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:wi}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
2491
2492
  position: relative;
2492
2493
  z-index: 1;
2493
2494
  pointer-events: auto;
@@ -2497,7 +2498,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
2497
2498
  align-items: center;
2498
2499
  vertical-align: middle;
2499
2500
  }
2500
- `,document.head.appendChild(e)}var Nt={list:"aia-list-qvLqO"};import{jsx as Ct}from"react/jsx-runtime";var ki=[125,69];function ua(e){return e===0?"first":e===1?"next":"last"}function Tt({pills:e,activePillIndex:n,onSelectPill:t,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?Ct("span",{className:Nt.list,"data-aia-pill-list-loading":"",children:ki.map((r,d)=>Ct("span",{"data-aia-pill-skeleton":"",className:`${Ce.pill} ${o?Ce.rounded:""} ${Ce.skeleton}`,style:{width:r,"--aia-pill-opacity":Mt[ua(d)]}},`skel-${r}`))}):Ct("span",{className:Nt.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,d)=>{let w=!!i&&d===n;return Ct(ha,{label:r.text,state:w?"selected":ua(d),selected:w,active:d===n,rounded:o,loading:s,smartSuggestion:xi(r),completionHeader:yi(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as Si,productImageSources as Ci,productImageSrc as Ti,productInitial as Pi,productPhotoFill as Ii,uiStringsFor as Ai}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ht,useRef as Pt,useState as It}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
2501
+ `,document.head.appendChild(e)}var Mt={list:"aia-list-qvLqO"};import{jsx as Ct}from"react/jsx-runtime";var Si=[125,69];function ma(e){return e===0?"first":e===1?"next":"last"}function Tt({pills:e,activePillIndex:n,onSelectPill:t,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?Ct("span",{className:Mt.list,"data-aia-pill-list-loading":"",children:Si.map((r,d)=>Ct("span",{"data-aia-pill-skeleton":"",className:`${Ce.pill} ${o?Ce.rounded:""} ${Ce.skeleton}`,style:{width:r,"--aia-pill-opacity":Dt[ma(d)]}},`skel-${r}`))}):Ct("span",{className:Mt.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,d)=>{let w=!!i&&d===n;return Ct(ua,{label:r.text,state:w?"selected":ma(d),selected:w,active:d===n,rounded:o,loading:s,smartSuggestion:yi(r),completionHeader:ki(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as Ci,productImageSources as Ti,productImageSrc as Pi,productInitial as Ii,productPhotoFill as Ai,uiStringsFor as Ei}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Nt,useRef as Pt,useState as It}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
2501
2502
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
2502
2503
  theming one package sees the same result in the other.
2503
2504
 
@@ -3124,7 +3125,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
3124
3125
  opacity: 0.01;
3125
3126
  }
3126
3127
  }
3127
- `,document.head.appendChild(e)}var Y={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};import{jsx as oe,jsxs as rt}from"react/jsx-runtime";function ma({products:e,listboxId:n,onSelect:t,busyProductId:i=null,onAddToCart:o,onFocusChange:s,focusable:r=!0,loading:d=!1,layout:w="row",imageFallback:v="image",showVendor:x=!0,strings:m=Ai()}){let p=e.length>0,h=Pt(null);if(Ht(()=>{let k=h.current;if(!(!p||!k))return Si(k)},[p]),!p)return null;let y=`${n}-products-label`;return rt("section",{className:Y.section,"data-aia-products":"","data-aia-loading":d?"":void 0,"data-aia-products-layout":w,role:"group","aria-labelledby":y,children:[oe("div",{className:Y.label,id:y,"data-aia-products-label":"",children:m.products}),oe("div",{ref:h,className:Y.row,"data-aia-products-row":"",children:e.map((k,T)=>oe(Ei,{product:k,id:`${n}-product-${T}`,onSelect:t,busy:k.id===i,onAddToCart:o,onFocusChange:s,focusable:r,imageFallback:v,showVendor:x,soldOut:m.soldOut,addToCart:m.addToCart},k.id))})]})}function Ei({product:e,id:n,onSelect:t,busy:i,onAddToCart:o,onFocusChange:s,focusable:r,imageFallback:d,showVendor:w,soldOut:v,addToCart:x}){let m=!!o&&e.available!==!1,[p,h]=It(null),y=T=>{T.relatedTarget?.closest("[data-aia-dropdown]")||s?.(!1)},k=T=>{T.metaKey||T.ctrlKey||T.shiftKey||T.altKey||T.button!==0||(T.preventDefault(),t(e))};return rt("a",{id:n,className:Y.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":m?"":void 0,"data-aia-product-state":i?"busy":void 0,"aria-busy":i?!0:void 0,role:"option","aria-selected":!1,style:p?{"--aia-product-photo-fill-x":String(p.x),"--aia-product-photo-fill-y":String(p.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:k,onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),t(e))},onFocus:()=>s?.(!0),onBlur:y,children:[oe(Oi,{sources:Ci(e.imageUrl),title:e.title,fallback:d,onPhotoFill:h},Ti(e.imageUrl)??""),rt("span",{className:Y.body,children:[w&&e.vendor?oe("span",{className:Y.vendor,children:e.vendor}):null,oe("span",{className:Y.title,children:e.title}),e.price?rt("span",{className:Y.price,children:[e.price,e.compareAtPrice?oe("s",{className:Y.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?oe("span",{className:Y.badge,children:v}):null]}),m&&o?oe(Ri,{product:e,label:`${x}: ${e.title}`,focusable:r,onAddToCart:o,onFocus:()=>s?.(!0),onBlur:y},zi(e)):null]})}function zi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function Ri({product:e,label:n,focusable:t,onAddToCart:i,onFocus:o,onBlur:s}){let[r,d]=It(null),w=Pt(null),v=Pt(e);v.current=e;let x=Pt(!0);Ht(()=>(x.current=!0,()=>{x.current=!1}),[]);let m=h=>{w.current=h,x.current&&d(h)},p=h=>{if(h.preventDefault(),h.stopPropagation(),w.current==="adding")return;m("adding");let y;try{y=Promise.resolve(i(v.current))}catch(k){y=Promise.reject(k)}y.then(()=>m("added"),()=>m(null))};return oe("span",{className:Y.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:t?0:-1,onClick:p,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||p(h)},onFocus:h=>{h.stopPropagation(),o()},onBlur:h=>{h.stopPropagation(),s(h)},children:rt("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[oe("path",{className:Y.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),oe("path",{className:Y.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),oe("path",{className:Y.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),oe("path",{className:Y.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),oe("circle",{className:Y.cartGlyph,cx:"9",cy:"20",r:"1.3"}),oe("circle",{className:Y.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Oi({sources:e,title:n,fallback:t,onPhotoFill:i}){let[o,s]=It(0),r=e[o],d=!!r,[w,v]=It(null),x=!d&&t==="initial";return Ht(()=>()=>i(null),[i]),rt("span",{className:Y.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!d&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":d&&w===r?"":void 0,children:[d?oe("img",{className:Y.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{v(r),i(Ii(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(m=>m+1)}}):null,x?Pi(n):null]})}import{isOptionsGridMobileViewport as Ui,measureOptionsGrid as Qi,needsOptionsGridMeasurement as Yi,OPTIONS_GRID_MOBILE_QUERY as ji,optionEnterDelayMs as $i,optionsShowLeadingVisuals as Zi,planOptionsGrid as va,pointerMayHighlight as xa,releasePanelHug as Xi,sameOptionRows as Ji,syncHighlightScroll as eo,syncPanelHug as to}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ao,useLayoutEffect as Bt,useRef as ya,useState as Sa}from"react";import{optionsGridTemplateColumns as Li}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Di,useRef as Mi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
3128
+ `,document.head.appendChild(e)}var Y={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};import{jsx as oe,jsxs as st}from"react/jsx-runtime";function ga({products:e,listboxId:n,onSelect:t,busyProductId:i=null,onAddToCart:o,onFocusChange:s,focusable:r=!0,loading:d=!1,layout:w="row",imageFallback:v="image",showVendor:x=!0,strings:m=Ei()}){let p=e.length>0,h=Pt(null);if(Nt(()=>{let k=h.current;if(!(!p||!k))return Ci(k)},[p]),!p)return null;let y=`${n}-products-label`;return st("section",{className:Y.section,"data-aia-products":"","data-aia-loading":d?"":void 0,"data-aia-products-layout":w,role:"group","aria-labelledby":y,children:[oe("div",{className:Y.label,id:y,"data-aia-products-label":"",children:m.products}),oe("div",{ref:h,className:Y.row,"data-aia-products-row":"",children:e.map((k,T)=>oe(zi,{product:k,id:`${n}-product-${T}`,onSelect:t,busy:k.id===i,onAddToCart:o,onFocusChange:s,focusable:r,imageFallback:v,showVendor:x,soldOut:m.soldOut,addToCart:m.addToCart},k.id))})]})}function zi({product:e,id:n,onSelect:t,busy:i,onAddToCart:o,onFocusChange:s,focusable:r,imageFallback:d,showVendor:w,soldOut:v,addToCart:x}){let m=!!o&&e.available!==!1,[p,h]=It(null),y=T=>{T.relatedTarget?.closest("[data-aia-dropdown]")||s?.(!1)},k=T=>{T.metaKey||T.ctrlKey||T.shiftKey||T.altKey||T.button!==0||(T.preventDefault(),t(e))};return st("a",{id:n,className:Y.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":m?"":void 0,"data-aia-product-state":i?"busy":void 0,"aria-busy":i?!0:void 0,role:"option","aria-selected":!1,style:p?{"--aia-product-photo-fill-x":String(p.x),"--aia-product-photo-fill-y":String(p.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:k,onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),t(e))},onFocus:()=>s?.(!0),onBlur:y,children:[oe(Li,{sources:Ti(e.imageUrl),title:e.title,fallback:d,onPhotoFill:h},Pi(e.imageUrl)??""),st("span",{className:Y.body,children:[w&&e.vendor?oe("span",{className:Y.vendor,children:e.vendor}):null,oe("span",{className:Y.title,children:e.title}),e.price?st("span",{className:Y.price,children:[e.price,e.compareAtPrice?oe("s",{className:Y.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?oe("span",{className:Y.badge,children:v}):null]}),m&&o?oe(Oi,{product:e,label:`${x}: ${e.title}`,focusable:r,onAddToCart:o,onFocus:()=>s?.(!0),onBlur:y},Ri(e)):null]})}function Ri(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function Oi({product:e,label:n,focusable:t,onAddToCart:i,onFocus:o,onBlur:s}){let[r,d]=It(null),w=Pt(null),v=Pt(e);v.current=e;let x=Pt(!0);Nt(()=>(x.current=!0,()=>{x.current=!1}),[]);let m=h=>{w.current=h,x.current&&d(h)},p=h=>{if(h.preventDefault(),h.stopPropagation(),w.current==="adding")return;m("adding");let y;try{y=Promise.resolve(i(v.current))}catch(k){y=Promise.reject(k)}y.then(()=>m("added"),()=>m(null))};return oe("span",{className:Y.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:t?0:-1,onClick:p,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||p(h)},onFocus:h=>{h.stopPropagation(),o()},onBlur:h=>{h.stopPropagation(),s(h)},children:st("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[oe("path",{className:Y.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),oe("path",{className:Y.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),oe("path",{className:Y.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),oe("path",{className:Y.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),oe("circle",{className:Y.cartGlyph,cx:"9",cy:"20",r:"1.3"}),oe("circle",{className:Y.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Li({sources:e,title:n,fallback:t,onPhotoFill:i}){let[o,s]=It(0),r=e[o],d=!!r,[w,v]=It(null),x=!d&&t==="initial";return Nt(()=>()=>i(null),[i]),st("span",{className:Y.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!d&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":d&&w===r?"":void 0,children:[d?oe("img",{className:Y.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{v(r),i(Ai(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(m=>m+1)}}):null,x?Ii(n):null]})}import{isOptionsGridMobileViewport as Qi,measureOptionsGrid as Yi,needsOptionsGridMeasurement as ji,OPTIONS_GRID_MOBILE_QUERY as $i,optionEnterDelayMs as Zi,optionsShowLeadingVisuals as Xi,planOptionsGrid as xa,pointerMayHighlight as ya,releasePanelHug as Ji,sameOptionRows as eo,syncHighlightScroll as to,syncPanelHug as ao}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as io,useLayoutEffect as Ft,useRef as ka,useState as Ca}from"react";import{optionsGridTemplateColumns as Di}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Mi,useRef as Ni}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
3128
3129
  display: grid;
3129
3130
  grid-template-columns: repeat(
3130
3131
  auto-fit,
@@ -3168,7 +3169,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
3168
3169
  :where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
3169
3170
  max-height: var(--aia-grid-max-height, 120px);
3170
3171
  }
3171
- `,document.head.appendChild(e)}import{jsx as Ni}from"react/jsx-runtime";function ga({min:e="16rem",max:n,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:d,innerRef:w,className:v,children:x,...m}){let p=Mi(null);Di(()=>{if(s===void 0)return;let y=p.current;y&&(y.scrollTop=0)},[s]);let h={"--aia-grid-min":e};return n&&(h["--aia-grid-max"]=n),t&&(h["--aia-grid-gap"]=t),o&&(h["--aia-grid-max-height"]=o),r&&(h.gridTemplateColumns=Li(r)),d&&(h.gridTemplateColumns=d),Ni("div",{ref:y=>{p.current=y,w?.(y)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:h,...m,children:x})}import{formatOptionCount as Hi,highlightParts as Fi,isMultiSelectToggleTap as Bi,OPTION_ENTER_DELAY_VAR as Wi,optionImageSources as fa,optionLabel as ba,sanitizeOptionIconSvg as Gi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ki,useMemo as qi,useRef as Vi,useState as kt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
3172
+ `,document.head.appendChild(e)}import{jsx as Hi}from"react/jsx-runtime";function fa({min:e="16rem",max:n,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:d,innerRef:w,className:v,children:x,...m}){let p=Ni(null);Mi(()=>{if(s===void 0)return;let y=p.current;y&&(y.scrollTop=0)},[s]);let h={"--aia-grid-min":e};return n&&(h["--aia-grid-max"]=n),t&&(h["--aia-grid-gap"]=t),o&&(h["--aia-grid-max-height"]=o),r&&(h.gridTemplateColumns=Di(r)),d&&(h.gridTemplateColumns=d),Hi("div",{ref:y=>{p.current=y,w?.(y)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:h,...m,children:x})}import{formatOptionCount as Fi,highlightParts as Bi,isMultiSelectToggleTap as Wi,OPTION_ENTER_DELAY_VAR as Gi,optionImageSources as ba,optionLabel as wa,sanitizeOptionIconSvg as Ki}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as qi,useMemo as Vi,useRef as _i,useState as kt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
3172
3173
  position: relative;
3173
3174
  /* Clip, not visible: the entrance rise below runs on the inner content,
3174
3175
  and a transformed box extends its scroll container's scrollable area.
@@ -3694,7 +3695,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
3694
3695
  border-radius: 6px;
3695
3696
  font-size: 11px;
3696
3697
  }
3697
- `,document.head.appendChild(e)}var ee={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};import{Fragment as _i,jsx as ue,jsxs as Ft}from"react/jsx-runtime";function wa({option:e,isHighlighted:n,checked:t,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:d,showIcon:w=!0,showImage:v=!0,showCount:x=!0,scrollHint:m,enterDelayMs:p=0}){let[h]=kt(p),[y,k]=kt(!1),T=v?fa(e.image_url):[],L=T[0]??null,[O,X]=kt([]),W=T.find(S=>!O.includes(S))??null,z=v?(e.imageCollage??[]).map(S=>fa(S)[0]).filter(S=>S!==void 0):[],[N,H]=kt(!1),[G,j]=kt(null),E=qi(()=>!L&&w&&e.icon_svg?Gi(e.icon_svg):null,[L,w,e.icon_svg]),ae=x?Hi(e.item_count):null,ne=Vi(void 0);Ki(()=>()=>clearTimeout(ne.current),[]);let V=S=>{if(d||!e.is_tappable||y&&t===void 0)return;k(!0);let F=S?.currentTarget;t!==void 0&&F!==void 0&&S!==void 0&&!Bi(F,F.querySelector("[data-aia-checkbox]"),S)?i(e,{commit:!0}):i(e),clearTimeout(ne.current),ne.current=setTimeout(()=>k(!1),170)},ie=[ee.item,n&&!d?ee.highlighted:"",e.liveMatch&&!d?ee.liveMatch:"",e.is_tappable?ee.tappable:ee.nonTappable,y?ee.pressed:"",m?ee.scrollHint:""].filter(Boolean).join(" ");return ue("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":E&&e.icon?e.icon:void 0,"data-aia-image":L?"":void 0,"data-aia-item-count":ae!==null?e.item_count:void 0,"aria-selected":t??n,className:ie,style:{[Wi]:`${h}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:V,onKeyDown:S=>{!d&&e.is_tappable&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),V())},onMouseEnter:!d&&e.is_tappable?o:void 0,onMouseLeave:s,children:Ft("span",{className:ee.content,children:[t!==void 0&&e.is_tappable&&ue("span",{className:ee.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),L&&z.length>1&&ue("span",{className:`${ee.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":z.length,"data-aia-image-loaded":N?"":void 0,children:z.map(S=>ue("img",{src:S,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>H(!0),onError:F=>{F.currentTarget.hidden=!0}},S))}),L&&z.length<=1&&ue("span",{className:`${ee.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":W!==null&&G===W?"":void 0,children:ue("img",{src:W??L,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:W===null,onLoad:()=>j(W),onError:()=>{W!==null&&X(S=>[...S,W])}})}),E&&ue("span",{className:`${ee.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:E}}),Ft("span",{className:ee.text,children:[e.matchedText?Fi(ba(e),e.matchedText).map((S,F)=>S.bold?ue("strong",{className:`${ee.match} magicx-aia-option-match`,"data-aia-match-partial":S.partial?"":void 0,children:S.text},F):S.text):ba(e),e.parameterLabel&&Ft(_i,{children:[" ",ue("span",{className:`${ee.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ue("span",{className:ee.tag,children:e.tag}),ae!==null&&ue("span",{className:`${ee.count} magicx-aia-option-count`,children:ae})]})})}import{jsx as ka}from"react/jsx-runtime";function io(){let[e,n]=Sa(Ui);return ao(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(ji),i=()=>n(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function Ca({options:e,activeIndex:n,picked:t,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:d,groupKey:w="",optionsPosition:v="below",showIcons:x=!0,showImages:m=!0,showCounts:p=!0}){let h=io(),y=ya(null),[k,T]=Sa(null),L=ya(null);Bt(()=>{if(d&&Ji(L.current,e))return;L.current=d?null:e;let z=y.current,N=z&&!d&&Yi(e.length,h),H=z?.closest("[data-aia-dropdown]");N&&H&&Xi(H);let G=N?Qi(z):null;T(G?va(e.length,h,G.rowWidths,G.gridWidth):null)},[e,h,d]);let O=k??va(e.length,h,null,null);Bt(()=>{let z=y.current?.closest("[data-aia-dropdown]");z&&to(z)},[O.template,h]);let X=d?-1:n;Bt(()=>{y.current&&eo(y.current,X)},[X]);let W=Zi(e,x,m);return ka(ga,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:w,template:O.template,maxHeight:O.maxHeight,innerRef:z=>{y.current=z},"data-aia-group":w,children:e.map((z,N)=>ka(wa,{option:z,isHighlighted:N===n,checked:t?t.includes(z.text):void 0,onSelect:i,onHighlight:H=>{xa(y.current,N,H)&&o(N)},onUnhighlight:s?H=>{xa(y.current,-1,H)&&s(N)}:void 0,id:`${r}-option-${N}`,loading:d,showIcon:x&&W,showImage:m&&W,showCount:p,scrollHint:!d&&O.scrollHintIndices.includes(N),enterDelayMs:d?0:$i(N,O.cols,e.length,v)},`${w}\0${z.parameter??""}\0${z.text}`))})}import{formatTime as oo,TIME_WHEEL_COLUMNS as no,TIME_WHEEL_ROW_HEIGHT as ro,timeWheelIndex as Ta,timeWheelIndexFromScroll as so,timeWheelRows as lo,withTimeWheelIndex as Pa}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as co,useEffect as po,useLayoutEffect as ho,useRef as At}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
3698
+ `,document.head.appendChild(e)}var ee={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};import{Fragment as Ui,jsx as ue,jsxs as Ht}from"react/jsx-runtime";function va({option:e,isHighlighted:n,checked:t,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:d,showIcon:w=!0,showImage:v=!0,showCount:x=!0,scrollHint:m,enterDelayMs:p=0}){let[h]=kt(p),[y,k]=kt(!1),T=v?ba(e.image_url):[],L=T[0]??null,[O,X]=kt([]),W=T.find(S=>!O.includes(S))??null,z=v?(e.imageCollage??[]).map(S=>ba(S)[0]).filter(S=>S!==void 0):[],[N,H]=kt(!1),[G,j]=kt(null),E=Vi(()=>!L&&w&&e.icon_svg?Ki(e.icon_svg):null,[L,w,e.icon_svg]),ae=x?Fi(e.item_count):null,ne=_i(void 0);qi(()=>()=>clearTimeout(ne.current),[]);let V=S=>{if(d||!e.is_tappable||y&&t===void 0)return;k(!0);let F=S?.currentTarget;t!==void 0&&F!==void 0&&S!==void 0&&!Wi(F,F.querySelector("[data-aia-checkbox]"),S)?i(e,{commit:!0}):i(e),clearTimeout(ne.current),ne.current=setTimeout(()=>k(!1),170)},ie=[ee.item,n&&!d?ee.highlighted:"",e.liveMatch&&!d?ee.liveMatch:"",e.is_tappable?ee.tappable:ee.nonTappable,y?ee.pressed:"",m?ee.scrollHint:""].filter(Boolean).join(" ");return ue("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":E&&e.icon?e.icon:void 0,"data-aia-image":L?"":void 0,"data-aia-item-count":ae!==null?e.item_count:void 0,"aria-selected":t??n,className:ie,style:{[Gi]:`${h}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:V,onKeyDown:S=>{!d&&e.is_tappable&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),V())},onMouseEnter:!d&&e.is_tappable?o:void 0,onMouseLeave:s,children:Ht("span",{className:ee.content,children:[t!==void 0&&e.is_tappable&&ue("span",{className:ee.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),L&&z.length>1&&ue("span",{className:`${ee.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":z.length,"data-aia-image-loaded":N?"":void 0,children:z.map(S=>ue("img",{src:S,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>H(!0),onError:F=>{F.currentTarget.hidden=!0}},S))}),L&&z.length<=1&&ue("span",{className:`${ee.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":W!==null&&G===W?"":void 0,children:ue("img",{src:W??L,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:W===null,onLoad:()=>j(W),onError:()=>{W!==null&&X(S=>[...S,W])}})}),E&&ue("span",{className:`${ee.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:E}}),Ht("span",{className:ee.text,children:[e.matchedText?Bi(wa(e),e.matchedText).map((S,F)=>S.bold?ue("strong",{className:`${ee.match} magicx-aia-option-match`,"data-aia-match-partial":S.partial?"":void 0,children:S.text},F):S.text):wa(e),e.parameterLabel&&Ht(Ui,{children:[" ",ue("span",{className:`${ee.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ue("span",{className:ee.tag,children:e.tag}),ae!==null&&ue("span",{className:`${ee.count} magicx-aia-option-count`,children:ae})]})})}import{jsx as Sa}from"react/jsx-runtime";function oo(){let[e,n]=Ca(Qi);return io(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia($i),i=()=>n(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function Ta({options:e,activeIndex:n,picked:t,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:d,groupKey:w="",optionsPosition:v="below",showIcons:x=!0,showImages:m=!0,showCounts:p=!0}){let h=oo(),y=ka(null),[k,T]=Ca(null),L=ka(null);Ft(()=>{if(d&&eo(L.current,e))return;L.current=d?null:e;let z=y.current,N=z&&!d&&ji(e.length,h),H=z?.closest("[data-aia-dropdown]");N&&H&&Ji(H);let G=N?Yi(z):null;T(G?xa(e.length,h,G.rowWidths,G.gridWidth):null)},[e,h,d]);let O=k??xa(e.length,h,null,null);Ft(()=>{let z=y.current?.closest("[data-aia-dropdown]");z&&ao(z)},[O.template,h]);let X=d?-1:n;Ft(()=>{y.current&&to(y.current,X)},[X]);let W=Xi(e,x,m);return Sa(fa,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:w,template:O.template,maxHeight:O.maxHeight,innerRef:z=>{y.current=z},"data-aia-group":w,children:e.map((z,N)=>Sa(va,{option:z,isHighlighted:N===n,checked:t?t.includes(z.text):void 0,onSelect:i,onHighlight:H=>{ya(y.current,N,H)&&o(N)},onUnhighlight:s?H=>{ya(y.current,-1,H)&&s(N)}:void 0,id:`${r}-option-${N}`,loading:d,showIcon:x&&W,showImage:m&&W,showCount:p,scrollHint:!d&&O.scrollHintIndices.includes(N),enterDelayMs:d?0:Zi(N,O.cols,e.length,v)},`${w}\0${z.parameter??""}\0${z.text}`))})}import{formatTime as no,TIME_WHEEL_COLUMNS as ro,TIME_WHEEL_ROW_HEIGHT as so,timeWheelIndex as Pa,timeWheelIndexFromScroll as lo,timeWheelRows as co,withTimeWheelIndex as Ia}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as po,useEffect as ho,useLayoutEffect as uo,useRef as At}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
3698
3699
 
3699
3700
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3700
3701
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3816,7 +3817,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
3816
3817
  .aia-done-llNY5:hover {
3817
3818
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3818
3819
  }
3819
- `,document.head.appendChild(e)}var me={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};import{jsx as je,jsxs as Wt}from"react/jsx-runtime";var uo=120;function Ia({view:e,label:n,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return Wt("div",{className:me.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:r=>r.preventDefault(),children:[je("span",{className:me.value,"data-aia-time-value":"","aria-live":"polite",children:oo(e.minutes)}),Wt("div",{className:me.columns,"aria-hidden":"true",children:[je("div",{className:me.band}),no.map(r=>Wt(co,{children:[r==="minute"&&je("span",{className:me.separator,children:":"}),je(mo,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),je("button",{type:"button",tabIndex:-1,className:me.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:t})]})}function mo({column:e,minutes:n,interactive:t,onTimeChange:i}){let o=At(null),s=At(null),r=At(null),d=At({minutes:n,interactive:t,onTimeChange:i});d.current={minutes:n,interactive:t,onTimeChange:i};let w=Ta(e,n);ho(()=>{let m=o.current;if(!m||r.current)return;let p=w*ro;Math.abs(m.scrollTop-p)<1||(s.current=p,m.scrollTop=p)},[w]),po(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let m=o.current,p=d.current;if(!m||!p.interactive)return;let h=so(e,m.scrollTop);h!==Ta(e,p.minutes)&&p.onTimeChange(Pa(e,p.minutes,h))},x=()=>{let m=o.current;if(m){if(s.current!=null&&Math.abs(m.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,uo)}};return je("div",{ref:o,className:me.column,"data-aia-time-column":e,onScroll:x,children:lo(e).map((m,p)=>je("div",{className:p===w?`${me.row} ${me.selected}`:me.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{d.current.interactive&&i(Pa(e,d.current.minutes,p))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3820
+ `,document.head.appendChild(e)}var me={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};import{jsx as je,jsxs as Bt}from"react/jsx-runtime";var mo=120;function Aa({view:e,label:n,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return Bt("div",{className:me.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:r=>r.preventDefault(),children:[je("span",{className:me.value,"data-aia-time-value":"","aria-live":"polite",children:no(e.minutes)}),Bt("div",{className:me.columns,"aria-hidden":"true",children:[je("div",{className:me.band}),ro.map(r=>Bt(po,{children:[r==="minute"&&je("span",{className:me.separator,children:":"}),je(go,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),je("button",{type:"button",tabIndex:-1,className:me.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:t})]})}function go({column:e,minutes:n,interactive:t,onTimeChange:i}){let o=At(null),s=At(null),r=At(null),d=At({minutes:n,interactive:t,onTimeChange:i});d.current={minutes:n,interactive:t,onTimeChange:i};let w=Pa(e,n);uo(()=>{let m=o.current;if(!m||r.current)return;let p=w*so;Math.abs(m.scrollTop-p)<1||(s.current=p,m.scrollTop=p)},[w]),ho(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let m=o.current,p=d.current;if(!m||!p.interactive)return;let h=lo(e,m.scrollTop);h!==Pa(e,p.minutes)&&p.onTimeChange(Ia(e,p.minutes,h))},x=()=>{let m=o.current;if(m){if(s.current!=null&&Math.abs(m.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,mo)}};return je("div",{ref:o,className:me.column,"data-aia-time-column":e,onScroll:x,children:co(e).map((m,p)=>je("div",{className:p===w?`${me.row} ${me.selected}`:me.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{d.current.interactive&&i(Ia(e,d.current.minutes,p))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3820
3821
  display: flex;
3821
3822
  flex-direction: column;
3822
3823
  gap: var(--aia-stack-space, 0.5rem);
@@ -3831,7 +3832,7 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
3831
3832
  align-items: end;
3832
3833
  }
3833
3834
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3834
- `,document.head.appendChild(e)}import{jsx as go}from"react/jsx-runtime";function Aa({space:e,align:n="stretch",className:t,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return go("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":n,style:s,...o,children:i})}import{jsx as te,jsxs as Gt}from"react/jsx-runtime";var Oo=typeof window>"u"?$e:Kt,Lo=[159,119,164],Do=()=>{},Ea=()=>{},Mo=e=>{},No=()=>{},Ho=e=>{},Fo=e=>{},Bo=e=>{},Wo=e=>{};function Go(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=Ro(n);if($e(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Ko(e,n){let t=st(null);$e(()=>{let i=e.current,o=n.current;if(!i||!o)return;let s=Io(i,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:fo({dropdown:i,grid:s,button:o})};return}t.current?.controller.update()}),$e(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function qo(e,n){let t=st(n);t.current=n;let i=st(null);Kt(()=>{let o=e.current;if(o){if(!i.current){i.current=bo({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),$e(()=>()=>{i.current?.destroy(),i.current=null},[])}function qt({suggestions:e,activeIndex:n,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:d,pills:w,onPillClick:v,showPills:x=!0,onSkip:m,showSkipButton:p=!0,showOptionIcons:h=!0,showOptionImages:y=!0,showOptionCounts:k=!0,skipDisabled:T=!1,activeSelected:L=!1,isLoading:O=!1,skeletonExiting:X=!1,isInputEmpty:W=!1,language:z,products:N,onProductSelect:H,onProductAddToCart:G,onProductFocusChange:j,productsLayout:E="row",productImageFallback:ae="image",showProductVendor:ne=!0,formatType:V="options",dateView:ie=null,selectedDateIso:S=null,selectedDateRange:F=null,dateRangeStart:c=null,dateReferences:A,onPreviousMonth:Te,onNextMonth:De,timeView:fe=null,multiSelectView:Ge=null,onMultiSelectCommit:Me,onSeeAllResults:u,seeAllBusy:Pe=!1,busyProductId:Ne=null,fullWidth:He=!1,onTimeChange:g,onTimeCommit:C,locationView:P=null,isReediting:R=!1,onLocationQuery:D,onLocationMove:$,onLocationCommit:le,onLocationFocusChange:de,isFocused:Ie=!1,optionsPosition:be="below",mode:Fe}){let ce=Go(Fe),Ke=ce!==void 0,_=st(null),Ae=st(null);Ko(_,Ae),$e(()=>{if(_.current)return wo(_.current)},[]);let Ze=e[0]?.options??[],ht=!!(w&&w.length>0&&v),we=!!(N&&N.length>0),qe=V==="time"&&fe!=null,Ve=V==="location"&&P!=null,J=s&&(Ze.length>0||x&&ht||O||we||qe||Ve);qo(_,J),Oo(()=>{let I=_.current;I&&(ko(I,yo(I)),Eo(I))});let ve={suggestions:e,activeIndex:n,pills:w,showPills:x,showSkipButton:p,showOptionIcons:h,showOptionImages:y,showOptionCounts:k,skipDisabled:T,activeSelected:L,isLoading:O,skeletonExiting:X,isInputEmpty:W,products:N,formatType:V,dateView:ie,selectedDateIso:S,selectedDateRange:F,dateRangeStart:c,dateReferences:A,timeView:fe,multiSelectView:Ge,locationView:P,isReediting:R,showsSeeAll:!!u},_e=st(ve);J&&(_e.current=ve);let a=J?ve:_e.current,Z=zo(z),xe=a.suggestions[0],b=xe?.options??[],Ue=a.activeIndex>=0&&!!b[a.activeIndex]?.is_tappable,Ee=To(a.pills??[],Z.keepTyping),ye=!!(Ee.length>0&&v),f=a.showPills&&ye,Xe=a.showPills&&!ye&&a.isLoading,Je=f||Xe,ze=ye&&So(Ee)&&a.showSkipButton&&!a.isInputEmpty&&!!m,et=Ee[0]?.text,tt=Co(a.formatType)&&a.dateView!=null,Re=b.length>0&&!tt,at=b.length>0&&tt&&!a.isLoading,Oe=a.formatType==="time"&&a.timeView!=null&&!a.isLoading,ke=a.formatType==="location"&&a.locationView!=null&&!a.isLoading,it=a.isLoading&&!Re&&!at&&!Oe&&!ke,Qe=a.products??[],ot=Po(f?Ee:[]);return Kt(()=>{_.current&&Ao(_.current,ot,{visible:J,anchorBottom:be==="above"})},[ot,J,be,a.suggestions,a.pills,a.isLoading,a.skeletonExiting,a.isInputEmpty,a.products,a.formatType,a.dateView,a.selectedDateIso,a.selectedDateRange,a.dateRangeStart,a.dateReferences,a.timeView,a.multiSelectView,a.locationView,a.showPills,a.showSkipButton,a.showOptionIcons,a.showOptionImages,a.showOptionCounts,a.showsSeeAll,E,z]),$e(()=>{let I=_.current;return()=>{I&&xo(I)}},[]),Gt("div",{ref:_,id:r,role:"listbox","aria-multiselectable":!!a.multiSelectView,"data-aia-dropdown":"","data-options-position":be,"data-mode":ce,"data-aia-loading":a.isLoading?"":void 0,"data-aia-skeleton-exiting":a.skeletonExiting?"":void 0,"data-aia-has-products":Qe.length>0?"":void 0,"data-aia-full-width":He?"":void 0,className:`${Ke?"magicx-aia ":""}${pe.dropdown} ${J?pe.visible:""} ${d??""}`,onMouseDown:I=>I.preventDefault(),children:[Gt(Aa,{space:"8px",children:[(Je||ze)&&Gt(vt,{noWrap:!0,className:pe.pillBar,"data-aia-pillbar":"",children:[Je&&te("span",{className:pe.pillScroll,"data-aia-pill-scroll":"",children:te(Tt,{pills:Ee,activePillIndex:0,activeSelected:a.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:a.isLoading})}),ze&&te("button",{type:"button",tabIndex:-1,className:pe.skip,"data-aia-skip":"",disabled:a.isLoading||a.skipDisabled,"aria-label":et?`${Z.skipLabel} ${et}`:Z.skipLabel,onClick:m,children:Z.skip})]}),Re&&te(Ca,{options:b,activeIndex:a.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:a.isLoading,groupKey:xe?`${xe.parameter} ${xe.text}`:"",optionsPosition:be,showIcons:a.showOptionIcons,showImages:a.showOptionImages,showCounts:a.showOptionCounts,picked:a.multiSelectView?.picked}),a.multiSelectView&&te("div",{"data-aia-multi-actions":"",onClick:I=>{I.target.closest("[data-aia-multi-done]")&&!a.skipDisabled&&!a.isLoading&&Me?.()},children:te("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:pe.multiDone,ref:I=>{I&&(I.disabled=!0,I.offsetHeight,I.disabled=a.skipDisabled||a.isLoading)},children:Z.done})}),at&&a.dateView&&te(oa,{options:b,activeIndex:a.activeIndex,listboxId:r,view:a.dateView,selection:{selectedIso:a.selectedDateIso??null,selectedRange:a.selectedDateRange??null,rangeStart:a.dateRangeStart??null,floor:vo(a.formatType,a.dateRangeStart),references:a.dateReferences??[]},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:Te??Ea,onNextMonth:De??Ea}),Oe&&a.timeView&&te(Ia,{view:a.timeView,label:Z.timeLabel,doneLabel:Z.done,interactive:!a.skipDisabled,onTimeChange:g??Mo,onTimeCommit:C??No}),ke&&a.locationView&&te(pa,{view:a.locationView,searchLabel:Z.locationSearch,noResultsLabel:Z.locationNoResults,useTypedLabel:Z.locationUseTyped,widgetFocused:Ie&&J,reediting:a.isReediting,visible:J,interactive:!a.skipDisabled,onQuery:D??Ho,onMove:$??Fo,onCommit:le??Bo,onFocusChange:de??Wo}),it&&te("div",{className:pe.skeletonBars,"data-aia-skeleton-bars":"",children:Lo.map(I=>te("span",{className:pe.skeletonBar,style:{width:I}},`bar-${I}`))}),te(ma,{products:Qe,listboxId:r,onSelect:H??Do,busyProductId:Ne,onAddToCart:G,onFocusChange:j,focusable:J&&!a.isLoading,loading:a.isLoading,layout:E,imageFallback:ae,showVendor:ne,strings:Z}),a.showsSeeAll&&te("div",{className:pe.seeAllRow,"data-aia-see-all":"",onClick:I=>{I.target.closest("[data-aia-see-all-button]")&&(I.stopPropagation(),!(a.isLoading||Pe)&&u?.())},children:te("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":Pe?"busy":void 0,"aria-busy":Pe?!0:void 0,className:pe.seeAll,ref:I=>{I&&(I.disabled=!0,I.offsetHeight,I.disabled=a.isLoading)},children:Z.seeAllResults})}),te(ra,{isOptionHighlighted:Ue,isInputEmpty:a.isInputEmpty,strings:Z})]}),te("button",{ref:Ae,type:"button",tabIndex:-1,className:pe.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Z.scrollArrow,"aria-hidden":"true",children:te("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:te("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as hn,ModeController as un,setCursorOffset as mn,uiStringsFor as gn,watchEditorHeight as fn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as Vo}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
3835
+ `,document.head.appendChild(e)}import{jsx as fo}from"react/jsx-runtime";function Ea({space:e,align:n="stretch",className:t,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return fo("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":n,style:s,...o,children:i})}import{jsx as te,jsxs as Wt}from"react/jsx-runtime";var Lo=typeof window>"u"?$e:Gt,Do=[159,119,164],Mo=()=>{},za=()=>{},No=e=>{},Ho=()=>{},Fo=e=>{},Bo=e=>{},Wo=e=>{},Go=e=>{};function Ko(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=Oo(n);if($e(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function qo(e,n){let t=lt(null);$e(()=>{let i=e.current,o=n.current;if(!i||!o)return;let s=Ao(i,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:bo({dropdown:i,grid:s,button:o})};return}t.current?.controller.update()}),$e(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Vo(e,n){let t=lt(n);t.current=n;let i=lt(null);Gt(()=>{let o=e.current;if(o){if(!i.current){i.current=wo({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),$e(()=>()=>{i.current?.destroy(),i.current=null},[])}function Kt({suggestions:e,activeIndex:n,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:d,pills:w,onPillClick:v,showPills:x=!0,onSkip:m,showSkipButton:p=!0,showOptionIcons:h=!0,showOptionImages:y=!0,showOptionCounts:k=!0,skipDisabled:T=!1,activeSelected:L=!1,isLoading:O=!1,skeletonExiting:X=!1,isInputEmpty:W=!1,language:z,products:N,onProductSelect:H,onProductAddToCart:G,onProductFocusChange:j,productsLayout:E="row",productImageFallback:ae="image",showProductVendor:ne=!0,formatType:V="options",dateView:ie=null,selectedDateIso:S=null,selectedDateRange:F=null,dateRangeStart:c=null,dateReferences:A,onPreviousMonth:Te,onNextMonth:De,timeView:fe=null,multiSelectView:Ge=null,onMultiSelectCommit:Me,onSeeAllResults:u,seeAllBusy:Pe=!1,busyProductId:Ne=null,fullWidth:He=!1,onTimeChange:g,onTimeCommit:C,locationView:P=null,isReediting:R=!1,onLocationQuery:D,onLocationMove:$,onLocationCommit:le,onLocationFocusChange:de,isFocused:Ie=!1,optionsPosition:be="below",mode:Fe}){let ce=Ko(Fe),Ke=ce!==void 0,_=lt(null),Ae=lt(null);qo(_,Ae),$e(()=>{if(_.current)return vo(_.current)},[]);let Ze=e[0]?.options??[],ut=!!(w&&w.length>0&&v),we=!!(N&&N.length>0),qe=V==="time"&&fe!=null,Ve=V==="location"&&P!=null,J=s&&(Ze.length>0||x&&ut||O||we||qe||Ve);Vo(_,J),Lo(()=>{let I=_.current;I&&(So(I,ko(I)),zo(I))});let ve={suggestions:e,activeIndex:n,pills:w,showPills:x,showSkipButton:p,showOptionIcons:h,showOptionImages:y,showOptionCounts:k,skipDisabled:T,activeSelected:L,isLoading:O,skeletonExiting:X,isInputEmpty:W,products:N,formatType:V,dateView:ie,selectedDateIso:S,selectedDateRange:F,dateRangeStart:c,dateReferences:A,timeView:fe,multiSelectView:Ge,locationView:P,isReediting:R,showsSeeAll:!!u},_e=lt(ve);J&&(_e.current=ve);let a=J?ve:_e.current,Z=Ro(z),xe=a.suggestions[0],f=xe?.options??[],Ue=a.activeIndex>=0&&!!f[a.activeIndex]?.is_tappable,Ee=Po(a.pills??[],Z.keepTyping),ye=!!(Ee.length>0&&v),b=a.showPills&&ye,Xe=a.showPills&&!ye&&a.isLoading,Je=b||Xe,ze=ye&&Co(Ee)&&a.showSkipButton&&!a.isInputEmpty&&!!m,et=Ee[0]?.text,tt=To(a.formatType)&&a.dateView!=null,Re=f.length>0&&!tt,at=f.length>0&&tt&&!a.isLoading,Oe=a.formatType==="time"&&a.timeView!=null&&!a.isLoading,ke=a.formatType==="location"&&a.locationView!=null&&!a.isLoading,it=a.isLoading&&!Re&&!at&&!Oe&&!ke,Qe=a.products??[],ot=Io(b?Ee:[]);return Gt(()=>{_.current&&Eo(_.current,ot,{visible:J,anchorBottom:be==="above"})},[ot,J,be,a.suggestions,a.pills,a.isLoading,a.skeletonExiting,a.isInputEmpty,a.products,a.formatType,a.dateView,a.selectedDateIso,a.selectedDateRange,a.dateRangeStart,a.dateReferences,a.timeView,a.multiSelectView,a.locationView,a.showPills,a.showSkipButton,a.showOptionIcons,a.showOptionImages,a.showOptionCounts,a.showsSeeAll,E,z]),$e(()=>{let I=_.current;return()=>{I&&yo(I)}},[]),Wt("div",{ref:_,id:r,role:"listbox","aria-multiselectable":!!a.multiSelectView,"data-aia-dropdown":"","data-options-position":be,"data-mode":ce,"data-aia-loading":a.isLoading?"":void 0,"data-aia-skeleton-exiting":a.skeletonExiting?"":void 0,"data-aia-has-products":Qe.length>0?"":void 0,"data-aia-full-width":He?"":void 0,className:`${Ke?"magicx-aia ":""}${pe.dropdown} ${J?pe.visible:""} ${d??""}`,onMouseDown:I=>I.preventDefault(),children:[Wt(Ea,{space:"8px",children:[(Je||ze)&&Wt(xt,{noWrap:!0,className:pe.pillBar,"data-aia-pillbar":"",children:[Je&&te("span",{className:pe.pillScroll,"data-aia-pill-scroll":"",children:te(Tt,{pills:Ee,activePillIndex:0,activeSelected:a.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:a.isLoading})}),ze&&te("button",{type:"button",tabIndex:-1,className:pe.skip,"data-aia-skip":"",disabled:a.isLoading||a.skipDisabled,"aria-label":et?`${Z.skipLabel} ${et}`:Z.skipLabel,onClick:m,children:Z.skip})]}),Re&&te(Ta,{options:f,activeIndex:a.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:a.isLoading,groupKey:xe?`${xe.parameter} ${xe.text}`:"",optionsPosition:be,showIcons:a.showOptionIcons,showImages:a.showOptionImages,showCounts:a.showOptionCounts,picked:a.multiSelectView?.picked}),a.multiSelectView&&te("div",{"data-aia-multi-actions":"",onClick:I=>{I.target.closest("[data-aia-multi-done]")&&!a.skipDisabled&&!a.isLoading&&Me?.()},children:te("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:pe.multiDone,ref:I=>{I&&(I.disabled=!0,I.offsetHeight,I.disabled=a.skipDisabled||a.isLoading)},children:Z.done})}),at&&a.dateView&&te(oa,{options:f,activeIndex:a.activeIndex,listboxId:r,view:a.dateView,selection:{selectedIso:a.selectedDateIso??null,selectedRange:a.selectedDateRange??null,rangeStart:a.dateRangeStart??null,floor:xo(a.formatType,a.dateRangeStart),references:a.dateReferences??[]},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:Te??za,onNextMonth:De??za}),Oe&&a.timeView&&te(Aa,{view:a.timeView,label:Z.timeLabel,doneLabel:Z.done,interactive:!a.skipDisabled,onTimeChange:g??No,onTimeCommit:C??Ho}),ke&&a.locationView&&te(ha,{view:a.locationView,searchLabel:Z.locationSearch,noResultsLabel:Z.locationNoResults,useTypedLabel:Z.locationUseTyped,widgetFocused:Ie&&J,reediting:a.isReediting,visible:J,interactive:!a.skipDisabled,onQuery:D??Fo,onMove:$??Bo,onCommit:le??Wo,onFocusChange:de??Go}),it&&te("div",{className:pe.skeletonBars,"data-aia-skeleton-bars":"",children:Do.map(I=>te("span",{className:pe.skeletonBar,style:{width:I}},`bar-${I}`))}),te(ga,{products:Qe,listboxId:r,onSelect:H??Mo,busyProductId:Ne,onAddToCart:G,onFocusChange:j,focusable:J&&!a.isLoading,loading:a.isLoading,layout:E,imageFallback:ae,showVendor:ne,strings:Z}),a.showsSeeAll&&te("div",{className:pe.seeAllRow,"data-aia-see-all":"",onClick:I=>{I.target.closest("[data-aia-see-all-button]")&&(I.stopPropagation(),!(a.isLoading||Pe)&&u?.())},children:te("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":Pe?"busy":void 0,"aria-busy":Pe?!0:void 0,className:pe.seeAll,ref:I=>{I&&(I.disabled=!0,I.offsetHeight,I.disabled=a.isLoading)},children:Z.seeAllResults})}),te(sa,{isOptionHighlighted:Ue,isInputEmpty:a.isInputEmpty,strings:Z})]}),te("button",{ref:Ae,type:"button",tabIndex:-1,className:pe.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Z.scrollArrow,"aria-hidden":"true",children:te("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:te("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as un,ModeController as mn,setCursorOffset as gn,uiStringsFor as fn,watchEditorHeight as bn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as _o}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
3835
3836
  flex-shrink: 0;
3836
3837
  width: 32px;
3837
3838
  height: 32px;
@@ -3935,5 +3936,5 @@ import{buildSubmitResult as Cs,cellDay as Ts,cellIso as Ps,DATE_RANGE_META_END a
3935
3936
  transition: none;
3936
3937
  }
3937
3938
  }
3938
- `,document.head.appendChild(e)}var za={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};import{jsx as Vt}from"react/jsx-runtime";function Ra({disabled:e,ready:n,busy:t=!1,onClick:i,label:o=Vo().submit}){return Vt("button",{type:"button","data-aia-submit":"",className:za.submitButton,disabled:e,"data-aia-ready":n?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:s=>{s.stopPropagation(),i()},"aria-label":o,children:Vt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":o,children:Vt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as _o,dateSelectionFor as Uo,dropdownPillsFor as Qo,editingSuggestion as Yo,HANDOFF_NOT_HANDLED as jo,identifiedParamLabel as $o,withoutTraditionalAutocomplete as Zo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Na,useEffect as We,useMemo as Xo,useRef as q,useState as Jo}from"react";import{useRef as Oa}from"react";function La(e){let n=Oa(e);n.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=Oa({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(d,w,v)=>{let x=n.current?.[s];return x?x(d,w,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}import{useRef as Da}from"react";function Ma(e){let n=Da(e);n.current=e;let t=Da(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=n.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var Ha={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function _t({onSubmit:e,onResult:n,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:d,currency:w,productId:v,visitorId:x,analyticsConsent:m,columns:p=2,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:k,prependPlaceholder:T,allOption:L,showNonTappableOptions:O,locationSearch:X,showOptionIcons:W,showOptionImages:z,showOptionCounts:N,showSkipButton:H,showProducts:G,submitProgress:j,productImageFallback:E="image",showProductVendor:ae=!0,onFocus:ne,onBlur:V,value:ie,completedParams:S,onChange:F,onParamsChange:c,products:A,mapProducts:Te,onProductSelect:De,onProductAddToCart:fe,source:Ge,setCursor:Me}){let u=q(null),[Pe,Ne]=Jo(null),He=q(e);He.current=e;let g=q(n);g.current=n;let C=q(t);C.current=t;let P=q(F);P.current=F;let R=q(c);R.current=c;let D=q(ne);D.current=ne;let $=q(V);$.current=V;let le=q(Me);le.current=Me;let de=q(De);de.current=De;let Ie=q(fe);Ie.current=fe;let be=q(x);be.current=x;let Fe=q(()=>{let l=be.current;return typeof l=="function"?l():l}).current,ce=x!==void 0,Ke=q(m);Ke.current=m;let _=q(()=>{let l=Ke.current;return typeof l=="function"?l():l}).current,Ae=Ma(A),Ze=q(Te);Ze.current=Te;let ht=q((l,U)=>{let B=Ze.current;return B?B(l,U):l}).current,we=Te?ht:void 0,qe=La(i);We(()=>{if(typeof document>"u")return;let l=new _o(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:w,productId:v,visitorId:ce?Fe:void 0,analyticsConsent:_,optionOverrides:qe.overrides,maskCompletedText:o,columns:p,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:k,prependPlaceholder:T,allOption:L,showNonTappableOptions:O,locationSearch:X,showProducts:G,submitProgress:j,source:Ge,value:ie,completedParams:S,onSubmit:(...B)=>He.current?.(...B),onResult:(...B)=>g.current?.(...B),onError:(...B)=>C.current?.(...B),onChange:(...B)=>P.current?.(...B),onParamsChange:(...B)=>R.current?.(...B),onFocus:()=>D.current?.(),onBlur:()=>$.current?.(),onProductSelect:B=>de.current?de.current(B):jo,onProductAddToCart:B=>Ie.current?.(B),setCursor:B=>le.current?.(B),products:Ae.config,mapProducts:we});u.current=l,Ne(l.getState());let U=l.subscribe(B=>Ne(B));return()=>{U(),l.destroy(),u.current===l&&(u.current=null)}},[]);let Ve=q(ce);We(()=>{Ve.current!==ce&&(Ve.current=ce,u.current?.update({visitorId:ce?Fe:void 0,analyticsConsent:_}))},[ce,Fe,_]);let J=typeof m=="function"?"function":m,ve=q(J);We(()=>{ve.current!==J&&(ve.current=J,u.current?.refreshAnalyticsConsent())},[J]),We(()=>{ie!==void 0&&u.current?.setValue(ie)},[ie]),We(()=>{S!==void 0&&u.current?.setCompletedParams(S)},[S]);let _e=JSON.stringify(s??null),a;try{a=JSON.stringify(r??null)}catch{a="[unstringifiable]"}We(()=>{u.current?.update({apiConfig:s,additionalContext:r,language:d,currency:w,productId:v,optionOverrides:qe.overrides,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:k,prependPlaceholder:T,allOption:L,showNonTappableOptions:O,locationSearch:X,showProducts:G,submitProgress:j})},[_e,a,d,w?.code,w?.rate,w?.country,v,qe.key,h,y,k,T,L,O,X,G,j]);let Z=q(!1);We(()=>{if(!Z.current){Z.current=!0;return}u.current?.update({products:Ae.config})},[Ae.enabled]),We(()=>{u.current?.update({mapProducts:we})},[we]);let xe=q(null);xe.current===null&&(xe.current={handleTextChange:l=>u.current?.handleTextChange(l),handleCompositionText:l=>u.current?.handleCompositionText(l),handleKeyDown:l=>{let U="nativeEvent"in l?l.nativeEvent:l;u.current?.handleKeyDown(U)},setFocused:l=>u.current?.setFocused(l),startEditingParam:l=>u.current?.startEditingParam(l),removeParam:l=>u.current?.removeParam(l)??!1,exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:l=>u.current?.handleCaretAfterInput(l),handleCaretMove:l=>u.current?.handleCaretMove(l),replaceEditingRange:l=>u.current?.replaceEditingRange(l)??!1,setActivePill:l=>u.current?.setActivePill(l),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),refreshProducts:()=>u.current?.refreshProducts(),prepareSubmit:()=>u.current?.prepareSubmit(),getState:()=>u.current?.getState()??Ha,recordSubmit:l=>u.current?.recordSubmit(l),holdSubmit:l=>u.current?.holdSubmit(l),endSubmitProgress:()=>u.current?.endSubmitProgress(),getVisitorId:()=>u.current?.getVisitorId(),refreshAnalyticsConsent:()=>u.current?.refreshAnalyticsConsent(),selectOption:(l,U)=>u.current?.selectOption(l,U),selectProduct:l=>u.current?.selectProduct(l),addProductToCart:l=>{let U=u.current;return!U||!Ie.current?Promise.resolve():U.addProductToCart(l)},setActiveDropdownIndex:l=>u.current?.setActiveDropdownIndex(l),clearHighlight:l=>u.current?.clearHighlight(l),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),setTime:l=>u.current?.setTime(l),commitTime:()=>u.current?.commitTime(),toggleMultiSelectOption:l=>u.current?.toggleMultiSelectOption(l),commitMultiSelect:()=>u.current?.commitMultiSelect(),setLocationQuery:l=>u.current?.setLocationQuery(l),moveLocationHighlight:l=>u.current?.moveLocationHighlight(l),commitLocation:l=>u.current?.commitLocation(l),setLocationFieldFocused:l=>u.current?.setLocationFieldFocused(l),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let b=xe.current,Ue=Na(l=>{let U=l.target.value,mt=U.length>0&&!l.nativeEvent?.isComposing&&U[0]!==U[0].toUpperCase()?U[0].toUpperCase()+U.slice(1):U;u.current?.handleTextChange(mt)},[]),Ee=Na(l=>{u.current?.handleKeyDown(l.nativeEvent)},[]),ye=u.current,f=Pe??Ha,Xe=ie!==void 0?ie:f.text,Je=S!==void 0?S:f.completedParams,ze=f.actionableSuggestions,et=ze[0],tt=Xo(()=>Zo(ze),[ze]),Re=ye?.listboxId??"",at=f.activeDropdownIndex>=0&&ye?`${Re}-option-${f.activeDropdownIndex}`:void 0,Oe=f.editingParam,ke=f.editingIdentified,it=Oe?Yo(Oe):ke?{parameter:ke.parameter,text:$o(ke.parameter),required:!0,options:[]}:null,Qe=f.dropdownSuggestion??it??et,ot=Qo(f.dropdownSuggestion,it,ze),I=Uo(f),ut=!ye||f.dropdownLoading;return{completedParams:Je,multiSelectView:f.multiSelectView,toggleMultiSelectOption:b.toggleMultiSelectOption,commitMultiSelect:b.commitMultiSelect,skippedParams:f.skippedParams,identifiedParams:f.identifiedParams,suggestionPills:tt,setActivePill:b.setActivePill,skipActivePill:b.skipActivePill,removeLastParam:b.removeLastParam,segments:f.segments,newParamId:f.newParamId,clearNewParamId:b.clearNewParamId,suggestions:f.suggestions,activeIndex:f.activeDropdownIndex,isReady:f.isReady,isLoading:ut,isFocused:f.isFocused,isDropdownOpen:f.isDropdownOpen,isActivePillSelected:f.isActivePillSelected,placeholderText:f.placeholderText,listboxId:Re,error:f.error,products:f.products,customFields:f.customFields,selectProduct:b.selectProduct,addProductToCart:b.addProductToCart,handleTextChange:b.handleTextChange,handleCompositionText:b.handleCompositionText,handleKeyDown:b.handleKeyDown,setFocused:b.setFocused,editingParam:Oe,editingIdentified:ke,editingAnchor:f.editingAnchor,caretOffset:f.caretOffset,startEditingParam:b.startEditingParam,removeParam:b.removeParam,exitEditMode:b.exitEditMode,handleCaretAfterInput:b.handleCaretAfterInput,handleCaretMove:b.handleCaretMove,replaceEditingRange:b.replaceEditingRange,inputProps:{value:Xe,placeholder:f.placeholderText||void 0,onChange:Ue,onKeyDown:Ee,onFocus:b.handleFocus,onBlur:b.handleBlur,role:"combobox","aria-expanded":f.isDropdownOpen,"aria-activedescendant":at,"aria-autocomplete":"list","aria-controls":Re},reset:b.reset,refreshProducts:b.refreshProducts,prepareSubmit:b.prepareSubmit,getState:b.getState,recordSubmit:b.recordSubmit,holdSubmit:b.holdSubmit,endSubmitProgress:b.endSubmitProgress,getVisitorId:b.getVisitorId,refreshAnalyticsConsent:b.refreshAnalyticsConsent,isSubmitting:f.isSubmitting,selectingProductId:f.selectingProductId,dropdownProps:{suggestions:Qe?[{...Qe,options:f.dropdownOptions}]:[],activeIndex:f.activeDropdownIndex,onSelect:b.selectOption,onHighlight:b.setActiveDropdownIndex,onUnhighlight:b.clearHighlight,isOpen:f.isDropdownOpen,id:Re,pills:ot,activeSelected:f.isActivePillSelected,onPillClick:b.setActivePill,onSkip:b.skipActivePill,showSkipButton:(H??!0)&&!Oe&&!ke,showOptionIcons:W??!0,showOptionImages:z??!0,showOptionCounts:N??!0,skipDisabled:f.inSelectionAnimation,isLoading:ut,skeletonExiting:f.skeletonExiting,isInputEmpty:Xe.trim().length===0,language:d,products:f.products,productImageFallback:E,showProductVendor:ae,onProductSelect:b.selectProduct,busyProductId:f.selectingProductId,seeAllBusy:f.isSubmitting,onProductAddToCart:fe?b.addProductToCart:void 0,onProductFocusChange:b.setFocused,formatType:f.activeFormatType,dateView:f.dateView,selectedDateIso:I.selectedIso,selectedDateRange:I.selectedRange,dateRangeStart:I.rangeStart,dateReferences:I.references,onPreviousMonth:b.showPreviousMonth,onNextMonth:b.showNextMonth,timeView:f.timeView,multiSelectView:f.dropdownMultiSelect,onMultiSelectCommit:b.commitMultiSelect,onTimeChange:b.setTime,onTimeCommit:b.commitTime,locationView:f.locationView,isReediting:f.editingParam!=null,onLocationQuery:b.setLocationQuery,onLocationMove:b.moveLocationHighlight,onLocationCommit:b.commitLocation,onLocationFocusChange:b.setLocationFieldFocused,isFocused:f.isFocused||f.locationFieldFocused,optionsPosition:y??"below"}}}import{attachChipRemove as en,cancelStartingHint as tn,chipIdFromTap as an,extractPlainText as Fa,getCursorOffset as Ba,keepCaretOnChip as on,plainTextLength as nn,renderEditableContent as rn,setCursorOffset as Wa,startingHintOptions as sn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ge,useEffect as lt,useLayoutEffect as Ut,useRef as dt}from"react";var Et;function ln(){if(Et!==void 0)return Et;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Et=e.contentEditable==="plaintext-only",Et}function Ga(e){let{segments:n,showChipIcons:t=!0,showChipImages:i=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:d,editingIdentified:w,editingAnchor:v,caretOffset:x,placeholderText:m,hintSuggestions:p,isFocused:h,isDropdownOpen:y,listboxId:k,activeDescendantId:T,autoFocus:L,handleTextChange:O,handleCompositionText:X,handleKeyDown:W,handleCaretAfterInput:z,handleCaretMove:N,startEditingParam:H,replaceEditingRange:G,setFocused:j}=e,E=dt(null),ae=dt(!1),ne=dt(""),V=dt(""),ie=dt(null),S=dt(0);ie.current=x,lt(()=>{if(!L)return;let g=E.current;if(!g)return;document.activeElement===g?j(!0):g.focus();let C=g.ownerDocument??document,P=C.getSelection(),R=P&&P.rangeCount>0&&g.contains(P.anchorNode);if(P&&!R){let D=C.createRange();D.selectNodeContents(g),D.collapse(!0),P.removeAllRanges(),P.addRange(D)}},[L,j]),lt(()=>{let g=E.current;if(!g)return;let C=g.ownerDocument??document,P=()=>{let R=C.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!g.contains(R.anchorNode))return;let D=R.anchorNode,$=D.nodeType===Node.ELEMENT_NODE?D:D.parentElement,de=(R.isCollapsed?$?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ie=d?.id??w?.id??null;if(de&&de!==Ie){H(de);return}performance.now()-S.current<50||N(Ba(g))};return C.addEventListener("selectionchange",P),()=>C.removeEventListener("selectionchange",P)},[d,w,H,N]),lt(()=>{let g=E.current;if(!g)return;let C=P=>{let R=an(g,P.target);R&&(H(R),on(g,R))};return g.addEventListener("click",C),()=>g.removeEventListener("click",C)},[H]),lt(()=>{let g=E.current;if(!(!g||!s||!o))return en(g,s)},[s,o]),Ut(()=>{let g=E.current;g&&rn({input:g,segments:n,newParamId:r,editingParamId:d?.id??null,placeholderText:m??"",isFocused:h,showChipIcons:t,showChipImages:i,showChipRemove:o,hintOptions:sn(p??[])})},[n,r,d,m,p,h,t,i,o]),lt(()=>{let g=E.current;return()=>{g&&tn(g)}},[]),Ut(()=>{let g=ne.current,C=r??"";if(ne.current=C,!C||C===g)return;let P=E.current;if(!P)return;P.focus();let R=ie.current??nn(P);Wa(P,R)},[r]),Ut(()=>{let g=V.current,C=d?.id??"";if(V.current=C,!C||C===g||v==null)return;let P=E.current;P&&Wa(P,v)},[d,v]);let F=ge(()=>{let g=E.current;if(!g)return;let C=Fa(g),R=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(ae.current){X(R);return}O(R)},[O,X]),c=ge(()=>{S.current=performance.now(),F();let g=E.current;g&&z(Ba(g))},[F,z]);lt(()=>{let g=E.current;if(!g)return;let C=P=>{let R=P,D=R.inputType;if(D==="insertParagraph"||D==="insertLineBreak"||D==="insertFromDrop"){P.preventDefault();return}if(D.startsWith("insert")||D.startsWith("delete")){let $=D.startsWith("delete")?"":R.data??"";G($)&&P.preventDefault()}};return g.addEventListener("beforeinput",C),()=>g.removeEventListener("beforeinput",C)},[G]);let A=ge(()=>{ae.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),Te=ge(()=>{ae.current=!1,E.current?.removeAttribute("data-aia-composing"),F()},[F]),De=ge(g=>{g.preventDefault();let C=E.current;if(!C)return;let P=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!P)return;let R=C.ownerDocument??document,D=R.getSelection();if(!D||D.rangeCount===0)return;let $=D.getRangeAt(0);if(!C.contains($.startContainer))return;$.deleteContents();let le=R.createTextNode(P);$.insertNode(le),$.setStartAfter(le),$.collapse(!0),D.removeAllRanges(),D.addRange($),F()},[F]),fe=ge(g=>W(g),[W]),Ge=ge(()=>j(!0),[j]),Me=ge(()=>j(!1),[j]),u=ge(()=>E.current?.focus(),[]),Pe=ge(()=>E.current?.blur(),[]),Ne=ge(()=>{let g=E.current;return g?Fa(g):""},[]),He=ln()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:He,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":k,"aria-expanded":y,"aria-activedescendant":T,spellCheck:!0,enterKeyHint:"send",onInput:c,onKeyDown:fe,onCompositionStart:A,onCompositionEnd:Te,onPaste:De,onFocus:Ge,onBlur:Me},getPlainText:Ne,focus:u,blur:Pe}}import{jsx as pt,jsxs as Yt}from"react/jsx-runtime";function bn(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var wn=dn(function({onSubmit:n,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:d,additionalContext:w,language:v,currency:x,productId:m,visitorId:p,analyticsConsent:h,columns:y,pillPlacement:k="dropdown",mode:T="auto",optionsPosition:L="below",animations:O=!0,optionsStyle:X="floating",dropdownTrigger:W,closeDropdownOnBlur:z,prependPlaceholder:N,allOption:H,showNonTappableOptions:G,locationSearch:j,showOptionIcons:E=!0,showChipIcons:ae=!0,showChipImages:ne=!0,showChipRemove:V=!1,showOptionImages:ie=!0,showOptionCounts:S=!0,showSkipButton:F,showProducts:c,submitProgress:A,productsLayout:Te,productImageFallback:De,showProductVendor:fe,autoFocus:Ge=!0,onFocus:Me,onBlur:u,value:Pe,completedParams:Ne,onChange:He,onParamsChange:g,products:C,mapProducts:P,onProductSelect:R,onProductAddToCart:D,submitButton:$,resetOnSubmit:le=!0,seeAllResults:de=!1},Ie){let be=ct(null),Fe=ct(null),ce=ct(null),Ke=ct(()=>{}),_=ct(null),Ae=ct(null);Qt(()=>{let M=be.current;if(M)return _.current?_.current.setMode(T):_.current=new un(M,T),()=>{_.current?.destroy(),_.current=null}},[T]);let Ze=zt(M=>{let re=Ae.current?.current;re&&(re.focus(),mn(re,M))},[]),{completedParams:ht,suggestionPills:we,setActivePill:qe,skipActivePill:Ve,segments:J,newParamId:ve,clearNewParamId:_e,placeholderText:a,isFocused:Z,isDropdownOpen:xe,isActivePillSelected:b,isLoading:Ue,isReady:Ee,activeIndex:ye,listboxId:f,handleTextChange:Xe,handleCompositionText:Je,handleKeyDown:ze,setFocused:et,editingParam:tt,editingIdentified:Re,editingAnchor:at,caretOffset:Oe,startEditingParam:ke,removeParam:it,handleCaretAfterInput:Qe,handleCaretMove:ot,replaceEditingRange:I,dropdownProps:ut,reset:l,refreshProducts:U,prepareSubmit:B,getState:mt,recordSubmit:jt,holdSubmit:$t,endSubmitProgress:Zt,getVisitorId:Xt,refreshAnalyticsConsent:Jt,isSubmitting:Rt}=_t({onSubmit:M=>Ke.current(M),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:d,additionalContext:w,language:v,currency:x,productId:m,visitorId:p,analyticsConsent:h,columns:y,dropdownTrigger:W,optionsPosition:L,closeDropdownOnBlur:z,prependPlaceholder:N,allOption:H,showNonTappableOptions:G,locationSearch:j,showOptionIcons:E,showOptionImages:ie,showOptionCounts:S,showSkipButton:F,showProducts:c,submitProgress:A,onFocus:Me,onBlur:u,value:Pe,completedParams:Ne,onChange:He,onParamsChange:g,products:C,mapProducts:P,onProductSelect:R,onProductAddToCart:D,source:"full-sdk",setCursor:Ze});Qt(()=>{if(!ve)return;let M=window.setTimeout(()=>_e(),650);return()=>window.clearTimeout(M)},[ve,_e]);let Ka=ye>=0?`${f}-option-${ye}`:void 0,{inputRef:Ot,editorProps:qa,focus:St,blur:ea,getPlainText:ta}=Ga({segments:J,newParamId:ve,editingParam:tt,editingIdentified:Re,editingAnchor:at,caretOffset:Oe,placeholderText:a,hintSuggestions:k==="inline"?[]:we,isFocused:Z,showChipIcons:ae,showChipImages:ne,showChipRemove:V,removeParam:it,isDropdownOpen:xe,listboxId:f,activeDescendantId:Ka,autoFocus:Ge,handleTextChange:Xe,handleCompositionText:Je,handleKeyDown:ze,handleCaretAfterInput:Qe,handleCaretMove:ot,startEditingParam:ke,replaceEditingRange:I,setFocused:et});Ae.current=Ot,pn(()=>{let M=Fe.current,re=Ot.current;if(!M||!re)return;let ft=()=>{let aa=M.firstElementChild;if(!aa)return;let ja=aa.getBoundingClientRect(),$a=re.getBoundingClientRect();ja.top>=$a.bottom-2?M.setAttribute("data-aia-pill-wrapped",""):M.removeAttribute("data-aia-pill-wrapped")};ft();let bt=new ResizeObserver(ft);return bt.observe(re),()=>bt.disconnect()},[J,we.length,Ue,Ot]),Qt(()=>{let M=ce.current;if(M)return fn(M)},[]),cn(Ie,()=>({focus:St,blur:ea,reset:l,refreshProducts:U,setMode:M=>_.current?.setMode(M),skipActivePill:Ve,endSubmitProgress:Zt,getVisitorId:Xt,refreshAnalyticsConsent:Jt}),[St,ea,l,U,Ve,Zt,Xt,Jt]);let nt=!!J.length||ht.length>0,gt=zt(M=>{if(!nt||M&&mt().isSubmitting)return;M&&B();let re=mt(),ft=hn(ta(),re.completedParams,re.skippedParams,{identifiedParams:re.identifiedParams,isReady:re.isReady,customFields:re.customFields});M&&jt(ft);let bt=n(ft);return M&&!le&&$t(bt),le&&l(),bt},[jt,$t,le,nt,B,mt,n,l,ta]);Ke.current=()=>gt(!1);let Va=de&&!ut.isInputEmpty&&nt,_a=zt(()=>gt(!0),[gt]),Ua=zt(M=>{M.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||St()},[St]),Qa=k==="inline",Ya=k==="dropdown";return Yt("div",{ref:be,className:`magicx-aia ${Ye.container} ${r??""}`,"data-pill-placement":k,"data-options-position":L,"data-animations":O?"on":"off","data-aia-options-style":X,"data-mode":bn(T),children:[pt(qt,{...ut,showPills:Ya,productsLayout:Te,productImageFallback:De,showProductVendor:fe,onSeeAllResults:Va?_a:void 0,fullWidth:de}),Yt("div",{className:Ye.inputWrapper,"data-aia-input-wrapper":"",onClick:Ua,children:[Yt("div",{ref:ce,className:Ye.editorArea,"data-aia-editor":"",children:[pt("div",{...qa,className:Ye.input,"data-aia-input":""}),Qa&&(Ue||we.length>0)&&pt("span",{ref:Fe,className:Ye.pillListContainer,"data-aia-pill-list-container":"",children:pt(Tt,{pills:we,activePillIndex:0,activeSelected:b,onSelectPill:qe,loading:Ue})})]}),$===null?null:$===void 0?pt(Ra,{disabled:!nt,ready:nt&&Ee,busy:Rt,onClick:()=>gt(!0),label:gn(v).submit}):pt("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Rt?"busy":void 0,"aria-busy":Rt?!0:void 0,className:Ye.submitSlot,onClick:M=>{nt&&(M.stopPropagation(),gt(!0))},children:$})]})]})});export{wn as AIAutocomplete,qt as AIAutocompleteDropdown,Is as DATE_RANGE_META_END,As as DATE_RANGE_META_START,Es as DEFAULT_OPTION_COUNT_UNIT,Hs as LOCATION_META_KEY,_s as PRODUCT_PATH_PREFIX,tl as TIME_META_KEY,il as WEEKDAY_LABELS,Cs as buildSubmitResult,Ts as cellDay,Ps as cellIso,zs as dateCellMarks,Rs as formatDate,Os as formatDateRange,Ls as formatOptionCount,Ds as formatPlace,Ms as formatTime,Ns as isoDate,Fs as monthLabel,Bs as optionCountLabel,Ws as optionHasImage,Gs as optionImageSources,Ks as optionImageSrc,qs as optionLabel,Vs as optionsShowLeadingVisuals,Us as parseDate,Qs as parseLooseDate,Ys as parseLooseDateRange,js as parseTime,$s as productFromMatchedItem,Zs as productImageSources,Xs as productsFromCustomFields,Js as sanitizeOptionIconSvg,el as selectedRangeFor,_t as useAIAutocomplete,al as visibleDateRange,ol as withSkippedParams};
3939
+ `,document.head.appendChild(e)}var Ra={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};import{jsx as qt}from"react/jsx-runtime";function Oa({disabled:e,ready:n,busy:t=!1,onClick:i,label:o=_o().submit}){return qt("button",{type:"button","data-aia-submit":"",className:Ra.submitButton,disabled:e,"data-aia-ready":n?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:s=>{s.stopPropagation(),i()},"aria-label":o,children:qt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":o,children:qt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Uo,dateSelectionFor as Qo,dropdownPillsFor as Yo,editingSuggestion as jo,HANDOFF_NOT_HANDLED as $o,identifiedParamLabel as Zo,withoutTraditionalAutocomplete as Xo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Ha,useEffect as We,useMemo as Jo,useRef as q,useState as en}from"react";import{useRef as La}from"react";function Da(e){let n=La(e);n.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=La({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(d,w,v)=>{let x=n.current?.[s];return x?x(d,w,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}import{useRef as Ma}from"react";function Na(e){let n=Ma(e);n.current=e;let t=Ma(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=n.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var Fa={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Vt({onSubmit:e,onResult:n,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:d,currency:w,productId:v,visitorId:x,analyticsConsent:m,columns:p=2,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:k,prependPlaceholder:T,allOption:L,showNonTappableOptions:O,locationSearch:X,showOptionIcons:W,showOptionImages:z,showOptionCounts:N,showSkipButton:H,showProducts:G,submitProgress:j,productImageFallback:E="image",showProductVendor:ae=!0,onFocus:ne,onBlur:V,value:ie,completedParams:S,onChange:F,onParamsChange:c,products:A,mapProducts:Te,onProductSelect:De,onProductAddToCart:fe,source:Ge,setCursor:Me}){let u=q(null),[Pe,Ne]=en(null),He=q(e);He.current=e;let g=q(n);g.current=n;let C=q(t);C.current=t;let P=q(F);P.current=F;let R=q(c);R.current=c;let D=q(ne);D.current=ne;let $=q(V);$.current=V;let le=q(Me);le.current=Me;let de=q(De);de.current=De;let Ie=q(fe);Ie.current=fe;let be=q(x);be.current=x;let Fe=q(()=>{let l=be.current;return typeof l=="function"?l():l}).current,ce=x!==void 0,Ke=q(m);Ke.current=m;let _=q(()=>{let l=Ke.current;return typeof l=="function"?l():l}).current,Ae=Na(A),Ze=q(Te);Ze.current=Te;let ut=q((l,U)=>{let B=Ze.current;return B?B(l,U):l}).current,we=Te?ut:void 0,qe=Da(i);We(()=>{if(typeof document>"u")return;let l=new Uo(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:w,productId:v,visitorId:ce?Fe:void 0,analyticsConsent:_,optionOverrides:qe.overrides,maskCompletedText:o,columns:p,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:k,prependPlaceholder:T,allOption:L,showNonTappableOptions:O,locationSearch:X,showProducts:G,submitProgress:j,source:Ge,value:ie,completedParams:S,onSubmit:(...B)=>He.current?.(...B),onResult:(...B)=>g.current?.(...B),onError:(...B)=>C.current?.(...B),onChange:(...B)=>P.current?.(...B),onParamsChange:(...B)=>R.current?.(...B),onFocus:()=>D.current?.(),onBlur:()=>$.current?.(),onProductSelect:B=>de.current?de.current(B):$o,onProductAddToCart:B=>Ie.current?.(B),setCursor:B=>le.current?.(B),products:Ae.config,mapProducts:we});u.current=l,Ne(l.getState());let U=l.subscribe(B=>Ne(B));return()=>{U(),l.destroy(),u.current===l&&(u.current=null)}},[]);let Ve=q(ce);We(()=>{Ve.current!==ce&&(Ve.current=ce,u.current?.update({visitorId:ce?Fe:void 0,analyticsConsent:_}))},[ce,Fe,_]);let J=typeof m=="function"?"function":m,ve=q(J);We(()=>{ve.current!==J&&(ve.current=J,u.current?.refreshAnalyticsConsent())},[J]),We(()=>{ie!==void 0&&u.current?.setValue(ie)},[ie]),We(()=>{S!==void 0&&u.current?.setCompletedParams(S)},[S]);let _e=JSON.stringify(s??null),a;try{a=JSON.stringify(r??null)}catch{a="[unstringifiable]"}We(()=>{u.current?.update({apiConfig:s,additionalContext:r,language:d,currency:w,productId:v,optionOverrides:qe.overrides,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:k,prependPlaceholder:T,allOption:L,showNonTappableOptions:O,locationSearch:X,showProducts:G,submitProgress:j})},[_e,a,d,w?.code,w?.rate,w?.country,v,qe.key,h,y,k,T,L,O,X,G,j]);let Z=q(!1);We(()=>{if(!Z.current){Z.current=!0;return}u.current?.update({products:Ae.config})},[Ae.enabled]),We(()=>{u.current?.update({mapProducts:we})},[we]);let xe=q(null);xe.current===null&&(xe.current={handleTextChange:l=>u.current?.handleTextChange(l),handleCompositionText:l=>u.current?.handleCompositionText(l),handleKeyDown:l=>{let U="nativeEvent"in l?l.nativeEvent:l;u.current?.handleKeyDown(U)},setFocused:l=>u.current?.setFocused(l),startEditingParam:l=>u.current?.startEditingParam(l),removeParam:l=>u.current?.removeParam(l)??!1,exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:l=>u.current?.handleCaretAfterInput(l),handleCaretMove:l=>u.current?.handleCaretMove(l),replaceEditingRange:l=>u.current?.replaceEditingRange(l)??!1,setActivePill:l=>u.current?.setActivePill(l),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),refreshProducts:()=>u.current?.refreshProducts(),prepareSubmit:()=>u.current?.prepareSubmit(),getState:()=>u.current?.getState()??Fa,recordSubmit:l=>u.current?.recordSubmit(l),holdSubmit:l=>u.current?.holdSubmit(l),endSubmitProgress:()=>u.current?.endSubmitProgress(),getSearchId:()=>u.current?.getSearchId(),getVisitorId:()=>u.current?.getVisitorId(),refreshAnalyticsConsent:()=>u.current?.refreshAnalyticsConsent(),selectOption:(l,U)=>u.current?.selectOption(l,U),selectProduct:l=>u.current?.selectProduct(l),addProductToCart:l=>{let U=u.current;return!U||!Ie.current?Promise.resolve():U.addProductToCart(l)},setActiveDropdownIndex:l=>u.current?.setActiveDropdownIndex(l),clearHighlight:l=>u.current?.clearHighlight(l),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),setTime:l=>u.current?.setTime(l),commitTime:()=>u.current?.commitTime(),toggleMultiSelectOption:l=>u.current?.toggleMultiSelectOption(l),commitMultiSelect:()=>u.current?.commitMultiSelect(),setLocationQuery:l=>u.current?.setLocationQuery(l),moveLocationHighlight:l=>u.current?.moveLocationHighlight(l),commitLocation:l=>u.current?.commitLocation(l),setLocationFieldFocused:l=>u.current?.setLocationFieldFocused(l),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let f=xe.current,Ue=Ha(l=>{let U=l.target.value,gt=U.length>0&&!l.nativeEvent?.isComposing&&U[0]!==U[0].toUpperCase()?U[0].toUpperCase()+U.slice(1):U;u.current?.handleTextChange(gt)},[]),Ee=Ha(l=>{u.current?.handleKeyDown(l.nativeEvent)},[]),ye=u.current,b=Pe??Fa,Xe=ie!==void 0?ie:b.text,Je=S!==void 0?S:b.completedParams,ze=b.actionableSuggestions,et=ze[0],tt=Jo(()=>Xo(ze),[ze]),Re=ye?.listboxId??"",at=b.activeDropdownIndex>=0&&ye?`${Re}-option-${b.activeDropdownIndex}`:void 0,Oe=b.editingParam,ke=b.editingIdentified,it=Oe?jo(Oe):ke?{parameter:ke.parameter,text:Zo(ke.parameter),required:!0,options:[]}:null,Qe=b.dropdownSuggestion??it??et,ot=Yo(b.dropdownSuggestion,it,ze),I=Qo(b),mt=!ye||b.dropdownLoading;return{completedParams:Je,multiSelectView:b.multiSelectView,toggleMultiSelectOption:f.toggleMultiSelectOption,commitMultiSelect:f.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:tt,setActivePill:f.setActivePill,skipActivePill:f.skipActivePill,removeLastParam:f.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:f.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:mt,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:Re,error:b.error,products:b.products,customFields:b.customFields,selectProduct:f.selectProduct,addProductToCart:f.addProductToCart,handleTextChange:f.handleTextChange,handleCompositionText:f.handleCompositionText,handleKeyDown:f.handleKeyDown,setFocused:f.setFocused,editingParam:Oe,editingIdentified:ke,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:f.startEditingParam,removeParam:f.removeParam,exitEditMode:f.exitEditMode,handleCaretAfterInput:f.handleCaretAfterInput,handleCaretMove:f.handleCaretMove,replaceEditingRange:f.replaceEditingRange,inputProps:{value:Xe,placeholder:b.placeholderText||void 0,onChange:Ue,onKeyDown:Ee,onFocus:f.handleFocus,onBlur:f.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":at,"aria-autocomplete":"list","aria-controls":Re},reset:f.reset,refreshProducts:f.refreshProducts,prepareSubmit:f.prepareSubmit,getState:f.getState,recordSubmit:f.recordSubmit,holdSubmit:f.holdSubmit,endSubmitProgress:f.endSubmitProgress,getSearchId:f.getSearchId,getVisitorId:f.getVisitorId,refreshAnalyticsConsent:f.refreshAnalyticsConsent,isSubmitting:b.isSubmitting,selectingProductId:b.selectingProductId,dropdownProps:{suggestions:Qe?[{...Qe,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:f.selectOption,onHighlight:f.setActiveDropdownIndex,onUnhighlight:f.clearHighlight,isOpen:b.isDropdownOpen,id:Re,pills:ot,activeSelected:b.isActivePillSelected,onPillClick:f.setActivePill,onSkip:f.skipActivePill,showSkipButton:(H??!0)&&!Oe&&!ke,showOptionIcons:W??!0,showOptionImages:z??!0,showOptionCounts:N??!0,skipDisabled:b.inSelectionAnimation,isLoading:mt,skeletonExiting:b.skeletonExiting,isInputEmpty:Xe.trim().length===0,language:d,products:b.products,productImageFallback:E,showProductVendor:ae,onProductSelect:f.selectProduct,busyProductId:b.selectingProductId,seeAllBusy:b.isSubmitting,onProductAddToCart:fe?f.addProductToCart:void 0,onProductFocusChange:f.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:I.selectedIso,selectedDateRange:I.selectedRange,dateRangeStart:I.rangeStart,dateReferences:I.references,onPreviousMonth:f.showPreviousMonth,onNextMonth:f.showNextMonth,timeView:b.timeView,multiSelectView:b.dropdownMultiSelect,onMultiSelectCommit:f.commitMultiSelect,onTimeChange:f.setTime,onTimeCommit:f.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:f.setLocationQuery,onLocationMove:f.moveLocationHighlight,onLocationCommit:f.commitLocation,onLocationFocusChange:f.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:y??"below"}}}import{attachChipRemove as tn,cancelStartingHint as an,chipIdFromTap as on,extractPlainText as Ba,getCursorOffset as Wa,keepCaretOnChip as nn,plainTextLength as rn,renderEditableContent as sn,setCursorOffset as Ga,startingHintOptions as ln}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ge,useEffect as dt,useLayoutEffect as _t,useRef as ct}from"react";var Et;function dn(){if(Et!==void 0)return Et;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Et=e.contentEditable==="plaintext-only",Et}function Ka(e){let{segments:n,showChipIcons:t=!0,showChipImages:i=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:d,editingIdentified:w,editingAnchor:v,caretOffset:x,placeholderText:m,hintSuggestions:p,isFocused:h,isDropdownOpen:y,listboxId:k,activeDescendantId:T,autoFocus:L,handleTextChange:O,handleCompositionText:X,handleKeyDown:W,handleCaretAfterInput:z,handleCaretMove:N,startEditingParam:H,replaceEditingRange:G,setFocused:j}=e,E=ct(null),ae=ct(!1),ne=ct(""),V=ct(""),ie=ct(null),S=ct(0);ie.current=x,dt(()=>{if(!L)return;let g=E.current;if(!g)return;document.activeElement===g?j(!0):g.focus();let C=g.ownerDocument??document,P=C.getSelection(),R=P&&P.rangeCount>0&&g.contains(P.anchorNode);if(P&&!R){let D=C.createRange();D.selectNodeContents(g),D.collapse(!0),P.removeAllRanges(),P.addRange(D)}},[L,j]),dt(()=>{let g=E.current;if(!g)return;let C=g.ownerDocument??document,P=()=>{let R=C.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!g.contains(R.anchorNode))return;let D=R.anchorNode,$=D.nodeType===Node.ELEMENT_NODE?D:D.parentElement,de=(R.isCollapsed?$?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ie=d?.id??w?.id??null;if(de&&de!==Ie){H(de);return}performance.now()-S.current<50||N(Wa(g))};return C.addEventListener("selectionchange",P),()=>C.removeEventListener("selectionchange",P)},[d,w,H,N]),dt(()=>{let g=E.current;if(!g)return;let C=P=>{let R=on(g,P.target);R&&(H(R),nn(g,R))};return g.addEventListener("click",C),()=>g.removeEventListener("click",C)},[H]),dt(()=>{let g=E.current;if(!(!g||!s||!o))return tn(g,s)},[s,o]),_t(()=>{let g=E.current;g&&sn({input:g,segments:n,newParamId:r,editingParamId:d?.id??null,placeholderText:m??"",isFocused:h,showChipIcons:t,showChipImages:i,showChipRemove:o,hintOptions:ln(p??[])})},[n,r,d,m,p,h,t,i,o]),dt(()=>{let g=E.current;return()=>{g&&an(g)}},[]),_t(()=>{let g=ne.current,C=r??"";if(ne.current=C,!C||C===g)return;let P=E.current;if(!P)return;P.focus();let R=ie.current??rn(P);Ga(P,R)},[r]),_t(()=>{let g=V.current,C=d?.id??"";if(V.current=C,!C||C===g||v==null)return;let P=E.current;P&&Ga(P,v)},[d,v]);let F=ge(()=>{let g=E.current;if(!g)return;let C=Ba(g),R=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(ae.current){X(R);return}O(R)},[O,X]),c=ge(()=>{S.current=performance.now(),F();let g=E.current;g&&z(Wa(g))},[F,z]);dt(()=>{let g=E.current;if(!g)return;let C=P=>{let R=P,D=R.inputType;if(D==="insertParagraph"||D==="insertLineBreak"||D==="insertFromDrop"){P.preventDefault();return}if(D.startsWith("insert")||D.startsWith("delete")){let $=D.startsWith("delete")?"":R.data??"";G($)&&P.preventDefault()}};return g.addEventListener("beforeinput",C),()=>g.removeEventListener("beforeinput",C)},[G]);let A=ge(()=>{ae.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),Te=ge(()=>{ae.current=!1,E.current?.removeAttribute("data-aia-composing"),F()},[F]),De=ge(g=>{g.preventDefault();let C=E.current;if(!C)return;let P=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!P)return;let R=C.ownerDocument??document,D=R.getSelection();if(!D||D.rangeCount===0)return;let $=D.getRangeAt(0);if(!C.contains($.startContainer))return;$.deleteContents();let le=R.createTextNode(P);$.insertNode(le),$.setStartAfter(le),$.collapse(!0),D.removeAllRanges(),D.addRange($),F()},[F]),fe=ge(g=>W(g),[W]),Ge=ge(()=>j(!0),[j]),Me=ge(()=>j(!1),[j]),u=ge(()=>E.current?.focus(),[]),Pe=ge(()=>E.current?.blur(),[]),Ne=ge(()=>{let g=E.current;return g?Ba(g):""},[]),He=dn()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:He,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":k,"aria-expanded":y,"aria-activedescendant":T,spellCheck:!0,enterKeyHint:"send",onInput:c,onKeyDown:fe,onCompositionStart:A,onCompositionEnd:Te,onPaste:De,onFocus:Ge,onBlur:Me},getPlainText:Ne,focus:u,blur:Pe}}import{jsx as ht,jsxs as Qt}from"react/jsx-runtime";function wn(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var vn=cn(function({onSubmit:n,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:d,additionalContext:w,language:v,currency:x,productId:m,visitorId:p,analyticsConsent:h,columns:y,pillPlacement:k="dropdown",mode:T="auto",optionsPosition:L="below",animations:O=!0,optionsStyle:X="floating",dropdownTrigger:W,closeDropdownOnBlur:z,prependPlaceholder:N,allOption:H,showNonTappableOptions:G,locationSearch:j,showOptionIcons:E=!0,showChipIcons:ae=!0,showChipImages:ne=!0,showChipRemove:V=!1,showOptionImages:ie=!0,showOptionCounts:S=!0,showSkipButton:F,showProducts:c,submitProgress:A,productsLayout:Te,productImageFallback:De,showProductVendor:fe,autoFocus:Ge=!0,onFocus:Me,onBlur:u,value:Pe,completedParams:Ne,onChange:He,onParamsChange:g,products:C,mapProducts:P,onProductSelect:R,onProductAddToCart:D,submitButton:$,resetOnSubmit:le=!0,seeAllResults:de=!1},Ie){let be=pt(null),Fe=pt(null),ce=pt(null),Ke=pt(()=>{}),_=pt(null),Ae=pt(null);Ut(()=>{let M=be.current;if(M)return _.current?_.current.setMode(T):_.current=new mn(M,T),()=>{_.current?.destroy(),_.current=null}},[T]);let Ze=zt(M=>{let re=Ae.current?.current;re&&(re.focus(),gn(re,M))},[]),{completedParams:ut,suggestionPills:we,setActivePill:qe,skipActivePill:Ve,segments:J,newParamId:ve,clearNewParamId:_e,placeholderText:a,isFocused:Z,isDropdownOpen:xe,isActivePillSelected:f,isLoading:Ue,isReady:Ee,activeIndex:ye,listboxId:b,handleTextChange:Xe,handleCompositionText:Je,handleKeyDown:ze,setFocused:et,editingParam:tt,editingIdentified:Re,editingAnchor:at,caretOffset:Oe,startEditingParam:ke,removeParam:it,handleCaretAfterInput:Qe,handleCaretMove:ot,replaceEditingRange:I,dropdownProps:mt,reset:l,refreshProducts:U,prepareSubmit:B,getState:gt,recordSubmit:Yt,holdSubmit:jt,endSubmitProgress:$t,getSearchId:Zt,getVisitorId:Xt,refreshAnalyticsConsent:Jt,isSubmitting:Rt}=Vt({onSubmit:M=>Ke.current(M),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:d,additionalContext:w,language:v,currency:x,productId:m,visitorId:p,analyticsConsent:h,columns:y,dropdownTrigger:W,optionsPosition:L,closeDropdownOnBlur:z,prependPlaceholder:N,allOption:H,showNonTappableOptions:G,locationSearch:j,showOptionIcons:E,showOptionImages:ie,showOptionCounts:S,showSkipButton:F,showProducts:c,submitProgress:A,onFocus:Me,onBlur:u,value:Pe,completedParams:Ne,onChange:He,onParamsChange:g,products:C,mapProducts:P,onProductSelect:R,onProductAddToCart:D,source:"full-sdk",setCursor:Ze});Ut(()=>{if(!ve)return;let M=window.setTimeout(()=>_e(),650);return()=>window.clearTimeout(M)},[ve,_e]);let qa=ye>=0?`${b}-option-${ye}`:void 0,{inputRef:Ot,editorProps:Va,focus:St,blur:ea,getPlainText:ta}=Ka({segments:J,newParamId:ve,editingParam:tt,editingIdentified:Re,editingAnchor:at,caretOffset:Oe,placeholderText:a,hintSuggestions:k==="inline"?[]:we,isFocused:Z,showChipIcons:ae,showChipImages:ne,showChipRemove:V,removeParam:it,isDropdownOpen:xe,listboxId:b,activeDescendantId:qa,autoFocus:Ge,handleTextChange:Xe,handleCompositionText:Je,handleKeyDown:ze,handleCaretAfterInput:Qe,handleCaretMove:ot,startEditingParam:ke,replaceEditingRange:I,setFocused:et});Ae.current=Ot,hn(()=>{let M=Fe.current,re=Ot.current;if(!M||!re)return;let bt=()=>{let aa=M.firstElementChild;if(!aa)return;let $a=aa.getBoundingClientRect(),Za=re.getBoundingClientRect();$a.top>=Za.bottom-2?M.setAttribute("data-aia-pill-wrapped",""):M.removeAttribute("data-aia-pill-wrapped")};bt();let wt=new ResizeObserver(bt);return wt.observe(re),()=>wt.disconnect()},[J,we.length,Ue,Ot]),Ut(()=>{let M=ce.current;if(M)return bn(M)},[]),pn(Ie,()=>({focus:St,blur:ea,reset:l,refreshProducts:U,setMode:M=>_.current?.setMode(M),skipActivePill:Ve,endSubmitProgress:$t,getSearchId:Zt,getVisitorId:Xt,refreshAnalyticsConsent:Jt}),[St,ea,l,U,Ve,$t,Zt,Xt,Jt]);let nt=!!J.length||ut.length>0,ft=zt(M=>{if(!nt||M&&gt().isSubmitting)return;M&&B();let re=gt(),bt=un(ta(),re.completedParams,re.skippedParams,{identifiedParams:re.identifiedParams,isReady:re.isReady,customFields:re.customFields});M&&Yt(bt);let wt=n(bt);return M&&!le&&jt(wt),le&&l(),wt},[Yt,jt,le,nt,B,gt,n,l,ta]);Ke.current=()=>ft(!1);let _a=de&&!mt.isInputEmpty&&nt,Ua=zt(()=>ft(!0),[ft]),Qa=zt(M=>{M.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||St()},[St]),Ya=k==="inline",ja=k==="dropdown";return Qt("div",{ref:be,className:`magicx-aia ${Ye.container} ${r??""}`,"data-pill-placement":k,"data-options-position":L,"data-animations":O?"on":"off","data-aia-options-style":X,"data-mode":wn(T),children:[ht(Kt,{...mt,showPills:ja,productsLayout:Te,productImageFallback:De,showProductVendor:fe,onSeeAllResults:_a?Ua:void 0,fullWidth:de}),Qt("div",{className:Ye.inputWrapper,"data-aia-input-wrapper":"",onClick:Qa,children:[Qt("div",{ref:ce,className:Ye.editorArea,"data-aia-editor":"",children:[ht("div",{...Va,className:Ye.input,"data-aia-input":""}),Ya&&(Ue||we.length>0)&&ht("span",{ref:Fe,className:Ye.pillListContainer,"data-aia-pill-list-container":"",children:ht(Tt,{pills:we,activePillIndex:0,activeSelected:f,onSelectPill:qe,loading:Ue})})]}),$===null?null:$===void 0?ht(Oa,{disabled:!nt,ready:nt&&Ee,busy:Rt,onClick:()=>ft(!0),label:fn(v).submit}):ht("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Rt?"busy":void 0,"aria-busy":Rt?!0:void 0,className:Ye.submitSlot,onClick:M=>{nt&&(M.stopPropagation(),ft(!0))},children:$})]})]})});export{vn as AIAutocomplete,Kt as AIAutocompleteDropdown,As as DATE_RANGE_META_END,Es as DATE_RANGE_META_START,zs as DEFAULT_OPTION_COUNT_UNIT,Fs as LOCATION_META_KEY,Us as PRODUCT_PATH_PREFIX,al as TIME_META_KEY,ol as WEEKDAY_LABELS,Ts as buildSubmitResult,Ps as cellDay,Is as cellIso,Rs as dateCellMarks,Os as formatDate,Ls as formatDateRange,Ds as formatOptionCount,Ms as formatPlace,Ns as formatTime,Hs as isoDate,Bs as monthLabel,Ws as optionCountLabel,Gs as optionHasImage,Ks as optionImageSources,qs as optionImageSrc,Vs as optionLabel,_s as optionsShowLeadingVisuals,Qs as parseDate,Ys as parseLooseDate,js as parseLooseDateRange,$s as parseTime,Zs as productFromMatchedItem,Xs as productImageSources,Js as productsFromCustomFields,el as sanitizeOptionIconSvg,tl as selectedRangeFor,Vt as useAIAutocomplete,il as visibleDateRange,nl as withSkippedParams};
3939
3940
  //# sourceMappingURL=index.mjs.map