@magicx-eng/ai-autocomplete-react 0.66.3 → 0.67.1

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.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Yt=Object.defineProperty;var ja=Object.getOwnPropertyDescriptor;var $a=Object.getOwnPropertyNames;var Za=Object.prototype.hasOwnProperty;var Xa=(e,a)=>{for(var t in a)Yt(e,t,{get:a[t],enumerable:!0})},Ja=(e,a,t,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of $a(a))!Za.call(e,i)&&i!==t&&Yt(e,i,{get:()=>a[i],enumerable:!(n=ja(a,i))||n.enumerable});return e};var ei=e=>Ja(Yt({},"__esModule",{value:!0}),e);var zi={};Xa(zi,{AIAutocomplete:()=>Ba,AIAutocompleteDropdown:()=>Gt,DATE_RANGE_META_END:()=>d.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>d.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>d.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>d.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>d.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>d.TIME_META_KEY,WEEKDAY_LABELS:()=>d.WEEKDAY_LABELS,buildSubmitResult:()=>d.buildSubmitResult,cellDay:()=>d.cellDay,cellIso:()=>d.cellIso,dateCellMarks:()=>d.dateCellMarks,focusesInputOnSelect:()=>d.focusesInputOnSelect,formatDate:()=>d.formatDate,formatDateRange:()=>d.formatDateRange,formatOptionCount:()=>d.formatOptionCount,formatPlace:()=>d.formatPlace,formatTime:()=>d.formatTime,isTouchPrimary:()=>d.isTouchPrimary,isoDate:()=>d.isoDate,monthLabel:()=>d.monthLabel,optionCountLabel:()=>d.optionCountLabel,optionHasImage:()=>d.optionHasImage,optionImageSources:()=>d.optionImageSources,optionImageSrc:()=>d.optionImageSrc,optionLabel:()=>d.optionLabel,optionsShowLeadingVisuals:()=>d.optionsShowLeadingVisuals,parseDate:()=>d.parseDate,parseLooseDate:()=>d.parseLooseDate,parseLooseDateRange:()=>d.parseLooseDateRange,parseTime:()=>d.parseTime,productFromMatchedItem:()=>d.productFromMatchedItem,productImageSources:()=>d.productImageSources,productsFromCustomFields:()=>d.productsFromCustomFields,sanitizeOptionIconSvg:()=>d.sanitizeOptionIconSvg,selectedRangeFor:()=>d.selectedRangeFor,useAIAutocomplete:()=>qt,visibleDateRange:()=>d.visibleDateRange,withSkippedParams:()=>d.withSkippedParams});module.exports=ei(zi);var d=require("@magicx-eng/ai-autocomplete-vanilla");var j=require("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
+ "use strict";var jt=Object.defineProperty;var Za=Object.getOwnPropertyDescriptor;var Xa=Object.getOwnPropertyNames;var Ja=Object.prototype.hasOwnProperty;var ei=(e,a)=>{for(var t in a)jt(e,t,{get:a[t],enumerable:!0})},ti=(e,a,t,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of Xa(a))!Ja.call(e,o)&&o!==t&&jt(e,o,{get:()=>a[o],enumerable:!(n=Za(a,o))||n.enumerable});return e};var ai=e=>ti(jt({},"__esModule",{value:!0}),e);var Oi={};ei(Oi,{AIAutocomplete:()=>Wa,AIAutocompleteDropdown:()=>Kt,DATE_RANGE_META_END:()=>d.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>d.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>d.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>d.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>d.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>d.TIME_META_KEY,WEEKDAY_LABELS:()=>d.WEEKDAY_LABELS,buildSubmitResult:()=>d.buildSubmitResult,cellDay:()=>d.cellDay,cellIso:()=>d.cellIso,dateCellMarks:()=>d.dateCellMarks,focusesInputOnSelect:()=>d.focusesInputOnSelect,formatDate:()=>d.formatDate,formatDateRange:()=>d.formatDateRange,formatOptionCount:()=>d.formatOptionCount,formatPlace:()=>d.formatPlace,formatTime:()=>d.formatTime,isTouchPrimary:()=>d.isTouchPrimary,isoDate:()=>d.isoDate,monthLabel:()=>d.monthLabel,optionCountLabel:()=>d.optionCountLabel,optionHasImage:()=>d.optionHasImage,optionImageSources:()=>d.optionImageSources,optionImageSrc:()=>d.optionImageSrc,optionLabel:()=>d.optionLabel,optionsShowLeadingVisuals:()=>d.optionsShowLeadingVisuals,parseDate:()=>d.parseDate,parseLooseDate:()=>d.parseLooseDate,parseLooseDateRange:()=>d.parseLooseDateRange,parseTime:()=>d.parseTime,productFromMatchedItem:()=>d.productFromMatchedItem,productImageSources:()=>d.productImageSources,productsFromCustomFields:()=>d.productsFromCustomFields,sanitizeOptionIconSvg:()=>d.sanitizeOptionIconSvg,selectedRangeFor:()=>d.selectedRangeFor,useAIAutocomplete:()=>_t,visibleDateRange:()=>d.visibleDateRange,withSkippedParams:()=>d.withSkippedParams});module.exports=ai(Oi);var d=require("@magicx-eng/ai-autocomplete-vanilla");var Q=require("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 @@
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 @@
439
463
  transition: none;
440
464
  }
441
465
  }
442
- `,document.head.appendChild(e)}var wt={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"};var M=require("@magicx-eng/ai-autocomplete-vanilla"),ee=require("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 wt={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"};var M=require("@magicx-eng/ai-autocomplete-vanilla"),te=require("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
  *
@@ -1813,7 +1837,7 @@
1813
1837
  opacity: 1;
1814
1838
  }
1815
1839
  }
1816
- `,document.head.appendChild(e)}var Ae={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"};var ae=require("@magicx-eng/ai-autocomplete-vanilla"),ha=require("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 Re={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"};var ae=require("@magicx-eng/ai-autocomplete-vanilla"),ua=require("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) ---
1817
1841
 
1818
1842
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1819
1843
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -2010,7 +2034,7 @@
2010
2034
  opacity: 0.8;
2011
2035
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
2012
2036
  }
2013
- `,document.head.appendChild(e)}var J={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"};var we=require("react/jsx-runtime"),ti=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ua({options:e,activeIndex:a,listboxId:t,view:n,selection:i,onSelect:c,onHighlight:s,onUnhighlight:p,onPreviousMonth:b,onNextMonth:y}){let k=(0,ae.isoDate)(new Date),g=(0,ae.visibleDateRange)({pendingStart:i.rangeStart,highlightedIso:(0,ae.cellIso)(e[a]),selected:i.selectedRange,floor:i.floor});return(0,we.jsxs)("div",{className:J.datepicker,"data-aia-datepicker":"",children:[(0,we.jsxs)("div",{className:J.header,children:[(0,we.jsx)("button",{type:"button",tabIndex:-1,className:J.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:b,children:"\u2039"}),(0,we.jsx)("span",{className:J.month,"data-aia-date-month":"","aria-live":"polite",children:(0,ae.monthLabel)(n)}),(0,we.jsx)("button",{type:"button",tabIndex:-1,className:J.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:y,children:"\u203A"})]}),(0,we.jsx)("div",{className:J.weekdays,"aria-hidden":"true",children:ae.WEEKDAY_LABELS.map((h,u)=>(0,we.jsx)("span",{className:J.weekday,children:h},ti[u]))}),(0,we.jsx)("div",{className:J.grid,"data-aia-date-grid":"",children:e.map((h,u)=>(0,we.jsx)(ai,{option:h,id:`${t}-option-${u}`,index:u,isHighlighted:u===a&&h.is_tappable,isToday:(0,ae.cellIso)(h)===k,isPast:(0,ae.isDimmedDay)((0,ae.cellIso)(h),k,i.floor),marks:(0,ae.dateCellMarks)((0,ae.cellIso)(h),{selectedIso:i.selectedIso,range:g,references:i.references}),onSelect:c,onHighlight:s,onUnhighlight:p},(0,ae.cellIso)(h)??`pad-${u}`))})]})}function ai({option:e,id:a,index:t,isHighlighted:n,isToday:i,isPast:c,marks:s,onSelect:p,onHighlight:b,onUnhighlight:y}){let[k,g]=(0,ha.useState)(!1),h=(0,ae.cellDay)(e);if(h==null)return(0,we.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${J.cell} ${J.blank}`});let u=()=>{g(!0),p(e),setTimeout(()=>g(!1),170)},S=[J.cell,J.day,c?J.past:"",n?J.highlighted:"",i?J.today:"",s.inRange?J.inRange:"",s.selected?J.selected:"",s.reference?J.reference:"",k?J.pressed:""].filter(Boolean).join(" ");return(0,we.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":n,"aria-label":e.text,tabIndex:0,className:S,onClick:u,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),u())},onMouseEnter:()=>b(t),onMouseLeave:y?()=>y(t):void 0,children:(0,we.jsx)("span",{className:J.number,children:h})})}var rt=require("@magicx-eng/ai-autocomplete-vanilla"),Ft=require("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 ee={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"};var ve=require("react/jsx-runtime"),ii=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ma({options:e,activeIndex:a,listboxId:t,view:n,selection:o,onSelect:l,onHighlight:s,onUnhighlight:p,onPreviousMonth:v,onNextMonth:x}){let k=(0,ae.isoDate)(new Date),g=(0,ae.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,ae.cellIso)(e[a]),selected:o.selectedRange,floor:o.floor});return(0,ve.jsxs)("div",{className:ee.datepicker,"data-aia-datepicker":"",children:[(0,ve.jsxs)("div",{className:ee.header,children:[(0,ve.jsx)("button",{type:"button",tabIndex:-1,className:ee.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:m=>m.preventDefault(),onClick:v,children:"\u2039"}),(0,ve.jsx)("span",{className:ee.month,"data-aia-date-month":"","aria-live":"polite",children:(0,ae.monthLabel)(n)}),(0,ve.jsx)("button",{type:"button",tabIndex:-1,className:ee.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:m=>m.preventDefault(),onClick:x,children:"\u203A"})]}),(0,ve.jsx)("div",{className:ee.weekdays,"aria-hidden":"true",children:ae.WEEKDAY_LABELS.map((m,h)=>(0,ve.jsx)("span",{className:ee.weekday,children:m},ii[h]))}),(0,ve.jsx)("div",{className:ee.grid,"data-aia-date-grid":"",children:e.map((m,h)=>(0,ve.jsx)(oi,{option:m,id:`${t}-option-${h}`,index:h,isHighlighted:h===a&&m.is_tappable,isToday:(0,ae.cellIso)(m)===k,isPast:(0,ae.isDimmedDay)((0,ae.cellIso)(m),k,o.floor),marks:(0,ae.dateCellMarks)((0,ae.cellIso)(m),{selectedIso:o.selectedIso,range:g,references:o.references}),onSelect:l,onHighlight:s,onUnhighlight:p},(0,ae.cellIso)(m)??`pad-${h}`))})]})}function oi({option:e,id:a,index:t,isHighlighted:n,isToday:o,isPast:l,marks:s,onSelect:p,onHighlight:v,onUnhighlight:x}){let[k,g]=(0,ua.useState)(!1),m=(0,ae.cellDay)(e);if(m==null)return(0,ve.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${ee.cell} ${ee.blank}`});let h=()=>{g(!0),p(e),setTimeout(()=>g(!1),170)},S=[ee.cell,ee.day,l?ee.past:"",n?ee.highlighted:"",o?ee.today:"",s.inRange?ee.inRange:"",s.selected?ee.selected:"",s.reference?ee.reference:"",k?ee.pressed:""].filter(Boolean).join(" ");return(0,ve.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":n,"aria-label":e.text,tabIndex:0,className:S,onClick:h,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),h())},onMouseEnter:()=>v(t),onMouseLeave:x?()=>x(t):void 0,children:(0,ve.jsx)("span",{className:ee.number,children:m})})}var dt=require("@magicx-eng/ai-autocomplete-vanilla"),Ht=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
2014
2038
  display: flex;
2015
2039
  flex-wrap: wrap;
2016
2040
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -2050,7 +2074,7 @@
2050
2074
  .aia-cluster[data-justify="around"] {
2051
2075
  justify-content: space-around;
2052
2076
  }
2053
- `,document.head.appendChild(e)}var jt=require("react/jsx-runtime");function zt({gap:e,align:a="center",justify:t="start",noWrap:n=!1,inline:i=!1,className:c,children:s,...p}){let b=e?{"--aia-cluster-gap":e}:void 0,y={className:c?`aia-cluster ${c}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":n||void 0,"data-inline":i||void 0,style:b,...p};return i?(0,jt.jsx)("span",{...y,children:s}):(0,jt.jsx)("div",{...y,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
2077
+ `,document.head.appendChild(e)}var $t=require("react/jsx-runtime");function Et({gap:e,align:a="center",justify:t="start",noWrap:n=!1,inline:o=!1,className:l,children:s,...p}){let v=e?{"--aia-cluster-gap":e}:void 0,x={className:l?`aia-cluster ${l}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":n||void 0,"data-inline":o||void 0,style:v,...p};return o?(0,$t.jsx)("span",{...x,children:s}):(0,$t.jsx)("div",{...x,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
2054
2078
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
2055
2079
  room above the hint/branding row so the footer doesn't butt against the last
2056
2080
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -2198,7 +2222,7 @@
2198
2222
  justify-content: flex-end;
2199
2223
  }
2200
2224
  }
2201
- `,document.head.appendChild(e)}var tt={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"};var Ve=require("react/jsx-runtime");function ma({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,rt.uiStringsFor)()}){let{key:n,hint:i}=(0,rt.getFooterHint)(e,a,t),[c,s]=(0,Ft.useState)(rt.ATTRIBUTION_URL);return(0,Ft.useEffect)(()=>{s((0,rt.buildAttributionUrl)())},[]),(0,Ve.jsx)("footer",{className:tt.footer,"data-aia-footer":"",children:(0,Ve.jsxs)(zt,{justify:"between",noWrap:!0,className:tt.row,children:[(0,Ve.jsxs)(zt,{gap:"5px",className:tt.hintGroup,children:[(0,Ve.jsx)("kbd",{className:tt.key,children:n}),(0,Ve.jsx)("span",{className:tt.hint,children:i})]}),(0,Ve.jsx)("a",{className:tt.brandLink,href:c,target:"_blank",rel:"noopener noreferrer",children:(0,Ve.jsx)("span",{className:tt.badge,children:(0,Ve.jsx)("span",{className:tt.brand,children:"Powered by Intent-1"})})})]})})}var se=require("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 et={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"};var _e=require("react/jsx-runtime");function ga({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,dt.uiStringsFor)()}){let{key:n,hint:o}=(0,dt.getFooterHint)(e,a,t),[l,s]=(0,Ht.useState)(dt.ATTRIBUTION_URL);return(0,Ht.useEffect)(()=>{s((0,dt.buildAttributionUrl)())},[]),(0,_e.jsx)("footer",{className:et.footer,"data-aia-footer":"",children:(0,_e.jsxs)(Et,{justify:"between",noWrap:!0,className:et.row,children:[(0,_e.jsxs)(Et,{gap:"5px",className:et.hintGroup,children:[(0,_e.jsx)("kbd",{className:et.key,children:n}),(0,_e.jsx)("span",{className:et.hint,children:o})]}),(0,_e.jsx)("a",{className:et.brandLink,href:l,target:"_blank",rel:"noopener noreferrer",children:(0,_e.jsx)("span",{className:et.badge,children:(0,_e.jsx)("span",{className:et.brand,children:"Powered by Intent-1"})})})]})})}var se=require("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
2202
2226
  Angular copy). The three are kept identical by
2203
2227
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
2204
2228
  .aia-location-6-fsr {
@@ -2332,7 +2356,7 @@
2332
2356
  .aia-loadingBar-OLCr4:nth-child(3) {
2333
2357
  width: 60%;
2334
2358
  }
2335
- `,document.head.appendChild(e)}var ie={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"};var U=require("react/jsx-runtime"),ii=0;function Lt(e){return e.getRootNode().activeElement??null}function ba(e){return e.getRootNode().getSelection?.()??document.getSelection()}function ga(e){if(!e.isContentEditable)return null;let a=ba(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function fa(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=ba(e);if(!t)return;let n=a;(!n||!n.startContainer.isConnected||!e.contains(n.startContainer))&&(n=document.createRange(),n.selectNodeContents(e),n.collapse(!1)),t.removeAllRanges(),t.addRange(n)}var oi=(0,U.jsxs)("svg",{className:ie.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,U.jsx)("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),(0,U.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),ni=(0,U.jsxs)("svg",{className:ie.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,U.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,U.jsx)("path",{d:"m20 20-3.5-3.5"})]});function wa({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:n,widgetFocused:i,reediting:c=!1,visible:s=!0,interactive:p=!0,onQuery:b,onMove:y,onCommit:k,onFocusChange:g}){let h=(0,se.useRef)(null),u=(0,se.useRef)(null),S=(0,se.useRef)(null),C=(0,se.useRef)(null),I=(0,se.useRef)(null),F=(0,se.useRef)(!1),N=(0,se.useRef)(!1),ne=(0,se.useRef)(!1),K=(0,se.useRef)(!1),R=(0,se.useRef)(i);R.current=i;let H=(0,se.useRef)(g);H.current=g;let _=o=>{K.current=o,g(o)},$=()=>{let o=h.current;return o!=null&&Lt(o)===o},ke=()=>{let o=u.current;if(!o)return;let x=Lt(o);x instanceof HTMLElement&&x!==h.current&&x!==document.body&&!o.contains(x)&&(C.current=x,I.current=ga(x))},Z=o=>{let x=u.current;!x||!(o instanceof HTMLElement)||o===C.current||o===document.body||x.contains(o)||(C.current=o,I.current=ga(o))},A=(0,se.useRef)(null);A.current===null&&(A.current=`aia-location-${++ii}`);let re=`${A.current}-row-`;(0,se.useEffect)(()=>{let o=h.current;o&&o.value!==e.query&&Lt(o)!==o&&(o.value=e.query)},[e.query]),(0,se.useEffect)(()=>{i&&(c&&!ne.current&&(N.current=!1),ne.current=c);let o=h.current;if(o){if(!s&&$()){N.current=!0,X();return}if(!i){setTimeout(()=>{if(R.current)return;let x=C.current;x&&Lt(x)===x||(N.current=!1)},0);return}if(!(!c||N.current||!p||$())){if(ke(),_(!0),o.focus({preventScroll:!0}),!$()){N.current=!0,_(!1);return}o.value&&o.select()}}}),(0,se.useLayoutEffect)(()=>()=>{if(!K.current)return;let o=h.current,x=C.current;x?.isConnected&&o&&Lt(o)===o&&(F.current=!0,fa(x,I.current),F.current=!1),K.current=!1,H.current(!1)},[]);let X=(o=!1)=>{o&&(N.current=!0);let x=C.current;x?.isConnected&&$()&&(F.current=!0,fa(x,I.current),F.current=!1),_(!1)},Se=e.query.trim(),Ce=e.highlighted>=0&&e.highlighted<e.places.length?`${re}${e.highlighted}`:void 0,he=null;return e.places.length>0?he=e.places.map((o,x)=>(0,U.jsxs)("div",{id:`${re}${x}`,role:"option","aria-selected":x===e.highlighted,className:x===e.highlighted?`${ie.row} ${ie.highlighted}`:ie.row,"data-aia-location-row":"","data-aia-index":x,onClick:()=>{p&&(X(!0),k(x))},children:[(0,U.jsx)("span",{className:ie.pin,children:oi}),(0,U.jsxs)("span",{className:ie.text,children:[(0,U.jsx)("span",{className:ie.name,children:o.name}),o.secondary&&(0,U.jsx)("span",{className:ie.secondary,children:o.secondary})]})]},o.id)):e.status==="loading"?he=(0,U.jsxs)("div",{className:ie.loading,"data-aia-location-loading":"",children:[(0,U.jsx)("span",{className:ie.loadingBar}),(0,U.jsx)("span",{className:ie.loadingBar}),(0,U.jsx)("span",{className:ie.loadingBar})]}):Se&&(he=(0,U.jsxs)("div",{className:ie.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,U.jsx)("span",{className:ie.empty,children:t}),(0,U.jsx)("span",{children:n})]})),(0,U.jsxs)("div",{ref:u,className:ie.location,"data-aia-location":"",onMouseDown:o=>{!(o.target instanceof Node)||!S.current?.contains(o.target)||(o.stopPropagation(),ke(),_(!0))},children:[(0,U.jsxs)("label",{ref:S,className:ie.field,children:[ni,(0,U.jsx)("input",{ref:h,type:"text",className:ie.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":Ce,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:s?0:-1,onChange:o=>b(o.target.value),onFocus:o=>{Z(o.relatedTarget),_(!0)},onBlur:()=>{F.current||(N.current=!0,_(!1))},onKeyDown:o=>{if(!o.nativeEvent.isComposing)switch(o.key){case"ArrowDown":case"ArrowUp":o.preventDefault(),y(o.key==="ArrowDown"?1:-1);return;case"Enter":if(o.preventDefault(),!p)return;X(!0),k();return;case"Escape":o.preventDefault(),o.stopPropagation(),N.current=!0,X();return;case"Backspace":if(o.currentTarget.value!=="")return;o.preventDefault(),N.current=!0,X();return}}})]}),(0,U.jsx)("div",{className:ie.results,"data-aia-location-results":"","aria-live":"polite",children:he})]})}var Ht=require("@magicx-eng/ai-autocomplete-vanilla");var va=require("@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 ie={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"};var U=require("react/jsx-runtime"),ni=0;function Rt(e){return e.getRootNode().activeElement??null}function wa(e){return e.getRootNode().getSelection?.()??document.getSelection()}function fa(e){if(!e.isContentEditable)return null;let a=wa(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function ba(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=wa(e);if(!t)return;let n=a;(!n||!n.startContainer.isConnected||!e.contains(n.startContainer))&&(n=document.createRange(),n.selectNodeContents(e),n.collapse(!1)),t.removeAllRanges(),t.addRange(n)}var ri=(0,U.jsxs)("svg",{className:ie.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,U.jsx)("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),(0,U.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),si=(0,U.jsxs)("svg",{className:ie.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,U.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,U.jsx)("path",{d:"m20 20-3.5-3.5"})]});function va({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:n,widgetFocused:o,reediting:l=!1,visible:s=!0,interactive:p=!0,onQuery:v,onMove:x,onCommit:k,onFocusChange:g}){let m=(0,se.useRef)(null),h=(0,se.useRef)(null),S=(0,se.useRef)(null),C=(0,se.useRef)(null),I=(0,se.useRef)(null),F=(0,se.useRef)(!1),N=(0,se.useRef)(!1),re=(0,se.useRef)(!1),K=(0,se.useRef)(!1),R=(0,se.useRef)(o);R.current=o;let H=(0,se.useRef)(g);H.current=g;let _=i=>{K.current=i,g(i)},ne=()=>{let i=m.current;return i!=null&&Rt(i)===i},fe=()=>{let i=h.current;if(!i)return;let y=Rt(i);y instanceof HTMLElement&&y!==m.current&&y!==document.body&&!i.contains(y)&&(C.current=y,I.current=fa(y))},pe=i=>{let y=h.current;!y||!(i instanceof HTMLElement)||i===C.current||i===document.body||y.contains(i)||(C.current=i,I.current=fa(i))},$=(0,se.useRef)(null);$.current===null&&($.current=`aia-location-${++ni}`);let E=`${$.current}-row-`;(0,se.useEffect)(()=>{let i=m.current;i&&i.value!==e.query&&Rt(i)!==i&&(i.value=e.query)},[e.query]),(0,se.useEffect)(()=>{o&&(l&&!re.current&&(N.current=!1),re.current=l);let i=m.current;if(i){if(!s&&ne()){N.current=!0,Z();return}if(!o){setTimeout(()=>{if(R.current)return;let y=C.current;y&&Rt(y)===y||(N.current=!1)},0);return}if(!(!l||N.current||!p||ne())){if(fe(),_(!0),i.focus({preventScroll:!0}),!ne()){N.current=!0,_(!1);return}i.value&&i.select()}}}),(0,se.useLayoutEffect)(()=>()=>{if(!K.current)return;let i=m.current,y=C.current;y?.isConnected&&i&&Rt(i)===i&&(F.current=!0,ba(y,I.current),F.current=!1),K.current=!1,H.current(!1)},[]);let Z=(i=!1)=>{i&&(N.current=!0);let y=C.current;y?.isConnected&&ne()&&(F.current=!0,ba(y,I.current),F.current=!1),_(!1)},Se=e.query.trim(),Ce=e.highlighted>=0&&e.highlighted<e.places.length?`${E}${e.highlighted}`:void 0,he=null;return e.places.length>0?he=e.places.map((i,y)=>(0,U.jsxs)("div",{id:`${E}${y}`,role:"option","aria-selected":y===e.highlighted,className:y===e.highlighted?`${ie.row} ${ie.highlighted}`:ie.row,"data-aia-location-row":"","data-aia-index":y,onClick:()=>{p&&(Z(!0),k(y))},children:[(0,U.jsx)("span",{className:ie.pin,children:ri}),(0,U.jsxs)("span",{className:ie.text,children:[(0,U.jsx)("span",{className:ie.name,children:i.name}),i.secondary&&(0,U.jsx)("span",{className:ie.secondary,children:i.secondary})]})]},i.id)):e.status==="loading"?he=(0,U.jsxs)("div",{className:ie.loading,"data-aia-location-loading":"",children:[(0,U.jsx)("span",{className:ie.loadingBar}),(0,U.jsx)("span",{className:ie.loadingBar}),(0,U.jsx)("span",{className:ie.loadingBar})]}):Se&&(he=(0,U.jsxs)("div",{className:ie.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,U.jsx)("span",{className:ie.empty,children:t}),(0,U.jsx)("span",{children:n})]})),(0,U.jsxs)("div",{ref:h,className:ie.location,"data-aia-location":"",onMouseDown:i=>{!(i.target instanceof Node)||!S.current?.contains(i.target)||(i.stopPropagation(),fe(),_(!0))},children:[(0,U.jsxs)("label",{ref:S,className:ie.field,children:[si,(0,U.jsx)("input",{ref:m,type:"text",className:ie.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":Ce,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:s?0:-1,onChange:i=>v(i.target.value),onFocus:i=>{pe(i.relatedTarget),_(!0)},onBlur:()=>{F.current||(N.current=!0,_(!1))},onKeyDown:i=>{if(!i.nativeEvent.isComposing)switch(i.key){case"ArrowDown":case"ArrowUp":i.preventDefault(),x(i.key==="ArrowDown"?1:-1);return;case"Enter":if(i.preventDefault(),!p)return;Z(!0),k();return;case"Escape":i.preventDefault(),i.stopPropagation(),N.current=!0,Z();return;case"Backspace":if(i.currentTarget.value!=="")return;i.preventDefault(),N.current=!0,Z();return}}})]}),(0,U.jsx)("div",{className:ie.results,"data-aia-location-results":"","aria-live":"polite",children:he})]})}var Bt=require("@magicx-eng/ai-autocomplete-vanilla");var xa=require("@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,
2336
2360
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
2337
2361
  The border is kept as a 1px transparent line so the box stays the same size
2338
2362
  as it was when the outline was dashed. */
@@ -2490,7 +2514,7 @@
2490
2514
  opacity: 0;
2491
2515
  }
2492
2516
  }
2493
- `,document.head.appendChild(e)}var Ue={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"};var st=require("react/jsx-runtime"),$t={selected:1,first:.7,next:.4,last:.2};function xa({label:e,state:a,active:t,rounded:n,loading:i,smartSuggestion:c,completionHeader:s,onClick:p}){let b=[Ue.pill,n?Ue.rounded:"",i?Ue.skeleton:""].filter(Boolean).join(" ");return(0,st.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":c?s?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:b,style:{"--aia-pill-opacity":$t[a]},onMouseDown:y=>y.preventDefault(),onClick:i?void 0:p,disabled:i,children:c?(0,st.jsxs)(st.Fragment,{children:[(0,st.jsx)("span",{className:`${Ue.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,st.jsx)("span",{className:`${Ue.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:va.SMART_SUGGESTION_SPARKLE_SVG}})]}):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 Ve={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"};var ct=require("react/jsx-runtime"),Zt={selected:1,first:.7,next:.4,last:.2};function ya({label:e,state:a,active:t,rounded:n,loading:o,smartSuggestion:l,completionHeader:s,onClick:p}){let v=[Ve.pill,n?Ve.rounded:"",o?Ve.skeleton:""].filter(Boolean).join(" ");return(0,ct.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":l?s?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:v,style:{"--aia-pill-opacity":Zt[a]},onMouseDown:x=>x.preventDefault(),onClick:o?void 0:p,disabled:o,children:l?(0,ct.jsxs)(ct.Fragment,{children:[(0,ct.jsx)("span",{className:`${Ve.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,ct.jsx)("span",{className:`${Ve.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:xa.SMART_SUGGESTION_SPARKLE_SVG}})]}):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 {
2494
2518
  position: relative;
2495
2519
  z-index: 1;
2496
2520
  pointer-events: auto;
@@ -2500,7 +2524,7 @@
2500
2524
  align-items: center;
2501
2525
  vertical-align: middle;
2502
2526
  }
2503
- `,document.head.appendChild(e)}var Zt={list:"aia-list-qvLqO"};var Ot=require("react/jsx-runtime"),ri=[125,69];function ya(e){return e===0?"first":e===1?"next":"last"}function Bt({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:n,rounded:i,loading:c}){return c&&e.length===0?(0,Ot.jsx)("span",{className:Zt.list,"data-aia-pill-list-loading":"",children:ri.map((s,p)=>(0,Ot.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ue.pill} ${i?Ue.rounded:""} ${Ue.skeleton}`,style:{width:s,"--aia-pill-opacity":$t[ya(p)]}},`skel-${s}`))}):(0,Ot.jsx)("span",{className:Zt.list,"data-aia-pill-list-loading":c?"":void 0,children:e.map((s,p)=>{let b=!!n&&p===a;return(0,Ot.jsx)(xa,{label:s.text,state:b?"selected":ya(p),selected:b,active:p===a,rounded:i,loading:c,smartSuggestion:(0,Ht.isSmartSuggestion)(s),completionHeader:(0,Ht.isTraditionalAutocompleteSuggestion)(s),onClick:()=>t(p)},`${s.parameter}-${s.text}`)})})}var Ee=require("@magicx-eng/ai-autocomplete-vanilla"),ve=require("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 Xt={list:"aia-list-qvLqO"};var zt=require("react/jsx-runtime"),li=[125,69];function ka(e){return e===0?"first":e===1?"next":"last"}function Wt({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:n,rounded:o,loading:l}){return l&&e.length===0?(0,zt.jsx)("span",{className:Xt.list,"data-aia-pill-list-loading":"",children:li.map((s,p)=>(0,zt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ve.pill} ${o?Ve.rounded:""} ${Ve.skeleton}`,style:{width:s,"--aia-pill-opacity":Zt[ka(p)]}},`skel-${s}`))}):(0,zt.jsx)("span",{className:Xt.list,"data-aia-pill-list-loading":l?"":void 0,children:e.map((s,p)=>{let v=!!n&&p===a;return(0,zt.jsx)(ya,{label:s.text,state:v?"selected":ka(p),selected:v,active:p===a,rounded:o,loading:l,smartSuggestion:(0,Bt.isSmartSuggestion)(s),completionHeader:(0,Bt.isTraditionalAutocompleteSuggestion)(s),onClick:()=>t(p)},`${s.parameter}-${s.text}`)})})}var ze=require("@magicx-eng/ai-autocomplete-vanilla"),xe=require("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
2504
2528
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
2505
2529
  theming one package sees the same result in the other.
2506
2530
 
@@ -3127,7 +3151,7 @@
3127
3151
  opacity: 0.01;
3128
3152
  }
3129
3153
  }
3130
- `,document.head.appendChild(e)}var oe={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"};var q=require("react/jsx-runtime");function ka({products:e,listboxId:a,onSelect:t,busyProductId:n=null,onAddToCart:i,onFocusChange:c,focusable:s=!0,loading:p=!1,layout:b="row",imageFallback:y="image",showVendor:k=!0,strings:g=(0,Ee.uiStringsFor)()}){let h=e.length>0,u=(0,ve.useRef)(null);if((0,ve.useEffect)(()=>{let C=u.current;if(!(!h||!C))return(0,Ee.attachProductRowWheel)(C)},[h]),!h)return null;let S=`${a}-products-label`;return(0,q.jsxs)("section",{className:oe.section,"data-aia-products":"","data-aia-loading":p?"":void 0,"data-aia-products-layout":b,role:"group","aria-labelledby":S,children:[(0,q.jsx)("div",{className:oe.label,id:S,"data-aia-products-label":"",children:g.products}),(0,q.jsx)("div",{ref:u,className:oe.row,"data-aia-products-row":"",children:e.map((C,I)=>(0,q.jsx)(si,{product:C,id:`${a}-product-${I}`,onSelect:t,busy:C.id===n,onAddToCart:i,onFocusChange:c,focusable:s,imageFallback:y,showVendor:k,soldOut:g.soldOut,addToCart:g.addToCart},C.id))})]})}function si({product:e,id:a,onSelect:t,busy:n,onAddToCart:i,onFocusChange:c,focusable:s,imageFallback:p,showVendor:b,soldOut:y,addToCart:k}){let g=!!i&&e.available!==!1,[h,u]=(0,ve.useState)(null),S=I=>{I.relatedTarget?.closest("[data-aia-dropdown]")||c?.(!1)},C=I=>{I.metaKey||I.ctrlKey||I.shiftKey||I.altKey||I.button!==0||(I.preventDefault(),t(e))};return(0,q.jsxs)("a",{id:a,className:oe.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":g?"":void 0,"data-aia-product-state":n?"busy":void 0,"aria-busy":n?!0:void 0,role:"option","aria-selected":!1,style:h?{"--aia-product-photo-fill-x":String(h.x),"--aia-product-photo-fill-y":String(h.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:C,onKeyDown:I=>{I.key!=="Enter"&&I.key!==" "||(I.preventDefault(),t(e))},onFocus:()=>c?.(!0),onBlur:S,children:[(0,q.jsx)(ci,{sources:(0,Ee.productImageSources)(e.imageUrl),title:e.title,fallback:p,onPhotoFill:u},(0,Ee.productImageSrc)(e.imageUrl)??""),(0,q.jsxs)("span",{className:oe.body,children:[b&&e.vendor?(0,q.jsx)("span",{className:oe.vendor,children:e.vendor}):null,(0,q.jsx)("span",{className:oe.title,children:e.title}),e.price?(0,q.jsxs)("span",{className:oe.price,children:[e.price,e.compareAtPrice?(0,q.jsx)("s",{className:oe.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,q.jsx)("span",{className:oe.badge,children:y}):null]}),g&&i?(0,q.jsx)(di,{product:e,label:`${k}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>c?.(!0),onBlur:S},li(e)):null]})}function li(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function di({product:e,label:a,focusable:t,onAddToCart:n,onFocus:i,onBlur:c}){let[s,p]=(0,ve.useState)(null),b=(0,ve.useRef)(null),y=(0,ve.useRef)(e);y.current=e;let k=(0,ve.useRef)(!0);(0,ve.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let g=u=>{b.current=u,k.current&&p(u)},h=u=>{if(u.preventDefault(),u.stopPropagation(),b.current==="adding")return;g("adding");let S;try{S=Promise.resolve(n(y.current))}catch(C){S=Promise.reject(C)}S.then(()=>g("added"),()=>g(null))};return(0,q.jsx)("span",{className:oe.cart,"data-aia-product-cart":"","data-aia-cart-state":s??void 0,"aria-busy":s==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:h,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||h(u)},onFocus:u=>{u.stopPropagation(),i()},onBlur:u=>{u.stopPropagation(),c(u)},children:(0,q.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,q.jsx)("path",{className:oe.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"}),(0,q.jsx)("path",{className:oe.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,q.jsx)("path",{className:oe.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,q.jsx)("path",{className:oe.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,q.jsx)("circle",{className:oe.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,q.jsx)("circle",{className:oe.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function ci({sources:e,title:a,fallback:t,onPhotoFill:n}){let[i,c]=(0,ve.useState)(0),s=e[i],p=!!s,[b,y]=(0,ve.useState)(null),k=!p&&t==="initial";return(0,ve.useEffect)(()=>()=>n(null),[n]),(0,q.jsxs)("span",{className:oe.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!p&&!k?"":void 0,"data-aia-product-initial":k?"":void 0,"data-aia-image-loaded":p&&b===s?"":void 0,children:[p?(0,q.jsx)("img",{className:oe.image,src:s,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{y(s),n((0,Ee.productPhotoFill)(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{i+1>=e.length&&n(null),c(g=>g+1)}}):null,k?(0,Ee.productInitial)(a):null]})}var W=require("@magicx-eng/ai-autocomplete-vanilla"),Re=require("react");var Sa=require("@magicx-eng/ai-autocomplete-vanilla"),Wt=require("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 oe={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"};var q=require("react/jsx-runtime");function Sa({products:e,listboxId:a,onSelect:t,busyProductId:n=null,onAddToCart:o,onFocusChange:l,focusable:s=!0,loading:p=!1,layout:v="row",imageFallback:x="image",showVendor:k=!0,strings:g=(0,ze.uiStringsFor)()}){let m=e.length>0,h=(0,xe.useRef)(null);if((0,xe.useEffect)(()=>{let C=h.current;if(!(!m||!C))return(0,ze.attachProductRowWheel)(C)},[m]),!m)return null;let S=`${a}-products-label`;return(0,q.jsxs)("section",{className:oe.section,"data-aia-products":"","data-aia-loading":p?"":void 0,"data-aia-products-layout":v,role:"group","aria-labelledby":S,children:[(0,q.jsx)("div",{className:oe.label,id:S,"data-aia-products-label":"",children:g.products}),(0,q.jsx)("div",{ref:h,className:oe.row,"data-aia-products-row":"",children:e.map((C,I)=>(0,q.jsx)(di,{product:C,id:`${a}-product-${I}`,onSelect:t,busy:C.id===n,onAddToCart:o,onFocusChange:l,focusable:s,imageFallback:x,showVendor:k,soldOut:g.soldOut,addToCart:g.addToCart},C.id))})]})}function di({product:e,id:a,onSelect:t,busy:n,onAddToCart:o,onFocusChange:l,focusable:s,imageFallback:p,showVendor:v,soldOut:x,addToCart:k}){let g=!!o&&e.available!==!1,[m,h]=(0,xe.useState)(null),S=I=>{I.relatedTarget?.closest("[data-aia-dropdown]")||l?.(!1)},C=I=>{I.metaKey||I.ctrlKey||I.shiftKey||I.altKey||I.button!==0||(I.preventDefault(),t(e))};return(0,q.jsxs)("a",{id:a,className:oe.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":g?"":void 0,"data-aia-product-state":n?"busy":void 0,"aria-busy":n?!0:void 0,role:"option","aria-selected":!1,style:m?{"--aia-product-photo-fill-x":String(m.x),"--aia-product-photo-fill-y":String(m.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:C,onKeyDown:I=>{I.key!=="Enter"&&I.key!==" "||(I.preventDefault(),t(e))},onFocus:()=>l?.(!0),onBlur:S,children:[(0,q.jsx)(hi,{sources:(0,ze.productImageSources)(e.imageUrl),title:e.title,fallback:p,onPhotoFill:h},(0,ze.productImageSrc)(e.imageUrl)??""),(0,q.jsxs)("span",{className:oe.body,children:[v&&e.vendor?(0,q.jsx)("span",{className:oe.vendor,children:e.vendor}):null,(0,q.jsx)("span",{className:oe.title,children:e.title}),e.price?(0,q.jsxs)("span",{className:oe.price,children:[e.price,e.compareAtPrice?(0,q.jsx)("s",{className:oe.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,q.jsx)("span",{className:oe.badge,children:x}):null]}),g&&o?(0,q.jsx)(pi,{product:e,label:`${k}: ${e.title}`,focusable:s,onAddToCart:o,onFocus:()=>l?.(!0),onBlur:S},ci(e)):null]})}function ci(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function pi({product:e,label:a,focusable:t,onAddToCart:n,onFocus:o,onBlur:l}){let[s,p]=(0,xe.useState)(null),v=(0,xe.useRef)(null),x=(0,xe.useRef)(e);x.current=e;let k=(0,xe.useRef)(!0);(0,xe.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let g=h=>{v.current=h,k.current&&p(h)},m=h=>{if(h.preventDefault(),h.stopPropagation(),v.current==="adding")return;g("adding");let S;try{S=Promise.resolve(n(x.current))}catch(C){S=Promise.reject(C)}S.then(()=>g("added"),()=>g(null))};return(0,q.jsx)("span",{className:oe.cart,"data-aia-product-cart":"","data-aia-cart-state":s??void 0,"aria-busy":s==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:m,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||m(h)},onFocus:h=>{h.stopPropagation(),o()},onBlur:h=>{h.stopPropagation(),l(h)},children:(0,q.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,q.jsx)("path",{className:oe.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"}),(0,q.jsx)("path",{className:oe.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,q.jsx)("path",{className:oe.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,q.jsx)("path",{className:oe.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,q.jsx)("circle",{className:oe.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,q.jsx)("circle",{className:oe.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function hi({sources:e,title:a,fallback:t,onPhotoFill:n}){let[o,l]=(0,xe.useState)(0),s=e[o],p=!!s,[v,x]=(0,xe.useState)(null),k=!p&&t==="initial";return(0,xe.useEffect)(()=>()=>n(null),[n]),(0,q.jsxs)("span",{className:oe.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!p&&!k?"":void 0,"data-aia-product-initial":k?"":void 0,"data-aia-image-loaded":p&&v===s?"":void 0,children:[p?(0,q.jsx)("img",{className:oe.image,src:s,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{x(s),n((0,ze.productPhotoFill)(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&n(null),l(g=>g+1)}}):null,k?(0,ze.productInitial)(a):null]})}var W=require("@magicx-eng/ai-autocomplete-vanilla"),Le=require("react");var Ca=require("@magicx-eng/ai-autocomplete-vanilla"),Gt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
3131
3155
  display: grid;
3132
3156
  grid-template-columns: repeat(
3133
3157
  auto-fit,
@@ -3171,7 +3195,7 @@
3171
3195
  :where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
3172
3196
  max-height: var(--aia-grid-max-height, 120px);
3173
3197
  }
3174
- `,document.head.appendChild(e)}var Ta=require("react/jsx-runtime");function Ca({min:e="16rem",max:a,gap:t,scroll:n=!1,maxHeight:i,scrollResetKey:c,cols:s,template:p,innerRef:b,className:y,children:k,...g}){let h=(0,Wt.useRef)(null);(0,Wt.useLayoutEffect)(()=>{if(c===void 0)return;let S=h.current;S&&(S.scrollTop=0)},[c]);let u={"--aia-grid-min":e};return a&&(u["--aia-grid-max"]=a),t&&(u["--aia-grid-gap"]=t),i&&(u["--aia-grid-max-height"]=i),s&&(u.gridTemplateColumns=(0,Sa.optionsGridTemplateColumns)(s)),p&&(u.gridTemplateColumns=p),(0,Ta.jsx)("div",{ref:S=>{h.current=S,b?.(S)},className:y?`aia-grid ${y}`:"aia-grid","data-scroll":n||void 0,style:u,...g,children:k})}var ce=require("@magicx-eng/ai-autocomplete-vanilla"),xe=require("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)}var Pa=require("react/jsx-runtime");function Ta({min:e="16rem",max:a,gap:t,scroll:n=!1,maxHeight:o,scrollResetKey:l,cols:s,template:p,innerRef:v,className:x,children:k,...g}){let m=(0,Gt.useRef)(null);(0,Gt.useLayoutEffect)(()=>{if(l===void 0)return;let S=m.current;S&&(S.scrollTop=0)},[l]);let h={"--aia-grid-min":e};return a&&(h["--aia-grid-max"]=a),t&&(h["--aia-grid-gap"]=t),o&&(h["--aia-grid-max-height"]=o),s&&(h.gridTemplateColumns=(0,Ca.optionsGridTemplateColumns)(s)),p&&(h.gridTemplateColumns=p),(0,Pa.jsx)("div",{ref:S=>{m.current=S,v?.(S)},className:x?`aia-grid ${x}`:"aia-grid","data-scroll":n||void 0,style:h,...g,children:k})}var ce=require("@magicx-eng/ai-autocomplete-vanilla"),ye=require("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 {
3175
3199
  position: relative;
3176
3200
  /* Clip, not visible: the entrance rise below runs on the inner content,
3177
3201
  and a transformed box extends its scroll container's scrollable area.
@@ -3734,7 +3758,7 @@
3734
3758
  height: 18px;
3735
3759
  border-radius: 6px;
3736
3760
  }
3737
- `,document.head.appendChild(e)}var le={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"};var de=require("react/jsx-runtime"),pi=2e3,hi=170;function Pa({option:e,isHighlighted:a,checked:t,onSelect:n,onHighlight:i,onUnhighlight:c,id:s,loading:p,showIcon:b=!0,showImage:y=!0,showCount:k=!0,scrollHint:g,enterDelayMs:h=0}){let[u]=(0,xe.useState)(h),[S,C]=(0,xe.useState)(!1),I=y?(0,ce.optionImageSources)(e.image_url):[],F=I[0]??null,[N,ne]=(0,xe.useState)([]),K=I.find(o=>!N.includes(o))??null,R=y?(e.imageCollage??[]).map(o=>(0,ce.optionImageSources)(o)[0]).filter(o=>o!==void 0):[],[H,_]=(0,xe.useState)(!1),[$,ke]=(0,xe.useState)(null),Z=(0,xe.useMemo)(()=>!F&&b&&e.icon_svg?(0,ce.sanitizeOptionIconSvg)(e.icon_svg):null,[F,b,e.icon_svg]),A=k?(0,ce.formatOptionCount)(e.item_count):null,re=(0,xe.useRef)(void 0),X=(0,xe.useRef)(null),Se=(0,xe.useRef)(Number.NEGATIVE_INFINITY);(0,xe.useEffect)(()=>()=>clearTimeout(re.current),[]);let Ce=o=>{if(p||!e.is_tappable)return;let x=o?.currentTarget,me=t!==void 0&&x!==void 0&&o!==void 0&&!(0,ce.isMultiSelectToggleTap)(x,x.querySelector("[data-aia-checkbox]"),o),Oe=t!==void 0&&!me;if(!Oe){let be=performance.now();if(be-Se.current<hi)return;Se.current=be}me?n(e,{commit:!0}):n(e),!Oe&&(C(!0),clearTimeout(re.current),re.current=setTimeout(()=>{C(!1),(0,ce.clearPanelMorphPressLook)(X.current?.closest("[data-aia-dropdown]"))},pi))},he=[le.item,a&&!p?le.highlighted:"",e.liveMatch&&!p?le.liveMatch:"",e.is_tappable?le.tappable:le.nonTappable,S?le.pressed:"",g?le.scrollHint:""].filter(Boolean).join(" ");return(0,de.jsx)("div",{ref:X,id:s,role:"option","data-aia-option":"","data-aia-loading":p?"":void 0,"data-aia-icon":Z&&e.icon?e.icon:void 0,"data-aia-image":F?"":void 0,"data-aia-item-count":A!==null?e.item_count:void 0,"aria-selected":t??a,className:he,style:{[ce.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:p||!e.is_tappable?-1:0,onClick:Ce,onKeyDown:o=>{!p&&e.is_tappable&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),Ce())},onMouseEnter:!p&&e.is_tappable?i:void 0,onMouseLeave:c,children:(0,de.jsxs)("span",{className:le.content,children:[t!==void 0&&e.is_tappable&&(0,de.jsx)("span",{className:le.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t}),F&&R.length>1&&(0,de.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":R.length,"data-aia-image-loaded":H?"":void 0,children:R.map(o=>(0,de.jsx)("img",{src:o,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>_(!0),onError:x=>{x.currentTarget.hidden=!0}},o))}),F&&R.length<=1&&(0,de.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":K!==null&&$===K?"":void 0,children:(0,de.jsx)("img",{src:K??F,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:K===null,onLoad:()=>ke(K),onError:()=>{K!==null&&ne(o=>[...o,K])}})}),Z&&(0,de.jsx)("span",{className:`${le.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:Z}}),(0,de.jsxs)("span",{className:le.text,children:[e.matchedText?(0,ce.highlightParts)((0,ce.optionLabel)(e),e.matchedText).map((o,x)=>o.bold?(0,de.jsx)("strong",{className:`${le.match} magicx-aia-option-match`,"data-aia-match-partial":o.partial?"":void 0,children:o.text},x):o.text):(0,ce.optionLabel)(e),e.parameterLabel&&(0,de.jsxs)(de.Fragment,{children:[" ",(0,de.jsx)("span",{className:`${le.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,de.jsx)("span",{className:le.tag,children:e.tag}),A!==null&&(0,de.jsx)("span",{className:`${le.count} magicx-aia-option-count`,children:A})]})})}var Xt=require("react/jsx-runtime");function ui(){let[e,a]=(0,Re.useState)(W.isOptionsGridMobileViewport);return(0,Re.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(W.OPTIONS_GRID_MOBILE_QUERY),n=()=>a(t.matches);return n(),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e}function Ia({options:e,activeIndex:a,picked:t,onSelect:n,onHighlight:i,onUnhighlight:c,listboxId:s,loading:p,groupKey:b="",optionsPosition:y="below",showIcons:k=!0,showImages:g=!0,showCounts:h=!0}){let u=ui(),S=(0,Re.useRef)(null),[C,I]=(0,Re.useState)(null),F=(0,Re.useRef)(null);(0,Re.useLayoutEffect)(()=>{if(p&&(0,W.sameOptionRows)(F.current,e))return;F.current=p?null:e;let R=S.current,H=R&&!p&&(0,W.needsOptionsGridMeasurement)(e.length,u),_=R?.closest("[data-aia-dropdown]");H&&_&&(0,W.releasePanelHug)(_);let $=H?(0,W.measureOptionsGrid)(R):null;I($?(0,W.planOptionsGrid)(e.length,u,$.rowWidths,$.gridWidth):null)},[e,u,p]);let N=C??(0,W.planOptionsGrid)(e.length,u,null,null);(0,Re.useLayoutEffect)(()=>{let R=S.current?.closest("[data-aia-dropdown]");R&&(0,W.syncPanelHug)(R)},[N.template,u]);let ne=p?-1:a;(0,Re.useLayoutEffect)(()=>{S.current&&(0,W.syncHighlightScroll)(S.current,ne)},[ne]);let K=(0,W.optionsShowLeadingVisuals)(e,k,g);return(0,Xt.jsx)(Ca,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:b,template:N.template,maxHeight:N.maxHeight,innerRef:R=>{S.current=R},"data-aia-group":b,children:e.map((R,H)=>(0,Xt.jsx)(Pa,{option:R,isHighlighted:H===a,checked:t?t.includes(R.text):void 0,onSelect:n,onHighlight:_=>{(0,W.pointerMayHighlight)(S.current,H,_)&&i(H)},onUnhighlight:c?_=>{(0,W.pointerMayHighlight)(S.current,-1,_)&&c(H)}:void 0,id:`${s}-option-${H}`,loading:p,showIcon:k&&K,showImage:g&&K,showCount:h,scrollHint:!p&&N.scrollHintIndices.includes(H),enterDelayMs:p?0:(0,W.optionEnterDelayMs)(H,N.cols,e.length,y)},`${b}\0${R.parameter??""}\0${R.text}`))})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),Be=require("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 le={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"};var de=require("react/jsx-runtime"),ui=2e3,mi=170;function Ia({option:e,isHighlighted:a,checked:t,onSelect:n,onHighlight:o,onUnhighlight:l,id:s,loading:p,showIcon:v=!0,showImage:x=!0,showCount:k=!0,scrollHint:g,enterDelayMs:m=0}){let[h]=(0,ye.useState)(m),[S,C]=(0,ye.useState)(!1),I=x?(0,ce.optionImageSources)(e.image_url):[],F=I[0]??null,[N,re]=(0,ye.useState)([]),K=I.find(i=>!N.includes(i))??null,R=x?(e.imageCollage??[]).map(i=>(0,ce.optionImageSources)(i)[0]).filter(i=>i!==void 0):[],[H,_]=(0,ye.useState)(!1),[ne,fe]=(0,ye.useState)(null),pe=(0,ye.useMemo)(()=>!F&&v&&e.icon_svg?(0,ce.sanitizeOptionIconSvg)(e.icon_svg):null,[F,v,e.icon_svg]),$=k?(0,ce.formatOptionCount)(e.item_count):null,E=(0,ye.useRef)(void 0),Z=(0,ye.useRef)(null),Se=(0,ye.useRef)(Number.NEGATIVE_INFINITY);(0,ye.useEffect)(()=>()=>clearTimeout(E.current),[]);let Ce=i=>{if(p||!e.is_tappable)return;let y=i?.currentTarget,ue=t!==void 0&&y!==void 0&&i!==void 0&&!(0,ce.isMultiSelectToggleTap)(y,y.querySelector("[data-aia-checkbox]"),i),me=t!==void 0&&!ue;if(!me){let we=performance.now();if(we-Se.current<mi)return;Se.current=we}ue?n(e,{commit:!0}):n(e),!me&&(C(!0),clearTimeout(E.current),E.current=setTimeout(()=>{C(!1),(0,ce.clearPanelMorphPressLook)(Z.current?.closest("[data-aia-dropdown]"))},ui))},he=[le.item,a&&!p?le.highlighted:"",e.liveMatch&&!p?le.liveMatch:"",e.is_tappable?le.tappable:le.nonTappable,S?le.pressed:"",g?le.scrollHint:""].filter(Boolean).join(" ");return(0,de.jsx)("div",{ref:Z,id:s,role:"option","data-aia-option":"","data-aia-loading":p?"":void 0,"data-aia-icon":pe&&e.icon?e.icon:void 0,"data-aia-image":F?"":void 0,"data-aia-item-count":$!==null?e.item_count:void 0,"aria-selected":t??a,className:he,style:{[ce.OPTION_ENTER_DELAY_VAR]:`${h}ms`},tabIndex:p||!e.is_tappable?-1:0,onClick:Ce,onKeyDown:i=>{!p&&e.is_tappable&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),Ce())},onMouseEnter:!p&&e.is_tappable?o:void 0,onMouseLeave:l,children:(0,de.jsxs)("span",{className:le.content,children:[t!==void 0&&e.is_tappable&&(0,de.jsx)("span",{className:le.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t}),F&&R.length>1&&(0,de.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":R.length,"data-aia-image-loaded":H?"":void 0,children:R.map(i=>(0,de.jsx)("img",{src:i,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>_(!0),onError:y=>{y.currentTarget.hidden=!0}},i))}),F&&R.length<=1&&(0,de.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":K!==null&&ne===K?"":void 0,children:(0,de.jsx)("img",{src:K??F,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:K===null,onLoad:()=>fe(K),onError:()=>{K!==null&&re(i=>[...i,K])}})}),pe&&(0,de.jsx)("span",{className:`${le.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:pe}}),(0,de.jsxs)("span",{className:le.text,children:[e.matchedText?(0,ce.highlightParts)((0,ce.optionLabel)(e),e.matchedText).map((i,y)=>i.bold?(0,de.jsx)("strong",{className:`${le.match} magicx-aia-option-match`,"data-aia-match-partial":i.partial?"":void 0,children:i.text},y):i.text):(0,ce.optionLabel)(e),e.parameterLabel&&(0,de.jsxs)(de.Fragment,{children:[" ",(0,de.jsx)("span",{className:`${le.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,de.jsx)("span",{className:le.tag,children:e.tag}),$!==null&&(0,de.jsx)("span",{className:`${le.count} magicx-aia-option-count`,children:$})]})})}var Jt=require("react/jsx-runtime");function gi(){let[e,a]=(0,Le.useState)(W.isOptionsGridMobileViewport);return(0,Le.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(W.OPTIONS_GRID_MOBILE_QUERY),n=()=>a(t.matches);return n(),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e}function Aa({options:e,activeIndex:a,picked:t,onSelect:n,onHighlight:o,onUnhighlight:l,listboxId:s,loading:p,groupKey:v="",optionsPosition:x="below",showIcons:k=!0,showImages:g=!0,showCounts:m=!0}){let h=gi(),S=(0,Le.useRef)(null),[C,I]=(0,Le.useState)(null),F=(0,Le.useRef)(null);(0,Le.useLayoutEffect)(()=>{if(p&&(0,W.sameOptionRows)(F.current,e))return;F.current=p?null:e;let R=S.current,H=R&&!p&&(0,W.needsOptionsGridMeasurement)(e.length,h),_=R?.closest("[data-aia-dropdown]");H&&_&&(0,W.releasePanelHug)(_);let ne=H?(0,W.measureOptionsGrid)(R):null;I(ne?(0,W.planOptionsGrid)(e.length,h,ne.rowWidths,ne.gridWidth):null)},[e,h,p]);let N=C??(0,W.planOptionsGrid)(e.length,h,null,null);(0,Le.useLayoutEffect)(()=>{let R=S.current?.closest("[data-aia-dropdown]");R&&(0,W.syncPanelHug)(R)},[N.template,h]);let re=p?-1:a;(0,Le.useLayoutEffect)(()=>{S.current&&(0,W.syncHighlightScroll)(S.current,re)},[re]);let K=(0,W.optionsShowLeadingVisuals)(e,k,g);return(0,Jt.jsx)(Ta,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:v,template:N.template,maxHeight:N.maxHeight,innerRef:R=>{S.current=R},"data-aia-group":v,children:e.map((R,H)=>(0,Jt.jsx)(Ia,{option:R,isHighlighted:H===a,checked:t?t.includes(R.text):void 0,onSelect:n,onHighlight:_=>{(0,W.pointerMayHighlight)(S.current,H,_)&&o(H)},onUnhighlight:l?_=>{(0,W.pointerMayHighlight)(S.current,-1,_)&&l(H)}:void 0,id:`${s}-option-${H}`,loading:p,showIcon:k&&K,showImage:g&&K,showCount:m,scrollHint:!p&&N.scrollHintIndices.includes(H),enterDelayMs:p?0:(0,W.optionEnterDelayMs)(H,N.cols,e.length,x)},`${v}\0${R.parameter??""}\0${R.text}`))})}var ge=require("@magicx-eng/ai-autocomplete-vanilla"),We=require("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) ---
3738
3762
 
3739
3763
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3740
3764
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3856,7 +3880,7 @@
3856
3880
  .aia-done-llNY5:hover {
3857
3881
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3858
3882
  }
3859
- `,document.head.appendChild(e)}var He={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"};var ze=require("react/jsx-runtime"),mi=120;function Aa({view:e,label:a,doneLabel:t,interactive:n=!0,onTimeChange:i,onTimeCommit:c}){return(0,ze.jsxs)("div",{className:He.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:s=>s.preventDefault(),children:[(0,ze.jsx)("span",{className:He.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ue.formatTime)(e.minutes)}),(0,ze.jsxs)("div",{className:He.columns,"aria-hidden":"true",children:[(0,ze.jsx)("div",{className:He.band}),ue.TIME_WHEEL_COLUMNS.map(s=>(0,ze.jsxs)(Be.Fragment,{children:[s==="minute"&&(0,ze.jsx)("span",{className:He.separator,children:":"}),(0,ze.jsx)(gi,{column:s,minutes:e.minutes,interactive:n,onTimeChange:i})]},s))]}),(0,ze.jsx)("button",{type:"button",tabIndex:-1,className:He.done,"data-aia-time-done":"",onClick:()=>{n&&c()},children:t})]})}function gi({column:e,minutes:a,interactive:t,onTimeChange:n}){let i=(0,Be.useRef)(null),c=(0,Be.useRef)(null),s=(0,Be.useRef)(null),p=(0,Be.useRef)({minutes:a,interactive:t,onTimeChange:n});p.current={minutes:a,interactive:t,onTimeChange:n};let b=(0,ue.timeWheelIndex)(e,a);(0,Be.useLayoutEffect)(()=>{let g=i.current;if(!g||s.current)return;let h=b*ue.TIME_WHEEL_ROW_HEIGHT;Math.abs(g.scrollTop-h)<1||(c.current=h,g.scrollTop=h)},[b]),(0,Be.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let y=()=>{s.current=null;let g=i.current,h=p.current;if(!g||!h.interactive)return;let u=(0,ue.timeWheelIndexFromScroll)(e,g.scrollTop);u!==(0,ue.timeWheelIndex)(e,h.minutes)&&h.onTimeChange((0,ue.withTimeWheelIndex)(e,h.minutes,u))},k=()=>{let g=i.current;if(g){if(c.current!=null&&Math.abs(g.scrollTop-c.current)<1){c.current=null;return}c.current=null,s.current&&clearTimeout(s.current),s.current=setTimeout(y,mi)}};return(0,ze.jsx)("div",{ref:i,className:He.column,"data-aia-time-column":e,onScroll:k,children:(0,ue.timeWheelRows)(e).map((g,h)=>(0,ze.jsx)("div",{className:h===b?`${He.row} ${He.selected}`:He.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{p.current.interactive&&n((0,ue.withTimeWheelIndex)(e,p.current.minutes,h))},children:g.label},g.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3883
+ `,document.head.appendChild(e)}var Be={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"};var Oe=require("react/jsx-runtime"),fi=120;function Ea({view:e,label:a,doneLabel:t,interactive:n=!0,onTimeChange:o,onTimeCommit:l}){return(0,Oe.jsxs)("div",{className:Be.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:s=>s.preventDefault(),children:[(0,Oe.jsx)("span",{className:Be.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ge.formatTime)(e.minutes)}),(0,Oe.jsxs)("div",{className:Be.columns,"aria-hidden":"true",children:[(0,Oe.jsx)("div",{className:Be.band}),ge.TIME_WHEEL_COLUMNS.map(s=>(0,Oe.jsxs)(We.Fragment,{children:[s==="minute"&&(0,Oe.jsx)("span",{className:Be.separator,children:":"}),(0,Oe.jsx)(bi,{column:s,minutes:e.minutes,interactive:n,onTimeChange:o})]},s))]}),(0,Oe.jsx)("button",{type:"button",tabIndex:-1,className:Be.done,"data-aia-time-done":"",onClick:()=>{n&&l()},children:t})]})}function bi({column:e,minutes:a,interactive:t,onTimeChange:n}){let o=(0,We.useRef)(null),l=(0,We.useRef)(null),s=(0,We.useRef)(null),p=(0,We.useRef)({minutes:a,interactive:t,onTimeChange:n});p.current={minutes:a,interactive:t,onTimeChange:n};let v=(0,ge.timeWheelIndex)(e,a);(0,We.useLayoutEffect)(()=>{let g=o.current;if(!g||s.current)return;let m=v*ge.TIME_WHEEL_ROW_HEIGHT;Math.abs(g.scrollTop-m)<1||(l.current=m,g.scrollTop=m)},[v]),(0,We.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let x=()=>{s.current=null;let g=o.current,m=p.current;if(!g||!m.interactive)return;let h=(0,ge.timeWheelIndexFromScroll)(e,g.scrollTop);h!==(0,ge.timeWheelIndex)(e,m.minutes)&&m.onTimeChange((0,ge.withTimeWheelIndex)(e,m.minutes,h))},k=()=>{let g=o.current;if(g){if(l.current!=null&&Math.abs(g.scrollTop-l.current)<1){l.current=null;return}l.current=null,s.current&&clearTimeout(s.current),s.current=setTimeout(x,fi)}};return(0,Oe.jsx)("div",{ref:o,className:Be.column,"data-aia-time-column":e,onScroll:k,children:(0,ge.timeWheelRows)(e).map((g,m)=>(0,Oe.jsx)("div",{className:m===v?`${Be.row} ${Be.selected}`:Be.row,"data-aia-time-row":"","data-aia-index":m,onClick:()=>{p.current.interactive&&n((0,ge.withTimeWheelIndex)(e,p.current.minutes,m))},children:g.label},g.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3860
3884
  display: flex;
3861
3885
  flex-direction: column;
3862
3886
  gap: var(--aia-stack-space, 0.5rem);
@@ -3871,7 +3895,7 @@
3871
3895
  align-items: end;
3872
3896
  }
3873
3897
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3874
- `,document.head.appendChild(e)}var Ra=require("react/jsx-runtime");function Ea({space:e,align:a="stretch",className:t,children:n,...i}){let c=e?{"--aia-stack-space":e}:void 0;return(0,Ra.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:c,...i,children:n})}var Y=require("react/jsx-runtime"),fi=typeof window>"u"?ee.useEffect:ee.useLayoutEffect,bi=[159,119,164],wi=()=>{},za=()=>{},vi=e=>{},xi=()=>{},yi=e=>{},ki=e=>{},Si=e=>{},Ci=e=>{};function Ti(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=(0,ee.useState)(a);if((0,ee.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let i=window.matchMedia("(prefers-color-scheme: dark)"),c=()=>n(i.matches);return i.addEventListener("change",c),()=>i.removeEventListener("change",c)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Pi(e,a){let t=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let n=e.current,i=a.current;if(!n||!i)return;let c=(0,M.queryLive)(n,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==c&&(t.current.controller.destroy(),t.current=null),c&&!t.current){t.current={grid:c,controller:(0,M.attachScrollArrow)({dropdown:n,grid:c,button:i})};return}t.current?.controller.update()}),(0,ee.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ii(e,a){let t=(0,ee.useRef)(a);t.current=a;let n=(0,ee.useRef)(null);(0,ee.useLayoutEffect)(()=>{let i=e.current;if(i){if(!n.current){n.current=(0,M.attachViewportFit)({dropdown:i,isOpen:()=>t.current});return}n.current.update()}}),(0,ee.useEffect)(()=>()=>{n.current?.destroy(),n.current=null},[])}function Gt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:n,onUnhighlight:i,isOpen:c,id:s,className:p,pills:b,onPillClick:y,showPills:k=!0,onSkip:g,showSkipButton:h=!0,showOptionIcons:u=!0,showOptionImages:S=!0,showOptionCounts:C=!0,skipDisabled:I=!1,activeSelected:F=!1,isLoading:N=!1,skeletonExiting:ne=!1,isInputEmpty:K=!1,language:R,products:H,onProductSelect:_,onProductAddToCart:$,onProductFocusChange:ke,productsLayout:Z="row",productImageFallback:A="image",showProductVendor:re=!0,formatType:X="options",dateView:Se=null,selectedDateIso:Ce=null,selectedDateRange:he=null,dateRangeStart:o=null,dateReferences:x,onPreviousMonth:me,onNextMonth:Oe,timeView:be=null,multiSelectView:lt=null,onMultiSelectCommit:Qe,onSeeAllResults:Ye,seeAllBusy:De=!1,busyProductId:dt=null,fullWidth:at=!1,onTimeChange:m,onTimeCommit:ct,locationView:f=null,isReediting:T=!1,onLocationQuery:z,onLocationMove:O,onLocationCommit:B,onLocationFocusChange:pe,isFocused:Ge=!1,optionsPosition:ge="below",mode:Ke}){let je=Ti(Ke),pt=je!==void 0,fe=(0,ee.useRef)(null),$e=(0,ee.useRef)(null);Pi(fe,$e),(0,ee.useEffect)(()=>{if(fe.current)return(0,M.containScroll)(fe.current)},[]);let Me=e[0]?.options??[],ht=!!(b&&b.length>0&&y),Pe=!!(H&&H.length>0),it=X==="time"&&be!=null,vt=X==="location"&&f!=null,Te=c&&(Me.length>0||k&&ht||N||Pe||it||vt);Ii(fe,Te),fi(()=>{let E=fe.current;E&&((0,M.fitMultiSelectDone)(E,(0,M.findMultiSelectDone)(E)),(0,M.syncPanelHug)(E))});let Ie={suggestions:e,activeIndex:a,pills:b,showPills:k,showSkipButton:h,showOptionIcons:u,showOptionImages:S,showOptionCounts:C,skipDisabled:I,activeSelected:F,isLoading:N,skeletonExiting:ne,isInputEmpty:K,products:H,formatType:X,dateView:Se,selectedDateIso:Ce,selectedDateRange:he,dateRangeStart:o,dateReferences:x,timeView:be,multiSelectView:lt,locationView:f,isReediting:T,showsSeeAll:!!Ye},ot=(0,ee.useRef)(Ie);Te&&(ot.current=Ie);let r=Te?Ie:ot.current,Q=(0,M.uiStringsFor)(R),Ne=r.suggestions[0],qe=Ne?.options??[],ut=r.activeIndex>=0&&!!qe[r.activeIndex]?.is_tappable,_e=(0,M.labelTraditionalAutocomplete)(r.pills??[],Q.keepTyping),Ze=!!(_e.length>0&&y),v=r.showPills&&Ze,mt=r.showPills&&!Ze&&r.isLoading,xt=v||mt,Xe=Ze&&(0,M.hasSkippablePill)(_e)&&r.showSkipButton&&!r.isInputEmpty&&!!g,w=_e[0]?.text,gt=(0,M.isCalendarFormat)(r.formatType)&&r.dateView!=null,yt=qe.length>0&&!gt,Je=qe.length>0&&gt&&!r.isLoading,kt=r.formatType==="time"&&r.timeView!=null&&!r.isLoading,St=r.formatType==="location"&&r.locationView!=null&&!r.isLoading,nt=r.isLoading&&!yt&&!Je&&!kt&&!St,Ct=r.products??[],et=(0,M.panelMorphKey)(v?_e:[]);return(0,ee.useLayoutEffect)(()=>{fe.current&&(0,M.settlePanelMorph)(fe.current,et,{visible:Te,anchorBottom:ge==="above"})},[et,Te,ge,r.suggestions,r.pills,r.isLoading,r.skeletonExiting,r.isInputEmpty,r.products,r.formatType,r.dateView,r.selectedDateIso,r.selectedDateRange,r.dateRangeStart,r.dateReferences,r.timeView,r.multiSelectView,r.locationView,r.showPills,r.showSkipButton,r.showOptionIcons,r.showOptionImages,r.showOptionCounts,r.showsSeeAll,Z,R]),(0,ee.useEffect)(()=>{let E=fe.current;return()=>{E&&(0,M.destroyPanelMorph)(E)}},[]),(0,Y.jsxs)("div",{ref:fe,id:s,role:"listbox","aria-multiselectable":!!r.multiSelectView,"data-aia-dropdown":"","data-options-position":ge,"data-mode":je,"data-aia-loading":r.isLoading?"":void 0,"data-aia-skeleton-exiting":r.skeletonExiting?"":void 0,"data-aia-has-products":Ct.length>0?"":void 0,"data-aia-full-width":at?"":void 0,className:`${pt?"magicx-aia ":""}${Ae.dropdown} ${Te?Ae.visible:""} ${p??""}`,onMouseDown:E=>E.preventDefault(),children:[(0,Y.jsxs)(Ea,{space:"8px",children:[(xt||Xe)&&(0,Y.jsxs)(zt,{noWrap:!0,className:Ae.pillBar,"data-aia-pillbar":"",children:[xt&&(0,Y.jsx)("span",{className:Ae.pillScroll,"data-aia-pill-scroll":"",children:(0,Y.jsx)(Bt,{pills:_e,activePillIndex:0,activeSelected:r.activeSelected,onSelectPill:y??(()=>{}),rounded:!0,loading:r.isLoading})}),Xe&&(0,Y.jsx)("button",{type:"button",tabIndex:-1,className:Ae.skip,"data-aia-skip":"",disabled:r.isLoading||r.skipDisabled,"aria-label":w?`${Q.skipLabel} ${w}`:Q.skipLabel,onClick:g,children:Q.skip})]}),yt&&(0,Y.jsx)(Ia,{options:qe,activeIndex:r.activeIndex,onSelect:t,onHighlight:n,onUnhighlight:i,listboxId:s,loading:r.isLoading,groupKey:Ne?`${Ne.parameter} ${Ne.text}`:"",optionsPosition:ge,showIcons:r.showOptionIcons,showImages:r.showOptionImages,showCounts:r.showOptionCounts,picked:r.multiSelectView?.picked}),r.multiSelectView&&(0,Y.jsx)("div",{"data-aia-multi-actions":"",onClick:E=>{E.target.closest("[data-aia-multi-done]")&&!r.skipDisabled&&!r.isLoading&&Qe?.()},children:(0,Y.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Ae.multiDone,ref:E=>{E&&(E.disabled=!0,E.offsetHeight,E.disabled=r.skipDisabled||r.isLoading)},children:Q.done})}),Je&&r.dateView&&(0,Y.jsx)(ua,{options:qe,activeIndex:r.activeIndex,listboxId:s,view:r.dateView,selection:{selectedIso:r.selectedDateIso??null,selectedRange:r.selectedDateRange??null,rangeStart:r.dateRangeStart??null,floor:(0,M.dateFloorFor)(r.formatType,r.dateRangeStart),references:r.dateReferences??[]},onSelect:t,onHighlight:n,onUnhighlight:i,onPreviousMonth:me??za,onNextMonth:Oe??za}),kt&&r.timeView&&(0,Y.jsx)(Aa,{view:r.timeView,label:Q.timeLabel,doneLabel:Q.done,interactive:!r.skipDisabled,onTimeChange:m??vi,onTimeCommit:ct??xi}),St&&r.locationView&&(0,Y.jsx)(wa,{view:r.locationView,searchLabel:Q.locationSearch,noResultsLabel:Q.locationNoResults,useTypedLabel:Q.locationUseTyped,widgetFocused:Ge&&Te,reediting:r.isReediting,visible:Te,interactive:!r.skipDisabled,onQuery:z??yi,onMove:O??ki,onCommit:B??Si,onFocusChange:pe??Ci}),nt&&(0,Y.jsx)("div",{className:Ae.skeletonBars,"data-aia-skeleton-bars":"",children:bi.map(E=>(0,Y.jsx)("span",{className:Ae.skeletonBar,style:{width:E}},`bar-${E}`))}),(0,Y.jsx)(ka,{products:Ct,listboxId:s,onSelect:_??wi,busyProductId:dt,onAddToCart:$,onFocusChange:ke,focusable:Te&&!r.isLoading,loading:r.isLoading,layout:Z,imageFallback:A,showVendor:re,strings:Q}),r.showsSeeAll&&(0,Y.jsx)("div",{className:Ae.seeAllRow,"data-aia-see-all":"",onClick:E=>{E.target.closest("[data-aia-see-all-button]")&&(E.stopPropagation(),!(r.isLoading||De)&&Ye?.())},children:(0,Y.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":De?"busy":void 0,"aria-busy":De?!0:void 0,className:Ae.seeAll,ref:E=>{E&&(E.disabled=!0,E.offsetHeight,E.disabled=r.isLoading)},children:Q.seeAllResults})}),(0,Y.jsx)(ma,{isOptionHighlighted:ut,isInputEmpty:r.isInputEmpty,strings:Q})]}),(0,Y.jsx)("button",{ref:$e,type:"button",tabIndex:-1,className:Ae.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Q.scrollArrow,"aria-hidden":"true",children:(0,Y.jsx)("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:(0,Y.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Le=require("@magicx-eng/ai-autocomplete-vanilla");var Oa=require("@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)}var za=require("react/jsx-runtime");function Ra({space:e,align:a="stretch",className:t,children:n,...o}){let l=e?{"--aia-stack-space":e}:void 0;return(0,za.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:l,...o,children:n})}var j=require("react/jsx-runtime"),wi=typeof window>"u"?te.useEffect:te.useLayoutEffect,vi=[159,119,164],xi=()=>{},La=()=>{},yi=e=>{},ki=()=>{},Si=e=>{},Ci=e=>{},Ti=e=>{},Pi=e=>{};function Ii(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=(0,te.useState)(a);if((0,te.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>n(o.matches);return o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Ai(e,a){let t=(0,te.useRef)(null);(0,te.useEffect)(()=>{let n=e.current,o=a.current;if(!n||!o)return;let l=(0,M.queryLive)(n,".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:(0,M.attachScrollArrow)({dropdown:n,grid:l,button:o})};return}t.current?.controller.update()}),(0,te.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ei(e,a){let t=(0,te.useRef)(a);t.current=a;let n=(0,te.useRef)(null);(0,te.useLayoutEffect)(()=>{let o=e.current;if(o){if(!n.current){n.current=(0,M.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}n.current.update()}}),(0,te.useEffect)(()=>()=>{n.current?.destroy(),n.current=null},[])}function Kt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:n,onUnhighlight:o,isOpen:l,id:s,className:p,pills:v,onPillClick:x,showPills:k=!0,onSkip:g,showSkipButton:m=!0,showOptionIcons:h=!0,showOptionImages:S=!0,showOptionCounts:C=!0,skipDisabled:I=!1,activeSelected:F=!1,isLoading:N=!1,skeletonExiting:re=!1,isInputEmpty:K=!1,language:R,products:H,onProductSelect:_,onProductAddToCart:ne,onProductFocusChange:fe,productsLayout:pe="row",productImageFallback:$="image",showProductVendor:E=!0,formatType:Z="options",dateView:Se=null,selectedDateIso:Ce=null,selectedDateRange:he=null,dateRangeStart:i=null,dateReferences:y,onPreviousMonth:ue,onNextMonth:me,timeView:we=null,multiSelectView:pt=null,onMultiSelectCommit:Ue,onSeeAllResults:Qe,seeAllBusy:Me=!1,busyProductId:ht=null,fullWidth:tt=!1,onTimeChange:u,onTimeCommit:ut,locationView:Ye=null,isReediting:at=!1,onLocationQuery:b,onLocationMove:T,onLocationCommit:z,onLocationFocusChange:D,isFocused:B=!1,optionsPosition:X="below",mode:Ie}){let Te=Ii(Ie),je=Te!==void 0,be=(0,te.useRef)(null),$e=(0,te.useRef)(null);Ai(be,$e),(0,te.useEffect)(()=>{if(be.current)return(0,M.containScroll)(be.current)},[]);let Ne=e[0]?.options??[],mt=!!(v&&v.length>0&&x),Ae=!!(H&&H.length>0),it=Z==="time"&&we!=null,vt=Z==="location"&&Ye!=null,Pe=l&&(Ne.length>0||k&&mt||N||Ae||it||vt);Ei(be,Pe),wi(()=>{let A=be.current;A&&((0,M.fitMultiSelectDone)(A,(0,M.findMultiSelectDone)(A)),(0,M.syncPanelHug)(A))});let Ee={suggestions:e,activeIndex:a,pills:v,showPills:k,showSkipButton:m,showOptionIcons:h,showOptionImages:S,showOptionCounts:C,skipDisabled:I,activeSelected:F,isLoading:N,skeletonExiting:re,isInputEmpty:K,products:H,formatType:Z,dateView:Se,selectedDateIso:Ce,selectedDateRange:he,dateRangeStart:i,dateReferences:y,timeView:we,multiSelectView:pt,locationView:Ye,isReediting:at,showsSeeAll:!!Qe},ot=(0,te.useRef)(Ee);Pe&&(ot.current=Ee);let r=Pe?Ee:ot.current,Y=(0,M.uiStringsFor)(R),Fe=r.suggestions[0],Ke=Fe?.options??[],gt=r.activeIndex>=0&&!!Ke[r.activeIndex]?.is_tappable,qe=(0,M.labelTraditionalAutocomplete)(r.pills??[],Y.keepTyping),Ze=!!(qe.length>0&&x),w=r.showPills&&Ze,xt=r.showPills&&!Ze&&r.isLoading,nt=w||xt,rt=Ze&&(0,M.hasSkippablePill)(qe)&&r.showSkipButton&&!r.isInputEmpty&&!!g,f=qe[0]?.text,st=(0,M.isCalendarFormat)(r.formatType)&&r.dateView!=null,yt=Ke.length>0&&!st,Xe=Ke.length>0&&st&&!r.isLoading,kt=r.formatType==="time"&&r.timeView!=null&&!r.isLoading,St=r.formatType==="location"&&r.locationView!=null&&!r.isLoading,lt=r.isLoading&&!yt&&!Xe&&!kt&&!St,Ct=r.products??[],Je=(0,M.panelMorphKey)(w?qe:[]);return(0,te.useLayoutEffect)(()=>{be.current&&(0,M.settlePanelMorph)(be.current,Je,{visible:Pe,anchorBottom:X==="above"})},[Je,Pe,X,r.suggestions,r.pills,r.isLoading,r.skeletonExiting,r.isInputEmpty,r.products,r.formatType,r.dateView,r.selectedDateIso,r.selectedDateRange,r.dateRangeStart,r.dateReferences,r.timeView,r.multiSelectView,r.locationView,r.showPills,r.showSkipButton,r.showOptionIcons,r.showOptionImages,r.showOptionCounts,r.showsSeeAll,pe,R]),(0,te.useEffect)(()=>{let A=be.current;return()=>{A&&(0,M.destroyPanelMorph)(A)}},[]),(0,j.jsxs)("div",{ref:be,id:s,role:"listbox","aria-multiselectable":!!r.multiSelectView,"data-aia-dropdown":"","data-options-position":X,"data-mode":Te,"data-aia-loading":r.isLoading?"":void 0,"data-aia-skeleton-exiting":r.skeletonExiting?"":void 0,"data-aia-has-products":Ct.length>0?"":void 0,"data-aia-full-width":tt?"":void 0,className:`${je?"magicx-aia ":""}${Re.dropdown} ${Pe?Re.visible:""} ${p??""}`,onMouseDown:A=>A.preventDefault(),children:[(0,j.jsxs)(Ra,{space:"8px",children:[(nt||rt)&&(0,j.jsxs)(Et,{noWrap:!0,className:Re.pillBar,"data-aia-pillbar":"",children:[nt&&(0,j.jsx)("span",{className:Re.pillScroll,"data-aia-pill-scroll":"",children:(0,j.jsx)(Wt,{pills:qe,activePillIndex:0,activeSelected:r.activeSelected,onSelectPill:x??(()=>{}),rounded:!0,loading:r.isLoading})}),rt&&(0,j.jsx)("button",{type:"button",tabIndex:-1,className:Re.skip,"data-aia-skip":"",disabled:r.isLoading||r.skipDisabled,"aria-label":f?`${Y.skipLabel} ${f}`:Y.skipLabel,onClick:g,children:Y.skip})]}),yt&&(0,j.jsx)(Aa,{options:Ke,activeIndex:r.activeIndex,onSelect:t,onHighlight:n,onUnhighlight:o,listboxId:s,loading:r.isLoading,groupKey:Fe?`${Fe.parameter} ${Fe.text}`:"",optionsPosition:X,showIcons:r.showOptionIcons,showImages:r.showOptionImages,showCounts:r.showOptionCounts,picked:r.multiSelectView?.picked}),r.multiSelectView&&(0,j.jsx)("div",{"data-aia-multi-actions":"",onClick:A=>{A.target.closest("[data-aia-multi-done]")&&!r.skipDisabled&&!r.isLoading&&Ue?.()},children:(0,j.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Re.multiDone,ref:A=>{A&&(A.disabled=!0,A.offsetHeight,A.disabled=r.skipDisabled||r.isLoading)},children:Y.done})}),Xe&&r.dateView&&(0,j.jsx)(ma,{options:Ke,activeIndex:r.activeIndex,listboxId:s,view:r.dateView,selection:{selectedIso:r.selectedDateIso??null,selectedRange:r.selectedDateRange??null,rangeStart:r.dateRangeStart??null,floor:(0,M.dateFloorFor)(r.formatType,r.dateRangeStart),references:r.dateReferences??[]},onSelect:t,onHighlight:n,onUnhighlight:o,onPreviousMonth:ue??La,onNextMonth:me??La}),kt&&r.timeView&&(0,j.jsx)(Ea,{view:r.timeView,label:Y.timeLabel,doneLabel:Y.done,interactive:!r.skipDisabled,onTimeChange:u??yi,onTimeCommit:ut??ki}),St&&r.locationView&&(0,j.jsx)(va,{view:r.locationView,searchLabel:Y.locationSearch,noResultsLabel:Y.locationNoResults,useTypedLabel:Y.locationUseTyped,widgetFocused:B&&Pe,reediting:r.isReediting,visible:Pe,interactive:!r.skipDisabled,onQuery:b??Si,onMove:T??Ci,onCommit:z??Ti,onFocusChange:D??Pi}),lt&&(0,j.jsx)("div",{className:Re.skeletonBars,"data-aia-skeleton-bars":"",children:vi.map(A=>(0,j.jsx)("span",{className:Re.skeletonBar,style:{width:A}},`bar-${A}`))}),(0,j.jsx)(Sa,{products:Ct,listboxId:s,onSelect:_??xi,busyProductId:ht,onAddToCart:ne,onFocusChange:fe,focusable:Pe&&!r.isLoading,loading:r.isLoading,layout:pe,imageFallback:$,showVendor:E,strings:Y}),r.showsSeeAll&&(0,j.jsx)("div",{className:Re.seeAllRow,"data-aia-see-all":"",onClick:A=>{A.target.closest("[data-aia-see-all-button]")&&(A.stopPropagation(),!(r.isLoading||Me)&&Qe?.())},children:(0,j.jsx)("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:Re.seeAll,ref:A=>{A&&(A.disabled=!0,A.offsetHeight,A.disabled=r.isLoading)},children:Y.seeAllResults})}),(0,j.jsx)(ga,{isOptionHighlighted:gt,isInputEmpty:r.isInputEmpty,strings:Y})]}),(0,j.jsx)("button",{ref:$e,type:"button",tabIndex:-1,className:Re.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Y.scrollArrow,"aria-hidden":"true",children:(0,j.jsx)("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:(0,j.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var De=require("@magicx-eng/ai-autocomplete-vanilla");var Da=require("@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 {
3875
3899
  flex-shrink: 0;
3876
3900
  width: 32px;
3877
3901
  height: 32px;
@@ -3975,5 +3999,5 @@
3975
3999
  transition: none;
3976
4000
  }
3977
4001
  }
3978
- `,document.head.appendChild(e)}var La={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};var Kt=require("react/jsx-runtime");function Da({disabled:e,ready:a,busy:t=!1,onClick:n,label:i=(0,Oa.uiStringsFor)().submit}){return(0,Kt.jsx)("button",{type:"button","data-aia-submit":"",className:La.submitButton,disabled:e,"data-aia-ready":a?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:c=>{c.stopPropagation(),n()},"aria-label":i,children:(0,Kt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Kt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var ye=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react");var Jt=require("react");function Ma(e){let a=(0,Jt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),n=(0,Jt.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let i={};for(let c of Object.keys(e??{})){let s=(p,b,y)=>{let k=a.current?.[c];return k?k(p,b,y):[]};i[c]=s}n.current={key:t,overrides:e?i:void 0}}return{overrides:n.current.overrides,key:t}}var ea=require("react");function Na(e){let a=(0,ea.useRef)(e);a.current=e;let t=(0,ea.useRef)(null);t.current===null&&(t.current={fetch:(i,c)=>{let s=a.current;return s?s.fetch(i,c):Promise.reject(new Error("products config removed"))},transform:i=>a.current?.transform(i)??[],get limit(){return a.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var Ai={query:"",raw_query:"",completed_params:[],identified_params:[],is_ready:!1},Fa={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 qt({onSubmit:e,onResult:a,onError:t,optionOverrides:n,maskCompletedText:i,apiConfig:c,additionalContext:s,language:p,currency:b,productId:y,visitorId:k,analyticsConsent:g,columns:h=2,dropdownTrigger:u,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:ne,showNonTappableOptions:K,locationSearch:R,showOptionIcons:H,showOptionImages:_,showOptionCounts:$,showSkipButton:ke,showProducts:Z,submitProgress:A,awaitAnswerOnSubmit:re,submitAnswerTimeoutMs:X,productImageFallback:Se="image",showProductVendor:Ce=!0,onFocus:he,onBlur:o,value:x,completedParams:me,onChange:Oe,onParamsChange:be,products:lt,mapProducts:Qe,onProductSelect:Ye,onProductAddToCart:De,source:dt,setCursor:at}){let m=(0,P.useRef)(null),[ct,f]=(0,P.useState)(null),T=(0,P.useRef)(e);T.current=e;let z=(0,P.useRef)(a);z.current=a;let O=(0,P.useRef)(t);O.current=t;let B=(0,P.useRef)(Oe);B.current=Oe;let pe=(0,P.useRef)(be);pe.current=be;let Ge=(0,P.useRef)(he);Ge.current=he;let ge=(0,P.useRef)(o);ge.current=o;let Ke=(0,P.useRef)(at);Ke.current=at;let je=(0,P.useRef)(Ye);je.current=Ye;let pt=(0,P.useRef)(De);pt.current=De;let fe=(0,P.useRef)(k);fe.current=k;let $e=(0,P.useRef)(()=>{let l=fe.current;return typeof l=="function"?l():l}).current,Me=k!==void 0,ht=(0,P.useRef)(g);ht.current=g;let Pe=(0,P.useRef)(()=>{let l=ht.current;return typeof l=="function"?l():l}).current,it=Na(lt),vt=(0,P.useRef)(Qe);vt.current=Qe;let Te=(0,P.useRef)((l,te)=>{let V=vt.current;return V?V(l,te):l}).current,Ie=Qe?Te:void 0,ot=Ma(n);(0,P.useEffect)(()=>{if(typeof document>"u")return;let l=new ye.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:c,additionalContext:s,language:p,currency:b,productId:y,visitorId:Me?$e:void 0,analyticsConsent:Pe,optionOverrides:ot.overrides,maskCompletedText:i,columns:h,dropdownTrigger:u,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:ne,showNonTappableOptions:K,locationSearch:R,showProducts:Z,submitProgress:A,awaitAnswerOnSubmit:re,submitAnswerTimeoutMs:X,source:dt,value:x,completedParams:me,onSubmit:(...V)=>T.current?.(...V),onResult:(...V)=>z.current?.(...V),onError:(...V)=>O.current?.(...V),onChange:(...V)=>B.current?.(...V),onParamsChange:(...V)=>pe.current?.(...V),onFocus:()=>Ge.current?.(),onBlur:()=>ge.current?.(),onProductSelect:V=>je.current?je.current(V):ye.HANDOFF_NOT_HANDLED,onProductAddToCart:V=>pt.current?.(V),setCursor:V=>Ke.current?.(V),products:it.config,mapProducts:Ie});m.current=l,f(l.getState());let te=l.subscribe(V=>f(V));return()=>{te(),l.destroy(),m.current===l&&(m.current=null)}},[]);let r=(0,P.useRef)(Me);(0,P.useEffect)(()=>{r.current!==Me&&(r.current=Me,m.current?.update({visitorId:Me?$e:void 0,analyticsConsent:Pe}))},[Me,$e,Pe]);let Q=typeof g=="function"?"function":g,Ne=(0,P.useRef)(Q);(0,P.useEffect)(()=>{Ne.current!==Q&&(Ne.current=Q,m.current?.refreshAnalyticsConsent())},[Q]),(0,P.useEffect)(()=>{x!==void 0&&m.current?.setValue(x)},[x]),(0,P.useEffect)(()=>{me!==void 0&&m.current?.setCompletedParams(me)},[me]);let qe=JSON.stringify(c??null),ut;try{ut=JSON.stringify(s??null)}catch{ut="[unstringifiable]"}(0,P.useEffect)(()=>{m.current?.update({apiConfig:c,additionalContext:s,language:p,currency:b,productId:y,optionOverrides:ot.overrides,dropdownTrigger:u,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:ne,showNonTappableOptions:K,locationSearch:R,showProducts:Z,submitProgress:A,awaitAnswerOnSubmit:re,submitAnswerTimeoutMs:X})},[qe,ut,p,b?.code,b?.rate,b?.country,y,ot.key,u,S,C,I,F,N,ne,K,R,Z,A,re,X]);let _e=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!_e.current){_e.current=!0;return}m.current?.update({products:it.config})},[it.enabled]),(0,P.useEffect)(()=>{m.current?.update({mapProducts:Ie})},[Ie]);let Ze=(0,P.useRef)(null);Ze.current===null&&(Ze.current={handleTextChange:l=>m.current?.handleTextChange(l),handleCompositionText:l=>m.current?.handleCompositionText(l),handleKeyDown:l=>{let te="nativeEvent"in l?l.nativeEvent:l;m.current?.handleKeyDown(te)},setFocused:l=>m.current?.setFocused(l),startEditingParam:l=>m.current?.startEditingParam(l),removeParam:l=>m.current?.removeParam(l)??!1,exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:l=>m.current?.handleCaretAfterInput(l),handleCaretMove:l=>m.current?.handleCaretMove(l),replaceEditingRange:l=>m.current?.replaceEditingRange(l)??!1,setActivePill:l=>m.current?.setActivePill(l),skipActivePill:()=>m.current?.skipActivePill(),removeLastParam:()=>m.current?.removeLastParam(),clearNewParamId:()=>m.current?.clearNewParamId(),reset:()=>m.current?.reset(),refreshProducts:()=>m.current?.refreshProducts(),prepareSubmit:()=>m.current?.prepareSubmit(),getState:()=>m.current?.getState()??Fa,getResult:()=>m.current?.getResult()??Ai,awaitSubmitResult:()=>m.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:l=>m.current?.recordSubmit(l),holdSubmit:l=>m.current?.holdSubmit(l),endSubmitProgress:()=>m.current?.endSubmitProgress(),getSearchId:()=>m.current?.getSearchId(),getVisitorId:()=>m.current?.getVisitorId(),refreshAnalyticsConsent:()=>m.current?.refreshAnalyticsConsent(),selectOption:(l,te)=>m.current?.selectOption(l,te),selectProduct:l=>m.current?.selectProduct(l),addProductToCart:l=>{let te=m.current;return!te||!pt.current?Promise.resolve():te.addProductToCart(l)},setActiveDropdownIndex:l=>m.current?.setActiveDropdownIndex(l),clearHighlight:l=>m.current?.clearHighlight(l),showPreviousMonth:()=>m.current?.showPreviousMonth(),showNextMonth:()=>m.current?.showNextMonth(),setTime:l=>m.current?.setTime(l),commitTime:()=>m.current?.commitTime(),toggleMultiSelectOption:l=>m.current?.toggleMultiSelectOption(l),commitMultiSelect:()=>m.current?.commitMultiSelect(),setLocationQuery:l=>m.current?.setLocationQuery(l),moveLocationHighlight:l=>m.current?.moveLocationHighlight(l),commitLocation:l=>m.current?.commitLocation(l),setLocationFieldFocused:l=>m.current?.setLocationFieldFocused(l),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let v=Ze.current,mt=(0,P.useCallback)(l=>{let te=l.target.value,Pt=te.length>0&&!l.nativeEvent?.isComposing&&te[0]!==te[0].toUpperCase()?te[0].toUpperCase()+te.slice(1):te;m.current?.handleTextChange(Pt)},[]),xt=(0,P.useCallback)(l=>{m.current?.handleKeyDown(l.nativeEvent)},[]),Xe=m.current,w=ct??Fa,gt=x!==void 0?x:w.text,yt=me!==void 0?me:w.completedParams,Je=w.actionableSuggestions,kt=Je[0],St=(0,P.useMemo)(()=>(0,ye.withoutTraditionalAutocomplete)(Je),[Je]),nt=Xe?.listboxId??"",Ct=w.activeDropdownIndex>=0&&Xe?`${nt}-option-${w.activeDropdownIndex}`:void 0,et=w.editingParam,E=w.editingIdentified,Dt=et?(0,ye.editingSuggestion)(et):E?{parameter:E.parameter,text:(0,ye.identifiedParamLabel)(E.parameter),required:!0,options:[]}:null,Mt=w.dropdownSuggestion??Dt??kt,Vt=(0,ye.dropdownPillsFor)(w.dropdownSuggestion,Dt,Je),Tt=(0,ye.dateSelectionFor)(w),At=!Xe||w.dropdownLoading;return{completedParams:yt,multiSelectView:w.multiSelectView,toggleMultiSelectOption:v.toggleMultiSelectOption,commitMultiSelect:v.commitMultiSelect,skippedParams:w.skippedParams,identifiedParams:w.identifiedParams,suggestionPills:St,setActivePill:v.setActivePill,skipActivePill:v.skipActivePill,removeLastParam:v.removeLastParam,segments:w.segments,newParamId:w.newParamId,clearNewParamId:v.clearNewParamId,suggestions:w.suggestions,activeIndex:w.activeDropdownIndex,isReady:w.isReady,isLoading:At,isFocused:w.isFocused,isDropdownOpen:w.isDropdownOpen,isActivePillSelected:w.isActivePillSelected,placeholderText:w.placeholderText,listboxId:nt,error:w.error,products:w.products,customFields:w.customFields,selectProduct:v.selectProduct,addProductToCart:v.addProductToCart,handleTextChange:v.handleTextChange,handleCompositionText:v.handleCompositionText,handleKeyDown:v.handleKeyDown,setFocused:v.setFocused,editingParam:et,editingIdentified:E,editingAnchor:w.editingAnchor,caretOffset:w.caretOffset,startEditingParam:v.startEditingParam,removeParam:v.removeParam,exitEditMode:v.exitEditMode,handleCaretAfterInput:v.handleCaretAfterInput,handleCaretMove:v.handleCaretMove,replaceEditingRange:v.replaceEditingRange,inputProps:{value:gt,placeholder:w.placeholderText||void 0,onChange:mt,onKeyDown:xt,onFocus:v.handleFocus,onBlur:v.handleBlur,role:"combobox","aria-expanded":w.isDropdownOpen,"aria-activedescendant":Ct,"aria-autocomplete":"list","aria-controls":nt},reset:v.reset,refreshProducts:v.refreshProducts,prepareSubmit:v.prepareSubmit,getState:v.getState,getResult:v.getResult,awaitSubmitResult:v.awaitSubmitResult,recordSubmit:v.recordSubmit,holdSubmit:v.holdSubmit,endSubmitProgress:v.endSubmitProgress,getSearchId:v.getSearchId,getVisitorId:v.getVisitorId,refreshAnalyticsConsent:v.refreshAnalyticsConsent,isSubmitting:w.isSubmitting,selectingProductId:w.selectingProductId,dropdownProps:{suggestions:Mt?[{...Mt,options:w.dropdownOptions}]:[],activeIndex:w.activeDropdownIndex,onSelect:v.selectOption,onHighlight:v.setActiveDropdownIndex,onUnhighlight:v.clearHighlight,isOpen:w.isDropdownOpen,id:nt,pills:Vt,activeSelected:w.isActivePillSelected,onPillClick:v.setActivePill,onSkip:v.skipActivePill,showSkipButton:(ke??!0)&&!et&&!E,showOptionIcons:H??!0,showOptionImages:_??!0,showOptionCounts:$??!0,skipDisabled:w.inSelectionAnimation,isLoading:At,skeletonExiting:w.skeletonExiting,isInputEmpty:gt.trim().length===0,language:p,products:w.products,productImageFallback:Se,showProductVendor:Ce,onProductSelect:v.selectProduct,busyProductId:w.selectingProductId,seeAllBusy:w.isSubmitting,onProductAddToCart:De?v.addProductToCart:void 0,onProductFocusChange:v.setFocused,formatType:w.activeFormatType,dateView:w.dateView,selectedDateIso:Tt.selectedIso,selectedDateRange:Tt.selectedRange,dateRangeStart:Tt.rangeStart,dateReferences:Tt.references,onPreviousMonth:v.showPreviousMonth,onNextMonth:v.showNextMonth,timeView:w.timeView,multiSelectView:w.dropdownMultiSelect,onMultiSelectCommit:v.commitMultiSelect,onTimeChange:v.setTime,onTimeCommit:v.commitTime,locationView:w.locationView,isReediting:w.editingParam!=null,onLocationQuery:v.setLocationQuery,onLocationMove:v.moveLocationHighlight,onLocationCommit:v.commitLocation,onLocationFocusChange:v.setLocationFieldFocused,isFocused:w.isFocused||w.locationFieldFocused,optionsPosition:S??"below"}}}var G=require("@magicx-eng/ai-autocomplete-vanilla"),L=require("react"),_t;function Ei(){if(_t!==void 0)return _t;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),_t=e.contentEditable==="plaintext-only",_t}function Ha(e){let{segments:a,showChipIcons:t=!0,showChipImages:n=!0,showChipRemove:i=!1,focusInputOnSelect:c,removeParam:s,newParamId:p,editingParam:b,editingIdentified:y,editingAnchor:k,caretOffset:g,placeholderText:h,hintSuggestions:u,isFocused:S,isDropdownOpen:C,listboxId:I,activeDescendantId:F,autoFocus:N,handleTextChange:ne,handleCompositionText:K,handleKeyDown:R,handleCaretAfterInput:H,handleCaretMove:_,startEditingParam:$,replaceEditingRange:ke,setFocused:Z}=e,A=(0,L.useRef)(null),re=(0,L.useRef)(!1),X=(0,L.useRef)(""),Se=(0,L.useRef)(""),Ce=(0,L.useRef)(null),he=(0,L.useRef)(0);Ce.current=g;let o=(0,L.useRef)(c);o.current=c,(0,L.useEffect)(()=>{if(!N)return;let f=A.current;if(!f)return;document.activeElement===f?Z(!0):f.focus();let T=f.ownerDocument??document,z=T.getSelection(),O=z&&z.rangeCount>0&&f.contains(z.anchorNode);if(z&&!O){let B=T.createRange();B.selectNodeContents(f),B.collapse(!0),z.removeAllRanges(),z.addRange(B)}},[N,Z]),(0,L.useEffect)(()=>{let f=A.current;if(!f)return;let T=f.ownerDocument??document,z=()=>{let O=T.getSelection();if(!O||O.rangeCount===0||!O.anchorNode||!f.contains(O.anchorNode))return;let B=O.anchorNode,pe=B.nodeType===Node.ELEMENT_NODE?B:B.parentElement,ge=(O.isCollapsed?pe?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ke=b?.id??y?.id??null;if(ge&&ge!==Ke){$(ge);return}performance.now()-he.current<50||_((0,G.getCursorOffset)(f))};return T.addEventListener("selectionchange",z),()=>T.removeEventListener("selectionchange",z)},[b,y,$,_]),(0,L.useEffect)(()=>{let f=A.current;if(!f)return;let T=z=>{let O=(0,G.chipIdFromTap)(f,z.target);O&&($(O),(0,G.keepCaretOnChip)(f,O))};return f.addEventListener("click",T),()=>f.removeEventListener("click",T)},[$]),(0,L.useEffect)(()=>{let f=A.current;if(!(!f||!s||!i))return(0,G.attachChipRemove)(f,s)},[s,i]),(0,L.useLayoutEffect)(()=>{let f=A.current;f&&(0,G.renderEditableContent)({input:f,segments:a,newParamId:p,editingParamId:b?.id??null,placeholderText:h??"",isFocused:S,showChipIcons:t,showChipImages:n,showChipRemove:i,hintOptions:(0,G.startingHintOptions)(u??[])})},[a,p,b,h,u,S,t,n,i]),(0,L.useEffect)(()=>{let f=A.current;return()=>{f&&(0,G.cancelStartingHint)(f)}},[]),(0,L.useLayoutEffect)(()=>{let f=X.current,T=p??"";if(X.current=T,!T||T===f)return;let z=A.current;if(!z)return;let O=Ce.current??(0,G.plainTextLength)(z);(0,G.settlePickFocus)(z,O,(0,G.focusesInputOnSelect)(o.current))},[p]),(0,L.useLayoutEffect)(()=>{let f=Se.current,T=b?.id??"";if(Se.current=T,!T||T===f||k==null)return;let z=A.current;z&&(0,G.setCursorOffset)(z,k)},[b,k]);let x=(0,L.useCallback)(()=>{let f=A.current;if(!f)return;let T=(0,G.extractPlainText)(f),O=T.length>0&&T[0]!==T[0].toUpperCase()?T[0].toUpperCase()+T.slice(1):T;if(re.current){K(O);return}ne(O)},[ne,K]),me=(0,L.useCallback)(()=>{he.current=performance.now(),x();let f=A.current;f&&H((0,G.getCursorOffset)(f))},[x,H]);(0,L.useEffect)(()=>{let f=A.current;if(!f)return;let T=z=>{let O=z,B=O.inputType;if(B==="insertParagraph"||B==="insertLineBreak"||B==="insertFromDrop"){z.preventDefault();return}if(B.startsWith("insert")||B.startsWith("delete")){let pe=B.startsWith("delete")?"":O.data??"";ke(pe)&&z.preventDefault()}};return f.addEventListener("beforeinput",T),()=>f.removeEventListener("beforeinput",T)},[ke]);let Oe=(0,L.useCallback)(()=>{re.current=!0,A.current?.setAttribute("data-aia-composing","true")},[]),be=(0,L.useCallback)(()=>{re.current=!1,A.current?.removeAttribute("data-aia-composing"),x()},[x]),lt=(0,L.useCallback)(f=>{f.preventDefault();let T=A.current;if(!T)return;let z=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!z)return;let O=T.ownerDocument??document,B=O.getSelection();if(!B||B.rangeCount===0)return;let pe=B.getRangeAt(0);if(!T.contains(pe.startContainer))return;pe.deleteContents();let Ge=O.createTextNode(z);pe.insertNode(Ge),pe.setStartAfter(Ge),pe.collapse(!0),B.removeAllRanges(),B.addRange(pe),x()},[x]),Qe=(0,L.useCallback)(f=>R(f),[R]),Ye=(0,L.useCallback)(()=>Z(!0),[Z]),De=(0,L.useCallback)(()=>Z(!1),[Z]),dt=(0,L.useCallback)(()=>A.current?.focus(),[]),at=(0,L.useCallback)(()=>A.current?.blur(),[]),m=(0,L.useCallback)(()=>{let f=A.current;return f?(0,G.extractPlainText)(f):""},[]),ct=Ei()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:ct,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":I,"aria-expanded":C,"aria-activedescendant":F,spellCheck:!0,enterKeyHint:"send",onInput:me,onKeyDown:Qe,onCompositionStart:Oe,onCompositionEnd:be,onPaste:lt,onFocus:Ye,onBlur:De},getPlainText:m,focus:dt,blur:at}}var We=require("react/jsx-runtime");function Ri(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ba=(0,j.forwardRef)(function({onSubmit:a,onResult:t,onError:n,optionOverrides:i,maskCompletedText:c,className:s,apiConfig:p,additionalContext:b,language:y,currency:k,productId:g,visitorId:h,analyticsConsent:u,columns:S,pillPlacement:C="dropdown",mode:I="auto",optionsPosition:F="below",animations:N=!0,optionsStyle:ne="floating",dropdownTrigger:K,closeDropdownOnBlur:R,focusInputOnSelect:H,startingState:_,prependPlaceholder:$,allOption:ke,showNonTappableOptions:Z,locationSearch:A,showOptionIcons:re=!0,showChipIcons:X=!0,showChipImages:Se=!0,showChipRemove:Ce=!1,showOptionImages:he=!0,showOptionCounts:o=!0,showSkipButton:x,showProducts:me,submitProgress:Oe,awaitAnswerOnSubmit:be,submitAnswerTimeoutMs:lt,productsLayout:Qe,productImageFallback:Ye,showProductVendor:De,autoFocus:dt=!0,onFocus:at,onBlur:m,value:ct,completedParams:f,onChange:T,onParamsChange:z,products:O,mapProducts:B,onProductSelect:pe,onProductAddToCart:Ge,submitButton:ge,resetOnSubmit:Ke=!0,seeAllResults:je=!1},pt){let fe=(0,j.useRef)(null),$e=(0,j.useRef)(null),Me=(0,j.useRef)(null),ht=(0,j.useRef)(()=>{}),Pe=(0,j.useRef)(null),it=(0,j.useRef)(null);(0,j.useEffect)(()=>{let D=fe.current;if(D)return Pe.current?Pe.current.setMode(I):Pe.current=new Le.ModeController(D,I),()=>{Pe.current?.destroy(),Pe.current=null}},[I]);let vt=(0,j.useCallback)(D=>{let Fe=it.current?.current;Fe&&(Fe.focus(),(0,Le.setCursorOffset)(Fe,D))},[]),{completedParams:Te,suggestionPills:Ie,setActivePill:ot,skipActivePill:r,segments:Q,newParamId:Ne,clearNewParamId:qe,placeholderText:ut,isFocused:_e,isDropdownOpen:Ze,isActivePillSelected:v,isLoading:mt,isReady:xt,activeIndex:Xe,listboxId:w,handleTextChange:gt,handleCompositionText:yt,handleKeyDown:Je,setFocused:kt,editingParam:St,editingIdentified:nt,editingAnchor:Ct,caretOffset:et,startEditingParam:E,removeParam:Dt,handleCaretAfterInput:Mt,handleCaretMove:Vt,replaceEditingRange:Tt,dropdownProps:At,reset:l,refreshProducts:te,prepareSubmit:V,getState:Pt,getResult:ta,awaitSubmitResult:aa,recordSubmit:ia,holdSubmit:oa,endSubmitProgress:na,getSearchId:ra,getVisitorId:sa,refreshAnalyticsConsent:la,isSubmitting:Ut}=qt({onSubmit:D=>ht.current(D),onResult:t,onError:n,optionOverrides:i,maskCompletedText:c,apiConfig:p,additionalContext:b,language:y,currency:k,productId:g,visitorId:h,analyticsConsent:u,columns:S,dropdownTrigger:K,optionsPosition:F,closeDropdownOnBlur:R,focusInputOnSelect:H,startingState:_,prependPlaceholder:$,allOption:ke,showNonTappableOptions:Z,locationSearch:A,showOptionIcons:re,showOptionImages:he,showOptionCounts:o,showSkipButton:x,showProducts:me,submitProgress:Oe,awaitAnswerOnSubmit:be,submitAnswerTimeoutMs:lt,onFocus:at,onBlur:m,value:ct,completedParams:f,onChange:T,onParamsChange:z,products:O,mapProducts:B,onProductSelect:pe,onProductAddToCart:Ge,source:"full-sdk",setCursor:vt});(0,j.useEffect)(()=>{if(!Ne)return;let D=window.setTimeout(()=>qe(),650);return()=>window.clearTimeout(D)},[Ne,qe]);let Wa=Xe>=0?`${w}-option-${Xe}`:void 0,{inputRef:It,editorProps:Ga,focus:da,blur:ca,getPlainText:pa}=Ha({segments:Q,newParamId:Ne,editingParam:St,editingIdentified:nt,editingAnchor:Ct,caretOffset:et,placeholderText:ut,hintSuggestions:C==="inline"?[]:Ie,isFocused:_e,showChipIcons:X,showChipImages:Se,showChipRemove:Ce,removeParam:Dt,focusInputOnSelect:H,isDropdownOpen:Ze,listboxId:w,activeDescendantId:Wa,autoFocus:dt,handleTextChange:gt,handleCompositionText:yt,handleKeyDown:Je,handleCaretAfterInput:Mt,handleCaretMove:Vt,startEditingParam:E,replaceEditingRange:Tt,setFocused:kt});it.current=It,(0,j.useLayoutEffect)(()=>{let D=$e.current,Fe=It.current;if(!D||!Fe)return;let bt=()=>{let Rt=D.firstElementChild;if(!Rt)return;let Qa=Rt.getBoundingClientRect(),Ya=Fe.getBoundingClientRect();Qa.top>=Ya.bottom-2?D.setAttribute("data-aia-pill-wrapped",""):D.removeAttribute("data-aia-pill-wrapped")};bt();let Et=new ResizeObserver(bt);return Et.observe(Fe),()=>Et.disconnect()},[Q,Ie.length,mt,It]),(0,j.useEffect)(()=>{let D=Me.current;if(D)return(0,Le.watchEditorHeight)(D)},[]),(0,j.useImperativeHandle)(pt,()=>({focus:da,blur:ca,reset:l,refreshProducts:te,setMode:D=>Pe.current?.setMode(D),skipActivePill:r,endSubmitProgress:na,getSearchId:ra,getVisitorId:sa,refreshAnalyticsConsent:la}),[da,ca,l,te,r,na,ra,sa,la]);let ft=!!Q.length||Te.length>0,Nt=(0,j.useCallback)((D,Fe)=>{let bt=Pt(),Et=(0,Le.buildSubmitResult)(pa(),bt.completedParams,bt.skippedParams,{identifiedParams:bt.identifiedParams,isReady:bt.isReady,customFields:Fe.custom_fields??null,customFieldsStale:Fe.custom_fields_stale===!0});D&&ia(Et);let Rt=a(Et);return D&&!Ke&&oa(Rt),Ke&&l(),Rt},[ia,oa,Ke,Pt,a,l,pa]),Qt=(0,j.useCallback)(()=>{if(ft&&!Pt().isSubmitting){if(be){aa().then(D=>{D&&Nt(!0,D)});return}V(),Nt(!0,ta())}},[ft,Pt,be,aa,V,ta,Nt]);ht.current=D=>ft?Nt(!1,D):void 0;let Ka=je&&!At.isInputEmpty&&ft,qa=Qt,_a=(0,j.useCallback)(D=>{D.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||It.current&&(0,Le.focusEditorFromTap)(It.current)},[It]),Va=C==="inline",Ua=C==="dropdown";return(0,We.jsxs)("div",{ref:fe,className:`magicx-aia ${wt.container} ${s??""}`,"data-pill-placement":C,"data-options-position":F,"data-animations":N?"on":"off","data-aia-options-style":ne,"data-mode":Ri(I),children:[(0,We.jsx)(Gt,{...At,showPills:Ua,productsLayout:Qe,productImageFallback:Ye,showProductVendor:De,onSeeAllResults:Ka?qa:void 0,fullWidth:je}),(0,We.jsxs)("div",{className:wt.inputWrapper,"data-aia-input-wrapper":"",onClick:_a,children:[(0,We.jsxs)("div",{ref:Me,className:wt.editorArea,"data-aia-editor":"",children:[(0,We.jsx)("div",{...Ga,className:wt.input,"data-aia-input":""}),Va&&(mt||Ie.length>0)&&(0,We.jsx)("span",{ref:$e,className:wt.pillListContainer,"data-aia-pill-list-container":"",children:(0,We.jsx)(Bt,{pills:Ie,activePillIndex:0,activeSelected:v,onSelectPill:ot,loading:mt})})]}),ge===null?null:ge===void 0?(0,We.jsx)(Da,{disabled:!ft,ready:ft&&xt,busy:Ut,onClick:Qt,label:(0,Le.uiStringsFor)(y).submit}):(0,We.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Ut?"busy":void 0,"aria-busy":Ut?!0:void 0,className:wt.submitSlot,onClick:D=>{ft&&(D.stopPropagation(),Qt())},children:ge})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,focusesInputOnSelect,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isTouchPrimary,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
4002
+ `,document.head.appendChild(e)}var Oa={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};var qt=require("react/jsx-runtime");function Ma({disabled:e,ready:a,busy:t=!1,onClick:n,label:o=(0,Da.uiStringsFor)().submit}){return(0,qt.jsx)("button",{type:"button","data-aia-submit":"",className:Oa.submitButton,disabled:e,"data-aia-ready":a?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:l=>{l.stopPropagation(),n()},"aria-label":o,children:(0,qt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":o,children:(0,qt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var ke=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react");var ea=require("react");function Na(e){let a=(0,ea.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),n=(0,ea.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let o={};for(let l of Object.keys(e??{})){let s=(p,v,x)=>{let k=a.current?.[l];return k?k(p,v,x):[]};o[l]=s}n.current={key:t,overrides:e?o:void 0}}return{overrides:n.current.overrides,key:t}}var ta=require("react");function Fa(e){let a=(0,ta.useRef)(e);a.current=e;let t=(0,ta.useRef)(null);t.current===null&&(t.current={fetch:(o,l)=>{let s=a.current;return s?s.fetch(o,l):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var Ri={query:"",raw_query:"",completed_params:[],identified_params:[],is_ready:!1},Ha={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 _t({onSubmit:e,onResult:a,onError:t,optionOverrides:n,maskCompletedText:o,apiConfig:l,additionalContext:s,language:p,currency:v,productId:x,visitorId:k,analyticsConsent:g,columns:m=2,dropdownTrigger:h,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:re,showNonTappableOptions:K,locationSearch:R,showOptionIcons:H,showOptionImages:_,showOptionCounts:ne,showSkipButton:fe,showProducts:pe,submitProgress:$,awaitAnswerOnSubmit:E,submitAnswerTimeoutMs:Z,productImageFallback:Se="image",showProductVendor:Ce=!0,onFocus:he,onBlur:i,value:y,completedParams:ue,onChange:me,onParamsChange:we,products:pt,mapProducts:Ue,onProductSelect:Qe,onProductAddToCart:Me,source:ht,setCursor:tt}){let u=(0,P.useRef)(null),[ut,Ye]=(0,P.useState)(null),at=(0,P.useRef)(e);at.current=e;let b=(0,P.useRef)(a);b.current=a;let T=(0,P.useRef)(t);T.current=t;let z=(0,P.useRef)(me);z.current=me;let D=(0,P.useRef)(we);D.current=we;let B=(0,P.useRef)(he);B.current=he;let X=(0,P.useRef)(i);X.current=i;let Ie=(0,P.useRef)(tt);Ie.current=tt;let Te=(0,P.useRef)(Qe);Te.current=Qe;let je=(0,P.useRef)(Me);je.current=Me;let be=(0,P.useRef)(k);be.current=k;let $e=(0,P.useRef)(()=>{let c=be.current;return typeof c=="function"?c():c}).current,Ne=k!==void 0,mt=(0,P.useRef)(g);mt.current=g;let Ae=(0,P.useRef)(()=>{let c=mt.current;return typeof c=="function"?c():c}).current,it=Fa(pt),vt=(0,P.useRef)(Ue);vt.current=Ue;let Pe=(0,P.useRef)((c,J)=>{let V=vt.current;return V?V(c,J):c}).current,Ee=Ue?Pe:void 0,ot=Na(n);(0,P.useEffect)(()=>{if(typeof document>"u")return;let c=new ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:l,additionalContext:s,language:p,currency:v,productId:x,visitorId:Ne?$e:void 0,analyticsConsent:Ae,optionOverrides:ot.overrides,maskCompletedText:o,columns:m,dropdownTrigger:h,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:re,showNonTappableOptions:K,locationSearch:R,showProducts:pe,submitProgress:$,awaitAnswerOnSubmit:E,submitAnswerTimeoutMs:Z,source:ht,value:y,completedParams:ue,onSubmit:(...V)=>at.current?.(...V),onResult:(...V)=>b.current?.(...V),onError:(...V)=>T.current?.(...V),onChange:(...V)=>z.current?.(...V),onParamsChange:(...V)=>D.current?.(...V),onFocus:()=>B.current?.(),onBlur:()=>X.current?.(),onProductSelect:V=>Te.current?Te.current(V):ke.HANDOFF_NOT_HANDLED,onProductAddToCart:V=>je.current?.(V),setCursor:V=>Ie.current?.(V),products:it.config,mapProducts:Ee});u.current=c,Ye(c.getState());let J=c.subscribe(V=>Ye(V));return()=>{J(),c.destroy(),u.current===c&&(u.current=null)}},[]);let r=(0,P.useRef)(Ne);(0,P.useEffect)(()=>{r.current!==Ne&&(r.current=Ne,u.current?.update({visitorId:Ne?$e:void 0,analyticsConsent:Ae}))},[Ne,$e,Ae]);let Y=typeof g=="function"?"function":g,Fe=(0,P.useRef)(Y);(0,P.useEffect)(()=>{Fe.current!==Y&&(Fe.current=Y,u.current?.refreshAnalyticsConsent())},[Y]),(0,P.useEffect)(()=>{y!==void 0&&u.current?.setValue(y)},[y]),(0,P.useEffect)(()=>{ue!==void 0&&u.current?.setCompletedParams(ue)},[ue]);let Ke=JSON.stringify(l??null),gt;try{gt=JSON.stringify(s??null)}catch{gt="[unstringifiable]"}(0,P.useEffect)(()=>{u.current?.update({apiConfig:l,additionalContext:s,language:p,currency:v,productId:x,optionOverrides:ot.overrides,dropdownTrigger:h,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:re,showNonTappableOptions:K,locationSearch:R,showProducts:pe,submitProgress:$,awaitAnswerOnSubmit:E,submitAnswerTimeoutMs:Z})},[Ke,gt,p,v?.code,v?.rate,v?.country,x,ot.key,h,S,C,I,F,N,re,K,R,pe,$,E,Z]);let qe=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!qe.current){qe.current=!0;return}u.current?.update({products:it.config})},[it.enabled]),(0,P.useEffect)(()=>{u.current?.update({mapProducts:Ee})},[Ee]);let Ze=(0,P.useRef)(null);Ze.current===null&&(Ze.current={handleTextChange:c=>u.current?.handleTextChange(c),handleCompositionText:c=>u.current?.handleCompositionText(c),handleKeyDown:c=>{let J="nativeEvent"in c?c.nativeEvent:c;u.current?.handleKeyDown(J)},setFocused:c=>u.current?.setFocused(c),startEditingParam:c=>u.current?.startEditingParam(c),removeParam:c=>u.current?.removeParam(c)??!1,exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:c=>u.current?.handleCaretAfterInput(c),handleCaretMove:c=>u.current?.handleCaretMove(c),replaceEditingRange:c=>u.current?.replaceEditingRange(c)??!1,setActivePill:c=>u.current?.setActivePill(c),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()??Ha,getResult:()=>u.current?.getResult()??Ri,awaitSubmitResult:()=>u.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:c=>u.current?.recordSubmit(c),holdSubmit:c=>u.current?.holdSubmit(c),endSubmitProgress:()=>u.current?.endSubmitProgress(),getSearchId:()=>u.current?.getSearchId(),getVisitorId:()=>u.current?.getVisitorId(),refreshAnalyticsConsent:()=>u.current?.refreshAnalyticsConsent(),selectOption:(c,J)=>u.current?.selectOption(c,J),selectProduct:c=>u.current?.selectProduct(c),addProductToCart:c=>{let J=u.current;return!J||!je.current?Promise.resolve():J.addProductToCart(c)},setActiveDropdownIndex:c=>u.current?.setActiveDropdownIndex(c),clearHighlight:c=>u.current?.clearHighlight(c),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),setTime:c=>u.current?.setTime(c),commitTime:()=>u.current?.commitTime(),toggleMultiSelectOption:c=>u.current?.toggleMultiSelectOption(c),commitMultiSelect:()=>u.current?.commitMultiSelect(),setLocationQuery:c=>u.current?.setLocationQuery(c),moveLocationHighlight:c=>u.current?.moveLocationHighlight(c),commitLocation:c=>u.current?.commitLocation(c),setLocationFieldFocused:c=>u.current?.setLocationFieldFocused(c),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let w=Ze.current,xt=(0,P.useCallback)(c=>{let J=c.target.value,Mt=J.length>0&&!c.nativeEvent?.isComposing&&J[0]!==J[0].toUpperCase()?J[0].toUpperCase()+J.slice(1):J;u.current?.handleTextChange(Mt)},[]),nt=(0,P.useCallback)(c=>{u.current?.handleKeyDown(c.nativeEvent)},[]),rt=u.current,f=ut??Ha,st=y!==void 0?y:f.text,yt=ue!==void 0?ue:f.completedParams,Xe=f.actionableSuggestions,kt=Xe[0],St=(0,P.useMemo)(()=>(0,ke.withoutTraditionalAutocomplete)(Xe),[Xe]),lt=rt?.listboxId??"",Ct=f.activeDropdownIndex>=0&&rt?`${lt}-option-${f.activeDropdownIndex}`:void 0,Je=f.editingParam,A=f.editingIdentified,Lt=Je?(0,ke.editingSuggestion)(Je):A?{parameter:A.parameter,text:(0,ke.identifiedParamLabel)(A.parameter),required:!0,options:[]}:null,Ot=f.dropdownSuggestion??Lt??kt,Ut=(0,ke.dropdownPillsFor)(f.dropdownSuggestion,Lt,Xe),Tt=(0,ke.dateSelectionFor)(f),Dt=!rt||f.dropdownLoading;return{completedParams:yt,multiSelectView:f.multiSelectView,toggleMultiSelectOption:w.toggleMultiSelectOption,commitMultiSelect:w.commitMultiSelect,skippedParams:f.skippedParams,identifiedParams:f.identifiedParams,suggestionPills:St,setActivePill:w.setActivePill,skipActivePill:w.skipActivePill,removeLastParam:w.removeLastParam,segments:f.segments,newParamId:f.newParamId,clearNewParamId:w.clearNewParamId,suggestions:f.suggestions,activeIndex:f.activeDropdownIndex,isReady:f.isReady,isLoading:Dt,isFocused:f.isFocused,isDropdownOpen:f.isDropdownOpen,isActivePillSelected:f.isActivePillSelected,blockingChips:f.blockingChips,placeholderText:f.placeholderText,listboxId:lt,error:f.error,products:f.products,customFields:f.customFields,selectProduct:w.selectProduct,addProductToCart:w.addProductToCart,handleTextChange:w.handleTextChange,handleCompositionText:w.handleCompositionText,handleKeyDown:w.handleKeyDown,setFocused:w.setFocused,editingParam:Je,editingIdentified:A,editingAnchor:f.editingAnchor,caretOffset:f.caretOffset,startEditingParam:w.startEditingParam,removeParam:w.removeParam,exitEditMode:w.exitEditMode,handleCaretAfterInput:w.handleCaretAfterInput,handleCaretMove:w.handleCaretMove,replaceEditingRange:w.replaceEditingRange,inputProps:{value:st,placeholder:f.placeholderText||void 0,onChange:xt,onKeyDown:nt,onFocus:w.handleFocus,onBlur:w.handleBlur,role:"combobox","aria-expanded":f.isDropdownOpen,"aria-activedescendant":Ct,"aria-autocomplete":"list","aria-controls":lt},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:f.isSubmitting,selectingProductId:f.selectingProductId,dropdownProps:{suggestions:Ot?[{...Ot,options:f.dropdownOptions}]:[],activeIndex:f.activeDropdownIndex,onSelect:w.selectOption,onHighlight:w.setActiveDropdownIndex,onUnhighlight:w.clearHighlight,isOpen:f.isDropdownOpen,id:lt,pills:Ut,activeSelected:f.isActivePillSelected,onPillClick:w.setActivePill,onSkip:w.skipActivePill,showSkipButton:(fe??!0)&&!Je&&!A,showOptionIcons:H??!0,showOptionImages:_??!0,showOptionCounts:ne??!0,skipDisabled:f.inSelectionAnimation,isLoading:Dt,skeletonExiting:f.skeletonExiting,isInputEmpty:st.trim().length===0,language:p,products:f.products,productImageFallback:Se,showProductVendor:Ce,onProductSelect:w.selectProduct,busyProductId:f.selectingProductId,seeAllBusy:f.isSubmitting,onProductAddToCart:Me?w.addProductToCart:void 0,onProductFocusChange:w.setFocused,formatType:f.activeFormatType,dateView:f.dateView,selectedDateIso:Tt.selectedIso,selectedDateRange:Tt.selectedRange,dateRangeStart:Tt.rangeStart,dateReferences:Tt.references,onPreviousMonth:w.showPreviousMonth,onNextMonth:w.showNextMonth,timeView:f.timeView,multiSelectView:f.dropdownMultiSelect,onMultiSelectCommit:w.commitMultiSelect,onTimeChange:w.setTime,onTimeCommit:w.commitTime,locationView:f.locationView,isReediting:f.editingParam!=null,onLocationQuery:w.setLocationQuery,onLocationMove:w.moveLocationHighlight,onLocationCommit:w.commitLocation,onLocationFocusChange:w.setLocationFieldFocused,isFocused:f.isFocused||f.locationFieldFocused,optionsPosition:S??"below"}}}var G=require("@magicx-eng/ai-autocomplete-vanilla"),O=require("react"),Vt;function zi(){if(Vt!==void 0)return Vt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Vt=e.contentEditable==="plaintext-only",Vt}function Ba(e){let{segments:a,showChipIcons:t=!0,showChipImages:n=!0,showChipRemove:o=!1,blockingParamIds:l,focusInputOnSelect:s,removeParam:p,newParamId:v,editingParam:x,editingIdentified:k,editingAnchor:g,caretOffset:m,placeholderText:h,hintSuggestions:S,isFocused:C,isDropdownOpen:I,listboxId:F,activeDescendantId:N,autoFocus:re,handleTextChange:K,handleCompositionText:R,handleKeyDown:H,handleCaretAfterInput:_,handleCaretMove:ne,startEditingParam:fe,replaceEditingRange:pe,setFocused:$}=e,E=(0,O.useRef)(null),Z=(0,O.useRef)(!1),Se=(0,O.useRef)(""),Ce=(0,O.useRef)(""),he=(0,O.useRef)(null),i=(0,O.useRef)(0);he.current=m;let y=(0,O.useRef)(s);y.current=s,(0,O.useEffect)(()=>{if(!re)return;let b=E.current;if(!b)return;document.activeElement===b?$(!0):b.focus();let T=b.ownerDocument??document,z=T.getSelection(),D=z&&z.rangeCount>0&&b.contains(z.anchorNode);if(z&&!D){let B=T.createRange();B.selectNodeContents(b),B.collapse(!0),z.removeAllRanges(),z.addRange(B)}},[re,$]),(0,O.useEffect)(()=>{let b=E.current;if(!b)return;let T=b.ownerDocument??document,z=()=>{let D=T.getSelection();if(!D||D.rangeCount===0||!D.anchorNode||!b.contains(D.anchorNode))return;let B=D.anchorNode,X=B.nodeType===Node.ELEMENT_NODE?B:B.parentElement,Te=(D.isCollapsed?X?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,je=x?.id??k?.id??null;if(Te&&Te!==je){fe(Te);return}performance.now()-i.current<50||ne((0,G.getCursorOffset)(b))};return T.addEventListener("selectionchange",z),()=>T.removeEventListener("selectionchange",z)},[x,k,fe,ne]),(0,O.useEffect)(()=>{let b=E.current;if(!b)return;let T=z=>{let D=(0,G.chipIdFromTap)(b,z.target);D&&(fe(D),(0,G.keepCaretOnChip)(b,D))};return b.addEventListener("click",T),()=>b.removeEventListener("click",T)},[fe]);let ue=o||(l?.length??0)>0;(0,O.useEffect)(()=>{let b=E.current;if(!(!b||!p||!ue))return(0,G.attachChipRemove)(b,p)},[p,ue]),(0,O.useLayoutEffect)(()=>{let b=E.current;b&&(0,G.renderEditableContent)({input:b,segments:a,newParamId:v,editingParamId:x?.id??null,placeholderText:h??"",isFocused:C,showChipIcons:t,showChipImages:n,showChipRemove:o,blockingParamIds:l,hintOptions:(0,G.startingHintOptions)(S??[])})},[a,v,x,h,S,C,t,n,o,l]),(0,O.useEffect)(()=>{let b=E.current;return()=>{b&&(0,G.cancelStartingHint)(b)}},[]),(0,O.useLayoutEffect)(()=>{let b=Se.current,T=v??"";if(Se.current=T,!T||T===b)return;let z=E.current;if(!z)return;let D=he.current??(0,G.plainTextLength)(z);(0,G.settlePickFocus)(z,D,(0,G.focusesInputOnSelect)(y.current))},[v]),(0,O.useLayoutEffect)(()=>{let b=Ce.current,T=x?.id??"";if(Ce.current=T,!T||T===b||g==null)return;let z=E.current;z&&(0,G.setCursorOffset)(z,g)},[x,g]);let me=(0,O.useCallback)(()=>{let b=E.current;if(!b)return;let T=(0,G.extractPlainText)(b),D=T.length>0&&T[0]!==T[0].toUpperCase()?T[0].toUpperCase()+T.slice(1):T;if(Z.current){R(D);return}K(D)},[K,R]),we=(0,O.useCallback)(()=>{i.current=performance.now(),me();let b=E.current;b&&_((0,G.getCursorOffset)(b))},[me,_]);(0,O.useEffect)(()=>{let b=E.current;if(!b)return;let T=z=>{let D=z,B=D.inputType;if(B==="insertParagraph"||B==="insertLineBreak"||B==="insertFromDrop"){z.preventDefault();return}if(B.startsWith("insert")||B.startsWith("delete")){let X=B.startsWith("delete")?"":D.data??"";pe(X)&&z.preventDefault()}};return b.addEventListener("beforeinput",T),()=>b.removeEventListener("beforeinput",T)},[pe]);let pt=(0,O.useCallback)(()=>{Z.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),Ue=(0,O.useCallback)(()=>{Z.current=!1,E.current?.removeAttribute("data-aia-composing"),me()},[me]),Qe=(0,O.useCallback)(b=>{b.preventDefault();let T=E.current;if(!T)return;let z=(b.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!z)return;let D=T.ownerDocument??document,B=D.getSelection();if(!B||B.rangeCount===0)return;let X=B.getRangeAt(0);if(!T.contains(X.startContainer))return;X.deleteContents();let Ie=D.createTextNode(z);X.insertNode(Ie),X.setStartAfter(Ie),X.collapse(!0),B.removeAllRanges(),B.addRange(X),me()},[me]),Me=(0,O.useCallback)(b=>H(b),[H]),ht=(0,O.useCallback)(()=>$(!0),[$]),tt=(0,O.useCallback)(()=>$(!1),[$]),u=(0,O.useCallback)(()=>E.current?.focus(),[]),ut=(0,O.useCallback)(()=>E.current?.blur(),[]),Ye=(0,O.useCallback)(()=>{let b=E.current;return b?(0,G.extractPlainText)(b):""},[]),at=zi()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:at,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":F,"aria-expanded":I,"aria-activedescendant":N,spellCheck:!0,enterKeyHint:"send",onInput:we,onKeyDown:Me,onCompositionStart:pt,onCompositionEnd:Ue,onPaste:Qe,onFocus:ht,onBlur:tt},getPlainText:Ye,focus:u,blur:ut}}var Ge=require("react/jsx-runtime");function Li(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Wa=(0,Q.forwardRef)(function({onSubmit:a,onResult:t,onError:n,optionOverrides:o,maskCompletedText:l,className:s,apiConfig:p,additionalContext:v,language:x,currency:k,productId:g,visitorId:m,analyticsConsent:h,columns:S,pillPlacement:C="dropdown",mode:I="auto",optionsPosition:F="below",animations:N=!0,optionsStyle:re="floating",dropdownTrigger:K,closeDropdownOnBlur:R,focusInputOnSelect:H,startingState:_,prependPlaceholder:ne,allOption:fe,showNonTappableOptions:pe,locationSearch:$,showOptionIcons:E=!0,showChipIcons:Z=!0,showChipImages:Se=!0,showChipRemove:Ce=!1,showOptionImages:he=!0,showOptionCounts:i=!0,showSkipButton:y,showProducts:ue,submitProgress:me,awaitAnswerOnSubmit:we,submitAnswerTimeoutMs:pt,productsLayout:Ue,productImageFallback:Qe,showProductVendor:Me,autoFocus:ht=!0,onFocus:tt,onBlur:u,value:ut,completedParams:Ye,onChange:at,onParamsChange:b,products:T,mapProducts:z,onProductSelect:D,onProductAddToCart:B,submitButton:X,resetOnSubmit:Ie=!0,seeAllResults:Te=!1},je){let be=(0,Q.useRef)(null),$e=(0,Q.useRef)(null),Ne=(0,Q.useRef)(null),mt=(0,Q.useRef)(()=>{}),Ae=(0,Q.useRef)(null),it=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let L=be.current;if(L)return Ae.current?Ae.current.setMode(I):Ae.current=new De.ModeController(L,I),()=>{Ae.current?.destroy(),Ae.current=null}},[I]);let vt=(0,Q.useCallback)(L=>{let He=it.current?.current;He&&(He.focus(),(0,De.setCursorOffset)(He,L))},[]),{completedParams:Pe,suggestionPills:Ee,setActivePill:ot,skipActivePill:r,segments:Y,newParamId:Fe,clearNewParamId:Ke,placeholderText:gt,isFocused:qe,isDropdownOpen:Ze,isActivePillSelected:w,blockingChips:xt,isLoading:nt,isReady:rt,activeIndex:f,listboxId:st,handleTextChange:yt,handleCompositionText:Xe,handleKeyDown:kt,setFocused:St,editingParam:lt,editingIdentified:Ct,editingAnchor:Je,caretOffset:A,startEditingParam:Lt,removeParam:Ot,handleCaretAfterInput:Ut,handleCaretMove:Tt,replaceEditingRange:Dt,dropdownProps:c,reset:J,refreshProducts:V,prepareSubmit:Mt,getState:Nt,getResult:aa,awaitSubmitResult:ia,recordSubmit:oa,holdSubmit:na,endSubmitProgress:ra,getSearchId:sa,getVisitorId:la,refreshAnalyticsConsent:da,isSubmitting:Qt}=_t({onSubmit:L=>mt.current(L),onResult:t,onError:n,optionOverrides:o,maskCompletedText:l,apiConfig:p,additionalContext:v,language:x,currency:k,productId:g,visitorId:m,analyticsConsent:h,columns:S,dropdownTrigger:K,optionsPosition:F,closeDropdownOnBlur:R,focusInputOnSelect:H,startingState:_,prependPlaceholder:ne,allOption:fe,showNonTappableOptions:pe,locationSearch:$,showOptionIcons:E,showOptionImages:he,showOptionCounts:i,showSkipButton:y,showProducts:ue,submitProgress:me,awaitAnswerOnSubmit:we,submitAnswerTimeoutMs:pt,onFocus:tt,onBlur:u,value:ut,completedParams:Ye,onChange:at,onParamsChange:b,products:T,mapProducts:z,onProductSelect:D,onProductAddToCart:B,source:"full-sdk",setCursor:vt});(0,Q.useEffect)(()=>{if(!Fe)return;let L=window.setTimeout(()=>Ke(),650);return()=>window.clearTimeout(L)},[Fe,Ke]);let Ga=(0,Q.useMemo)(()=>xt.map(L=>L.paramId),[xt]),Ka=f>=0?`${st}-option-${f}`:void 0,{inputRef:Pt,editorProps:qa,focus:ca,blur:pa,getPlainText:ha}=Ba({segments:Y,newParamId:Fe,editingParam:lt,editingIdentified:Ct,editingAnchor:Je,caretOffset:A,placeholderText:gt,hintSuggestions:C==="inline"?[]:Ee,isFocused:qe,showChipIcons:Z,showChipImages:Se,showChipRemove:Ce,blockingParamIds:Ga,removeParam:Ot,focusInputOnSelect:H,isDropdownOpen:Ze,listboxId:st,activeDescendantId:Ka,autoFocus:ht,handleTextChange:yt,handleCompositionText:Xe,handleKeyDown:kt,handleCaretAfterInput:Ut,handleCaretMove:Tt,startEditingParam:Lt,replaceEditingRange:Dt,setFocused:St});it.current=Pt,(0,Q.useLayoutEffect)(()=>{let L=$e.current,He=Pt.current;if(!L||!He)return;let bt=()=>{let At=L.firstElementChild;if(!At)return;let ja=At.getBoundingClientRect(),$a=He.getBoundingClientRect();ja.top>=$a.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};bt();let It=new ResizeObserver(bt);return It.observe(He),()=>It.disconnect()},[Y,Ee.length,nt,Pt]),(0,Q.useEffect)(()=>{let L=Ne.current;if(L)return(0,De.watchEditorHeight)(L)},[]),(0,Q.useImperativeHandle)(je,()=>({focus:ca,blur:pa,reset:J,refreshProducts:V,setMode:L=>Ae.current?.setMode(L),skipActivePill:r,endSubmitProgress:ra,getSearchId:sa,getVisitorId:la,refreshAnalyticsConsent:da}),[ca,pa,J,V,r,ra,sa,la,da]);let ft=!!Y.length||Pe.length>0,Ft=(0,Q.useCallback)((L,He)=>{let bt=Nt(),It=(0,De.buildSubmitResult)(ha(),bt.completedParams,bt.skippedParams,{identifiedParams:bt.identifiedParams,isReady:bt.isReady,customFields:He.custom_fields??null,customFieldsStale:He.custom_fields_stale===!0});L&&oa(It);let At=a(It);return L&&!Ie&&na(At),Ie&&J(),At},[oa,na,Ie,Nt,a,J,ha]),Yt=(0,Q.useCallback)(()=>{if(ft&&!Nt().isSubmitting){if(we){ia().then(L=>{L&&Ft(!0,L)});return}Mt(),Ft(!0,aa())}},[ft,Nt,we,ia,Mt,aa,Ft]);mt.current=L=>ft?Ft(!1,L):void 0;let _a=Te&&!c.isInputEmpty&&ft,Va=Yt,Ua=(0,Q.useCallback)(L=>{L.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Pt.current&&(0,De.focusEditorFromTap)(Pt.current)},[Pt]),Qa=C==="inline",Ya=C==="dropdown";return(0,Ge.jsxs)("div",{ref:be,className:`magicx-aia ${wt.container} ${s??""}`,"data-pill-placement":C,"data-options-position":F,"data-animations":N?"on":"off","data-aia-options-style":re,"data-mode":Li(I),children:[(0,Ge.jsx)(Kt,{...c,showPills:Ya,productsLayout:Ue,productImageFallback:Qe,showProductVendor:Me,onSeeAllResults:_a?Va:void 0,fullWidth:Te}),(0,Ge.jsxs)("div",{className:wt.inputWrapper,"data-aia-input-wrapper":"",onClick:Ua,children:[(0,Ge.jsxs)("div",{ref:Ne,className:wt.editorArea,"data-aia-editor":"",children:[(0,Ge.jsx)("div",{...qa,className:wt.input,"data-aia-input":""}),Qa&&(nt||Ee.length>0)&&(0,Ge.jsx)("span",{ref:$e,className:wt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ge.jsx)(Wt,{pills:Ee,activePillIndex:0,activeSelected:w,onSelectPill:ot,loading:nt})})]}),X===null?null:X===void 0?(0,Ge.jsx)(Ma,{disabled:!ft,ready:ft&&rt,busy:Qt,onClick:Yt,label:(0,De.uiStringsFor)(x).submit}):(0,Ge.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Qt?"busy":void 0,"aria-busy":Qt?!0:void 0,className:wt.submitSlot,onClick:L=>{ft&&(L.stopPropagation(),Yt())},children:X})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,focusesInputOnSelect,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isTouchPrimary,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
3979
4003
  //# sourceMappingURL=index.js.map