@magicx-eng/ai-autocomplete-react 0.43.1 → 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 zn,cellDay as Mn,cellIso as Nn,DATE_RANGE_META_END as Fn,DATE_RANGE_META_START as Hn,DEFAULT_OPTION_COUNT_UNIT as Bn,dateCellMarks as Kn,formatDate as Gn,formatDateRange as Wn,formatOptionCount as _n,isoDate as qn,monthLabel as Un,optionCountLabel as Vn,optionHasImage as jn,optionImageSources as Yn,optionImageSrc as Qn,optionLabel as Zn,optionsShowLeadingVisuals as $n,PRODUCT_PATH_PREFIX as Xn,parseDate as Jn,parseLooseDate as er,parseLooseDateRange as tr,productFromMatchedItem as ar,productImageSources as ir,productsFromCustomFields as or,sanitizeOptionIconSvg as nr,selectedRangeFor as rr,visibleDateRange as sr,WEEKDAY_LABELS as lr,withSkippedParams as dr}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Oi,useCallback as ft,useEffect as Jt,useImperativeHandle as Di,useLayoutEffect as Li,useRef as We}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 zn,cellDay as Mn,cellIso as Nn,DATE_RANGE_META_END a
280
280
  opacity: 0;
281
281
  }
282
282
  }
283
- `,document.head.appendChild(e)}var Te={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 si,attachViewportFit as li,containScroll as di,hasSkippablePill as ci,isCalendarFormat as pi,labelTraditionalAutocomplete as hi,uiStringsFor as ui}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Le,useRef as De,useState as mi}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 zn,cellDay as Mn,cellIso as Nn,DATE_RANGE_META_END a
1132
1132
  opacity: 0.25;
1133
1133
  }
1134
1134
  }
1135
- `,document.head.appendChild(e)}var ce={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 sa,cellIso as Oe,dateCellMarks as la,isoDate as da,monthLabel as ca,visibleDateRange as pa,WEEKDAY_LABELS as ha}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as ua}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 zn,cellDay as Mn,cellIso as Nn,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 te,jsxs as Ct}from"react/jsx-runtime";var ma=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function St({options:e,activeIndex:n,listboxId:t,view:i,selection:o,onSelect:r,onHighlight:a,onUnhighlight:c,onPreviousMonth:s,onNextMonth:m}){let y=da(new Date),P=pa({pendingStart:o.rangeStart,highlightedIso:Oe(e[n]),selected:o.selectedRange});return Ct("div",{className:D.datepicker,"data-aia-datepicker":"",children:[Ct("div",{className:D.header,children:[te("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:f=>f.preventDefault(),onClick:s,children:"\u2039"}),te("span",{className:D.month,"data-aia-date-month":"","aria-live":"polite",children:ca(i)}),te("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:f=>f.preventDefault(),onClick:m,children:"\u203A"})]}),te("div",{className:D.weekdays,"aria-hidden":"true",children:ha.map((f,x)=>te("span",{className:D.weekday,children:f},ma[x]))}),te("div",{className:D.grid,"data-aia-date-grid":"",children:e.map((f,x)=>te(ga,{option:f,id:`${t}-option-${x}`,index:x,isHighlighted:x===n&&f.is_tappable,isToday:Oe(f)===y,isPast:Oe(f)!=null&&Oe(f)<y,marks:la(Oe(f),{selectedIso:o.selectedIso,range:P}),onSelect:r,onHighlight:a,onUnhighlight:c},Oe(f)??`pad-${x}`))})]})}function ga({option:e,id:n,index:t,isHighlighted:i,isToday:o,isPast:r,marks:a,onSelect:c,onHighlight:s,onUnhighlight:m}){let[y,P]=ua(!1),f=sa(e);if(f==null)return te("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 x=()=>{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 te("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:I,onClick:x,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),x())},onMouseEnter:()=>s(t),onMouseLeave:m?()=>m(t):void 0,children:te("span",{className:D.number,children:f})})}import{ATTRIBUTION_URL as fa,buildAttributionUrl as ba,getFooterHint as wa,uiStringsFor as va}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as xa,useState as ya}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 zn,cellDay as Mn,cellIso as Nn,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 Pt}from"react/jsx-runtime";function Ke({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?Pt("span",{...m,children:a}):Pt("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 zn,cellDay as Mn,cellIso as Nn,DATE_RANGE_META_END a
1482
1482
  justify-content: flex-end;
1483
1483
  }
1484
1484
  }
1485
- `,document.head.appendChild(e)}var pe={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 Ge,jsxs as rt}from"react/jsx-runtime";function It({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:t=va()}){let{key:i,hint:o}=wa(e,n,t),[r,a]=ya(fa);return xa(()=>{a(ba())},[]),Ge("footer",{className:pe.footer,"data-aia-footer":"",children:rt(Ke,{justify:"between",noWrap:!0,className:pe.row,children:[rt(Ke,{gap:"5px",className:pe.hintGroup,children:[Ge("kbd",{className:pe.key,children:i}),Ge("span",{className:pe.hint,children:o})]}),rt("a",{className:pe.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[Ge("span",{className:pe.brand,children:"AI"}),Ge("span",{className:pe.badge,children:"Autocomplete"})]})]})})}import{isSmartSuggestion as Pa,isTraditionalAutocompleteSuggestion as Ia}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as ka}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 zn,cellDay as Mn,cellIso as Nn,DATE_RANGE_META_END a
1662
1662
  opacity: 0;
1663
1663
  }
1664
1664
  }
1665
- `,document.head.appendChild(e)}var ae={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 Ca,jsx as st,jsxs as Sa}from"react/jsx-runtime";var lt={selected:1,first:.7,next:.4,last:.2};function Tt({label:e,state:n,rounded:t,loading:i,smartSuggestion:o,completionHeader:r,onClick:a}){let c=[ae.pill,t?ae.rounded:"",i?ae.skeleton:""].filter(Boolean).join(" ");return st("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:lt[n]},onMouseDown:s=>s.preventDefault(),onClick:i?void 0:a,disabled:i,children:o?Sa(Ca,{children:[st("span",{className:`${ae.smartText} magicx-aia-smart-suggestion-text`,children:e}),st("span",{className:`${ae.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:ka}})]}):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 zn,cellDay as Mn,cellIso as Nn,DATE_RANGE_META_END a
1672
1672
  align-items: center;
1673
1673
  vertical-align: middle;
1674
1674
  }
1675
- `,document.head.appendChild(e)}var dt={list:"aia-list-qvLqO"};import{jsx as Ye}from"react/jsx-runtime";var Ta=[125,69];function Et(e){return e===0?"first":e===1?"next":"last"}function Qe({pills:e,activePillIndex:n,onSelectPill:t,activeSelected:i,rounded:o,loading:r}){return r&&e.length===0?Ye("span",{className:dt.list,"data-aia-pill-list-loading":"",children:Ta.map((a,c)=>Ye("span",{"data-aia-pill-skeleton":"",className:`${ae.pill} ${o?ae.rounded:""} ${ae.skeleton}`,style:{width:a,opacity:lt[Et(c)]}},`skel-${a}`))}):Ye("span",{className:dt.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((a,c)=>{let s=!!i&&c===n;return Ye(Tt,{label:a.text,state:s?"selected":Et(c),selected:s,rounded:o,loading:r,smartSuggestion:Pa(a),completionHeader:Ia(a),onClick:()=>t(c)},`${a.parameter}-${a.text}`)})})}import{attachProductRowWheel as Ea,productImageSources as Aa,productImageSrc as Ra,productInitial as Oa,uiStringsFor as Da}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as La,useRef as za,useState as At}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 zn,cellDay as Mn,cellIso as Nn,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 zn,cellDay as Mn,cellIso as Nn,DATE_RANGE_META_END a
1975
2070
  letter-spacing: 0.02em;
1976
2071
  text-align: center;
1977
2072
  }
1978
- `,document.head.appendChild(e)}var Y={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",badge:"aia-badge-j9Hcd"};import{jsx as he,jsxs as Ze}from"react/jsx-runtime";function Rt({products:e,listboxId:n,onSelect:t,onFocusChange:i,focusable:o=!0,layout:r="row",imageFallback:a="image",strings:c=Da()}){let s=e.length>0,m=za(null);if(La(()=>{let P=m.current;if(!(!s||!P))return Ea(P)},[s]),!s)return null;let y=`${n}-products-label`;return Ze("section",{className:Y.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":y,children:[he("div",{className:Y.label,id:y,"data-aia-products-label":"",children:c.products}),he("div",{ref:m,className:Y.row,"data-aia-products-row":"",children:e.map((P,f)=>he(Ma,{product:P,id:`${n}-product-${f}`,onSelect:t,onFocusChange:i,focusable:o,imageFallback:a,soldOut:c.soldOut},P.id))})]})}function Ma({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 Ze("a",{id:n,className:Y.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:[he(Na,{sources:Aa(e.imageUrl),title:e.title,fallback:r},Ra(e.imageUrl)??""),Ze("span",{className:Y.body,children:[e.vendor?he("span",{className:Y.vendor,children:e.vendor}):null,he("span",{className:Y.title,children:e.title}),e.price?he("span",{className:Y.price,children:e.price}):null,e.available===!1?he("span",{className:Y.badge,children:a}):null]})]})}function Na({sources:e,title:n,fallback:t}){let[i,o]=At(0),r=e[i],a=!!r,[c,s]=At(null),m=!a&&t==="initial";return Ze("span",{className:Y.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?he("img",{className:Y.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:()=>s(r),onError:()=>o(y=>y+1)}):null,m?Oa(n):null]})}import{isOptionsGridMobileViewport as Za,measureOptionsGrid as $a,needsOptionsGridMeasurement as Xa,OPTIONS_GRID_MOBILE_QUERY as Ja,optionEnterDelayMs as ei,optionsShowLeadingVisuals as ti,planOptionsGrid as zt,sameOptionRows as ai}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ii,useLayoutEffect as oi,useRef as Mt,useState as Ft}from"react";import{optionsGridTemplateColumns as Fa}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Ha,useRef as Ba}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 zn,cellDay as Mn,cellIso as Nn,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 Ka}from"react/jsx-runtime";function Ot({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=Ba(null);Ha(()=>{if(r===void 0)return;let I=f.current;I&&(I.scrollTop=0)},[r]);let x={"--aia-grid-min":e};return n&&(x["--aia-grid-max"]=n),t&&(x["--aia-grid-gap"]=t),o&&(x["--aia-grid-max-height"]=o),a&&(x.gridTemplateColumns=Fa(a)),c&&(x.gridTemplateColumns=c),Ka("div",{ref:I=>{f.current=I,s?.(I)},className:m?`aia-grid ${m}`:"aia-grid","data-scroll":i||void 0,style:x,...P,children:y})}import{formatOptionCount as Ga,highlightParts as Wa,OPTION_ENTER_DELAY_VAR as _a,optionImageSources as qa,optionLabel as Dt,sanitizeOptionIconSvg as Ua}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Va,useMemo as ja,useRef as Ya,useState as $e}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 zn,cellDay as Mn,cellIso as Nn,DATE_RANGE_META_END a
2469
2580
  opacity: 0;
2470
2581
  }
2471
2582
  }
2472
- `,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 Qa,jsx as ke,jsxs as ct}from"react/jsx-runtime";function Lt({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]=$e(P),[x,I]=$e(!1),T=s?qa(e.image_url):[],z=T[0]??null,[K,_]=$e([]),S=T.find(R=>!K.includes(R))??null,[O,M]=$e(null),k=ja(()=>!z&&c&&e.icon_svg?Ua(e.icon_svg):null,[z,c,e.icon_svg]),q=m?Ga(e.item_count):null,F=Ya(void 0);Va(()=>()=>clearTimeout(F.current),[]);let H=()=>{a||!e.is_tappable||x||(I(!0),t(e),clearTimeout(F.current),F.current=setTimeout(()=>I(!1),170))},Z=[W.item,n&&!a?W.highlighted:"",e.is_tappable?W.tappable:W.nonTappable,x?W.pressed:"",y?W.scrollHint:""].filter(Boolean).join(" ");return ke("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":q!==null?e.item_count:void 0,"aria-selected":n,className:Z,style:{[_a]:`${f}ms`},tabIndex:a||!e.is_tappable?-1:0,onClick:H,onKeyDown:R=>{!a&&e.is_tappable&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),H())},onMouseEnter:!a&&e.is_tappable?i:void 0,onMouseLeave:o,children:ct("span",{className:W.content,children:[z&&ke("span",{className:`${W.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":S!==null&&O===S?"":void 0,children:ke("img",{src:S??z,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:S===null,onLoad:()=>M(S),onError:()=>{S!==null&&_(R=>[...R,S])}})}),k&&ke("span",{className:`${W.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:k}}),ct("span",{className:W.text,children:[e.matchedText?Wa(Dt(e),e.matchedText).map((R,U)=>R.bold?ke("strong",{className:`${W.match} magicx-aia-option-match`,children:R.text},U):R.text):Dt(e),e.parameterLabel&&ct(Qa,{children:[" ",ke("span",{className:`${W.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ke("span",{className:W.tag,children:e.tag}),q!==null&&ke("span",{className:`${W.count} magicx-aia-option-count`,children:q})]})})}import{jsx as Nt}from"react/jsx-runtime";function ni(){let[e,n]=Ft(Za);return ii(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(Ja),i=()=>n(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function Ht({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=ni(),x=Mt(null),[I,T]=Ft(null),z=Mt(null);oi(()=>{if(a&&ai(z.current,e))return;z.current=a?null:e;let S=x.current,M=S&&!a&&Xa(e.length,f)?$a(S):null;T(M?zt(e.length,f,M.rowWidths,M.gridWidth):null)},[e,f,a]);let K=I??zt(e.length,f,null,null),_=ti(e,m,y);return Nt(Ot,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:c,template:K.template,maxHeight:K.maxHeight,innerRef:S=>{x.current=S},"data-aia-group":c,children:e.map((S,O)=>Nt(Lt,{option:S,isHighlighted:O===n,onSelect:t,onHighlight:()=>i(O),onUnhighlight:o?()=>o(O):void 0,id:`${r}-option-${O}`,loading:a,showIcon:m&&_,showImage:y&&_,showCount:P,scrollHint:!a&&K.scrollHintIndices.includes(O),enterDelayMs:a?0:ei(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 zn,cellDay as Mn,cellIso as Nn,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 ri}from"react/jsx-runtime";function Bt({space:e,align:n="stretch",className:t,children:i,...o}){let r=e?{"--aia-stack-space":e}:void 0;return ri("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":n,style:r,...o,children:i})}import{jsx as Q,jsxs as pt}from"react/jsx-runtime";var gi=[159,119,164],fi=()=>{},Kt=()=>{};function bi(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=mi(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 wi(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:si({dropdown:i,grid:r,button:o})};return}t.current?.controller.update()}),Le(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function vi(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=li({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),Le(()=>()=>{i.current?.destroy(),i.current=null},[])}function ht({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:x=!0,showOptionImages:I=!0,showOptionCounts:T=!0,skipDisabled:z=!1,activeSelected:K=!1,isLoading:_=!1,skeletonExiting:S=!1,isInputEmpty:O=!1,language:M,products:k,onProductSelect:q,onProductFocusChange:F,productsLayout:H="row",productImageFallback:Z="image",formatType:R="options",dateView:U=null,selectedDateIso:ie=null,selectedDateRange:ue=null,dateRangeStart:Ce=null,onPreviousMonth:me,onNextMonth:u,optionsPosition:ge="below",mode:fe}){let oe=bi(fe),be=oe!==void 0,j=De(null),ne=De(null);wi(j,ne),Le(()=>{if(j.current)return di(j.current)},[]);let l=e[0]?.options??[],g=!!(s&&s.length>0&&m),b=!!(k&&k.length>0),w=r&&(l.length>0||y&&g||_||b);vi(j,w);let C={suggestions:e,activeIndex:n,pills:s,showPills:y,showSkipButton:f,showOptionIcons:x,showOptionImages:I,showOptionCounts:T,skipDisabled:z,activeSelected:K,isLoading:_,skeletonExiting:S,isInputEmpty:O,products:k,formatType:R,dateView:U,selectedDateIso:ie,selectedDateRange:ue,dateRangeStart:Ce},L=De(C);w&&(L.current=C);let p=w?C:L.current,N=ui(M),$=p.suggestions[0],re=$?.options??[],se=p.activeIndex>=0&&!!re[p.activeIndex]?.is_tappable,J=hi(p.pills??[],N.keepTyping),we=!!(J.length>0&&m),le=p.showPills&&we,ve=p.showPills&&!we&&p.isLoading,de=le||ve,v=we&&ci(J)&&p.showSkipButton&&!p.isInputEmpty&&!!P,Ee=J[0]?.text,Ae=pi(p.formatType)&&p.dateView!=null,xe=re.length>0&&!Ae,h=re.length>0&&Ae&&!p.isLoading,Se=p.isLoading&&!xe&&!h,Pe=p.products??[];return pt("div",{ref:j,id:a,role:"listbox","data-aia-dropdown":"","data-options-position":ge,"data-mode":oe,"data-aia-loading":p.isLoading?"":void 0,"data-aia-skeleton-exiting":p.skeletonExiting?"":void 0,"data-aia-has-products":Pe.length>0?"":void 0,className:`${be?"magicx-aia ":""}${ce.dropdown} ${w?ce.visible:""} ${c??""}`,onMouseDown:ee=>ee.preventDefault(),children:[pt(Bt,{space:"8px",children:[(de||v)&&pt(Ke,{noWrap:!0,className:ce.pillBar,"data-aia-pillbar":"",children:[de&&Q("span",{className:ce.pillScroll,"data-aia-pill-scroll":"",children:Q(Qe,{pills:J,activePillIndex:0,activeSelected:p.activeSelected,onSelectPill:m??(()=>{}),rounded:!0,loading:p.isLoading})}),v&&Q("button",{type:"button",tabIndex:-1,className:ce.skip,"data-aia-skip":"",disabled:p.isLoading||p.skipDisabled,"aria-label":Ee?`${N.skipLabel} ${Ee}`:N.skipLabel,onClick:P,children:N.skip})]}),xe&&Q(Ht,{options:re,activeIndex:p.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:a,loading:p.isLoading,groupKey:$?`${$.parameter} ${$.text}`:"",optionsPosition:ge,showIcons:p.showOptionIcons,showImages:p.showOptionImages,showCounts:p.showOptionCounts}),h&&p.dateView&&Q(St,{options:re,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:me??Kt,onNextMonth:u??Kt}),Se&&Q("div",{className:ce.skeletonBars,"data-aia-skeleton-bars":"",children:gi.map(ee=>Q("span",{className:ce.skeletonBar,style:{width:ee}},`bar-${ee}`))}),Q(Rt,{products:Pe,listboxId:a,onSelect:q??fi,onFocusChange:F,focusable:w,layout:H,imageFallback:Z,strings:N}),Q(It,{isOptionHighlighted:se,isInputEmpty:p.isInputEmpty,strings:N})]}),Q("button",{ref:ne,type:"button",tabIndex:-1,className:ce.scrollArrow,"data-aia-scroll-arrow":"","aria-label":N.scrollArrow,"aria-hidden":"true",children:Q("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:Q("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as zi,ModeController as Mi,setCursorOffset as Ni,uiStringsFor as Fi}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as xi}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 zn,cellDay as Mn,cellIso as Nn,DATE_RANGE_META_END a
2537
2648
  );
2538
2649
  cursor: default;
2539
2650
  }
2540
- `,document.head.appendChild(e)}var Gt={submitButton:"aia-submitButton-otz7H"};import{jsx as ut}from"react/jsx-runtime";function Wt({disabled:e,onClick:n,label:t=xi().submit}){return ut("button",{type:"button","data-aia-submit":"",className:Gt.submitButton,disabled:e,onClick:i=>{i.stopPropagation(),n()},"aria-label":t,children:ut("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:ut("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as yi,dateSelectionFor as ki,identifiedParamLabel as Ci,withoutTraditionalAutocomplete as Si}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as jt,useEffect as ze,useRef as B,useState as Pi}from"react";import{useRef as _t}from"react";function qt(e){let n=_t(e);n.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=_t({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 Ut}from"react";function Vt(e){let n=Ut(e);n.current=e;let t=Ut(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 Yt={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 mt({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:x,closeDropdownOnBlur:I,showNonTappableOptions:T,showOptionIcons:z,showOptionImages:K,showOptionCounts:_,showSkipButton:S,showProducts:O,productImageFallback:M="image",onFocus:k,onBlur:q,value:F,completedParams:H,onChange:Z,onParamsChange:R,products:U,mapProducts:ie,onProductSelect:ue,source:Ce,setCursor:me}){let u=B(null),[ge,fe]=Pi(null),oe=B(e);oe.current=e;let be=B(n);be.current=n;let j=B(t);j.current=t;let ne=B(Z);ne.current=Z;let l=B(R);l.current=R;let g=B(k);g.current=k;let b=B(q);b.current=q;let w=B(me);w.current=me;let C=B(ue);C.current=ue;let L=B(y);L.current=y;let p=B(()=>{let d=L.current;return typeof d=="function"?d():d}).current,N=Vt(U),$=B(ie);$.current=ie;let re=B((d,G)=>{let E=$.current;return E?E(d,G):d}).current,se=ie?re:void 0,J=qt(i);ze(()=>{if(typeof document>"u")return;let d=new yi(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:a,language:c,currency:s,productId:m,visitorId:p,optionOverrides:J.overrides,maskCompletedText:o,columns:P,dropdownTrigger:f,optionsPosition:x,closeDropdownOnBlur:I,showNonTappableOptions:T,showProducts:O,source:Ce,value:F,completedParams:H,onSubmit:(...E)=>oe.current?.(...E),onResult:(...E)=>be.current?.(...E),onError:(...E)=>j.current?.(...E),onChange:(...E)=>ne.current?.(...E),onParamsChange:(...E)=>l.current?.(...E),onFocus:()=>g.current?.(),onBlur:()=>b.current?.(),onProductSelect:E=>C.current?.(E),setCursor:E=>w.current?.(E),products:N.config,mapProducts:se});u.current=d,fe(d.getState());let G=d.subscribe(E=>fe(E));return()=>{G(),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 we=JSON.stringify(r??null),le;try{le=JSON.stringify(a??null)}catch{le="[unstringifiable]"}ze(()=>{u.current?.update({apiConfig:r,additionalContext:a,language:c,currency:s,productId:m,optionOverrides:J.overrides,dropdownTrigger:f,optionsPosition:x,closeDropdownOnBlur:I,showNonTappableOptions:T,showProducts:O})},[we,le,c,s?.code,s?.rate,s?.country,m,J.key,f,x,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:se})},[se]);let de=B(null);de.current===null&&(de.current={handleTextChange:d=>u.current?.handleTextChange(d),handleKeyDown:d=>{let G="nativeEvent"in d?d.nativeEvent:d;u.current?.handleKeyDown(G)},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(),prepareSubmit:()=>u.current?.prepareSubmit(),getState:()=>u.current?.getState()??Yt,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 v=de.current,Ee=jt(d=>{let G=d.target.value,Ue=G.length>0&&!d.nativeEvent?.isComposing&&G[0]!==G[0].toUpperCase()?G[0].toUpperCase()+G.slice(1):G;u.current?.handleTextChange(Ue)},[]),Ae=jt(d=>{u.current?.handleKeyDown(d.nativeEvent)},[]),xe=u.current,h=ge??Yt,Se=F!==void 0?F:h.text,Pe=H!==void 0?H:h.completedParams,ee=h.actionableSuggestions,et=ee[0],tt=Si(ee),Re=xe?.listboxId??"",at=h.activeDropdownIndex>=0&&xe?`${Re}-option-${h.activeDropdownIndex}`:void 0,ye=h.editingParam,Ie=h.editingIdentified,Fe=ye?{parameter:ye.suggestionParameter,text:ye.suggestionPlaceholder,required:!0,options:ye.options}:Ie?{parameter:Ie.parameter,text:Ci(Ie.parameter),required:!0,options:[]}:null,_e=h.dropdownSuggestion??Fe??et,it=Fe?[Fe]:ee,He=ki(h),qe=!xe||h.dropdownLoading;return{completedParams:Pe,skippedParams:h.skippedParams,identifiedParams:h.identifiedParams,suggestionPills:tt,setActivePill:v.setActivePill,skipActivePill:v.skipActivePill,removeLastParam:v.removeLastParam,segments:h.segments,newParamId:h.newParamId,clearNewParamId:v.clearNewParamId,suggestions:h.suggestions,activeIndex:h.activeDropdownIndex,isReady:h.isReady,isLoading:qe,isFocused:h.isFocused,isDropdownOpen:h.isDropdownOpen,isActivePillSelected:h.isActivePillSelected,placeholderText:h.placeholderText,listboxId:Re,error:h.error,products:h.products,customFields:h.customFields,selectProduct:v.selectProduct,handleTextChange:v.handleTextChange,handleKeyDown:v.handleKeyDown,setFocused:v.setFocused,editingParam:ye,editingIdentified:Ie,editingAnchor:h.editingAnchor,caretOffset:h.caretOffset,startEditingParam:v.startEditingParam,exitEditMode:v.exitEditMode,handleCaretAfterInput:v.handleCaretAfterInput,handleCaretMove:v.handleCaretMove,replaceEditingRange:v.replaceEditingRange,inputProps:{value:Se,placeholder:h.placeholderText||void 0,onChange:Ee,onKeyDown:Ae,onFocus:v.handleFocus,onBlur:v.handleBlur,role:"combobox","aria-expanded":h.isDropdownOpen,"aria-activedescendant":at,"aria-autocomplete":"list","aria-controls":Re},reset:v.reset,refreshProducts:v.refreshProducts,prepareSubmit:v.prepareSubmit,getState:v.getState,recordSubmit:v.recordSubmit,dropdownProps:{suggestions:_e?[{..._e,options:h.dropdownOptions}]:[],activeIndex:h.activeDropdownIndex,onSelect:v.selectOption,onHighlight:v.setActiveDropdownIndex,onUnhighlight:v.clearHighlight,isOpen:h.isDropdownOpen,id:Re,pills:it,activeSelected:h.isActivePillSelected,onPillClick:v.setActivePill,onSkip:v.skipActivePill,showSkipButton:(S??!0)&&!ye&&!Ie,showOptionIcons:z??!0,showOptionImages:K??!0,showOptionCounts:_??!0,skipDisabled:h.inSelectionAnimation,isLoading:qe,skeletonExiting:h.skeletonExiting,isInputEmpty:Se.trim().length===0,language:c,products:h.products,productImageFallback:M,onProductSelect:v.selectProduct,onProductFocusChange:v.setFocused,formatType:h.activeFormatType,dateView:h.dateView,selectedDateIso:He.selectedIso,selectedDateRange:He.selectedRange,dateRangeStart:He.rangeStart,onPreviousMonth:v.showPreviousMonth,onNextMonth:v.showNextMonth,optionsPosition:x??"below"}}}import{chipIdFromTap as Ii,extractPlainText as Qt,getCursorOffset as Zt,keepCaretOnChip as Ti,plainTextLength as Ei,renderEditableContent as Ai,setCursorOffset as $t}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as X,useEffect as Xe,useLayoutEffect as gt,useRef as Me}from"react";var Je;function Ri(){if(Je!==void 0)return Je;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Je=e.contentEditable==="plaintext-only",Je}function Xt(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:x,autoFocus:I,handleTextChange:T,handleKeyDown:z,handleCaretAfterInput:K,handleCaretMove:_,startEditingParam:S,replaceEditingRange:O,setFocused:M}=e,k=Me(null),q=Me(!1),F=Me(""),H=Me(""),Z=Me(null),R=Me(0);Z.current=s,Xe(()=>{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]),Xe(()=>{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,$=r?.id??a?.id??null;if(N&&N!==$){S(N);return}performance.now()-R.current<50||_(Zt(l))};return g.addEventListener("selectionchange",b),()=>g.removeEventListener("selectionchange",b)},[r,a,S,_]),Xe(()=>{let l=k.current;if(!l)return;let g=b=>{let w=Ii(l,b.target);w&&(S(w),Ti(l,w))};return l.addEventListener("click",g),()=>l.removeEventListener("click",g)},[S]),gt(()=>{let l=k.current;l&&Ai({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]),gt(()=>{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=Z.current??Ei(b);$t(b,w)},[o]),gt(()=>{let l=H.current,g=r?.id??"";if(H.current=g,!g||g===l||c==null)return;let b=k.current;b&&$t(b,c)},[r,c]);let U=X(()=>{if(q.current)return;let l=k.current;if(!l)return;let g=Qt(l),w=g.length>0&&g[0]!==g[0].toUpperCase()?g[0].toUpperCase()+g.slice(1):g;T(w)},[T]),ie=X(()=>{R.current=performance.now(),U();let l=k.current;l&&K(Zt(l))},[U,K]);Xe(()=>{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 ue=X(()=>{q.current=!0,k.current?.setAttribute("data-aia-composing","true")},[]),Ce=X(()=>{q.current=!1,k.current?.removeAttribute("data-aia-composing"),U()},[U]),me=X(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),U()},[U]),u=X(l=>z(l),[z]),ge=X(()=>M(!0),[M]),fe=X(()=>M(!1),[M]),oe=X(()=>k.current?.focus(),[]),be=X(()=>k.current?.blur(),[]),j=X(()=>{let l=k.current;return l?Qt(l):""},[]),ne=Ri()?"plaintext-only":"true";return{inputRef:k,editorProps:{ref:k,contentEditable:ne,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":f,"aria-expanded":P,"aria-activedescendant":x,spellCheck:!0,enterKeyHint:"send",onInput:ie,onKeyDown:u,onCompositionStart:ue,onCompositionEnd:Ce,onPaste:me,onFocus:ge,onBlur:fe},getPlainText:j,focus:oe,blur:be}}import{jsx as Ne,jsxs as bt}from"react/jsx-runtime";function Hi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Bi=Oi(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:x,pillPlacement:I="dropdown",mode:T="auto",optionsPosition:z="below",animations:K=!0,dropdownTrigger:_,closeDropdownOnBlur:S,showNonTappableOptions:O,showOptionIcons:M=!0,showChipIcons:k=!0,showChipImages:q=!0,showOptionImages:F=!0,showOptionCounts:H=!0,showSkipButton:Z,showProducts:R,productsLayout:U,productImageFallback:ie,autoFocus:ue=!0,onFocus:Ce,onBlur:me,value:u,completedParams:ge,onChange:fe,onParamsChange:oe,products:be,mapProducts:j,onProductSelect:ne,submitButton:l,resetOnSubmit:g=!0},b){let w=We(null),C=We(null),L=We(()=>{}),p=We(null),N=We(null);Jt(()=>{let A=w.current;if(A)return p.current?p.current.setMode(T):p.current=new Mi(A,T),()=>{p.current?.destroy(),p.current=null}},[T]);let $=ft(A=>{let V=N.current?.current;V&&(V.focus(),Ni(V,A))},[]),{completedParams:re,suggestionPills:se,setActivePill:J,skipActivePill:we,segments:le,newParamId:ve,clearNewParamId:de,placeholderText:v,isFocused:Ee,isDropdownOpen:Ae,isActivePillSelected:xe,isLoading:h,activeIndex:Se,listboxId:Pe,handleTextChange:ee,handleKeyDown:et,setFocused:tt,editingParam:Re,editingIdentified:at,editingAnchor:ye,caretOffset:Ie,startEditingParam:Fe,handleCaretAfterInput:_e,handleCaretMove:it,replaceEditingRange:He,dropdownProps:qe,reset:d,refreshProducts:G,prepareSubmit:E,getState:Ue,recordSubmit:wt}=mt({onSubmit:A=>L.current(A),onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,apiConfig:c,additionalContext:s,language:m,currency:y,productId:P,visitorId:f,columns:x,dropdownTrigger:_,optionsPosition:z,closeDropdownOnBlur:S,showNonTappableOptions:O,showOptionIcons:M,showOptionImages:F,showOptionCounts:H,showSkipButton:Z,showProducts:R,onFocus:Ce,onBlur:me,value:u,completedParams:ge,onChange:fe,onParamsChange:oe,products:be,mapProducts:j,onProductSelect:ne,source:"full-sdk",setCursor:$});Jt(()=>{if(!ve)return;let A=window.setTimeout(()=>de(),650);return()=>window.clearTimeout(A)},[ve,de]);let ea=Se>=0?`${Pe}-option-${Se}`:void 0,{inputRef:ot,editorProps:ta,focus:Ve,blur:vt,getPlainText:xt}=Xt({segments:le,newParamId:ve,editingParam:Re,editingIdentified:at,editingAnchor:ye,caretOffset:Ie,placeholderText:v,isFocused:Ee,showChipIcons:k,showChipImages:q,isDropdownOpen:Ae,listboxId:Pe,activeDescendantId:ea,autoFocus:ue,handleTextChange:ee,handleKeyDown:et,handleCaretAfterInput:_e,handleCaretMove:it,startEditingParam:Fe,replaceEditingRange:He,setFocused:tt});N.current=ot,Li(()=>{let A=C.current,V=ot.current;if(!A||!V)return;let Be=()=>{let kt=A.firstElementChild;if(!kt)return;let na=kt.getBoundingClientRect(),ra=V.getBoundingClientRect();na.top>=ra.bottom-2?A.setAttribute("data-aia-pill-wrapped",""):A.removeAttribute("data-aia-pill-wrapped")};Be();let yt=new ResizeObserver(Be);return yt.observe(V),()=>yt.disconnect()},[le,se.length,h,ot]),Di(b,()=>({focus:Ve,blur:vt,reset:d,refreshProducts:G,setMode:A=>p.current?.setMode(A),skipActivePill:we}),[Ve,vt,d,G,we]);let je=!!le.length||re.length>0,nt=ft(A=>{if(!je)return;A&&E();let V=Ue(),Be=zi(xt(),V.completedParams,V.skippedParams,{identifiedParams:V.identifiedParams,isReady:V.isReady,customFields:V.customFields});A&&wt(Be),n(Be),g&&d()},[wt,g,je,E,Ue,n,d,xt]);L.current=()=>nt(!1);let aa=ft(A=>{A.target?.closest("[data-aia-pill]")||Ve()},[Ve]),ia=I==="inline",oa=I==="dropdown";return bt("div",{ref:w,className:`magicx-aia ${Te.container} ${a??""}`,"data-pill-placement":I,"data-options-position":z,"data-animations":K?"on":"off","data-mode":Hi(T),children:[Ne(ht,{...qe,showPills:oa,productsLayout:U,productImageFallback:ie}),bt("div",{className:Te.inputWrapper,"data-aia-input-wrapper":"",onClick:aa,children:[bt("div",{className:Te.editorArea,"data-aia-editor":"",children:[Ne("div",{...ta,className:Te.input,"data-aia-input":""}),ia&&(h||se.length>0)&&Ne("span",{ref:C,className:Te.pillListContainer,"data-aia-pill-list-container":"",children:Ne(Qe,{pills:se,activePillIndex:0,activeSelected:xe,onSelectPill:J,loading:h})})]}),l===null?null:l===void 0?Ne(Wt,{disabled:!je,onClick:()=>nt(!0),label:Fi(m).submit}):Ne("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Te.submitSlot,onClick:A=>{je&&(A.stopPropagation(),nt(!0))},children:l})]})]})});export{Bi as AIAutocomplete,ht as AIAutocompleteDropdown,Fn as DATE_RANGE_META_END,Hn as DATE_RANGE_META_START,Bn as DEFAULT_OPTION_COUNT_UNIT,Xn as PRODUCT_PATH_PREFIX,lr as WEEKDAY_LABELS,zn as buildSubmitResult,Mn as cellDay,Nn as cellIso,Kn as dateCellMarks,Gn as formatDate,Wn as formatDateRange,_n as formatOptionCount,qn as isoDate,Un as monthLabel,Vn as optionCountLabel,jn as optionHasImage,Yn as optionImageSources,Qn as optionImageSrc,Zn as optionLabel,$n as optionsShowLeadingVisuals,Jn as parseDate,er as parseLooseDate,tr as parseLooseDateRange,ar as productFromMatchedItem,ir as productImageSources,or as productsFromCustomFields,nr as sanitizeOptionIconSvg,rr as selectedRangeFor,mt as useAIAutocomplete,sr as visibleDateRange,dr 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