@magicx-eng/ai-autocomplete-react 0.49.1 → 0.50.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 Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END as _r,DATE_RANGE_META_START as Ur,DEFAULT_OPTION_COUNT_UNIT as Vr,dateCellMarks as Qr,formatDate as Yr,formatDateRange as jr,formatOptionCount as $r,formatPlace as Zr,formatTime as Xr,isoDate as Jr,LOCATION_META_KEY as es,monthLabel as ts,optionCountLabel as as,optionHasImage as is,optionImageSources as os,optionImageSrc as ns,optionLabel as rs,optionsShowLeadingVisuals as ss,PRODUCT_PATH_PREFIX as ls,parseDate as ds,parseLooseDate as cs,parseLooseDateRange as ps,parseTime as hs,productFromMatchedItem as us,productImageSources as ms,productsFromCustomFields as gs,sanitizeOptionIconSvg as fs,selectedRangeFor as bs,TIME_META_KEY as ws,visibleDateRange as vs,WEEKDAY_LABELS as xs,withSkippedParams as ys}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as To,useCallback as Rt,useEffect as Ot,useImperativeHandle as Po,useLayoutEffect as Io,useRef as $e}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 Kr,cellDay as qr,cellIso as _r,DATE_RANGE_META_END as Ur,DATE_RANGE_META_START as Vr,DEFAULT_OPTION_COUNT_UNIT as Qr,dateCellMarks as Yr,formatDate as jr,formatDateRange as $r,formatOptionCount as Zr,formatPlace as Xr,formatTime as Jr,isoDate as es,LOCATION_META_KEY as ts,monthLabel as as,optionCountLabel as is,optionHasImage as os,optionImageSources as ns,optionImageSrc as rs,optionLabel as ss,optionsShowLeadingVisuals as ls,PRODUCT_PATH_PREFIX as ds,parseDate as cs,parseLooseDate as ps,parseLooseDateRange as hs,parseTime as us,productFromMatchedItem as ms,productImageSources as gs,productsFromCustomFields as fs,sanitizeOptionIconSvg as bs,selectedRangeFor as ws,TIME_META_KEY as vs,visibleDateRange as xs,WEEKDAY_LABELS as ys,withSkippedParams as ks}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Po,useCallback as Ot,useEffect as Dt,useImperativeHandle as Io,useLayoutEffect as Eo,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 Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
346
346
  transition: none;
347
347
  }
348
348
  }
349
- `,document.head.appendChild(e)}var He={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 Qi,attachViewportFit as Yi,containScroll as ji,dateFloorFor as $i,hasSkippablePill as Zi,isCalendarFormat as Xi,labelTraditionalAutocomplete as Ji,uiStringsFor as eo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Qe,useRef as Ve,useState as to}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 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 Yi,attachViewportFit as ji,containScroll as $i,dateFloorFor as Zi,hasSkippablePill as Xi,isCalendarFormat as Ji,labelTraditionalAutocomplete as eo,uiStringsFor as to}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as je,useRef as Ye,useState as ao}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
  *
@@ -1287,7 +1287,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
1287
1287
  .aia-multiDone-y12U7:hover {
1288
1288
  background: var(--aia-multi-done-bg-hover, var(--aia-confirm-bg-hover, #404040));
1289
1289
  }
1290
- `,document.head.appendChild(e)}var fe={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 Aa,cellIso as it,dateCellMarks as La,isDimmedDay as Ra,isoDate as Oa,monthLabel as Da,visibleDateRange as Ma,WEEKDAY_LABELS as za}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Na}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) ---
1290
+ `,document.head.appendChild(e)}var ue={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 La,cellIso as ot,dateCellMarks as Ra,isDimmedDay as Oa,isoDate as Da,monthLabel as Ma,visibleDateRange as za,WEEKDAY_LABELS as Na}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Fa}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) ---
1291
1291
 
1292
1292
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1293
1293
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1474,7 +1474,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
1474
1474
  opacity: 0.8;
1475
1475
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1476
1476
  }
1477
- `,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 be,jsxs as Wt}from"react/jsx-runtime";var Fa=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Gt({options:e,activeIndex:i,listboxId:t,view:a,selection:o,onSelect:r,onHighlight:n,onUnhighlight:s,onPreviousMonth:g,onNextMonth:v}){let x=Oa(new Date),u=Ma({pendingStart:o.rangeStart,highlightedIso:it(e[i]),selected:o.selectedRange,floor:o.floor});return Wt("div",{className:W.datepicker,"data-aia-datepicker":"",children:[Wt("div",{className:W.header,children:[be("button",{type:"button",tabIndex:-1,className:W.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:d=>d.preventDefault(),onClick:g,children:"\u2039"}),be("span",{className:W.month,"data-aia-date-month":"","aria-live":"polite",children:Da(a)}),be("button",{type:"button",tabIndex:-1,className:W.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:d=>d.preventDefault(),onClick:v,children:"\u203A"})]}),be("div",{className:W.weekdays,"aria-hidden":"true",children:za.map((d,c)=>be("span",{className:W.weekday,children:d},Fa[c]))}),be("div",{className:W.grid,"data-aia-date-grid":"",children:e.map((d,c)=>be(Ha,{option:d,id:`${t}-option-${c}`,index:c,isHighlighted:c===i&&d.is_tappable,isToday:it(d)===x,isPast:Ra(it(d),x,o.floor),marks:La(it(d),{selectedIso:o.selectedIso,range:u}),onSelect:r,onHighlight:n,onUnhighlight:s},it(d)??`pad-${c}`))})]})}function Ha({option:e,id:i,index:t,isHighlighted:a,isToday:o,isPast:r,marks:n,onSelect:s,onHighlight:g,onUnhighlight:v}){let[x,u]=Na(!1),d=Aa(e);if(d==null)return be("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${W.cell} ${W.blank}`});let c=()=>{u(!0),s(e),setTimeout(()=>u(!1),170)},w=[W.cell,W.day,r?W.past:"",a?W.highlighted:"",o?W.today:"",n.inRange?W.inRange:"",n.selected?W.selected:"",x?W.pressed:""].filter(Boolean).join(" ");return be("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:w,onClick:c,onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),c())},onMouseEnter:()=>g(t),onMouseLeave:v?()=>v(t):void 0,children:be("span",{className:W.number,children:d})})}import{ATTRIBUTION_URL as Ba,buildAttributionUrl as Wa,getFooterHint as Ga,uiStringsFor as Ka}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as qa,useState as _a}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 {
1477
+ `,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 me,jsxs as Gt}from"react/jsx-runtime";var Ha=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Kt({options:e,activeIndex:o,listboxId:a,view:i,selection:n,onSelect:l,onHighlight:r,onUnhighlight:d,onPreviousMonth:m,onNextMonth:v}){let x=Da(new Date),u=za({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:[me("button",{type:"button",tabIndex:-1,className:H.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:c=>c.preventDefault(),onClick:m,children:"\u2039"}),me("span",{className:H.month,"data-aia-date-month":"","aria-live":"polite",children:Ma(i)}),me("button",{type:"button",tabIndex:-1,className:H.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:c=>c.preventDefault(),onClick:v,children:"\u203A"})]}),me("div",{className:H.weekdays,"aria-hidden":"true",children:Na.map((c,p)=>me("span",{className:H.weekday,children:c},Ha[p]))}),me("div",{className:H.grid,"data-aia-date-grid":"",children:e.map((c,p)=>me(Ba,{option:c,id:`${a}-option-${p}`,index:p,isHighlighted:p===o&&c.is_tappable,isToday:ot(c)===x,isPast:Oa(ot(c),x,n.floor),marks:Ra(ot(c),{selectedIso:n.selectedIso,range:u}),onSelect:l,onHighlight:r,onUnhighlight:d},ot(c)??`pad-${p}`))})]})}function Ba({option:e,id:o,index:a,isHighlighted:i,isToday:n,isPast:l,marks:r,onSelect:d,onHighlight:m,onUnhighlight:v}){let[x,u]=Fa(!1),c=La(e);if(c==null)return me("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),d(e),setTimeout(()=>u(!1),170)},w=[H.cell,H.day,l?H.past:"",i?H.highlighted:"",n?H.today:"",r.inRange?H.inRange:"",r.selected?H.selected:"",x?H.pressed:""].filter(Boolean).join(" ");return me("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:w,onClick:p,onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),p())},onMouseEnter:()=>m(a),onMouseLeave:v?()=>v(a):void 0,children:me("span",{className:H.number,children:c})})}import{ATTRIBUTION_URL as Wa,buildAttributionUrl as Ga,getFooterHint as Ka,uiStringsFor as qa}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as _a,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 {
1478
1478
  display: flex;
1479
1479
  flex-wrap: wrap;
1480
1480
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1514,7 +1514,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
1514
1514
  .aia-cluster[data-justify="around"] {
1515
1515
  justify-content: space-around;
1516
1516
  }
1517
- `,document.head.appendChild(e)}import{jsx as Kt}from"react/jsx-runtime";function ot({gap:e,align:i="center",justify:t="start",noWrap:a=!1,inline:o=!1,className:r,children:n,...s}){let g=e?{"--aia-cluster-gap":e}:void 0,v={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":i,"data-justify":t,"data-nowrap":a||void 0,"data-inline":o||void 0,style:g,...s};return o?Kt("span",{...v,children:n}):Kt("div",{...v,children:n})}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
1517
+ `,document.head.appendChild(e)}import{jsx as qt}from"react/jsx-runtime";function nt({gap:e,align:o="center",justify:a="start",noWrap:i=!1,inline:n=!1,className:l,children:r,...d}){let m=e?{"--aia-cluster-gap":e}:void 0,v={className:l?`aia-cluster ${l}`:"aia-cluster","data-align":o,"data-justify":a,"data-nowrap":i||void 0,"data-inline":n||void 0,style:m,...d};return n?qt("span",{...v,children:r}):qt("div",{...v,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
1518
1518
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1519
1519
  room above the hint/branding row so the footer doesn't butt against the last
1520
1520
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1661,7 +1661,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
1661
1661
  justify-content: flex-end;
1662
1662
  }
1663
1663
  }
1664
- `,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 nt,jsxs as vt}from"react/jsx-runtime";function qt({isOptionHighlighted:e=!1,isInputEmpty:i=!1,strings:t=Ka()}){let{key:a,hint:o}=Ga(e,i,t),[r,n]=_a(Ba);return qa(()=>{n(Wa())},[]),nt("footer",{className:Se.footer,"data-aia-footer":"",children:vt(ot,{justify:"between",noWrap:!0,className:Se.row,children:[vt(ot,{gap:"5px",className:Se.hintGroup,children:[nt("kbd",{className:Se.key,children:a}),nt("span",{className:Se.hint,children:o})]}),vt("a",{className:Se.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[nt("span",{className:Se.brand,children:"AI"}),nt("span",{className:Se.badge,children:"Autocomplete"})]})]})})}import{useEffect as _t,useLayoutEffect as Ua,useRef as se}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
1664
+ `,document.head.appendChild(e)}var Ce={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 _t({isOptionHighlighted:e=!1,isInputEmpty:o=!1,strings:a=qa()}){let{key:i,hint:n}=Ka(e,o,a),[l,r]=Ua(Wa);return _a(()=>{r(Ga())},[]),rt("footer",{className:Ce.footer,"data-aia-footer":"",children:xt(nt,{justify:"between",noWrap:!0,className:Ce.row,children:[xt(nt,{gap:"5px",className:Ce.hintGroup,children:[rt("kbd",{className:Ce.key,children:i}),rt("span",{className:Ce.hint,children:n})]}),xt("a",{className:Ce.brandLink,href:l,target:"_blank",rel:"noopener noreferrer",children:[rt("span",{className:Ce.brand,children:"AI"}),rt("span",{className:Ce.badge,children:"Autocomplete"})]})]})})}import{useEffect as Ut,useLayoutEffect as Va,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
1665
1665
  Angular copy). The three are kept identical by
1666
1666
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
1667
1667
  .aia-location-6-fsr {
@@ -1788,7 +1788,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
1788
1788
  .aia-loadingBar-OLCr4:nth-child(3) {
1789
1789
  width: 60%;
1790
1790
  }
1791
- `,document.head.appendChild(e)}var G={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 te,jsxs as Oe}from"react/jsx-runtime";var Va=0;function rt(e){return e.getRootNode().activeElement??null}function Vt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Qa(e){if(!e.isContentEditable)return null;let i=Vt(e);if(!i||i.rangeCount===0)return null;let t=i.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function Ut(e,i){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=Vt(e);if(!t)return;let a=i;(!a||!a.startContainer.isConnected||!e.contains(a.startContainer))&&(a=document.createRange(),a.selectNodeContents(e),a.collapse(!1)),t.removeAllRanges(),t.addRange(a)}var Ya=Oe("svg",{className:G.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[te("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),te("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),ja=Oe("svg",{className:G.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[te("circle",{cx:"11",cy:"11",r:"7"}),te("path",{d:"m20 20-3.5-3.5"})]});function Qt({view:e,searchLabel:i,noResultsLabel:t,useTypedLabel:a,widgetFocused:o,visible:r=!0,interactive:n=!0,onQuery:s,onMove:g,onCommit:v,onFocusChange:x}){let u=se(null),d=se(null),c=se(null),w=se(null),L=se(null),N=se(!1),D=se(!1),H=se(!1),q=se(o);q.current=o;let R=se(x);R.current=x;let I=p=>{H.current=p,x(p)},C=()=>{let p=u.current;return p!=null&&rt(p)===p},V=()=>{let p=d.current;if(!p)return;let E=rt(p);E instanceof HTMLElement&&E!==u.current&&E!==document.body&&!p.contains(E)&&(w.current=E,L.current=Qa(E))},Q=se(null);Q.current===null&&(Q.current=`aia-location-${++Va}`);let B=`${Q.current}-row-`;_t(()=>{let p=u.current;p&&p.value!==e.query&&rt(p)!==p&&(p.value=e.query)},[e.query]),_t(()=>{let p=u.current;if(p){if(!r&&C()){D.current=!0,F();return}if(!o){setTimeout(()=>{if(q.current)return;let E=w.current;E&&rt(E)===E||(D.current=!1)},0);return}if(!(D.current||!n||C())){if(V(),I(!0),p.focus({preventScroll:!0}),!C()){D.current=!0,I(!1);return}p.value&&p.select()}}}),Ua(()=>()=>{if(!H.current)return;let p=u.current,E=w.current;E?.isConnected&&p&&rt(p)===p&&(N.current=!0,Ut(E,L.current),N.current=!1),H.current=!1,R.current(!1)},[]);let F=(p=!1)=>{p&&(D.current=!0);let E=w.current;E?.isConnected&&C()&&(N.current=!0,Ut(E,L.current),N.current=!1),I(!1)},ae=e.query.trim(),P=e.highlighted>=0&&e.highlighted<e.places.length?`${B}${e.highlighted}`:void 0,_=null;return e.places.length>0?_=e.places.map((p,E)=>Oe("div",{id:`${B}${E}`,role:"option","aria-selected":E===e.highlighted,className:E===e.highlighted?`${G.row} ${G.highlighted}`:G.row,"data-aia-location-row":"","data-aia-index":E,onClick:()=>{n&&(F(!0),v(E))},children:[te("span",{className:G.pin,children:Ya}),Oe("span",{className:G.text,children:[te("span",{className:G.name,children:p.name}),p.secondary&&te("span",{className:G.secondary,children:p.secondary})]})]},p.id)):e.status==="loading"?_=Oe("div",{className:G.loading,"data-aia-location-loading":"",children:[te("span",{className:G.loadingBar}),te("span",{className:G.loadingBar}),te("span",{className:G.loadingBar})]}):ae&&(_=Oe("div",{className:G.note,"data-aia-location-note":"",children:[e.status==="done"&&te("span",{className:G.empty,children:t}),te("span",{children:a})]})),Oe("div",{ref:d,className:G.location,"data-aia-location":"",onMouseDown:p=>{!(p.target instanceof Node)||!c.current?.contains(p.target)||(p.stopPropagation(),V(),I(!0))},children:[Oe("label",{ref:c,className:G.field,children:[ja,te("input",{ref:u,type:"text",className:G.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:i,"aria-label":i,"aria-activedescendant":P,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:p=>s(p.target.value),onFocus:()=>I(!0),onBlur:()=>{N.current||(D.current=!0,I(!1))},onKeyDown:p=>{if(!p.nativeEvent.isComposing)switch(p.key){case"ArrowDown":case"ArrowUp":p.preventDefault(),g(p.key==="ArrowDown"?1:-1);return;case"Enter":if(p.preventDefault(),!n)return;F(!0),v();return;case"Escape":p.preventDefault(),p.stopPropagation(),D.current=!0,F();return;case"Backspace":if(p.currentTarget.value!=="")return;p.preventDefault(),D.current=!0,F();return}}})]}),te("div",{className:G.results,"data-aia-location-results":"","aria-live":"polite",children:_})]})}import{isSmartSuggestion as Ja,isTraditionalAutocompleteSuggestion as ei}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as $a}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,
1791
+ `,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 ae,jsxs as Oe}from"react/jsx-runtime";var Qa=0;function st(e){return e.getRootNode().activeElement??null}function Qt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Ya(e){if(!e.isContentEditable)return null;let o=Qt(e);if(!o||o.rangeCount===0)return null;let a=o.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function Vt(e,o){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=Qt(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 ja=Oe("svg",{className:B.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[ae("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),ae("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),$a=Oe("svg",{className:B.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[ae("circle",{cx:"11",cy:"11",r:"7"}),ae("path",{d:"m20 20-3.5-3.5"})]});function Yt({view:e,searchLabel:o,noResultsLabel:a,useTypedLabel:i,widgetFocused:n,visible:l=!0,interactive:r=!0,onQuery:d,onMove:m,onCommit:v,onFocusChange:x}){let u=le(null),c=le(null),p=le(null),w=le(null),I=le(null),M=le(!1),A=le(!1),F=le(!1),K=le(n);K.current=n;let L=le(x);L.current=x;let E=h=>{F.current=h,x(h)},y=()=>{let h=u.current;return h!=null&&st(h)===h},$=()=>{let h=c.current;if(!h)return;let T=st(h);T instanceof HTMLElement&&T!==u.current&&T!==document.body&&!h.contains(T)&&(w.current=T,I.current=Ya(T))},q=le(null);q.current===null&&(q.current=`aia-location-${++Qa}`);let Z=`${q.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(!l&&y()){A.current=!0,z();return}if(!n){setTimeout(()=>{if(K.current)return;let T=w.current;T&&st(T)===T||(A.current=!1)},0);return}if(!(A.current||!r||y())){if($(),E(!0),h.focus({preventScroll:!0}),!y()){A.current=!0,E(!1);return}h.value&&h.select()}}}),Va(()=>()=>{if(!F.current)return;let h=u.current,T=w.current;T?.isConnected&&h&&st(h)===h&&(M.current=!0,Vt(T,I.current),M.current=!1),F.current=!1,L.current(!1)},[]);let z=(h=!1)=>{h&&(A.current=!0);let T=w.current;T?.isConnected&&y()&&(M.current=!0,Vt(T,I.current),M.current=!1),E(!1)},_=e.query.trim(),S=e.highlighted>=0&&e.highlighted<e.places.length?`${Z}${e.highlighted}`:void 0,G=null;return e.places.length>0?G=e.places.map((h,T)=>Oe("div",{id:`${Z}${T}`,role:"option","aria-selected":T===e.highlighted,className:T===e.highlighted?`${B.row} ${B.highlighted}`:B.row,"data-aia-location-row":"","data-aia-index":T,onClick:()=>{r&&(z(!0),v(T))},children:[ae("span",{className:B.pin,children:ja}),Oe("span",{className:B.text,children:[ae("span",{className:B.name,children:h.name}),h.secondary&&ae("span",{className:B.secondary,children:h.secondary})]})]},h.id)):e.status==="loading"?G=Oe("div",{className:B.loading,"data-aia-location-loading":"",children:[ae("span",{className:B.loadingBar}),ae("span",{className:B.loadingBar}),ae("span",{className:B.loadingBar})]}):_&&(G=Oe("div",{className:B.note,"data-aia-location-note":"",children:[e.status==="done"&&ae("span",{className:B.empty,children:a}),ae("span",{children:i})]})),Oe("div",{ref:c,className:B.location,"data-aia-location":"",onMouseDown:h=>{!(h.target instanceof Node)||!p.current?.contains(h.target)||(h.stopPropagation(),$(),E(!0))},children:[Oe("label",{ref:p,className:B.field,children:[$a,ae("input",{ref:u,type:"text",className:B.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:o,"aria-label":o,"aria-activedescendant":S,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:l?0:-1,onChange:h=>d(h.target.value),onFocus:()=>E(!0),onBlur:()=>{M.current||(A.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),v();return;case"Escape":h.preventDefault(),h.stopPropagation(),A.current=!0,z();return;case"Backspace":if(h.currentTarget.value!=="")return;h.preventDefault(),A.current=!0,z();return}}})]}),ae("div",{className:B.results,"data-aia-location-results":"","aria-live":"polite",children:G})]})}import{isSmartSuggestion as ei,isTraditionalAutocompleteSuggestion as ti}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Za}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,
1792
1792
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1793
1793
  The border is kept as a 1px transparent line so the box stays the same size
1794
1794
  as it was when the outline was dashed. */
@@ -1968,7 +1968,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
1968
1968
  opacity: 0;
1969
1969
  }
1970
1970
  }
1971
- `,document.head.appendChild(e)}var we={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 Za,jsx as xt,jsxs as Xa}from"react/jsx-runtime";var yt={selected:1,first:.7,next:.4,last:.2};function Yt({label:e,state:i,rounded:t,loading:a,smartSuggestion:o,completionHeader:r,onClick:n}){let s=[we.pill,t?we.rounded:"",a?we.skeleton:""].filter(Boolean).join(" ");return xt("button",{type:"button","data-aia-pill":"","data-aia-loading":a?"":void 0,"data-aia-smart-suggestion":o?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:s,style:{opacity:yt[i]},onMouseDown:g=>g.preventDefault(),onClick:a?void 0:n,disabled:a,children:o?Xa(Za,{children:[xt("span",{className:`${we.smartText} magicx-aia-smart-suggestion-text`,children:e}),xt("span",{className:`${we.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:$a}})]}):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 {
1971
+ `,document.head.appendChild(e)}var ge={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 Xa,jsx as yt,jsxs as Ja}from"react/jsx-runtime";var kt={selected:1,first:.7,next:.4,last:.2};function jt({label:e,state:o,rounded:a,loading:i,smartSuggestion:n,completionHeader:l,onClick:r}){let d=[ge.pill,a?ge.rounded:"",i?ge.skeleton:""].filter(Boolean).join(" ");return yt("button",{type:"button","data-aia-pill":"","data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":n?l?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:d,style:{opacity:kt[o]},onMouseDown:m=>m.preventDefault(),onClick:i?void 0:r,disabled:i,children:n?Ja(Xa,{children:[yt("span",{className:`${ge.smartText} magicx-aia-smart-suggestion-text`,children:e}),yt("span",{className:`${ge.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Za}})]}):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 {
1972
1972
  position: relative;
1973
1973
  z-index: 1;
1974
1974
  pointer-events: auto;
@@ -1978,7 +1978,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
1978
1978
  align-items: center;
1979
1979
  vertical-align: middle;
1980
1980
  }
1981
- `,document.head.appendChild(e)}var kt={list:"aia-list-qvLqO"};import{jsx as dt}from"react/jsx-runtime";var ti=[125,69];function jt(e){return e===0?"first":e===1?"next":"last"}function ct({pills:e,activePillIndex:i,onSelectPill:t,activeSelected:a,rounded:o,loading:r}){return r&&e.length===0?dt("span",{className:kt.list,"data-aia-pill-list-loading":"",children:ti.map((n,s)=>dt("span",{"data-aia-pill-skeleton":"",className:`${we.pill} ${o?we.rounded:""} ${we.skeleton}`,style:{width:n,opacity:yt[jt(s)]}},`skel-${n}`))}):dt("span",{className:kt.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((n,s)=>{let g=!!a&&s===i;return dt(Yt,{label:n.text,state:g?"selected":jt(s),selected:g,rounded:o,loading:r,smartSuggestion:Ja(n),completionHeader:ei(n),onClick:()=>t(s)},`${n.parameter}-${n.text}`)})})}import{attachProductRowWheel as ai,productImageSources as ii,productImageSrc as oi,productInitial as ni,productPhotoFill as ri,uiStringsFor as si}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ct,useRef as pt,useState as ht}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
1981
+ `,document.head.appendChild(e)}var Ct={list:"aia-list-qvLqO"};import{jsx as ct}from"react/jsx-runtime";var ai=[125,69];function $t(e){return e===0?"first":e===1?"next":"last"}function pt({pills:e,activePillIndex:o,onSelectPill:a,activeSelected:i,rounded:n,loading:l}){return l&&e.length===0?ct("span",{className:Ct.list,"data-aia-pill-list-loading":"",children:ai.map((r,d)=>ct("span",{"data-aia-pill-skeleton":"",className:`${ge.pill} ${n?ge.rounded:""} ${ge.skeleton}`,style:{width:r,opacity:kt[$t(d)]}},`skel-${r}`))}):ct("span",{className:Ct.list,"data-aia-pill-list-loading":l?"":void 0,children:e.map((r,d)=>{let m=!!i&&d===o;return ct(jt,{label:r.text,state:m?"selected":$t(d),selected:m,rounded:n,loading:l,smartSuggestion:ei(r),completionHeader:ti(r),onClick:()=>a(d)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as ii,productImageSources as oi,productImageSrc as ni,productInitial as ri,productPhotoFill as si,uiStringsFor as li}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
1982
1982
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1983
1983
  theming one package sees the same result in the other.
1984
1984
 
@@ -2434,7 +2434,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
2434
2434
  .aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT[data-aia-product-has-cart] {
2435
2435
  padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
2436
2436
  }
2437
- `,document.head.appendChild(e)}var K={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 Ue}from"react/jsx-runtime";function $t({products:e,listboxId:i,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r=!0,layout:n="row",imageFallback:s="image",strings:g=si()}){let v=e.length>0,x=pt(null);if(Ct(()=>{let d=x.current;if(!(!v||!d))return ai(d)},[v]),!v)return null;let u=`${i}-products-label`;return Ue("section",{className:K.section,"data-aia-products":"","data-aia-products-layout":n,role:"group","aria-labelledby":u,children:[j("div",{className:K.label,id:u,"data-aia-products-label":"",children:g.products}),j("div",{ref:x,className:K.row,"data-aia-products-row":"",children:e.map((d,c)=>j(li,{product:d,id:`${i}-product-${c}`,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:s,soldOut:g.soldOut,addToCart:g.addToCart},d.id))})]})}function li({product:e,id:i,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:n,soldOut:s,addToCart:g}){let v=!!a&&e.available!==!1,[x,u]=ht(null),d=w=>{w.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},c=w=>{w.metaKey||w.ctrlKey||w.shiftKey||w.altKey||w.button!==0||(w.preventDefault(),t(e))};return Ue("a",{id:i,className:K.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":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:r?0:-1,onClick:c,onKeyDown:w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:d,children:[j(pi,{sources:ii(e.imageUrl),title:e.title,fallback:n,onPhotoFill:u},oi(e.imageUrl)??""),Ue("span",{className:K.body,children:[e.vendor?j("span",{className:K.vendor,children:e.vendor}):null,j("span",{className:K.title,children:e.title}),e.price?Ue("span",{className:K.price,children:[e.price,e.compareAtPrice?j("s",{className:K.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?j("span",{className:K.badge,children:s}):null]}),v&&a?j(ci,{product:e,label:`${g}: ${e.title}`,focusable:r,onAddToCart:a,onFocus:()=>o?.(!0),onBlur:d},di(e)):null]})}function di(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(i=>i??"").join("\0")}function ci({product:e,label:i,focusable:t,onAddToCart:a,onFocus:o,onBlur:r}){let[n,s]=ht(null),g=pt(null),v=pt(e);v.current=e;let x=pt(!0);Ct(()=>(x.current=!0,()=>{x.current=!1}),[]);let u=c=>{g.current=c,x.current&&s(c)},d=c=>{if(c.preventDefault(),c.stopPropagation(),g.current==="adding")return;u("adding");let w;try{w=Promise.resolve(a(v.current))}catch(L){w=Promise.reject(L)}w.then(()=>u("added"),()=>u(null))};return j("span",{className:K.cart,"data-aia-product-cart":"","data-aia-cart-state":n??void 0,"aria-busy":n==="adding"?!0:void 0,role:"button","aria-label":i,tabIndex:t?0:-1,onClick:d,onKeyDown:c=>{c.key!=="Enter"&&c.key!==" "||d(c)},onFocus:c=>{c.stopPropagation(),o()},onBlur:c=>{c.stopPropagation(),r(c)},children:Ue("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[j("path",{className:K.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:K.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),j("path",{className:K.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),j("path",{className:K.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),j("circle",{className:K.cartGlyph,cx:"9",cy:"20",r:"1.3"}),j("circle",{className:K.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function pi({sources:e,title:i,fallback:t,onPhotoFill:a}){let[o,r]=ht(0),n=e[o],s=!!n,[g,v]=ht(null),x=!s&&t==="initial";return Ct(()=>()=>a(null),[a]),Ue("span",{className:K.media,"aria-hidden":"true","data-aia-product-placeholder":!s&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":s&&g===n?"":void 0,children:[s?j("img",{className:K.image,src:n,alt:"",loading:"lazy",decoding:"async",onLoad:u=>{v(n),a(ri(u.currentTarget.naturalWidth,u.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&a(null),r(u=>u+1)}}):null,x?ni(i):null]})}import{isOptionsGridMobileViewport as Pi,measureOptionsGrid as Ii,needsOptionsGridMeasurement as Ei,OPTIONS_GRID_MOBILE_QUERY as Ai,optionEnterDelayMs as Li,optionsShowLeadingVisuals as Ri,planOptionsGrid as ea,sameOptionRows as Oi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Di,useLayoutEffect as Mi,useRef as ta,useState as ia}from"react";import{optionsGridTemplateColumns as hi}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as ui,useRef as mi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2437
+ `,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 Q,jsxs as Qe}from"react/jsx-runtime";function Zt({products:e,listboxId:o,onSelect:a,onAddToCart:i,onFocusChange:n,focusable:l=!0,layout:r="row",imageFallback:d="image",strings:m=li()}){let v=e.length>0,x=ht(null);if(St(()=>{let c=x.current;if(!(!v||!c))return ii(c)},[v]),!v)return null;let u=`${o}-products-label`;return Qe("section",{className:W.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":u,children:[Q("div",{className:W.label,id:u,"data-aia-products-label":"",children:m.products}),Q("div",{ref:x,className:W.row,"data-aia-products-row":"",children:e.map((c,p)=>Q(di,{product:c,id:`${o}-product-${p}`,onSelect:a,onAddToCart:i,onFocusChange:n,focusable:l,imageFallback:d,soldOut:m.soldOut,addToCart:m.addToCart},c.id))})]})}function di({product:e,id:o,onSelect:a,onAddToCart:i,onFocusChange:n,focusable:l,imageFallback:r,soldOut:d,addToCart:m}){let v=!!i&&e.available!==!1,[x,u]=ut(null),c=w=>{w.relatedTarget?.closest("[data-aia-dropdown]")||n?.(!1)},p=w=>{w.metaKey||w.ctrlKey||w.shiftKey||w.altKey||w.button!==0||(w.preventDefault(),a(e))};return Qe("a",{id:o,className:W.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":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:l?0:-1,onClick:p,onKeyDown:w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),a(e))},onFocus:()=>n?.(!0),onBlur:c,children:[Q(hi,{sources:oi(e.imageUrl),title:e.title,fallback:r,onPhotoFill:u},ni(e.imageUrl)??""),Qe("span",{className:W.body,children:[e.vendor?Q("span",{className:W.vendor,children:e.vendor}):null,Q("span",{className:W.title,children:e.title}),e.price?Qe("span",{className:W.price,children:[e.price,e.compareAtPrice?Q("s",{className:W.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?Q("span",{className:W.badge,children:d}):null]}),v&&i?Q(pi,{product:e,label:`${m}: ${e.title}`,focusable:l,onAddToCart:i,onFocus:()=>n?.(!0),onBlur:c},ci(e)):null]})}function ci(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(o=>o??"").join("\0")}function pi({product:e,label:o,focusable:a,onAddToCart:i,onFocus:n,onBlur:l}){let[r,d]=ut(null),m=ht(null),v=ht(e);v.current=e;let x=ht(!0);St(()=>(x.current=!0,()=>{x.current=!1}),[]);let u=p=>{m.current=p,x.current&&d(p)},c=p=>{if(p.preventDefault(),p.stopPropagation(),m.current==="adding")return;u("adding");let w;try{w=Promise.resolve(i(v.current))}catch(I){w=Promise.reject(I)}w.then(()=>u("added"),()=>u(null))};return Q("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(),l(p)},children:Qe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[Q("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"}),Q("path",{className:W.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),Q("path",{className:W.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),Q("path",{className:W.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),Q("circle",{className:W.cartGlyph,cx:"9",cy:"20",r:"1.3"}),Q("circle",{className:W.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function hi({sources:e,title:o,fallback:a,onPhotoFill:i}){let[n,l]=ut(0),r=e[n],d=!!r,[m,v]=ut(null),x=!d&&a==="initial";return St(()=>()=>i(null),[i]),Qe("span",{className:W.media,"aria-hidden":"true","data-aia-product-placeholder":!d&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":d&&m===r?"":void 0,children:[d?Q("img",{className:W.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:u=>{v(r),i(si(u.currentTarget.naturalWidth,u.currentTarget.naturalHeight))},onError:()=>{n+1>=e.length&&i(null),l(u=>u+1)}}):null,x?ri(o):null]})}import{isOptionsGridMobileViewport as Ii,measureOptionsGrid as Ei,needsOptionsGridMeasurement as Ai,OPTIONS_GRID_MOBILE_QUERY as Li,optionEnterDelayMs as Ri,optionsShowLeadingVisuals as Oi,planOptionsGrid as ta,sameOptionRows as Di}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Mi,useLayoutEffect as zi,useRef as aa,useState as oa}from"react";import{optionsGridTemplateColumns as ui}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as mi,useRef as gi}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 {
2438
2438
  display: grid;
2439
2439
  grid-template-columns: repeat(
2440
2440
  auto-fit,
@@ -2470,7 +2470,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
2470
2470
  .aia-grid[data-scroll]::-webkit-scrollbar {
2471
2471
  display: none;
2472
2472
  }
2473
- `,document.head.appendChild(e)}import{jsx as gi}from"react/jsx-runtime";function Zt({min:e="16rem",max:i,gap:t,scroll:a=!1,maxHeight:o,scrollResetKey:r,cols:n,template:s,innerRef:g,className:v,children:x,...u}){let d=mi(null);ui(()=>{if(r===void 0)return;let w=d.current;w&&(w.scrollTop=0)},[r]);let c={"--aia-grid-min":e};return i&&(c["--aia-grid-max"]=i),t&&(c["--aia-grid-gap"]=t),o&&(c["--aia-grid-max-height"]=o),n&&(c.gridTemplateColumns=hi(n)),s&&(c.gridTemplateColumns=s),gi("div",{ref:w=>{d.current=w,g?.(w)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":a||void 0,style:c,...u,children:x})}import{formatOptionCount as fi,highlightParts as bi,isMultiSelectToggleTap as wi,OPTION_ENTER_DELAY_VAR as vi,optionImageSources as xi,optionLabel as Xt,sanitizeOptionIconSvg as yi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ki,useMemo as Ci,useRef as Si,useState as ut}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 {
2473
+ `,document.head.appendChild(e)}import{jsx as fi}from"react/jsx-runtime";function Xt({min:e="16rem",max:o,gap:a,scroll:i=!1,maxHeight:n,scrollResetKey:l,cols:r,template:d,innerRef:m,className:v,children:x,...u}){let c=gi(null);mi(()=>{if(l===void 0)return;let w=c.current;w&&(w.scrollTop=0)},[l]);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=ui(r)),d&&(p.gridTemplateColumns=d),fi("div",{ref:w=>{c.current=w,m?.(w)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:p,...u,children:x})}import{formatOptionCount as bi,highlightParts as wi,isMultiSelectToggleTap as vi,OPTION_ENTER_DELAY_VAR as xi,optionImageSources as yi,optionLabel as Jt,sanitizeOptionIconSvg as ki}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ci,useMemo as Si,useRef as Ti,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 {
2474
2474
  position: relative;
2475
2475
  /* Clip, not visible: the entrance rise below runs on the inner content,
2476
2476
  and a transformed box extends its scroll container's scrollable area.
@@ -2996,7 +2996,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
2996
2996
  .aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
2997
2997
  background: var(--aia-option-bg, transparent);
2998
2998
  }
2999
- `,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 Ti,jsx as Te,jsxs as St}from"react/jsx-runtime";function Jt({option:e,isHighlighted:i,checked:t,onSelect:a,onHighlight:o,onUnhighlight:r,id:n,loading:s,showIcon:g=!0,showImage:v=!0,showCount:x=!0,scrollHint:u,enterDelayMs:d=0}){let[c]=ut(d),[w,L]=ut(!1),N=v?xi(e.image_url):[],D=N[0]??null,[H,q]=ut([]),R=N.find(P=>!H.includes(P))??null,[I,C]=ut(null),V=Ci(()=>!D&&g&&e.icon_svg?yi(e.icon_svg):null,[D,g,e.icon_svg]),Q=x?fi(e.item_count):null,B=Si(void 0);ki(()=>()=>clearTimeout(B.current),[]);let F=P=>{if(s||!e.is_tappable||w&&t===void 0)return;L(!0);let _=P?.currentTarget;t!==void 0&&_!==void 0&&P!==void 0&&!wi(_,_.querySelector("[data-aia-checkbox]"),P)?a(e,{commit:!0}):a(e),clearTimeout(B.current),B.current=setTimeout(()=>L(!1),170)},ae=[$.item,i&&!s?$.highlighted:"",e.liveMatch&&!s?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,w?$.pressed:"",u?$.scrollHint:""].filter(Boolean).join(" ");return Te("div",{id:n,role:"option","data-aia-option":"","data-aia-loading":s?"":void 0,"data-aia-icon":V&&e.icon?e.icon:void 0,"data-aia-image":D?"":void 0,"data-aia-item-count":Q!==null?e.item_count:void 0,"aria-selected":t??i,className:ae,style:{[vi]:`${c}ms`},tabIndex:s||!e.is_tappable?-1:0,onClick:F,onKeyDown:P=>{!s&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),F())},onMouseEnter:!s&&e.is_tappable?o:void 0,onMouseLeave:r,children:St("span",{className:$.content,children:[t!==void 0&&e.is_tappable&&Te("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),D&&Te("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":R!==null&&I===R?"":void 0,children:Te("img",{src:R??D,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:R===null,onLoad:()=>C(R),onError:()=>{R!==null&&q(P=>[...P,R])}})}),V&&Te("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:V}}),St("span",{className:$.text,children:[e.matchedText?bi(Xt(e),e.matchedText).map((P,_)=>P.bold?Te("strong",{className:`${$.match} magicx-aia-option-match`,children:P.text},_):P.text):Xt(e),e.parameterLabel&&St(Ti,{children:[" ",Te("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&Te("span",{className:$.tag,children:e.tag}),Q!==null&&Te("span",{className:`${$.count} magicx-aia-option-count`,children:Q})]})})}import{jsx as aa}from"react/jsx-runtime";function zi(){let[e,i]=ia(Pi);return Di(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(Ai),a=()=>i(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function oa({options:e,activeIndex:i,picked:t,onSelect:a,onHighlight:o,onUnhighlight:r,listboxId:n,loading:s,groupKey:g="",optionsPosition:v="below",showIcons:x=!0,showImages:u=!0,showCounts:d=!0}){let c=zi(),w=ta(null),[L,N]=ia(null),D=ta(null);Mi(()=>{if(s&&Oi(D.current,e))return;D.current=s?null:e;let R=w.current,C=R&&!s&&Ei(e.length,c)?Ii(R):null;N(C?ea(e.length,c,C.rowWidths,C.gridWidth):null)},[e,c,s]);let H=L??ea(e.length,c,null,null),q=Ri(e,x,u);return aa(Zt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:g,template:H.template,maxHeight:H.maxHeight,innerRef:R=>{w.current=R},"data-aia-group":g,children:e.map((R,I)=>aa(Jt,{option:R,isHighlighted:I===i,checked:t?t.includes(R.text):void 0,onSelect:a,onHighlight:()=>o(I),onUnhighlight:r?()=>r(I):void 0,id:`${n}-option-${I}`,loading:s,showIcon:x&&q,showImage:u&&q,showCount:d,scrollHint:!s&&H.scrollHintIndices.includes(I),enterDelayMs:s?0:Li(I,H.cols,e.length,v)},`${g}\0${R.text}`))})}import{formatTime as Ni,TIME_WHEEL_COLUMNS as Fi,TIME_WHEEL_ROW_HEIGHT as Hi,timeWheelIndex as na,timeWheelIndexFromScroll as Bi,timeWheelRows as Wi,withTimeWheelIndex as ra}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as Gi,useEffect as Ki,useLayoutEffect as qi,useRef as mt}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) ---
2999
+ `,document.head.appendChild(e)}var Y={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 Pi,jsx as Se,jsxs as Tt}from"react/jsx-runtime";function ea({option:e,isHighlighted:o,checked:a,onSelect:i,onHighlight:n,onUnhighlight:l,id:r,loading:d,showIcon:m=!0,showImage:v=!0,showCount:x=!0,scrollHint:u,enterDelayMs:c=0}){let[p]=mt(c),[w,I]=mt(!1),M=v?yi(e.image_url):[],A=M[0]??null,[F,K]=mt([]),L=M.find(S=>!F.includes(S))??null,[E,y]=mt(null),$=Si(()=>!A&&m&&e.icon_svg?ki(e.icon_svg):null,[A,m,e.icon_svg]),q=x?bi(e.item_count):null,Z=Ti(void 0);Ci(()=>()=>clearTimeout(Z.current),[]);let z=S=>{if(d||!e.is_tappable||w&&a===void 0)return;I(!0);let G=S?.currentTarget;a!==void 0&&G!==void 0&&S!==void 0&&!vi(G,G.querySelector("[data-aia-checkbox]"),S)?i(e,{commit:!0}):i(e),clearTimeout(Z.current),Z.current=setTimeout(()=>I(!1),170)},_=[Y.item,o&&!d?Y.highlighted:"",e.liveMatch&&!d?Y.liveMatch:"",e.is_tappable?Y.tappable:Y.nonTappable,w?Y.pressed:"",u?Y.scrollHint:""].filter(Boolean).join(" ");return Se("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":$&&e.icon?e.icon:void 0,"data-aia-image":A?"":void 0,"data-aia-item-count":q!==null?e.item_count:void 0,"aria-selected":a??o,className:_,style:{[xi]:`${p}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:z,onKeyDown:S=>{!d&&e.is_tappable&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),z())},onMouseEnter:!d&&e.is_tappable?n:void 0,onMouseLeave:l,children:Tt("span",{className:Y.content,children:[a!==void 0&&e.is_tappable&&Se("span",{className:Y.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),A&&Se("span",{className:`${Y.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":L!==null&&E===L?"":void 0,children:Se("img",{src:L??A,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:L===null,onLoad:()=>y(L),onError:()=>{L!==null&&K(S=>[...S,L])}})}),$&&Se("span",{className:`${Y.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:$}}),Tt("span",{className:Y.text,children:[e.matchedText?wi(Jt(e),e.matchedText).map((S,G)=>S.bold?Se("strong",{className:`${Y.match} magicx-aia-option-match`,children:S.text},G):S.text):Jt(e),e.parameterLabel&&Tt(Pi,{children:[" ",Se("span",{className:`${Y.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&Se("span",{className:Y.tag,children:e.tag}),q!==null&&Se("span",{className:`${Y.count} magicx-aia-option-count`,children:q})]})})}import{jsx as ia}from"react/jsx-runtime";function Ni(){let[e,o]=oa(Ii);return Mi(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(Li),i=()=>o(a.matches);return i(),a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[]),e}function na({options:e,activeIndex:o,picked:a,onSelect:i,onHighlight:n,onUnhighlight:l,listboxId:r,loading:d,groupKey:m="",optionsPosition:v="below",showIcons:x=!0,showImages:u=!0,showCounts:c=!0}){let p=Ni(),w=aa(null),[I,M]=oa(null),A=aa(null);zi(()=>{if(d&&Di(A.current,e))return;A.current=d?null:e;let L=w.current,y=L&&!d&&Ai(e.length,p)?Ei(L):null;M(y?ta(e.length,p,y.rowWidths,y.gridWidth):null)},[e,p,d]);let F=I??ta(e.length,p,null,null),K=Oi(e,x,u);return ia(Xt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:m,template:F.template,maxHeight:F.maxHeight,innerRef:L=>{w.current=L},"data-aia-group":m,children:e.map((L,E)=>ia(ea,{option:L,isHighlighted:E===o,checked:a?a.includes(L.text):void 0,onSelect:i,onHighlight:()=>n(E),onUnhighlight:l?()=>l(E):void 0,id:`${r}-option-${E}`,loading:d,showIcon:x&&K,showImage:u&&K,showCount:c,scrollHint:!d&&F.scrollHintIndices.includes(E),enterDelayMs:d?0:Ri(E,F.cols,e.length,v)},`${m}\0${L.text}`))})}import{formatTime as Fi,TIME_WHEEL_COLUMNS as Hi,TIME_WHEEL_ROW_HEIGHT as Bi,timeWheelIndex as ra,timeWheelIndexFromScroll as Wi,timeWheelRows as Gi,withTimeWheelIndex as sa}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as Ki,useEffect as qi,useLayoutEffect as _i,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) ---
3000
3000
 
3001
3001
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3002
3002
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3118,7 +3118,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
3118
3118
  .aia-done-llNY5:hover {
3119
3119
  background: var(--aia-time-done-bg-hover, var(--aia-confirm-bg-hover, #404040));
3120
3120
  }
3121
- `,document.head.appendChild(e)}var le={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 Be,jsxs as Tt}from"react/jsx-runtime";var _i=120;function sa({view:e,label:i,doneLabel:t,interactive:a=!0,onTimeChange:o,onTimeCommit:r}){return Tt("div",{className:le.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":i,onMouseDown:n=>n.preventDefault(),children:[Be("span",{className:le.value,"data-aia-time-value":"","aria-live":"polite",children:Ni(e.minutes)}),Tt("div",{className:le.columns,"aria-hidden":"true",children:[Be("div",{className:le.band}),Fi.map(n=>Tt(Gi,{children:[n==="minute"&&Be("span",{className:le.separator,children:":"}),Be(Ui,{column:n,minutes:e.minutes,interactive:a,onTimeChange:o})]},n))]}),Be("button",{type:"button",tabIndex:-1,className:le.done,"data-aia-time-done":"",onClick:()=>{a&&r()},children:t})]})}function Ui({column:e,minutes:i,interactive:t,onTimeChange:a}){let o=mt(null),r=mt(null),n=mt(null),s=mt({minutes:i,interactive:t,onTimeChange:a});s.current={minutes:i,interactive:t,onTimeChange:a};let g=na(e,i);qi(()=>{let u=o.current;if(!u||n.current)return;let d=g*Hi;Math.abs(u.scrollTop-d)<1||(r.current=d,u.scrollTop=d)},[g]),Ki(()=>()=>{n.current&&clearTimeout(n.current)},[]);let v=()=>{n.current=null;let u=o.current,d=s.current;if(!u||!d.interactive)return;let c=Bi(e,u.scrollTop);c!==na(e,d.minutes)&&d.onTimeChange(ra(e,d.minutes,c))},x=()=>{let u=o.current;if(u){if(r.current!=null&&Math.abs(u.scrollTop-r.current)<1){r.current=null;return}r.current=null,n.current&&clearTimeout(n.current),n.current=setTimeout(v,_i)}};return Be("div",{ref:o,className:le.column,"data-aia-time-column":e,onScroll:x,children:Wi(e).map((u,d)=>Be("div",{className:d===g?`${le.row} ${le.selected}`:le.row,"data-aia-time-row":"","data-aia-index":d,onClick:()=>{s.current.interactive&&a(ra(e,s.current.minutes,d))},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 {
3121
+ `,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 Ge,jsxs as Pt}from"react/jsx-runtime";var Ui=120;function la({view:e,label:o,doneLabel:a,interactive:i=!0,onTimeChange:n,onTimeCommit:l}){return Pt("div",{className:de.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":o,onMouseDown:r=>r.preventDefault(),children:[Ge("span",{className:de.value,"data-aia-time-value":"","aria-live":"polite",children:Fi(e.minutes)}),Pt("div",{className:de.columns,"aria-hidden":"true",children:[Ge("div",{className:de.band}),Hi.map(r=>Pt(Ki,{children:[r==="minute"&&Ge("span",{className:de.separator,children:":"}),Ge(Vi,{column:r,minutes:e.minutes,interactive:i,onTimeChange:n})]},r))]}),Ge("button",{type:"button",tabIndex:-1,className:de.done,"data-aia-time-done":"",onClick:()=>{i&&l()},children:a})]})}function Vi({column:e,minutes:o,interactive:a,onTimeChange:i}){let n=gt(null),l=gt(null),r=gt(null),d=gt({minutes:o,interactive:a,onTimeChange:i});d.current={minutes:o,interactive:a,onTimeChange:i};let m=ra(e,o);_i(()=>{let u=n.current;if(!u||r.current)return;let c=m*Bi;Math.abs(u.scrollTop-c)<1||(l.current=c,u.scrollTop=c)},[m]),qi(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let u=n.current,c=d.current;if(!u||!c.interactive)return;let p=Wi(e,u.scrollTop);p!==ra(e,c.minutes)&&c.onTimeChange(sa(e,c.minutes,p))},x=()=>{let u=n.current;if(u){if(l.current!=null&&Math.abs(u.scrollTop-l.current)<1){l.current=null;return}l.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,Ui)}};return Ge("div",{ref:n,className:de.column,"data-aia-time-column":e,onScroll:x,children:Gi(e).map((u,c)=>Ge("div",{className:c===m?`${de.row} ${de.selected}`:de.row,"data-aia-time-row":"","data-aia-index":c,onClick:()=>{d.current.interactive&&i(sa(e,d.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 {
3122
3122
  display: flex;
3123
3123
  flex-direction: column;
3124
3124
  gap: var(--aia-stack-space, 0.5rem);
@@ -3133,7 +3133,7 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
3133
3133
  align-items: end;
3134
3134
  }
3135
3135
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3136
- `,document.head.appendChild(e)}import{jsx as Vi}from"react/jsx-runtime";function la({space:e,align:i="stretch",className:t,children:a,...o}){let r=e?{"--aia-stack-space":e}:void 0;return Vi("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":i,style:r,...o,children:a})}import{jsx as X,jsxs as Pt}from"react/jsx-runtime";var ao=[159,119,164],io=()=>{},da=()=>{},oo=e=>{},no=()=>{},ro=e=>{},so=e=>{},lo=e=>{},co=e=>{};function po(e){let i=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=to(i);if(Qe(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>a(o.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ho(e,i){let t=Ve(null);Qe(()=>{let a=e.current,o=i.current;if(!a||!o)return;let r=a.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:Qi({dropdown:a,grid:r,button:o})};return}t.current?.controller.update()}),Qe(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function uo(e,i){let t=Ve(i);t.current=i;let a=Ve(null);Qe(()=>{let o=e.current;if(o){if(!a.current){a.current=Yi({dropdown:o,isOpen:()=>t.current});return}a.current.update()}}),Qe(()=>()=>{a.current?.destroy(),a.current=null},[])}function It({suggestions:e,activeIndex:i,onSelect:t,onHighlight:a,onUnhighlight:o,isOpen:r,id:n,className:s,pills:g,onPillClick:v,showPills:x=!0,onSkip:u,showSkipButton:d=!0,showOptionIcons:c=!0,showOptionImages:w=!0,showOptionCounts:L=!0,skipDisabled:N=!1,activeSelected:D=!1,isLoading:H=!1,skeletonExiting:q=!1,isInputEmpty:R=!1,language:I,products:C,onProductSelect:V,onProductAddToCart:Q,onProductFocusChange:B,productsLayout:F="row",productImageFallback:ae="image",formatType:P="options",dateView:_=null,selectedDateIso:p=null,selectedDateRange:E=null,dateRangeStart:ve=null,onPreviousMonth:De,onNextMonth:Pe,timeView:f=null,multiSelectView:Me=null,onMultiSelectCommit:Ie,onTimeChange:Ee,onTimeCommit:Ae,locationView:b=null,onLocationQuery:k,onLocationMove:S,onLocationCommit:A,onLocationFocusChange:O,isFocused:U=!1,optionsPosition:ie="below",mode:oe}){let ce=po(oe),pe=ce!==void 0,ne=Ve(null),ze=Ve(null);ho(ne,ze),Qe(()=>{if(ne.current)return ji(ne.current)},[]);let Xe=e[0]?.options??[],xe=!!(g&&g.length>0&&v),Ne=!!(C&&C.length>0),We=P==="time"&&f!=null,ye=P==="location"&&b!=null,J=r&&(Xe.length>0||x&&xe||H||Ne||We||ye);uo(ne,J);let he={suggestions:e,activeIndex:i,pills:g,showPills:x,showSkipButton:d,showOptionIcons:c,showOptionImages:w,showOptionCounts:L,skipDisabled:N,activeSelected:D,isLoading:H,skeletonExiting:q,isInputEmpty:R,products:C,formatType:P,dateView:_,selectedDateIso:p,selectedDateRange:E,dateRangeStart:ve,timeView:f,multiSelectView:Me,locationView:b},y=Ve(he);J&&(y.current=he);let h=J?he:y.current,Y=eo(I),ue=h.suggestions[0],m=ue?.options??[],Ge=h.activeIndex>=0&&!!m[h.activeIndex]?.is_tappable,ke=Ji(h.pills??[],Y.keepTyping),me=!!(ke.length>0&&v),Je=h.showPills&&me,et=h.showPills&&!me&&h.isLoading,Ce=Je||et,Ke=me&&Zi(ke)&&h.showSkipButton&&!h.isInputEmpty&&!!u,re=ke[0]?.text,ge=Xi(h.formatType)&&h.dateView!=null,Le=m.length>0&&!ge,Fe=m.length>0&&ge&&!h.isLoading,qe=h.formatType==="time"&&h.timeView!=null&&!h.isLoading,Re=h.formatType==="location"&&h.locationView!=null&&!h.isLoading,_e=h.isLoading&&!Le&&!Fe&&!qe&&!Re,l=h.products??[];return Pt("div",{ref:ne,id:n,role:"listbox","aria-multiselectable":!!h.multiSelectView,"data-aia-dropdown":"","data-options-position":ie,"data-mode":ce,"data-aia-loading":h.isLoading?"":void 0,"data-aia-skeleton-exiting":h.skeletonExiting?"":void 0,"data-aia-has-products":l.length>0?"":void 0,className:`${pe?"magicx-aia ":""}${fe.dropdown} ${J?fe.visible:""} ${s??""}`,onMouseDown:T=>T.preventDefault(),children:[Pt(la,{space:"8px",children:[(Ce||Ke)&&Pt(ot,{noWrap:!0,className:fe.pillBar,"data-aia-pillbar":"",children:[Ce&&X("span",{className:fe.pillScroll,"data-aia-pill-scroll":"",children:X(ct,{pills:ke,activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:h.isLoading})}),Ke&&X("button",{type:"button",tabIndex:-1,className:fe.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":re?`${Y.skipLabel} ${re}`:Y.skipLabel,onClick:u,children:Y.skip})]}),Le&&X(oa,{options:m,activeIndex:h.activeIndex,onSelect:t,onHighlight:a,onUnhighlight:o,listboxId:n,loading:h.isLoading,groupKey:ue?`${ue.parameter} ${ue.text}`:"",optionsPosition:ie,showIcons:h.showOptionIcons,showImages:h.showOptionImages,showCounts:h.showOptionCounts,picked:h.isLoading?void 0:h.multiSelectView?.picked}),h.multiSelectView&&!h.isLoading&&X("div",{onClick:T=>{T.target.closest("[data-aia-multi-done]")&&!h.skipDisabled&&Ie?.()},children:X("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:fe.multiDone,ref:T=>{T&&(T.disabled=!0,T.offsetHeight,T.disabled=h.skipDisabled)},children:Y.done})}),Fe&&h.dateView&&X(Gt,{options:m,activeIndex:h.activeIndex,listboxId:n,view:h.dateView,selection:{selectedIso:h.selectedDateIso??null,selectedRange:h.selectedDateRange??null,rangeStart:h.dateRangeStart??null,floor:$i(h.formatType,h.dateRangeStart)},onSelect:t,onHighlight:a,onUnhighlight:o,onPreviousMonth:De??da,onNextMonth:Pe??da}),qe&&h.timeView&&X(sa,{view:h.timeView,label:Y.timeLabel,doneLabel:Y.done,interactive:!h.skipDisabled,onTimeChange:Ee??oo,onTimeCommit:Ae??no}),Re&&h.locationView&&X(Qt,{view:h.locationView,searchLabel:Y.locationSearch,noResultsLabel:Y.locationNoResults,useTypedLabel:Y.locationUseTyped,widgetFocused:U&&J,visible:J,interactive:!h.skipDisabled,onQuery:k??ro,onMove:S??so,onCommit:A??lo,onFocusChange:O??co}),_e&&X("div",{className:fe.skeletonBars,"data-aia-skeleton-bars":"",children:ao.map(T=>X("span",{className:fe.skeletonBar,style:{width:T}},`bar-${T}`))}),X($t,{products:l,listboxId:n,onSelect:V??io,onAddToCart:Q,onFocusChange:B,focusable:J,layout:F,imageFallback:ae,strings:Y}),X(qt,{isOptionHighlighted:Ge,isInputEmpty:h.isInputEmpty,strings:Y})]}),X("button",{ref:ze,type:"button",tabIndex:-1,className:fe.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Y.scrollArrow,"aria-hidden":"true",children:X("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:X("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Eo,ModeController as Ao,setCursorOffset as Lo,uiStringsFor as Ro,watchEditorHeight as Oo}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as mo}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 {
3136
+ `,document.head.appendChild(e)}import{jsx as Qi}from"react/jsx-runtime";function da({space:e,align:o="stretch",className:a,children:i,...n}){let l=e?{"--aia-stack-space":e}:void 0;return Qi("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":o,style:l,...n,children:i})}import{jsx as X,jsxs as It}from"react/jsx-runtime";var io=[159,119,164],oo=()=>{},ca=()=>{},no=e=>{},ro=()=>{},so=e=>{},lo=e=>{},co=e=>{},po=e=>{};function ho(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,i]=ao(o);if(je(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>i(n.matches);return n.addEventListener("change",l),()=>n.removeEventListener("change",l)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function uo(e,o){let a=Ye(null);je(()=>{let i=e.current,n=o.current;if(!i||!n)return;let l=i.querySelector(".aia-grid[data-scroll]");if(a.current&&a.current.grid!==l&&(a.current.controller.destroy(),a.current=null),l&&!a.current){a.current={grid:l,controller:Yi({dropdown:i,grid:l,button:n})};return}a.current?.controller.update()}),je(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function mo(e,o){let a=Ye(o);a.current=o;let i=Ye(null);je(()=>{let n=e.current;if(n){if(!i.current){i.current=ji({dropdown:n,isOpen:()=>a.current});return}i.current.update()}}),je(()=>()=>{i.current?.destroy(),i.current=null},[])}function Et({suggestions:e,activeIndex:o,onSelect:a,onHighlight:i,onUnhighlight:n,isOpen:l,id:r,className:d,pills:m,onPillClick:v,showPills:x=!0,onSkip:u,showSkipButton:c=!0,showOptionIcons:p=!0,showOptionImages:w=!0,showOptionCounts:I=!0,skipDisabled:M=!1,activeSelected:A=!1,isLoading:F=!1,skeletonExiting:K=!1,isInputEmpty:L=!1,language:E,products:y,onProductSelect:$,onProductAddToCart:q,onProductFocusChange:Z,productsLayout:z="row",productImageFallback:_="image",formatType:S="options",dateView:G=null,selectedDateIso:h=null,selectedDateRange:T=null,dateRangeStart:Te=null,onPreviousMonth:fe,onNextMonth:De,timeView:be=null,multiSelectView:g=null,onMultiSelectCommit:Me,onTimeChange:Pe,onTimeCommit:Ie,locationView:f=null,onLocationQuery:k,onLocationMove:C,onLocationCommit:P,onLocationFocusChange:R,isFocused:U=!1,optionsPosition:ie="below",mode:oe}){let ne=ho(oe),ze=ne!==void 0,ee=Ye(null),we=Ye(null);uo(ee,we),je(()=>{if(ee.current)return $i(ee.current)},[]);let Ke=e[0]?.options??[],et=!!(m&&m.length>0&&v),ve=!!(y&&y.length>0),Ne=S==="time"&&be!=null,qe=S==="location"&&f!=null,J=l&&(Ke.length>0||x&&et||F||ve||Ne||qe);mo(ee,J);let pe={suggestions:e,activeIndex:o,pills:m,showPills:x,showSkipButton:c,showOptionIcons:p,showOptionImages:w,showOptionCounts:I,skipDisabled:M,activeSelected:A,isLoading:F,skeletonExiting:K,isInputEmpty:L,products:y,formatType:S,dateView:G,selectedDateIso:h,selectedDateRange:T,dateRangeStart:Te,timeView:be,multiSelectView:g,locationView:f},xe=Ye(pe);J&&(xe.current=pe);let t=J?pe:xe.current,V=to(E),Ee=t.suggestions[0],re=Ee?.options??[],b=t.activeIndex>=0&&!!re[t.activeIndex]?.is_tappable,ye=eo(t.pills??[],V.keepTyping),Ae=!!(ye.length>0&&v),Le=t.showPills&&Ae,tt=t.showPills&&!Ae&&t.isLoading,_e=Le||tt,ke=Ae&&Xi(ye)&&t.showSkipButton&&!t.isInputEmpty&&!!u,Ue=ye[0]?.text,se=Ji(t.formatType)&&t.dateView!=null,he=re.length>0&&!se,Re=re.length>0&&se&&!t.isLoading,Fe=t.formatType==="time"&&t.timeView!=null&&!t.isLoading,Ve=t.formatType==="location"&&t.locationView!=null&&!t.isLoading,He=t.isLoading&&!he&&!Re&&!Fe&&!Ve,Be=t.products??[];return It("div",{ref:ee,id:r,role:"listbox","aria-multiselectable":!!t.multiSelectView,"data-aia-dropdown":"","data-options-position":ie,"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 ":""}${ue.dropdown} ${J?ue.visible:""} ${d??""}`,onMouseDown:s=>s.preventDefault(),children:[It(da,{space:"8px",children:[(_e||ke)&&It(nt,{noWrap:!0,className:ue.pillBar,"data-aia-pillbar":"",children:[_e&&X("span",{className:ue.pillScroll,"data-aia-pill-scroll":"",children:X(pt,{pills:ye,activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:t.isLoading})}),ke&&X("button",{type:"button",tabIndex:-1,className:ue.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":Ue?`${V.skipLabel} ${Ue}`:V.skipLabel,onClick:u,children:V.skip})]}),he&&X(na,{options:re,activeIndex:t.activeIndex,onSelect:a,onHighlight:i,onUnhighlight:n,listboxId:r,loading:t.isLoading,groupKey:Ee?`${Ee.parameter} ${Ee.text}`:"",optionsPosition:ie,showIcons:t.showOptionIcons,showImages:t.showOptionImages,showCounts:t.showOptionCounts,picked:t.isLoading?void 0:t.multiSelectView?.picked}),t.multiSelectView&&!t.isLoading&&X("div",{onClick:s=>{s.target.closest("[data-aia-multi-done]")&&!t.skipDisabled&&Me?.()},children:X("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:ue.multiDone,ref:s=>{s&&(s.disabled=!0,s.offsetHeight,s.disabled=t.skipDisabled)},children:V.done})}),Re&&t.dateView&&X(Kt,{options:re,activeIndex:t.activeIndex,listboxId:r,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null,floor:Zi(t.formatType,t.dateRangeStart)},onSelect:a,onHighlight:i,onUnhighlight:n,onPreviousMonth:fe??ca,onNextMonth:De??ca}),Fe&&t.timeView&&X(la,{view:t.timeView,label:V.timeLabel,doneLabel:V.done,interactive:!t.skipDisabled,onTimeChange:Pe??no,onTimeCommit:Ie??ro}),Ve&&t.locationView&&X(Yt,{view:t.locationView,searchLabel:V.locationSearch,noResultsLabel:V.locationNoResults,useTypedLabel:V.locationUseTyped,widgetFocused:U&&J,visible:J,interactive:!t.skipDisabled,onQuery:k??so,onMove:C??lo,onCommit:P??co,onFocusChange:R??po}),He&&X("div",{className:ue.skeletonBars,"data-aia-skeleton-bars":"",children:io.map(s=>X("span",{className:ue.skeletonBar,style:{width:s}},`bar-${s}`))}),X(Zt,{products:Be,listboxId:r,onSelect:$??oo,onAddToCart:q,onFocusChange:Z,focusable:J,layout:z,imageFallback:_,strings:V}),X(_t,{isOptionHighlighted:b,isInputEmpty:t.isInputEmpty,strings:V})]}),X("button",{ref:we,type:"button",tabIndex:-1,className:ue.scrollArrow,"data-aia-scroll-arrow":"","aria-label":V.scrollArrow,"aria-hidden":"true",children:X("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:X("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Ao,ModeController as Lo,setCursorOffset as Ro,uiStringsFor as Oo,watchEditorHeight as Do}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as go}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 {
3137
3137
  flex-shrink: 0;
3138
3138
  width: 32px;
3139
3139
  height: 32px;
@@ -3204,5 +3204,5 @@ import{buildSubmitResult as Gr,cellDay as Kr,cellIso as qr,DATE_RANGE_META_END a
3204
3204
  transition: none;
3205
3205
  }
3206
3206
  }
3207
- `,document.head.appendChild(e)}var ca={submitButton:"aia-submitButton-otz7H"};import{jsx as Et}from"react/jsx-runtime";function pa({disabled:e,ready:i,onClick:t,label:a=mo().submit}){return Et("button",{type:"button","data-aia-submit":"",className:ca.submitButton,disabled:e,"data-aia-ready":i?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":a,children:Et("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":a,children:Et("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as go,dateSelectionFor as fo,identifiedParamLabel as bo,withoutTraditionalAutocomplete as wo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as fa,useEffect as Ye,useRef as Z,useState as vo}from"react";import{useRef as ha}from"react";function ua(e){let i=ha(e);i.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=ha({key:"",overrides:void 0});if(a.current.key!==t){let o={};for(let r of Object.keys(e??{})){let n=(s,g,v)=>{let x=i.current?.[r];return x?x(s,g,v):[]};o[r]=n}a.current={key:t,overrides:e?o:void 0}}return{overrides:a.current.overrides,key:t}}import{useRef as ma}from"react";function ga(e){let i=ma(e);i.current=e;let t=ma(null);t.current===null&&(t.current={fetch:(o,r)=>{let n=i.current;return n?n.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>i.current?.transform(o)??[],get limit(){return i.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var ba={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:"",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 At({onSubmit:e,onResult:i,onError:t,optionOverrides:a,maskCompletedText:o,apiConfig:r,additionalContext:n,language:s,currency:g,productId:v,visitorId:x,columns:u=2,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:w,showNonTappableOptions:L,locationSearch:N,showOptionIcons:D,showOptionImages:H,showOptionCounts:q,showSkipButton:R,showProducts:I,productImageFallback:C="image",onFocus:V,onBlur:Q,value:B,completedParams:F,onChange:ae,onParamsChange:P,products:_,mapProducts:p,onProductSelect:E,onProductAddToCart:ve,source:De,setCursor:Pe}){let f=Z(null),[Me,Ie]=vo(null),Ee=Z(e);Ee.current=e;let Ae=Z(i);Ae.current=i;let b=Z(t);b.current=t;let k=Z(ae);k.current=ae;let S=Z(P);S.current=P;let A=Z(V);A.current=V;let O=Z(Q);O.current=Q;let U=Z(Pe);U.current=Pe;let ie=Z(E);ie.current=E;let oe=Z(ve);oe.current=ve;let ce=Z(x);ce.current=x;let pe=Z(()=>{let l=ce.current;return typeof l=="function"?l():l}).current,ne=ga(_),ze=Z(p);ze.current=p;let Xe=Z((l,T)=>{let z=ze.current;return z?z(l,T):l}).current,xe=p?Xe:void 0,Ne=ua(a);Ye(()=>{if(typeof document>"u")return;let l=new go(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:n,language:s,currency:g,productId:v,visitorId:pe,optionOverrides:Ne.overrides,maskCompletedText:o,columns:u,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:w,showNonTappableOptions:L,locationSearch:N,showProducts:I,source:De,value:B,completedParams:F,onSubmit:(...z)=>Ee.current?.(...z),onResult:(...z)=>Ae.current?.(...z),onError:(...z)=>b.current?.(...z),onChange:(...z)=>k.current?.(...z),onParamsChange:(...z)=>S.current?.(...z),onFocus:()=>A.current?.(),onBlur:()=>O.current?.(),onProductSelect:z=>ie.current?.(z),onProductAddToCart:z=>oe.current?.(z),setCursor:z=>U.current?.(z),products:ne.config,mapProducts:xe});f.current=l,Ie(l.getState());let T=l.subscribe(z=>Ie(z));return()=>{T(),l.destroy(),f.current===l&&(f.current=null)}},[]),Ye(()=>{B!==void 0&&f.current?.setValue(B)},[B]),Ye(()=>{F!==void 0&&f.current?.setCompletedParams(F)},[F]);let We=JSON.stringify(r??null),ye;try{ye=JSON.stringify(n??null)}catch{ye="[unstringifiable]"}Ye(()=>{f.current?.update({apiConfig:r,additionalContext:n,language:s,currency:g,productId:v,optionOverrides:Ne.overrides,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:w,showNonTappableOptions:L,locationSearch:N,showProducts:I})},[We,ye,s,g?.code,g?.rate,g?.country,v,Ne.key,d,c,w,L,N,I]);let J=Z(!1);Ye(()=>{if(!J.current){J.current=!0;return}f.current?.update({products:ne.config})},[ne.enabled]),Ye(()=>{f.current?.update({mapProducts:xe})},[xe]);let he=Z(null);he.current===null&&(he.current={handleTextChange:l=>f.current?.handleTextChange(l),handleKeyDown:l=>{let T="nativeEvent"in l?l.nativeEvent:l;f.current?.handleKeyDown(T)},setFocused:l=>f.current?.setFocused(l),startEditingParam:l=>f.current?.startEditingParam(l),exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:l=>f.current?.handleCaretAfterInput(l),handleCaretMove:l=>f.current?.handleCaretMove(l),replaceEditingRange:l=>f.current?.replaceEditingRange(l)??!1,setActivePill:l=>f.current?.setActivePill(l),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()??ba,recordSubmit:l=>f.current?.recordSubmit(l),selectOption:(l,T)=>f.current?.selectOption(l,T),selectProduct:l=>f.current?.selectProduct(l),addProductToCart:l=>{let T=f.current;return!T||!oe.current?Promise.resolve():T.addProductToCart(l)},setActiveDropdownIndex:l=>f.current?.setActiveDropdownIndex(l),clearHighlight:l=>f.current?.clearHighlight(l),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),setTime:l=>f.current?.setTime(l),commitTime:()=>f.current?.commitTime(),toggleMultiSelectOption:l=>f.current?.toggleMultiSelectOption(l),commitMultiSelect:()=>f.current?.commitMultiSelect(),setLocationQuery:l=>f.current?.setLocationQuery(l),moveLocationHighlight:l=>f.current?.moveLocationHighlight(l),commitLocation:l=>f.current?.commitLocation(l),setLocationFieldFocused:l=>f.current?.setLocationFieldFocused(l),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let y=he.current,h=fa(l=>{let T=l.target.value,st=T.length>0&&!l.nativeEvent?.isComposing&&T[0]!==T[0].toUpperCase()?T[0].toUpperCase()+T.slice(1):T;f.current?.handleTextChange(st)},[]),Y=fa(l=>{f.current?.handleKeyDown(l.nativeEvent)},[]),ue=f.current,m=Me??ba,Ge=B!==void 0?B:m.text,ke=F!==void 0?F:m.completedParams,me=m.actionableSuggestions,Je=me[0],et=wo(me),Ce=ue?.listboxId??"",Ke=m.activeDropdownIndex>=0&&ue?`${Ce}-option-${m.activeDropdownIndex}`:void 0,re=m.editingParam,ge=m.editingIdentified,Le=re?{parameter:re.suggestionParameter,text:re.suggestionPlaceholder,required:!0,options:re.options}:ge?{parameter:ge.parameter,text:bo(ge.parameter),required:!0,options:[]}:null,Fe=m.dropdownSuggestion??Le??Je,qe=Le?[Le]:me,Re=fo(m),_e=!ue||m.dropdownLoading;return{completedParams:ke,multiSelectView:m.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:m.skippedParams,identifiedParams:m.identifiedParams,suggestionPills:et,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:m.segments,newParamId:m.newParamId,clearNewParamId:y.clearNewParamId,suggestions:m.suggestions,activeIndex:m.activeDropdownIndex,isReady:m.isReady,isLoading:_e,isFocused:m.isFocused,isDropdownOpen:m.isDropdownOpen,isActivePillSelected:m.isActivePillSelected,placeholderText:m.placeholderText,listboxId:Ce,error:m.error,products:m.products,customFields:m.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:re,editingIdentified:ge,editingAnchor:m.editingAnchor,caretOffset:m.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:Ge,placeholder:m.placeholderText||void 0,onChange:h,onKeyDown:Y,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":m.isDropdownOpen,"aria-activedescendant":Ke,"aria-autocomplete":"list","aria-controls":Ce},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:Fe?[{...Fe,options:m.dropdownOptions}]:[],activeIndex:m.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:m.isDropdownOpen,id:Ce,pills:qe,activeSelected:m.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(R??!0)&&!re&&!ge,showOptionIcons:D??!0,showOptionImages:H??!0,showOptionCounts:q??!0,skipDisabled:m.inSelectionAnimation,isLoading:_e,skeletonExiting:m.skeletonExiting,isInputEmpty:Ge.trim().length===0,language:s,products:m.products,productImageFallback:C,onProductSelect:y.selectProduct,onProductAddToCart:ve?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:m.activeFormatType,dateView:m.dateView,selectedDateIso:Re.selectedIso,selectedDateRange:Re.selectedRange,dateRangeStart:Re.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:m.timeView,multiSelectView:m.multiSelectView,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:m.locationView,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:m.isFocused||m.locationFieldFocused,optionsPosition:c??"below"}}}import{chipIdFromTap as xo,extractPlainText as wa,getCursorOffset as va,keepCaretOnChip as yo,plainTextLength as ko,renderEditableContent as Co,setCursorOffset as xa}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as de,useEffect as gt,useLayoutEffect as Lt,useRef as je}from"react";var ft;function So(){if(ft!==void 0)return ft;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),ft=e.contentEditable==="plaintext-only",ft}function ya(e){let{segments:i,showChipIcons:t=!0,showChipImages:a=!0,newParamId:o,editingParam:r,editingIdentified:n,editingAnchor:s,caretOffset:g,placeholderText:v,isFocused:x,isDropdownOpen:u,listboxId:d,activeDescendantId:c,autoFocus:w,handleTextChange:L,handleKeyDown:N,handleCaretAfterInput:D,handleCaretMove:H,startEditingParam:q,replaceEditingRange:R,setFocused:I}=e,C=je(null),V=je(!1),Q=je(""),B=je(""),F=je(null),ae=je(0);F.current=g,gt(()=>{if(!w)return;let b=C.current;if(!b)return;document.activeElement===b?I(!0):b.focus();let k=b.ownerDocument??document,S=k.getSelection(),A=S&&S.rangeCount>0&&b.contains(S.anchorNode);if(S&&!A){let O=k.createRange();O.selectNodeContents(b),O.collapse(!0),S.removeAllRanges(),S.addRange(O)}},[w,I]),gt(()=>{let b=C.current;if(!b)return;let k=b.ownerDocument??document,S=()=>{let A=k.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!b.contains(A.anchorNode))return;let O=A.anchorNode,U=O.nodeType===Node.ELEMENT_NODE?O:O.parentElement,oe=(A.isCollapsed?U?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ce=r?.id??n?.id??null;if(oe&&oe!==ce){q(oe);return}performance.now()-ae.current<50||H(va(b))};return k.addEventListener("selectionchange",S),()=>k.removeEventListener("selectionchange",S)},[r,n,q,H]),gt(()=>{let b=C.current;if(!b)return;let k=S=>{let A=xo(b,S.target);A&&(q(A),yo(b,A))};return b.addEventListener("click",k),()=>b.removeEventListener("click",k)},[q]),Lt(()=>{let b=C.current;b&&Co({input:b,segments:i,newParamId:o,editingParamId:r?.id??null,placeholderText:v??"",isFocused:x,showChipIcons:t,showChipImages:a})},[i,o,r,v,x,t,a]),Lt(()=>{let b=Q.current,k=o??"";if(Q.current=k,!k||k===b)return;let S=C.current;if(!S)return;S.focus();let A=F.current??ko(S);xa(S,A)},[o]),Lt(()=>{let b=B.current,k=r?.id??"";if(B.current=k,!k||k===b||s==null)return;let S=C.current;S&&xa(S,s)},[r,s]);let P=de(()=>{if(V.current)return;let b=C.current;if(!b)return;let k=wa(b),A=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;L(A)},[L]),_=de(()=>{ae.current=performance.now(),P();let b=C.current;b&&D(va(b))},[P,D]);gt(()=>{let b=C.current;if(!b)return;let k=S=>{let A=S,O=A.inputType;if(O==="insertParagraph"||O==="insertLineBreak"||O==="insertFromDrop"){S.preventDefault();return}if(O.startsWith("insert")||O.startsWith("delete")){let U=O.startsWith("delete")?"":A.data??"";R(U)&&S.preventDefault()}};return b.addEventListener("beforeinput",k),()=>b.removeEventListener("beforeinput",k)},[R]);let p=de(()=>{V.current=!0,C.current?.setAttribute("data-aia-composing","true")},[]),E=de(()=>{V.current=!1,C.current?.removeAttribute("data-aia-composing"),P()},[P]),ve=de(b=>{b.preventDefault();let k=C.current;if(!k)return;let S=(b.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!S)return;let A=k.ownerDocument??document,O=A.getSelection();if(!O||O.rangeCount===0)return;let U=O.getRangeAt(0);if(!k.contains(U.startContainer))return;U.deleteContents();let ie=A.createTextNode(S);U.insertNode(ie),U.setStartAfter(ie),U.collapse(!0),O.removeAllRanges(),O.addRange(U),P()},[P]),De=de(b=>N(b),[N]),Pe=de(()=>I(!0),[I]),f=de(()=>I(!1),[I]),Me=de(()=>C.current?.focus(),[]),Ie=de(()=>C.current?.blur(),[]),Ee=de(()=>{let b=C.current;return b?wa(b):""},[]),Ae=So()?"plaintext-only":"true";return{inputRef:C,editorProps:{ref:C,contentEditable:Ae,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":d,"aria-expanded":u,"aria-activedescendant":c,spellCheck:!0,enterKeyHint:"send",onInput:_,onKeyDown:De,onCompositionStart:p,onCompositionEnd:E,onPaste:ve,onFocus:Pe,onBlur:f},getPlainText:Ee,focus:Me,blur:Ie}}import{jsx as Ze,jsxs as Dt}from"react/jsx-runtime";function Do(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Mo=To(function({onSubmit:i,onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,className:n,apiConfig:s,additionalContext:g,language:v,currency:x,productId:u,visitorId:d,columns:c,pillPlacement:w="dropdown",mode:L="auto",optionsPosition:N="below",animations:D=!0,dropdownTrigger:H,closeDropdownOnBlur:q,showNonTappableOptions:R,locationSearch:I,showOptionIcons:C=!0,showChipIcons:V=!0,showChipImages:Q=!0,showOptionImages:B=!0,showOptionCounts:F=!0,showSkipButton:ae,showProducts:P,productsLayout:_,productImageFallback:p,autoFocus:E=!0,onFocus:ve,onBlur:De,value:Pe,completedParams:f,onChange:Me,onParamsChange:Ie,products:Ee,mapProducts:Ae,onProductSelect:b,onProductAddToCart:k,submitButton:S,resetOnSubmit:A=!0},O){let U=$e(null),ie=$e(null),oe=$e(null),ce=$e(()=>{}),pe=$e(null),ne=$e(null);Ot(()=>{let M=U.current;if(M)return pe.current?pe.current.setMode(L):pe.current=new Ao(M,L),()=>{pe.current?.destroy(),pe.current=null}},[L]);let ze=Rt(M=>{let ee=ne.current?.current;ee&&(ee.focus(),Lo(ee,M))},[]),{completedParams:Xe,suggestionPills:xe,setActivePill:Ne,skipActivePill:We,segments:ye,newParamId:J,clearNewParamId:he,placeholderText:y,isFocused:h,isDropdownOpen:Y,isActivePillSelected:ue,isLoading:m,isReady:Ge,activeIndex:ke,listboxId:me,handleTextChange:Je,handleKeyDown:et,setFocused:Ce,editingParam:Ke,editingIdentified:re,editingAnchor:ge,caretOffset:Le,startEditingParam:Fe,handleCaretAfterInput:qe,handleCaretMove:Re,replaceEditingRange:_e,dropdownProps:l,reset:T,refreshProducts:z,prepareSubmit:st,getState:Mt,recordSubmit:zt}=At({onSubmit:M=>ce.current(M),onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,apiConfig:s,additionalContext:g,language:v,currency:x,productId:u,visitorId:d,columns:c,dropdownTrigger:H,optionsPosition:N,closeDropdownOnBlur:q,showNonTappableOptions:R,locationSearch:I,showOptionIcons:C,showOptionImages:B,showOptionCounts:F,showSkipButton:ae,showProducts:P,onFocus:ve,onBlur:De,value:Pe,completedParams:f,onChange:Me,onParamsChange:Ie,products:Ee,mapProducts:Ae,onProductSelect:b,onProductAddToCart:k,source:"full-sdk",setCursor:ze});Ot(()=>{if(!J)return;let M=window.setTimeout(()=>he(),650);return()=>window.clearTimeout(M)},[J,he]);let ka=ke>=0?`${me}-option-${ke}`:void 0,{inputRef:bt,editorProps:Ca,focus:lt,blur:Nt,getPlainText:Ft}=ya({segments:ye,newParamId:J,editingParam:Ke,editingIdentified:re,editingAnchor:ge,caretOffset:Le,placeholderText:y,isFocused:h,showChipIcons:V,showChipImages:Q,isDropdownOpen:Y,listboxId:me,activeDescendantId:ka,autoFocus:E,handleTextChange:Je,handleKeyDown:et,handleCaretAfterInput:qe,handleCaretMove:Re,startEditingParam:Fe,replaceEditingRange:_e,setFocused:Ce});ne.current=bt,Io(()=>{let M=ie.current,ee=bt.current;if(!M||!ee)return;let at=()=>{let Bt=M.firstElementChild;if(!Bt)return;let Ia=Bt.getBoundingClientRect(),Ea=ee.getBoundingClientRect();Ia.top>=Ea.bottom-2?M.setAttribute("data-aia-pill-wrapped",""):M.removeAttribute("data-aia-pill-wrapped")};at();let Ht=new ResizeObserver(at);return Ht.observe(ee),()=>Ht.disconnect()},[ye,xe.length,m,bt]),Ot(()=>{let M=oe.current;if(M)return Oo(M)},[]),Po(O,()=>({focus:lt,blur:Nt,reset:T,refreshProducts:z,setMode:M=>pe.current?.setMode(M),skipActivePill:We}),[lt,Nt,T,z,We]);let tt=!!ye.length||Xe.length>0,wt=Rt(M=>{if(!tt)return;M&&st();let ee=Mt(),at=Eo(Ft(),ee.completedParams,ee.skippedParams,{identifiedParams:ee.identifiedParams,isReady:ee.isReady,customFields:ee.customFields});M&&zt(at),i(at),A&&T()},[zt,A,tt,st,Mt,i,T,Ft]);ce.current=()=>wt(!1);let Sa=Rt(M=>{M.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||lt()},[lt]),Ta=w==="inline",Pa=w==="dropdown";return Dt("div",{ref:U,className:`magicx-aia ${He.container} ${n??""}`,"data-pill-placement":w,"data-options-position":N,"data-animations":D?"on":"off","data-mode":Do(L),children:[Ze(It,{...l,showPills:Pa,productsLayout:_,productImageFallback:p}),Dt("div",{className:He.inputWrapper,"data-aia-input-wrapper":"",onClick:Sa,children:[Dt("div",{ref:oe,className:He.editorArea,"data-aia-editor":"",children:[Ze("div",{...Ca,className:He.input,"data-aia-input":""}),Ta&&(m||xe.length>0)&&Ze("span",{ref:ie,className:He.pillListContainer,"data-aia-pill-list-container":"",children:Ze(ct,{pills:xe,activePillIndex:0,activeSelected:ue,onSelectPill:Ne,loading:m})})]}),S===null?null:S===void 0?Ze(pa,{disabled:!tt,ready:tt&&Ge,onClick:()=>wt(!0),label:Ro(v).submit}):Ze("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:He.submitSlot,onClick:M=>{tt&&(M.stopPropagation(),wt(!0))},children:S})]})]})});export{Mo as AIAutocomplete,It as AIAutocompleteDropdown,_r as DATE_RANGE_META_END,Ur as DATE_RANGE_META_START,Vr as DEFAULT_OPTION_COUNT_UNIT,es as LOCATION_META_KEY,ls as PRODUCT_PATH_PREFIX,ws as TIME_META_KEY,xs as WEEKDAY_LABELS,Gr as buildSubmitResult,Kr as cellDay,qr as cellIso,Qr as dateCellMarks,Yr as formatDate,jr as formatDateRange,$r as formatOptionCount,Zr as formatPlace,Xr as formatTime,Jr as isoDate,ts as monthLabel,as as optionCountLabel,is as optionHasImage,os as optionImageSources,ns as optionImageSrc,rs as optionLabel,ss as optionsShowLeadingVisuals,ds as parseDate,cs as parseLooseDate,ps as parseLooseDateRange,hs as parseTime,us as productFromMatchedItem,ms as productImageSources,gs as productsFromCustomFields,fs as sanitizeOptionIconSvg,bs as selectedRangeFor,At as useAIAutocomplete,vs as visibleDateRange,ys as withSkippedParams};
3207
+ `,document.head.appendChild(e)}var pa={submitButton:"aia-submitButton-otz7H"};import{jsx as At}from"react/jsx-runtime";function ha({disabled:e,ready:o,onClick:a,label:i=go().submit}){return At("button",{type:"button","data-aia-submit":"",className:pa.submitButton,disabled:e,"data-aia-ready":o?"":void 0,onClick:n=>{n.stopPropagation(),a()},"aria-label":i,children:At("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:At("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as fo,dateSelectionFor as bo,identifiedParamLabel as wo,withoutTraditionalAutocomplete as vo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ba,useEffect as $e,useRef as j,useState as xo}from"react";import{useRef as ua}from"react";function ma(e){let o=ua(e);o.current=e;let a=Object.keys(e??{}).sort().join("\0"),i=ua({key:"",overrides:void 0});if(i.current.key!==a){let n={};for(let l of Object.keys(e??{})){let r=(d,m,v)=>{let x=o.current?.[l];return x?x(d,m,v):[]};n[l]=r}i.current={key:a,overrides:e?n:void 0}}return{overrides:i.current.overrides,key:a}}import{useRef as ga}from"react";function fa(e){let o=ga(e);o.current=e;let a=ga(null);a.current===null&&(a.current={fetch:(n,l)=>{let r=o.current;return r?r.fetch(n,l):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 wa={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:a,optionOverrides:i,maskCompletedText:n,apiConfig:l,additionalContext:r,language:d,currency:m,productId:v,visitorId:x,columns:u=2,dropdownTrigger:c,optionsPosition:p,closeDropdownOnBlur:w,prependPlaceholder:I,showNonTappableOptions:M,locationSearch:A,showOptionIcons:F,showOptionImages:K,showOptionCounts:L,showSkipButton:E,showProducts:y,productImageFallback:$="image",onFocus:q,onBlur:Z,value:z,completedParams:_,onChange:S,onParamsChange:G,products:h,mapProducts:T,onProductSelect:Te,onProductAddToCart:fe,source:De,setCursor:be}){let g=j(null),[Me,Pe]=xo(null),Ie=j(e);Ie.current=e;let f=j(o);f.current=o;let k=j(a);k.current=a;let C=j(S);C.current=S;let P=j(G);P.current=G;let R=j(q);R.current=q;let U=j(Z);U.current=Z;let ie=j(be);ie.current=be;let oe=j(Te);oe.current=Te;let ne=j(fe);ne.current=fe;let ze=j(x);ze.current=x;let ee=j(()=>{let s=ze.current;return typeof s=="function"?s():s}).current,we=fa(h),Ke=j(T);Ke.current=T;let et=j((s,N)=>{let D=Ke.current;return D?D(s,N):s}).current,ve=T?et:void 0,Ne=ma(i);$e(()=>{if(typeof document>"u")return;let s=new fo(document.createElement("div"),{renderMode:"headless",apiConfig:l,additionalContext:r,language:d,currency:m,productId:v,visitorId:ee,optionOverrides:Ne.overrides,maskCompletedText:n,columns:u,dropdownTrigger:c,optionsPosition:p,closeDropdownOnBlur:w,prependPlaceholder:I,showNonTappableOptions:M,locationSearch:A,showProducts:y,source:De,value:z,completedParams:_,onSubmit:(...D)=>Ie.current?.(...D),onResult:(...D)=>f.current?.(...D),onError:(...D)=>k.current?.(...D),onChange:(...D)=>C.current?.(...D),onParamsChange:(...D)=>P.current?.(...D),onFocus:()=>R.current?.(),onBlur:()=>U.current?.(),onProductSelect:D=>oe.current?.(D),onProductAddToCart:D=>ne.current?.(D),setCursor:D=>ie.current?.(D),products:we.config,mapProducts:ve});g.current=s,Pe(s.getState());let N=s.subscribe(D=>Pe(D));return()=>{N(),s.destroy(),g.current===s&&(g.current=null)}},[]),$e(()=>{z!==void 0&&g.current?.setValue(z)},[z]),$e(()=>{_!==void 0&&g.current?.setCompletedParams(_)},[_]);let qe=JSON.stringify(l??null),J;try{J=JSON.stringify(r??null)}catch{J="[unstringifiable]"}$e(()=>{g.current?.update({apiConfig:l,additionalContext:r,language:d,currency:m,productId:v,optionOverrides:Ne.overrides,dropdownTrigger:c,optionsPosition:p,closeDropdownOnBlur:w,prependPlaceholder:I,showNonTappableOptions:M,locationSearch:A,showProducts:y})},[qe,J,d,m?.code,m?.rate,m?.country,v,Ne.key,c,p,w,I,M,A,y]);let pe=j(!1);$e(()=>{if(!pe.current){pe.current=!0;return}g.current?.update({products:we.config})},[we.enabled]),$e(()=>{g.current?.update({mapProducts:ve})},[ve]);let xe=j(null);xe.current===null&&(xe.current={handleTextChange:s=>g.current?.handleTextChange(s),handleKeyDown:s=>{let N="nativeEvent"in s?s.nativeEvent:s;g.current?.handleKeyDown(N)},setFocused:s=>g.current?.setFocused(s),startEditingParam:s=>g.current?.startEditingParam(s),exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:s=>g.current?.handleCaretAfterInput(s),handleCaretMove:s=>g.current?.handleCaretMove(s),replaceEditingRange:s=>g.current?.replaceEditingRange(s)??!1,setActivePill:s=>g.current?.setActivePill(s),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()??wa,recordSubmit:s=>g.current?.recordSubmit(s),selectOption:(s,N)=>g.current?.selectOption(s,N),selectProduct:s=>g.current?.selectProduct(s),addProductToCart:s=>{let N=g.current;return!N||!ne.current?Promise.resolve():N.addProductToCart(s)},setActiveDropdownIndex:s=>g.current?.setActiveDropdownIndex(s),clearHighlight:s=>g.current?.clearHighlight(s),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),setTime:s=>g.current?.setTime(s),commitTime:()=>g.current?.commitTime(),toggleMultiSelectOption:s=>g.current?.toggleMultiSelectOption(s),commitMultiSelect:()=>g.current?.commitMultiSelect(),setLocationQuery:s=>g.current?.setLocationQuery(s),moveLocationHighlight:s=>g.current?.moveLocationHighlight(s),commitLocation:s=>g.current?.commitLocation(s),setLocationFieldFocused:s=>g.current?.setLocationFieldFocused(s),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let t=xe.current,V=ba(s=>{let N=s.target.value,lt=N.length>0&&!s.nativeEvent?.isComposing&&N[0]!==N[0].toUpperCase()?N[0].toUpperCase()+N.slice(1):N;g.current?.handleTextChange(lt)},[]),Ee=ba(s=>{g.current?.handleKeyDown(s.nativeEvent)},[]),re=g.current,b=Me??wa,ye=z!==void 0?z:b.text,Ae=_!==void 0?_:b.completedParams,Le=b.actionableSuggestions,tt=Le[0],_e=vo(Le),ke=re?.listboxId??"",Ue=b.activeDropdownIndex>=0&&re?`${ke}-option-${b.activeDropdownIndex}`:void 0,se=b.editingParam,he=b.editingIdentified,Re=se?{parameter:se.suggestionParameter,text:se.suggestionPlaceholder,required:!0,options:se.options}:he?{parameter:he.parameter,text:wo(he.parameter),required:!0,options:[]}:null,Fe=b.dropdownSuggestion??Re??tt,Ve=Re?[Re]:Le,He=bo(b),Be=!re||b.dropdownLoading;return{completedParams:Ae,multiSelectView:b.multiSelectView,toggleMultiSelectOption:t.toggleMultiSelectOption,commitMultiSelect:t.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:_e,setActivePill:t.setActivePill,skipActivePill:t.skipActivePill,removeLastParam:t.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:t.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:Be,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:ke,error:b.error,products:b.products,customFields:b.customFields,selectProduct:t.selectProduct,addProductToCart:t.addProductToCart,handleTextChange:t.handleTextChange,handleKeyDown:t.handleKeyDown,setFocused:t.setFocused,editingParam:se,editingIdentified:he,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:t.startEditingParam,exitEditMode:t.exitEditMode,handleCaretAfterInput:t.handleCaretAfterInput,handleCaretMove:t.handleCaretMove,replaceEditingRange:t.replaceEditingRange,inputProps:{value:ye,placeholder:b.placeholderText||void 0,onChange:V,onKeyDown:Ee,onFocus:t.handleFocus,onBlur:t.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":Ue,"aria-autocomplete":"list","aria-controls":ke},reset:t.reset,refreshProducts:t.refreshProducts,prepareSubmit:t.prepareSubmit,getState:t.getState,recordSubmit:t.recordSubmit,dropdownProps:{suggestions:Fe?[{...Fe,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:t.selectOption,onHighlight:t.setActiveDropdownIndex,onUnhighlight:t.clearHighlight,isOpen:b.isDropdownOpen,id:ke,pills:Ve,activeSelected:b.isActivePillSelected,onPillClick:t.setActivePill,onSkip:t.skipActivePill,showSkipButton:(E??!0)&&!se&&!he,showOptionIcons:F??!0,showOptionImages:K??!0,showOptionCounts:L??!0,skipDisabled:b.inSelectionAnimation,isLoading:Be,skeletonExiting:b.skeletonExiting,isInputEmpty:ye.trim().length===0,language:d,products:b.products,productImageFallback:$,onProductSelect:t.selectProduct,onProductAddToCart:fe?t.addProductToCart:void 0,onProductFocusChange:t.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:He.selectedIso,selectedDateRange:He.selectedRange,dateRangeStart:He.rangeStart,onPreviousMonth:t.showPreviousMonth,onNextMonth:t.showNextMonth,timeView:b.timeView,multiSelectView:b.multiSelectView,onMultiSelectCommit:t.commitMultiSelect,onTimeChange:t.setTime,onTimeCommit:t.commitTime,locationView:b.locationView,onLocationQuery:t.setLocationQuery,onLocationMove:t.moveLocationHighlight,onLocationCommit:t.commitLocation,onLocationFocusChange:t.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:p??"below"}}}import{chipIdFromTap as yo,extractPlainText as va,getCursorOffset as xa,keepCaretOnChip as ko,plainTextLength as Co,renderEditableContent as So,setCursorOffset as ya}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ce,useEffect as ft,useLayoutEffect as Rt,useRef as Ze}from"react";var bt;function To(){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 ka(e){let{segments:o,showChipIcons:a=!0,showChipImages:i=!0,newParamId:n,editingParam:l,editingIdentified:r,editingAnchor:d,caretOffset:m,placeholderText:v,isFocused:x,isDropdownOpen:u,listboxId:c,activeDescendantId:p,autoFocus:w,handleTextChange:I,handleKeyDown:M,handleCaretAfterInput:A,handleCaretMove:F,startEditingParam:K,replaceEditingRange:L,setFocused:E}=e,y=Ze(null),$=Ze(!1),q=Ze(""),Z=Ze(""),z=Ze(null),_=Ze(0);z.current=m,ft(()=>{if(!w)return;let f=y.current;if(!f)return;document.activeElement===f?E(!0):f.focus();let k=f.ownerDocument??document,C=k.getSelection(),P=C&&C.rangeCount>0&&f.contains(C.anchorNode);if(C&&!P){let R=k.createRange();R.selectNodeContents(f),R.collapse(!0),C.removeAllRanges(),C.addRange(R)}},[w,E]),ft(()=>{let f=y.current;if(!f)return;let k=f.ownerDocument??document,C=()=>{let P=k.getSelection();if(!P||P.rangeCount===0||!P.anchorNode||!f.contains(P.anchorNode))return;let R=P.anchorNode,U=R.nodeType===Node.ELEMENT_NODE?R:R.parentElement,oe=(P.isCollapsed?U?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ne=l?.id??r?.id??null;if(oe&&oe!==ne){K(oe);return}performance.now()-_.current<50||F(xa(f))};return k.addEventListener("selectionchange",C),()=>k.removeEventListener("selectionchange",C)},[l,r,K,F]),ft(()=>{let f=y.current;if(!f)return;let k=C=>{let P=yo(f,C.target);P&&(K(P),ko(f,P))};return f.addEventListener("click",k),()=>f.removeEventListener("click",k)},[K]),Rt(()=>{let f=y.current;f&&So({input:f,segments:o,newParamId:n,editingParamId:l?.id??null,placeholderText:v??"",isFocused:x,showChipIcons:a,showChipImages:i})},[o,n,l,v,x,a,i]),Rt(()=>{let f=q.current,k=n??"";if(q.current=k,!k||k===f)return;let C=y.current;if(!C)return;C.focus();let P=z.current??Co(C);ya(C,P)},[n]),Rt(()=>{let f=Z.current,k=l?.id??"";if(Z.current=k,!k||k===f||d==null)return;let C=y.current;C&&ya(C,d)},[l,d]);let S=ce(()=>{if($.current)return;let f=y.current;if(!f)return;let k=va(f),P=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;I(P)},[I]),G=ce(()=>{_.current=performance.now(),S();let f=y.current;f&&A(xa(f))},[S,A]);ft(()=>{let f=y.current;if(!f)return;let k=C=>{let P=C,R=P.inputType;if(R==="insertParagraph"||R==="insertLineBreak"||R==="insertFromDrop"){C.preventDefault();return}if(R.startsWith("insert")||R.startsWith("delete")){let U=R.startsWith("delete")?"":P.data??"";L(U)&&C.preventDefault()}};return f.addEventListener("beforeinput",k),()=>f.removeEventListener("beforeinput",k)},[L]);let h=ce(()=>{$.current=!0,y.current?.setAttribute("data-aia-composing","true")},[]),T=ce(()=>{$.current=!1,y.current?.removeAttribute("data-aia-composing"),S()},[S]),Te=ce(f=>{f.preventDefault();let k=y.current;if(!k)return;let C=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!C)return;let P=k.ownerDocument??document,R=P.getSelection();if(!R||R.rangeCount===0)return;let U=R.getRangeAt(0);if(!k.contains(U.startContainer))return;U.deleteContents();let ie=P.createTextNode(C);U.insertNode(ie),U.setStartAfter(ie),U.collapse(!0),R.removeAllRanges(),R.addRange(U),S()},[S]),fe=ce(f=>M(f),[M]),De=ce(()=>E(!0),[E]),be=ce(()=>E(!1),[E]),g=ce(()=>y.current?.focus(),[]),Me=ce(()=>y.current?.blur(),[]),Pe=ce(()=>{let f=y.current;return f?va(f):""},[]),Ie=To()?"plaintext-only":"true";return{inputRef:y,editorProps:{ref:y,contentEditable:Ie,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:G,onKeyDown:fe,onCompositionStart:h,onCompositionEnd:T,onPaste:Te,onFocus:De,onBlur:be},getPlainText:Pe,focus:g,blur:Me}}import{jsx as Je,jsxs as Mt}from"react/jsx-runtime";function Mo(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var zo=Po(function({onSubmit:o,onResult:a,onError:i,optionOverrides:n,maskCompletedText:l,className:r,apiConfig:d,additionalContext:m,language:v,currency:x,productId:u,visitorId:c,columns:p,pillPlacement:w="dropdown",mode:I="auto",optionsPosition:M="below",animations:A=!0,dropdownTrigger:F,closeDropdownOnBlur:K,prependPlaceholder:L,showNonTappableOptions:E,locationSearch:y,showOptionIcons:$=!0,showChipIcons:q=!0,showChipImages:Z=!0,showOptionImages:z=!0,showOptionCounts:_=!0,showSkipButton:S,showProducts:G,productsLayout:h,productImageFallback:T,autoFocus:Te=!0,onFocus:fe,onBlur:De,value:be,completedParams:g,onChange:Me,onParamsChange:Pe,products:Ie,mapProducts:f,onProductSelect:k,onProductAddToCart:C,submitButton:P,resetOnSubmit:R=!0},U){let ie=Xe(null),oe=Xe(null),ne=Xe(null),ze=Xe(()=>{}),ee=Xe(null),we=Xe(null);Dt(()=>{let O=ie.current;if(O)return ee.current?ee.current.setMode(I):ee.current=new Lo(O,I),()=>{ee.current?.destroy(),ee.current=null}},[I]);let Ke=Ot(O=>{let te=we.current?.current;te&&(te.focus(),Ro(te,O))},[]),{completedParams:et,suggestionPills:ve,setActivePill:Ne,skipActivePill:qe,segments:J,newParamId:pe,clearNewParamId:xe,placeholderText:t,isFocused:V,isDropdownOpen:Ee,isActivePillSelected:re,isLoading:b,isReady:ye,activeIndex:Ae,listboxId:Le,handleTextChange:tt,handleKeyDown:_e,setFocused:ke,editingParam:Ue,editingIdentified:se,editingAnchor:he,caretOffset:Re,startEditingParam:Fe,handleCaretAfterInput:Ve,handleCaretMove:He,replaceEditingRange:Be,dropdownProps:s,reset:N,refreshProducts:D,prepareSubmit:lt,getState:zt,recordSubmit:Nt}=Lt({onSubmit:O=>ze.current(O),onResult:a,onError:i,optionOverrides:n,maskCompletedText:l,apiConfig:d,additionalContext:m,language:v,currency:x,productId:u,visitorId:c,columns:p,dropdownTrigger:F,optionsPosition:M,closeDropdownOnBlur:K,prependPlaceholder:L,showNonTappableOptions:E,locationSearch:y,showOptionIcons:$,showOptionImages:z,showOptionCounts:_,showSkipButton:S,showProducts:G,onFocus:fe,onBlur:De,value:be,completedParams:g,onChange:Me,onParamsChange:Pe,products:Ie,mapProducts:f,onProductSelect:k,onProductAddToCart:C,source:"full-sdk",setCursor:Ke});Dt(()=>{if(!pe)return;let O=window.setTimeout(()=>xe(),650);return()=>window.clearTimeout(O)},[pe,xe]);let Ca=Ae>=0?`${Le}-option-${Ae}`:void 0,{inputRef:wt,editorProps:Sa,focus:dt,blur:Ft,getPlainText:Ht}=ka({segments:J,newParamId:pe,editingParam:Ue,editingIdentified:se,editingAnchor:he,caretOffset:Re,placeholderText:t,isFocused:V,showChipIcons:q,showChipImages:Z,isDropdownOpen:Ee,listboxId:Le,activeDescendantId:Ca,autoFocus:Te,handleTextChange:tt,handleKeyDown:_e,handleCaretAfterInput:Ve,handleCaretMove:He,startEditingParam:Fe,replaceEditingRange:Be,setFocused:ke});we.current=wt,Eo(()=>{let O=oe.current,te=wt.current;if(!O||!te)return;let it=()=>{let Wt=O.firstElementChild;if(!Wt)return;let Ea=Wt.getBoundingClientRect(),Aa=te.getBoundingClientRect();Ea.top>=Aa.bottom-2?O.setAttribute("data-aia-pill-wrapped",""):O.removeAttribute("data-aia-pill-wrapped")};it();let Bt=new ResizeObserver(it);return Bt.observe(te),()=>Bt.disconnect()},[J,ve.length,b,wt]),Dt(()=>{let O=ne.current;if(O)return Do(O)},[]),Io(U,()=>({focus:dt,blur:Ft,reset:N,refreshProducts:D,setMode:O=>ee.current?.setMode(O),skipActivePill:qe}),[dt,Ft,N,D,qe]);let at=!!J.length||et.length>0,vt=Ot(O=>{if(!at)return;O&&lt();let te=zt(),it=Ao(Ht(),te.completedParams,te.skippedParams,{identifiedParams:te.identifiedParams,isReady:te.isReady,customFields:te.customFields});O&&Nt(it),o(it),R&&N()},[Nt,R,at,lt,zt,o,N,Ht]);ze.current=()=>vt(!1);let Ta=Ot(O=>{O.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||dt()},[dt]),Pa=w==="inline",Ia=w==="dropdown";return Mt("div",{ref:ie,className:`magicx-aia ${We.container} ${r??""}`,"data-pill-placement":w,"data-options-position":M,"data-animations":A?"on":"off","data-mode":Mo(I),children:[Je(Et,{...s,showPills:Ia,productsLayout:h,productImageFallback:T}),Mt("div",{className:We.inputWrapper,"data-aia-input-wrapper":"",onClick:Ta,children:[Mt("div",{ref:ne,className:We.editorArea,"data-aia-editor":"",children:[Je("div",{...Sa,className:We.input,"data-aia-input":""}),Pa&&(b||ve.length>0)&&Je("span",{ref:oe,className:We.pillListContainer,"data-aia-pill-list-container":"",children:Je(pt,{pills:ve,activePillIndex:0,activeSelected:re,onSelectPill:Ne,loading:b})})]}),P===null?null:P===void 0?Je(ha,{disabled:!at,ready:at&&ye,onClick:()=>vt(!0),label:Oo(v).submit}):Je("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:We.submitSlot,onClick:O=>{at&&(O.stopPropagation(),vt(!0))},children:P})]})]})});export{zo as AIAutocomplete,Et as AIAutocompleteDropdown,Ur as DATE_RANGE_META_END,Vr as DATE_RANGE_META_START,Qr as DEFAULT_OPTION_COUNT_UNIT,ts as LOCATION_META_KEY,ds as PRODUCT_PATH_PREFIX,vs as TIME_META_KEY,ys as WEEKDAY_LABELS,Kr as buildSubmitResult,qr as cellDay,_r as cellIso,Yr as dateCellMarks,jr as formatDate,$r as formatDateRange,Zr as formatOptionCount,Xr as formatPlace,Jr as formatTime,es as isoDate,as as monthLabel,is as optionCountLabel,os as optionHasImage,ns as optionImageSources,rs as optionImageSrc,ss as optionLabel,ls as optionsShowLeadingVisuals,cs as parseDate,ps as parseLooseDate,hs as parseLooseDateRange,us as parseTime,ms as productFromMatchedItem,gs as productImageSources,fs as productsFromCustomFields,bs as sanitizeOptionIconSvg,ws as selectedRangeFor,Lt as useAIAutocomplete,xs as visibleDateRange,ks as withSkippedParams};
3208
3208
  //# sourceMappingURL=index.mjs.map