@magicx-eng/ai-autocomplete-react 0.43.0 → 0.44.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 Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END as Bn,DATE_RANGE_META_START as Kn,DEFAULT_OPTION_COUNT_UNIT as Gn,dateCellMarks as Wn,formatDate as _n,formatDateRange as qn,formatOptionCount as Un,isoDate as Vn,monthLabel as jn,optionCountLabel as Yn,optionHasImage as Qn,optionImageSources as Zn,optionImageSrc as $n,optionLabel as Xn,optionsShowLeadingVisuals as Jn,PRODUCT_PATH_PREFIX as er,parseDate as tr,parseLooseDate as ar,parseLooseDateRange as ir,productFromMatchedItem as or,productImageSources as nr,productsFromCustomFields as rr,sanitizeOptionIconSvg as sr,selectedRangeFor as lr,visibleDateRange as dr,WEEKDAY_LABELS as cr,withSkippedParams as pr}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Li,useCallback as bt,useEffect as ea,useImperativeHandle as zi,useLayoutEffect as Mi,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 Hn,cellDay as Bn,cellIso as Gn,DATE_RANGE_META_END as Kn,DATE_RANGE_META_START as qn,DEFAULT_OPTION_COUNT_UNIT as Wn,dateCellMarks as Un,formatDate as _n,formatDateRange as jn,formatOptionCount as Vn,isoDate as Yn,monthLabel as Qn,optionCountLabel as $n,optionHasImage as Zn,optionImageSources as Xn,optionImageSrc as Jn,optionLabel as er,optionsShowLeadingVisuals as tr,PRODUCT_PATH_PREFIX as ar,parseDate as ir,parseLooseDate as or,parseLooseDateRange as nr,productFromMatchedItem as rr,productImageSources as sr,productsFromCustomFields as lr,sanitizeOptionIconSvg as dr,selectedRangeFor as cr,visibleDateRange as pr,WEEKDAY_LABELS as hr,withSkippedParams as ur}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Mi,useCallback as yt,useEffect as aa,useImperativeHandle as Ni,useLayoutEffect as Fi,useRef as Ve}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
@@ -280,7 +280,7 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
280
280
  opacity: 0;
281
281
  }
282
282
  }
283
- `,document.head.appendChild(e)}var Ee={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",aiaPillReveal:"aia-aiaPillReveal-wf05b"};import{attachScrollArrow as li,attachViewportFit as di,containScroll as ci,hasSkippablePill as pi,isCalendarFormat as hi,labelTraditionalAutocomplete as ui,uiStringsFor as mi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Le,useRef as De,useState as gi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
283
+ `,document.head.appendChild(e)}var Ae={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",aiaPillReveal:"aia-aiaPillReveal-wf05b"};import{attachScrollArrow as pi,attachViewportFit as hi,containScroll as ui,hasSkippablePill as mi,isCalendarFormat as gi,labelTraditionalAutocomplete as fi,uiStringsFor as bi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Me,useRef as ze,useState as wi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
284
284
  * Built-in appearance defaults \u2014 zero specificity via :where().
285
285
  * Consumer CSS always wins without !important.
286
286
  *
@@ -1132,7 +1132,7 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
1132
1132
  opacity: 0.25;
1133
1133
  }
1134
1134
  }
1135
- `,document.head.appendChild(e)}var le={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"};import{cellDay as la,cellIso as Oe,dateCellMarks as da,isoDate as ca,monthLabel as pa,visibleDateRange as ha,WEEKDAY_LABELS as ua}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as ma}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) ---
1135
+ `,document.head.appendChild(e)}var pe={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q"};import{cellDay as ca,cellIso as Le,dateCellMarks as pa,isoDate as ha,monthLabel as ua,visibleDateRange as ma,WEEKDAY_LABELS as ga}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) ---
1136
1136
 
1137
1137
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1138
1138
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1295,7 +1295,7 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
1295
1295
  opacity: 0.8;
1296
1296
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1297
1297
  }
1298
- `,document.head.appendChild(e)}var D={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 ae,jsxs as Pt}from"react/jsx-runtime";var ga=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function It({options:e,activeIndex:n,listboxId:t,view:i,selection:o,onSelect:r,onHighlight:a,onUnhighlight:c,onPreviousMonth:s,onNextMonth:m}){let y=ca(new Date),P=ha({pendingStart:o.rangeStart,highlightedIso:Oe(e[n]),selected:o.selectedRange});return Pt("div",{className:D.datepicker,"data-aia-datepicker":"",children:[Pt("div",{className:D.header,children:[ae("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:f=>f.preventDefault(),onClick:s,children:"\u2039"}),ae("span",{className:D.month,"data-aia-date-month":"","aria-live":"polite",children:pa(i)}),ae("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:f=>f.preventDefault(),onClick:m,children:"\u203A"})]}),ae("div",{className:D.weekdays,"aria-hidden":"true",children:ua.map((f,v)=>ae("span",{className:D.weekday,children:f},ga[v]))}),ae("div",{className:D.grid,"data-aia-date-grid":"",children:e.map((f,v)=>ae(fa,{option:f,id:`${t}-option-${v}`,index:v,isHighlighted:v===n&&f.is_tappable,isToday:Oe(f)===y,isPast:Oe(f)!=null&&Oe(f)<y,marks:da(Oe(f),{selectedIso:o.selectedIso,range:P}),onSelect:r,onHighlight:a,onUnhighlight:c},Oe(f)??`pad-${v}`))})]})}function fa({option:e,id:n,index:t,isHighlighted:i,isToday:o,isPast:r,marks:a,onSelect:c,onHighlight:s,onUnhighlight:m}){let[y,P]=ma(!1),f=la(e);if(f==null)return ae("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${D.cell} ${D.blank}`});let v=()=>{P(!0),c(e),setTimeout(()=>P(!1),170)},I=[D.cell,D.day,r?D.past:"",i?D.highlighted:"",o?D.today:"",a.inRange?D.inRange:"",a.selected?D.selected:"",y?D.pressed:""].filter(Boolean).join(" ");return ae("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:I,onClick:v,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),v())},onMouseEnter:()=>s(t),onMouseLeave:m?()=>m(t):void 0,children:ae("span",{className:D.number,children:f})})}import{ATTRIBUTION_URL as ba,buildAttributionUrl as wa,getFooterHint as va,uiStringsFor as xa}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ya,useState as ka}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 {
1298
+ `,document.head.appendChild(e)}var z={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 ne,jsxs as It}from"react/jsx-runtime";var ba=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Et({options:e,activeIndex:n,listboxId:t,view:a,selection:o,onSelect:r,onHighlight:i,onUnhighlight:p,onPreviousMonth:u,onNextMonth:m}){let b=ha(new Date),k=ma({pendingStart:o.rangeStart,highlightedIso:Le(e[n]),selected:o.selectedRange});return It("div",{className:z.datepicker,"data-aia-datepicker":"",children:[It("div",{className:z.header,children:[ne("button",{type:"button",tabIndex:-1,className:z.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:l=>l.preventDefault(),onClick:u,children:"\u2039"}),ne("span",{className:z.month,"data-aia-date-month":"","aria-live":"polite",children:ua(a)}),ne("button",{type:"button",tabIndex:-1,className:z.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:l=>l.preventDefault(),onClick:m,children:"\u203A"})]}),ne("div",{className:z.weekdays,"aria-hidden":"true",children:ga.map((l,w)=>ne("span",{className:z.weekday,children:l},ba[w]))}),ne("div",{className:z.grid,"data-aia-date-grid":"",children:e.map((l,w)=>ne(wa,{option:l,id:`${t}-option-${w}`,index:w,isHighlighted:w===n&&l.is_tappable,isToday:Le(l)===b,isPast:Le(l)!=null&&Le(l)<b,marks:pa(Le(l),{selectedIso:o.selectedIso,range:k}),onSelect:r,onHighlight:i,onUnhighlight:p},Le(l)??`pad-${w}`))})]})}function wa({option:e,id:n,index:t,isHighlighted:a,isToday:o,isPast:r,marks:i,onSelect:p,onHighlight:u,onUnhighlight:m}){let[b,k]=fa(!1),l=ca(e);if(l==null)return ne("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${z.cell} ${z.blank}`});let w=()=>{k(!0),p(e),setTimeout(()=>k(!1),170)},s=[z.cell,z.day,r?z.past:"",a?z.highlighted:"",o?z.today:"",i.inRange?z.inRange:"",i.selected?z.selected:"",b?z.pressed:""].filter(Boolean).join(" ");return ne("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:s,onClick:w,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),w())},onMouseEnter:()=>u(t),onMouseLeave:m?()=>m(t):void 0,children:ne("span",{className:z.number,children:l})})}import{ATTRIBUTION_URL as va,buildAttributionUrl as xa,getFooterHint as ya,uiStringsFor as ka}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ca,useState as Sa}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 {
1299
1299
  display: flex;
1300
1300
  flex-wrap: wrap;
1301
1301
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1335,7 +1335,7 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
1335
1335
  .aia-cluster[data-justify="around"] {
1336
1336
  justify-content: space-around;
1337
1337
  }
1338
- `,document.head.appendChild(e)}import{jsx as Tt}from"react/jsx-runtime";function Ge({gap:e,align:n="center",justify:t="start",noWrap:i=!1,inline:o=!1,className:r,children:a,...c}){let s=e?{"--aia-cluster-gap":e}:void 0,m={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":n,"data-justify":t,"data-nowrap":i||void 0,"data-inline":o||void 0,style:s,...c};return o?Tt("span",{...m,children:a}):Tt("div",{...m,children:a})}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
1338
+ `,document.head.appendChild(e)}import{jsx as At}from"react/jsx-runtime";function We({gap:e,align:n="center",justify:t="start",noWrap:a=!1,inline:o=!1,className:r,children:i,...p}){let u=e?{"--aia-cluster-gap":e}:void 0,m={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":n,"data-justify":t,"data-nowrap":a||void 0,"data-inline":o||void 0,style:u,...p};return o?At("span",{...m,children:i}):At("div",{...m,children:i})}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
1339
1339
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1340
1340
  room above the hint/branding row so the footer doesn't butt against the last
1341
1341
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1482,7 +1482,7 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
1482
1482
  justify-content: flex-end;
1483
1483
  }
1484
1484
  }
1485
- `,document.head.appendChild(e)}var de={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 We,jsxs as st}from"react/jsx-runtime";function Et({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:t=xa()}){let{key:i,hint:o}=va(e,n,t),[r,a]=ka(ba);return ya(()=>{a(wa())},[]),We("footer",{className:de.footer,"data-aia-footer":"",children:st(Ge,{justify:"between",noWrap:!0,className:de.row,children:[st(Ge,{gap:"5px",className:de.hintGroup,children:[We("kbd",{className:de.key,children:i}),We("span",{className:de.hint,children:o})]}),st("a",{className:de.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[We("span",{className:de.brand,children:"AI"}),We("span",{className:de.badge,children:"Autocomplete"})]})]})})}import{isSmartSuggestion as Ia,isTraditionalAutocompleteSuggestion as Ta}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Ca}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,
1485
+ `,document.head.appendChild(e)}var he={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 Ue,jsxs as ct}from"react/jsx-runtime";function Rt({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:t=ka()}){let{key:a,hint:o}=ya(e,n,t),[r,i]=Sa(va);return Ca(()=>{i(xa())},[]),Ue("footer",{className:he.footer,"data-aia-footer":"",children:ct(We,{justify:"between",noWrap:!0,className:he.row,children:[ct(We,{gap:"5px",className:he.hintGroup,children:[Ue("kbd",{className:he.key,children:a}),Ue("span",{className:he.hint,children:o})]}),ct("a",{className:he.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[Ue("span",{className:he.brand,children:"AI"}),Ue("span",{className:he.badge,children:"Autocomplete"})]})]})})}import{isSmartSuggestion as Ea,isTraditionalAutocompleteSuggestion as Aa}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Pa}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,
1486
1486
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1487
1487
  The border is kept as a 1px transparent line so the box stays the same size
1488
1488
  as it was when the outline was dashed. */
@@ -1662,7 +1662,7 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
1662
1662
  opacity: 0;
1663
1663
  }
1664
1664
  }
1665
- `,document.head.appendChild(e)}var ie={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 Sa,jsx as lt,jsxs as Pa}from"react/jsx-runtime";var dt={selected:1,first:.7,next:.4,last:.2};function At({label:e,state:n,rounded:t,loading:i,smartSuggestion:o,completionHeader:r,onClick:a}){let c=[ie.pill,t?ie.rounded:"",i?ie.skeleton:""].filter(Boolean).join(" ");return lt("button",{type:"button","data-aia-pill":"","data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":o?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:c,style:{opacity:dt[n]},onMouseDown:s=>s.preventDefault(),onClick:i?void 0:a,disabled:i,children:o?Pa(Sa,{children:[lt("span",{className:`${ie.smartText} magicx-aia-smart-suggestion-text`,children:e}),lt("span",{className:`${ie.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Ca}})]}):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 {
1665
+ `,document.head.appendChild(e)}var re={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 Ta,jsx as pt,jsxs as Ia}from"react/jsx-runtime";var ht={selected:1,first:.7,next:.4,last:.2};function Dt({label:e,state:n,rounded:t,loading:a,smartSuggestion:o,completionHeader:r,onClick:i}){let p=[re.pill,t?re.rounded:"",a?re.skeleton:""].filter(Boolean).join(" ");return pt("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:p,style:{opacity:ht[n]},onMouseDown:u=>u.preventDefault(),onClick:a?void 0:i,disabled:a,children:o?Ia(Ta,{children:[pt("span",{className:`${re.smartText} magicx-aia-smart-suggestion-text`,children:e}),pt("span",{className:`${re.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Pa}})]}):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 {
1666
1666
  position: relative;
1667
1667
  z-index: 1;
1668
1668
  pointer-events: auto;
@@ -1672,7 +1672,7 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
1672
1672
  align-items: center;
1673
1673
  vertical-align: middle;
1674
1674
  }
1675
- `,document.head.appendChild(e)}var ct={list:"aia-list-qvLqO"};import{jsx as Ze}from"react/jsx-runtime";var Ea=[125,69];function Rt(e){return e===0?"first":e===1?"next":"last"}function $e({pills:e,activePillIndex:n,onSelectPill:t,activeSelected:i,rounded:o,loading:r}){return r&&e.length===0?Ze("span",{className:ct.list,"data-aia-pill-list-loading":"",children:Ea.map((a,c)=>Ze("span",{"data-aia-pill-skeleton":"",className:`${ie.pill} ${o?ie.rounded:""} ${ie.skeleton}`,style:{width:a,opacity:dt[Rt(c)]}},`skel-${a}`))}):Ze("span",{className:ct.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((a,c)=>{let s=!!i&&c===n;return Ze(At,{label:a.text,state:s?"selected":Rt(c),selected:s,rounded:o,loading:r,smartSuggestion:Ia(a),completionHeader:Ta(a),onClick:()=>t(c)},`${a.parameter}-${a.text}`)})})}import{attachProductRowWheel as Aa,productImageSources as Ra,productImageSrc as Oa,productInitial as Da,uiStringsFor as La}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as za,useRef as Ma,useState as Ot}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
1675
+ `,document.head.appendChild(e)}var ut={list:"aia-list-qvLqO"};import{jsx as Xe}from"react/jsx-runtime";var Ra=[125,69];function Ot(e){return e===0?"first":e===1?"next":"last"}function Je({pills:e,activePillIndex:n,onSelectPill:t,activeSelected:a,rounded:o,loading:r}){return r&&e.length===0?Xe("span",{className:ut.list,"data-aia-pill-list-loading":"",children:Ra.map((i,p)=>Xe("span",{"data-aia-pill-skeleton":"",className:`${re.pill} ${o?re.rounded:""} ${re.skeleton}`,style:{width:i,opacity:ht[Ot(p)]}},`skel-${i}`))}):Xe("span",{className:ut.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((i,p)=>{let u=!!a&&p===n;return Xe(Dt,{label:i.text,state:u?"selected":Ot(p),selected:u,rounded:o,loading:r,smartSuggestion:Ea(i),completionHeader:Aa(i),onClick:()=>t(p)},`${i.parameter}-${i.text}`)})})}import{attachProductRowWheel as Da,productImageSources as Oa,productImageSrc as La,productInitial as za,productPhotoFill as Ma,uiStringsFor as Na}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as mt,useRef as _e,useState as et}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
1676
1676
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1677
1677
  theming one package sees the same result in the other.
1678
1678
 
@@ -1911,6 +1911,101 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
1911
1911
  pointer-events: none;
1912
1912
  }
1913
1913
 
1914
+ /* Add-to-cart button (\`onProductAddToCart\`). A child of the card, lifted
1915
+ over the bottom right corner of the square media tile: the tile starts
1916
+ below the card's 6px padding and is the card's width less both paddings
1917
+ wide, so its bottom edge is the card width less 6px down, and the button
1918
+ sits 6px inside that corner. A light disc with a dark glyph, like the
1919
+ sold-out chip, reads on any photo; a store's accent goes in through the
1920
+ tokens. */
1921
+ .aia-cart-kSlqU {
1922
+ position: absolute;
1923
+ /* The tile's corner moved in by the margin a photo leaves when it doesn't
1924
+ fill the square (--aia-product-photo-fill-x / -y, set on the card when
1925
+ the photo loads; 1, the tile's own corner, until then). */
1926
+ top: calc(
1927
+ var(--aia-product-card-width, 116px) -
1928
+ 12px -
1929
+ var(--aia-product-cart-size, 28px) -
1930
+ (var(--aia-product-card-width, 116px) - 12px) *
1931
+ (1 - var(--aia-product-photo-fill-y, 1)) /
1932
+ 2
1933
+ );
1934
+ right: calc(
1935
+ 12px +
1936
+ (var(--aia-product-card-width, 116px) - 12px) *
1937
+ (1 - var(--aia-product-photo-fill-x, 1)) /
1938
+ 2
1939
+ );
1940
+ display: flex;
1941
+ align-items: center;
1942
+ justify-content: center;
1943
+ width: var(--aia-product-cart-size, 28px);
1944
+ height: var(--aia-product-cart-size, 28px);
1945
+ border-radius: 999px;
1946
+ background: var(--aia-product-cart-bg, rgba(255, 255, 255, 0.94));
1947
+ color: var(--aia-product-cart-color, #1f2328);
1948
+ box-shadow:
1949
+ 0 0 0 1px rgba(0, 0, 0, 0.08),
1950
+ 0 1px 3px rgba(0, 0, 0, 0.22);
1951
+ cursor: pointer;
1952
+ transition:
1953
+ transform 150ms ease,
1954
+ opacity 150ms ease;
1955
+ }
1956
+
1957
+ .aia-cart-kSlqU:hover {
1958
+ transform: scale(1.08);
1959
+ }
1960
+
1961
+ .aia-cart-kSlqU:focus-visible {
1962
+ outline: 2px solid var(--aia-product-focus-ring, var(--aia-option-color-selected, currentColor));
1963
+ outline-offset: 2px;
1964
+ }
1965
+
1966
+ .aia-cart-kSlqU svg {
1967
+ display: block;
1968
+ width: 16px;
1969
+ height: 16px;
1970
+ fill: none;
1971
+ stroke: currentColor;
1972
+ stroke-width: 2;
1973
+ stroke-linecap: round;
1974
+ stroke-linejoin: round;
1975
+ }
1976
+
1977
+ /* The glyph's shapes carry no paint attributes of their own, so a page's
1978
+ \`path { \u2026 }\` / \`circle { \u2026 }\` would beat what they inherit from the svg;
1979
+ pin it by class, like the submit arrow's. */
1980
+ .aia-cart-kSlqU svg path {
1981
+ fill: none;
1982
+ stroke: currentColor;
1983
+ }
1984
+
1985
+ .aia-cart-kSlqU svg circle {
1986
+ fill: none;
1987
+ stroke: currentColor;
1988
+ }
1989
+
1990
+ .aia-cartCheck-YTTQ6 {
1991
+ display: none;
1992
+ }
1993
+
1994
+ /* While the integration's promise is in flight the button dims and ignores
1995
+ presses; once it resolves the cart turns into a check for a moment. */
1996
+ .aia-cart-kSlqU[data-aia-cart-state="adding"] {
1997
+ opacity: 0.6;
1998
+ cursor: progress;
1999
+ }
2000
+
2001
+ .aia-cart-kSlqU[data-aia-cart-state="added"] .aia-cartGlyph-cmqAk {
2002
+ display: none;
2003
+ }
2004
+
2005
+ .aia-cart-kSlqU[data-aia-cart-state="added"] .aia-cartCheck-YTTQ6 {
2006
+ display: inline;
2007
+ }
2008
+
1914
2009
  /* A sold-out product's image steps back, so the badge is not the only cue.
1915
2010
  Desaturated rather than faded: opacity lets the panel show through, which
1916
2011
  muddies a photo on a dark surface. */
@@ -1975,7 +2070,23 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
1975
2070
  letter-spacing: 0.02em;
1976
2071
  text-align: center;
1977
2072
  }
1978
- `,document.head.appendChild(e)}var j={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",badge:"aia-badge-j9Hcd"};import{jsx as ce,jsxs as Xe}from"react/jsx-runtime";function Dt({products:e,listboxId:n,onSelect:t,onFocusChange:i,focusable:o=!0,layout:r="row",imageFallback:a="image",strings:c=La()}){let s=e.length>0,m=Ma(null);if(za(()=>{let P=m.current;if(!(!s||!P))return Aa(P)},[s]),!s)return null;let y=`${n}-products-label`;return Xe("section",{className:j.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":y,children:[ce("div",{className:j.label,id:y,"data-aia-products-label":"",children:c.products}),ce("div",{ref:m,className:j.row,"data-aia-products-row":"",children:e.map((P,f)=>ce(Na,{product:P,id:`${n}-product-${f}`,onSelect:t,onFocusChange:i,focusable:o,imageFallback:a,soldOut:c.soldOut},P.id))})]})}function Na({product:e,id:n,onSelect:t,onFocusChange:i,focusable:o,imageFallback:r,soldOut:a}){let c=s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.button!==0||(s.preventDefault(),t(e))};return Xe("a",{id:n,className:j.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,role:"option","aria-selected":!1,href:e.url,tabIndex:o?0:-1,onClick:c,onKeyDown:s=>{s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),t(e))},onFocus:()=>i?.(!0),onBlur:s=>{s.relatedTarget?.closest("[data-aia-dropdown]")||i?.(!1)},children:[ce(Fa,{sources:Ra(e.imageUrl),title:e.title,fallback:r},Oa(e.imageUrl)??""),Xe("span",{className:j.body,children:[e.vendor?ce("span",{className:j.vendor,children:e.vendor}):null,ce("span",{className:j.title,children:e.title}),e.price?ce("span",{className:j.price,children:e.price}):null,e.available===!1?ce("span",{className:j.badge,children:a}):null]})]})}function Fa({sources:e,title:n,fallback:t}){let[i,o]=Ot(0),r=e[i],a=!!r,[c,s]=Ot(null),m=!a&&t==="initial";return Xe("span",{className:j.media,"aria-hidden":"true","data-aia-product-placeholder":!a&&!m?"":void 0,"data-aia-product-initial":m?"":void 0,"data-aia-image-loaded":a&&c===r?"":void 0,children:[a?ce("img",{className:j.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:()=>s(r),onError:()=>o(y=>y+1)}):null,m?Da(n):null]})}import{isOptionsGridMobileViewport as $a,measureOptionsGrid as Xa,needsOptionsGridMeasurement as Ja,OPTIONS_GRID_MOBILE_QUERY as ei,optionEnterDelayMs as ti,optionsShowLeadingVisuals as ai,planOptionsGrid as Nt,sameOptionRows as ii}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as oi,useLayoutEffect as ni,useRef as Ft,useState as Bt}from"react";import{optionsGridTemplateColumns as Ha}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Ba,useRef as Ka}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 {
2073
+
2074
+ /* In a list the button rides the row's right end, centred, and the text
2075
+ column stops short of it. */
2076
+ .aia-section-Hugfg[data-aia-products-layout="list"] .aia-cart-kSlqU {
2077
+ top: 50%;
2078
+ right: 8px;
2079
+ transform: translateY(-50%);
2080
+ }
2081
+
2082
+ .aia-section-Hugfg[data-aia-products-layout="list"] .aia-cart-kSlqU:hover {
2083
+ transform: translateY(-50%) scale(1.08);
2084
+ }
2085
+
2086
+ .aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT[data-aia-product-has-cart] {
2087
+ padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
2088
+ }
2089
+ `,document.head.appendChild(e)}var F={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",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk"};import{jsx as K,jsxs as je}from"react/jsx-runtime";function Lt({products:e,listboxId:n,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r=!0,layout:i="row",imageFallback:p="image",strings:u=Na()}){let m=e.length>0,b=_e(null);if(mt(()=>{let l=b.current;if(!(!m||!l))return Da(l)},[m]),!m)return null;let k=`${n}-products-label`;return je("section",{className:F.section,"data-aia-products":"","data-aia-products-layout":i,role:"group","aria-labelledby":k,children:[K("div",{className:F.label,id:k,"data-aia-products-label":"",children:u.products}),K("div",{ref:b,className:F.row,"data-aia-products-row":"",children:e.map((l,w)=>K(Fa,{product:l,id:`${n}-product-${w}`,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:p,soldOut:u.soldOut,addToCart:u.addToCart},l.id))})]})}function Fa({product:e,id:n,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:i,soldOut:p,addToCart:u}){let m=!!a&&e.available!==!1,[b,k]=et(null),l=s=>{s.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},w=s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.button!==0||(s.preventDefault(),t(e))};return je("a",{id:n,className:F.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":m?"":void 0,role:"option","aria-selected":!1,style:b?{"--aia-product-photo-fill-x":String(b.x),"--aia-product-photo-fill-y":String(b.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:w,onKeyDown:s=>{s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:l,children:[K(Ga,{sources:Oa(e.imageUrl),title:e.title,fallback:i,onPhotoFill:k},La(e.imageUrl)??""),je("span",{className:F.body,children:[e.vendor?K("span",{className:F.vendor,children:e.vendor}):null,K("span",{className:F.title,children:e.title}),e.price?K("span",{className:F.price,children:e.price}):null,e.available===!1?K("span",{className:F.badge,children:p}):null]}),m&&a?K(Ba,{product:e,label:`${u}: ${e.title}`,focusable:r,onAddToCart:a,onFocus:()=>o?.(!0),onBlur:l}):null]})}var Ha=1500;function Ba({product:e,label:n,focusable:t,onAddToCart:a,onFocus:o,onBlur:r}){let[i,p]=et(null),u=_e(null),m=_e(e);m.current=e;let b=_e(void 0),k=_e(!0);mt(()=>(k.current=!0,()=>{k.current=!1,clearTimeout(b.current)}),[]);let l=s=>{u.current=s,k.current&&p(s)},w=s=>{if(s.preventDefault(),s.stopPropagation(),u.current==="adding")return;clearTimeout(b.current),l("adding");let T;try{T=Promise.resolve(a(m.current))}catch(D){T=Promise.reject(D)}T.then(()=>{l("added"),b.current=setTimeout(()=>l(null),Ha)},()=>l(null))};return K("span",{className:F.cart,"data-aia-product-cart":"","data-aia-cart-state":i??void 0,"aria-busy":i==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:t?0:-1,onClick:w,onKeyDown:s=>{s.key!=="Enter"&&s.key!==" "||w(s)},onFocus:s=>{s.stopPropagation(),o()},onBlur:s=>{s.stopPropagation(),r(s)},children:je("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[K("path",{className:F.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"}),K("path",{className:F.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),K("path",{className:F.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),K("circle",{className:F.cartGlyph,cx:"9",cy:"20",r:"1.3"}),K("circle",{className:F.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ga({sources:e,title:n,fallback:t,onPhotoFill:a}){let[o,r]=et(0),i=e[o],p=!!i,[u,m]=et(null),b=!p&&t==="initial";return mt(()=>()=>a(null),[a]),je("span",{className:F.media,"aria-hidden":"true","data-aia-product-placeholder":!p&&!b?"":void 0,"data-aia-product-initial":b?"":void 0,"data-aia-image-loaded":p&&u===i?"":void 0,children:[p?K("img",{className:F.image,src:i,alt:"",loading:"lazy",decoding:"async",onLoad:k=>{m(i),a(Ma(k.currentTarget.naturalWidth,k.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&a(null),r(k=>k+1)}}):null,b?za(n):null]})}import{isOptionsGridMobileViewport as ei,measureOptionsGrid as ti,needsOptionsGridMeasurement as ai,OPTIONS_GRID_MOBILE_QUERY as ii,optionEnterDelayMs as oi,optionsShowLeadingVisuals as ni,planOptionsGrid as Ft,sameOptionRows as ri}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as si,useLayoutEffect as li,useRef as Ht,useState as Gt}from"react";import{optionsGridTemplateColumns as Ka}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as qa,useRef as Wa}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 {
1979
2090
  display: grid;
1980
2091
  grid-template-columns: repeat(
1981
2092
  auto-fit,
@@ -2011,7 +2122,7 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
2011
2122
  .aia-grid[data-scroll]::-webkit-scrollbar {
2012
2123
  display: none;
2013
2124
  }
2014
- `,document.head.appendChild(e)}import{jsx as Ga}from"react/jsx-runtime";function Lt({min:e="16rem",max:n,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:r,cols:a,template:c,innerRef:s,className:m,children:y,...P}){let f=Ka(null);Ba(()=>{if(r===void 0)return;let I=f.current;I&&(I.scrollTop=0)},[r]);let v={"--aia-grid-min":e};return n&&(v["--aia-grid-max"]=n),t&&(v["--aia-grid-gap"]=t),o&&(v["--aia-grid-max-height"]=o),a&&(v.gridTemplateColumns=Ha(a)),c&&(v.gridTemplateColumns=c),Ga("div",{ref:I=>{f.current=I,s?.(I)},className:m?`aia-grid ${m}`:"aia-grid","data-scroll":i||void 0,style:v,...P,children:y})}import{formatOptionCount as Wa,highlightParts as _a,OPTION_ENTER_DELAY_VAR as qa,optionImageSources as Ua,optionLabel as zt,sanitizeOptionIconSvg as Va}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ja,useMemo as Ya,useRef as Qa,useState as Je}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 {
2125
+ `,document.head.appendChild(e)}import{jsx as Ua}from"react/jsx-runtime";function zt({min:e="16rem",max:n,gap:t,scroll:a=!1,maxHeight:o,scrollResetKey:r,cols:i,template:p,innerRef:u,className:m,children:b,...k}){let l=Wa(null);qa(()=>{if(r===void 0)return;let s=l.current;s&&(s.scrollTop=0)},[r]);let w={"--aia-grid-min":e};return n&&(w["--aia-grid-max"]=n),t&&(w["--aia-grid-gap"]=t),o&&(w["--aia-grid-max-height"]=o),i&&(w.gridTemplateColumns=Ka(i)),p&&(w.gridTemplateColumns=p),Ua("div",{ref:s=>{l.current=s,u?.(s)},className:m?`aia-grid ${m}`:"aia-grid","data-scroll":a||void 0,style:w,...k,children:b})}import{formatOptionCount as _a,highlightParts as ja,OPTION_ENTER_DELAY_VAR as Va,optionImageSources as Ya,optionLabel as Mt,sanitizeOptionIconSvg as Qa}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as $a,useMemo as Za,useRef as Xa,useState as tt}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 {
2015
2126
  position: relative;
2016
2127
  /* Clip, not visible: the entrance rise below runs on the inner content,
2017
2128
  and a transformed box extends its scroll container's scrollable area.
@@ -2469,7 +2580,7 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
2469
2580
  opacity: 0;
2470
2581
  }
2471
2582
  }
2472
- `,document.head.appendChild(e)}var G={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",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"};import{Fragment as Za,jsx as Se,jsxs as pt}from"react/jsx-runtime";function Mt({option:e,isHighlighted:n,onSelect:t,onHighlight:i,onUnhighlight:o,id:r,loading:a,showIcon:c=!0,showImage:s=!0,showCount:m=!0,scrollHint:y,enterDelayMs:P=0}){let[f]=Je(P),[v,I]=Je(!1),T=s?Ua(e.image_url):[],z=T[0]??null,[K,W]=Je([]),S=T.find(E=>!K.includes(E))??null,[O,M]=Je(null),k=Ya(()=>!z&&c&&e.icon_svg?Va(e.icon_svg):null,[z,c,e.icon_svg]),_=m?Wa(e.item_count):null,F=Qa(void 0);ja(()=>()=>clearTimeout(F.current),[]);let H=()=>{a||!e.is_tappable||v||(I(!0),t(e),clearTimeout(F.current),F.current=setTimeout(()=>I(!1),170))},Q=[G.item,n&&!a?G.highlighted:"",e.is_tappable?G.tappable:G.nonTappable,v?G.pressed:"",y?G.scrollHint:""].filter(Boolean).join(" ");return Se("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":a?"":void 0,"data-aia-icon":k&&e.icon?e.icon:void 0,"data-aia-image":z?"":void 0,"data-aia-item-count":_!==null?e.item_count:void 0,"aria-selected":n,className:Q,style:{[qa]:`${f}ms`},tabIndex:a||!e.is_tappable?-1:0,onClick:H,onKeyDown:E=>{!a&&e.is_tappable&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),H())},onMouseEnter:!a&&e.is_tappable?i:void 0,onMouseLeave:o,children:pt("span",{className:G.content,children:[z&&Se("span",{className:`${G.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":S!==null&&O===S?"":void 0,children:Se("img",{src:S??z,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:S===null,onLoad:()=>M(S),onError:()=>{S!==null&&W(E=>[...E,S])}})}),k&&Se("span",{className:`${G.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:k}}),pt("span",{className:G.text,children:[e.matchedText?_a(zt(e),e.matchedText).map((E,q)=>E.bold?Se("strong",{className:`${G.match} magicx-aia-option-match`,children:E.text},q):E.text):zt(e),e.parameterLabel&&pt(Za,{children:[" ",Se("span",{className:`${G.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&Se("span",{className:G.tag,children:e.tag}),_!==null&&Se("span",{className:`${G.count} magicx-aia-option-count`,children:_})]})})}import{jsx as Ht}from"react/jsx-runtime";function ri(){let[e,n]=Bt($a);return oi(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(ei),i=()=>n(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function Kt({options:e,activeIndex:n,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:a,groupKey:c="",optionsPosition:s="below",showIcons:m=!0,showImages:y=!0,showCounts:P=!0}){let f=ri(),v=Ft(null),[I,T]=Bt(null),z=Ft(null);ni(()=>{if(a&&ii(z.current,e))return;z.current=a?null:e;let S=v.current,M=S&&!a&&Ja(e.length,f)?Xa(S):null;T(M?Nt(e.length,f,M.rowWidths,M.gridWidth):null)},[e,f,a]);let K=I??Nt(e.length,f,null,null),W=ai(e,m,y);return Ht(Lt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:c,template:K.template,maxHeight:K.maxHeight,innerRef:S=>{v.current=S},"data-aia-group":c,children:e.map((S,O)=>Ht(Mt,{option:S,isHighlighted:O===n,onSelect:t,onHighlight:()=>i(O),onUnhighlight:o?()=>o(O):void 0,id:`${r}-option-${O}`,loading:a,showIcon:m&&W,showImage:y&&W,showCount:P,scrollHint:!a&&K.scrollHintIndices.includes(O),enterDelayMs:a?0:ti(O,K.cols,e.length,s)},`${c}\0${S.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
2583
+ `,document.head.appendChild(e)}var W={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",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"};import{Fragment as Ja,jsx as Ce,jsxs as gt}from"react/jsx-runtime";function Nt({option:e,isHighlighted:n,onSelect:t,onHighlight:a,onUnhighlight:o,id:r,loading:i,showIcon:p=!0,showImage:u=!0,showCount:m=!0,scrollHint:b,enterDelayMs:k=0}){let[l]=tt(k),[w,s]=tt(!1),T=u?Ya(e.image_url):[],D=T[0]??null,[q,U]=tt([]),I=T.find(R=>!q.includes(R))??null,[O,M]=tt(null),S=Za(()=>!D&&p&&e.icon_svg?Qa(e.icon_svg):null,[D,p,e.icon_svg]),_=m?_a(e.item_count):null,H=Xa(void 0);$a(()=>()=>clearTimeout(H.current),[]);let G=()=>{i||!e.is_tappable||w||(s(!0),t(e),clearTimeout(H.current),H.current=setTimeout(()=>s(!1),170))},X=[W.item,n&&!i?W.highlighted:"",e.is_tappable?W.tappable:W.nonTappable,w?W.pressed:"",b?W.scrollHint:""].filter(Boolean).join(" ");return Ce("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":i?"":void 0,"data-aia-icon":S&&e.icon?e.icon:void 0,"data-aia-image":D?"":void 0,"data-aia-item-count":_!==null?e.item_count:void 0,"aria-selected":n,className:X,style:{[Va]:`${l}ms`},tabIndex:i||!e.is_tappable?-1:0,onClick:G,onKeyDown:R=>{!i&&e.is_tappable&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),G())},onMouseEnter:!i&&e.is_tappable?a:void 0,onMouseLeave:o,children:gt("span",{className:W.content,children:[D&&Ce("span",{className:`${W.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":I!==null&&O===I?"":void 0,children:Ce("img",{src:I??D,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:I===null,onLoad:()=>M(I),onError:()=>{I!==null&&U(R=>[...R,I])}})}),S&&Ce("span",{className:`${W.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:S}}),gt("span",{className:W.text,children:[e.matchedText?ja(Mt(e),e.matchedText).map((R,j)=>R.bold?Ce("strong",{className:`${W.match} magicx-aia-option-match`,children:R.text},j):R.text):Mt(e),e.parameterLabel&&gt(Ja,{children:[" ",Ce("span",{className:`${W.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&Ce("span",{className:W.tag,children:e.tag}),_!==null&&Ce("span",{className:`${W.count} magicx-aia-option-count`,children:_})]})})}import{jsx as Bt}from"react/jsx-runtime";function di(){let[e,n]=Gt(ei);return si(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(ii),a=()=>n(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function Kt({options:e,activeIndex:n,onSelect:t,onHighlight:a,onUnhighlight:o,listboxId:r,loading:i,groupKey:p="",optionsPosition:u="below",showIcons:m=!0,showImages:b=!0,showCounts:k=!0}){let l=di(),w=Ht(null),[s,T]=Gt(null),D=Ht(null);li(()=>{if(i&&ri(D.current,e))return;D.current=i?null:e;let I=w.current,M=I&&!i&&ai(e.length,l)?ti(I):null;T(M?Ft(e.length,l,M.rowWidths,M.gridWidth):null)},[e,l,i]);let q=s??Ft(e.length,l,null,null),U=ni(e,m,b);return Bt(zt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:p,template:q.template,maxHeight:q.maxHeight,innerRef:I=>{w.current=I},"data-aia-group":p,children:e.map((I,O)=>Bt(Nt,{option:I,isHighlighted:O===n,onSelect:t,onHighlight:()=>a(O),onUnhighlight:o?()=>o(O):void 0,id:`${r}-option-${O}`,loading:i,showIcon:m&&U,showImage:b&&U,showCount:k,scrollHint:!i&&q.scrollHintIndices.includes(O),enterDelayMs:i?0:oi(O,q.cols,e.length,u)},`${p}\0${I.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
2473
2584
  display: flex;
2474
2585
  flex-direction: column;
2475
2586
  gap: var(--aia-stack-space, 0.5rem);
@@ -2484,7 +2595,7 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
2484
2595
  align-items: end;
2485
2596
  }
2486
2597
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
2487
- `,document.head.appendChild(e)}import{jsx as si}from"react/jsx-runtime";function Gt({space:e,align:n="stretch",className:t,children:i,...o}){let r=e?{"--aia-stack-space":e}:void 0;return si("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":n,style:r,...o,children:i})}import{jsx as Y,jsxs as ht}from"react/jsx-runtime";var fi=[159,119,164],bi=()=>{},Wt=()=>{};function wi(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=gi(n);if(Le(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>i(o.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function vi(e,n){let t=De(null);Le(()=>{let i=e.current,o=n.current;if(!i||!o)return;let r=i.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:li({dropdown:i,grid:r,button:o})};return}t.current?.controller.update()}),Le(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function xi(e,n){let t=De(n);t.current=n;let i=De(null);Le(()=>{let o=e.current;if(o){if(!i.current){i.current=di({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),Le(()=>()=>{i.current?.destroy(),i.current=null},[])}function ut({suggestions:e,activeIndex:n,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:r,id:a,className:c,pills:s,onPillClick:m,showPills:y=!0,onSkip:P,showSkipButton:f=!0,showOptionIcons:v=!0,showOptionImages:I=!0,showOptionCounts:T=!0,skipDisabled:z=!1,activeSelected:K=!1,isLoading:W=!1,skeletonExiting:S=!1,isInputEmpty:O=!1,language:M,products:k,onProductSelect:_,onProductFocusChange:F,productsLayout:H="row",productImageFallback:Q="image",formatType:E="options",dateView:q=null,selectedDateIso:oe=null,selectedDateRange:pe=null,dateRangeStart:Pe=null,onPreviousMonth:he,onNextMonth:u,optionsPosition:ue="below",mode:me}){let ne=wi(me),ge=ne!==void 0,V=De(null),re=De(null);vi(V,re),Le(()=>{if(V.current)return ci(V.current)},[]);let l=e[0]?.options??[],g=!!(s&&s.length>0&&m),b=!!(k&&k.length>0),w=r&&(l.length>0||y&&g||W||b);xi(V,w);let C={suggestions:e,activeIndex:n,pills:s,showPills:y,showSkipButton:f,showOptionIcons:v,showOptionImages:I,showOptionCounts:T,skipDisabled:z,activeSelected:K,isLoading:W,skeletonExiting:S,isInputEmpty:O,products:k,formatType:E,dateView:q,selectedDateIso:oe,selectedDateRange:pe,dateRangeStart:Pe},L=De(C);w&&(L.current=C);let p=w?C:L.current,N=mi(M),Z=p.suggestions[0],$=Z?.options??[],fe=p.activeIndex>=0&&!!$[p.activeIndex]?.is_tappable,X=ui(p.pills??[],N.keepTyping),be=!!(X.length>0&&m),we=p.showPills&&be,ve=p.showPills&&!be&&p.isLoading,xe=we||ve,x=be&&pi(X)&&p.showSkipButton&&!p.isInputEmpty&&!!P,ye=X[0]?.text,ke=hi(p.formatType)&&p.dateView!=null,se=$.length>0&&!ke,h=$.length>0&&ke&&!p.isLoading,Ae=p.isLoading&&!se&&!h,Re=p.products??[];return ht("div",{ref:V,id:a,role:"listbox","data-aia-dropdown":"","data-options-position":ue,"data-mode":ne,"data-aia-loading":p.isLoading?"":void 0,"data-aia-skeleton-exiting":p.skeletonExiting?"":void 0,"data-aia-has-products":Re.length>0?"":void 0,className:`${ge?"magicx-aia ":""}${le.dropdown} ${w?le.visible:""} ${c??""}`,onMouseDown:ee=>ee.preventDefault(),children:[ht(Gt,{space:"8px",children:[(xe||x)&&ht(Ge,{noWrap:!0,className:le.pillBar,"data-aia-pillbar":"",children:[xe&&Y("span",{className:le.pillScroll,"data-aia-pill-scroll":"",children:Y($e,{pills:X,activePillIndex:0,activeSelected:p.activeSelected,onSelectPill:m??(()=>{}),rounded:!0,loading:p.isLoading})}),x&&Y("button",{type:"button",tabIndex:-1,className:le.skip,"data-aia-skip":"",disabled:p.isLoading||p.skipDisabled,"aria-label":ye?`${N.skipLabel} ${ye}`:N.skipLabel,onClick:P,children:N.skip})]}),se&&Y(Kt,{options:$,activeIndex:p.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:a,loading:p.isLoading,groupKey:Z?`${Z.parameter} ${Z.text}`:"",optionsPosition:ue,showIcons:p.showOptionIcons,showImages:p.showOptionImages,showCounts:p.showOptionCounts}),h&&p.dateView&&Y(It,{options:$,activeIndex:p.activeIndex,listboxId:a,view:p.dateView,selection:{selectedIso:p.selectedDateIso??null,selectedRange:p.selectedDateRange??null,rangeStart:p.dateRangeStart??null},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:he??Wt,onNextMonth:u??Wt}),Ae&&Y("div",{className:le.skeletonBars,"data-aia-skeleton-bars":"",children:fi.map(ee=>Y("span",{className:le.skeletonBar,style:{width:ee}},`bar-${ee}`))}),Y(Dt,{products:Re,listboxId:a,onSelect:_??bi,onFocusChange:F,focusable:w,layout:H,imageFallback:Q,strings:N}),Y(Et,{isOptionHighlighted:fe,isInputEmpty:p.isInputEmpty,strings:N})]}),Y("button",{ref:re,type:"button",tabIndex:-1,className:le.scrollArrow,"data-aia-scroll-arrow":"","aria-label":N.scrollArrow,"aria-hidden":"true",children:Y("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:Y("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Ni,ModeController as Fi,setCursorOffset as Hi,uiStringsFor as Bi}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as yi}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 {
2598
+ `,document.head.appendChild(e)}import{jsx as ci}from"react/jsx-runtime";function qt({space:e,align:n="stretch",className:t,children:a,...o}){let r=e?{"--aia-stack-space":e}:void 0;return ci("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":n,style:r,...o,children:a})}import{jsx as Z,jsxs as ft}from"react/jsx-runtime";var vi=[159,119,164],xi=()=>{},Wt=()=>{};function yi(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=wi(n);if(Me(()=>{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 ki(e,n){let t=ze(null);Me(()=>{let a=e.current,o=n.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:pi({dropdown:a,grid:r,button:o})};return}t.current?.controller.update()}),Me(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ci(e,n){let t=ze(n);t.current=n;let a=ze(null);Me(()=>{let o=e.current;if(o){if(!a.current){a.current=hi({dropdown:o,isOpen:()=>t.current});return}a.current.update()}}),Me(()=>()=>{a.current?.destroy(),a.current=null},[])}function bt({suggestions:e,activeIndex:n,onSelect:t,onHighlight:a,onUnhighlight:o,isOpen:r,id:i,className:p,pills:u,onPillClick:m,showPills:b=!0,onSkip:k,showSkipButton:l=!0,showOptionIcons:w=!0,showOptionImages:s=!0,showOptionCounts:T=!0,skipDisabled:D=!1,activeSelected:q=!1,isLoading:U=!1,skeletonExiting:I=!1,isInputEmpty:O=!1,language:M,products:S,onProductSelect:_,onProductAddToCart:H,onProductFocusChange:G,productsLayout:X="row",productImageFallback:R="image",formatType:j="options",dateView:se=null,selectedDateIso:ue=null,selectedDateRange:le=null,dateRangeStart:Se=null,onPreviousMonth:me,onNextMonth:g,optionsPosition:ge="below",mode:fe}){let de=yi(fe),be=de!==void 0,$=ze(null),d=ze(null);ki($,d),Me(()=>{if($.current)return ui($.current)},[]);let v=e[0]?.options??[],y=!!(u&&u.length>0&&m),P=!!(S&&S.length>0),C=r&&(v.length>0||b&&y||U||P);Ci($,C);let L={suggestions:e,activeIndex:n,pills:u,showPills:b,showSkipButton:l,showOptionIcons:w,showOptionImages:s,showOptionCounts:T,skipDisabled:D,activeSelected:q,isLoading:U,skeletonExiting:I,isInputEmpty:O,products:S,formatType:j,dateView:se,selectedDateIso:ue,selectedDateRange:le,dateRangeStart:Se},Q=ze(L);C&&(Q.current=L);let h=C?L:Q.current,V=bi(M),ee=h.suggestions[0],te=ee?.options??[],Pe=h.activeIndex>=0&&!!te[h.activeIndex]?.is_tappable,ae=fi(h.pills??[],V.keepTyping),ie=!!(ae.length>0&&m),Te=h.showPills&&ie,ce=h.showPills&&!ie&&h.isLoading,we=Te||ce,ve=ie&&mi(ae)&&h.showSkipButton&&!h.isInputEmpty&&!!k,x=ae[0]?.text,Re=gi(h.formatType)&&h.dateView!=null,De=te.length>0&&!Re,oe=te.length>0&&Re&&!h.isLoading,f=h.isLoading&&!De&&!oe,xe=h.products??[];return ft("div",{ref:$,id:i,role:"listbox","data-aia-dropdown":"","data-options-position":ge,"data-mode":de,"data-aia-loading":h.isLoading?"":void 0,"data-aia-skeleton-exiting":h.skeletonExiting?"":void 0,"data-aia-has-products":xe.length>0?"":void 0,className:`${be?"magicx-aia ":""}${pe.dropdown} ${C?pe.visible:""} ${p??""}`,onMouseDown:ye=>ye.preventDefault(),children:[ft(qt,{space:"8px",children:[(we||ve)&&ft(We,{noWrap:!0,className:pe.pillBar,"data-aia-pillbar":"",children:[we&&Z("span",{className:pe.pillScroll,"data-aia-pill-scroll":"",children:Z(Je,{pills:ae,activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:m??(()=>{}),rounded:!0,loading:h.isLoading})}),ve&&Z("button",{type:"button",tabIndex:-1,className:pe.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":x?`${V.skipLabel} ${x}`:V.skipLabel,onClick:k,children:V.skip})]}),De&&Z(Kt,{options:te,activeIndex:h.activeIndex,onSelect:t,onHighlight:a,onUnhighlight:o,listboxId:i,loading:h.isLoading,groupKey:ee?`${ee.parameter} ${ee.text}`:"",optionsPosition:ge,showIcons:h.showOptionIcons,showImages:h.showOptionImages,showCounts:h.showOptionCounts}),oe&&h.dateView&&Z(Et,{options:te,activeIndex:h.activeIndex,listboxId:i,view:h.dateView,selection:{selectedIso:h.selectedDateIso??null,selectedRange:h.selectedDateRange??null,rangeStart:h.dateRangeStart??null},onSelect:t,onHighlight:a,onUnhighlight:o,onPreviousMonth:me??Wt,onNextMonth:g??Wt}),f&&Z("div",{className:pe.skeletonBars,"data-aia-skeleton-bars":"",children:vi.map(ye=>Z("span",{className:pe.skeletonBar,style:{width:ye}},`bar-${ye}`))}),Z(Lt,{products:xe,listboxId:i,onSelect:_??xi,onAddToCart:H,onFocusChange:G,focusable:C,layout:X,imageFallback:R,strings:V}),Z(Rt,{isOptionHighlighted:Pe,isInputEmpty:h.isInputEmpty,strings:V})]}),Z("button",{ref:d,type:"button",tabIndex:-1,className:pe.scrollArrow,"data-aia-scroll-arrow":"","aria-label":V.scrollArrow,"aria-hidden":"true",children:Z("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:Z("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Hi,ModeController as Bi,setCursorOffset as Gi,uiStringsFor as Ki}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as Si}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 {
2488
2599
  flex-shrink: 0;
2489
2600
  width: 32px;
2490
2601
  height: 32px;
@@ -2537,5 +2648,5 @@ import{buildSubmitResult as Nn,cellDay as Fn,cellIso as Hn,DATE_RANGE_META_END a
2537
2648
  );
2538
2649
  cursor: default;
2539
2650
  }
2540
- `,document.head.appendChild(e)}var _t={submitButton:"aia-submitButton-otz7H"};import{jsx as mt}from"react/jsx-runtime";function qt({disabled:e,onClick:n,label:t=yi().submit}){return mt("button",{type:"button","data-aia-submit":"",className:_t.submitButton,disabled:e,onClick:i=>{i.stopPropagation(),n()},"aria-label":t,children:mt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:mt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as ki,dateSelectionFor as Ci,identifiedParamLabel as Si,withoutTraditionalAutocomplete as Pi}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Qt,useEffect as ze,useRef as B,useState as Ii}from"react";import{useRef as Ut}from"react";function Vt(e){let n=Ut(e);n.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=Ut({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let r of Object.keys(e??{})){let a=(c,s,m)=>{let y=n.current?.[r];return y?y(c,s,m):[]};o[r]=a}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}import{useRef as jt}from"react";function Yt(e){let n=jt(e);n.current=e;let t=jt(null);t.current===null&&(t.current={fetch:(o,r)=>{let a=n.current;return a?a.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var Ti={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,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};function gt({onSubmit:e,onResult:n,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:r,additionalContext:a,language:c,currency:s,productId:m,visitorId:y,columns:P=2,dropdownTrigger:f,optionsPosition:v,closeDropdownOnBlur:I,showNonTappableOptions:T,showOptionIcons:z,showOptionImages:K,showOptionCounts:W,showSkipButton:S,showProducts:O,productImageFallback:M="image",onFocus:k,onBlur:_,value:F,completedParams:H,onChange:Q,onParamsChange:E,products:q,mapProducts:oe,onProductSelect:pe,source:Pe,setCursor:he}){let u=B(null),[ue,me]=Ii(null),ne=B(e);ne.current=e;let ge=B(n);ge.current=n;let V=B(t);V.current=t;let re=B(Q);re.current=Q;let l=B(E);l.current=E;let g=B(k);g.current=k;let b=B(_);b.current=_;let w=B(he);w.current=he;let C=B(pe);C.current=pe;let L=B(y);L.current=y;let p=B(()=>{let d=L.current;return typeof d=="function"?d():d}).current,N=Yt(q),Z=B(oe);Z.current=oe;let $=B((d,U)=>{let A=Z.current;return A?A(d,U):d}).current,fe=oe?$:void 0,X=Vt(i);ze(()=>{if(typeof document>"u")return;let d=new ki(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:a,language:c,currency:s,productId:m,visitorId:p,optionOverrides:X.overrides,maskCompletedText:o,columns:P,dropdownTrigger:f,optionsPosition:v,closeDropdownOnBlur:I,showNonTappableOptions:T,showProducts:O,source:Pe,value:F,completedParams:H,onSubmit:(...A)=>ne.current?.(...A),onResult:(...A)=>ge.current?.(...A),onError:(...A)=>V.current?.(...A),onChange:(...A)=>re.current?.(...A),onParamsChange:(...A)=>l.current?.(...A),onFocus:()=>g.current?.(),onBlur:()=>b.current?.(),onProductSelect:A=>C.current?.(A),setCursor:A=>w.current?.(A),products:N.config,mapProducts:fe});u.current=d,me(d.getState());let U=d.subscribe(A=>me(A));return()=>{U(),d.destroy(),u.current===d&&(u.current=null)}},[]),ze(()=>{F!==void 0&&u.current?.setValue(F)},[F]),ze(()=>{H!==void 0&&u.current?.setCompletedParams(H)},[H]);let be=JSON.stringify(r??null),we;try{we=JSON.stringify(a??null)}catch{we="[unstringifiable]"}ze(()=>{u.current?.update({apiConfig:r,additionalContext:a,language:c,currency:s,productId:m,optionOverrides:X.overrides,dropdownTrigger:f,optionsPosition:v,closeDropdownOnBlur:I,showNonTappableOptions:T,showProducts:O})},[be,we,c,s?.code,s?.rate,s?.country,m,X.key,f,v,I,T,O]);let ve=B(!1);ze(()=>{if(!ve.current){ve.current=!0;return}u.current?.update({products:N.config})},[N.enabled]),ze(()=>{u.current?.update({mapProducts:fe})},[fe]);let xe=B(null);xe.current===null&&(xe.current={handleTextChange:d=>u.current?.handleTextChange(d),handleKeyDown:d=>{let U="nativeEvent"in d?d.nativeEvent:d;u.current?.handleKeyDown(U)},setFocused:d=>u.current?.setFocused(d),startEditingParam:d=>u.current?.startEditingParam(d),exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:d=>u.current?.handleCaretAfterInput(d),handleCaretMove:d=>u.current?.handleCaretMove(d),replaceEditingRange:d=>u.current?.replaceEditingRange(d)??!1,setActivePill:d=>u.current?.setActivePill(d),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),refreshProducts:()=>u.current?.refreshProducts(),recordSubmit:d=>u.current?.recordSubmit(d),selectOption:d=>u.current?.selectOption(d),selectProduct:d=>u.current?.selectProduct(d),setActiveDropdownIndex:d=>u.current?.setActiveDropdownIndex(d),clearHighlight:d=>u.current?.clearHighlight(d),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let x=xe.current,ye=Qt(d=>{let U=d.target.value,ot=U.length>0&&!d.nativeEvent?.isComposing&&U[0]!==U[0].toUpperCase()?U[0].toUpperCase()+U.slice(1):U;u.current?.handleTextChange(ot)},[]),ke=Qt(d=>{u.current?.handleKeyDown(d.nativeEvent)},[]),se=u.current,h=ue??Ti,Ae=F!==void 0?F:h.text,Re=H!==void 0?H:h.completedParams,ee=h.actionableSuggestions,Fe=ee[0],qe=Pi(ee),Ie=se?.listboxId??"",at=h.activeDropdownIndex>=0&&se?`${Ie}-option-${h.activeDropdownIndex}`:void 0,Ce=h.editingParam,Te=h.editingIdentified,He=Ce?{parameter:Ce.suggestionParameter,text:Ce.suggestionPlaceholder,required:!0,options:Ce.options}:Te?{parameter:Te.parameter,text:Si(Te.parameter),required:!0,options:[]}:null,Ue=h.dropdownSuggestion??He??Fe,it=He?[He]:ee,Be=Ci(h),Ve=!se||h.dropdownLoading;return{completedParams:Re,skippedParams:h.skippedParams,identifiedParams:h.identifiedParams,suggestionPills:qe,setActivePill:x.setActivePill,skipActivePill:x.skipActivePill,removeLastParam:x.removeLastParam,segments:h.segments,newParamId:h.newParamId,clearNewParamId:x.clearNewParamId,suggestions:h.suggestions,activeIndex:h.activeDropdownIndex,isReady:h.isReady,isLoading:Ve,isFocused:h.isFocused,isDropdownOpen:h.isDropdownOpen,isActivePillSelected:h.isActivePillSelected,placeholderText:h.placeholderText,listboxId:Ie,error:h.error,products:h.products,customFields:h.customFields,selectProduct:x.selectProduct,handleTextChange:x.handleTextChange,handleKeyDown:x.handleKeyDown,setFocused:x.setFocused,editingParam:Ce,editingIdentified:Te,editingAnchor:h.editingAnchor,caretOffset:h.caretOffset,startEditingParam:x.startEditingParam,exitEditMode:x.exitEditMode,handleCaretAfterInput:x.handleCaretAfterInput,handleCaretMove:x.handleCaretMove,replaceEditingRange:x.replaceEditingRange,inputProps:{value:Ae,placeholder:h.placeholderText||void 0,onChange:ye,onKeyDown:ke,onFocus:x.handleFocus,onBlur:x.handleBlur,role:"combobox","aria-expanded":h.isDropdownOpen,"aria-activedescendant":at,"aria-autocomplete":"list","aria-controls":Ie},reset:x.reset,refreshProducts:x.refreshProducts,recordSubmit:x.recordSubmit,dropdownProps:{suggestions:Ue?[{...Ue,options:h.dropdownOptions}]:[],activeIndex:h.activeDropdownIndex,onSelect:x.selectOption,onHighlight:x.setActiveDropdownIndex,onUnhighlight:x.clearHighlight,isOpen:h.isDropdownOpen,id:Ie,pills:it,activeSelected:h.isActivePillSelected,onPillClick:x.setActivePill,onSkip:x.skipActivePill,showSkipButton:(S??!0)&&!Ce&&!Te,showOptionIcons:z??!0,showOptionImages:K??!0,showOptionCounts:W??!0,skipDisabled:h.inSelectionAnimation,isLoading:Ve,skeletonExiting:h.skeletonExiting,isInputEmpty:Ae.trim().length===0,language:c,products:h.products,productImageFallback:M,onProductSelect:x.selectProduct,onProductFocusChange:x.setFocused,formatType:h.activeFormatType,dateView:h.dateView,selectedDateIso:Be.selectedIso,selectedDateRange:Be.selectedRange,dateRangeStart:Be.rangeStart,onPreviousMonth:x.showPreviousMonth,onNextMonth:x.showNextMonth,optionsPosition:v??"below"}}}import{chipIdFromTap as Ei,extractPlainText as Zt,getCursorOffset as $t,keepCaretOnChip as Ai,plainTextLength as Ri,renderEditableContent as Oi,setCursorOffset as Xt}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as J,useEffect as et,useLayoutEffect as ft,useRef as Me}from"react";var tt;function Di(){if(tt!==void 0)return tt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),tt=e.contentEditable==="plaintext-only",tt}function Jt(e){let{segments:n,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:r,editingIdentified:a,editingAnchor:c,caretOffset:s,placeholderText:m,isFocused:y,isDropdownOpen:P,listboxId:f,activeDescendantId:v,autoFocus:I,handleTextChange:T,handleKeyDown:z,handleCaretAfterInput:K,handleCaretMove:W,startEditingParam:S,replaceEditingRange:O,setFocused:M}=e,k=Me(null),_=Me(!1),F=Me(""),H=Me(""),Q=Me(null),E=Me(0);Q.current=s,et(()=>{if(!I)return;let l=k.current;if(!l)return;document.activeElement===l?M(!0):l.focus();let g=l.ownerDocument??document,b=g.getSelection(),w=b&&b.rangeCount>0&&l.contains(b.anchorNode);if(b&&!w){let C=g.createRange();C.selectNodeContents(l),C.collapse(!0),b.removeAllRanges(),b.addRange(C)}},[I,M]),et(()=>{let l=k.current;if(!l)return;let g=l.ownerDocument??document,b=()=>{let w=g.getSelection();if(!w||w.rangeCount===0||!w.anchorNode||!l.contains(w.anchorNode))return;let C=w.anchorNode,L=C.nodeType===Node.ELEMENT_NODE?C:C.parentElement,N=(w.isCollapsed?L?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Z=r?.id??a?.id??null;if(N&&N!==Z){S(N);return}performance.now()-E.current<50||W($t(l))};return g.addEventListener("selectionchange",b),()=>g.removeEventListener("selectionchange",b)},[r,a,S,W]),et(()=>{let l=k.current;if(!l)return;let g=b=>{let w=Ei(l,b.target);w&&(S(w),Ai(l,w))};return l.addEventListener("click",g),()=>l.removeEventListener("click",g)},[S]),ft(()=>{let l=k.current;l&&Oi({input:l,segments:n,newParamId:o,editingParamId:r?.id??null,placeholderText:m??"",isFocused:y,showChipIcons:t,showChipImages:i})},[n,o,r,m,y,t,i]),ft(()=>{let l=F.current,g=o??"";if(F.current=g,!g||g===l)return;let b=k.current;if(!b)return;b.focus();let w=Q.current??Ri(b);Xt(b,w)},[o]),ft(()=>{let l=H.current,g=r?.id??"";if(H.current=g,!g||g===l||c==null)return;let b=k.current;b&&Xt(b,c)},[r,c]);let q=J(()=>{if(_.current)return;let l=k.current;if(!l)return;let g=Zt(l),w=g.length>0&&g[0]!==g[0].toUpperCase()?g[0].toUpperCase()+g.slice(1):g;T(w)},[T]),oe=J(()=>{E.current=performance.now(),q();let l=k.current;l&&K($t(l))},[q,K]);et(()=>{let l=k.current;if(!l)return;let g=b=>{let w=b,C=w.inputType;if(C==="insertParagraph"||C==="insertLineBreak"||C==="insertFromDrop"){b.preventDefault();return}if(C.startsWith("insert")||C.startsWith("delete")){let L=C.startsWith("delete")?"":w.data??"";O(L)&&b.preventDefault()}};return l.addEventListener("beforeinput",g),()=>l.removeEventListener("beforeinput",g)},[O]);let pe=J(()=>{_.current=!0,k.current?.setAttribute("data-aia-composing","true")},[]),Pe=J(()=>{_.current=!1,k.current?.removeAttribute("data-aia-composing"),q()},[q]),he=J(l=>{l.preventDefault();let g=k.current;if(!g)return;let b=(l.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!b)return;let w=g.ownerDocument??document,C=w.getSelection();if(!C||C.rangeCount===0)return;let L=C.getRangeAt(0);if(!g.contains(L.startContainer))return;L.deleteContents();let p=w.createTextNode(b);L.insertNode(p),L.setStartAfter(p),L.collapse(!0),C.removeAllRanges(),C.addRange(L),q()},[q]),u=J(l=>z(l),[z]),ue=J(()=>M(!0),[M]),me=J(()=>M(!1),[M]),ne=J(()=>k.current?.focus(),[]),ge=J(()=>k.current?.blur(),[]),V=J(()=>{let l=k.current;return l?Zt(l):""},[]),re=Di()?"plaintext-only":"true";return{inputRef:k,editorProps:{ref:k,contentEditable:re,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":f,"aria-expanded":P,"aria-activedescendant":v,spellCheck:!0,enterKeyHint:"send",onInput:oe,onKeyDown:u,onCompositionStart:pe,onCompositionEnd:Pe,onPaste:he,onFocus:ue,onBlur:me},getPlainText:V,focus:ne,blur:ge}}import{jsx as Ne,jsxs as wt}from"react/jsx-runtime";function Ki(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Gi=Li(function({onSubmit:n,onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,className:a,apiConfig:c,additionalContext:s,language:m,currency:y,productId:P,visitorId:f,columns:v,pillPlacement:I="dropdown",mode:T="auto",optionsPosition:z="below",animations:K=!0,dropdownTrigger:W,closeDropdownOnBlur:S,showNonTappableOptions:O,showOptionIcons:M=!0,showChipIcons:k=!0,showChipImages:_=!0,showOptionImages:F=!0,showOptionCounts:H=!0,showSkipButton:Q,showProducts:E,productsLayout:q,productImageFallback:oe,autoFocus:pe=!0,onFocus:Pe,onBlur:he,value:u,completedParams:ue,onChange:me,onParamsChange:ne,products:ge,mapProducts:V,onProductSelect:re,submitButton:l,resetOnSubmit:g=!0},b){let w=_e(null),C=_e(null),L=_e(()=>{}),p=_e(null),N=_e(null);ea(()=>{let R=w.current;if(R)return p.current?p.current.setMode(T):p.current=new Fi(R,T),()=>{p.current?.destroy(),p.current=null}},[T]);let Z=bt(R=>{let te=N.current?.current;te&&(te.focus(),Hi(te,R))},[]),{completedParams:$,skippedParams:fe,identifiedParams:X,isReady:be,customFields:we,suggestionPills:ve,setActivePill:xe,skipActivePill:x,segments:ye,newParamId:ke,clearNewParamId:se,placeholderText:h,isFocused:Ae,isDropdownOpen:Re,isActivePillSelected:ee,isLoading:Fe,activeIndex:qe,listboxId:Ie,handleTextChange:at,handleKeyDown:Ce,setFocused:Te,editingParam:He,editingIdentified:Ue,editingAnchor:it,caretOffset:Be,startEditingParam:Ve,handleCaretAfterInput:d,handleCaretMove:U,replaceEditingRange:A,dropdownProps:ot,reset:je,refreshProducts:vt,recordSubmit:xt}=gt({onSubmit:R=>L.current(R),onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,apiConfig:c,additionalContext:s,language:m,currency:y,productId:P,visitorId:f,columns:v,dropdownTrigger:W,optionsPosition:z,closeDropdownOnBlur:S,showNonTappableOptions:O,showOptionIcons:M,showOptionImages:F,showOptionCounts:H,showSkipButton:Q,showProducts:E,onFocus:Pe,onBlur:he,value:u,completedParams:ue,onChange:me,onParamsChange:ne,products:ge,mapProducts:V,onProductSelect:re,source:"full-sdk",setCursor:Z});ea(()=>{if(!ke)return;let R=window.setTimeout(()=>se(),650);return()=>window.clearTimeout(R)},[ke,se]);let ta=qe>=0?`${Ie}-option-${qe}`:void 0,{inputRef:nt,editorProps:aa,focus:Ye,blur:yt,getPlainText:kt}=Jt({segments:ye,newParamId:ke,editingParam:He,editingIdentified:Ue,editingAnchor:it,caretOffset:Be,placeholderText:h,isFocused:Ae,showChipIcons:k,showChipImages:_,isDropdownOpen:Re,listboxId:Ie,activeDescendantId:ta,autoFocus:pe,handleTextChange:at,handleKeyDown:Ce,handleCaretAfterInput:d,handleCaretMove:U,startEditingParam:Ve,replaceEditingRange:A,setFocused:Te});N.current=nt,Mi(()=>{let R=C.current,te=nt.current;if(!R||!te)return;let Ke=()=>{let St=R.firstElementChild;if(!St)return;let ra=St.getBoundingClientRect(),sa=te.getBoundingClientRect();ra.top>=sa.bottom-2?R.setAttribute("data-aia-pill-wrapped",""):R.removeAttribute("data-aia-pill-wrapped")};Ke();let Ct=new ResizeObserver(Ke);return Ct.observe(te),()=>Ct.disconnect()},[ye,ve.length,Fe,nt]),zi(b,()=>({focus:Ye,blur:yt,reset:je,refreshProducts:vt,setMode:R=>p.current?.setMode(R),skipActivePill:x}),[Ye,yt,je,vt,x]);let Qe=!!ye.length||$.length>0,rt=bt(R=>{if(!Qe)return;let te=kt(),Ke=Ni(te,$,fe,{identifiedParams:X,isReady:be,customFields:we});R&&xt(Ke),n(Ke),g&&je()},[xt,g,Qe,$,fe,X,be,we,n,je,kt]);L.current=()=>rt(!1);let ia=bt(R=>{R.target?.closest("[data-aia-pill]")||Ye()},[Ye]),oa=I==="inline",na=I==="dropdown";return wt("div",{ref:w,className:`magicx-aia ${Ee.container} ${a??""}`,"data-pill-placement":I,"data-options-position":z,"data-animations":K?"on":"off","data-mode":Ki(T),children:[Ne(ut,{...ot,showPills:na,productsLayout:q,productImageFallback:oe}),wt("div",{className:Ee.inputWrapper,"data-aia-input-wrapper":"",onClick:ia,children:[wt("div",{className:Ee.editorArea,"data-aia-editor":"",children:[Ne("div",{...aa,className:Ee.input,"data-aia-input":""}),oa&&(Fe||ve.length>0)&&Ne("span",{ref:C,className:Ee.pillListContainer,"data-aia-pill-list-container":"",children:Ne($e,{pills:ve,activePillIndex:0,activeSelected:ee,onSelectPill:xe,loading:Fe})})]}),l===null?null:l===void 0?Ne(qt,{disabled:!Qe,onClick:()=>rt(!0),label:Bi(m).submit}):Ne("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ee.submitSlot,onClick:R=>{Qe&&(R.stopPropagation(),rt(!0))},children:l})]})]})});export{Gi as AIAutocomplete,ut as AIAutocompleteDropdown,Bn as DATE_RANGE_META_END,Kn as DATE_RANGE_META_START,Gn as DEFAULT_OPTION_COUNT_UNIT,er as PRODUCT_PATH_PREFIX,cr as WEEKDAY_LABELS,Nn as buildSubmitResult,Fn as cellDay,Hn as cellIso,Wn as dateCellMarks,_n as formatDate,qn as formatDateRange,Un as formatOptionCount,Vn as isoDate,jn as monthLabel,Yn as optionCountLabel,Qn as optionHasImage,Zn as optionImageSources,$n as optionImageSrc,Xn as optionLabel,Jn as optionsShowLeadingVisuals,tr as parseDate,ar as parseLooseDate,ir as parseLooseDateRange,or as productFromMatchedItem,nr as productImageSources,rr as productsFromCustomFields,sr as sanitizeOptionIconSvg,lr as selectedRangeFor,gt as useAIAutocomplete,dr as visibleDateRange,pr as withSkippedParams};
2651
+ `,document.head.appendChild(e)}var Ut={submitButton:"aia-submitButton-otz7H"};import{jsx as wt}from"react/jsx-runtime";function _t({disabled:e,onClick:n,label:t=Si().submit}){return wt("button",{type:"button","data-aia-submit":"",className:Ut.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),n()},"aria-label":t,children:wt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:wt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Pi,dateSelectionFor as Ti,identifiedParamLabel as Ii,withoutTraditionalAutocomplete as Ei}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as $t,useEffect as Ne,useRef as B,useState as Ai}from"react";import{useRef as jt}from"react";function Vt(e){let n=jt(e);n.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=jt({key:"",overrides:void 0});if(a.current.key!==t){let o={};for(let r of Object.keys(e??{})){let i=(p,u,m)=>{let b=n.current?.[r];return b?b(p,u,m):[]};o[r]=i}a.current={key:t,overrides:e?o:void 0}}return{overrides:a.current.overrides,key:t}}import{useRef as Yt}from"react";function Qt(e){let n=Yt(e);n.current=e;let t=Yt(null);t.current===null&&(t.current={fetch:(o,r)=>{let i=n.current;return i?i.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var Zt={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,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};function vt({onSubmit:e,onResult:n,onError:t,optionOverrides:a,maskCompletedText:o,apiConfig:r,additionalContext:i,language:p,currency:u,productId:m,visitorId:b,columns:k=2,dropdownTrigger:l,optionsPosition:w,closeDropdownOnBlur:s,showNonTappableOptions:T,showOptionIcons:D,showOptionImages:q,showOptionCounts:U,showSkipButton:I,showProducts:O,productImageFallback:M="image",onFocus:S,onBlur:_,value:H,completedParams:G,onChange:X,onParamsChange:R,products:j,mapProducts:se,onProductSelect:ue,onProductAddToCart:le,source:Se,setCursor:me}){let g=B(null),[ge,fe]=Ai(null),de=B(e);de.current=e;let be=B(n);be.current=n;let $=B(t);$.current=t;let d=B(X);d.current=X;let v=B(R);v.current=R;let y=B(S);y.current=S;let P=B(_);P.current=_;let C=B(me);C.current=me;let L=B(ue);L.current=ue;let Q=B(le);Q.current=le;let h=B(b);h.current=b;let V=B(()=>{let c=h.current;return typeof c=="function"?c():c}).current,ee=Qt(j),te=B(se);te.current=se;let Pe=B((c,N)=>{let E=te.current;return E?E(c,N):c}).current,ae=se?Pe:void 0,ie=Vt(a);Ne(()=>{if(typeof document>"u")return;let c=new Pi(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:i,language:p,currency:u,productId:m,visitorId:V,optionOverrides:ie.overrides,maskCompletedText:o,columns:k,dropdownTrigger:l,optionsPosition:w,closeDropdownOnBlur:s,showNonTappableOptions:T,showProducts:O,source:Se,value:H,completedParams:G,onSubmit:(...E)=>de.current?.(...E),onResult:(...E)=>be.current?.(...E),onError:(...E)=>$.current?.(...E),onChange:(...E)=>d.current?.(...E),onParamsChange:(...E)=>v.current?.(...E),onFocus:()=>y.current?.(),onBlur:()=>P.current?.(),onProductSelect:E=>L.current?.(E),onProductAddToCart:E=>Q.current?.(E),setCursor:E=>C.current?.(E),products:ee.config,mapProducts:ae});g.current=c,fe(c.getState());let N=c.subscribe(E=>fe(E));return()=>{N(),c.destroy(),g.current===c&&(g.current=null)}},[]),Ne(()=>{H!==void 0&&g.current?.setValue(H)},[H]),Ne(()=>{G!==void 0&&g.current?.setCompletedParams(G)},[G]);let Te=JSON.stringify(r??null),ce;try{ce=JSON.stringify(i??null)}catch{ce="[unstringifiable]"}Ne(()=>{g.current?.update({apiConfig:r,additionalContext:i,language:p,currency:u,productId:m,optionOverrides:ie.overrides,dropdownTrigger:l,optionsPosition:w,closeDropdownOnBlur:s,showNonTappableOptions:T,showProducts:O})},[Te,ce,p,u?.code,u?.rate,u?.country,m,ie.key,l,w,s,T,O]);let we=B(!1);Ne(()=>{if(!we.current){we.current=!0;return}g.current?.update({products:ee.config})},[ee.enabled]),Ne(()=>{g.current?.update({mapProducts:ae})},[ae]);let ve=B(null);ve.current===null&&(ve.current={handleTextChange:c=>g.current?.handleTextChange(c),handleKeyDown:c=>{let N="nativeEvent"in c?c.nativeEvent:c;g.current?.handleKeyDown(N)},setFocused:c=>g.current?.setFocused(c),startEditingParam:c=>g.current?.startEditingParam(c),exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:c=>g.current?.handleCaretAfterInput(c),handleCaretMove:c=>g.current?.handleCaretMove(c),replaceEditingRange:c=>g.current?.replaceEditingRange(c)??!1,setActivePill:c=>g.current?.setActivePill(c),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()??Zt,recordSubmit:c=>g.current?.recordSubmit(c),selectOption:c=>g.current?.selectOption(c),selectProduct:c=>g.current?.selectProduct(c),addProductToCart:c=>{let N=g.current;return!N||!Q.current?Promise.resolve():N.addProductToCart(c)},setActiveDropdownIndex:c=>g.current?.setActiveDropdownIndex(c),clearHighlight:c=>g.current?.clearHighlight(c),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let x=ve.current,Re=$t(c=>{let N=c.target.value,Qe=N.length>0&&!c.nativeEvent?.isComposing&&N[0]!==N[0].toUpperCase()?N[0].toUpperCase()+N.slice(1):N;g.current?.handleTextChange(Qe)},[]),De=$t(c=>{g.current?.handleKeyDown(c.nativeEvent)},[]),oe=g.current,f=ge??Zt,xe=H!==void 0?H:f.text,ye=G!==void 0?G:f.completedParams,Be=f.actionableSuggestions,ot=Be[0],nt=Ei(Be),Oe=oe?.listboxId??"",rt=f.activeDropdownIndex>=0&&oe?`${Oe}-option-${f.activeDropdownIndex}`:void 0,ke=f.editingParam,Ie=f.editingIdentified,Ge=ke?{parameter:ke.suggestionParameter,text:ke.suggestionPlaceholder,required:!0,options:ke.options}:Ie?{parameter:Ie.parameter,text:Ii(Ie.parameter),required:!0,options:[]}:null,Ye=f.dropdownSuggestion??Ge??ot,st=Ge?[Ge]:Be,Ke=Ti(f),Ee=!oe||f.dropdownLoading;return{completedParams:ye,skippedParams:f.skippedParams,identifiedParams:f.identifiedParams,suggestionPills:nt,setActivePill:x.setActivePill,skipActivePill:x.skipActivePill,removeLastParam:x.removeLastParam,segments:f.segments,newParamId:f.newParamId,clearNewParamId:x.clearNewParamId,suggestions:f.suggestions,activeIndex:f.activeDropdownIndex,isReady:f.isReady,isLoading:Ee,isFocused:f.isFocused,isDropdownOpen:f.isDropdownOpen,isActivePillSelected:f.isActivePillSelected,placeholderText:f.placeholderText,listboxId:Oe,error:f.error,products:f.products,customFields:f.customFields,selectProduct:x.selectProduct,addProductToCart:x.addProductToCart,handleTextChange:x.handleTextChange,handleKeyDown:x.handleKeyDown,setFocused:x.setFocused,editingParam:ke,editingIdentified:Ie,editingAnchor:f.editingAnchor,caretOffset:f.caretOffset,startEditingParam:x.startEditingParam,exitEditMode:x.exitEditMode,handleCaretAfterInput:x.handleCaretAfterInput,handleCaretMove:x.handleCaretMove,replaceEditingRange:x.replaceEditingRange,inputProps:{value:xe,placeholder:f.placeholderText||void 0,onChange:Re,onKeyDown:De,onFocus:x.handleFocus,onBlur:x.handleBlur,role:"combobox","aria-expanded":f.isDropdownOpen,"aria-activedescendant":rt,"aria-autocomplete":"list","aria-controls":Oe},reset:x.reset,refreshProducts:x.refreshProducts,prepareSubmit:x.prepareSubmit,getState:x.getState,recordSubmit:x.recordSubmit,dropdownProps:{suggestions:Ye?[{...Ye,options:f.dropdownOptions}]:[],activeIndex:f.activeDropdownIndex,onSelect:x.selectOption,onHighlight:x.setActiveDropdownIndex,onUnhighlight:x.clearHighlight,isOpen:f.isDropdownOpen,id:Oe,pills:st,activeSelected:f.isActivePillSelected,onPillClick:x.setActivePill,onSkip:x.skipActivePill,showSkipButton:(I??!0)&&!ke&&!Ie,showOptionIcons:D??!0,showOptionImages:q??!0,showOptionCounts:U??!0,skipDisabled:f.inSelectionAnimation,isLoading:Ee,skeletonExiting:f.skeletonExiting,isInputEmpty:xe.trim().length===0,language:p,products:f.products,productImageFallback:M,onProductSelect:x.selectProduct,onProductAddToCart:le?x.addProductToCart:void 0,onProductFocusChange:x.setFocused,formatType:f.activeFormatType,dateView:f.dateView,selectedDateIso:Ke.selectedIso,selectedDateRange:Ke.selectedRange,dateRangeStart:Ke.rangeStart,onPreviousMonth:x.showPreviousMonth,onNextMonth:x.showNextMonth,optionsPosition:w??"below"}}}import{chipIdFromTap as Ri,extractPlainText as Xt,getCursorOffset as Jt,keepCaretOnChip as Di,plainTextLength as Oi,renderEditableContent as Li,setCursorOffset as ea}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as J,useEffect as at,useLayoutEffect as xt,useRef as Fe}from"react";var it;function zi(){if(it!==void 0)return it;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),it=e.contentEditable==="plaintext-only",it}function ta(e){let{segments:n,showChipIcons:t=!0,showChipImages:a=!0,newParamId:o,editingParam:r,editingIdentified:i,editingAnchor:p,caretOffset:u,placeholderText:m,isFocused:b,isDropdownOpen:k,listboxId:l,activeDescendantId:w,autoFocus:s,handleTextChange:T,handleKeyDown:D,handleCaretAfterInput:q,handleCaretMove:U,startEditingParam:I,replaceEditingRange:O,setFocused:M}=e,S=Fe(null),_=Fe(!1),H=Fe(""),G=Fe(""),X=Fe(null),R=Fe(0);X.current=u,at(()=>{if(!s)return;let d=S.current;if(!d)return;document.activeElement===d?M(!0):d.focus();let v=d.ownerDocument??document,y=v.getSelection(),P=y&&y.rangeCount>0&&d.contains(y.anchorNode);if(y&&!P){let C=v.createRange();C.selectNodeContents(d),C.collapse(!0),y.removeAllRanges(),y.addRange(C)}},[s,M]),at(()=>{let d=S.current;if(!d)return;let v=d.ownerDocument??document,y=()=>{let P=v.getSelection();if(!P||P.rangeCount===0||!P.anchorNode||!d.contains(P.anchorNode))return;let C=P.anchorNode,L=C.nodeType===Node.ELEMENT_NODE?C:C.parentElement,h=(P.isCollapsed?L?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,V=r?.id??i?.id??null;if(h&&h!==V){I(h);return}performance.now()-R.current<50||U(Jt(d))};return v.addEventListener("selectionchange",y),()=>v.removeEventListener("selectionchange",y)},[r,i,I,U]),at(()=>{let d=S.current;if(!d)return;let v=y=>{let P=Ri(d,y.target);P&&(I(P),Di(d,P))};return d.addEventListener("click",v),()=>d.removeEventListener("click",v)},[I]),xt(()=>{let d=S.current;d&&Li({input:d,segments:n,newParamId:o,editingParamId:r?.id??null,placeholderText:m??"",isFocused:b,showChipIcons:t,showChipImages:a})},[n,o,r,m,b,t,a]),xt(()=>{let d=H.current,v=o??"";if(H.current=v,!v||v===d)return;let y=S.current;if(!y)return;y.focus();let P=X.current??Oi(y);ea(y,P)},[o]),xt(()=>{let d=G.current,v=r?.id??"";if(G.current=v,!v||v===d||p==null)return;let y=S.current;y&&ea(y,p)},[r,p]);let j=J(()=>{if(_.current)return;let d=S.current;if(!d)return;let v=Xt(d),P=v.length>0&&v[0]!==v[0].toUpperCase()?v[0].toUpperCase()+v.slice(1):v;T(P)},[T]),se=J(()=>{R.current=performance.now(),j();let d=S.current;d&&q(Jt(d))},[j,q]);at(()=>{let d=S.current;if(!d)return;let v=y=>{let P=y,C=P.inputType;if(C==="insertParagraph"||C==="insertLineBreak"||C==="insertFromDrop"){y.preventDefault();return}if(C.startsWith("insert")||C.startsWith("delete")){let L=C.startsWith("delete")?"":P.data??"";O(L)&&y.preventDefault()}};return d.addEventListener("beforeinput",v),()=>d.removeEventListener("beforeinput",v)},[O]);let ue=J(()=>{_.current=!0,S.current?.setAttribute("data-aia-composing","true")},[]),le=J(()=>{_.current=!1,S.current?.removeAttribute("data-aia-composing"),j()},[j]),Se=J(d=>{d.preventDefault();let v=S.current;if(!v)return;let y=(d.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!y)return;let P=v.ownerDocument??document,C=P.getSelection();if(!C||C.rangeCount===0)return;let L=C.getRangeAt(0);if(!v.contains(L.startContainer))return;L.deleteContents();let Q=P.createTextNode(y);L.insertNode(Q),L.setStartAfter(Q),L.collapse(!0),C.removeAllRanges(),C.addRange(L),j()},[j]),me=J(d=>D(d),[D]),g=J(()=>M(!0),[M]),ge=J(()=>M(!1),[M]),fe=J(()=>S.current?.focus(),[]),de=J(()=>S.current?.blur(),[]),be=J(()=>{let d=S.current;return d?Xt(d):""},[]),$=zi()?"plaintext-only":"true";return{inputRef:S,editorProps:{ref:S,contentEditable:$,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":l,"aria-expanded":k,"aria-activedescendant":w,spellCheck:!0,enterKeyHint:"send",onInput:se,onKeyDown:me,onCompositionStart:ue,onCompositionEnd:le,onPaste:Se,onFocus:g,onBlur:ge},getPlainText:be,focus:fe,blur:de}}import{jsx as He,jsxs as kt}from"react/jsx-runtime";function qi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Wi=Mi(function({onSubmit:n,onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,className:i,apiConfig:p,additionalContext:u,language:m,currency:b,productId:k,visitorId:l,columns:w,pillPlacement:s="dropdown",mode:T="auto",optionsPosition:D="below",animations:q=!0,dropdownTrigger:U,closeDropdownOnBlur:I,showNonTappableOptions:O,showOptionIcons:M=!0,showChipIcons:S=!0,showChipImages:_=!0,showOptionImages:H=!0,showOptionCounts:G=!0,showSkipButton:X,showProducts:R,productsLayout:j,productImageFallback:se,autoFocus:ue=!0,onFocus:le,onBlur:Se,value:me,completedParams:g,onChange:ge,onParamsChange:fe,products:de,mapProducts:be,onProductSelect:$,onProductAddToCart:d,submitButton:v,resetOnSubmit:y=!0},P){let C=Ve(null),L=Ve(null),Q=Ve(()=>{}),h=Ve(null),V=Ve(null);aa(()=>{let A=C.current;if(A)return h.current?h.current.setMode(T):h.current=new Bi(A,T),()=>{h.current?.destroy(),h.current=null}},[T]);let ee=yt(A=>{let Y=V.current?.current;Y&&(Y.focus(),Gi(Y,A))},[]),{completedParams:te,suggestionPills:Pe,setActivePill:ae,skipActivePill:ie,segments:Te,newParamId:ce,clearNewParamId:we,placeholderText:ve,isFocused:x,isDropdownOpen:Re,isActivePillSelected:De,isLoading:oe,activeIndex:f,listboxId:xe,handleTextChange:ye,handleKeyDown:Be,setFocused:ot,editingParam:nt,editingIdentified:Oe,editingAnchor:rt,caretOffset:ke,startEditingParam:Ie,handleCaretAfterInput:Ge,handleCaretMove:Ye,replaceEditingRange:st,dropdownProps:Ke,reset:Ee,refreshProducts:c,prepareSubmit:N,getState:E,recordSubmit:Qe}=vt({onSubmit:A=>Q.current(A),onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,apiConfig:p,additionalContext:u,language:m,currency:b,productId:k,visitorId:l,columns:w,dropdownTrigger:U,optionsPosition:D,closeDropdownOnBlur:I,showNonTappableOptions:O,showOptionIcons:M,showOptionImages:H,showOptionCounts:G,showSkipButton:X,showProducts:R,onFocus:le,onBlur:Se,value:me,completedParams:g,onChange:ge,onParamsChange:fe,products:de,mapProducts:be,onProductSelect:$,onProductAddToCart:d,source:"full-sdk",setCursor:ee});aa(()=>{if(!ce)return;let A=window.setTimeout(()=>we(),650);return()=>window.clearTimeout(A)},[ce,we]);let ia=f>=0?`${xe}-option-${f}`:void 0,{inputRef:lt,editorProps:oa,focus:$e,blur:Ct,getPlainText:St}=ta({segments:Te,newParamId:ce,editingParam:nt,editingIdentified:Oe,editingAnchor:rt,caretOffset:ke,placeholderText:ve,isFocused:x,showChipIcons:S,showChipImages:_,isDropdownOpen:Re,listboxId:xe,activeDescendantId:ia,autoFocus:ue,handleTextChange:ye,handleKeyDown:Be,handleCaretAfterInput:Ge,handleCaretMove:Ye,startEditingParam:Ie,replaceEditingRange:st,setFocused:ot});V.current=lt,Fi(()=>{let A=L.current,Y=lt.current;if(!A||!Y)return;let qe=()=>{let Tt=A.firstElementChild;if(!Tt)return;let la=Tt.getBoundingClientRect(),da=Y.getBoundingClientRect();la.top>=da.bottom-2?A.setAttribute("data-aia-pill-wrapped",""):A.removeAttribute("data-aia-pill-wrapped")};qe();let Pt=new ResizeObserver(qe);return Pt.observe(Y),()=>Pt.disconnect()},[Te,Pe.length,oe,lt]),Ni(P,()=>({focus:$e,blur:Ct,reset:Ee,refreshProducts:c,setMode:A=>h.current?.setMode(A),skipActivePill:ie}),[$e,Ct,Ee,c,ie]);let Ze=!!Te.length||te.length>0,dt=yt(A=>{if(!Ze)return;A&&N();let Y=E(),qe=Hi(St(),Y.completedParams,Y.skippedParams,{identifiedParams:Y.identifiedParams,isReady:Y.isReady,customFields:Y.customFields});A&&Qe(qe),n(qe),y&&Ee()},[Qe,y,Ze,N,E,n,Ee,St]);Q.current=()=>dt(!1);let na=yt(A=>{A.target?.closest("[data-aia-pill]")||$e()},[$e]),ra=s==="inline",sa=s==="dropdown";return kt("div",{ref:C,className:`magicx-aia ${Ae.container} ${i??""}`,"data-pill-placement":s,"data-options-position":D,"data-animations":q?"on":"off","data-mode":qi(T),children:[He(bt,{...Ke,showPills:sa,productsLayout:j,productImageFallback:se}),kt("div",{className:Ae.inputWrapper,"data-aia-input-wrapper":"",onClick:na,children:[kt("div",{className:Ae.editorArea,"data-aia-editor":"",children:[He("div",{...oa,className:Ae.input,"data-aia-input":""}),ra&&(oe||Pe.length>0)&&He("span",{ref:L,className:Ae.pillListContainer,"data-aia-pill-list-container":"",children:He(Je,{pills:Pe,activePillIndex:0,activeSelected:De,onSelectPill:ae,loading:oe})})]}),v===null?null:v===void 0?He(_t,{disabled:!Ze,onClick:()=>dt(!0),label:Ki(m).submit}):He("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ae.submitSlot,onClick:A=>{Ze&&(A.stopPropagation(),dt(!0))},children:v})]})]})});export{Wi as AIAutocomplete,bt as AIAutocompleteDropdown,Kn as DATE_RANGE_META_END,qn as DATE_RANGE_META_START,Wn as DEFAULT_OPTION_COUNT_UNIT,ar as PRODUCT_PATH_PREFIX,hr as WEEKDAY_LABELS,Hn as buildSubmitResult,Bn as cellDay,Gn as cellIso,Un as dateCellMarks,_n as formatDate,jn as formatDateRange,Vn as formatOptionCount,Yn as isoDate,Qn as monthLabel,$n as optionCountLabel,Zn as optionHasImage,Xn as optionImageSources,Jn as optionImageSrc,er as optionLabel,tr as optionsShowLeadingVisuals,ir as parseDate,or as parseLooseDate,nr as parseLooseDateRange,rr as productFromMatchedItem,sr as productImageSources,lr as productsFromCustomFields,dr as sanitizeOptionIconSvg,cr as selectedRangeFor,vt as useAIAutocomplete,pr as visibleDateRange,ur as withSkippedParams};
2541
2652
  //# sourceMappingURL=index.mjs.map