@magicx-eng/ai-autocomplete-react 0.66.2 → 0.67.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 Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END as Bs,DATE_RANGE_META_START as Ws,DEFAULT_OPTION_COUNT_UNIT as Gs,dateCellMarks as Ks,focusesInputOnSelect as qs,formatDate as _s,formatDateRange as Vs,formatOptionCount as Us,formatPlace as Qs,formatTime as Ys,isoDate as js,isTouchPrimary as $s,LOCATION_META_KEY as Zs,monthLabel as Xs,optionCountLabel as Js,optionHasImage as el,optionImageSources as tl,optionImageSrc as al,optionLabel as il,optionsShowLeadingVisuals as ol,PRODUCT_PATH_PREFIX as nl,parseDate as rl,parseLooseDate as sl,parseLooseDateRange as ll,parseTime as dl,productFromMatchedItem as cl,productImageSources as pl,productsFromCustomFields as hl,sanitizeOptionIconSvg as ul,selectedRangeFor as ml,TIME_META_KEY as gl,visibleDateRange as fl,WEEKDAY_LABELS as bl,withSkippedParams as wl}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as xn,useCallback as Dt,useEffect as Zt,useImperativeHandle as yn,useLayoutEffect as kn,useRef as ft}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 Ks,cellDay as qs,cellIso as _s,DATE_RANGE_META_END as Vs,DATE_RANGE_META_START as Us,DEFAULT_OPTION_COUNT_UNIT as Qs,dateCellMarks as Ys,focusesInputOnSelect as js,formatDate as $s,formatDateRange as Zs,formatOptionCount as Xs,formatPlace as Js,formatTime as el,isoDate as tl,isTouchPrimary as al,LOCATION_META_KEY as il,monthLabel as ol,optionCountLabel as nl,optionHasImage as rl,optionImageSources as sl,optionImageSrc as ll,optionLabel as dl,optionsShowLeadingVisuals as cl,PRODUCT_PATH_PREFIX as pl,parseDate as hl,parseLooseDate as ul,parseLooseDateRange as ml,parseTime as gl,productFromMatchedItem as fl,productImageSources as bl,productsFromCustomFields as wl,sanitizeOptionIconSvg as vl,selectedRangeFor as xl,TIME_META_KEY as yl,visibleDateRange as kl,WEEKDAY_LABELS as Sl,withSkippedParams as Cl}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Tn,useCallback as Mt,useEffect as Jt,useImperativeHandle as Pn,useLayoutEffect as In,useMemo as An,useRef as gt}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
@@ -157,6 +157,30 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
157
157
  background: var(--aia-completed-pill-bg-active, rgba(189, 189, 189, 0.35));
158
158
  }
159
159
 
160
+ /* A chip whose removal finds items when the search found none (custom_fields.blocking_filters).
161
+ Greyed out at half opacity. After the hover rule, so it stays greyed while pointed at. */
162
+ :where(.aia-input-IW-P-) strong[class~="magicx-aia-segment--blocking"] {
163
+ opacity: var(--aia-blocking-chip-opacity, 0.5);
164
+ }
165
+
166
+ /* The \xD7 of a greyed chip keeps its normal weight: its opacity multiplies with the chip's, so it is divided back out. */
167
+ :where(.aia-input-IW-P-)
168
+ strong[class~="magicx-aia-segment--blocking"]
169
+ span[class~="magicx-aia-segment-remove"] {
170
+ opacity: calc(var(--aia-chip-remove-opacity, 0.32) / var(--aia-blocking-chip-opacity, 0.5));
171
+ }
172
+
173
+ @media (hover: hover) {
174
+ :where(.aia-input-IW-P-)
175
+ strong[class~="magicx-aia-segment--blocking"]
176
+ span[class~="magicx-aia-segment-remove"]:hover {
177
+ opacity: calc(
178
+ var(--aia-chip-remove-opacity-hover, 0.7) /
179
+ var(--aia-blocking-chip-opacity, 0.5)
180
+ );
181
+ }
182
+ }
183
+
160
184
  /* The picked option's icon inside a completed chip (see \`icon_svg\` on
161
185
  CompletedParamState). Inline-block, one em square and sat on the text
162
186
  baseline; the chip is one inline-block, so the icon never ends a line
@@ -439,7 +463,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
439
463
  transition: none;
440
464
  }
441
465
  }
442
- `,document.head.appendChild(e)}var Je={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};import{attachScrollArrow as So,attachViewportFit as Co,containScroll as To,dateFloorFor as Po,destroyPanelMorph as Io,findMultiSelectDone as Ao,fitMultiSelectDone as Eo,hasSkippablePill as Ro,isCalendarFormat as zo,labelTraditionalAutocomplete as Lo,panelMorphKey as Oo,queryLive as Do,settlePanelMorph as Mo,syncPanelHug as No,uiStringsFor as Fo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as tt,useLayoutEffect as Ut,useRef as mt,useState as Ho}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
466
+ `,document.head.appendChild(e)}var Je={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};import{attachScrollArrow as Ao,attachViewportFit as Eo,containScroll as Ro,dateFloorFor as zo,destroyPanelMorph as Lo,findMultiSelectDone as Oo,fitMultiSelectDone as Do,hasSkippablePill as Mo,isCalendarFormat as No,labelTraditionalAutocomplete as Fo,panelMorphKey as Ho,queryLive as Bo,settlePanelMorph as Wo,syncPanelHug as Go,uiStringsFor as Ko}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as tt,useLayoutEffect as Yt,useRef as ut,useState as qo}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
443
467
  * Built-in appearance defaults \u2014 zero specificity via :where().
444
468
  * Consumer CSS always wins without !important.
445
469
  *
@@ -1164,13 +1188,15 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
1164
1188
  );
1165
1189
  }
1166
1190
  }
1167
- /* While the panel glides wider (panelMorph.ts), its new content is laid out at
1168
- the width it lands at and the panel, which clips, reveals it as it opens:
1169
- squeezed into the narrow width it starts from, two columns would wrap. The
1170
- leaving copy keeps its own width. */
1191
+ /* While the panel glides to a new width (panelMorph.ts), its new content is
1192
+ laid out at the width it lands at, so it never rewraps under the glide:
1193
+ wider, the panel, which clips, reveals it as it opens; narrower, it starts
1194
+ at its final width instead of squeezing frame by frame. The leaving copy
1195
+ keeps its own width. */
1171
1196
  [data-aia-dropdown][data-aia-glide-width]
1172
1197
  > :not(.magicx-aia-panel-ghost):not([data-aia-scroll-arrow]) {
1173
1198
  min-width: var(--aia-glide-content-width, auto);
1199
+ max-width: var(--aia-glide-content-width, none);
1174
1200
  }
1175
1201
  /* The All row's tile shows the first options' pictures together: two side by
1176
1202
  side, three as a tall half and two quarters, four in a 2x2 grid. Each is
@@ -1811,7 +1837,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
1811
1837
  opacity: 1;
1812
1838
  }
1813
1839
  }
1814
- `,document.head.appendChild(e)}var pe={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",seeAllSpin:"aia-seeAllSpin-jlsZP",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as oi,cellIso as yt,dateCellMarks as ni,isDimmedDay as ri,isoDate as si,monthLabel as li,visibleDateRange as di,WEEKDAY_LABELS as ci}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as pi}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) ---
1840
+ `,document.head.appendChild(e)}var me={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",seeAllSpin:"aia-seeAllSpin-jlsZP",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as si,cellIso as vt,dateCellMarks as li,isDimmedDay as di,isoDate as ci,monthLabel as pi,visibleDateRange as hi,WEEKDAY_LABELS as ui}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as mi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1815
1841
 
1816
1842
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1817
1843
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -2008,7 +2034,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
2008
2034
  opacity: 0.8;
2009
2035
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
2010
2036
  }
2011
- `,document.head.appendChild(e)}var V={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};import{jsx as Te,jsxs as ca}from"react/jsx-runtime";var hi=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function pa({options:e,activeIndex:n,listboxId:t,view:i,selection:o,onSelect:l,onHighlight:r,onUnhighlight:d,onPreviousMonth:f,onNextMonth:v}){let x=si(new Date),m=di({pendingStart:o.rangeStart,highlightedIso:yt(e[n]),selected:o.selectedRange,floor:o.floor});return ca("div",{className:V.datepicker,"data-aia-datepicker":"",children:[ca("div",{className:V.header,children:[Te("button",{type:"button",tabIndex:-1,className:V.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:f,children:"\u2039"}),Te("span",{className:V.month,"data-aia-date-month":"","aria-live":"polite",children:li(i)}),Te("button",{type:"button",tabIndex:-1,className:V.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:v,children:"\u203A"})]}),Te("div",{className:V.weekdays,"aria-hidden":"true",children:ci.map((p,h)=>Te("span",{className:V.weekday,children:p},hi[h]))}),Te("div",{className:V.grid,"data-aia-date-grid":"",children:e.map((p,h)=>Te(ui,{option:p,id:`${t}-option-${h}`,index:h,isHighlighted:h===n&&p.is_tappable,isToday:yt(p)===x,isPast:ri(yt(p),x,o.floor),marks:ni(yt(p),{selectedIso:o.selectedIso,range:m,references:o.references}),onSelect:l,onHighlight:r,onUnhighlight:d},yt(p)??`pad-${h}`))})]})}function ui({option:e,id:n,index:t,isHighlighted:i,isToday:o,isPast:l,marks:r,onSelect:d,onHighlight:f,onUnhighlight:v}){let[x,m]=pi(!1),p=oi(e);if(p==null)return Te("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${V.cell} ${V.blank}`});let h=()=>{m(!0),d(e),setTimeout(()=>m(!1),170)},y=[V.cell,V.day,l?V.past:"",i?V.highlighted:"",o?V.today:"",r.inRange?V.inRange:"",r.selected?V.selected:"",r.reference?V.reference:"",x?V.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:y,onClick:h,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),h())},onMouseEnter:()=>f(t),onMouseLeave:v?()=>v(t):void 0,children:Te("span",{className:V.number,children:p})})}import{ATTRIBUTION_URL as mi,buildAttributionUrl as gi,getFooterHint as fi,uiStringsFor as bi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as wi,useState as vi}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 {
2037
+ `,document.head.appendChild(e)}var _={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};import{jsx as Te,jsxs as ha}from"react/jsx-runtime";var gi=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ua({options:e,activeIndex:r,listboxId:t,view:o,selection:n,onSelect:l,onHighlight:s,onUnhighlight:c,onPreviousMonth:w,onNextMonth:v}){let y=ci(new Date),m=hi({pendingStart:n.rangeStart,highlightedIso:vt(e[r]),selected:n.selectedRange,floor:n.floor});return ha("div",{className:_.datepicker,"data-aia-datepicker":"",children:[ha("div",{className:_.header,children:[Te("button",{type:"button",tabIndex:-1,className:_.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:u=>u.preventDefault(),onClick:w,children:"\u2039"}),Te("span",{className:_.month,"data-aia-date-month":"","aria-live":"polite",children:pi(o)}),Te("button",{type:"button",tabIndex:-1,className:_.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:u=>u.preventDefault(),onClick:v,children:"\u203A"})]}),Te("div",{className:_.weekdays,"aria-hidden":"true",children:ui.map((u,p)=>Te("span",{className:_.weekday,children:u},gi[p]))}),Te("div",{className:_.grid,"data-aia-date-grid":"",children:e.map((u,p)=>Te(fi,{option:u,id:`${t}-option-${p}`,index:p,isHighlighted:p===r&&u.is_tappable,isToday:vt(u)===y,isPast:di(vt(u),y,n.floor),marks:li(vt(u),{selectedIso:n.selectedIso,range:m,references:n.references}),onSelect:l,onHighlight:s,onUnhighlight:c},vt(u)??`pad-${p}`))})]})}function fi({option:e,id:r,index:t,isHighlighted:o,isToday:n,isPast:l,marks:s,onSelect:c,onHighlight:w,onUnhighlight:v}){let[y,m]=mi(!1),u=si(e);if(u==null)return Te("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${_.cell} ${_.blank}`});let p=()=>{m(!0),c(e),setTimeout(()=>m(!1),170)},k=[_.cell,_.day,l?_.past:"",o?_.highlighted:"",n?_.today:"",s.inRange?_.inRange:"",s.selected?_.selected:"",s.reference?_.reference:"",y?_.pressed:""].filter(Boolean).join(" ");return Te("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":o,"aria-label":e.text,tabIndex:0,className:k,onClick:p,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),p())},onMouseEnter:()=>w(t),onMouseLeave:v?()=>v(t):void 0,children:Te("span",{className:_.number,children:u})})}import{ATTRIBUTION_URL as bi,buildAttributionUrl as wi,getFooterHint as vi,uiStringsFor as xi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as yi,useState as ki}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
2012
2038
  display: flex;
2013
2039
  flex-wrap: wrap;
2014
2040
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -2048,7 +2074,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
2048
2074
  .aia-cluster[data-justify="around"] {
2049
2075
  justify-content: space-around;
2050
2076
  }
2051
- `,document.head.appendChild(e)}import{jsx as ha}from"react/jsx-runtime";function kt({gap:e,align:n="center",justify:t="start",noWrap:i=!1,inline:o=!1,className:l,children:r,...d}){let f=e?{"--aia-cluster-gap":e}:void 0,v={className:l?`aia-cluster ${l}`:"aia-cluster","data-align":n,"data-justify":t,"data-nowrap":i||void 0,"data-inline":o||void 0,style:f,...d};return o?ha("span",{...v,children:r}):ha("div",{...v,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
2077
+ `,document.head.appendChild(e)}import{jsx as ma}from"react/jsx-runtime";function xt({gap:e,align:r="center",justify:t="start",noWrap:o=!1,inline:n=!1,className:l,children:s,...c}){let w=e?{"--aia-cluster-gap":e}:void 0,v={className:l?`aia-cluster ${l}`:"aia-cluster","data-align":r,"data-justify":t,"data-nowrap":o||void 0,"data-inline":n||void 0,style:w,...c};return n?ma("span",{...v,children:s}):ma("div",{...v,children:s})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
2052
2078
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
2053
2079
  room above the hint/branding row so the footer doesn't butt against the last
2054
2080
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -2196,7 +2222,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
2196
2222
  justify-content: flex-end;
2197
2223
  }
2198
2224
  }
2199
- `,document.head.appendChild(e)}var Me={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 ht,jsxs as ua}from"react/jsx-runtime";function ma({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:t=bi()}){let{key:i,hint:o}=fi(e,n,t),[l,r]=vi(mi);return wi(()=>{r(gi())},[]),ht("footer",{className:Me.footer,"data-aia-footer":"",children:ua(kt,{justify:"between",noWrap:!0,className:Me.row,children:[ua(kt,{gap:"5px",className:Me.hintGroup,children:[ht("kbd",{className:Me.key,children:i}),ht("span",{className:Me.hint,children:o})]}),ht("a",{className:Me.brandLink,href:l,target:"_blank",rel:"noopener noreferrer",children:ht("span",{className:Me.badge,children:ht("span",{className:Me.brand,children:"Powered by Intent-1"})})})]})})}import{useEffect as ga,useLayoutEffect as xi,useRef as he}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
2225
+ `,document.head.appendChild(e)}var Me={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 pt,jsxs as ga}from"react/jsx-runtime";function fa({isOptionHighlighted:e=!1,isInputEmpty:r=!1,strings:t=xi()}){let{key:o,hint:n}=vi(e,r,t),[l,s]=ki(bi);return yi(()=>{s(wi())},[]),pt("footer",{className:Me.footer,"data-aia-footer":"",children:ga(xt,{justify:"between",noWrap:!0,className:Me.row,children:[ga(xt,{gap:"5px",className:Me.hintGroup,children:[pt("kbd",{className:Me.key,children:o}),pt("span",{className:Me.hint,children:n})]}),pt("a",{className:Me.brandLink,href:l,target:"_blank",rel:"noopener noreferrer",children:pt("span",{className:Me.badge,children:pt("span",{className:Me.brand,children:"Powered by Intent-1"})})})]})})}import{useEffect as ba,useLayoutEffect as Si,useRef as ge}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
2200
2226
  Angular copy). The three are kept identical by
2201
2227
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
2202
2228
  .aia-location-6-fsr {
@@ -2330,7 +2356,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
2330
2356
  .aia-loadingBar-OLCr4:nth-child(3) {
2331
2357
  width: 60%;
2332
2358
  }
2333
- `,document.head.appendChild(e)}var Y={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};import{jsx as oe,jsxs as Ge}from"react/jsx-runtime";var yi=0;function St(e){return e.getRootNode().activeElement??null}function wa(e){return e.getRootNode().getSelection?.()??document.getSelection()}function fa(e){if(!e.isContentEditable)return null;let n=wa(e);if(!n||n.rangeCount===0)return null;let t=n.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function ba(e,n){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=wa(e);if(!t)return;let i=n;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}var ki=Ge("svg",{className:Y.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[oe("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),oe("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Si=Ge("svg",{className:Y.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[oe("circle",{cx:"11",cy:"11",r:"7"}),oe("path",{d:"m20 20-3.5-3.5"})]});function va({view:e,searchLabel:n,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:l=!1,visible:r=!0,interactive:d=!0,onQuery:f,onMove:v,onCommit:x,onFocusChange:m}){let p=he(null),h=he(null),y=he(null),S=he(null),T=he(null),D=he(!1),O=he(!1),$=he(!1),F=he(!1),E=he(o);E.current=o;let M=he(m);M.current=m;let H=c=>{F.current=c,m(c)},K=()=>{let c=p.current;return c!=null&&St(c)===c},ne=()=>{let c=h.current;if(!c)return;let k=St(c);k instanceof HTMLElement&&k!==p.current&&k!==document.body&&!c.contains(k)&&(S.current=k,T.current=fa(k))},q=c=>{let k=h.current;!k||!(c instanceof HTMLElement)||c===S.current||c===document.body||k.contains(c)||(S.current=c,T.current=fa(c))},P=he(null);P.current===null&&(P.current=`aia-location-${++yi}`);let Z=`${P.current}-row-`;ga(()=>{let c=p.current;c&&c.value!==e.query&&St(c)!==c&&(c.value=e.query)},[e.query]),ga(()=>{o&&(l&&!$.current&&(O.current=!1),$.current=l);let c=p.current;if(c){if(!r&&K()){O.current=!0,_();return}if(!o){setTimeout(()=>{if(E.current)return;let k=S.current;k&&St(k)===k||(O.current=!1)},0);return}if(!(!l||O.current||!d||K())){if(ne(),H(!0),c.focus({preventScroll:!0}),!K()){O.current=!0,H(!1);return}c.value&&c.select()}}}),xi(()=>()=>{if(!F.current)return;let c=p.current,k=S.current;k?.isConnected&&c&&St(c)===c&&(D.current=!0,ba(k,T.current),D.current=!1),F.current=!1,M.current(!1)},[]);let _=(c=!1)=>{c&&(O.current=!0);let k=S.current;k?.isConnected&&K()&&(D.current=!0,ba(k,T.current),D.current=!1),H(!1)},se=e.query.trim(),A=e.highlighted>=0&&e.highlighted<e.places.length?`${Z}${e.highlighted}`:void 0,G=null;return e.places.length>0?G=e.places.map((c,k)=>Ge("div",{id:`${Z}${k}`,role:"option","aria-selected":k===e.highlighted,className:k===e.highlighted?`${Y.row} ${Y.highlighted}`:Y.row,"data-aia-location-row":"","data-aia-index":k,onClick:()=>{d&&(_(!0),x(k))},children:[oe("span",{className:Y.pin,children:ki}),Ge("span",{className:Y.text,children:[oe("span",{className:Y.name,children:c.name}),c.secondary&&oe("span",{className:Y.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?G=Ge("div",{className:Y.loading,"data-aia-location-loading":"",children:[oe("span",{className:Y.loadingBar}),oe("span",{className:Y.loadingBar}),oe("span",{className:Y.loadingBar})]}):se&&(G=Ge("div",{className:Y.note,"data-aia-location-note":"",children:[e.status==="done"&&oe("span",{className:Y.empty,children:t}),oe("span",{children:i})]})),Ge("div",{ref:h,className:Y.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!y.current?.contains(c.target)||(c.stopPropagation(),ne(),H(!0))},children:[Ge("label",{ref:y,className:Y.field,children:[Si,oe("input",{ref:p,type:"text",className:Y.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:n,"aria-label":n,"aria-activedescendant":A,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>f(c.target.value),onFocus:c=>{q(c.relatedTarget),H(!0)},onBlur:()=>{D.current||(O.current=!0,H(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!d)return;_(!0),x();return;case"Escape":c.preventDefault(),c.stopPropagation(),O.current=!0,_();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),O.current=!0,_();return}}})]}),oe("div",{className:Y.results,"data-aia-location-results":"","aria-live":"polite",children:G})]})}import{isSmartSuggestion as Ii,isTraditionalAutocompleteSuggestion as Ai}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Ci}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,
2359
+ `,document.head.appendChild(e)}var U={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};import{jsx as re,jsxs as _e}from"react/jsx-runtime";var Ci=0;function yt(e){return e.getRootNode().activeElement??null}function xa(e){return e.getRootNode().getSelection?.()??document.getSelection()}function wa(e){if(!e.isContentEditable)return null;let r=xa(e);if(!r||r.rangeCount===0)return null;let t=r.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function va(e,r){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=xa(e);if(!t)return;let o=r;(!o||!o.startContainer.isConnected||!e.contains(o.startContainer))&&(o=document.createRange(),o.selectNodeContents(e),o.collapse(!1)),t.removeAllRanges(),t.addRange(o)}var Ti=_e("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[re("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),re("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Pi=_e("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[re("circle",{cx:"11",cy:"11",r:"7"}),re("path",{d:"m20 20-3.5-3.5"})]});function ya({view:e,searchLabel:r,noResultsLabel:t,useTypedLabel:o,widgetFocused:n,reediting:l=!1,visible:s=!0,interactive:c=!0,onQuery:w,onMove:v,onCommit:y,onFocusChange:m}){let u=ge(null),p=ge(null),k=ge(null),S=ge(null),T=ge(null),O=ge(!1),L=ge(!1),j=ge(!1),N=ge(!1),A=ge(n);A.current=n;let D=ge(m);D.current=m;let F=a=>{N.current=a,m(a)},Y=()=>{let a=u.current;return a!=null&&yt(a)===a},ie=()=>{let a=p.current;if(!a)return;let x=yt(a);x instanceof HTMLElement&&x!==u.current&&x!==document.body&&!a.contains(x)&&(S.current=x,T.current=wa(x))},X=a=>{let x=p.current;!x||!(a instanceof HTMLElement)||a===S.current||a===document.body||x.contains(a)||(S.current=a,T.current=wa(a))},W=ge(null);W.current===null&&(W.current=`aia-location-${++Ci}`);let I=`${W.current}-row-`;ba(()=>{let a=u.current;a&&a.value!==e.query&&yt(a)!==a&&(a.value=e.query)},[e.query]),ba(()=>{n&&(l&&!j.current&&(L.current=!1),j.current=l);let a=u.current;if(a){if(!s&&Y()){L.current=!0,G();return}if(!n){setTimeout(()=>{if(A.current)return;let x=S.current;x&&yt(x)===x||(L.current=!1)},0);return}if(!(!l||L.current||!c||Y())){if(ie(),F(!0),a.focus({preventScroll:!0}),!Y()){L.current=!0,F(!1);return}a.value&&a.select()}}}),Si(()=>()=>{if(!N.current)return;let a=u.current,x=S.current;x?.isConnected&&a&&yt(a)===a&&(O.current=!0,va(x,T.current),O.current=!1),N.current=!1,D.current(!1)},[]);let G=(a=!1)=>{a&&(L.current=!0);let x=S.current;x?.isConnected&&Y()&&(O.current=!0,va(x,T.current),O.current=!1),F(!1)},se=e.query.trim(),le=e.highlighted>=0&&e.highlighted<e.places.length?`${I}${e.highlighted}`:void 0,ee=null;return e.places.length>0?ee=e.places.map((a,x)=>_e("div",{id:`${I}${x}`,role:"option","aria-selected":x===e.highlighted,className:x===e.highlighted?`${U.row} ${U.highlighted}`:U.row,"data-aia-location-row":"","data-aia-index":x,onClick:()=>{c&&(G(!0),y(x))},children:[re("span",{className:U.pin,children:Ti}),_e("span",{className:U.text,children:[re("span",{className:U.name,children:a.name}),a.secondary&&re("span",{className:U.secondary,children:a.secondary})]})]},a.id)):e.status==="loading"?ee=_e("div",{className:U.loading,"data-aia-location-loading":"",children:[re("span",{className:U.loadingBar}),re("span",{className:U.loadingBar}),re("span",{className:U.loadingBar})]}):se&&(ee=_e("div",{className:U.note,"data-aia-location-note":"",children:[e.status==="done"&&re("span",{className:U.empty,children:t}),re("span",{children:o})]})),_e("div",{ref:p,className:U.location,"data-aia-location":"",onMouseDown:a=>{!(a.target instanceof Node)||!k.current?.contains(a.target)||(a.stopPropagation(),ie(),F(!0))},children:[_e("label",{ref:k,className:U.field,children:[Pi,re("input",{ref:u,type:"text",className:U.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:r,"aria-label":r,"aria-activedescendant":le,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:s?0:-1,onChange:a=>w(a.target.value),onFocus:a=>{X(a.relatedTarget),F(!0)},onBlur:()=>{O.current||(L.current=!0,F(!1))},onKeyDown:a=>{if(!a.nativeEvent.isComposing)switch(a.key){case"ArrowDown":case"ArrowUp":a.preventDefault(),v(a.key==="ArrowDown"?1:-1);return;case"Enter":if(a.preventDefault(),!c)return;G(!0),y();return;case"Escape":a.preventDefault(),a.stopPropagation(),L.current=!0,G();return;case"Backspace":if(a.currentTarget.value!=="")return;a.preventDefault(),L.current=!0,G();return}}})]}),re("div",{className:U.results,"data-aia-location-results":"","aria-live":"polite",children:ee})]})}import{isSmartSuggestion as Ri,isTraditionalAutocompleteSuggestion as zi}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Ii}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,
2334
2360
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
2335
2361
  The border is kept as a 1px transparent line so the box stays the same size
2336
2362
  as it was when the outline was dashed. */
@@ -2488,7 +2514,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
2488
2514
  opacity: 0;
2489
2515
  }
2490
2516
  }
2491
- `,document.head.appendChild(e)}var Pe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};import{Fragment as Ti,jsx as Ht,jsxs as Pi}from"react/jsx-runtime";var Bt={selected:1,first:.7,next:.4,last:.2};function xa({label:e,state:n,active:t,rounded:i,loading:o,smartSuggestion:l,completionHeader:r,onClick:d}){let f=[Pe.pill,i?Pe.rounded:"",o?Pe.skeleton:""].filter(Boolean).join(" ");return Ht("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":l?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:f,style:{"--aia-pill-opacity":Bt[n]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:d,disabled:o,children:l?Pi(Ti,{children:[Ht("span",{className:`${Pe.smartText} magicx-aia-smart-suggestion-text`,children:e}),Ht("span",{className:`${Pe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Ci}})]}):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 {
2517
+ `,document.head.appendChild(e)}var Pe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};import{Fragment as Ai,jsx as Bt,jsxs as Ei}from"react/jsx-runtime";var Wt={selected:1,first:.7,next:.4,last:.2};function ka({label:e,state:r,active:t,rounded:o,loading:n,smartSuggestion:l,completionHeader:s,onClick:c}){let w=[Pe.pill,o?Pe.rounded:"",n?Pe.skeleton:""].filter(Boolean).join(" ");return Bt("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":n?"":void 0,"data-aia-smart-suggestion":l?s?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:w,style:{"--aia-pill-opacity":Wt[r]},onMouseDown:v=>v.preventDefault(),onClick:n?void 0:c,disabled:n,children:l?Ei(Ai,{children:[Bt("span",{className:`${Pe.smartText} magicx-aia-smart-suggestion-text`,children:e}),Bt("span",{className:`${Pe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Ii}})]}):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 {
2492
2518
  position: relative;
2493
2519
  z-index: 1;
2494
2520
  pointer-events: auto;
@@ -2498,7 +2524,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
2498
2524
  align-items: center;
2499
2525
  vertical-align: middle;
2500
2526
  }
2501
- `,document.head.appendChild(e)}var Wt={list:"aia-list-qvLqO"};import{jsx as At}from"react/jsx-runtime";var Ei=[125,69];function ya(e){return e===0?"first":e===1?"next":"last"}function Et({pills:e,activePillIndex:n,onSelectPill:t,activeSelected:i,rounded:o,loading:l}){return l&&e.length===0?At("span",{className:Wt.list,"data-aia-pill-list-loading":"",children:Ei.map((r,d)=>At("span",{"data-aia-pill-skeleton":"",className:`${Pe.pill} ${o?Pe.rounded:""} ${Pe.skeleton}`,style:{width:r,"--aia-pill-opacity":Bt[ya(d)]}},`skel-${r}`))}):At("span",{className:Wt.list,"data-aia-pill-list-loading":l?"":void 0,children:e.map((r,d)=>{let f=!!i&&d===n;return At(xa,{label:r.text,state:f?"selected":ya(d),selected:f,active:d===n,rounded:o,loading:l,smartSuggestion:Ii(r),completionHeader:Ai(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as Ri,productImageSources as zi,productImageSrc as Li,productInitial as Oi,productPhotoFill as Di,uiStringsFor as Mi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Gt,useRef as Rt,useState as zt}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
2527
+ `,document.head.appendChild(e)}var Gt={list:"aia-list-qvLqO"};import{jsx as Et}from"react/jsx-runtime";var Li=[125,69];function Sa(e){return e===0?"first":e===1?"next":"last"}function Rt({pills:e,activePillIndex:r,onSelectPill:t,activeSelected:o,rounded:n,loading:l}){return l&&e.length===0?Et("span",{className:Gt.list,"data-aia-pill-list-loading":"",children:Li.map((s,c)=>Et("span",{"data-aia-pill-skeleton":"",className:`${Pe.pill} ${n?Pe.rounded:""} ${Pe.skeleton}`,style:{width:s,"--aia-pill-opacity":Wt[Sa(c)]}},`skel-${s}`))}):Et("span",{className:Gt.list,"data-aia-pill-list-loading":l?"":void 0,children:e.map((s,c)=>{let w=!!o&&c===r;return Et(ka,{label:s.text,state:w?"selected":Sa(c),selected:w,active:c===r,rounded:n,loading:l,smartSuggestion:Ri(s),completionHeader:zi(s),onClick:()=>t(c)},`${s.parameter}-${s.text}`)})})}import{attachProductRowWheel as Oi,productImageSources as Di,productImageSrc as Mi,productInitial as Ni,productPhotoFill as Fi,uiStringsFor as Hi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Kt,useRef as zt,useState as Lt}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
2502
2528
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
2503
2529
  theming one package sees the same result in the other.
2504
2530
 
@@ -3125,7 +3151,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
3125
3151
  opacity: 0.01;
3126
3152
  }
3127
3153
  }
3128
- `,document.head.appendChild(e)}var j={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};import{jsx as te,jsxs as ut}from"react/jsx-runtime";function ka({products:e,listboxId:n,onSelect:t,busyProductId:i=null,onAddToCart:o,onFocusChange:l,focusable:r=!0,loading:d=!1,layout:f="row",imageFallback:v="image",showVendor:x=!0,strings:m=Mi()}){let p=e.length>0,h=Rt(null);if(Gt(()=>{let S=h.current;if(!(!p||!S))return Ri(S)},[p]),!p)return null;let y=`${n}-products-label`;return ut("section",{className:j.section,"data-aia-products":"","data-aia-loading":d?"":void 0,"data-aia-products-layout":f,role:"group","aria-labelledby":y,children:[te("div",{className:j.label,id:y,"data-aia-products-label":"",children:m.products}),te("div",{ref:h,className:j.row,"data-aia-products-row":"",children:e.map((S,T)=>te(Ni,{product:S,id:`${n}-product-${T}`,onSelect:t,busy:S.id===i,onAddToCart:o,onFocusChange:l,focusable:r,imageFallback:v,showVendor:x,soldOut:m.soldOut,addToCart:m.addToCart},S.id))})]})}function Ni({product:e,id:n,onSelect:t,busy:i,onAddToCart:o,onFocusChange:l,focusable:r,imageFallback:d,showVendor:f,soldOut:v,addToCart:x}){let m=!!o&&e.available!==!1,[p,h]=zt(null),y=T=>{T.relatedTarget?.closest("[data-aia-dropdown]")||l?.(!1)},S=T=>{T.metaKey||T.ctrlKey||T.shiftKey||T.altKey||T.button!==0||(T.preventDefault(),t(e))};return ut("a",{id:n,className:j.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":m?"":void 0,"data-aia-product-state":i?"busy":void 0,"aria-busy":i?!0:void 0,role:"option","aria-selected":!1,style:p?{"--aia-product-photo-fill-x":String(p.x),"--aia-product-photo-fill-y":String(p.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:S,onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),t(e))},onFocus:()=>l?.(!0),onBlur:y,children:[te(Bi,{sources:zi(e.imageUrl),title:e.title,fallback:d,onPhotoFill:h},Li(e.imageUrl)??""),ut("span",{className:j.body,children:[f&&e.vendor?te("span",{className:j.vendor,children:e.vendor}):null,te("span",{className:j.title,children:e.title}),e.price?ut("span",{className:j.price,children:[e.price,e.compareAtPrice?te("s",{className:j.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?te("span",{className:j.badge,children:v}):null]}),m&&o?te(Hi,{product:e,label:`${x}: ${e.title}`,focusable:r,onAddToCart:o,onFocus:()=>l?.(!0),onBlur:y},Fi(e)):null]})}function Fi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function Hi({product:e,label:n,focusable:t,onAddToCart:i,onFocus:o,onBlur:l}){let[r,d]=zt(null),f=Rt(null),v=Rt(e);v.current=e;let x=Rt(!0);Gt(()=>(x.current=!0,()=>{x.current=!1}),[]);let m=h=>{f.current=h,x.current&&d(h)},p=h=>{if(h.preventDefault(),h.stopPropagation(),f.current==="adding")return;m("adding");let y;try{y=Promise.resolve(i(v.current))}catch(S){y=Promise.reject(S)}y.then(()=>m("added"),()=>m(null))};return te("span",{className:j.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:t?0:-1,onClick:p,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||p(h)},onFocus:h=>{h.stopPropagation(),o()},onBlur:h=>{h.stopPropagation(),l(h)},children:ut("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[te("path",{className:j.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"}),te("path",{className:j.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),te("path",{className:j.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),te("path",{className:j.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),te("circle",{className:j.cartGlyph,cx:"9",cy:"20",r:"1.3"}),te("circle",{className:j.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Bi({sources:e,title:n,fallback:t,onPhotoFill:i}){let[o,l]=zt(0),r=e[o],d=!!r,[f,v]=zt(null),x=!d&&t==="initial";return Gt(()=>()=>i(null),[i]),ut("span",{className:j.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!d&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":d&&f===r?"":void 0,children:[d?te("img",{className:j.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{v(r),i(Di(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),l(m=>m+1)}}):null,x?Oi(n):null]})}import{isOptionsGridMobileViewport as Ji,measureOptionsGrid as eo,needsOptionsGridMeasurement as to,OPTIONS_GRID_MOBILE_QUERY as ao,optionEnterDelayMs as io,optionsShowLeadingVisuals as oo,planOptionsGrid as Ia,pointerMayHighlight as Aa,releasePanelHug as no,sameOptionRows as ro,syncHighlightScroll as so,syncPanelHug as lo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as co,useLayoutEffect as qt,useRef as Ea,useState as za}from"react";import{optionsGridTemplateColumns as Wi}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Gi,useRef as Ki}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 {
3154
+ `,document.head.appendChild(e)}var Q={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};import{jsx as J,jsxs as ht}from"react/jsx-runtime";function Ca({products:e,listboxId:r,onSelect:t,busyProductId:o=null,onAddToCart:n,onFocusChange:l,focusable:s=!0,loading:c=!1,layout:w="row",imageFallback:v="image",showVendor:y=!0,strings:m=Hi()}){let u=e.length>0,p=zt(null);if(Kt(()=>{let S=p.current;if(!(!u||!S))return Oi(S)},[u]),!u)return null;let k=`${r}-products-label`;return ht("section",{className:Q.section,"data-aia-products":"","data-aia-loading":c?"":void 0,"data-aia-products-layout":w,role:"group","aria-labelledby":k,children:[J("div",{className:Q.label,id:k,"data-aia-products-label":"",children:m.products}),J("div",{ref:p,className:Q.row,"data-aia-products-row":"",children:e.map((S,T)=>J(Bi,{product:S,id:`${r}-product-${T}`,onSelect:t,busy:S.id===o,onAddToCart:n,onFocusChange:l,focusable:s,imageFallback:v,showVendor:y,soldOut:m.soldOut,addToCart:m.addToCart},S.id))})]})}function Bi({product:e,id:r,onSelect:t,busy:o,onAddToCart:n,onFocusChange:l,focusable:s,imageFallback:c,showVendor:w,soldOut:v,addToCart:y}){let m=!!n&&e.available!==!1,[u,p]=Lt(null),k=T=>{T.relatedTarget?.closest("[data-aia-dropdown]")||l?.(!1)},S=T=>{T.metaKey||T.ctrlKey||T.shiftKey||T.altKey||T.button!==0||(T.preventDefault(),t(e))};return ht("a",{id:r,className:Q.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":m?"":void 0,"data-aia-product-state":o?"busy":void 0,"aria-busy":o?!0:void 0,role:"option","aria-selected":!1,style:u?{"--aia-product-photo-fill-x":String(u.x),"--aia-product-photo-fill-y":String(u.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:S,onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),t(e))},onFocus:()=>l?.(!0),onBlur:k,children:[J(Ki,{sources:Di(e.imageUrl),title:e.title,fallback:c,onPhotoFill:p},Mi(e.imageUrl)??""),ht("span",{className:Q.body,children:[w&&e.vendor?J("span",{className:Q.vendor,children:e.vendor}):null,J("span",{className:Q.title,children:e.title}),e.price?ht("span",{className:Q.price,children:[e.price,e.compareAtPrice?J("s",{className:Q.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?J("span",{className:Q.badge,children:v}):null]}),m&&n?J(Gi,{product:e,label:`${y}: ${e.title}`,focusable:s,onAddToCart:n,onFocus:()=>l?.(!0),onBlur:k},Wi(e)):null]})}function Wi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(r=>r??"").join("\0")}function Gi({product:e,label:r,focusable:t,onAddToCart:o,onFocus:n,onBlur:l}){let[s,c]=Lt(null),w=zt(null),v=zt(e);v.current=e;let y=zt(!0);Kt(()=>(y.current=!0,()=>{y.current=!1}),[]);let m=p=>{w.current=p,y.current&&c(p)},u=p=>{if(p.preventDefault(),p.stopPropagation(),w.current==="adding")return;m("adding");let k;try{k=Promise.resolve(o(v.current))}catch(S){k=Promise.reject(S)}k.then(()=>m("added"),()=>m(null))};return J("span",{className:Q.cart,"data-aia-product-cart":"","data-aia-cart-state":s??void 0,"aria-busy":s==="adding"?!0:void 0,role:"button","aria-label":r,tabIndex:t?0:-1,onClick:u,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||u(p)},onFocus:p=>{p.stopPropagation(),n()},onBlur:p=>{p.stopPropagation(),l(p)},children:ht("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[J("path",{className:Q.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),J("path",{className:Q.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),J("path",{className:Q.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),J("path",{className:Q.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),J("circle",{className:Q.cartGlyph,cx:"9",cy:"20",r:"1.3"}),J("circle",{className:Q.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ki({sources:e,title:r,fallback:t,onPhotoFill:o}){let[n,l]=Lt(0),s=e[n],c=!!s,[w,v]=Lt(null),y=!c&&t==="initial";return Kt(()=>()=>o(null),[o]),ht("span",{className:Q.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!c&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":c&&w===s?"":void 0,children:[c?J("img",{className:Q.image,src:s,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{v(s),o(Fi(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{n+1>=e.length&&o(null),l(m=>m+1)}}):null,y?Ni(r):null]})}import{isOptionsGridMobileViewport as oo,measureOptionsGrid as no,needsOptionsGridMeasurement as ro,OPTIONS_GRID_MOBILE_QUERY as so,optionEnterDelayMs as lo,optionsShowLeadingVisuals as co,planOptionsGrid as Ea,pointerMayHighlight as Ra,releasePanelHug as po,sameOptionRows as ho,syncHighlightScroll as uo,syncPanelHug as mo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as go,useLayoutEffect as Vt,useRef as za,useState as Oa}from"react";import{optionsGridTemplateColumns as qi}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as _i,useRef as Vi}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 {
3129
3155
  display: grid;
3130
3156
  grid-template-columns: repeat(
3131
3157
  auto-fit,
@@ -3169,7 +3195,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
3169
3195
  :where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
3170
3196
  max-height: var(--aia-grid-max-height, 120px);
3171
3197
  }
3172
- `,document.head.appendChild(e)}import{jsx as qi}from"react/jsx-runtime";function Sa({min:e="16rem",max:n,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:l,cols:r,template:d,innerRef:f,className:v,children:x,...m}){let p=Ki(null);Gi(()=>{if(l===void 0)return;let y=p.current;y&&(y.scrollTop=0)},[l]);let h={"--aia-grid-min":e};return n&&(h["--aia-grid-max"]=n),t&&(h["--aia-grid-gap"]=t),o&&(h["--aia-grid-max-height"]=o),r&&(h.gridTemplateColumns=Wi(r)),d&&(h.gridTemplateColumns=d),qi("div",{ref:y=>{p.current=y,f?.(y)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:h,...m,children:x})}import{formatOptionCount as _i,highlightParts as Vi,isMultiSelectToggleTap as Ui,OPTION_ENTER_DELAY_VAR as Qi,optionImageSources as Ca,optionLabel as Ta,sanitizeOptionIconSvg as Yi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ji,useMemo as $i,useRef as Zi,useState as Ct}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 {
3198
+ `,document.head.appendChild(e)}import{jsx as Ui}from"react/jsx-runtime";function Ta({min:e="16rem",max:r,gap:t,scroll:o=!1,maxHeight:n,scrollResetKey:l,cols:s,template:c,innerRef:w,className:v,children:y,...m}){let u=Vi(null);_i(()=>{if(l===void 0)return;let k=u.current;k&&(k.scrollTop=0)},[l]);let p={"--aia-grid-min":e};return r&&(p["--aia-grid-max"]=r),t&&(p["--aia-grid-gap"]=t),n&&(p["--aia-grid-max-height"]=n),s&&(p.gridTemplateColumns=qi(s)),c&&(p.gridTemplateColumns=c),Ui("div",{ref:k=>{u.current=k,w?.(k)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":o||void 0,style:p,...m,children:y})}import{clearPanelMorphPressLook as Qi,formatOptionCount as Yi,highlightParts as ji,isMultiSelectToggleTap as $i,OPTION_ENTER_DELAY_VAR as Zi,optionImageSources as Pa,optionLabel as Ia,sanitizeOptionIconSvg as Xi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ji,useMemo as eo,useRef as qt,useState as kt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
3173
3199
  position: relative;
3174
3200
  /* Clip, not visible: the entrance rise below runs on the inner content,
3175
3201
  and a transformed box extends its scroll container's scrollable area.
@@ -3287,31 +3313,22 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
3287
3313
  opacity: 0.5;
3288
3314
  }
3289
3315
 
3290
- /* Press feedback: the picked option's text compresses down while every other
3291
- option steps back in opacity \u2014 no fill, no glow, the hierarchy carries it. */
3316
+ /* Press feedback: the picked option fills with the option background (the
3317
+ row's own background transition) while every other option steps back in
3318
+ opacity. No scale: a row that shrinks and springs back reads as a jolt,
3319
+ and the next question then arrives on top of it. The press stays on until
3320
+ the options leave, so the picked row never flashes back to normal first. */
3292
3321
  .aia-pressed-98o-r {
3293
3322
  color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
3294
- animation: aia-pressCompress-ICV3q 170ms ease forwards;
3323
+ background: var(--aia-option-bg, transparent);
3324
+ font-weight: 500;
3295
3325
  }
3296
3326
 
3297
3327
  [role="listbox"]:has(.aia-pressed-98o-r) .aia-item-d4vpD:not(.aia-pressed-98o-r) {
3298
3328
  opacity: 0.35;
3299
- transition: opacity 60ms ease;
3300
- }
3301
-
3302
- @keyframes aia-pressCompress-ICV3q {
3303
- 0% {
3304
- transform: scale(1);
3305
- }
3306
- 25% {
3307
- transform: scale(0.93);
3308
- }
3309
- 60% {
3310
- transform: scale(0.93);
3311
- }
3312
- 100% {
3313
- transform: scale(1);
3314
- }
3329
+ transition:
3330
+ background-color 180ms ease,
3331
+ opacity 120ms ease;
3315
3332
  }
3316
3333
 
3317
3334
  /* Scroll hint \u2014 the last visible row of a scrollable web grid fades toward its
@@ -3600,8 +3617,8 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
3600
3617
  display: inline-flex;
3601
3618
  align-items: center;
3602
3619
  justify-content: center;
3603
- /* The mark is text centred in the box. An indent inherited from the row
3604
- (an icon row hangs its text with one) would slide it out of the box. */
3620
+ /* An indent inherited from the row (an icon row hangs its text with one)
3621
+ would slide the mark out of the box. */
3605
3622
  text-indent: 0;
3606
3623
  flex: 0 0 18px;
3607
3624
  width: 18px;
@@ -3610,14 +3627,61 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
3610
3627
  border-radius: 6px;
3611
3628
  background: var(--aia-surface);
3612
3629
  color: transparent;
3613
- font-size: 11px;
3614
3630
  line-height: 1;
3631
+ /* A tick animates the box alone: the row stays put (no press, no dimming),
3632
+ since a multi-select tap keeps the list open for the next tick. */
3633
+ transition:
3634
+ background-color 140ms ease,
3635
+ border-color 140ms ease,
3636
+ color 140ms ease;
3637
+ }
3638
+
3639
+ /* The tick is drawn, not typed: a rounded stroke with a short left leg and a
3640
+ long right one, shaped like Apple's SF Symbols "checkmark". The text "\u2713"
3641
+ it replaces changes with the font and reads thin and cheap. It is painted
3642
+ in the box's text colour, so it fades in with the fill. */
3643
+ .aia-checkbox-KGRhg::after {
3644
+ content: "";
3645
+ width: 14px;
3646
+ height: 14px;
3647
+ background: currentColor;
3648
+ -webkit-mask:
3649
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.2 12.6l4.6 4.6 9-10.6' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
3650
+ center / contain no-repeat;
3651
+ mask:
3652
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.2 12.6l4.6 4.6 9-10.6' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
3653
+ center / contain no-repeat;
3654
+ }
3655
+
3656
+ /* Forced colours replace backgrounds with Canvas, which would hide a tick
3657
+ painted as a background; draw it in the forced text colour instead. */
3658
+ @media (forced-colors: active) {
3659
+ .aia-checkbox-KGRhg[data-checked="true"]::after {
3660
+ forced-color-adjust: none;
3661
+ background: CanvasText;
3662
+ }
3615
3663
  }
3616
3664
 
3617
3665
  .aia-checkbox-KGRhg[data-checked="true"] {
3618
3666
  background: var(--aia-confirm-bg, #262626);
3619
3667
  border-color: var(--aia-confirm-bg, #262626);
3620
3668
  color: var(--aia-confirm-color, #ffffff);
3669
+ animation: aia-checkPop-CCWRW 160ms ease-out;
3670
+ }
3671
+
3672
+ @keyframes aia-checkPop-CCWRW {
3673
+ 0% {
3674
+ transform: scale(0.82);
3675
+ }
3676
+ 100% {
3677
+ transform: scale(1);
3678
+ }
3679
+ }
3680
+
3681
+ @media (prefers-reduced-motion: reduce) {
3682
+ .aia-checkbox-KGRhg[data-checked="true"] {
3683
+ animation: none;
3684
+ }
3621
3685
  }
3622
3686
 
3623
3687
  .aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
@@ -3693,9 +3757,8 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
3693
3757
  width: 18px;
3694
3758
  height: 18px;
3695
3759
  border-radius: 6px;
3696
- font-size: 11px;
3697
3760
  }
3698
- `,document.head.appendChild(e)}var X={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};import{Fragment as Xi,jsx as we,jsxs as Kt}from"react/jsx-runtime";function Pa({option:e,isHighlighted:n,checked:t,onSelect:i,onHighlight:o,onUnhighlight:l,id:r,loading:d,showIcon:f=!0,showImage:v=!0,showCount:x=!0,scrollHint:m,enterDelayMs:p=0}){let[h]=Ct(p),[y,S]=Ct(!1),T=v?Ca(e.image_url):[],D=T[0]??null,[O,$]=Ct([]),F=T.find(A=>!O.includes(A))??null,E=v?(e.imageCollage??[]).map(A=>Ca(A)[0]).filter(A=>A!==void 0):[],[M,H]=Ct(!1),[K,ne]=Ct(null),q=$i(()=>!D&&f&&e.icon_svg?Yi(e.icon_svg):null,[D,f,e.icon_svg]),P=x?_i(e.item_count):null,Z=Zi(void 0);ji(()=>()=>clearTimeout(Z.current),[]);let _=A=>{if(d||!e.is_tappable||y&&t===void 0)return;S(!0);let G=A?.currentTarget;t!==void 0&&G!==void 0&&A!==void 0&&!Ui(G,G.querySelector("[data-aia-checkbox]"),A)?i(e,{commit:!0}):i(e),clearTimeout(Z.current),Z.current=setTimeout(()=>S(!1),170)},se=[X.item,n&&!d?X.highlighted:"",e.liveMatch&&!d?X.liveMatch:"",e.is_tappable?X.tappable:X.nonTappable,y?X.pressed:"",m?X.scrollHint:""].filter(Boolean).join(" ");return we("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":q&&e.icon?e.icon:void 0,"data-aia-image":D?"":void 0,"data-aia-item-count":P!==null?e.item_count:void 0,"aria-selected":t??n,className:se,style:{[Qi]:`${h}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:_,onKeyDown:A=>{!d&&e.is_tappable&&(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),_())},onMouseEnter:!d&&e.is_tappable?o:void 0,onMouseLeave:l,children:Kt("span",{className:X.content,children:[t!==void 0&&e.is_tappable&&we("span",{className:X.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),D&&E.length>1&&we("span",{className:`${X.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":E.length,"data-aia-image-loaded":M?"":void 0,children:E.map(A=>we("img",{src:A,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>H(!0),onError:G=>{G.currentTarget.hidden=!0}},A))}),D&&E.length<=1&&we("span",{className:`${X.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":F!==null&&K===F?"":void 0,children:we("img",{src:F??D,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:F===null,onLoad:()=>ne(F),onError:()=>{F!==null&&$(A=>[...A,F])}})}),q&&we("span",{className:`${X.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:q}}),Kt("span",{className:X.text,children:[e.matchedText?Vi(Ta(e),e.matchedText).map((A,G)=>A.bold?we("strong",{className:`${X.match} magicx-aia-option-match`,"data-aia-match-partial":A.partial?"":void 0,children:A.text},G):A.text):Ta(e),e.parameterLabel&&Kt(Xi,{children:[" ",we("span",{className:`${X.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&we("span",{className:X.tag,children:e.tag}),P!==null&&we("span",{className:`${X.count} magicx-aia-option-count`,children:P})]})})}import{jsx as Ra}from"react/jsx-runtime";function po(){let[e,n]=za(Ji);return co(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(ao),i=()=>n(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function La({options:e,activeIndex:n,picked:t,onSelect:i,onHighlight:o,onUnhighlight:l,listboxId:r,loading:d,groupKey:f="",optionsPosition:v="below",showIcons:x=!0,showImages:m=!0,showCounts:p=!0}){let h=po(),y=Ea(null),[S,T]=za(null),D=Ea(null);qt(()=>{if(d&&ro(D.current,e))return;D.current=d?null:e;let E=y.current,M=E&&!d&&to(e.length,h),H=E?.closest("[data-aia-dropdown]");M&&H&&no(H);let K=M?eo(E):null;T(K?Ia(e.length,h,K.rowWidths,K.gridWidth):null)},[e,h,d]);let O=S??Ia(e.length,h,null,null);qt(()=>{let E=y.current?.closest("[data-aia-dropdown]");E&&lo(E)},[O.template,h]);let $=d?-1:n;qt(()=>{y.current&&so(y.current,$)},[$]);let F=oo(e,x,m);return Ra(Sa,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:f,template:O.template,maxHeight:O.maxHeight,innerRef:E=>{y.current=E},"data-aia-group":f,children:e.map((E,M)=>Ra(Pa,{option:E,isHighlighted:M===n,checked:t?t.includes(E.text):void 0,onSelect:i,onHighlight:H=>{Aa(y.current,M,H)&&o(M)},onUnhighlight:l?H=>{Aa(y.current,-1,H)&&l(M)}:void 0,id:`${r}-option-${M}`,loading:d,showIcon:x&&F,showImage:m&&F,showCount:p,scrollHint:!d&&O.scrollHintIndices.includes(M),enterDelayMs:d?0:io(M,O.cols,e.length,v)},`${f}\0${E.parameter??""}\0${E.text}`))})}import{formatTime as ho,TIME_WHEEL_COLUMNS as uo,TIME_WHEEL_ROW_HEIGHT as mo,timeWheelIndex as Oa,timeWheelIndexFromScroll as go,timeWheelRows as fo,withTimeWheelIndex as Da}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as bo,useEffect as wo,useLayoutEffect as vo,useRef as Lt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
3761
+ `,document.head.appendChild(e)}var $={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg",checkPop:"aia-checkPop-CCWRW"};import{Fragment as io,jsx as xe,jsxs as _t}from"react/jsx-runtime";var to=2e3,ao=170;function Aa({option:e,isHighlighted:r,checked:t,onSelect:o,onHighlight:n,onUnhighlight:l,id:s,loading:c,showIcon:w=!0,showImage:v=!0,showCount:y=!0,scrollHint:m,enterDelayMs:u=0}){let[p]=kt(u),[k,S]=kt(!1),T=v?Pa(e.image_url):[],O=T[0]??null,[L,j]=kt([]),N=T.find(a=>!L.includes(a))??null,A=v?(e.imageCollage??[]).map(a=>Pa(a)[0]).filter(a=>a!==void 0):[],[D,F]=kt(!1),[Y,ie]=kt(null),X=eo(()=>!O&&w&&e.icon_svg?Xi(e.icon_svg):null,[O,w,e.icon_svg]),W=y?Yi(e.item_count):null,I=qt(void 0),G=qt(null),se=qt(Number.NEGATIVE_INFINITY);Ji(()=>()=>clearTimeout(I.current),[]);let le=a=>{if(c||!e.is_tappable)return;let x=a?.currentTarget,te=t!==void 0&&x!==void 0&&a!==void 0&&!$i(x,x.querySelector("[data-aia-checkbox]"),a),ae=t!==void 0&&!te;if(!ae){let ne=performance.now();if(ne-se.current<ao)return;se.current=ne}te?o(e,{commit:!0}):o(e),!ae&&(S(!0),clearTimeout(I.current),I.current=setTimeout(()=>{S(!1),Qi(G.current?.closest("[data-aia-dropdown]"))},to))},ee=[$.item,r&&!c?$.highlighted:"",e.liveMatch&&!c?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,k?$.pressed:"",m?$.scrollHint:""].filter(Boolean).join(" ");return xe("div",{ref:G,id:s,role:"option","data-aia-option":"","data-aia-loading":c?"":void 0,"data-aia-icon":X&&e.icon?e.icon:void 0,"data-aia-image":O?"":void 0,"data-aia-item-count":W!==null?e.item_count:void 0,"aria-selected":t??r,className:ee,style:{[Zi]:`${p}ms`},tabIndex:c||!e.is_tappable?-1:0,onClick:le,onKeyDown:a=>{!c&&e.is_tappable&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),le())},onMouseEnter:!c&&e.is_tappable?n:void 0,onMouseLeave:l,children:_t("span",{className:$.content,children:[t!==void 0&&e.is_tappable&&xe("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t}),O&&A.length>1&&xe("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":A.length,"data-aia-image-loaded":D?"":void 0,children:A.map(a=>xe("img",{src:a,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>F(!0),onError:x=>{x.currentTarget.hidden=!0}},a))}),O&&A.length<=1&&xe("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":N!==null&&Y===N?"":void 0,children:xe("img",{src:N??O,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:N===null,onLoad:()=>ie(N),onError:()=>{N!==null&&j(a=>[...a,N])}})}),X&&xe("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:X}}),_t("span",{className:$.text,children:[e.matchedText?ji(Ia(e),e.matchedText).map((a,x)=>a.bold?xe("strong",{className:`${$.match} magicx-aia-option-match`,"data-aia-match-partial":a.partial?"":void 0,children:a.text},x):a.text):Ia(e),e.parameterLabel&&_t(io,{children:[" ",xe("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&xe("span",{className:$.tag,children:e.tag}),W!==null&&xe("span",{className:`${$.count} magicx-aia-option-count`,children:W})]})})}import{jsx as La}from"react/jsx-runtime";function fo(){let[e,r]=Oa(oo);return go(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(so),o=()=>r(t.matches);return o(),t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[]),e}function Da({options:e,activeIndex:r,picked:t,onSelect:o,onHighlight:n,onUnhighlight:l,listboxId:s,loading:c,groupKey:w="",optionsPosition:v="below",showIcons:y=!0,showImages:m=!0,showCounts:u=!0}){let p=fo(),k=za(null),[S,T]=Oa(null),O=za(null);Vt(()=>{if(c&&ho(O.current,e))return;O.current=c?null:e;let A=k.current,D=A&&!c&&ro(e.length,p),F=A?.closest("[data-aia-dropdown]");D&&F&&po(F);let Y=D?no(A):null;T(Y?Ea(e.length,p,Y.rowWidths,Y.gridWidth):null)},[e,p,c]);let L=S??Ea(e.length,p,null,null);Vt(()=>{let A=k.current?.closest("[data-aia-dropdown]");A&&mo(A)},[L.template,p]);let j=c?-1:r;Vt(()=>{k.current&&uo(k.current,j)},[j]);let N=co(e,y,m);return La(Ta,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:w,template:L.template,maxHeight:L.maxHeight,innerRef:A=>{k.current=A},"data-aia-group":w,children:e.map((A,D)=>La(Aa,{option:A,isHighlighted:D===r,checked:t?t.includes(A.text):void 0,onSelect:o,onHighlight:F=>{Ra(k.current,D,F)&&n(D)},onUnhighlight:l?F=>{Ra(k.current,-1,F)&&l(D)}:void 0,id:`${s}-option-${D}`,loading:c,showIcon:y&&N,showImage:m&&N,showCount:u,scrollHint:!c&&L.scrollHintIndices.includes(D),enterDelayMs:c?0:lo(D,L.cols,e.length,v)},`${w}\0${A.parameter??""}\0${A.text}`))})}import{formatTime as bo,TIME_WHEEL_COLUMNS as wo,TIME_WHEEL_ROW_HEIGHT as vo,timeWheelIndex as Ma,timeWheelIndexFromScroll as xo,timeWheelRows as yo,withTimeWheelIndex as Na}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as ko,useEffect as So,useLayoutEffect as Co,useRef as Ot}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
3699
3762
 
3700
3763
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3701
3764
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3817,7 +3880,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
3817
3880
  .aia-done-llNY5:hover {
3818
3881
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3819
3882
  }
3820
- `,document.head.appendChild(e)}var ve={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};import{jsx as et,jsxs as _t}from"react/jsx-runtime";var xo=120;function Ma({view:e,label:n,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:l}){return _t("div",{className:ve.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:r=>r.preventDefault(),children:[et("span",{className:ve.value,"data-aia-time-value":"","aria-live":"polite",children:ho(e.minutes)}),_t("div",{className:ve.columns,"aria-hidden":"true",children:[et("div",{className:ve.band}),uo.map(r=>_t(bo,{children:[r==="minute"&&et("span",{className:ve.separator,children:":"}),et(yo,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),et("button",{type:"button",tabIndex:-1,className:ve.done,"data-aia-time-done":"",onClick:()=>{i&&l()},children:t})]})}function yo({column:e,minutes:n,interactive:t,onTimeChange:i}){let o=Lt(null),l=Lt(null),r=Lt(null),d=Lt({minutes:n,interactive:t,onTimeChange:i});d.current={minutes:n,interactive:t,onTimeChange:i};let f=Oa(e,n);vo(()=>{let m=o.current;if(!m||r.current)return;let p=f*mo;Math.abs(m.scrollTop-p)<1||(l.current=p,m.scrollTop=p)},[f]),wo(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let m=o.current,p=d.current;if(!m||!p.interactive)return;let h=go(e,m.scrollTop);h!==Oa(e,p.minutes)&&p.onTimeChange(Da(e,p.minutes,h))},x=()=>{let m=o.current;if(m){if(l.current!=null&&Math.abs(m.scrollTop-l.current)<1){l.current=null;return}l.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,xo)}};return et("div",{ref:o,className:ve.column,"data-aia-time-column":e,onScroll:x,children:fo(e).map((m,p)=>et("div",{className:p===f?`${ve.row} ${ve.selected}`:ve.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{d.current.interactive&&i(Da(e,d.current.minutes,p))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3883
+ `,document.head.appendChild(e)}var ye={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};import{jsx as et,jsxs as Ut}from"react/jsx-runtime";var To=120;function Fa({view:e,label:r,doneLabel:t,interactive:o=!0,onTimeChange:n,onTimeCommit:l}){return Ut("div",{className:ye.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":r,onMouseDown:s=>s.preventDefault(),children:[et("span",{className:ye.value,"data-aia-time-value":"","aria-live":"polite",children:bo(e.minutes)}),Ut("div",{className:ye.columns,"aria-hidden":"true",children:[et("div",{className:ye.band}),wo.map(s=>Ut(ko,{children:[s==="minute"&&et("span",{className:ye.separator,children:":"}),et(Po,{column:s,minutes:e.minutes,interactive:o,onTimeChange:n})]},s))]}),et("button",{type:"button",tabIndex:-1,className:ye.done,"data-aia-time-done":"",onClick:()=>{o&&l()},children:t})]})}function Po({column:e,minutes:r,interactive:t,onTimeChange:o}){let n=Ot(null),l=Ot(null),s=Ot(null),c=Ot({minutes:r,interactive:t,onTimeChange:o});c.current={minutes:r,interactive:t,onTimeChange:o};let w=Ma(e,r);Co(()=>{let m=n.current;if(!m||s.current)return;let u=w*vo;Math.abs(m.scrollTop-u)<1||(l.current=u,m.scrollTop=u)},[w]),So(()=>()=>{s.current&&clearTimeout(s.current)},[]);let v=()=>{s.current=null;let m=n.current,u=c.current;if(!m||!u.interactive)return;let p=xo(e,m.scrollTop);p!==Ma(e,u.minutes)&&u.onTimeChange(Na(e,u.minutes,p))},y=()=>{let m=n.current;if(m){if(l.current!=null&&Math.abs(m.scrollTop-l.current)<1){l.current=null;return}l.current=null,s.current&&clearTimeout(s.current),s.current=setTimeout(v,To)}};return et("div",{ref:n,className:ye.column,"data-aia-time-column":e,onScroll:y,children:yo(e).map((m,u)=>et("div",{className:u===w?`${ye.row} ${ye.selected}`:ye.row,"data-aia-time-row":"","data-aia-index":u,onClick:()=>{c.current.interactive&&o(Na(e,c.current.minutes,u))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3821
3884
  display: flex;
3822
3885
  flex-direction: column;
3823
3886
  gap: var(--aia-stack-space, 0.5rem);
@@ -3832,7 +3895,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
3832
3895
  align-items: end;
3833
3896
  }
3834
3897
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3835
- `,document.head.appendChild(e)}import{jsx as ko}from"react/jsx-runtime";function Na({space:e,align:n="stretch",className:t,children:i,...o}){let l=e?{"--aia-stack-space":e}:void 0;return ko("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":n,style:l,...o,children:i})}import{jsx as J,jsxs as Vt}from"react/jsx-runtime";var Bo=typeof window>"u"?tt:Ut,Wo=[159,119,164],Go=()=>{},Fa=()=>{},Ko=e=>{},qo=()=>{},_o=e=>{},Vo=e=>{},Uo=e=>{},Qo=e=>{};function Yo(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=Ho(n);if(tt(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>i(o.matches);return o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function jo(e,n){let t=mt(null);tt(()=>{let i=e.current,o=n.current;if(!i||!o)return;let l=Do(i,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==l&&(t.current.controller.destroy(),t.current=null),l&&!t.current){t.current={grid:l,controller:So({dropdown:i,grid:l,button:o})};return}t.current?.controller.update()}),tt(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function $o(e,n){let t=mt(n);t.current=n;let i=mt(null);Ut(()=>{let o=e.current;if(o){if(!i.current){i.current=Co({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),tt(()=>()=>{i.current?.destroy(),i.current=null},[])}function Qt({suggestions:e,activeIndex:n,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:l,id:r,className:d,pills:f,onPillClick:v,showPills:x=!0,onSkip:m,showSkipButton:p=!0,showOptionIcons:h=!0,showOptionImages:y=!0,showOptionCounts:S=!0,skipDisabled:T=!1,activeSelected:D=!1,isLoading:O=!1,skeletonExiting:$=!1,isInputEmpty:F=!1,language:E,products:M,onProductSelect:H,onProductAddToCart:K,onProductFocusChange:ne,productsLayout:q="row",productImageFallback:P="image",showProductVendor:Z=!0,formatType:_="options",dateView:se=null,selectedDateIso:A=null,selectedDateRange:G=null,dateRangeStart:c=null,dateReferences:k,onPreviousMonth:le,onNextMonth:Ne,timeView:ue=null,multiSelectView:qe=null,onMultiSelectCommit:Ie,onSeeAllResults:Ae,seeAllBusy:me=!1,busyProductId:_e=null,fullWidth:Fe=!1,onTimeChange:u,onTimeCommit:Ve,locationView:g=null,isReediting:C=!1,onLocationQuery:R,onLocationMove:z,onLocationCommit:N,onLocationFocusChange:ee,isFocused:ye=!1,optionsPosition:ae="below",mode:ke}){let Ee=Yo(ke),Ue=Ee!==void 0,ie=mt(null),Re=mt(null);jo(ie,Re),tt(()=>{if(ie.current)return To(ie.current)},[]);let ge=e[0]?.options??[],Qe=!!(f&&f.length>0&&v),de=!!(M&&M.length>0),He=_==="time"&&ue!=null,it=_==="location"&&g!=null,re=l&&(ge.length>0||x&&Qe||O||de||He||it);$o(ie,re),Bo(()=>{let I=ie.current;I&&(Eo(I,Ao(I)),No(I))});let ce={suggestions:e,activeIndex:n,pills:f,showPills:x,showSkipButton:p,showOptionIcons:h,showOptionImages:y,showOptionCounts:S,skipDisabled:T,activeSelected:D,isLoading:O,skeletonExiting:$,isInputEmpty:F,products:M,formatType:_,dateView:se,selectedDateIso:A,selectedDateRange:G,dateRangeStart:c,dateReferences:k,timeView:ue,multiSelectView:qe,locationView:g,isReediting:C,showsSeeAll:!!Ae},Be=mt(ce);re&&(Be.current=ce);let a=re?ce:Be.current,W=Fo(E),fe=a.suggestions[0],Se=fe?.options??[],Ye=a.activeIndex>=0&&!!Se[a.activeIndex]?.is_tappable,Ce=Lo(a.pills??[],W.keepTyping),ze=!!(Ce.length>0&&v),w=a.showPills&&ze,je=a.showPills&&!ze&&a.isLoading,ot=w||je,Le=ze&&Ro(Ce)&&a.showSkipButton&&!a.isInputEmpty&&!!m,b=Ce[0]?.text,$e=zo(a.formatType)&&a.dateView!=null,nt=Se.length>0&&!$e,Oe=Se.length>0&&$e&&!a.isLoading,rt=a.formatType==="time"&&a.timeView!=null&&!a.isLoading,st=a.formatType==="location"&&a.locationView!=null&&!a.isLoading,We=a.isLoading&&!nt&&!Oe&&!rt&&!st,lt=a.products??[],De=Oo(w?Ce:[]);return Ut(()=>{ie.current&&Mo(ie.current,De,{visible:re,anchorBottom:ae==="above"})},[De,re,ae,a.suggestions,a.pills,a.isLoading,a.skeletonExiting,a.isInputEmpty,a.products,a.formatType,a.dateView,a.selectedDateIso,a.selectedDateRange,a.dateRangeStart,a.dateReferences,a.timeView,a.multiSelectView,a.locationView,a.showPills,a.showSkipButton,a.showOptionIcons,a.showOptionImages,a.showOptionCounts,a.showsSeeAll,q,E]),tt(()=>{let I=ie.current;return()=>{I&&Io(I)}},[]),Vt("div",{ref:ie,id:r,role:"listbox","aria-multiselectable":!!a.multiSelectView,"data-aia-dropdown":"","data-options-position":ae,"data-mode":Ee,"data-aia-loading":a.isLoading?"":void 0,"data-aia-skeleton-exiting":a.skeletonExiting?"":void 0,"data-aia-has-products":lt.length>0?"":void 0,"data-aia-full-width":Fe?"":void 0,className:`${Ue?"magicx-aia ":""}${pe.dropdown} ${re?pe.visible:""} ${d??""}`,onMouseDown:I=>I.preventDefault(),children:[Vt(Na,{space:"8px",children:[(ot||Le)&&Vt(kt,{noWrap:!0,className:pe.pillBar,"data-aia-pillbar":"",children:[ot&&J("span",{className:pe.pillScroll,"data-aia-pill-scroll":"",children:J(Et,{pills:Ce,activePillIndex:0,activeSelected:a.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:a.isLoading})}),Le&&J("button",{type:"button",tabIndex:-1,className:pe.skip,"data-aia-skip":"",disabled:a.isLoading||a.skipDisabled,"aria-label":b?`${W.skipLabel} ${b}`:W.skipLabel,onClick:m,children:W.skip})]}),nt&&J(La,{options:Se,activeIndex:a.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:a.isLoading,groupKey:fe?`${fe.parameter} ${fe.text}`:"",optionsPosition:ae,showIcons:a.showOptionIcons,showImages:a.showOptionImages,showCounts:a.showOptionCounts,picked:a.multiSelectView?.picked}),a.multiSelectView&&J("div",{"data-aia-multi-actions":"",onClick:I=>{I.target.closest("[data-aia-multi-done]")&&!a.skipDisabled&&!a.isLoading&&Ie?.()},children:J("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:pe.multiDone,ref:I=>{I&&(I.disabled=!0,I.offsetHeight,I.disabled=a.skipDisabled||a.isLoading)},children:W.done})}),Oe&&a.dateView&&J(pa,{options:Se,activeIndex:a.activeIndex,listboxId:r,view:a.dateView,selection:{selectedIso:a.selectedDateIso??null,selectedRange:a.selectedDateRange??null,rangeStart:a.dateRangeStart??null,floor:Po(a.formatType,a.dateRangeStart),references:a.dateReferences??[]},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:le??Fa,onNextMonth:Ne??Fa}),rt&&a.timeView&&J(Ma,{view:a.timeView,label:W.timeLabel,doneLabel:W.done,interactive:!a.skipDisabled,onTimeChange:u??Ko,onTimeCommit:Ve??qo}),st&&a.locationView&&J(va,{view:a.locationView,searchLabel:W.locationSearch,noResultsLabel:W.locationNoResults,useTypedLabel:W.locationUseTyped,widgetFocused:ye&&re,reediting:a.isReediting,visible:re,interactive:!a.skipDisabled,onQuery:R??_o,onMove:z??Vo,onCommit:N??Uo,onFocusChange:ee??Qo}),We&&J("div",{className:pe.skeletonBars,"data-aia-skeleton-bars":"",children:Wo.map(I=>J("span",{className:pe.skeletonBar,style:{width:I}},`bar-${I}`))}),J(ka,{products:lt,listboxId:r,onSelect:H??Go,busyProductId:_e,onAddToCart:K,onFocusChange:ne,focusable:re&&!a.isLoading,loading:a.isLoading,layout:q,imageFallback:P,showVendor:Z,strings:W}),a.showsSeeAll&&J("div",{className:pe.seeAllRow,"data-aia-see-all":"",onClick:I=>{I.target.closest("[data-aia-see-all-button]")&&(I.stopPropagation(),!(a.isLoading||me)&&Ae?.())},children:J("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":me?"busy":void 0,"aria-busy":me?!0:void 0,className:pe.seeAll,ref:I=>{I&&(I.disabled=!0,I.offsetHeight,I.disabled=a.isLoading)},children:W.seeAllResults})}),J(ma,{isOptionHighlighted:Ye,isInputEmpty:a.isInputEmpty,strings:W})]}),J("button",{ref:Re,type:"button",tabIndex:-1,className:pe.scrollArrow,"data-aia-scroll-arrow":"","aria-label":W.scrollArrow,"aria-hidden":"true",children:J("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:J("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Sn,focusEditorFromTap as Cn,ModeController as Tn,setCursorOffset as Pn,uiStringsFor as In,watchEditorHeight as An}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as Zo}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 {
3898
+ `,document.head.appendChild(e)}import{jsx as Io}from"react/jsx-runtime";function Ha({space:e,align:r="stretch",className:t,children:o,...n}){let l=e?{"--aia-stack-space":e}:void 0;return Io("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":r,style:l,...n,children:o})}import{jsx as Z,jsxs as Qt}from"react/jsx-runtime";var _o=typeof window>"u"?tt:Yt,Vo=[159,119,164],Uo=()=>{},Ba=()=>{},Qo=e=>{},Yo=()=>{},jo=e=>{},$o=e=>{},Zo=e=>{},Xo=e=>{};function Jo(e){let r=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,o]=qo(r);if(tt(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>o(n.matches);return n.addEventListener("change",l),()=>n.removeEventListener("change",l)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function en(e,r){let t=ut(null);tt(()=>{let o=e.current,n=r.current;if(!o||!n)return;let l=Bo(o,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==l&&(t.current.controller.destroy(),t.current=null),l&&!t.current){t.current={grid:l,controller:Ao({dropdown:o,grid:l,button:n})};return}t.current?.controller.update()}),tt(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function tn(e,r){let t=ut(r);t.current=r;let o=ut(null);Yt(()=>{let n=e.current;if(n){if(!o.current){o.current=Eo({dropdown:n,isOpen:()=>t.current});return}o.current.update()}}),tt(()=>()=>{o.current?.destroy(),o.current=null},[])}function jt({suggestions:e,activeIndex:r,onSelect:t,onHighlight:o,onUnhighlight:n,isOpen:l,id:s,className:c,pills:w,onPillClick:v,showPills:y=!0,onSkip:m,showSkipButton:u=!0,showOptionIcons:p=!0,showOptionImages:k=!0,showOptionCounts:S=!0,skipDisabled:T=!1,activeSelected:O=!1,isLoading:L=!1,skeletonExiting:j=!1,isInputEmpty:N=!1,language:A,products:D,onProductSelect:F,onProductAddToCart:Y,onProductFocusChange:ie,productsLayout:X="row",productImageFallback:W="image",showProductVendor:I=!0,formatType:G="options",dateView:se=null,selectedDateIso:le=null,selectedDateRange:ee=null,dateRangeStart:a=null,dateReferences:x,onPreviousMonth:te,onNextMonth:ae,timeView:ne=null,multiSelectView:Ue=null,onMultiSelectCommit:Ie,onSeeAllResults:Ae,seeAllBusy:fe=!1,busyProductId:Qe=null,fullWidth:Ne=!1,onTimeChange:h,onTimeCommit:Ye,locationView:Ee=null,isReediting:Fe=!1,onLocationQuery:f,onLocationMove:C,onLocationCommit:E,onLocationFocusChange:z,isFocused:M=!1,optionsPosition:K="below",mode:pe}){let de=Jo(pe),Re=de!==void 0,oe=ut(null),ze=ut(null);en(oe,ze),tt(()=>{if(oe.current)return Ro(oe.current)},[]);let be=e[0]?.options??[],je=!!(w&&w.length>0&&v),he=!!(D&&D.length>0),He=G==="time"&&ne!=null,it=G==="location"&&Ee!=null,ce=l&&(be.length>0||y&&je||L||he||He||it);tn(oe,ce),_o(()=>{let P=oe.current;P&&(Do(P,Oo(P)),Go(P))});let ue={suggestions:e,activeIndex:r,pills:w,showPills:y,showSkipButton:u,showOptionIcons:p,showOptionImages:k,showOptionCounts:S,skipDisabled:T,activeSelected:O,isLoading:L,skeletonExiting:j,isInputEmpty:N,products:D,formatType:G,dateView:se,selectedDateIso:le,selectedDateRange:ee,dateRangeStart:a,dateReferences:x,timeView:ne,multiSelectView:Ue,locationView:Ee,isReediting:Fe,showsSeeAll:!!Ae},Be=ut(ue);ce&&(Be.current=ue);let i=ce?ue:Be.current,B=Ko(A),we=i.suggestions[0],Se=we?.options??[],$e=i.activeIndex>=0&&!!Se[i.activeIndex]?.is_tappable,Ce=Fo(i.pills??[],B.keepTyping),Le=!!(Ce.length>0&&v),b=i.showPills&&Le,ot=i.showPills&&!Le&&i.isLoading,We=b||ot,Ge=Le&&Mo(Ce)&&i.showSkipButton&&!i.isInputEmpty&&!!m,g=Ce[0]?.text,Ke=No(i.formatType)&&i.dateView!=null,nt=Se.length>0&&!Ke,Oe=Se.length>0&&Ke&&!i.isLoading,rt=i.formatType==="time"&&i.timeView!=null&&!i.isLoading,st=i.formatType==="location"&&i.locationView!=null&&!i.isLoading,qe=i.isLoading&&!nt&&!Oe&&!rt&&!st,lt=i.products??[],De=Ho(b?Ce:[]);return Yt(()=>{oe.current&&Wo(oe.current,De,{visible:ce,anchorBottom:K==="above"})},[De,ce,K,i.suggestions,i.pills,i.isLoading,i.skeletonExiting,i.isInputEmpty,i.products,i.formatType,i.dateView,i.selectedDateIso,i.selectedDateRange,i.dateRangeStart,i.dateReferences,i.timeView,i.multiSelectView,i.locationView,i.showPills,i.showSkipButton,i.showOptionIcons,i.showOptionImages,i.showOptionCounts,i.showsSeeAll,X,A]),tt(()=>{let P=oe.current;return()=>{P&&Lo(P)}},[]),Qt("div",{ref:oe,id:s,role:"listbox","aria-multiselectable":!!i.multiSelectView,"data-aia-dropdown":"","data-options-position":K,"data-mode":de,"data-aia-loading":i.isLoading?"":void 0,"data-aia-skeleton-exiting":i.skeletonExiting?"":void 0,"data-aia-has-products":lt.length>0?"":void 0,"data-aia-full-width":Ne?"":void 0,className:`${Re?"magicx-aia ":""}${me.dropdown} ${ce?me.visible:""} ${c??""}`,onMouseDown:P=>P.preventDefault(),children:[Qt(Ha,{space:"8px",children:[(We||Ge)&&Qt(xt,{noWrap:!0,className:me.pillBar,"data-aia-pillbar":"",children:[We&&Z("span",{className:me.pillScroll,"data-aia-pill-scroll":"",children:Z(Rt,{pills:Ce,activePillIndex:0,activeSelected:i.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:i.isLoading})}),Ge&&Z("button",{type:"button",tabIndex:-1,className:me.skip,"data-aia-skip":"",disabled:i.isLoading||i.skipDisabled,"aria-label":g?`${B.skipLabel} ${g}`:B.skipLabel,onClick:m,children:B.skip})]}),nt&&Z(Da,{options:Se,activeIndex:i.activeIndex,onSelect:t,onHighlight:o,onUnhighlight:n,listboxId:s,loading:i.isLoading,groupKey:we?`${we.parameter} ${we.text}`:"",optionsPosition:K,showIcons:i.showOptionIcons,showImages:i.showOptionImages,showCounts:i.showOptionCounts,picked:i.multiSelectView?.picked}),i.multiSelectView&&Z("div",{"data-aia-multi-actions":"",onClick:P=>{P.target.closest("[data-aia-multi-done]")&&!i.skipDisabled&&!i.isLoading&&Ie?.()},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:me.multiDone,ref:P=>{P&&(P.disabled=!0,P.offsetHeight,P.disabled=i.skipDisabled||i.isLoading)},children:B.done})}),Oe&&i.dateView&&Z(ua,{options:Se,activeIndex:i.activeIndex,listboxId:s,view:i.dateView,selection:{selectedIso:i.selectedDateIso??null,selectedRange:i.selectedDateRange??null,rangeStart:i.dateRangeStart??null,floor:zo(i.formatType,i.dateRangeStart),references:i.dateReferences??[]},onSelect:t,onHighlight:o,onUnhighlight:n,onPreviousMonth:te??Ba,onNextMonth:ae??Ba}),rt&&i.timeView&&Z(Fa,{view:i.timeView,label:B.timeLabel,doneLabel:B.done,interactive:!i.skipDisabled,onTimeChange:h??Qo,onTimeCommit:Ye??Yo}),st&&i.locationView&&Z(ya,{view:i.locationView,searchLabel:B.locationSearch,noResultsLabel:B.locationNoResults,useTypedLabel:B.locationUseTyped,widgetFocused:M&&ce,reediting:i.isReediting,visible:ce,interactive:!i.skipDisabled,onQuery:f??jo,onMove:C??$o,onCommit:E??Zo,onFocusChange:z??Xo}),qe&&Z("div",{className:me.skeletonBars,"data-aia-skeleton-bars":"",children:Vo.map(P=>Z("span",{className:me.skeletonBar,style:{width:P}},`bar-${P}`))}),Z(Ca,{products:lt,listboxId:s,onSelect:F??Uo,busyProductId:Qe,onAddToCart:Y,onFocusChange:ie,focusable:ce&&!i.isLoading,loading:i.isLoading,layout:X,imageFallback:W,showVendor:I,strings:B}),i.showsSeeAll&&Z("div",{className:me.seeAllRow,"data-aia-see-all":"",onClick:P=>{P.target.closest("[data-aia-see-all-button]")&&(P.stopPropagation(),!(i.isLoading||fe)&&Ae?.())},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":fe?"busy":void 0,"aria-busy":fe?!0:void 0,className:me.seeAll,ref:P=>{P&&(P.disabled=!0,P.offsetHeight,P.disabled=i.isLoading)},children:B.seeAllResults})}),Z(fa,{isOptionHighlighted:$e,isInputEmpty:i.isInputEmpty,strings:B})]}),Z("button",{ref:ze,type:"button",tabIndex:-1,className:me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":B.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 En,focusEditorFromTap as Rn,ModeController as zn,setCursorOffset as Ln,uiStringsFor as On,watchEditorHeight as Dn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as an}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 {
3836
3899
  flex-shrink: 0;
3837
3900
  width: 32px;
3838
3901
  height: 32px;
@@ -3936,5 +3999,5 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
3936
3999
  transition: none;
3937
4000
  }
3938
4001
  }
3939
- `,document.head.appendChild(e)}var Ha={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};import{jsx as Yt}from"react/jsx-runtime";function Ba({disabled:e,ready:n,busy:t=!1,onClick:i,label:o=Zo().submit}){return Yt("button",{type:"button","data-aia-submit":"",className:Ha.submitButton,disabled:e,"data-aia-ready":n?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:l=>{l.stopPropagation(),i()},"aria-label":o,children:Yt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":o,children:Yt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Xo,dateSelectionFor as Jo,dropdownPillsFor as en,editingSuggestion as tn,HANDOFF_NOT_HANDLED as an,identifiedParamLabel as on,withoutTraditionalAutocomplete as nn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as _a,useEffect as Ke,useMemo as rn,useRef as U,useState as sn}from"react";import{useRef as Wa}from"react";function Ga(e){let n=Wa(e);n.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=Wa({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let l of Object.keys(e??{})){let r=(d,f,v)=>{let x=n.current?.[l];return x?x(d,f,v):[]};o[l]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}import{useRef as Ka}from"react";function qa(e){let n=Ka(e);n.current=e;let t=Ka(null);t.current===null&&(t.current={fetch:(o,l)=>{let r=n.current;return r?r.fetch(o,l):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 ln={query:"",raw_query:"",completed_params:[],identified_params:[],is_ready:!1},Va={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,highlightByPointer:!1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function jt({onSubmit:e,onResult:n,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:l,additionalContext:r,language:d,currency:f,productId:v,visitorId:x,analyticsConsent:m,columns:p=2,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:D,prependPlaceholder:O,allOption:$,showNonTappableOptions:F,locationSearch:E,showOptionIcons:M,showOptionImages:H,showOptionCounts:K,showSkipButton:ne,showProducts:q,submitProgress:P,awaitAnswerOnSubmit:Z,submitAnswerTimeoutMs:_,productImageFallback:se="image",showProductVendor:A=!0,onFocus:G,onBlur:c,value:k,completedParams:le,onChange:Ne,onParamsChange:ue,products:qe,mapProducts:Ie,onProductSelect:Ae,onProductAddToCart:me,source:_e,setCursor:Fe}){let u=U(null),[Ve,g]=sn(null),C=U(e);C.current=e;let R=U(n);R.current=n;let z=U(t);z.current=t;let N=U(Ne);N.current=Ne;let ee=U(ue);ee.current=ue;let ye=U(G);ye.current=G;let ae=U(c);ae.current=c;let ke=U(Fe);ke.current=Fe;let Ee=U(Ae);Ee.current=Ae;let Ue=U(me);Ue.current=me;let ie=U(x);ie.current=x;let Re=U(()=>{let s=ie.current;return typeof s=="function"?s():s}).current,ge=x!==void 0,Qe=U(m);Qe.current=m;let de=U(()=>{let s=Qe.current;return typeof s=="function"?s():s}).current,He=qa(qe),it=U(Ie);it.current=Ie;let re=U((s,Q)=>{let B=it.current;return B?B(s,Q):s}).current,ce=Ie?re:void 0,Be=Ga(i);Ke(()=>{if(typeof document>"u")return;let s=new Xo(document.createElement("div"),{renderMode:"headless",apiConfig:l,additionalContext:r,language:d,currency:f,productId:v,visitorId:ge?Re:void 0,analyticsConsent:de,optionOverrides:Be.overrides,maskCompletedText:o,columns:p,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:D,prependPlaceholder:O,allOption:$,showNonTappableOptions:F,locationSearch:E,showProducts:q,submitProgress:P,awaitAnswerOnSubmit:Z,submitAnswerTimeoutMs:_,source:_e,value:k,completedParams:le,onSubmit:(...B)=>C.current?.(...B),onResult:(...B)=>R.current?.(...B),onError:(...B)=>z.current?.(...B),onChange:(...B)=>N.current?.(...B),onParamsChange:(...B)=>ee.current?.(...B),onFocus:()=>ye.current?.(),onBlur:()=>ae.current?.(),onProductSelect:B=>Ee.current?Ee.current(B):an,onProductAddToCart:B=>Ue.current?.(B),setCursor:B=>ke.current?.(B),products:He.config,mapProducts:ce});u.current=s,g(s.getState());let Q=s.subscribe(B=>g(B));return()=>{Q(),s.destroy(),u.current===s&&(u.current=null)}},[]);let a=U(ge);Ke(()=>{a.current!==ge&&(a.current=ge,u.current?.update({visitorId:ge?Re:void 0,analyticsConsent:de}))},[ge,Re,de]);let W=typeof m=="function"?"function":m,fe=U(W);Ke(()=>{fe.current!==W&&(fe.current=W,u.current?.refreshAnalyticsConsent())},[W]),Ke(()=>{k!==void 0&&u.current?.setValue(k)},[k]),Ke(()=>{le!==void 0&&u.current?.setCompletedParams(le)},[le]);let Se=JSON.stringify(l??null),Ye;try{Ye=JSON.stringify(r??null)}catch{Ye="[unstringifiable]"}Ke(()=>{u.current?.update({apiConfig:l,additionalContext:r,language:d,currency:f,productId:v,optionOverrides:Be.overrides,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:D,prependPlaceholder:O,allOption:$,showNonTappableOptions:F,locationSearch:E,showProducts:q,submitProgress:P,awaitAnswerOnSubmit:Z,submitAnswerTimeoutMs:_})},[Se,Ye,d,f?.code,f?.rate,f?.country,v,Be.key,h,y,S,T,D,O,$,F,E,q,P,Z,_]);let Ce=U(!1);Ke(()=>{if(!Ce.current){Ce.current=!0;return}u.current?.update({products:He.config})},[He.enabled]),Ke(()=>{u.current?.update({mapProducts:ce})},[ce]);let ze=U(null);ze.current===null&&(ze.current={handleTextChange:s=>u.current?.handleTextChange(s),handleCompositionText:s=>u.current?.handleCompositionText(s),handleKeyDown:s=>{let Q="nativeEvent"in s?s.nativeEvent:s;u.current?.handleKeyDown(Q)},setFocused:s=>u.current?.setFocused(s),startEditingParam:s=>u.current?.startEditingParam(s),removeParam:s=>u.current?.removeParam(s)??!1,exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:s=>u.current?.handleCaretAfterInput(s),handleCaretMove:s=>u.current?.handleCaretMove(s),replaceEditingRange:s=>u.current?.replaceEditingRange(s)??!1,setActivePill:s=>u.current?.setActivePill(s),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()??Va,getResult:()=>u.current?.getResult()??ln,awaitSubmitResult:()=>u.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:s=>u.current?.recordSubmit(s),holdSubmit:s=>u.current?.holdSubmit(s),endSubmitProgress:()=>u.current?.endSubmitProgress(),getSearchId:()=>u.current?.getSearchId(),getVisitorId:()=>u.current?.getVisitorId(),refreshAnalyticsConsent:()=>u.current?.refreshAnalyticsConsent(),selectOption:(s,Q)=>u.current?.selectOption(s,Q),selectProduct:s=>u.current?.selectProduct(s),addProductToCart:s=>{let Q=u.current;return!Q||!Ue.current?Promise.resolve():Q.addProductToCart(s)},setActiveDropdownIndex:s=>u.current?.setActiveDropdownIndex(s),clearHighlight:s=>u.current?.clearHighlight(s),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),setTime:s=>u.current?.setTime(s),commitTime:()=>u.current?.commitTime(),toggleMultiSelectOption:s=>u.current?.toggleMultiSelectOption(s),commitMultiSelect:()=>u.current?.commitMultiSelect(),setLocationQuery:s=>u.current?.setLocationQuery(s),moveLocationHighlight:s=>u.current?.moveLocationHighlight(s),commitLocation:s=>u.current?.commitLocation(s),setLocationFieldFocused:s=>u.current?.setLocationFieldFocused(s),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let w=ze.current,je=_a(s=>{let Q=s.target.value,ct=Q.length>0&&!s.nativeEvent?.isComposing&&Q[0]!==Q[0].toUpperCase()?Q[0].toUpperCase()+Q.slice(1):Q;u.current?.handleTextChange(ct)},[]),ot=_a(s=>{u.current?.handleKeyDown(s.nativeEvent)},[]),Le=u.current,b=Ve??Va,$e=k!==void 0?k:b.text,nt=le!==void 0?le:b.completedParams,Oe=b.actionableSuggestions,rt=Oe[0],st=rn(()=>nn(Oe),[Oe]),We=Le?.listboxId??"",lt=b.activeDropdownIndex>=0&&Le?`${We}-option-${b.activeDropdownIndex}`:void 0,De=b.editingParam,I=b.editingIdentified,Tt=De?tn(De):I?{parameter:I.parameter,text:on(I.parameter),required:!0,options:[]}:null,Pt=b.dropdownSuggestion??Tt??rt,Mt=en(b.dropdownSuggestion,Tt,Oe),dt=Jo(b),wt=!Le||b.dropdownLoading;return{completedParams:nt,multiSelectView:b.multiSelectView,toggleMultiSelectOption:w.toggleMultiSelectOption,commitMultiSelect:w.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:st,setActivePill:w.setActivePill,skipActivePill:w.skipActivePill,removeLastParam:w.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:w.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:wt,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:We,error:b.error,products:b.products,customFields:b.customFields,selectProduct:w.selectProduct,addProductToCart:w.addProductToCart,handleTextChange:w.handleTextChange,handleCompositionText:w.handleCompositionText,handleKeyDown:w.handleKeyDown,setFocused:w.setFocused,editingParam:De,editingIdentified:I,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:w.startEditingParam,removeParam:w.removeParam,exitEditMode:w.exitEditMode,handleCaretAfterInput:w.handleCaretAfterInput,handleCaretMove:w.handleCaretMove,replaceEditingRange:w.replaceEditingRange,inputProps:{value:$e,placeholder:b.placeholderText||void 0,onChange:je,onKeyDown:ot,onFocus:w.handleFocus,onBlur:w.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":We},reset:w.reset,refreshProducts:w.refreshProducts,prepareSubmit:w.prepareSubmit,getState:w.getState,getResult:w.getResult,awaitSubmitResult:w.awaitSubmitResult,recordSubmit:w.recordSubmit,holdSubmit:w.holdSubmit,endSubmitProgress:w.endSubmitProgress,getSearchId:w.getSearchId,getVisitorId:w.getVisitorId,refreshAnalyticsConsent:w.refreshAnalyticsConsent,isSubmitting:b.isSubmitting,selectingProductId:b.selectingProductId,dropdownProps:{suggestions:Pt?[{...Pt,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:w.selectOption,onHighlight:w.setActiveDropdownIndex,onUnhighlight:w.clearHighlight,isOpen:b.isDropdownOpen,id:We,pills:Mt,activeSelected:b.isActivePillSelected,onPillClick:w.setActivePill,onSkip:w.skipActivePill,showSkipButton:(ne??!0)&&!De&&!I,showOptionIcons:M??!0,showOptionImages:H??!0,showOptionCounts:K??!0,skipDisabled:b.inSelectionAnimation,isLoading:wt,skeletonExiting:b.skeletonExiting,isInputEmpty:$e.trim().length===0,language:d,products:b.products,productImageFallback:se,showProductVendor:A,onProductSelect:w.selectProduct,busyProductId:b.selectingProductId,seeAllBusy:b.isSubmitting,onProductAddToCart:me?w.addProductToCart:void 0,onProductFocusChange:w.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:dt.selectedIso,selectedDateRange:dt.selectedRange,dateRangeStart:dt.rangeStart,dateReferences:dt.references,onPreviousMonth:w.showPreviousMonth,onNextMonth:w.showNextMonth,timeView:b.timeView,multiSelectView:b.dropdownMultiSelect,onMultiSelectCommit:w.commitMultiSelect,onTimeChange:w.setTime,onTimeCommit:w.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:w.setLocationQuery,onLocationMove:w.moveLocationHighlight,onLocationCommit:w.commitLocation,onLocationFocusChange:w.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:y??"below"}}}import{attachChipRemove as dn,cancelStartingHint as cn,chipIdFromTap as pn,extractPlainText as Ua,focusesInputOnSelect as hn,getCursorOffset as Qa,keepCaretOnChip as un,plainTextLength as mn,renderEditableContent as gn,setCursorOffset as fn,settlePickFocus as bn,startingHintOptions as wn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as xe,useEffect as gt,useLayoutEffect as $t,useRef as at}from"react";var Ot;function vn(){if(Ot!==void 0)return Ot;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ot=e.contentEditable==="plaintext-only",Ot}function Ya(e){let{segments:n,showChipIcons:t=!0,showChipImages:i=!0,showChipRemove:o=!1,focusInputOnSelect:l,removeParam:r,newParamId:d,editingParam:f,editingIdentified:v,editingAnchor:x,caretOffset:m,placeholderText:p,hintSuggestions:h,isFocused:y,isDropdownOpen:S,listboxId:T,activeDescendantId:D,autoFocus:O,handleTextChange:$,handleCompositionText:F,handleKeyDown:E,handleCaretAfterInput:M,handleCaretMove:H,startEditingParam:K,replaceEditingRange:ne,setFocused:q}=e,P=at(null),Z=at(!1),_=at(""),se=at(""),A=at(null),G=at(0);A.current=m;let c=at(l);c.current=l,gt(()=>{if(!O)return;let g=P.current;if(!g)return;document.activeElement===g?q(!0):g.focus();let C=g.ownerDocument??document,R=C.getSelection(),z=R&&R.rangeCount>0&&g.contains(R.anchorNode);if(R&&!z){let N=C.createRange();N.selectNodeContents(g),N.collapse(!0),R.removeAllRanges(),R.addRange(N)}},[O,q]),gt(()=>{let g=P.current;if(!g)return;let C=g.ownerDocument??document,R=()=>{let z=C.getSelection();if(!z||z.rangeCount===0||!z.anchorNode||!g.contains(z.anchorNode))return;let N=z.anchorNode,ee=N.nodeType===Node.ELEMENT_NODE?N:N.parentElement,ae=(z.isCollapsed?ee?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ke=f?.id??v?.id??null;if(ae&&ae!==ke){K(ae);return}performance.now()-G.current<50||H(Qa(g))};return C.addEventListener("selectionchange",R),()=>C.removeEventListener("selectionchange",R)},[f,v,K,H]),gt(()=>{let g=P.current;if(!g)return;let C=R=>{let z=pn(g,R.target);z&&(K(z),un(g,z))};return g.addEventListener("click",C),()=>g.removeEventListener("click",C)},[K]),gt(()=>{let g=P.current;if(!(!g||!r||!o))return dn(g,r)},[r,o]),$t(()=>{let g=P.current;g&&gn({input:g,segments:n,newParamId:d,editingParamId:f?.id??null,placeholderText:p??"",isFocused:y,showChipIcons:t,showChipImages:i,showChipRemove:o,hintOptions:wn(h??[])})},[n,d,f,p,h,y,t,i,o]),gt(()=>{let g=P.current;return()=>{g&&cn(g)}},[]),$t(()=>{let g=_.current,C=d??"";if(_.current=C,!C||C===g)return;let R=P.current;if(!R)return;let z=A.current??mn(R);bn(R,z,hn(c.current))},[d]),$t(()=>{let g=se.current,C=f?.id??"";if(se.current=C,!C||C===g||x==null)return;let R=P.current;R&&fn(R,x)},[f,x]);let k=xe(()=>{let g=P.current;if(!g)return;let C=Ua(g),z=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(Z.current){F(z);return}$(z)},[$,F]),le=xe(()=>{G.current=performance.now(),k();let g=P.current;g&&M(Qa(g))},[k,M]);gt(()=>{let g=P.current;if(!g)return;let C=R=>{let z=R,N=z.inputType;if(N==="insertParagraph"||N==="insertLineBreak"||N==="insertFromDrop"){R.preventDefault();return}if(N.startsWith("insert")||N.startsWith("delete")){let ee=N.startsWith("delete")?"":z.data??"";ne(ee)&&R.preventDefault()}};return g.addEventListener("beforeinput",C),()=>g.removeEventListener("beforeinput",C)},[ne]);let Ne=xe(()=>{Z.current=!0,P.current?.setAttribute("data-aia-composing","true")},[]),ue=xe(()=>{Z.current=!1,P.current?.removeAttribute("data-aia-composing"),k()},[k]),qe=xe(g=>{g.preventDefault();let C=P.current;if(!C)return;let R=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!R)return;let z=C.ownerDocument??document,N=z.getSelection();if(!N||N.rangeCount===0)return;let ee=N.getRangeAt(0);if(!C.contains(ee.startContainer))return;ee.deleteContents();let ye=z.createTextNode(R);ee.insertNode(ye),ee.setStartAfter(ye),ee.collapse(!0),N.removeAllRanges(),N.addRange(ee),k()},[k]),Ie=xe(g=>E(g),[E]),Ae=xe(()=>q(!0),[q]),me=xe(()=>q(!1),[q]),_e=xe(()=>P.current?.focus(),[]),Fe=xe(()=>P.current?.blur(),[]),u=xe(()=>{let g=P.current;return g?Ua(g):""},[]),Ve=vn()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:Ve,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":T,"aria-expanded":S,"aria-activedescendant":D,spellCheck:!0,enterKeyHint:"send",onInput:le,onKeyDown:Ie,onCompositionStart:Ne,onCompositionEnd:ue,onPaste:qe,onFocus:Ae,onBlur:me},getPlainText:u,focus:_e,blur:Fe}}import{jsx as bt,jsxs as Xt}from"react/jsx-runtime";function En(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Rn=xn(function({onSubmit:n,onResult:t,onError:i,optionOverrides:o,maskCompletedText:l,className:r,apiConfig:d,additionalContext:f,language:v,currency:x,productId:m,visitorId:p,analyticsConsent:h,columns:y,pillPlacement:S="dropdown",mode:T="auto",optionsPosition:D="below",animations:O=!0,optionsStyle:$="floating",dropdownTrigger:F,closeDropdownOnBlur:E,focusInputOnSelect:M,startingState:H,prependPlaceholder:K,allOption:ne,showNonTappableOptions:q,locationSearch:P,showOptionIcons:Z=!0,showChipIcons:_=!0,showChipImages:se=!0,showChipRemove:A=!1,showOptionImages:G=!0,showOptionCounts:c=!0,showSkipButton:k,showProducts:le,submitProgress:Ne,awaitAnswerOnSubmit:ue,submitAnswerTimeoutMs:qe,productsLayout:Ie,productImageFallback:Ae,showProductVendor:me,autoFocus:_e=!0,onFocus:Fe,onBlur:u,value:Ve,completedParams:g,onChange:C,onParamsChange:R,products:z,mapProducts:N,onProductSelect:ee,onProductAddToCart:ye,submitButton:ae,resetOnSubmit:ke=!0,seeAllResults:Ee=!1},Ue){let ie=ft(null),Re=ft(null),ge=ft(null),Qe=ft(()=>{}),de=ft(null),He=ft(null);Zt(()=>{let L=ie.current;if(L)return de.current?de.current.setMode(T):de.current=new Tn(L,T),()=>{de.current?.destroy(),de.current=null}},[T]);let it=Dt(L=>{let be=He.current?.current;be&&(be.focus(),Pn(be,L))},[]),{completedParams:re,suggestionPills:ce,setActivePill:Be,skipActivePill:a,segments:W,newParamId:fe,clearNewParamId:Se,placeholderText:Ye,isFocused:Ce,isDropdownOpen:ze,isActivePillSelected:w,isLoading:je,isReady:ot,activeIndex:Le,listboxId:b,handleTextChange:$e,handleCompositionText:nt,handleKeyDown:Oe,setFocused:rt,editingParam:st,editingIdentified:We,editingAnchor:lt,caretOffset:De,startEditingParam:I,removeParam:Tt,handleCaretAfterInput:Pt,handleCaretMove:Mt,replaceEditingRange:dt,dropdownProps:wt,reset:s,refreshProducts:Q,prepareSubmit:B,getState:ct,getResult:Jt,awaitSubmitResult:ea,recordSubmit:ta,holdSubmit:aa,endSubmitProgress:ia,getSearchId:oa,getVisitorId:na,refreshAnalyticsConsent:ra,isSubmitting:Nt}=jt({onSubmit:L=>Qe.current(L),onResult:t,onError:i,optionOverrides:o,maskCompletedText:l,apiConfig:d,additionalContext:f,language:v,currency:x,productId:m,visitorId:p,analyticsConsent:h,columns:y,dropdownTrigger:F,optionsPosition:D,closeDropdownOnBlur:E,focusInputOnSelect:M,startingState:H,prependPlaceholder:K,allOption:ne,showNonTappableOptions:q,locationSearch:P,showOptionIcons:Z,showOptionImages:G,showOptionCounts:c,showSkipButton:k,showProducts:le,submitProgress:Ne,awaitAnswerOnSubmit:ue,submitAnswerTimeoutMs:qe,onFocus:Fe,onBlur:u,value:Ve,completedParams:g,onChange:C,onParamsChange:R,products:z,mapProducts:N,onProductSelect:ee,onProductAddToCart:ye,source:"full-sdk",setCursor:it});Zt(()=>{if(!fe)return;let L=window.setTimeout(()=>Se(),650);return()=>window.clearTimeout(L)},[fe,Se]);let ja=Le>=0?`${b}-option-${Le}`:void 0,{inputRef:pt,editorProps:$a,focus:sa,blur:la,getPlainText:da}=Ya({segments:W,newParamId:fe,editingParam:st,editingIdentified:We,editingAnchor:lt,caretOffset:De,placeholderText:Ye,hintSuggestions:S==="inline"?[]:ce,isFocused:Ce,showChipIcons:_,showChipImages:se,showChipRemove:A,removeParam:Tt,focusInputOnSelect:M,isDropdownOpen:ze,listboxId:b,activeDescendantId:ja,autoFocus:_e,handleTextChange:$e,handleCompositionText:nt,handleKeyDown:Oe,handleCaretAfterInput:Pt,handleCaretMove:Mt,startEditingParam:I,replaceEditingRange:dt,setFocused:rt});He.current=pt,kn(()=>{let L=Re.current,be=pt.current;if(!L||!be)return;let Xe=()=>{let xt=L.firstElementChild;if(!xt)return;let ai=xt.getBoundingClientRect(),ii=be.getBoundingClientRect();ai.top>=ii.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};Xe();let vt=new ResizeObserver(Xe);return vt.observe(be),()=>vt.disconnect()},[W,ce.length,je,pt]),Zt(()=>{let L=ge.current;if(L)return An(L)},[]),yn(Ue,()=>({focus:sa,blur:la,reset:s,refreshProducts:Q,setMode:L=>de.current?.setMode(L),skipActivePill:a,endSubmitProgress:ia,getSearchId:oa,getVisitorId:na,refreshAnalyticsConsent:ra}),[sa,la,s,Q,a,ia,oa,na,ra]);let Ze=!!W.length||re.length>0,It=Dt((L,be)=>{let Xe=ct(),vt=Sn(da(),Xe.completedParams,Xe.skippedParams,{identifiedParams:Xe.identifiedParams,isReady:Xe.isReady,customFields:be.custom_fields??null,customFieldsStale:be.custom_fields_stale===!0});L&&ta(vt);let xt=n(vt);return L&&!ke&&aa(xt),ke&&s(),xt},[ta,aa,ke,ct,n,s,da]),Ft=Dt(()=>{if(Ze&&!ct().isSubmitting){if(ue){ea().then(L=>{L&&It(!0,L)});return}B(),It(!0,Jt())}},[Ze,ct,ue,ea,B,Jt,It]);Qe.current=L=>Ze?It(!1,L):void 0;let Za=Ee&&!wt.isInputEmpty&&Ze,Xa=Ft,Ja=Dt(L=>{L.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||pt.current&&Cn(pt.current)},[pt]),ei=S==="inline",ti=S==="dropdown";return Xt("div",{ref:ie,className:`magicx-aia ${Je.container} ${r??""}`,"data-pill-placement":S,"data-options-position":D,"data-animations":O?"on":"off","data-aia-options-style":$,"data-mode":En(T),children:[bt(Qt,{...wt,showPills:ti,productsLayout:Ie,productImageFallback:Ae,showProductVendor:me,onSeeAllResults:Za?Xa:void 0,fullWidth:Ee}),Xt("div",{className:Je.inputWrapper,"data-aia-input-wrapper":"",onClick:Ja,children:[Xt("div",{ref:ge,className:Je.editorArea,"data-aia-editor":"",children:[bt("div",{...$a,className:Je.input,"data-aia-input":""}),ei&&(je||ce.length>0)&&bt("span",{ref:Re,className:Je.pillListContainer,"data-aia-pill-list-container":"",children:bt(Et,{pills:ce,activePillIndex:0,activeSelected:w,onSelectPill:Be,loading:je})})]}),ae===null?null:ae===void 0?bt(Ba,{disabled:!Ze,ready:Ze&&ot,busy:Nt,onClick:Ft,label:In(v).submit}):bt("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Nt?"busy":void 0,"aria-busy":Nt?!0:void 0,className:Je.submitSlot,onClick:L=>{Ze&&(L.stopPropagation(),Ft())},children:ae})]})]})});export{Rn as AIAutocomplete,Qt as AIAutocompleteDropdown,Bs as DATE_RANGE_META_END,Ws as DATE_RANGE_META_START,Gs as DEFAULT_OPTION_COUNT_UNIT,Zs as LOCATION_META_KEY,nl as PRODUCT_PATH_PREFIX,gl as TIME_META_KEY,bl as WEEKDAY_LABELS,Ns as buildSubmitResult,Fs as cellDay,Hs as cellIso,Ks as dateCellMarks,qs as focusesInputOnSelect,_s as formatDate,Vs as formatDateRange,Us as formatOptionCount,Qs as formatPlace,Ys as formatTime,$s as isTouchPrimary,js as isoDate,Xs as monthLabel,Js as optionCountLabel,el as optionHasImage,tl as optionImageSources,al as optionImageSrc,il as optionLabel,ol as optionsShowLeadingVisuals,rl as parseDate,sl as parseLooseDate,ll as parseLooseDateRange,dl as parseTime,cl as productFromMatchedItem,pl as productImageSources,hl as productsFromCustomFields,ul as sanitizeOptionIconSvg,ml as selectedRangeFor,jt as useAIAutocomplete,fl as visibleDateRange,wl as withSkippedParams};
4002
+ `,document.head.appendChild(e)}var Wa={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};import{jsx as $t}from"react/jsx-runtime";function Ga({disabled:e,ready:r,busy:t=!1,onClick:o,label:n=an().submit}){return $t("button",{type:"button","data-aia-submit":"",className:Wa.submitButton,disabled:e,"data-aia-ready":r?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:l=>{l.stopPropagation(),o()},"aria-label":n,children:$t("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":n,children:$t("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as on,dateSelectionFor as nn,dropdownPillsFor as rn,editingSuggestion as sn,HANDOFF_NOT_HANDLED as ln,identifiedParamLabel as dn,withoutTraditionalAutocomplete as cn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Ua,useEffect as Ve,useMemo as pn,useRef as V,useState as hn}from"react";import{useRef as Ka}from"react";function qa(e){let r=Ka(e);r.current=e;let t=Object.keys(e??{}).sort().join("\0"),o=Ka({key:"",overrides:void 0});if(o.current.key!==t){let n={};for(let l of Object.keys(e??{})){let s=(c,w,v)=>{let y=r.current?.[l];return y?y(c,w,v):[]};n[l]=s}o.current={key:t,overrides:e?n:void 0}}return{overrides:o.current.overrides,key:t}}import{useRef as _a}from"react";function Va(e){let r=_a(e);r.current=e;let t=_a(null);t.current===null&&(t.current={fetch:(n,l)=>{let s=r.current;return s?s.fetch(n,l):Promise.reject(new Error("products config removed"))},transform:n=>r.current?.transform(n)??[],get limit(){return r.current?.limit}});let o=e!==void 0;return{config:o?t.current:void 0,enabled:o}}var un={query:"",raw_query:"",completed_params:[],identified_params:[],is_ready:!1},Qa={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,highlightByPointer:!1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,blockingChips:[],filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Zt({onSubmit:e,onResult:r,onError:t,optionOverrides:o,maskCompletedText:n,apiConfig:l,additionalContext:s,language:c,currency:w,productId:v,visitorId:y,analyticsConsent:m,columns:u=2,dropdownTrigger:p,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:j,showNonTappableOptions:N,locationSearch:A,showOptionIcons:D,showOptionImages:F,showOptionCounts:Y,showSkipButton:ie,showProducts:X,submitProgress:W,awaitAnswerOnSubmit:I,submitAnswerTimeoutMs:G,productImageFallback:se="image",showProductVendor:le=!0,onFocus:ee,onBlur:a,value:x,completedParams:te,onChange:ae,onParamsChange:ne,products:Ue,mapProducts:Ie,onProductSelect:Ae,onProductAddToCart:fe,source:Qe,setCursor:Ne}){let h=V(null),[Ye,Ee]=hn(null),Fe=V(e);Fe.current=e;let f=V(r);f.current=r;let C=V(t);C.current=t;let E=V(ae);E.current=ae;let z=V(ne);z.current=ne;let M=V(ee);M.current=ee;let K=V(a);K.current=a;let pe=V(Ne);pe.current=Ne;let de=V(Ae);de.current=Ae;let Re=V(fe);Re.current=fe;let oe=V(y);oe.current=y;let ze=V(()=>{let d=oe.current;return typeof d=="function"?d():d}).current,be=y!==void 0,je=V(m);je.current=m;let he=V(()=>{let d=je.current;return typeof d=="function"?d():d}).current,He=Va(Ue),it=V(Ie);it.current=Ie;let ce=V((d,q)=>{let H=it.current;return H?H(d,q):d}).current,ue=Ie?ce:void 0,Be=qa(o);Ve(()=>{if(typeof document>"u")return;let d=new on(document.createElement("div"),{renderMode:"headless",apiConfig:l,additionalContext:s,language:c,currency:w,productId:v,visitorId:be?ze:void 0,analyticsConsent:he,optionOverrides:Be.overrides,maskCompletedText:n,columns:u,dropdownTrigger:p,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:j,showNonTappableOptions:N,locationSearch:A,showProducts:X,submitProgress:W,awaitAnswerOnSubmit:I,submitAnswerTimeoutMs:G,source:Qe,value:x,completedParams:te,onSubmit:(...H)=>Fe.current?.(...H),onResult:(...H)=>f.current?.(...H),onError:(...H)=>C.current?.(...H),onChange:(...H)=>E.current?.(...H),onParamsChange:(...H)=>z.current?.(...H),onFocus:()=>M.current?.(),onBlur:()=>K.current?.(),onProductSelect:H=>de.current?de.current(H):ln,onProductAddToCart:H=>Re.current?.(H),setCursor:H=>pe.current?.(H),products:He.config,mapProducts:ue});h.current=d,Ee(d.getState());let q=d.subscribe(H=>Ee(H));return()=>{q(),d.destroy(),h.current===d&&(h.current=null)}},[]);let i=V(be);Ve(()=>{i.current!==be&&(i.current=be,h.current?.update({visitorId:be?ze:void 0,analyticsConsent:he}))},[be,ze,he]);let B=typeof m=="function"?"function":m,we=V(B);Ve(()=>{we.current!==B&&(we.current=B,h.current?.refreshAnalyticsConsent())},[B]),Ve(()=>{x!==void 0&&h.current?.setValue(x)},[x]),Ve(()=>{te!==void 0&&h.current?.setCompletedParams(te)},[te]);let Se=JSON.stringify(l??null),$e;try{$e=JSON.stringify(s??null)}catch{$e="[unstringifiable]"}Ve(()=>{h.current?.update({apiConfig:l,additionalContext:s,language:c,currency:w,productId:v,optionOverrides:Be.overrides,dropdownTrigger:p,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:j,showNonTappableOptions:N,locationSearch:A,showProducts:X,submitProgress:W,awaitAnswerOnSubmit:I,submitAnswerTimeoutMs:G})},[Se,$e,c,w?.code,w?.rate,w?.country,v,Be.key,p,k,S,T,O,L,j,N,A,X,W,I,G]);let Ce=V(!1);Ve(()=>{if(!Ce.current){Ce.current=!0;return}h.current?.update({products:He.config})},[He.enabled]),Ve(()=>{h.current?.update({mapProducts:ue})},[ue]);let Le=V(null);Le.current===null&&(Le.current={handleTextChange:d=>h.current?.handleTextChange(d),handleCompositionText:d=>h.current?.handleCompositionText(d),handleKeyDown:d=>{let q="nativeEvent"in d?d.nativeEvent:d;h.current?.handleKeyDown(q)},setFocused:d=>h.current?.setFocused(d),startEditingParam:d=>h.current?.startEditingParam(d),removeParam:d=>h.current?.removeParam(d)??!1,exitEditMode:()=>h.current?.exitEditMode(),handleCaretAfterInput:d=>h.current?.handleCaretAfterInput(d),handleCaretMove:d=>h.current?.handleCaretMove(d),replaceEditingRange:d=>h.current?.replaceEditingRange(d)??!1,setActivePill:d=>h.current?.setActivePill(d),skipActivePill:()=>h.current?.skipActivePill(),removeLastParam:()=>h.current?.removeLastParam(),clearNewParamId:()=>h.current?.clearNewParamId(),reset:()=>h.current?.reset(),refreshProducts:()=>h.current?.refreshProducts(),prepareSubmit:()=>h.current?.prepareSubmit(),getState:()=>h.current?.getState()??Qa,getResult:()=>h.current?.getResult()??un,awaitSubmitResult:()=>h.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:d=>h.current?.recordSubmit(d),holdSubmit:d=>h.current?.holdSubmit(d),endSubmitProgress:()=>h.current?.endSubmitProgress(),getSearchId:()=>h.current?.getSearchId(),getVisitorId:()=>h.current?.getVisitorId(),refreshAnalyticsConsent:()=>h.current?.refreshAnalyticsConsent(),selectOption:(d,q)=>h.current?.selectOption(d,q),selectProduct:d=>h.current?.selectProduct(d),addProductToCart:d=>{let q=h.current;return!q||!Re.current?Promise.resolve():q.addProductToCart(d)},setActiveDropdownIndex:d=>h.current?.setActiveDropdownIndex(d),clearHighlight:d=>h.current?.clearHighlight(d),showPreviousMonth:()=>h.current?.showPreviousMonth(),showNextMonth:()=>h.current?.showNextMonth(),setTime:d=>h.current?.setTime(d),commitTime:()=>h.current?.commitTime(),toggleMultiSelectOption:d=>h.current?.toggleMultiSelectOption(d),commitMultiSelect:()=>h.current?.commitMultiSelect(),setLocationQuery:d=>h.current?.setLocationQuery(d),moveLocationHighlight:d=>h.current?.moveLocationHighlight(d),commitLocation:d=>h.current?.commitLocation(d),setLocationFieldFocused:d=>h.current?.setLocationFieldFocused(d),handleFocus:()=>h.current?.setFocused(!0),handleBlur:()=>h.current?.setFocused(!1)});let b=Le.current,ot=Ua(d=>{let q=d.target.value,Pt=q.length>0&&!d.nativeEvent?.isComposing&&q[0]!==q[0].toUpperCase()?q[0].toUpperCase()+q.slice(1):q;h.current?.handleTextChange(Pt)},[]),We=Ua(d=>{h.current?.handleKeyDown(d.nativeEvent)},[]),Ge=h.current,g=Ye??Qa,Ke=x!==void 0?x:g.text,nt=te!==void 0?te:g.completedParams,Oe=g.actionableSuggestions,rt=Oe[0],st=pn(()=>cn(Oe),[Oe]),qe=Ge?.listboxId??"",lt=g.activeDropdownIndex>=0&&Ge?`${qe}-option-${g.activeDropdownIndex}`:void 0,De=g.editingParam,P=g.editingIdentified,St=De?sn(De):P?{parameter:P.parameter,text:dn(P.parameter),required:!0,options:[]}:null,Ct=g.dropdownSuggestion??St??rt,Nt=rn(g.dropdownSuggestion,St,Oe),dt=nn(g),Tt=!Ge||g.dropdownLoading;return{completedParams:nt,multiSelectView:g.multiSelectView,toggleMultiSelectOption:b.toggleMultiSelectOption,commitMultiSelect:b.commitMultiSelect,skippedParams:g.skippedParams,identifiedParams:g.identifiedParams,suggestionPills:st,setActivePill:b.setActivePill,skipActivePill:b.skipActivePill,removeLastParam:b.removeLastParam,segments:g.segments,newParamId:g.newParamId,clearNewParamId:b.clearNewParamId,suggestions:g.suggestions,activeIndex:g.activeDropdownIndex,isReady:g.isReady,isLoading:Tt,isFocused:g.isFocused,isDropdownOpen:g.isDropdownOpen,isActivePillSelected:g.isActivePillSelected,blockingChips:g.blockingChips,placeholderText:g.placeholderText,listboxId:qe,error:g.error,products:g.products,customFields:g.customFields,selectProduct:b.selectProduct,addProductToCart:b.addProductToCart,handleTextChange:b.handleTextChange,handleCompositionText:b.handleCompositionText,handleKeyDown:b.handleKeyDown,setFocused:b.setFocused,editingParam:De,editingIdentified:P,editingAnchor:g.editingAnchor,caretOffset:g.caretOffset,startEditingParam:b.startEditingParam,removeParam:b.removeParam,exitEditMode:b.exitEditMode,handleCaretAfterInput:b.handleCaretAfterInput,handleCaretMove:b.handleCaretMove,replaceEditingRange:b.replaceEditingRange,inputProps:{value:Ke,placeholder:g.placeholderText||void 0,onChange:ot,onKeyDown:We,onFocus:b.handleFocus,onBlur:b.handleBlur,role:"combobox","aria-expanded":g.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":qe},reset:b.reset,refreshProducts:b.refreshProducts,prepareSubmit:b.prepareSubmit,getState:b.getState,getResult:b.getResult,awaitSubmitResult:b.awaitSubmitResult,recordSubmit:b.recordSubmit,holdSubmit:b.holdSubmit,endSubmitProgress:b.endSubmitProgress,getSearchId:b.getSearchId,getVisitorId:b.getVisitorId,refreshAnalyticsConsent:b.refreshAnalyticsConsent,isSubmitting:g.isSubmitting,selectingProductId:g.selectingProductId,dropdownProps:{suggestions:Ct?[{...Ct,options:g.dropdownOptions}]:[],activeIndex:g.activeDropdownIndex,onSelect:b.selectOption,onHighlight:b.setActiveDropdownIndex,onUnhighlight:b.clearHighlight,isOpen:g.isDropdownOpen,id:qe,pills:Nt,activeSelected:g.isActivePillSelected,onPillClick:b.setActivePill,onSkip:b.skipActivePill,showSkipButton:(ie??!0)&&!De&&!P,showOptionIcons:D??!0,showOptionImages:F??!0,showOptionCounts:Y??!0,skipDisabled:g.inSelectionAnimation,isLoading:Tt,skeletonExiting:g.skeletonExiting,isInputEmpty:Ke.trim().length===0,language:c,products:g.products,productImageFallback:se,showProductVendor:le,onProductSelect:b.selectProduct,busyProductId:g.selectingProductId,seeAllBusy:g.isSubmitting,onProductAddToCart:fe?b.addProductToCart:void 0,onProductFocusChange:b.setFocused,formatType:g.activeFormatType,dateView:g.dateView,selectedDateIso:dt.selectedIso,selectedDateRange:dt.selectedRange,dateRangeStart:dt.rangeStart,dateReferences:dt.references,onPreviousMonth:b.showPreviousMonth,onNextMonth:b.showNextMonth,timeView:g.timeView,multiSelectView:g.dropdownMultiSelect,onMultiSelectCommit:b.commitMultiSelect,onTimeChange:b.setTime,onTimeCommit:b.commitTime,locationView:g.locationView,isReediting:g.editingParam!=null,onLocationQuery:b.setLocationQuery,onLocationMove:b.moveLocationHighlight,onLocationCommit:b.commitLocation,onLocationFocusChange:b.setLocationFieldFocused,isFocused:g.isFocused||g.locationFieldFocused,optionsPosition:k??"below"}}}import{attachChipRemove as mn,cancelStartingHint as gn,chipIdFromTap as fn,extractPlainText as Ya,focusesInputOnSelect as bn,getCursorOffset as ja,keepCaretOnChip as wn,plainTextLength as vn,renderEditableContent as xn,setCursorOffset as yn,settlePickFocus as kn,startingHintOptions as Sn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ke,useEffect as mt,useLayoutEffect as Xt,useRef as at}from"react";var Dt;function Cn(){if(Dt!==void 0)return Dt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Dt=e.contentEditable==="plaintext-only",Dt}function $a(e){let{segments:r,showChipIcons:t=!0,showChipImages:o=!0,showChipRemove:n=!1,blockingParamIds:l,focusInputOnSelect:s,removeParam:c,newParamId:w,editingParam:v,editingIdentified:y,editingAnchor:m,caretOffset:u,placeholderText:p,hintSuggestions:k,isFocused:S,isDropdownOpen:T,listboxId:O,activeDescendantId:L,autoFocus:j,handleTextChange:N,handleCompositionText:A,handleKeyDown:D,handleCaretAfterInput:F,handleCaretMove:Y,startEditingParam:ie,replaceEditingRange:X,setFocused:W}=e,I=at(null),G=at(!1),se=at(""),le=at(""),ee=at(null),a=at(0);ee.current=u;let x=at(s);x.current=s,mt(()=>{if(!j)return;let f=I.current;if(!f)return;document.activeElement===f?W(!0):f.focus();let C=f.ownerDocument??document,E=C.getSelection(),z=E&&E.rangeCount>0&&f.contains(E.anchorNode);if(E&&!z){let M=C.createRange();M.selectNodeContents(f),M.collapse(!0),E.removeAllRanges(),E.addRange(M)}},[j,W]),mt(()=>{let f=I.current;if(!f)return;let C=f.ownerDocument??document,E=()=>{let z=C.getSelection();if(!z||z.rangeCount===0||!z.anchorNode||!f.contains(z.anchorNode))return;let M=z.anchorNode,K=M.nodeType===Node.ELEMENT_NODE?M:M.parentElement,de=(z.isCollapsed?K?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Re=v?.id??y?.id??null;if(de&&de!==Re){ie(de);return}performance.now()-a.current<50||Y(ja(f))};return C.addEventListener("selectionchange",E),()=>C.removeEventListener("selectionchange",E)},[v,y,ie,Y]),mt(()=>{let f=I.current;if(!f)return;let C=E=>{let z=fn(f,E.target);z&&(ie(z),wn(f,z))};return f.addEventListener("click",C),()=>f.removeEventListener("click",C)},[ie]);let te=n||(l?.length??0)>0;mt(()=>{let f=I.current;if(!(!f||!c||!te))return mn(f,c)},[c,te]),Xt(()=>{let f=I.current;f&&xn({input:f,segments:r,newParamId:w,editingParamId:v?.id??null,placeholderText:p??"",isFocused:S,showChipIcons:t,showChipImages:o,showChipRemove:n,blockingParamIds:l,hintOptions:Sn(k??[])})},[r,w,v,p,k,S,t,o,n,l]),mt(()=>{let f=I.current;return()=>{f&&gn(f)}},[]),Xt(()=>{let f=se.current,C=w??"";if(se.current=C,!C||C===f)return;let E=I.current;if(!E)return;let z=ee.current??vn(E);kn(E,z,bn(x.current))},[w]),Xt(()=>{let f=le.current,C=v?.id??"";if(le.current=C,!C||C===f||m==null)return;let E=I.current;E&&yn(E,m)},[v,m]);let ae=ke(()=>{let f=I.current;if(!f)return;let C=Ya(f),z=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(G.current){A(z);return}N(z)},[N,A]),ne=ke(()=>{a.current=performance.now(),ae();let f=I.current;f&&F(ja(f))},[ae,F]);mt(()=>{let f=I.current;if(!f)return;let C=E=>{let z=E,M=z.inputType;if(M==="insertParagraph"||M==="insertLineBreak"||M==="insertFromDrop"){E.preventDefault();return}if(M.startsWith("insert")||M.startsWith("delete")){let K=M.startsWith("delete")?"":z.data??"";X(K)&&E.preventDefault()}};return f.addEventListener("beforeinput",C),()=>f.removeEventListener("beforeinput",C)},[X]);let Ue=ke(()=>{G.current=!0,I.current?.setAttribute("data-aia-composing","true")},[]),Ie=ke(()=>{G.current=!1,I.current?.removeAttribute("data-aia-composing"),ae()},[ae]),Ae=ke(f=>{f.preventDefault();let C=I.current;if(!C)return;let E=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!E)return;let z=C.ownerDocument??document,M=z.getSelection();if(!M||M.rangeCount===0)return;let K=M.getRangeAt(0);if(!C.contains(K.startContainer))return;K.deleteContents();let pe=z.createTextNode(E);K.insertNode(pe),K.setStartAfter(pe),K.collapse(!0),M.removeAllRanges(),M.addRange(K),ae()},[ae]),fe=ke(f=>D(f),[D]),Qe=ke(()=>W(!0),[W]),Ne=ke(()=>W(!1),[W]),h=ke(()=>I.current?.focus(),[]),Ye=ke(()=>I.current?.blur(),[]),Ee=ke(()=>{let f=I.current;return f?Ya(f):""},[]),Fe=Cn()?"plaintext-only":"true";return{inputRef:I,editorProps:{ref:I,contentEditable:Fe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":O,"aria-expanded":T,"aria-activedescendant":L,spellCheck:!0,enterKeyHint:"send",onInput:ne,onKeyDown:fe,onCompositionStart:Ue,onCompositionEnd:Ie,onPaste:Ae,onFocus:Qe,onBlur:Ne},getPlainText:Ee,focus:h,blur:Ye}}import{jsx as ft,jsxs as ea}from"react/jsx-runtime";function Mn(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Nn=Tn(function({onSubmit:r,onResult:t,onError:o,optionOverrides:n,maskCompletedText:l,className:s,apiConfig:c,additionalContext:w,language:v,currency:y,productId:m,visitorId:u,analyticsConsent:p,columns:k,pillPlacement:S="dropdown",mode:T="auto",optionsPosition:O="below",animations:L=!0,optionsStyle:j="floating",dropdownTrigger:N,closeDropdownOnBlur:A,focusInputOnSelect:D,startingState:F,prependPlaceholder:Y,allOption:ie,showNonTappableOptions:X,locationSearch:W,showOptionIcons:I=!0,showChipIcons:G=!0,showChipImages:se=!0,showChipRemove:le=!1,showOptionImages:ee=!0,showOptionCounts:a=!0,showSkipButton:x,showProducts:te,submitProgress:ae,awaitAnswerOnSubmit:ne,submitAnswerTimeoutMs:Ue,productsLayout:Ie,productImageFallback:Ae,showProductVendor:fe,autoFocus:Qe=!0,onFocus:Ne,onBlur:h,value:Ye,completedParams:Ee,onChange:Fe,onParamsChange:f,products:C,mapProducts:E,onProductSelect:z,onProductAddToCart:M,submitButton:K,resetOnSubmit:pe=!0,seeAllResults:de=!1},Re){let oe=gt(null),ze=gt(null),be=gt(null),je=gt(()=>{}),he=gt(null),He=gt(null);Jt(()=>{let R=oe.current;if(R)return he.current?he.current.setMode(T):he.current=new zn(R,T),()=>{he.current?.destroy(),he.current=null}},[T]);let it=Mt(R=>{let ve=He.current?.current;ve&&(ve.focus(),Ln(ve,R))},[]),{completedParams:ce,suggestionPills:ue,setActivePill:Be,skipActivePill:i,segments:B,newParamId:we,clearNewParamId:Se,placeholderText:$e,isFocused:Ce,isDropdownOpen:Le,isActivePillSelected:b,blockingChips:ot,isLoading:We,isReady:Ge,activeIndex:g,listboxId:Ke,handleTextChange:nt,handleCompositionText:Oe,handleKeyDown:rt,setFocused:st,editingParam:qe,editingIdentified:lt,editingAnchor:De,caretOffset:P,startEditingParam:St,removeParam:Ct,handleCaretAfterInput:Nt,handleCaretMove:dt,replaceEditingRange:Tt,dropdownProps:d,reset:q,refreshProducts:H,prepareSubmit:Pt,getState:It,getResult:ta,awaitSubmitResult:aa,recordSubmit:ia,holdSubmit:oa,endSubmitProgress:na,getSearchId:ra,getVisitorId:sa,refreshAnalyticsConsent:la,isSubmitting:Ft}=Zt({onSubmit:R=>je.current(R),onResult:t,onError:o,optionOverrides:n,maskCompletedText:l,apiConfig:c,additionalContext:w,language:v,currency:y,productId:m,visitorId:u,analyticsConsent:p,columns:k,dropdownTrigger:N,optionsPosition:O,closeDropdownOnBlur:A,focusInputOnSelect:D,startingState:F,prependPlaceholder:Y,allOption:ie,showNonTappableOptions:X,locationSearch:W,showOptionIcons:I,showOptionImages:ee,showOptionCounts:a,showSkipButton:x,showProducts:te,submitProgress:ae,awaitAnswerOnSubmit:ne,submitAnswerTimeoutMs:Ue,onFocus:Ne,onBlur:h,value:Ye,completedParams:Ee,onChange:Fe,onParamsChange:f,products:C,mapProducts:E,onProductSelect:z,onProductAddToCart:M,source:"full-sdk",setCursor:it});Jt(()=>{if(!we)return;let R=window.setTimeout(()=>Se(),650);return()=>window.clearTimeout(R)},[we,Se]);let Za=An(()=>ot.map(R=>R.paramId),[ot]),Xa=g>=0?`${Ke}-option-${g}`:void 0,{inputRef:ct,editorProps:Ja,focus:da,blur:ca,getPlainText:pa}=$a({segments:B,newParamId:we,editingParam:qe,editingIdentified:lt,editingAnchor:De,caretOffset:P,placeholderText:$e,hintSuggestions:S==="inline"?[]:ue,isFocused:Ce,showChipIcons:G,showChipImages:se,showChipRemove:le,blockingParamIds:Za,removeParam:Ct,focusInputOnSelect:D,isDropdownOpen:Le,listboxId:Ke,activeDescendantId:Xa,autoFocus:Qe,handleTextChange:nt,handleCompositionText:Oe,handleKeyDown:rt,handleCaretAfterInput:Nt,handleCaretMove:dt,startEditingParam:St,replaceEditingRange:Tt,setFocused:st});He.current=ct,In(()=>{let R=ze.current,ve=ct.current;if(!R||!ve)return;let Xe=()=>{let wt=R.firstElementChild;if(!wt)return;let ni=wt.getBoundingClientRect(),ri=ve.getBoundingClientRect();ni.top>=ri.bottom-2?R.setAttribute("data-aia-pill-wrapped",""):R.removeAttribute("data-aia-pill-wrapped")};Xe();let bt=new ResizeObserver(Xe);return bt.observe(ve),()=>bt.disconnect()},[B,ue.length,We,ct]),Jt(()=>{let R=be.current;if(R)return Dn(R)},[]),Pn(Re,()=>({focus:da,blur:ca,reset:q,refreshProducts:H,setMode:R=>he.current?.setMode(R),skipActivePill:i,endSubmitProgress:na,getSearchId:ra,getVisitorId:sa,refreshAnalyticsConsent:la}),[da,ca,q,H,i,na,ra,sa,la]);let Ze=!!B.length||ce.length>0,At=Mt((R,ve)=>{let Xe=It(),bt=En(pa(),Xe.completedParams,Xe.skippedParams,{identifiedParams:Xe.identifiedParams,isReady:Xe.isReady,customFields:ve.custom_fields??null,customFieldsStale:ve.custom_fields_stale===!0});R&&ia(bt);let wt=r(bt);return R&&!pe&&oa(wt),pe&&q(),wt},[ia,oa,pe,It,r,q,pa]),Ht=Mt(()=>{if(Ze&&!It().isSubmitting){if(ne){aa().then(R=>{R&&At(!0,R)});return}Pt(),At(!0,ta())}},[Ze,It,ne,aa,Pt,ta,At]);je.current=R=>Ze?At(!1,R):void 0;let ei=de&&!d.isInputEmpty&&Ze,ti=Ht,ai=Mt(R=>{R.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||ct.current&&Rn(ct.current)},[ct]),ii=S==="inline",oi=S==="dropdown";return ea("div",{ref:oe,className:`magicx-aia ${Je.container} ${s??""}`,"data-pill-placement":S,"data-options-position":O,"data-animations":L?"on":"off","data-aia-options-style":j,"data-mode":Mn(T),children:[ft(jt,{...d,showPills:oi,productsLayout:Ie,productImageFallback:Ae,showProductVendor:fe,onSeeAllResults:ei?ti:void 0,fullWidth:de}),ea("div",{className:Je.inputWrapper,"data-aia-input-wrapper":"",onClick:ai,children:[ea("div",{ref:be,className:Je.editorArea,"data-aia-editor":"",children:[ft("div",{...Ja,className:Je.input,"data-aia-input":""}),ii&&(We||ue.length>0)&&ft("span",{ref:ze,className:Je.pillListContainer,"data-aia-pill-list-container":"",children:ft(Rt,{pills:ue,activePillIndex:0,activeSelected:b,onSelectPill:Be,loading:We})})]}),K===null?null:K===void 0?ft(Ga,{disabled:!Ze,ready:Ze&&Ge,busy:Ft,onClick:Ht,label:On(v).submit}):ft("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Ft?"busy":void 0,"aria-busy":Ft?!0:void 0,className:Je.submitSlot,onClick:R=>{Ze&&(R.stopPropagation(),Ht())},children:K})]})]})});export{Nn as AIAutocomplete,jt as AIAutocompleteDropdown,Vs as DATE_RANGE_META_END,Us as DATE_RANGE_META_START,Qs as DEFAULT_OPTION_COUNT_UNIT,il as LOCATION_META_KEY,pl as PRODUCT_PATH_PREFIX,yl as TIME_META_KEY,Sl as WEEKDAY_LABELS,Ks as buildSubmitResult,qs as cellDay,_s as cellIso,Ys as dateCellMarks,js as focusesInputOnSelect,$s as formatDate,Zs as formatDateRange,Xs as formatOptionCount,Js as formatPlace,el as formatTime,al as isTouchPrimary,tl as isoDate,ol as monthLabel,nl as optionCountLabel,rl as optionHasImage,sl as optionImageSources,ll as optionImageSrc,dl as optionLabel,cl as optionsShowLeadingVisuals,hl as parseDate,ul as parseLooseDate,ml as parseLooseDateRange,gl as parseTime,fl as productFromMatchedItem,bl as productImageSources,wl as productsFromCustomFields,vl as sanitizeOptionIconSvg,xl as selectedRangeFor,Zt as useAIAutocomplete,kl as visibleDateRange,Cl as withSkippedParams};
3940
4003
  //# sourceMappingURL=index.mjs.map