@magicx-eng/ai-autocomplete-react 0.51.0 → 0.52.0

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 $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END as Jr,DATE_RANGE_META_START as es,DEFAULT_OPTION_COUNT_UNIT as ts,dateCellMarks as as,formatDate as is,formatDateRange as os,formatOptionCount as ns,formatPlace as rs,formatTime as ss,isoDate as ls,LOCATION_META_KEY as ds,monthLabel as cs,optionCountLabel as ps,optionHasImage as hs,optionImageSources as us,optionImageSrc as ms,optionLabel as gs,optionsShowLeadingVisuals as fs,PRODUCT_PATH_PREFIX as bs,parseDate as ws,parseLooseDate as vs,parseLooseDateRange as xs,parseTime as ys,productFromMatchedItem as ks,productImageSources as Cs,productsFromCustomFields as Ss,sanitizeOptionIconSvg as Ts,selectedRangeFor as Ps,TIME_META_KEY as Is,visibleDateRange as Es,WEEKDAY_LABELS as As,withSkippedParams as Ls}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Mo,useCallback as Dt,useEffect as Mt,useImperativeHandle as zo,useLayoutEffect as No,useRef as Xe}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 $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END as Jr,DATE_RANGE_META_START as es,DEFAULT_OPTION_COUNT_UNIT as ts,dateCellMarks as as,formatDate as is,formatDateRange as os,formatOptionCount as ns,formatPlace as rs,formatTime as ss,isoDate as ls,LOCATION_META_KEY as ds,monthLabel as cs,optionCountLabel as ps,optionHasImage as hs,optionImageSources as us,optionImageSrc as ms,optionLabel as gs,optionsShowLeadingVisuals as fs,PRODUCT_PATH_PREFIX as bs,parseDate as ws,parseLooseDate as vs,parseLooseDateRange as xs,parseTime as ys,productFromMatchedItem as ks,productImageSources as Cs,productsFromCustomFields as Ss,sanitizeOptionIconSvg as Ts,selectedRangeFor as Ps,TIME_META_KEY as Is,visibleDateRange as Es,WEEKDAY_LABELS as As,withSkippedParams as Rs}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Mo,useCallback as Dt,useEffect as Mt,useImperativeHandle as zo,useLayoutEffect as No,useRef as Xe}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
@@ -346,7 +346,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
346
346
  transition: none;
347
347
  }
348
348
  }
349
- `,document.head.appendChild(e)}var We={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 ji,attachViewportFit as $i,containScroll as Zi,dateFloorFor as Xi,destroyPanelMorph as Ji,findMultiSelectDone as eo,fitMultiSelectDone as to,hasSkippablePill as ao,isCalendarFormat as io,labelTraditionalAutocomplete as oo,panelMorphKey as no,queryLive as ro,settlePanelMorph as so,uiStringsFor as lo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ge,useLayoutEffect as Et,useRef as je,useState as co}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
349
+ `,document.head.appendChild(e)}var Be={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 ji,attachViewportFit as $i,containScroll as Zi,dateFloorFor as Xi,destroyPanelMorph as Ji,findMultiSelectDone as eo,fitMultiSelectDone as to,hasSkippablePill as ao,isCalendarFormat as io,labelTraditionalAutocomplete as oo,panelMorphKey as no,queryLive as ro,settlePanelMorph as so,uiStringsFor as lo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ke,useLayoutEffect as Et,useRef as je,useState as co}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
350
350
  * Built-in appearance defaults \u2014 zero specificity via :where().
351
351
  * Consumer CSS always wins without !important.
352
352
  *
@@ -1402,7 +1402,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
1402
1402
  /* biome-ignore lint/complexity/noImportantStyles: a row's own pointer-events: auto must not make the leaving copy catch taps */
1403
1403
  pointer-events: none !important;
1404
1404
  }
1405
- `,document.head.appendChild(e)}var me={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",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q",multiDone:"aia-multiDone-y12U7"};import{cellDay as Oa,cellIso as ot,dateCellMarks as Ra,isDimmedDay as Da,isoDate as Ma,monthLabel as za,visibleDateRange as Na,WEEKDAY_LABELS as Fa}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Ha}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) ---
1405
+ `,document.head.appendChild(e)}var xe={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",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q",multiDone:"aia-multiDone-y12U7"};import{cellDay as Oa,cellIso as ot,dateCellMarks as Da,isDimmedDay as Ma,isoDate as za,monthLabel as Na,visibleDateRange as Fa,WEEKDAY_LABELS as Ha}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Ba}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) ---
1406
1406
 
1407
1407
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1408
1408
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1589,7 +1589,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
1589
1589
  opacity: 0.8;
1590
1590
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1591
1591
  }
1592
- `,document.head.appendChild(e)}var H={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",pressed:"aia-pressed-bEyyN"};import{jsx as ge,jsxs as Gt}from"react/jsx-runtime";var Ba=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function qt({options:e,activeIndex:o,listboxId:a,view:i,selection:n,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:m,onNextMonth:b}){let x=Ma(new Date),u=Na({pendingStart:n.rangeStart,highlightedIso:ot(e[o]),selected:n.selectedRange,floor:n.floor});return Gt("div",{className:H.datepicker,"data-aia-datepicker":"",children:[Gt("div",{className:H.header,children:[ge("button",{type:"button",tabIndex:-1,className:H.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:c=>c.preventDefault(),onClick:m,children:"\u2039"}),ge("span",{className:H.month,"data-aia-date-month":"","aria-live":"polite",children:za(i)}),ge("button",{type:"button",tabIndex:-1,className:H.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:c=>c.preventDefault(),onClick:b,children:"\u203A"})]}),ge("div",{className:H.weekdays,"aria-hidden":"true",children:Fa.map((c,p)=>ge("span",{className:H.weekday,children:c},Ba[p]))}),ge("div",{className:H.grid,"data-aia-date-grid":"",children:e.map((c,p)=>ge(Wa,{option:c,id:`${a}-option-${p}`,index:p,isHighlighted:p===o&&c.is_tappable,isToday:ot(c)===x,isPast:Da(ot(c),x,n.floor),marks:Ra(ot(c),{selectedIso:n.selectedIso,range:u}),onSelect:s,onHighlight:r,onUnhighlight:l},ot(c)??`pad-${p}`))})]})}function Wa({option:e,id:o,index:a,isHighlighted:i,isToday:n,isPast:s,marks:r,onSelect:l,onHighlight:m,onUnhighlight:b}){let[x,u]=Ha(!1),c=Oa(e);if(c==null)return ge("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${H.cell} ${H.blank}`});let p=()=>{u(!0),l(e),setTimeout(()=>u(!1),170)},v=[H.cell,H.day,s?H.past:"",i?H.highlighted:"",n?H.today:"",r.inRange?H.inRange:"",r.selected?H.selected:"",x?H.pressed:""].filter(Boolean).join(" ");return ge("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:v,onClick:p,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),p())},onMouseEnter:()=>m(a),onMouseLeave:b?()=>b(a):void 0,children:ge("span",{className:H.number,children:c})})}import{ATTRIBUTION_URL as Ka,buildAttributionUrl as Ga,getFooterHint as qa,uiStringsFor as _a}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Va,useState as Ua}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 {
1592
+ `,document.head.appendChild(e)}var W={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",pressed:"aia-pressed-bEyyN"};import{jsx as ye,jsxs as Gt}from"react/jsx-runtime";var Wa=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function qt({options:e,activeIndex:o,listboxId:t,view:a,selection:i,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:m,onNextMonth:w}){let x=za(new Date),g=Fa({pendingStart:i.rangeStart,highlightedIso:ot(e[o]),selected:i.selectedRange,floor:i.floor});return Gt("div",{className:W.datepicker,"data-aia-datepicker":"",children:[Gt("div",{className:W.header,children:[ye("button",{type:"button",tabIndex:-1,className:W.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:c=>c.preventDefault(),onClick:m,children:"\u2039"}),ye("span",{className:W.month,"data-aia-date-month":"","aria-live":"polite",children:Na(a)}),ye("button",{type:"button",tabIndex:-1,className:W.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:c=>c.preventDefault(),onClick:w,children:"\u203A"})]}),ye("div",{className:W.weekdays,"aria-hidden":"true",children:Ha.map((c,h)=>ye("span",{className:W.weekday,children:c},Wa[h]))}),ye("div",{className:W.grid,"data-aia-date-grid":"",children:e.map((c,h)=>ye(Ka,{option:c,id:`${t}-option-${h}`,index:h,isHighlighted:h===o&&c.is_tappable,isToday:ot(c)===x,isPast:Ma(ot(c),x,i.floor),marks:Da(ot(c),{selectedIso:i.selectedIso,range:g}),onSelect:s,onHighlight:r,onUnhighlight:l},ot(c)??`pad-${h}`))})]})}function Ka({option:e,id:o,index:t,isHighlighted:a,isToday:i,isPast:s,marks:r,onSelect:l,onHighlight:m,onUnhighlight:w}){let[x,g]=Ba(!1),c=Oa(e);if(c==null)return ye("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${W.cell} ${W.blank}`});let h=()=>{g(!0),l(e),setTimeout(()=>g(!1),170)},v=[W.cell,W.day,s?W.past:"",a?W.highlighted:"",i?W.today:"",r.inRange?W.inRange:"",r.selected?W.selected:"",x?W.pressed:""].filter(Boolean).join(" ");return ye("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:v,onClick:h,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),h())},onMouseEnter:()=>m(t),onMouseLeave:w?()=>w(t):void 0,children:ye("span",{className:W.number,children:c})})}import{ATTRIBUTION_URL as Ga,buildAttributionUrl as qa,getFooterHint as _a,uiStringsFor as Va}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ua,useState as Qa}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 {
1593
1593
  display: flex;
1594
1594
  flex-wrap: wrap;
1595
1595
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1629,7 +1629,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
1629
1629
  .aia-cluster[data-justify="around"] {
1630
1630
  justify-content: space-around;
1631
1631
  }
1632
- `,document.head.appendChild(e)}import{jsx as _t}from"react/jsx-runtime";function nt({gap:e,align:o="center",justify:a="start",noWrap:i=!1,inline:n=!1,className:s,children:r,...l}){let m=e?{"--aia-cluster-gap":e}:void 0,b={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":o,"data-justify":a,"data-nowrap":i||void 0,"data-inline":n||void 0,style:m,...l};return n?_t("span",{...b,children:r}):_t("div",{...b,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
1632
+ `,document.head.appendChild(e)}import{jsx as _t}from"react/jsx-runtime";function nt({gap:e,align:o="center",justify:t="start",noWrap:a=!1,inline:i=!1,className:s,children:r,...l}){let m=e?{"--aia-cluster-gap":e}:void 0,w={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":o,"data-justify":t,"data-nowrap":a||void 0,"data-inline":i||void 0,style:m,...l};return i?_t("span",{...w,children:r}):_t("div",{...w,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
1633
1633
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1634
1634
  room above the hint/branding row so the footer doesn't butt against the last
1635
1635
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1776,7 +1776,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
1776
1776
  justify-content: flex-end;
1777
1777
  }
1778
1778
  }
1779
- `,document.head.appendChild(e)}var Se={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 xt}from"react/jsx-runtime";function Vt({isOptionHighlighted:e=!1,isInputEmpty:o=!1,strings:a=_a()}){let{key:i,hint:n}=qa(e,o,a),[s,r]=Ua(Ka);return Va(()=>{r(Ga())},[]),rt("footer",{className:Se.footer,"data-aia-footer":"",children:xt(nt,{justify:"between",noWrap:!0,className:Se.row,children:[xt(nt,{gap:"5px",className:Se.hintGroup,children:[rt("kbd",{className:Se.key,children:i}),rt("span",{className:Se.hint,children:n})]}),xt("a",{className:Se.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[rt("span",{className:Se.brand,children:"AI"}),rt("span",{className:Se.badge,children:"Autocomplete"})]})]})})}import{useEffect as Ut,useLayoutEffect as Qa,useRef as le}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
1779
+ `,document.head.appendChild(e)}var Ie={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 xt}from"react/jsx-runtime";function Vt({isOptionHighlighted:e=!1,isInputEmpty:o=!1,strings:t=Va()}){let{key:a,hint:i}=_a(e,o,t),[s,r]=Qa(Ga);return Ua(()=>{r(qa())},[]),rt("footer",{className:Ie.footer,"data-aia-footer":"",children:xt(nt,{justify:"between",noWrap:!0,className:Ie.row,children:[xt(nt,{gap:"5px",className:Ie.hintGroup,children:[rt("kbd",{className:Ie.key,children:a}),rt("span",{className:Ie.hint,children:i})]}),xt("a",{className:Ie.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[rt("span",{className:Ie.brand,children:"AI"}),rt("span",{className:Ie.badge,children:"Autocomplete"})]})]})})}import{useEffect as Ut,useLayoutEffect as Ya,useRef as re}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
1780
1780
  Angular copy). The three are kept identical by
1781
1781
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
1782
1782
  .aia-location-6-fsr {
@@ -1792,9 +1792,15 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
1792
1792
  gap: 8px;
1793
1793
  padding: 8px 10px;
1794
1794
  border-radius: var(--aia-location-field-radius, 10px);
1795
- background: var(--aia-location-field-bg, rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06));
1795
+ background: var(--aia-location-field-bg-idle, transparent);
1796
1796
  color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
1797
1797
  cursor: text;
1798
+ transition: background-color 120ms ease;
1799
+ }
1800
+
1801
+ .aia-field-xEzwi:hover,
1802
+ .aia-field-xEzwi:focus-within {
1803
+ background: var(--aia-location-field-bg, rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06));
1798
1804
  }
1799
1805
 
1800
1806
  .aia-icon-czx6C {
@@ -1818,6 +1824,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
1818
1824
 
1819
1825
  .aia-input-Yi9V-::placeholder {
1820
1826
  color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
1827
+ font-weight: 300;
1821
1828
  opacity: 0.7;
1822
1829
  }
1823
1830
 
@@ -1903,7 +1910,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
1903
1910
  .aia-loadingBar-OLCr4:nth-child(3) {
1904
1911
  width: 60%;
1905
1912
  }
1906
- `,document.head.appendChild(e)}var B={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 ie,jsxs as Re}from"react/jsx-runtime";var Ya=0;function st(e){return e.getRootNode().activeElement??null}function Yt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function ja(e){if(!e.isContentEditable)return null;let o=Yt(e);if(!o||o.rangeCount===0)return null;let a=o.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function Qt(e,o){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=Yt(e);if(!a)return;let i=o;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),a.removeAllRanges(),a.addRange(i)}var $a=Re("svg",{className:B.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[ie("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),ie("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Za=Re("svg",{className:B.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[ie("circle",{cx:"11",cy:"11",r:"7"}),ie("path",{d:"m20 20-3.5-3.5"})]});function jt({view:e,searchLabel:o,noResultsLabel:a,useTypedLabel:i,widgetFocused:n,visible:s=!0,interactive:r=!0,onQuery:l,onMove:m,onCommit:b,onFocusChange:x}){let u=le(null),c=le(null),p=le(null),v=le(null),A=le(null),N=le(!1),L=le(!1),F=le(!1),G=le(n);G.current=n;let O=le(x);O.current=x;let E=h=>{F.current=h,x(h)},k=()=>{let h=u.current;return h!=null&&st(h)===h},X=()=>{let h=c.current;if(!h)return;let P=st(h);P instanceof HTMLElement&&P!==u.current&&P!==document.body&&!h.contains(P)&&(v.current=P,A.current=ja(P))},_=le(null);_.current===null&&(_.current=`aia-location-${++Ya}`);let J=`${_.current}-row-`;Ut(()=>{let h=u.current;h&&h.value!==e.query&&st(h)!==h&&(h.value=e.query)},[e.query]),Ut(()=>{let h=u.current;if(h){if(!s&&k()){L.current=!0,z();return}if(!n){setTimeout(()=>{if(G.current)return;let P=v.current;P&&st(P)===P||(L.current=!1)},0);return}if(!(L.current||!r||k())){if(X(),E(!0),h.focus({preventScroll:!0}),!k()){L.current=!0,E(!1);return}h.value&&h.select()}}}),Qa(()=>()=>{if(!F.current)return;let h=u.current,P=v.current;P?.isConnected&&h&&st(h)===h&&(N.current=!0,Qt(P,A.current),N.current=!1),F.current=!1,O.current(!1)},[]);let z=(h=!1)=>{h&&(L.current=!0);let P=v.current;P?.isConnected&&k()&&(N.current=!0,Qt(P,A.current),N.current=!1),E(!1)},V=e.query.trim(),T=e.highlighted>=0&&e.highlighted<e.places.length?`${J}${e.highlighted}`:void 0,K=null;return e.places.length>0?K=e.places.map((h,P)=>Re("div",{id:`${J}${P}`,role:"option","aria-selected":P===e.highlighted,className:P===e.highlighted?`${B.row} ${B.highlighted}`:B.row,"data-aia-location-row":"","data-aia-index":P,onClick:()=>{r&&(z(!0),b(P))},children:[ie("span",{className:B.pin,children:$a}),Re("span",{className:B.text,children:[ie("span",{className:B.name,children:h.name}),h.secondary&&ie("span",{className:B.secondary,children:h.secondary})]})]},h.id)):e.status==="loading"?K=Re("div",{className:B.loading,"data-aia-location-loading":"",children:[ie("span",{className:B.loadingBar}),ie("span",{className:B.loadingBar}),ie("span",{className:B.loadingBar})]}):V&&(K=Re("div",{className:B.note,"data-aia-location-note":"",children:[e.status==="done"&&ie("span",{className:B.empty,children:a}),ie("span",{children:i})]})),Re("div",{ref:c,className:B.location,"data-aia-location":"",onMouseDown:h=>{!(h.target instanceof Node)||!p.current?.contains(h.target)||(h.stopPropagation(),X(),E(!0))},children:[Re("label",{ref:p,className:B.field,children:[Za,ie("input",{ref:u,type:"text",className:B.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:o,"aria-label":o,"aria-activedescendant":T,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:s?0:-1,onChange:h=>l(h.target.value),onFocus:()=>E(!0),onBlur:()=>{N.current||(L.current=!0,E(!1))},onKeyDown:h=>{if(!h.nativeEvent.isComposing)switch(h.key){case"ArrowDown":case"ArrowUp":h.preventDefault(),m(h.key==="ArrowDown"?1:-1);return;case"Enter":if(h.preventDefault(),!r)return;z(!0),b();return;case"Escape":h.preventDefault(),h.stopPropagation(),L.current=!0,z();return;case"Backspace":if(h.currentTarget.value!=="")return;h.preventDefault(),L.current=!0,z();return}}})]}),ie("div",{className:B.results,"data-aia-location-results":"","aria-live":"polite",children:K})]})}import{isSmartSuggestion as ti,isTraditionalAutocompleteSuggestion as ai}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Xa}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,
1913
+ `,document.head.appendChild(e)}var K={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 oe,jsxs as Me}from"react/jsx-runtime";var ja=0;function st(e){return e.getRootNode().activeElement??null}function jt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Qt(e){if(!e.isContentEditable)return null;let o=jt(e);if(!o||o.rangeCount===0)return null;let t=o.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function Yt(e,o){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=jt(e);if(!t)return;let a=o;(!a||!a.startContainer.isConnected||!e.contains(a.startContainer))&&(a=document.createRange(),a.selectNodeContents(e),a.collapse(!1)),t.removeAllRanges(),t.addRange(a)}var $a=Me("svg",{className:K.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[oe("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),oe("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Za=Me("svg",{className:K.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[oe("circle",{cx:"11",cy:"11",r:"7"}),oe("path",{d:"m20 20-3.5-3.5"})]});function $t({view:e,searchLabel:o,noResultsLabel:t,useTypedLabel:a,widgetFocused:i,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:m,onMove:w,onCommit:x,onFocusChange:g}){let c=re(null),h=re(null),v=re(null),E=re(null),F=re(null),M=re(!1),O=re(!1),V=re(!1),R=re(!1),D=re(i);D.current=i;let S=re(g);S.current=g;let H=d=>{R.current=d,g(d)},U=()=>{let d=c.current;return d!=null&&st(d)===d},X=()=>{let d=h.current;if(!d)return;let I=st(d);I instanceof HTMLElement&&I!==c.current&&I!==document.body&&!d.contains(I)&&(E.current=I,F.current=Qt(I))},q=d=>{let I=h.current;!I||!(d instanceof HTMLElement)||d===E.current||d===document.body||I.contains(d)||(E.current=d,F.current=Qt(d))},_=re(null);_.current===null&&(_.current=`aia-location-${++ja}`);let T=`${_.current}-row-`;Ut(()=>{let d=c.current;d&&d.value!==e.query&&st(d)!==d&&(d.value=e.query)},[e.query]),Ut(()=>{i&&(s&&!V.current&&(O.current=!1),V.current=s);let d=c.current;if(d){if(!r&&U()){O.current=!0,B();return}if(!i){setTimeout(()=>{if(D.current)return;let I=E.current;I&&st(I)===I||(O.current=!1)},0);return}if(!(!s||O.current||!l||U())){if(X(),H(!0),d.focus({preventScroll:!0}),!U()){O.current=!0,H(!1);return}d.value&&d.select()}}}),Ya(()=>()=>{if(!R.current)return;let d=c.current,I=E.current;I?.isConnected&&d&&st(d)===d&&(M.current=!0,Yt(I,F.current),M.current=!1),R.current=!1,S.current(!1)},[]);let B=(d=!1)=>{d&&(O.current=!0);let I=E.current;I?.isConnected&&U()&&(M.current=!0,Yt(I,F.current),M.current=!1),H(!1)},he=e.query.trim(),se=e.highlighted>=0&&e.highlighted<e.places.length?`${T}${e.highlighted}`:void 0,ne=null;return e.places.length>0?ne=e.places.map((d,I)=>Me("div",{id:`${T}${I}`,role:"option","aria-selected":I===e.highlighted,className:I===e.highlighted?`${K.row} ${K.highlighted}`:K.row,"data-aia-location-row":"","data-aia-index":I,onClick:()=>{l&&(B(!0),x(I))},children:[oe("span",{className:K.pin,children:$a}),Me("span",{className:K.text,children:[oe("span",{className:K.name,children:d.name}),d.secondary&&oe("span",{className:K.secondary,children:d.secondary})]})]},d.id)):e.status==="loading"?ne=Me("div",{className:K.loading,"data-aia-location-loading":"",children:[oe("span",{className:K.loadingBar}),oe("span",{className:K.loadingBar}),oe("span",{className:K.loadingBar})]}):he&&(ne=Me("div",{className:K.note,"data-aia-location-note":"",children:[e.status==="done"&&oe("span",{className:K.empty,children:t}),oe("span",{children:a})]})),Me("div",{ref:h,className:K.location,"data-aia-location":"",onMouseDown:d=>{!(d.target instanceof Node)||!v.current?.contains(d.target)||(d.stopPropagation(),X(),H(!0))},children:[Me("label",{ref:v,className:K.field,children:[Za,oe("input",{ref:c,type:"text",className:K.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:o,"aria-label":o,"aria-activedescendant":se,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:d=>m(d.target.value),onFocus:d=>{q(d.relatedTarget),H(!0)},onBlur:()=>{M.current||(O.current=!0,H(!1))},onKeyDown:d=>{if(!d.nativeEvent.isComposing)switch(d.key){case"ArrowDown":case"ArrowUp":d.preventDefault(),w(d.key==="ArrowDown"?1:-1);return;case"Enter":if(d.preventDefault(),!l)return;B(!0),x();return;case"Escape":d.preventDefault(),d.stopPropagation(),O.current=!0,B();return;case"Backspace":if(d.currentTarget.value!=="")return;d.preventDefault(),O.current=!0,B();return}}})]}),oe("div",{className:K.results,"data-aia-location-results":"","aria-live":"polite",children:ne})]})}import{isSmartSuggestion as ti,isTraditionalAutocompleteSuggestion as ai}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Xa}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,
1907
1914
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1908
1915
  The border is kept as a 1px transparent line so the box stays the same size
1909
1916
  as it was when the outline was dashed. */
@@ -2086,7 +2093,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
2086
2093
  opacity: 0;
2087
2094
  }
2088
2095
  }
2089
- `,document.head.appendChild(e)}var fe={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",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};import{Fragment as Ja,jsx as yt,jsxs as ei}from"react/jsx-runtime";var kt={selected:1,first:.7,next:.4,last:.2};function $t({label:e,state:o,active:a,rounded:i,loading:n,smartSuggestion:s,completionHeader:r,onClick:l}){let m=[fe.pill,i?fe.rounded:"",n?fe.skeleton:""].filter(Boolean).join(" ");return yt("button",{type:"button","data-aia-pill":"","data-aia-pill-active":a?"":void 0,"data-aia-loading":n?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:m,style:{"--aia-pill-opacity":kt[o]},onMouseDown:b=>b.preventDefault(),onClick:n?void 0:l,disabled:n,children:s?ei(Ja,{children:[yt("span",{className:`${fe.smartText} magicx-aia-smart-suggestion-text`,children:e}),yt("span",{className:`${fe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Xa}})]}):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 {
2096
+ `,document.head.appendChild(e)}var ke={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",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};import{Fragment as Ja,jsx as yt,jsxs as ei}from"react/jsx-runtime";var kt={selected:1,first:.7,next:.4,last:.2};function Zt({label:e,state:o,active:t,rounded:a,loading:i,smartSuggestion:s,completionHeader:r,onClick:l}){let m=[ke.pill,a?ke.rounded:"",i?ke.skeleton:""].filter(Boolean).join(" ");return yt("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:m,style:{"--aia-pill-opacity":kt[o]},onMouseDown:w=>w.preventDefault(),onClick:i?void 0:l,disabled:i,children:s?ei(Ja,{children:[yt("span",{className:`${ke.smartText} magicx-aia-smart-suggestion-text`,children:e}),yt("span",{className:`${ke.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Xa}})]}):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 {
2090
2097
  position: relative;
2091
2098
  z-index: 1;
2092
2099
  pointer-events: auto;
@@ -2096,7 +2103,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
2096
2103
  align-items: center;
2097
2104
  vertical-align: middle;
2098
2105
  }
2099
- `,document.head.appendChild(e)}var Ct={list:"aia-list-qvLqO"};import{jsx as ct}from"react/jsx-runtime";var ii=[125,69];function Zt(e){return e===0?"first":e===1?"next":"last"}function pt({pills:e,activePillIndex:o,onSelectPill:a,activeSelected:i,rounded:n,loading:s}){return s&&e.length===0?ct("span",{className:Ct.list,"data-aia-pill-list-loading":"",children:ii.map((r,l)=>ct("span",{"data-aia-pill-skeleton":"",className:`${fe.pill} ${n?fe.rounded:""} ${fe.skeleton}`,style:{width:r,"--aia-pill-opacity":kt[Zt(l)]}},`skel-${r}`))}):ct("span",{className:Ct.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let m=!!i&&l===o;return ct($t,{label:r.text,state:m?"selected":Zt(l),selected:m,active:l===o,rounded:n,loading:s,smartSuggestion:ti(r),completionHeader:ai(r),onClick:()=>a(l)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as oi,productImageSources as ni,productImageSrc as ri,productInitial as si,productPhotoFill as li,uiStringsFor as di}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as St,useRef as ht,useState as ut}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
2106
+ `,document.head.appendChild(e)}var Ct={list:"aia-list-qvLqO"};import{jsx as ct}from"react/jsx-runtime";var ii=[125,69];function Xt(e){return e===0?"first":e===1?"next":"last"}function pt({pills:e,activePillIndex:o,onSelectPill:t,activeSelected:a,rounded:i,loading:s}){return s&&e.length===0?ct("span",{className:Ct.list,"data-aia-pill-list-loading":"",children:ii.map((r,l)=>ct("span",{"data-aia-pill-skeleton":"",className:`${ke.pill} ${i?ke.rounded:""} ${ke.skeleton}`,style:{width:r,"--aia-pill-opacity":kt[Xt(l)]}},`skel-${r}`))}):ct("span",{className:Ct.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let m=!!a&&l===o;return ct(Zt,{label:r.text,state:m?"selected":Xt(l),selected:m,active:l===o,rounded:i,loading:s,smartSuggestion:ti(r),completionHeader:ai(r),onClick:()=>t(l)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as oi,productImageSources as ni,productImageSrc as ri,productInitial as si,productPhotoFill as li,uiStringsFor as di}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as St,useRef as ht,useState as ut}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
2100
2107
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
2101
2108
  theming one package sees the same result in the other.
2102
2109
 
@@ -2552,7 +2559,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
2552
2559
  .aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT[data-aia-product-has-cart] {
2553
2560
  padding-right: calc(var(--aia-product-cart-size, 19.6px) + 11.2px);
2554
2561
  }
2555
- `,document.head.appendChild(e)}var W={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"};import{jsx as j,jsxs as Ye}from"react/jsx-runtime";function Xt({products:e,listboxId:o,onSelect:a,onAddToCart:i,onFocusChange:n,focusable:s=!0,layout:r="row",imageFallback:l="image",strings:m=di()}){let b=e.length>0,x=ht(null);if(St(()=>{let c=x.current;if(!(!b||!c))return oi(c)},[b]),!b)return null;let u=`${o}-products-label`;return Ye("section",{className:W.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":u,children:[j("div",{className:W.label,id:u,"data-aia-products-label":"",children:m.products}),j("div",{ref:x,className:W.row,"data-aia-products-row":"",children:e.map((c,p)=>j(ci,{product:c,id:`${o}-product-${p}`,onSelect:a,onAddToCart:i,onFocusChange:n,focusable:s,imageFallback:l,soldOut:m.soldOut,addToCart:m.addToCart},c.id))})]})}function ci({product:e,id:o,onSelect:a,onAddToCart:i,onFocusChange:n,focusable:s,imageFallback:r,soldOut:l,addToCart:m}){let b=!!i&&e.available!==!1,[x,u]=ut(null),c=v=>{v.relatedTarget?.closest("[data-aia-dropdown]")||n?.(!1)},p=v=>{v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||v.button!==0||(v.preventDefault(),a(e))};return Ye("a",{id:o,className:W.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":b?"":void 0,role:"option","aria-selected":!1,style:x?{"--aia-product-photo-fill-x":String(x.x),"--aia-product-photo-fill-y":String(x.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:p,onKeyDown:v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),a(e))},onFocus:()=>n?.(!0),onBlur:c,children:[j(ui,{sources:ni(e.imageUrl),title:e.title,fallback:r,onPhotoFill:u},ri(e.imageUrl)??""),Ye("span",{className:W.body,children:[e.vendor?j("span",{className:W.vendor,children:e.vendor}):null,j("span",{className:W.title,children:e.title}),e.price?Ye("span",{className:W.price,children:[e.price,e.compareAtPrice?j("s",{className:W.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?j("span",{className:W.badge,children:l}):null]}),b&&i?j(hi,{product:e,label:`${m}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>n?.(!0),onBlur:c},pi(e)):null]})}function pi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(o=>o??"").join("\0")}function hi({product:e,label:o,focusable:a,onAddToCart:i,onFocus:n,onBlur:s}){let[r,l]=ut(null),m=ht(null),b=ht(e);b.current=e;let x=ht(!0);St(()=>(x.current=!0,()=>{x.current=!1}),[]);let u=p=>{m.current=p,x.current&&l(p)},c=p=>{if(p.preventDefault(),p.stopPropagation(),m.current==="adding")return;u("adding");let v;try{v=Promise.resolve(i(b.current))}catch(A){v=Promise.reject(A)}v.then(()=>u("added"),()=>u(null))};return j("span",{className:W.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":o,tabIndex:a?0:-1,onClick:c,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||c(p)},onFocus:p=>{p.stopPropagation(),n()},onBlur:p=>{p.stopPropagation(),s(p)},children:Ye("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[j("path",{className:W.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"}),j("path",{className:W.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),j("path",{className:W.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),j("path",{className:W.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),j("circle",{className:W.cartGlyph,cx:"9",cy:"20",r:"1.3"}),j("circle",{className:W.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function ui({sources:e,title:o,fallback:a,onPhotoFill:i}){let[n,s]=ut(0),r=e[n],l=!!r,[m,b]=ut(null),x=!l&&a==="initial";return St(()=>()=>i(null),[i]),Ye("span",{className:W.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":l&&m===r?"":void 0,children:[l?j("img",{className:W.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:u=>{b(r),i(li(u.currentTarget.naturalWidth,u.currentTarget.naturalHeight))},onError:()=>{n+1>=e.length&&i(null),s(u=>u+1)}}):null,x?si(o):null]})}import{isOptionsGridMobileViewport as Ei,measureOptionsGrid as Ai,needsOptionsGridMeasurement as Li,OPTIONS_GRID_MOBILE_QUERY as Oi,optionEnterDelayMs as Ri,optionsShowLeadingVisuals as Di,planOptionsGrid as aa,sameOptionRows as Mi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as zi,useLayoutEffect as Ni,useRef as ia,useState as na}from"react";import{optionsGridTemplateColumns as mi}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as gi,useRef as fi}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 {
2562
+ `,document.head.appendChild(e)}var G={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"};import{jsx as j,jsxs as Ye}from"react/jsx-runtime";function Jt({products:e,listboxId:o,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:s=!0,layout:r="row",imageFallback:l="image",strings:m=di()}){let w=e.length>0,x=ht(null);if(St(()=>{let c=x.current;if(!(!w||!c))return oi(c)},[w]),!w)return null;let g=`${o}-products-label`;return Ye("section",{className:G.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":g,children:[j("div",{className:G.label,id:g,"data-aia-products-label":"",children:m.products}),j("div",{ref:x,className:G.row,"data-aia-products-row":"",children:e.map((c,h)=>j(ci,{product:c,id:`${o}-product-${h}`,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:s,imageFallback:l,soldOut:m.soldOut,addToCart:m.addToCart},c.id))})]})}function ci({product:e,id:o,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:s,imageFallback:r,soldOut:l,addToCart:m}){let w=!!a&&e.available!==!1,[x,g]=ut(null),c=v=>{v.relatedTarget?.closest("[data-aia-dropdown]")||i?.(!1)},h=v=>{v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||v.button!==0||(v.preventDefault(),t(e))};return Ye("a",{id:o,className:G.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":w?"":void 0,role:"option","aria-selected":!1,style:x?{"--aia-product-photo-fill-x":String(x.x),"--aia-product-photo-fill-y":String(x.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:h,onKeyDown:v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),t(e))},onFocus:()=>i?.(!0),onBlur:c,children:[j(ui,{sources:ni(e.imageUrl),title:e.title,fallback:r,onPhotoFill:g},ri(e.imageUrl)??""),Ye("span",{className:G.body,children:[e.vendor?j("span",{className:G.vendor,children:e.vendor}):null,j("span",{className:G.title,children:e.title}),e.price?Ye("span",{className:G.price,children:[e.price,e.compareAtPrice?j("s",{className:G.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?j("span",{className:G.badge,children:l}):null]}),w&&a?j(hi,{product:e,label:`${m}: ${e.title}`,focusable:s,onAddToCart:a,onFocus:()=>i?.(!0),onBlur:c},pi(e)):null]})}function pi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(o=>o??"").join("\0")}function hi({product:e,label:o,focusable:t,onAddToCart:a,onFocus:i,onBlur:s}){let[r,l]=ut(null),m=ht(null),w=ht(e);w.current=e;let x=ht(!0);St(()=>(x.current=!0,()=>{x.current=!1}),[]);let g=h=>{m.current=h,x.current&&l(h)},c=h=>{if(h.preventDefault(),h.stopPropagation(),m.current==="adding")return;g("adding");let v;try{v=Promise.resolve(a(w.current))}catch(E){v=Promise.reject(E)}v.then(()=>g("added"),()=>g(null))};return j("span",{className:G.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":o,tabIndex:t?0:-1,onClick:c,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||c(h)},onFocus:h=>{h.stopPropagation(),i()},onBlur:h=>{h.stopPropagation(),s(h)},children:Ye("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[j("path",{className:G.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"}),j("path",{className:G.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),j("path",{className:G.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),j("path",{className:G.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),j("circle",{className:G.cartGlyph,cx:"9",cy:"20",r:"1.3"}),j("circle",{className:G.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function ui({sources:e,title:o,fallback:t,onPhotoFill:a}){let[i,s]=ut(0),r=e[i],l=!!r,[m,w]=ut(null),x=!l&&t==="initial";return St(()=>()=>a(null),[a]),Ye("span",{className:G.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":l&&m===r?"":void 0,children:[l?j("img",{className:G.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{w(r),a(li(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{i+1>=e.length&&a(null),s(g=>g+1)}}):null,x?si(o):null]})}import{isOptionsGridMobileViewport as Ei,measureOptionsGrid as Ai,needsOptionsGridMeasurement as Ri,OPTIONS_GRID_MOBILE_QUERY as Li,optionEnterDelayMs as Oi,optionsShowLeadingVisuals as Di,planOptionsGrid as ia,sameOptionRows as Mi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as zi,useLayoutEffect as Ni,useRef as oa,useState as ra}from"react";import{optionsGridTemplateColumns as mi}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as gi,useRef as fi}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 {
2556
2563
  display: grid;
2557
2564
  grid-template-columns: repeat(
2558
2565
  auto-fit,
@@ -2588,7 +2595,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
2588
2595
  .aia-grid[data-scroll]::-webkit-scrollbar {
2589
2596
  display: none;
2590
2597
  }
2591
- `,document.head.appendChild(e)}import{jsx as bi}from"react/jsx-runtime";function Jt({min:e="16rem",max:o,gap:a,scroll:i=!1,maxHeight:n,scrollResetKey:s,cols:r,template:l,innerRef:m,className:b,children:x,...u}){let c=fi(null);gi(()=>{if(s===void 0)return;let v=c.current;v&&(v.scrollTop=0)},[s]);let p={"--aia-grid-min":e};return o&&(p["--aia-grid-max"]=o),a&&(p["--aia-grid-gap"]=a),n&&(p["--aia-grid-max-height"]=n),r&&(p.gridTemplateColumns=mi(r)),l&&(p.gridTemplateColumns=l),bi("div",{ref:v=>{c.current=v,m?.(v)},className:b?`aia-grid ${b}`:"aia-grid","data-scroll":i||void 0,style:p,...u,children:x})}import{formatOptionCount as wi,highlightParts as vi,isMultiSelectToggleTap as xi,OPTION_ENTER_DELAY_VAR as yi,optionImageSources as ki,optionLabel as ea,sanitizeOptionIconSvg as Ci}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Si,useMemo as Ti,useRef as Pi,useState as mt}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 {
2598
+ `,document.head.appendChild(e)}import{jsx as bi}from"react/jsx-runtime";function ea({min:e="16rem",max:o,gap:t,scroll:a=!1,maxHeight:i,scrollResetKey:s,cols:r,template:l,innerRef:m,className:w,children:x,...g}){let c=fi(null);gi(()=>{if(s===void 0)return;let v=c.current;v&&(v.scrollTop=0)},[s]);let h={"--aia-grid-min":e};return o&&(h["--aia-grid-max"]=o),t&&(h["--aia-grid-gap"]=t),i&&(h["--aia-grid-max-height"]=i),r&&(h.gridTemplateColumns=mi(r)),l&&(h.gridTemplateColumns=l),bi("div",{ref:v=>{c.current=v,m?.(v)},className:w?`aia-grid ${w}`:"aia-grid","data-scroll":a||void 0,style:h,...g,children:x})}import{formatOptionCount as wi,highlightParts as vi,isMultiSelectToggleTap as xi,OPTION_ENTER_DELAY_VAR as yi,optionImageSources as ki,optionLabel as ta,sanitizeOptionIconSvg as Ci}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Si,useMemo as Ti,useRef as Pi,useState as mt}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 {
2592
2599
  position: relative;
2593
2600
  /* Clip, not visible: the entrance rise below runs on the inner content,
2594
2601
  and a transformed box extends its scroll container's scrollable area.
@@ -3114,7 +3121,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
3114
3121
  .aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
3115
3122
  background: var(--aia-option-bg, transparent);
3116
3123
  }
3117
- `,document.head.appendChild(e)}var $={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",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd",checkbox:"aia-checkbox-KGRhg"};import{Fragment as Ii,jsx as Te,jsxs as Tt}from"react/jsx-runtime";function ta({option:e,isHighlighted:o,checked:a,onSelect:i,onHighlight:n,onUnhighlight:s,id:r,loading:l,showIcon:m=!0,showImage:b=!0,showCount:x=!0,scrollHint:u,enterDelayMs:c=0}){let[p]=mt(c),[v,A]=mt(!1),N=b?ki(e.image_url):[],L=N[0]??null,[F,G]=mt([]),O=N.find(T=>!F.includes(T))??null,[E,k]=mt(null),X=Ti(()=>!L&&m&&e.icon_svg?Ci(e.icon_svg):null,[L,m,e.icon_svg]),_=x?wi(e.item_count):null,J=Pi(void 0);Si(()=>()=>clearTimeout(J.current),[]);let z=T=>{if(l||!e.is_tappable||v&&a===void 0)return;A(!0);let K=T?.currentTarget;a!==void 0&&K!==void 0&&T!==void 0&&!xi(K,K.querySelector("[data-aia-checkbox]"),T)?i(e,{commit:!0}):i(e),clearTimeout(J.current),J.current=setTimeout(()=>A(!1),170)},V=[$.item,o&&!l?$.highlighted:"",e.liveMatch&&!l?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,v?$.pressed:"",u?$.scrollHint:""].filter(Boolean).join(" ");return Te("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":X&&e.icon?e.icon:void 0,"data-aia-image":L?"":void 0,"data-aia-item-count":_!==null?e.item_count:void 0,"aria-selected":a??o,className:V,style:{[yi]:`${p}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:z,onKeyDown:T=>{!l&&e.is_tappable&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),z())},onMouseEnter:!l&&e.is_tappable?n:void 0,onMouseLeave:s,children:Tt("span",{className:$.content,children:[a!==void 0&&e.is_tappable&&Te("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),L&&Te("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":O!==null&&E===O?"":void 0,children:Te("img",{src:O??L,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:O===null,onLoad:()=>k(O),onError:()=>{O!==null&&G(T=>[...T,O])}})}),X&&Te("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:X}}),Tt("span",{className:$.text,children:[e.matchedText?vi(ea(e),e.matchedText).map((T,K)=>T.bold?Te("strong",{className:`${$.match} magicx-aia-option-match`,children:T.text},K):T.text):ea(e),e.parameterLabel&&Tt(Ii,{children:[" ",Te("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&Te("span",{className:$.tag,children:e.tag}),_!==null&&Te("span",{className:`${$.count} magicx-aia-option-count`,children:_})]})})}import{jsx as oa}from"react/jsx-runtime";function Fi(){let[e,o]=na(Ei);return zi(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(Oi),i=()=>o(a.matches);return i(),a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[]),e}function ra({options:e,activeIndex:o,picked:a,onSelect:i,onHighlight:n,onUnhighlight:s,listboxId:r,loading:l,groupKey:m="",optionsPosition:b="below",showIcons:x=!0,showImages:u=!0,showCounts:c=!0}){let p=Fi(),v=ia(null),[A,N]=na(null),L=ia(null);Ni(()=>{if(l&&Mi(L.current,e))return;L.current=l?null:e;let O=v.current,k=O&&!l&&Li(e.length,p)?Ai(O):null;N(k?aa(e.length,p,k.rowWidths,k.gridWidth):null)},[e,p,l]);let F=A??aa(e.length,p,null,null),G=Di(e,x,u);return oa(Jt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:m,template:F.template,maxHeight:F.maxHeight,innerRef:O=>{v.current=O},"data-aia-group":m,children:e.map((O,E)=>oa(ta,{option:O,isHighlighted:E===o,checked:a?a.includes(O.text):void 0,onSelect:i,onHighlight:()=>n(E),onUnhighlight:s?()=>s(E):void 0,id:`${r}-option-${E}`,loading:l,showIcon:x&&G,showImage:u&&G,showCount:c,scrollHint:!l&&F.scrollHintIndices.includes(E),enterDelayMs:l?0:Ri(E,F.cols,e.length,b)},`${m}\0${O.text}`))})}import{formatTime as Hi,TIME_WHEEL_COLUMNS as Bi,TIME_WHEEL_ROW_HEIGHT as Wi,timeWheelIndex as sa,timeWheelIndexFromScroll as Ki,timeWheelRows as Gi,withTimeWheelIndex as la}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as qi,useEffect as _i,useLayoutEffect as Vi,useRef as gt}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) ---
3124
+ `,document.head.appendChild(e)}var $={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",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd",checkbox:"aia-checkbox-KGRhg"};import{Fragment as Ii,jsx as Ee,jsxs as Tt}from"react/jsx-runtime";function aa({option:e,isHighlighted:o,checked:t,onSelect:a,onHighlight:i,onUnhighlight:s,id:r,loading:l,showIcon:m=!0,showImage:w=!0,showCount:x=!0,scrollHint:g,enterDelayMs:c=0}){let[h]=mt(c),[v,E]=mt(!1),F=w?ki(e.image_url):[],M=F[0]??null,[O,V]=mt([]),R=F.find(T=>!O.includes(T))??null,[D,S]=mt(null),H=Ti(()=>!M&&m&&e.icon_svg?Ci(e.icon_svg):null,[M,m,e.icon_svg]),U=x?wi(e.item_count):null,X=Pi(void 0);Si(()=>()=>clearTimeout(X.current),[]);let q=T=>{if(l||!e.is_tappable||v&&t===void 0)return;E(!0);let B=T?.currentTarget;t!==void 0&&B!==void 0&&T!==void 0&&!xi(B,B.querySelector("[data-aia-checkbox]"),T)?a(e,{commit:!0}):a(e),clearTimeout(X.current),X.current=setTimeout(()=>E(!1),170)},_=[$.item,o&&!l?$.highlighted:"",e.liveMatch&&!l?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,v?$.pressed:"",g?$.scrollHint:""].filter(Boolean).join(" ");return Ee("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":H&&e.icon?e.icon:void 0,"data-aia-image":M?"":void 0,"data-aia-item-count":U!==null?e.item_count:void 0,"aria-selected":t??o,className:_,style:{[yi]:`${h}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:q,onKeyDown:T=>{!l&&e.is_tappable&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),q())},onMouseEnter:!l&&e.is_tappable?i:void 0,onMouseLeave:s,children:Tt("span",{className:$.content,children:[t!==void 0&&e.is_tappable&&Ee("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),M&&Ee("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":R!==null&&D===R?"":void 0,children:Ee("img",{src:R??M,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:R===null,onLoad:()=>S(R),onError:()=>{R!==null&&V(T=>[...T,R])}})}),H&&Ee("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:H}}),Tt("span",{className:$.text,children:[e.matchedText?vi(ta(e),e.matchedText).map((T,B)=>T.bold?Ee("strong",{className:`${$.match} magicx-aia-option-match`,children:T.text},B):T.text):ta(e),e.parameterLabel&&Tt(Ii,{children:[" ",Ee("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&Ee("span",{className:$.tag,children:e.tag}),U!==null&&Ee("span",{className:`${$.count} magicx-aia-option-count`,children:U})]})})}import{jsx as na}from"react/jsx-runtime";function Fi(){let[e,o]=ra(Ei);return zi(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(Li),a=()=>o(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function sa({options:e,activeIndex:o,picked:t,onSelect:a,onHighlight:i,onUnhighlight:s,listboxId:r,loading:l,groupKey:m="",optionsPosition:w="below",showIcons:x=!0,showImages:g=!0,showCounts:c=!0}){let h=Fi(),v=oa(null),[E,F]=ra(null),M=oa(null);Ni(()=>{if(l&&Mi(M.current,e))return;M.current=l?null:e;let R=v.current,S=R&&!l&&Ri(e.length,h)?Ai(R):null;F(S?ia(e.length,h,S.rowWidths,S.gridWidth):null)},[e,h,l]);let O=E??ia(e.length,h,null,null),V=Di(e,x,g);return na(ea,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:m,template:O.template,maxHeight:O.maxHeight,innerRef:R=>{v.current=R},"data-aia-group":m,children:e.map((R,D)=>na(aa,{option:R,isHighlighted:D===o,checked:t?t.includes(R.text):void 0,onSelect:a,onHighlight:()=>i(D),onUnhighlight:s?()=>s(D):void 0,id:`${r}-option-${D}`,loading:l,showIcon:x&&V,showImage:g&&V,showCount:c,scrollHint:!l&&O.scrollHintIndices.includes(D),enterDelayMs:l?0:Oi(D,O.cols,e.length,w)},`${m}\0${R.text}`))})}import{formatTime as Hi,TIME_WHEEL_COLUMNS as Bi,TIME_WHEEL_ROW_HEIGHT as Wi,timeWheelIndex as la,timeWheelIndexFromScroll as Ki,timeWheelRows as Gi,withTimeWheelIndex as da}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as qi,useEffect as _i,useLayoutEffect as Vi,useRef as gt}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) ---
3118
3125
 
3119
3126
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3120
3127
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3236,7 +3243,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
3236
3243
  .aia-done-llNY5:hover {
3237
3244
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3238
3245
  }
3239
- `,document.head.appendChild(e)}var de={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 Ke,jsxs as Pt}from"react/jsx-runtime";var Ui=120;function da({view:e,label:o,doneLabel:a,interactive:i=!0,onTimeChange:n,onTimeCommit:s}){return Pt("div",{className:de.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":o,onMouseDown:r=>r.preventDefault(),children:[Ke("span",{className:de.value,"data-aia-time-value":"","aria-live":"polite",children:Hi(e.minutes)}),Pt("div",{className:de.columns,"aria-hidden":"true",children:[Ke("div",{className:de.band}),Bi.map(r=>Pt(qi,{children:[r==="minute"&&Ke("span",{className:de.separator,children:":"}),Ke(Qi,{column:r,minutes:e.minutes,interactive:i,onTimeChange:n})]},r))]}),Ke("button",{type:"button",tabIndex:-1,className:de.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:a})]})}function Qi({column:e,minutes:o,interactive:a,onTimeChange:i}){let n=gt(null),s=gt(null),r=gt(null),l=gt({minutes:o,interactive:a,onTimeChange:i});l.current={minutes:o,interactive:a,onTimeChange:i};let m=sa(e,o);Vi(()=>{let u=n.current;if(!u||r.current)return;let c=m*Wi;Math.abs(u.scrollTop-c)<1||(s.current=c,u.scrollTop=c)},[m]),_i(()=>()=>{r.current&&clearTimeout(r.current)},[]);let b=()=>{r.current=null;let u=n.current,c=l.current;if(!u||!c.interactive)return;let p=Ki(e,u.scrollTop);p!==sa(e,c.minutes)&&c.onTimeChange(la(e,c.minutes,p))},x=()=>{let u=n.current;if(u){if(s.current!=null&&Math.abs(u.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(b,Ui)}};return Ke("div",{ref:n,className:de.column,"data-aia-time-column":e,onScroll:x,children:Gi(e).map((u,c)=>Ke("div",{className:c===m?`${de.row} ${de.selected}`:de.row,"data-aia-time-row":"","data-aia-index":c,onClick:()=>{l.current.interactive&&i(la(e,l.current.minutes,c))},children:u.label},u.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3246
+ `,document.head.appendChild(e)}var ce={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 We,jsxs as Pt}from"react/jsx-runtime";var Ui=120;function ca({view:e,label:o,doneLabel:t,interactive:a=!0,onTimeChange:i,onTimeCommit:s}){return Pt("div",{className:ce.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":o,onMouseDown:r=>r.preventDefault(),children:[We("span",{className:ce.value,"data-aia-time-value":"","aria-live":"polite",children:Hi(e.minutes)}),Pt("div",{className:ce.columns,"aria-hidden":"true",children:[We("div",{className:ce.band}),Bi.map(r=>Pt(qi,{children:[r==="minute"&&We("span",{className:ce.separator,children:":"}),We(Qi,{column:r,minutes:e.minutes,interactive:a,onTimeChange:i})]},r))]}),We("button",{type:"button",tabIndex:-1,className:ce.done,"data-aia-time-done":"",onClick:()=>{a&&s()},children:t})]})}function Qi({column:e,minutes:o,interactive:t,onTimeChange:a}){let i=gt(null),s=gt(null),r=gt(null),l=gt({minutes:o,interactive:t,onTimeChange:a});l.current={minutes:o,interactive:t,onTimeChange:a};let m=la(e,o);Vi(()=>{let g=i.current;if(!g||r.current)return;let c=m*Wi;Math.abs(g.scrollTop-c)<1||(s.current=c,g.scrollTop=c)},[m]),_i(()=>()=>{r.current&&clearTimeout(r.current)},[]);let w=()=>{r.current=null;let g=i.current,c=l.current;if(!g||!c.interactive)return;let h=Ki(e,g.scrollTop);h!==la(e,c.minutes)&&c.onTimeChange(da(e,c.minutes,h))},x=()=>{let g=i.current;if(g){if(s.current!=null&&Math.abs(g.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(w,Ui)}};return We("div",{ref:i,className:ce.column,"data-aia-time-column":e,onScroll:x,children:Gi(e).map((g,c)=>We("div",{className:c===m?`${ce.row} ${ce.selected}`:ce.row,"data-aia-time-row":"","data-aia-index":c,onClick:()=>{l.current.interactive&&a(da(e,l.current.minutes,c))},children:g.label},g.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3240
3247
  display: flex;
3241
3248
  flex-direction: column;
3242
3249
  gap: var(--aia-stack-space, 0.5rem);
@@ -3251,7 +3258,7 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
3251
3258
  align-items: end;
3252
3259
  }
3253
3260
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3254
- `,document.head.appendChild(e)}import{jsx as Yi}from"react/jsx-runtime";function ca({space:e,align:o="stretch",className:a,children:i,...n}){let s=e?{"--aia-stack-space":e}:void 0;return Yi("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":o,style:s,...n,children:i})}import{jsx as ee,jsxs as It}from"react/jsx-runtime";var po=typeof window>"u"?Ge:Et,ho=[159,119,164],uo=()=>{},pa=()=>{},mo=e=>{},go=()=>{},fo=e=>{},bo=e=>{},wo=e=>{},vo=e=>{};function xo(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,i]=co(o);if(Ge(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(n.matches);return n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function yo(e,o){let a=je(null);Ge(()=>{let i=e.current,n=o.current;if(!i||!n)return;let s=ro(i,".aia-grid[data-scroll]");if(a.current&&a.current.grid!==s&&(a.current.controller.destroy(),a.current=null),s&&!a.current){a.current={grid:s,controller:ji({dropdown:i,grid:s,button:n})};return}a.current?.controller.update()}),Ge(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function ko(e,o){let a=je(o);a.current=o;let i=je(null);Et(()=>{let n=e.current;if(n){if(!i.current){i.current=$i({dropdown:n,isOpen:()=>a.current});return}i.current.update()}}),Ge(()=>()=>{i.current?.destroy(),i.current=null},[])}function At({suggestions:e,activeIndex:o,onSelect:a,onHighlight:i,onUnhighlight:n,isOpen:s,id:r,className:l,pills:m,onPillClick:b,showPills:x=!0,onSkip:u,showSkipButton:c=!0,showOptionIcons:p=!0,showOptionImages:v=!0,showOptionCounts:A=!0,skipDisabled:N=!1,activeSelected:L=!1,isLoading:F=!1,skeletonExiting:G=!1,isInputEmpty:O=!1,language:E,products:k,onProductSelect:X,onProductAddToCart:_,onProductFocusChange:J,productsLayout:z="row",productImageFallback:V="image",formatType:T="options",dateView:K=null,selectedDateIso:h=null,selectedDateRange:P=null,dateRangeStart:Pe=null,onPreviousMonth:be,onNextMonth:De,timeView:we=null,multiSelectView:g=null,onMultiSelectCommit:Me,onTimeChange:Ie,onTimeCommit:Ee,locationView:f=null,onLocationQuery:C,onLocationMove:S,onLocationCommit:I,onLocationFocusChange:R,isFocused:U=!1,optionsPosition:te="below",mode:oe}){let ne=xo(oe),ze=ne!==void 0,q=je(null),ve=je(null);yo(q,ve),Ge(()=>{if(q.current)return Zi(q.current)},[]);let qe=e[0]?.options??[],et=!!(m&&m.length>0&&b),xe=!!(k&&k.length>0),Ne=T==="time"&&we!=null,_e=T==="location"&&f!=null,Q=s&&(qe.length>0||x&&et||F||xe||Ne||_e);ko(q,Q),po(()=>{let y=q.current;y&&to(y,eo(y))});let pe={suggestions:e,activeIndex:o,pills:m,showPills:x,showSkipButton:c,showOptionIcons:p,showOptionImages:v,showOptionCounts:A,skipDisabled:N,activeSelected:L,isLoading:F,skeletonExiting:G,isInputEmpty:O,products:k,formatType:T,dateView:K,selectedDateIso:h,selectedDateRange:P,dateRangeStart:Pe,timeView:we,multiSelectView:g,locationView:f},ye=je(pe);Q&&(ye.current=pe);let t=Q?pe:ye.current,Y=lo(E),Ae=t.suggestions[0],re=Ae?.options??[],w=t.activeIndex>=0&&!!re[t.activeIndex]?.is_tappable,he=oo(t.pills??[],Y.keepTyping),Le=!!(he.length>0&&b),ke=t.showPills&&Le,tt=t.showPills&&!Le&&t.isLoading,Ve=ke||tt,Ce=Le&&ao(he)&&t.showSkipButton&&!t.isInputEmpty&&!!u,Ue=he[0]?.text,se=io(t.formatType)&&t.dateView!=null,ue=re.length>0&&!se,Oe=re.length>0&&se&&!t.isLoading,Fe=t.formatType==="time"&&t.timeView!=null&&!t.isLoading,Qe=t.formatType==="location"&&t.locationView!=null&&!t.isLoading,He=t.isLoading&&!ue&&!Oe&&!Fe&&!Qe,Be=t.products??[],d=no(ke?he:[]);return Et(()=>{q.current&&so(q.current,d,{visible:Q,anchorBottom:te==="above"})},[d,Q,te,t.suggestions,t.pills,t.isLoading,t.skeletonExiting,t.isInputEmpty,t.products,t.formatType,t.dateView,t.selectedDateIso,t.selectedDateRange,t.dateRangeStart,t.timeView,t.multiSelectView,t.locationView,t.showPills,t.showSkipButton,t.showOptionIcons,t.showOptionImages,t.showOptionCounts,z,E]),Ge(()=>{let y=q.current;return()=>{y&&Ji(y)}},[]),It("div",{ref:q,id:r,role:"listbox","aria-multiselectable":!!t.multiSelectView,"data-aia-dropdown":"","data-options-position":te,"data-mode":ne,"data-aia-loading":t.isLoading?"":void 0,"data-aia-skeleton-exiting":t.skeletonExiting?"":void 0,"data-aia-has-products":Be.length>0?"":void 0,className:`${ze?"magicx-aia ":""}${me.dropdown} ${Q?me.visible:""} ${l??""}`,onMouseDown:y=>y.preventDefault(),children:[It(ca,{space:"8px",children:[(Ve||Ce)&&It(nt,{noWrap:!0,className:me.pillBar,"data-aia-pillbar":"",children:[Ve&&ee("span",{className:me.pillScroll,"data-aia-pill-scroll":"",children:ee(pt,{pills:he,activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:b??(()=>{}),rounded:!0,loading:t.isLoading})}),Ce&&ee("button",{type:"button",tabIndex:-1,className:me.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":Ue?`${Y.skipLabel} ${Ue}`:Y.skipLabel,onClick:u,children:Y.skip})]}),ue&&ee(ra,{options:re,activeIndex:t.activeIndex,onSelect:a,onHighlight:i,onUnhighlight:n,listboxId:r,loading:t.isLoading,groupKey:Ae?`${Ae.parameter} ${Ae.text}`:"",optionsPosition:te,showIcons:t.showOptionIcons,showImages:t.showOptionImages,showCounts:t.showOptionCounts,picked:t.isLoading?void 0:t.multiSelectView?.picked}),t.multiSelectView&&!t.isLoading&&ee("div",{onClick:y=>{y.target.closest("[data-aia-multi-done]")&&!t.skipDisabled&&Me?.()},children:ee("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:me.multiDone,ref:y=>{y&&(y.disabled=!0,y.offsetHeight,y.disabled=t.skipDisabled)},children:Y.done})}),Oe&&t.dateView&&ee(qt,{options:re,activeIndex:t.activeIndex,listboxId:r,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null,floor:Xi(t.formatType,t.dateRangeStart)},onSelect:a,onHighlight:i,onUnhighlight:n,onPreviousMonth:be??pa,onNextMonth:De??pa}),Fe&&t.timeView&&ee(da,{view:t.timeView,label:Y.timeLabel,doneLabel:Y.done,interactive:!t.skipDisabled,onTimeChange:Ie??mo,onTimeCommit:Ee??go}),Qe&&t.locationView&&ee(jt,{view:t.locationView,searchLabel:Y.locationSearch,noResultsLabel:Y.locationNoResults,useTypedLabel:Y.locationUseTyped,widgetFocused:U&&Q,visible:Q,interactive:!t.skipDisabled,onQuery:C??fo,onMove:S??bo,onCommit:I??wo,onFocusChange:R??vo}),He&&ee("div",{className:me.skeletonBars,"data-aia-skeleton-bars":"",children:ho.map(y=>ee("span",{className:me.skeletonBar,style:{width:y}},`bar-${y}`))}),ee(Xt,{products:Be,listboxId:r,onSelect:X??uo,onAddToCart:_,onFocusChange:J,focusable:Q,layout:z,imageFallback:V,strings:Y}),ee(Vt,{isOptionHighlighted:w,isInputEmpty:t.isInputEmpty,strings:Y})]}),ee("button",{ref:ve,type:"button",tabIndex:-1,className:me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Y.scrollArrow,"aria-hidden":"true",children:ee("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:ee("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Fo,ModeController as Ho,setCursorOffset as Bo,uiStringsFor as Wo,watchEditorHeight as Ko}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as Co}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 {
3261
+ `,document.head.appendChild(e)}import{jsx as Yi}from"react/jsx-runtime";function pa({space:e,align:o="stretch",className:t,children:a,...i}){let s=e?{"--aia-stack-space":e}:void 0;return Yi("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":o,style:s,...i,children:a})}import{jsx as te,jsxs as It}from"react/jsx-runtime";var po=typeof window>"u"?Ke:Et,ho=[159,119,164],uo=()=>{},ha=()=>{},mo=e=>{},go=()=>{},fo=e=>{},bo=e=>{},wo=e=>{},vo=e=>{};function xo(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=co(o);if(Ke(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let i=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>a(i.matches);return i.addEventListener("change",s),()=>i.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function yo(e,o){let t=je(null);Ke(()=>{let a=e.current,i=o.current;if(!a||!i)return;let s=ro(a,".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:ji({dropdown:a,grid:s,button:i})};return}t.current?.controller.update()}),Ke(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function ko(e,o){let t=je(o);t.current=o;let a=je(null);Et(()=>{let i=e.current;if(i){if(!a.current){a.current=$i({dropdown:i,isOpen:()=>t.current});return}a.current.update()}}),Ke(()=>()=>{a.current?.destroy(),a.current=null},[])}function At({suggestions:e,activeIndex:o,onSelect:t,onHighlight:a,onUnhighlight:i,isOpen:s,id:r,className:l,pills:m,onPillClick:w,showPills:x=!0,onSkip:g,showSkipButton:c=!0,showOptionIcons:h=!0,showOptionImages:v=!0,showOptionCounts:E=!0,skipDisabled:F=!1,activeSelected:M=!1,isLoading:O=!1,skeletonExiting:V=!1,isInputEmpty:R=!1,language:D,products:S,onProductSelect:H,onProductAddToCart:U,onProductFocusChange:X,productsLayout:q="row",productImageFallback:_="image",formatType:T="options",dateView:B=null,selectedDateIso:he=null,selectedDateRange:se=null,dateRangeStart:ne=null,onPreviousMonth:d,onNextMonth:I,timeView:Ce=null,multiSelectView:f=null,onMultiSelectCommit:ze,onTimeChange:Ae,onTimeCommit:Re,locationView:b=null,isReediting:C=!1,onLocationQuery:P,onLocationMove:A,onLocationCommit:L,onLocationFocusChange:Q,isFocused:le=!1,optionsPosition:ae="below",mode:ue}){let Le=xo(ue),me=Le!==void 0,J=je(null),Ne=je(null);yo(J,Ne),Ke(()=>{if(J.current)return Zi(J.current)},[]);let et=e[0]?.options??[],Se=!!(m&&m.length>0&&w),Fe=!!(S&&S.length>0),Ge=T==="time"&&Ce!=null,Te=T==="location"&&b!=null,ee=s&&(et.length>0||x&&Se||O||Fe||Ge||Te);ko(J,ee),po(()=>{let k=J.current;k&&to(k,eo(k))});let ge={suggestions:e,activeIndex:o,pills:m,showPills:x,showSkipButton:c,showOptionIcons:h,showOptionImages:v,showOptionCounts:E,skipDisabled:F,activeSelected:M,isLoading:O,skeletonExiting:V,isInputEmpty:R,products:S,formatType:T,dateView:B,selectedDateIso:he,selectedDateRange:se,dateRangeStart:ne,timeView:Ce,multiSelectView:f,locationView:b,isReediting:C},y=je(ge);ee&&(y.current=ge);let n=ee?ge:y.current,Y=lo(D),fe=n.suggestions[0],u=fe?.options??[],qe=n.activeIndex>=0&&!!u[n.activeIndex]?.is_tappable,be=oo(n.pills??[],Y.keepTyping),we=!!(be.length>0&&w),_e=n.showPills&&we,tt=n.showPills&&!we&&n.isLoading,Pe=_e||tt,Ve=we&&ao(be)&&n.showSkipButton&&!n.isInputEmpty&&!!g,de=be[0]?.text,ve=io(n.formatType)&&n.dateView!=null,Oe=u.length>0&&!ve,He=u.length>0&&ve&&!n.isLoading,Ue=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,De=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,Qe=n.isLoading&&!Oe&&!He&&!Ue&&!De,p=n.products??[],z=no(_e?be:[]);return Et(()=>{J.current&&so(J.current,z,{visible:ee,anchorBottom:ae==="above"})},[z,ee,ae,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,q,D]),Ke(()=>{let k=J.current;return()=>{k&&Ji(k)}},[]),It("div",{ref:J,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":ae,"data-mode":Le,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":p.length>0?"":void 0,className:`${me?"magicx-aia ":""}${xe.dropdown} ${ee?xe.visible:""} ${l??""}`,onMouseDown:k=>k.preventDefault(),children:[It(pa,{space:"8px",children:[(Pe||Ve)&&It(nt,{noWrap:!0,className:xe.pillBar,"data-aia-pillbar":"",children:[Pe&&te("span",{className:xe.pillScroll,"data-aia-pill-scroll":"",children:te(pt,{pills:be,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:n.isLoading})}),Ve&&te("button",{type:"button",tabIndex:-1,className:xe.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":de?`${Y.skipLabel} ${de}`:Y.skipLabel,onClick:g,children:Y.skip})]}),Oe&&te(sa,{options:u,activeIndex:n.activeIndex,onSelect:t,onHighlight:a,onUnhighlight:i,listboxId:r,loading:n.isLoading,groupKey:fe?`${fe.parameter} ${fe.text}`:"",optionsPosition:ae,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.isLoading?void 0:n.multiSelectView?.picked}),n.multiSelectView&&!n.isLoading&&te("div",{onClick:k=>{k.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&ze?.()},children:te("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:xe.multiDone,ref:k=>{k&&(k.disabled=!0,k.offsetHeight,k.disabled=n.skipDisabled)},children:Y.done})}),He&&n.dateView&&te(qt,{options:u,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:Xi(n.formatType,n.dateRangeStart)},onSelect:t,onHighlight:a,onUnhighlight:i,onPreviousMonth:d??ha,onNextMonth:I??ha}),Ue&&n.timeView&&te(ca,{view:n.timeView,label:Y.timeLabel,doneLabel:Y.done,interactive:!n.skipDisabled,onTimeChange:Ae??mo,onTimeCommit:Re??go}),De&&n.locationView&&te($t,{view:n.locationView,searchLabel:Y.locationSearch,noResultsLabel:Y.locationNoResults,useTypedLabel:Y.locationUseTyped,widgetFocused:le&&ee,reediting:n.isReediting,visible:ee,interactive:!n.skipDisabled,onQuery:P??fo,onMove:A??bo,onCommit:L??wo,onFocusChange:Q??vo}),Qe&&te("div",{className:xe.skeletonBars,"data-aia-skeleton-bars":"",children:ho.map(k=>te("span",{className:xe.skeletonBar,style:{width:k}},`bar-${k}`))}),te(Jt,{products:p,listboxId:r,onSelect:H??uo,onAddToCart:U,onFocusChange:X,focusable:ee,layout:q,imageFallback:_,strings:Y}),te(Vt,{isOptionHighlighted:qe,isInputEmpty:n.isInputEmpty,strings:Y})]}),te("button",{ref:Ne,type:"button",tabIndex:-1,className:xe.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Y.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 Fo,ModeController as Ho,setCursorOffset as Bo,uiStringsFor as Wo,watchEditorHeight as Ko}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as Co}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 {
3255
3262
  flex-shrink: 0;
3256
3263
  width: 32px;
3257
3264
  height: 32px;
@@ -3322,5 +3329,5 @@ import{buildSubmitResult as $r,cellDay as Zr,cellIso as Xr,DATE_RANGE_META_END a
3322
3329
  transition: none;
3323
3330
  }
3324
3331
  }
3325
- `,document.head.appendChild(e)}var ha={submitButton:"aia-submitButton-otz7H"};import{jsx as Lt}from"react/jsx-runtime";function ua({disabled:e,ready:o,onClick:a,label:i=Co().submit}){return Lt("button",{type:"button","data-aia-submit":"",className:ha.submitButton,disabled:e,"data-aia-ready":o?"":void 0,onClick:n=>{n.stopPropagation(),a()},"aria-label":i,children:Lt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:Lt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as So,dateSelectionFor as To,identifiedParamLabel as Po,withoutTraditionalAutocomplete as Io}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as wa,useEffect as $e,useRef as Z,useState as Eo}from"react";import{useRef as ma}from"react";function ga(e){let o=ma(e);o.current=e;let a=Object.keys(e??{}).sort().join("\0"),i=ma({key:"",overrides:void 0});if(i.current.key!==a){let n={};for(let s of Object.keys(e??{})){let r=(l,m,b)=>{let x=o.current?.[s];return x?x(l,m,b):[]};n[s]=r}i.current={key:a,overrides:e?n:void 0}}return{overrides:i.current.overrides,key:a}}import{useRef as fa}from"react";function ba(e){let o=fa(e);o.current=e;let a=fa(null);a.current===null&&(a.current={fetch:(n,s)=>{let r=o.current;return r?r.fetch(n,s):Promise.reject(new Error("products config removed"))},transform:n=>o.current?.transform(n)??[],get limit(){return o.current?.limit}});let i=e!==void 0;return{config:i?a.current:void 0,enabled:i}}var va={text:"",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,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateFloor:null,timeView:null,multiSelectView:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,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 Ot({onSubmit:e,onResult:o,onError:a,optionOverrides:i,maskCompletedText:n,apiConfig:s,additionalContext:r,language:l,currency:m,productId:b,visitorId:x,columns:u=2,dropdownTrigger:c,optionsPosition:p,closeDropdownOnBlur:v,prependPlaceholder:A,showNonTappableOptions:N,locationSearch:L,showOptionIcons:F,showOptionImages:G,showOptionCounts:O,showSkipButton:E,showProducts:k,productImageFallback:X="image",onFocus:_,onBlur:J,value:z,completedParams:V,onChange:T,onParamsChange:K,products:h,mapProducts:P,onProductSelect:Pe,onProductAddToCart:be,source:De,setCursor:we}){let g=Z(null),[Me,Ie]=Eo(null),Ee=Z(e);Ee.current=e;let f=Z(o);f.current=o;let C=Z(a);C.current=a;let S=Z(T);S.current=T;let I=Z(K);I.current=K;let R=Z(_);R.current=_;let U=Z(J);U.current=J;let te=Z(we);te.current=we;let oe=Z(Pe);oe.current=Pe;let ne=Z(be);ne.current=be;let ze=Z(x);ze.current=x;let q=Z(()=>{let d=ze.current;return typeof d=="function"?d():d}).current,ve=ba(h),qe=Z(P);qe.current=P;let et=Z((d,y)=>{let M=qe.current;return M?M(d,y):d}).current,xe=P?et:void 0,Ne=ga(i);$e(()=>{if(typeof document>"u")return;let d=new So(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:m,productId:b,visitorId:q,optionOverrides:Ne.overrides,maskCompletedText:n,columns:u,dropdownTrigger:c,optionsPosition:p,closeDropdownOnBlur:v,prependPlaceholder:A,showNonTappableOptions:N,locationSearch:L,showProducts:k,source:De,value:z,completedParams:V,onSubmit:(...M)=>Ee.current?.(...M),onResult:(...M)=>f.current?.(...M),onError:(...M)=>C.current?.(...M),onChange:(...M)=>S.current?.(...M),onParamsChange:(...M)=>I.current?.(...M),onFocus:()=>R.current?.(),onBlur:()=>U.current?.(),onProductSelect:M=>oe.current?.(M),onProductAddToCart:M=>ne.current?.(M),setCursor:M=>te.current?.(M),products:ve.config,mapProducts:xe});g.current=d,Ie(d.getState());let y=d.subscribe(M=>Ie(M));return()=>{y(),d.destroy(),g.current===d&&(g.current=null)}},[]),$e(()=>{z!==void 0&&g.current?.setValue(z)},[z]),$e(()=>{V!==void 0&&g.current?.setCompletedParams(V)},[V]);let _e=JSON.stringify(s??null),Q;try{Q=JSON.stringify(r??null)}catch{Q="[unstringifiable]"}$e(()=>{g.current?.update({apiConfig:s,additionalContext:r,language:l,currency:m,productId:b,optionOverrides:Ne.overrides,dropdownTrigger:c,optionsPosition:p,closeDropdownOnBlur:v,prependPlaceholder:A,showNonTappableOptions:N,locationSearch:L,showProducts:k})},[_e,Q,l,m?.code,m?.rate,m?.country,b,Ne.key,c,p,v,A,N,L,k]);let pe=Z(!1);$e(()=>{if(!pe.current){pe.current=!0;return}g.current?.update({products:ve.config})},[ve.enabled]),$e(()=>{g.current?.update({mapProducts:xe})},[xe]);let ye=Z(null);ye.current===null&&(ye.current={handleTextChange:d=>g.current?.handleTextChange(d),handleKeyDown:d=>{let y="nativeEvent"in d?d.nativeEvent:d;g.current?.handleKeyDown(y)},setFocused:d=>g.current?.setFocused(d),startEditingParam:d=>g.current?.startEditingParam(d),exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:d=>g.current?.handleCaretAfterInput(d),handleCaretMove:d=>g.current?.handleCaretMove(d),replaceEditingRange:d=>g.current?.replaceEditingRange(d)??!1,setActivePill:d=>g.current?.setActivePill(d),skipActivePill:()=>g.current?.skipActivePill(),removeLastParam:()=>g.current?.removeLastParam(),clearNewParamId:()=>g.current?.clearNewParamId(),reset:()=>g.current?.reset(),refreshProducts:()=>g.current?.refreshProducts(),prepareSubmit:()=>g.current?.prepareSubmit(),getState:()=>g.current?.getState()??va,recordSubmit:d=>g.current?.recordSubmit(d),selectOption:(d,y)=>g.current?.selectOption(d,y),selectProduct:d=>g.current?.selectProduct(d),addProductToCart:d=>{let y=g.current;return!y||!ne.current?Promise.resolve():y.addProductToCart(d)},setActiveDropdownIndex:d=>g.current?.setActiveDropdownIndex(d),clearHighlight:d=>g.current?.clearHighlight(d),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),setTime:d=>g.current?.setTime(d),commitTime:()=>g.current?.commitTime(),toggleMultiSelectOption:d=>g.current?.toggleMultiSelectOption(d),commitMultiSelect:()=>g.current?.commitMultiSelect(),setLocationQuery:d=>g.current?.setLocationQuery(d),moveLocationHighlight:d=>g.current?.moveLocationHighlight(d),commitLocation:d=>g.current?.commitLocation(d),setLocationFieldFocused:d=>g.current?.setLocationFieldFocused(d),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let t=ye.current,Y=wa(d=>{let y=d.target.value,lt=y.length>0&&!d.nativeEvent?.isComposing&&y[0]!==y[0].toUpperCase()?y[0].toUpperCase()+y.slice(1):y;g.current?.handleTextChange(lt)},[]),Ae=wa(d=>{g.current?.handleKeyDown(d.nativeEvent)},[]),re=g.current,w=Me??va,he=z!==void 0?z:w.text,Le=V!==void 0?V:w.completedParams,ke=w.actionableSuggestions,tt=ke[0],Ve=Io(ke),Ce=re?.listboxId??"",Ue=w.activeDropdownIndex>=0&&re?`${Ce}-option-${w.activeDropdownIndex}`:void 0,se=w.editingParam,ue=w.editingIdentified,Oe=se?{parameter:se.suggestionParameter,text:se.suggestionPlaceholder,required:!0,options:se.options}:ue?{parameter:ue.parameter,text:Po(ue.parameter),required:!0,options:[]}:null,Fe=w.dropdownSuggestion??Oe??tt,Qe=Oe?[Oe]:ke,He=To(w),Be=!re||w.dropdownLoading;return{completedParams:Le,multiSelectView:w.multiSelectView,toggleMultiSelectOption:t.toggleMultiSelectOption,commitMultiSelect:t.commitMultiSelect,skippedParams:w.skippedParams,identifiedParams:w.identifiedParams,suggestionPills:Ve,setActivePill:t.setActivePill,skipActivePill:t.skipActivePill,removeLastParam:t.removeLastParam,segments:w.segments,newParamId:w.newParamId,clearNewParamId:t.clearNewParamId,suggestions:w.suggestions,activeIndex:w.activeDropdownIndex,isReady:w.isReady,isLoading:Be,isFocused:w.isFocused,isDropdownOpen:w.isDropdownOpen,isActivePillSelected:w.isActivePillSelected,placeholderText:w.placeholderText,listboxId:Ce,error:w.error,products:w.products,customFields:w.customFields,selectProduct:t.selectProduct,addProductToCart:t.addProductToCart,handleTextChange:t.handleTextChange,handleKeyDown:t.handleKeyDown,setFocused:t.setFocused,editingParam:se,editingIdentified:ue,editingAnchor:w.editingAnchor,caretOffset:w.caretOffset,startEditingParam:t.startEditingParam,exitEditMode:t.exitEditMode,handleCaretAfterInput:t.handleCaretAfterInput,handleCaretMove:t.handleCaretMove,replaceEditingRange:t.replaceEditingRange,inputProps:{value:he,placeholder:w.placeholderText||void 0,onChange:Y,onKeyDown:Ae,onFocus:t.handleFocus,onBlur:t.handleBlur,role:"combobox","aria-expanded":w.isDropdownOpen,"aria-activedescendant":Ue,"aria-autocomplete":"list","aria-controls":Ce},reset:t.reset,refreshProducts:t.refreshProducts,prepareSubmit:t.prepareSubmit,getState:t.getState,recordSubmit:t.recordSubmit,dropdownProps:{suggestions:Fe?[{...Fe,options:w.dropdownOptions}]:[],activeIndex:w.activeDropdownIndex,onSelect:t.selectOption,onHighlight:t.setActiveDropdownIndex,onUnhighlight:t.clearHighlight,isOpen:w.isDropdownOpen,id:Ce,pills:Qe,activeSelected:w.isActivePillSelected,onPillClick:t.setActivePill,onSkip:t.skipActivePill,showSkipButton:(E??!0)&&!se&&!ue,showOptionIcons:F??!0,showOptionImages:G??!0,showOptionCounts:O??!0,skipDisabled:w.inSelectionAnimation,isLoading:Be,skeletonExiting:w.skeletonExiting,isInputEmpty:he.trim().length===0,language:l,products:w.products,productImageFallback:X,onProductSelect:t.selectProduct,onProductAddToCart:be?t.addProductToCart:void 0,onProductFocusChange:t.setFocused,formatType:w.activeFormatType,dateView:w.dateView,selectedDateIso:He.selectedIso,selectedDateRange:He.selectedRange,dateRangeStart:He.rangeStart,onPreviousMonth:t.showPreviousMonth,onNextMonth:t.showNextMonth,timeView:w.timeView,multiSelectView:w.multiSelectView,onMultiSelectCommit:t.commitMultiSelect,onTimeChange:t.setTime,onTimeCommit:t.commitTime,locationView:w.locationView,onLocationQuery:t.setLocationQuery,onLocationMove:t.moveLocationHighlight,onLocationCommit:t.commitLocation,onLocationFocusChange:t.setLocationFieldFocused,isFocused:w.isFocused||w.locationFieldFocused,optionsPosition:p??"below"}}}import{chipIdFromTap as Ao,extractPlainText as xa,getCursorOffset as ya,keepCaretOnChip as Lo,plainTextLength as Oo,renderEditableContent as Ro,setCursorOffset as ka}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ce,useEffect as ft,useLayoutEffect as Rt,useRef as Ze}from"react";var bt;function Do(){if(bt!==void 0)return bt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),bt=e.contentEditable==="plaintext-only",bt}function Ca(e){let{segments:o,showChipIcons:a=!0,showChipImages:i=!0,newParamId:n,editingParam:s,editingIdentified:r,editingAnchor:l,caretOffset:m,placeholderText:b,isFocused:x,isDropdownOpen:u,listboxId:c,activeDescendantId:p,autoFocus:v,handleTextChange:A,handleKeyDown:N,handleCaretAfterInput:L,handleCaretMove:F,startEditingParam:G,replaceEditingRange:O,setFocused:E}=e,k=Ze(null),X=Ze(!1),_=Ze(""),J=Ze(""),z=Ze(null),V=Ze(0);z.current=m,ft(()=>{if(!v)return;let f=k.current;if(!f)return;document.activeElement===f?E(!0):f.focus();let C=f.ownerDocument??document,S=C.getSelection(),I=S&&S.rangeCount>0&&f.contains(S.anchorNode);if(S&&!I){let R=C.createRange();R.selectNodeContents(f),R.collapse(!0),S.removeAllRanges(),S.addRange(R)}},[v,E]),ft(()=>{let f=k.current;if(!f)return;let C=f.ownerDocument??document,S=()=>{let I=C.getSelection();if(!I||I.rangeCount===0||!I.anchorNode||!f.contains(I.anchorNode))return;let R=I.anchorNode,U=R.nodeType===Node.ELEMENT_NODE?R:R.parentElement,oe=(I.isCollapsed?U?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ne=s?.id??r?.id??null;if(oe&&oe!==ne){G(oe);return}performance.now()-V.current<50||F(ya(f))};return C.addEventListener("selectionchange",S),()=>C.removeEventListener("selectionchange",S)},[s,r,G,F]),ft(()=>{let f=k.current;if(!f)return;let C=S=>{let I=Ao(f,S.target);I&&(G(I),Lo(f,I))};return f.addEventListener("click",C),()=>f.removeEventListener("click",C)},[G]),Rt(()=>{let f=k.current;f&&Ro({input:f,segments:o,newParamId:n,editingParamId:s?.id??null,placeholderText:b??"",isFocused:x,showChipIcons:a,showChipImages:i})},[o,n,s,b,x,a,i]),Rt(()=>{let f=_.current,C=n??"";if(_.current=C,!C||C===f)return;let S=k.current;if(!S)return;S.focus();let I=z.current??Oo(S);ka(S,I)},[n]),Rt(()=>{let f=J.current,C=s?.id??"";if(J.current=C,!C||C===f||l==null)return;let S=k.current;S&&ka(S,l)},[s,l]);let T=ce(()=>{if(X.current)return;let f=k.current;if(!f)return;let C=xa(f),I=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;A(I)},[A]),K=ce(()=>{V.current=performance.now(),T();let f=k.current;f&&L(ya(f))},[T,L]);ft(()=>{let f=k.current;if(!f)return;let C=S=>{let I=S,R=I.inputType;if(R==="insertParagraph"||R==="insertLineBreak"||R==="insertFromDrop"){S.preventDefault();return}if(R.startsWith("insert")||R.startsWith("delete")){let U=R.startsWith("delete")?"":I.data??"";O(U)&&S.preventDefault()}};return f.addEventListener("beforeinput",C),()=>f.removeEventListener("beforeinput",C)},[O]);let h=ce(()=>{X.current=!0,k.current?.setAttribute("data-aia-composing","true")},[]),P=ce(()=>{X.current=!1,k.current?.removeAttribute("data-aia-composing"),T()},[T]),Pe=ce(f=>{f.preventDefault();let C=k.current;if(!C)return;let S=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!S)return;let I=C.ownerDocument??document,R=I.getSelection();if(!R||R.rangeCount===0)return;let U=R.getRangeAt(0);if(!C.contains(U.startContainer))return;U.deleteContents();let te=I.createTextNode(S);U.insertNode(te),U.setStartAfter(te),U.collapse(!0),R.removeAllRanges(),R.addRange(U),T()},[T]),be=ce(f=>N(f),[N]),De=ce(()=>E(!0),[E]),we=ce(()=>E(!1),[E]),g=ce(()=>k.current?.focus(),[]),Me=ce(()=>k.current?.blur(),[]),Ie=ce(()=>{let f=k.current;return f?xa(f):""},[]),Ee=Do()?"plaintext-only":"true";return{inputRef:k,editorProps:{ref:k,contentEditable:Ee,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":c,"aria-expanded":u,"aria-activedescendant":p,spellCheck:!0,enterKeyHint:"send",onInput:K,onKeyDown:be,onCompositionStart:h,onCompositionEnd:P,onPaste:Pe,onFocus:De,onBlur:we},getPlainText:Ie,focus:g,blur:Me}}import{jsx as Je,jsxs as zt}from"react/jsx-runtime";function Go(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var qo=Mo(function({onSubmit:o,onResult:a,onError:i,optionOverrides:n,maskCompletedText:s,className:r,apiConfig:l,additionalContext:m,language:b,currency:x,productId:u,visitorId:c,columns:p,pillPlacement:v="dropdown",mode:A="auto",optionsPosition:N="below",animations:L=!0,dropdownTrigger:F,closeDropdownOnBlur:G,prependPlaceholder:O,showNonTappableOptions:E,locationSearch:k,showOptionIcons:X=!0,showChipIcons:_=!0,showChipImages:J=!0,showOptionImages:z=!0,showOptionCounts:V=!0,showSkipButton:T,showProducts:K,productsLayout:h,productImageFallback:P,autoFocus:Pe=!0,onFocus:be,onBlur:De,value:we,completedParams:g,onChange:Me,onParamsChange:Ie,products:Ee,mapProducts:f,onProductSelect:C,onProductAddToCart:S,submitButton:I,resetOnSubmit:R=!0},U){let te=Xe(null),oe=Xe(null),ne=Xe(null),ze=Xe(()=>{}),q=Xe(null),ve=Xe(null);Mt(()=>{let D=te.current;if(D)return q.current?q.current.setMode(A):q.current=new Ho(D,A),()=>{q.current?.destroy(),q.current=null}},[A]);let qe=Dt(D=>{let ae=ve.current?.current;ae&&(ae.focus(),Bo(ae,D))},[]),{completedParams:et,suggestionPills:xe,setActivePill:Ne,skipActivePill:_e,segments:Q,newParamId:pe,clearNewParamId:ye,placeholderText:t,isFocused:Y,isDropdownOpen:Ae,isActivePillSelected:re,isLoading:w,isReady:he,activeIndex:Le,listboxId:ke,handleTextChange:tt,handleKeyDown:Ve,setFocused:Ce,editingParam:Ue,editingIdentified:se,editingAnchor:ue,caretOffset:Oe,startEditingParam:Fe,handleCaretAfterInput:Qe,handleCaretMove:He,replaceEditingRange:Be,dropdownProps:d,reset:y,refreshProducts:M,prepareSubmit:lt,getState:Nt,recordSubmit:Ft}=Ot({onSubmit:D=>ze.current(D),onResult:a,onError:i,optionOverrides:n,maskCompletedText:s,apiConfig:l,additionalContext:m,language:b,currency:x,productId:u,visitorId:c,columns:p,dropdownTrigger:F,optionsPosition:N,closeDropdownOnBlur:G,prependPlaceholder:O,showNonTappableOptions:E,locationSearch:k,showOptionIcons:X,showOptionImages:z,showOptionCounts:V,showSkipButton:T,showProducts:K,onFocus:be,onBlur:De,value:we,completedParams:g,onChange:Me,onParamsChange:Ie,products:Ee,mapProducts:f,onProductSelect:C,onProductAddToCart:S,source:"full-sdk",setCursor:qe});Mt(()=>{if(!pe)return;let D=window.setTimeout(()=>ye(),650);return()=>window.clearTimeout(D)},[pe,ye]);let Sa=Le>=0?`${ke}-option-${Le}`:void 0,{inputRef:wt,editorProps:Ta,focus:dt,blur:Ht,getPlainText:Bt}=Ca({segments:Q,newParamId:pe,editingParam:Ue,editingIdentified:se,editingAnchor:ue,caretOffset:Oe,placeholderText:t,isFocused:Y,showChipIcons:_,showChipImages:J,isDropdownOpen:Ae,listboxId:ke,activeDescendantId:Sa,autoFocus:Pe,handleTextChange:tt,handleKeyDown:Ve,handleCaretAfterInput:Qe,handleCaretMove:He,startEditingParam:Fe,replaceEditingRange:Be,setFocused:Ce});ve.current=wt,No(()=>{let D=oe.current,ae=wt.current;if(!D||!ae)return;let it=()=>{let Kt=D.firstElementChild;if(!Kt)return;let Aa=Kt.getBoundingClientRect(),La=ae.getBoundingClientRect();Aa.top>=La.bottom-2?D.setAttribute("data-aia-pill-wrapped",""):D.removeAttribute("data-aia-pill-wrapped")};it();let Wt=new ResizeObserver(it);return Wt.observe(ae),()=>Wt.disconnect()},[Q,xe.length,w,wt]),Mt(()=>{let D=ne.current;if(D)return Ko(D)},[]),zo(U,()=>({focus:dt,blur:Ht,reset:y,refreshProducts:M,setMode:D=>q.current?.setMode(D),skipActivePill:_e}),[dt,Ht,y,M,_e]);let at=!!Q.length||et.length>0,vt=Dt(D=>{if(!at)return;D&&lt();let ae=Nt(),it=Fo(Bt(),ae.completedParams,ae.skippedParams,{identifiedParams:ae.identifiedParams,isReady:ae.isReady,customFields:ae.customFields});D&&Ft(it),o(it),R&&y()},[Ft,R,at,lt,Nt,o,y,Bt]);ze.current=()=>vt(!1);let Pa=Dt(D=>{D.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||dt()},[dt]),Ia=v==="inline",Ea=v==="dropdown";return zt("div",{ref:te,className:`magicx-aia ${We.container} ${r??""}`,"data-pill-placement":v,"data-options-position":N,"data-animations":L?"on":"off","data-mode":Go(A),children:[Je(At,{...d,showPills:Ea,productsLayout:h,productImageFallback:P}),zt("div",{className:We.inputWrapper,"data-aia-input-wrapper":"",onClick:Pa,children:[zt("div",{ref:ne,className:We.editorArea,"data-aia-editor":"",children:[Je("div",{...Ta,className:We.input,"data-aia-input":""}),Ia&&(w||xe.length>0)&&Je("span",{ref:oe,className:We.pillListContainer,"data-aia-pill-list-container":"",children:Je(pt,{pills:xe,activePillIndex:0,activeSelected:re,onSelectPill:Ne,loading:w})})]}),I===null?null:I===void 0?Je(ua,{disabled:!at,ready:at&&he,onClick:()=>vt(!0),label:Wo(b).submit}):Je("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:We.submitSlot,onClick:D=>{at&&(D.stopPropagation(),vt(!0))},children:I})]})]})});export{qo as AIAutocomplete,At as AIAutocompleteDropdown,Jr as DATE_RANGE_META_END,es as DATE_RANGE_META_START,ts as DEFAULT_OPTION_COUNT_UNIT,ds as LOCATION_META_KEY,bs as PRODUCT_PATH_PREFIX,Is as TIME_META_KEY,As as WEEKDAY_LABELS,$r as buildSubmitResult,Zr as cellDay,Xr as cellIso,as as dateCellMarks,is as formatDate,os as formatDateRange,ns as formatOptionCount,rs as formatPlace,ss as formatTime,ls as isoDate,cs as monthLabel,ps as optionCountLabel,hs as optionHasImage,us as optionImageSources,ms as optionImageSrc,gs as optionLabel,fs as optionsShowLeadingVisuals,ws as parseDate,vs as parseLooseDate,xs as parseLooseDateRange,ys as parseTime,ks as productFromMatchedItem,Cs as productImageSources,Ss as productsFromCustomFields,Ts as sanitizeOptionIconSvg,Ps as selectedRangeFor,Ot as useAIAutocomplete,Es as visibleDateRange,Ls as withSkippedParams};
3332
+ `,document.head.appendChild(e)}var ua={submitButton:"aia-submitButton-otz7H"};import{jsx as Rt}from"react/jsx-runtime";function ma({disabled:e,ready:o,onClick:t,label:a=Co().submit}){return Rt("button",{type:"button","data-aia-submit":"",className:ua.submitButton,disabled:e,"data-aia-ready":o?"":void 0,onClick:i=>{i.stopPropagation(),t()},"aria-label":a,children:Rt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":a,children:Rt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as So,dateSelectionFor as To,identifiedParamLabel as Po,withoutTraditionalAutocomplete as Io}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as va,useEffect as $e,useRef as Z,useState as Eo}from"react";import{useRef as ga}from"react";function fa(e){let o=ga(e);o.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=ga({key:"",overrides:void 0});if(a.current.key!==t){let i={};for(let s of Object.keys(e??{})){let r=(l,m,w)=>{let x=o.current?.[s];return x?x(l,m,w):[]};i[s]=r}a.current={key:t,overrides:e?i:void 0}}return{overrides:a.current.overrides,key:t}}import{useRef as ba}from"react";function wa(e){let o=ba(e);o.current=e;let t=ba(null);t.current===null&&(t.current={fetch:(i,s)=>{let r=o.current;return r?r.fetch(i,s):Promise.reject(new Error("products config removed"))},transform:i=>o.current?.transform(i)??[],get limit(){return o.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var xa={text:"",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,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateFloor:null,timeView:null,multiSelectView:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,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 Lt({onSubmit:e,onResult:o,onError:t,optionOverrides:a,maskCompletedText:i,apiConfig:s,additionalContext:r,language:l,currency:m,productId:w,visitorId:x,columns:g=2,dropdownTrigger:c,optionsPosition:h,closeDropdownOnBlur:v,prependPlaceholder:E,showNonTappableOptions:F,locationSearch:M,showOptionIcons:O,showOptionImages:V,showOptionCounts:R,showSkipButton:D,showProducts:S,productImageFallback:H="image",onFocus:U,onBlur:X,value:q,completedParams:_,onChange:T,onParamsChange:B,products:he,mapProducts:se,onProductSelect:ne,onProductAddToCart:d,source:I,setCursor:Ce}){let f=Z(null),[ze,Ae]=Eo(null),Re=Z(e);Re.current=e;let b=Z(o);b.current=o;let C=Z(t);C.current=t;let P=Z(T);P.current=T;let A=Z(B);A.current=B;let L=Z(U);L.current=U;let Q=Z(X);Q.current=X;let le=Z(Ce);le.current=Ce;let ae=Z(ne);ae.current=ne;let ue=Z(d);ue.current=d;let Le=Z(x);Le.current=x;let me=Z(()=>{let p=Le.current;return typeof p=="function"?p():p}).current,J=wa(he),Ne=Z(se);Ne.current=se;let et=Z((p,z)=>{let k=Ne.current;return k?k(p,z):p}).current,Se=se?et:void 0,Fe=fa(a);$e(()=>{if(typeof document>"u")return;let p=new So(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:m,productId:w,visitorId:me,optionOverrides:Fe.overrides,maskCompletedText:i,columns:g,dropdownTrigger:c,optionsPosition:h,closeDropdownOnBlur:v,prependPlaceholder:E,showNonTappableOptions:F,locationSearch:M,showProducts:S,source:I,value:q,completedParams:_,onSubmit:(...k)=>Re.current?.(...k),onResult:(...k)=>b.current?.(...k),onError:(...k)=>C.current?.(...k),onChange:(...k)=>P.current?.(...k),onParamsChange:(...k)=>A.current?.(...k),onFocus:()=>L.current?.(),onBlur:()=>Q.current?.(),onProductSelect:k=>ae.current?.(k),onProductAddToCart:k=>ue.current?.(k),setCursor:k=>le.current?.(k),products:J.config,mapProducts:Se});f.current=p,Ae(p.getState());let z=p.subscribe(k=>Ae(k));return()=>{z(),p.destroy(),f.current===p&&(f.current=null)}},[]),$e(()=>{q!==void 0&&f.current?.setValue(q)},[q]),$e(()=>{_!==void 0&&f.current?.setCompletedParams(_)},[_]);let Ge=JSON.stringify(s??null),Te;try{Te=JSON.stringify(r??null)}catch{Te="[unstringifiable]"}$e(()=>{f.current?.update({apiConfig:s,additionalContext:r,language:l,currency:m,productId:w,optionOverrides:Fe.overrides,dropdownTrigger:c,optionsPosition:h,closeDropdownOnBlur:v,prependPlaceholder:E,showNonTappableOptions:F,locationSearch:M,showProducts:S})},[Ge,Te,l,m?.code,m?.rate,m?.country,w,Fe.key,c,h,v,E,F,M,S]);let ee=Z(!1);$e(()=>{if(!ee.current){ee.current=!0;return}f.current?.update({products:J.config})},[J.enabled]),$e(()=>{f.current?.update({mapProducts:Se})},[Se]);let ge=Z(null);ge.current===null&&(ge.current={handleTextChange:p=>f.current?.handleTextChange(p),handleKeyDown:p=>{let z="nativeEvent"in p?p.nativeEvent:p;f.current?.handleKeyDown(z)},setFocused:p=>f.current?.setFocused(p),startEditingParam:p=>f.current?.startEditingParam(p),exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:p=>f.current?.handleCaretAfterInput(p),handleCaretMove:p=>f.current?.handleCaretMove(p),replaceEditingRange:p=>f.current?.replaceEditingRange(p)??!1,setActivePill:p=>f.current?.setActivePill(p),skipActivePill:()=>f.current?.skipActivePill(),removeLastParam:()=>f.current?.removeLastParam(),clearNewParamId:()=>f.current?.clearNewParamId(),reset:()=>f.current?.reset(),refreshProducts:()=>f.current?.refreshProducts(),prepareSubmit:()=>f.current?.prepareSubmit(),getState:()=>f.current?.getState()??xa,recordSubmit:p=>f.current?.recordSubmit(p),selectOption:(p,z)=>f.current?.selectOption(p,z),selectProduct:p=>f.current?.selectProduct(p),addProductToCart:p=>{let z=f.current;return!z||!ue.current?Promise.resolve():z.addProductToCart(p)},setActiveDropdownIndex:p=>f.current?.setActiveDropdownIndex(p),clearHighlight:p=>f.current?.clearHighlight(p),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),setTime:p=>f.current?.setTime(p),commitTime:()=>f.current?.commitTime(),toggleMultiSelectOption:p=>f.current?.toggleMultiSelectOption(p),commitMultiSelect:()=>f.current?.commitMultiSelect(),setLocationQuery:p=>f.current?.setLocationQuery(p),moveLocationHighlight:p=>f.current?.moveLocationHighlight(p),commitLocation:p=>f.current?.commitLocation(p),setLocationFieldFocused:p=>f.current?.setLocationFieldFocused(p),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let y=ge.current,n=va(p=>{let z=p.target.value,lt=z.length>0&&!p.nativeEvent?.isComposing&&z[0]!==z[0].toUpperCase()?z[0].toUpperCase()+z.slice(1):z;f.current?.handleTextChange(lt)},[]),Y=va(p=>{f.current?.handleKeyDown(p.nativeEvent)},[]),fe=f.current,u=ze??xa,qe=q!==void 0?q:u.text,be=_!==void 0?_:u.completedParams,we=u.actionableSuggestions,_e=we[0],tt=Io(we),Pe=fe?.listboxId??"",Ve=u.activeDropdownIndex>=0&&fe?`${Pe}-option-${u.activeDropdownIndex}`:void 0,de=u.editingParam,ve=u.editingIdentified,Oe=de?{parameter:de.suggestionParameter,text:de.suggestionPlaceholder,required:!0,options:de.options}:ve?{parameter:ve.parameter,text:Po(ve.parameter),required:!0,options:[]}:null,He=u.dropdownSuggestion??Oe??_e,Ue=Oe?[Oe]:we,De=To(u),Qe=!fe||u.dropdownLoading;return{completedParams:be,multiSelectView:u.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:tt,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:y.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:Qe,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:Pe,error:u.error,products:u.products,customFields:u.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:de,editingIdentified:ve,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:qe,placeholder:u.placeholderText||void 0,onChange:n,onKeyDown:Y,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":Ve,"aria-autocomplete":"list","aria-controls":Pe},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:He?[{...He,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:u.isDropdownOpen,id:Pe,pills:Ue,activeSelected:u.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(D??!0)&&!de&&!ve,showOptionIcons:O??!0,showOptionImages:V??!0,showOptionCounts:R??!0,skipDisabled:u.inSelectionAnimation,isLoading:Qe,skeletonExiting:u.skeletonExiting,isInputEmpty:qe.trim().length===0,language:l,products:u.products,productImageFallback:H,onProductSelect:y.selectProduct,onProductAddToCart:d?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:De.selectedIso,selectedDateRange:De.selectedRange,dateRangeStart:De.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:u.timeView,multiSelectView:u.multiSelectView,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:u.locationView,isReediting:u.editingParam!=null,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:u.isFocused||u.locationFieldFocused,optionsPosition:h??"below"}}}import{chipIdFromTap as Ao,extractPlainText as ya,getCursorOffset as ka,keepCaretOnChip as Ro,plainTextLength as Lo,renderEditableContent as Oo,setCursorOffset as Ca}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as pe,useEffect as ft,useLayoutEffect as Ot,useRef as Ze}from"react";var bt;function Do(){if(bt!==void 0)return bt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),bt=e.contentEditable==="plaintext-only",bt}function Sa(e){let{segments:o,showChipIcons:t=!0,showChipImages:a=!0,newParamId:i,editingParam:s,editingIdentified:r,editingAnchor:l,caretOffset:m,placeholderText:w,isFocused:x,isDropdownOpen:g,listboxId:c,activeDescendantId:h,autoFocus:v,handleTextChange:E,handleKeyDown:F,handleCaretAfterInput:M,handleCaretMove:O,startEditingParam:V,replaceEditingRange:R,setFocused:D}=e,S=Ze(null),H=Ze(!1),U=Ze(""),X=Ze(""),q=Ze(null),_=Ze(0);q.current=m,ft(()=>{if(!v)return;let b=S.current;if(!b)return;document.activeElement===b?D(!0):b.focus();let C=b.ownerDocument??document,P=C.getSelection(),A=P&&P.rangeCount>0&&b.contains(P.anchorNode);if(P&&!A){let L=C.createRange();L.selectNodeContents(b),L.collapse(!0),P.removeAllRanges(),P.addRange(L)}},[v,D]),ft(()=>{let b=S.current;if(!b)return;let C=b.ownerDocument??document,P=()=>{let A=C.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!b.contains(A.anchorNode))return;let L=A.anchorNode,Q=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,ae=(A.isCollapsed?Q?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ue=s?.id??r?.id??null;if(ae&&ae!==ue){V(ae);return}performance.now()-_.current<50||O(ka(b))};return C.addEventListener("selectionchange",P),()=>C.removeEventListener("selectionchange",P)},[s,r,V,O]),ft(()=>{let b=S.current;if(!b)return;let C=P=>{let A=Ao(b,P.target);A&&(V(A),Ro(b,A))};return b.addEventListener("click",C),()=>b.removeEventListener("click",C)},[V]),Ot(()=>{let b=S.current;b&&Oo({input:b,segments:o,newParamId:i,editingParamId:s?.id??null,placeholderText:w??"",isFocused:x,showChipIcons:t,showChipImages:a})},[o,i,s,w,x,t,a]),Ot(()=>{let b=U.current,C=i??"";if(U.current=C,!C||C===b)return;let P=S.current;if(!P)return;P.focus();let A=q.current??Lo(P);Ca(P,A)},[i]),Ot(()=>{let b=X.current,C=s?.id??"";if(X.current=C,!C||C===b||l==null)return;let P=S.current;P&&Ca(P,l)},[s,l]);let T=pe(()=>{if(H.current)return;let b=S.current;if(!b)return;let C=ya(b),A=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;E(A)},[E]),B=pe(()=>{_.current=performance.now(),T();let b=S.current;b&&M(ka(b))},[T,M]);ft(()=>{let b=S.current;if(!b)return;let C=P=>{let A=P,L=A.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){P.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let Q=L.startsWith("delete")?"":A.data??"";R(Q)&&P.preventDefault()}};return b.addEventListener("beforeinput",C),()=>b.removeEventListener("beforeinput",C)},[R]);let he=pe(()=>{H.current=!0,S.current?.setAttribute("data-aia-composing","true")},[]),se=pe(()=>{H.current=!1,S.current?.removeAttribute("data-aia-composing"),T()},[T]),ne=pe(b=>{b.preventDefault();let C=S.current;if(!C)return;let P=(b.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!P)return;let A=C.ownerDocument??document,L=A.getSelection();if(!L||L.rangeCount===0)return;let Q=L.getRangeAt(0);if(!C.contains(Q.startContainer))return;Q.deleteContents();let le=A.createTextNode(P);Q.insertNode(le),Q.setStartAfter(le),Q.collapse(!0),L.removeAllRanges(),L.addRange(Q),T()},[T]),d=pe(b=>F(b),[F]),I=pe(()=>D(!0),[D]),Ce=pe(()=>D(!1),[D]),f=pe(()=>S.current?.focus(),[]),ze=pe(()=>S.current?.blur(),[]),Ae=pe(()=>{let b=S.current;return b?ya(b):""},[]),Re=Do()?"plaintext-only":"true";return{inputRef:S,editorProps:{ref:S,contentEditable:Re,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":c,"aria-expanded":g,"aria-activedescendant":h,spellCheck:!0,enterKeyHint:"send",onInput:B,onKeyDown:d,onCompositionStart:he,onCompositionEnd:se,onPaste:ne,onFocus:I,onBlur:Ce},getPlainText:Ae,focus:f,blur:ze}}import{jsx as Je,jsxs as zt}from"react/jsx-runtime";function Go(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var qo=Mo(function({onSubmit:o,onResult:t,onError:a,optionOverrides:i,maskCompletedText:s,className:r,apiConfig:l,additionalContext:m,language:w,currency:x,productId:g,visitorId:c,columns:h,pillPlacement:v="dropdown",mode:E="auto",optionsPosition:F="below",animations:M=!0,dropdownTrigger:O,closeDropdownOnBlur:V,prependPlaceholder:R,showNonTappableOptions:D,locationSearch:S,showOptionIcons:H=!0,showChipIcons:U=!0,showChipImages:X=!0,showOptionImages:q=!0,showOptionCounts:_=!0,showSkipButton:T,showProducts:B,productsLayout:he,productImageFallback:se,autoFocus:ne=!0,onFocus:d,onBlur:I,value:Ce,completedParams:f,onChange:ze,onParamsChange:Ae,products:Re,mapProducts:b,onProductSelect:C,onProductAddToCart:P,submitButton:A,resetOnSubmit:L=!0},Q){let le=Xe(null),ae=Xe(null),ue=Xe(null),Le=Xe(()=>{}),me=Xe(null),J=Xe(null);Mt(()=>{let N=le.current;if(N)return me.current?me.current.setMode(E):me.current=new Ho(N,E),()=>{me.current?.destroy(),me.current=null}},[E]);let Ne=Dt(N=>{let ie=J.current?.current;ie&&(ie.focus(),Bo(ie,N))},[]),{completedParams:et,suggestionPills:Se,setActivePill:Fe,skipActivePill:Ge,segments:Te,newParamId:ee,clearNewParamId:ge,placeholderText:y,isFocused:n,isDropdownOpen:Y,isActivePillSelected:fe,isLoading:u,isReady:qe,activeIndex:be,listboxId:we,handleTextChange:_e,handleKeyDown:tt,setFocused:Pe,editingParam:Ve,editingIdentified:de,editingAnchor:ve,caretOffset:Oe,startEditingParam:He,handleCaretAfterInput:Ue,handleCaretMove:De,replaceEditingRange:Qe,dropdownProps:p,reset:z,refreshProducts:k,prepareSubmit:lt,getState:Nt,recordSubmit:Ft}=Lt({onSubmit:N=>Le.current(N),onResult:t,onError:a,optionOverrides:i,maskCompletedText:s,apiConfig:l,additionalContext:m,language:w,currency:x,productId:g,visitorId:c,columns:h,dropdownTrigger:O,optionsPosition:F,closeDropdownOnBlur:V,prependPlaceholder:R,showNonTappableOptions:D,locationSearch:S,showOptionIcons:H,showOptionImages:q,showOptionCounts:_,showSkipButton:T,showProducts:B,onFocus:d,onBlur:I,value:Ce,completedParams:f,onChange:ze,onParamsChange:Ae,products:Re,mapProducts:b,onProductSelect:C,onProductAddToCart:P,source:"full-sdk",setCursor:Ne});Mt(()=>{if(!ee)return;let N=window.setTimeout(()=>ge(),650);return()=>window.clearTimeout(N)},[ee,ge]);let Ta=be>=0?`${we}-option-${be}`:void 0,{inputRef:wt,editorProps:Pa,focus:dt,blur:Ht,getPlainText:Bt}=Sa({segments:Te,newParamId:ee,editingParam:Ve,editingIdentified:de,editingAnchor:ve,caretOffset:Oe,placeholderText:y,isFocused:n,showChipIcons:U,showChipImages:X,isDropdownOpen:Y,listboxId:we,activeDescendantId:Ta,autoFocus:ne,handleTextChange:_e,handleKeyDown:tt,handleCaretAfterInput:Ue,handleCaretMove:De,startEditingParam:He,replaceEditingRange:Qe,setFocused:Pe});J.current=wt,No(()=>{let N=ae.current,ie=wt.current;if(!N||!ie)return;let it=()=>{let Kt=N.firstElementChild;if(!Kt)return;let Ra=Kt.getBoundingClientRect(),La=ie.getBoundingClientRect();Ra.top>=La.bottom-2?N.setAttribute("data-aia-pill-wrapped",""):N.removeAttribute("data-aia-pill-wrapped")};it();let Wt=new ResizeObserver(it);return Wt.observe(ie),()=>Wt.disconnect()},[Te,Se.length,u,wt]),Mt(()=>{let N=ue.current;if(N)return Ko(N)},[]),zo(Q,()=>({focus:dt,blur:Ht,reset:z,refreshProducts:k,setMode:N=>me.current?.setMode(N),skipActivePill:Ge}),[dt,Ht,z,k,Ge]);let at=!!Te.length||et.length>0,vt=Dt(N=>{if(!at)return;N&&lt();let ie=Nt(),it=Fo(Bt(),ie.completedParams,ie.skippedParams,{identifiedParams:ie.identifiedParams,isReady:ie.isReady,customFields:ie.customFields});N&&Ft(it),o(it),L&&z()},[Ft,L,at,lt,Nt,o,z,Bt]);Le.current=()=>vt(!1);let Ia=Dt(N=>{N.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||dt()},[dt]),Ea=v==="inline",Aa=v==="dropdown";return zt("div",{ref:le,className:`magicx-aia ${Be.container} ${r??""}`,"data-pill-placement":v,"data-options-position":F,"data-animations":M?"on":"off","data-mode":Go(E),children:[Je(At,{...p,showPills:Aa,productsLayout:he,productImageFallback:se}),zt("div",{className:Be.inputWrapper,"data-aia-input-wrapper":"",onClick:Ia,children:[zt("div",{ref:ue,className:Be.editorArea,"data-aia-editor":"",children:[Je("div",{...Pa,className:Be.input,"data-aia-input":""}),Ea&&(u||Se.length>0)&&Je("span",{ref:ae,className:Be.pillListContainer,"data-aia-pill-list-container":"",children:Je(pt,{pills:Se,activePillIndex:0,activeSelected:fe,onSelectPill:Fe,loading:u})})]}),A===null?null:A===void 0?Je(ma,{disabled:!at,ready:at&&qe,onClick:()=>vt(!0),label:Wo(w).submit}):Je("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Be.submitSlot,onClick:N=>{at&&(N.stopPropagation(),vt(!0))},children:A})]})]})});export{qo as AIAutocomplete,At as AIAutocompleteDropdown,Jr as DATE_RANGE_META_END,es as DATE_RANGE_META_START,ts as DEFAULT_OPTION_COUNT_UNIT,ds as LOCATION_META_KEY,bs as PRODUCT_PATH_PREFIX,Is as TIME_META_KEY,As as WEEKDAY_LABELS,$r as buildSubmitResult,Zr as cellDay,Xr as cellIso,as as dateCellMarks,is as formatDate,os as formatDateRange,ns as formatOptionCount,rs as formatPlace,ss as formatTime,ls as isoDate,cs as monthLabel,ps as optionCountLabel,hs as optionHasImage,us as optionImageSources,ms as optionImageSrc,gs as optionLabel,fs as optionsShowLeadingVisuals,ws as parseDate,vs as parseLooseDate,xs as parseLooseDateRange,ys as parseTime,ks as productFromMatchedItem,Cs as productImageSources,Ss as productsFromCustomFields,Ts as sanitizeOptionIconSvg,Ps as selectedRangeFor,Lt as useAIAutocomplete,Es as visibleDateRange,Rs as withSkippedParams};
3326
3333
  //# sourceMappingURL=index.mjs.map