@magicx-eng/ai-autocomplete-react 0.42.0 → 0.43.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.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { AutocompleteResult, OptionOverrides, APIConfig, CurrencyOptions, AppearanceMode, CompletedParamState, ProductsLayout, ProductImageFallback, ProductsConfig, Product, MatchedItem, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, SkippedParamState, IdentifiedParamState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
1
+ import { AutocompleteResult, OptionOverrides, APIConfig, CurrencyOptions, AppearanceMode, CompletedParamState, ProductsLayout, ProductImageFallback, ProductsConfig, Product, MatchedItem, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, SkippedParamState, IdentifiedParamState, CoreState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
2
2
  export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, CurrencyOptions, CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, DateMonthView, DateRange, ExpressedFilter, FilterOp, FormatType, IdentifiedParam, IdentifiedParamState, MatchedItem, MatchedItems, OptionOverrides, PRODUCT_PATH_PREFIX, Product, ProductImageFallback, ProductsConfig, ProductsLayout, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, formatOptionCount, isoDate, monthLabel, optionCountLabel, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, productFromMatchedItem, productImageSources, productsFromCustomFields, sanitizeOptionIconSvg, selectedRangeFor, visibleDateRange, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
3
3
  import * as react from 'react';
4
4
  import { ReactNode, KeyboardEvent, ChangeEvent } from 'react';
@@ -383,6 +383,10 @@ interface UseAIAutocompleteReturn {
383
383
  * Does nothing without mapProducts or with a custom products integration.
384
384
  */
385
385
  refreshProducts: () => void;
386
+ /** Prepare the typed word before you build a submit result from your own button. */
387
+ prepareSubmit: () => void;
388
+ /** Read the current state, including changes from prepareSubmit(). */
389
+ getState: () => CoreState;
386
390
  /**
387
391
  * Records a submit in telemetry. Enter is recorded by the SDK; call this
388
392
  * from a submit button you render, so each submit is counted once.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AutocompleteResult, OptionOverrides, APIConfig, CurrencyOptions, AppearanceMode, CompletedParamState, ProductsLayout, ProductImageFallback, ProductsConfig, Product, MatchedItem, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, SkippedParamState, IdentifiedParamState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
1
+ import { AutocompleteResult, OptionOverrides, APIConfig, CurrencyOptions, AppearanceMode, CompletedParamState, ProductsLayout, ProductImageFallback, ProductsConfig, Product, MatchedItem, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, SkippedParamState, IdentifiedParamState, CoreState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
2
2
  export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, CurrencyOptions, CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, DateMonthView, DateRange, ExpressedFilter, FilterOp, FormatType, IdentifiedParam, IdentifiedParamState, MatchedItem, MatchedItems, OptionOverrides, PRODUCT_PATH_PREFIX, Product, ProductImageFallback, ProductsConfig, ProductsLayout, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, formatOptionCount, isoDate, monthLabel, optionCountLabel, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, productFromMatchedItem, productImageSources, productsFromCustomFields, sanitizeOptionIconSvg, selectedRangeFor, visibleDateRange, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
3
3
  import * as react from 'react';
4
4
  import { ReactNode, KeyboardEvent, ChangeEvent } from 'react';
@@ -383,6 +383,10 @@ interface UseAIAutocompleteReturn {
383
383
  * Does nothing without mapProducts or with a custom products integration.
384
384
  */
385
385
  refreshProducts: () => void;
386
+ /** Prepare the typed word before you build a submit result from your own button. */
387
+ prepareSubmit: () => void;
388
+ /** Read the current state, including changes from prepareSubmit(). */
389
+ getState: () => CoreState;
386
390
  /**
387
391
  * Records a submit in telemetry. Enter is recorded by the SDK; call this
388
392
  * from a submit button you render, so each submit is counted once.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var xt=Object.defineProperty;var la=Object.getOwnPropertyDescriptor;var da=Object.getOwnPropertyNames;var ca=Object.prototype.hasOwnProperty;var pa=(e,a)=>{for(var t in a)xt(e,t,{get:a[t],enumerable:!0})},ha=(e,a,t,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of da(a))!ca.call(e,o)&&o!==t&&xt(e,o,{get:()=>a[o],enumerable:!(i=la(a,o))||i.enumerable});return e};var ua=e=>ha(xt({},"__esModule",{value:!0}),e);var Ea={};pa(Ea,{AIAutocomplete:()=>ea,AIAutocompleteDropdown:()=>pt,DATE_RANGE_META_END:()=>s.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>s.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>s.DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX:()=>s.PRODUCT_PATH_PREFIX,WEEKDAY_LABELS:()=>s.WEEKDAY_LABELS,buildSubmitResult:()=>s.buildSubmitResult,cellDay:()=>s.cellDay,cellIso:()=>s.cellIso,dateCellMarks:()=>s.dateCellMarks,formatDate:()=>s.formatDate,formatDateRange:()=>s.formatDateRange,formatOptionCount:()=>s.formatOptionCount,isoDate:()=>s.isoDate,monthLabel:()=>s.monthLabel,optionCountLabel:()=>s.optionCountLabel,optionHasImage:()=>s.optionHasImage,optionImageSources:()=>s.optionImageSources,optionImageSrc:()=>s.optionImageSrc,optionLabel:()=>s.optionLabel,optionsShowLeadingVisuals:()=>s.optionsShowLeadingVisuals,parseDate:()=>s.parseDate,parseLooseDate:()=>s.parseLooseDate,parseLooseDateRange:()=>s.parseLooseDateRange,productFromMatchedItem:()=>s.productFromMatchedItem,productImageSources:()=>s.productImageSources,productsFromCustomFields:()=>s.productsFromCustomFields,sanitizeOptionIconSvg:()=>s.sanitizeOptionIconSvg,selectedRangeFor:()=>s.selectedRangeFor,useAIAutocomplete:()=>ut,visibleDateRange:()=>s.visibleDateRange,withSkippedParams:()=>s.withSkippedParams});module.exports=ua(Ea);var s=require("@magicx-eng/ai-autocomplete-vanilla");var H=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 vt=Object.defineProperty;var sa=Object.getOwnPropertyDescriptor;var la=Object.getOwnPropertyNames;var da=Object.prototype.hasOwnProperty;var ca=(e,a)=>{for(var t in a)vt(e,t,{get:a[t],enumerable:!0})},pa=(e,a,t,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of la(a))!da.call(e,o)&&o!==t&&vt(e,o,{get:()=>a[o],enumerable:!(i=sa(a,o))||i.enumerable});return e};var ha=e=>pa(vt({},"__esModule",{value:!0}),e);var Ia={};ca(Ia,{AIAutocomplete:()=>Jt,AIAutocompleteDropdown:()=>dt,DATE_RANGE_META_END:()=>s.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>s.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>s.DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX:()=>s.PRODUCT_PATH_PREFIX,WEEKDAY_LABELS:()=>s.WEEKDAY_LABELS,buildSubmitResult:()=>s.buildSubmitResult,cellDay:()=>s.cellDay,cellIso:()=>s.cellIso,dateCellMarks:()=>s.dateCellMarks,formatDate:()=>s.formatDate,formatDateRange:()=>s.formatDateRange,formatOptionCount:()=>s.formatOptionCount,isoDate:()=>s.isoDate,monthLabel:()=>s.monthLabel,optionCountLabel:()=>s.optionCountLabel,optionHasImage:()=>s.optionHasImage,optionImageSources:()=>s.optionImageSources,optionImageSrc:()=>s.optionImageSrc,optionLabel:()=>s.optionLabel,optionsShowLeadingVisuals:()=>s.optionsShowLeadingVisuals,parseDate:()=>s.parseDate,parseLooseDate:()=>s.parseLooseDate,parseLooseDateRange:()=>s.parseLooseDateRange,productFromMatchedItem:()=>s.productFromMatchedItem,productImageSources:()=>s.productImageSources,productsFromCustomFields:()=>s.productsFromCustomFields,sanitizeOptionIconSvg:()=>s.sanitizeOptionIconSvg,selectedRangeFor:()=>s.selectedRangeFor,useAIAutocomplete:()=>pt,visibleDateRange:()=>s.visibleDateRange,withSkippedParams:()=>s.withSkippedParams});module.exports=ha(Ia);var s=require("@magicx-eng/ai-autocomplete-vanilla");var H=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
@@ -280,7 +280,7 @@
280
280
  opacity: 0;
281
281
  }
282
282
  }
283
- `,document.head.appendChild(e)}var Ue={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaPillReveal:"aia-aiaPillReveal-wf05b"};var ie=require("@magicx-eng/ai-autocomplete-vanilla"),j=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
283
+ `,document.head.appendChild(e)}var qe={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaPillReveal:"aia-aiaPillReveal-wf05b"};var oe=require("@magicx-eng/ai-autocomplete-vanilla"),j=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
284
284
  * Built-in appearance defaults \u2014 zero specificity via :where().
285
285
  * Consumer CSS always wins without !important.
286
286
  *
@@ -1132,7 +1132,7 @@
1132
1132
  opacity: 0.25;
1133
1133
  }
1134
1134
  }
1135
- `,document.head.appendChild(e)}var Ce={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q"};var F=require("@magicx-eng/ai-autocomplete-vanilla"),Lt=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) ---
1135
+ `,document.head.appendChild(e)}var Pe={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q"};var F=require("@magicx-eng/ai-autocomplete-vanilla"),Ot=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) ---
1136
1136
 
1137
1137
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1138
1138
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1295,7 +1295,7 @@
1295
1295
  opacity: 0.8;
1296
1296
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1297
1297
  }
1298
- `,document.head.appendChild(e)}var M={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var ae=require("react/jsx-runtime"),ma=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function zt({options:e,activeIndex:a,listboxId:t,view:i,selection:o,onSelect:r,onHighlight:n,onUnhighlight:p,onPreviousMonth:l,onNextMonth:g}){let k=(0,F.isoDate)(new Date),E=(0,F.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,F.cellIso)(e[a]),selected:o.selectedRange});return(0,ae.jsxs)("div",{className:M.datepicker,"data-aia-datepicker":"",children:[(0,ae.jsxs)("div",{className:M.header,children:[(0,ae.jsx)("button",{type:"button",tabIndex:-1,className:M.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:b=>b.preventDefault(),onClick:l,children:"\u2039"}),(0,ae.jsx)("span",{className:M.month,"data-aia-date-month":"","aria-live":"polite",children:(0,F.monthLabel)(i)}),(0,ae.jsx)("button",{type:"button",tabIndex:-1,className:M.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:b=>b.preventDefault(),onClick:g,children:"\u203A"})]}),(0,ae.jsx)("div",{className:M.weekdays,"aria-hidden":"true",children:F.WEEKDAY_LABELS.map((b,x)=>(0,ae.jsx)("span",{className:M.weekday,children:b},ma[x]))}),(0,ae.jsx)("div",{className:M.grid,"data-aia-date-grid":"",children:e.map((b,x)=>(0,ae.jsx)(ga,{option:b,id:`${t}-option-${x}`,index:x,isHighlighted:x===a&&b.is_tappable,isToday:(0,F.cellIso)(b)===k,isPast:(0,F.cellIso)(b)!=null&&(0,F.cellIso)(b)<k,marks:(0,F.dateCellMarks)((0,F.cellIso)(b),{selectedIso:o.selectedIso,range:E}),onSelect:r,onHighlight:n,onUnhighlight:p},(0,F.cellIso)(b)??`pad-${x}`))})]})}function ga({option:e,id:a,index:t,isHighlighted:i,isToday:o,isPast:r,marks:n,onSelect:p,onHighlight:l,onUnhighlight:g}){let[k,E]=(0,Lt.useState)(!1),b=(0,F.cellDay)(e);if(b==null)return(0,ae.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${M.cell} ${M.blank}`});let x=()=>{E(!0),p(e),setTimeout(()=>E(!1),170)},A=[M.cell,M.day,r?M.past:"",i?M.highlighted:"",o?M.today:"",n.inRange?M.inRange:"",n.selected?M.selected:"",k?M.pressed:""].filter(Boolean).join(" ");return(0,ae.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:A,onClick:x,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),x())},onMouseEnter:()=>l(t),onMouseLeave:g?()=>g(t):void 0,children:(0,ae.jsx)("span",{className:M.number,children:b})})}var He=require("@magicx-eng/ai-autocomplete-vanilla"),st=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 {
1298
+ `,document.head.appendChild(e)}var M={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var ie=require("react/jsx-runtime"),ua=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Dt({options:e,activeIndex:a,listboxId:t,view:i,selection:o,onSelect:r,onHighlight:n,onUnhighlight:p,onPreviousMonth:l,onNextMonth:g}){let k=(0,F.isoDate)(new Date),E=(0,F.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,F.cellIso)(e[a]),selected:o.selectedRange});return(0,ie.jsxs)("div",{className:M.datepicker,"data-aia-datepicker":"",children:[(0,ie.jsxs)("div",{className:M.header,children:[(0,ie.jsx)("button",{type:"button",tabIndex:-1,className:M.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:b=>b.preventDefault(),onClick:l,children:"\u2039"}),(0,ie.jsx)("span",{className:M.month,"data-aia-date-month":"","aria-live":"polite",children:(0,F.monthLabel)(i)}),(0,ie.jsx)("button",{type:"button",tabIndex:-1,className:M.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:b=>b.preventDefault(),onClick:g,children:"\u203A"})]}),(0,ie.jsx)("div",{className:M.weekdays,"aria-hidden":"true",children:F.WEEKDAY_LABELS.map((b,y)=>(0,ie.jsx)("span",{className:M.weekday,children:b},ua[y]))}),(0,ie.jsx)("div",{className:M.grid,"data-aia-date-grid":"",children:e.map((b,y)=>(0,ie.jsx)(ma,{option:b,id:`${t}-option-${y}`,index:y,isHighlighted:y===a&&b.is_tappable,isToday:(0,F.cellIso)(b)===k,isPast:(0,F.cellIso)(b)!=null&&(0,F.cellIso)(b)<k,marks:(0,F.dateCellMarks)((0,F.cellIso)(b),{selectedIso:o.selectedIso,range:E}),onSelect:r,onHighlight:n,onUnhighlight:p},(0,F.cellIso)(b)??`pad-${y}`))})]})}function ma({option:e,id:a,index:t,isHighlighted:i,isToday:o,isPast:r,marks:n,onSelect:p,onHighlight:l,onUnhighlight:g}){let[k,E]=(0,Ot.useState)(!1),b=(0,F.cellDay)(e);if(b==null)return(0,ie.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${M.cell} ${M.blank}`});let y=()=>{E(!0),p(e),setTimeout(()=>E(!1),170)},A=[M.cell,M.day,r?M.past:"",i?M.highlighted:"",o?M.today:"",n.inRange?M.inRange:"",n.selected?M.selected:"",k?M.pressed:""].filter(Boolean).join(" ");return(0,ie.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:A,onClick:y,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),y())},onMouseEnter:()=>l(t),onMouseLeave:g?()=>g(t):void 0,children:(0,ie.jsx)("span",{className:M.number,children:b})})}var Ne=require("@magicx-eng/ai-autocomplete-vanilla"),nt=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 {
1299
1299
  display: flex;
1300
1300
  flex-wrap: wrap;
1301
1301
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1335,7 +1335,7 @@
1335
1335
  .aia-cluster[data-justify="around"] {
1336
1336
  justify-content: space-around;
1337
1337
  }
1338
- `,document.head.appendChild(e)}var yt=require("react/jsx-runtime");function Je({gap:e,align:a="center",justify:t="start",noWrap:i=!1,inline:o=!1,className:r,children:n,...p}){let l=e?{"--aia-cluster-gap":e}:void 0,g={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":i||void 0,"data-inline":o||void 0,style:l,...p};return o?(0,yt.jsx)("span",{...g,children:n}):(0,yt.jsx)("div",{...g,children:n})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
1338
+ `,document.head.appendChild(e)}var xt=require("react/jsx-runtime");function Xe({gap:e,align:a="center",justify:t="start",noWrap:i=!1,inline:o=!1,className:r,children:n,...p}){let l=e?{"--aia-cluster-gap":e}:void 0,g={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":i||void 0,"data-inline":o||void 0,style:l,...p};return o?(0,xt.jsx)("span",{...g,children:n}):(0,xt.jsx)("div",{...g,children:n})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
1339
1339
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1340
1340
  room above the hint/branding row so the footer doesn't butt against the last
1341
1341
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1482,7 +1482,7 @@
1482
1482
  justify-content: flex-end;
1483
1483
  }
1484
1484
  }
1485
- `,document.head.appendChild(e)}var Se={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var ge=require("react/jsx-runtime");function Mt({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,He.uiStringsFor)()}){let{key:i,hint:o}=(0,He.getFooterHint)(e,a,t),[r,n]=(0,st.useState)(He.ATTRIBUTION_URL);return(0,st.useEffect)(()=>{n((0,He.buildAttributionUrl)())},[]),(0,ge.jsx)("footer",{className:Se.footer,"data-aia-footer":"",children:(0,ge.jsxs)(Je,{justify:"between",noWrap:!0,className:Se.row,children:[(0,ge.jsxs)(Je,{gap:"5px",className:Se.hintGroup,children:[(0,ge.jsx)("kbd",{className:Se.key,children:i}),(0,ge.jsx)("span",{className:Se.hint,children:o})]}),(0,ge.jsxs)("a",{className:Se.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[(0,ge.jsx)("span",{className:Se.brand,children:"AI"}),(0,ge.jsx)("span",{className:Se.badge,children:"Autocomplete"})]})]})})}var lt=require("@magicx-eng/ai-autocomplete-vanilla");var Nt=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,
1485
+ `,document.head.appendChild(e)}var Ie={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 me=require("react/jsx-runtime");function Lt({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,Ne.uiStringsFor)()}){let{key:i,hint:o}=(0,Ne.getFooterHint)(e,a,t),[r,n]=(0,nt.useState)(Ne.ATTRIBUTION_URL);return(0,nt.useEffect)(()=>{n((0,Ne.buildAttributionUrl)())},[]),(0,me.jsx)("footer",{className:Ie.footer,"data-aia-footer":"",children:(0,me.jsxs)(Xe,{justify:"between",noWrap:!0,className:Ie.row,children:[(0,me.jsxs)(Xe,{gap:"5px",className:Ie.hintGroup,children:[(0,me.jsx)("kbd",{className:Ie.key,children:i}),(0,me.jsx)("span",{className:Ie.hint,children:o})]}),(0,me.jsxs)("a",{className:Ie.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[(0,me.jsx)("span",{className:Ie.brand,children:"AI"}),(0,me.jsx)("span",{className:Ie.badge,children:"Autocomplete"})]})]})})}var rt=require("@magicx-eng/ai-autocomplete-vanilla");var zt=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,
1486
1486
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1487
1487
  The border is kept as a 1px transparent line so the box stays the same size
1488
1488
  as it was when the outline was dashed. */
@@ -1662,7 +1662,7 @@
1662
1662
  opacity: 0;
1663
1663
  }
1664
1664
  }
1665
- `,document.head.appendChild(e)}var fe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var Be=require("react/jsx-runtime"),kt={selected:1,first:.7,next:.4,last:.2};function Ft({label:e,state:a,rounded:t,loading:i,smartSuggestion:o,completionHeader:r,onClick:n}){let p=[fe.pill,t?fe.rounded:"",i?fe.skeleton:""].filter(Boolean).join(" ");return(0,Be.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":o?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:p,style:{opacity:kt[a]},onMouseDown:l=>l.preventDefault(),onClick:i?void 0:n,disabled:i,children:o?(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)("span",{className:`${fe.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,Be.jsx)("span",{className:`${fe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Nt.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 {
1665
+ `,document.head.appendChild(e)}var ge={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var Fe=require("react/jsx-runtime"),yt={selected:1,first:.7,next:.4,last:.2};function Mt({label:e,state:a,rounded:t,loading:i,smartSuggestion:o,completionHeader:r,onClick:n}){let p=[ge.pill,t?ge.rounded:"",i?ge.skeleton:""].filter(Boolean).join(" ");return(0,Fe.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":o?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:p,style:{opacity:yt[a]},onMouseDown:l=>l.preventDefault(),onClick:i?void 0:n,disabled:i,children:o?(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("span",{className:`${ge.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,Fe.jsx)("span",{className:`${ge.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:zt.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 {
1666
1666
  position: relative;
1667
1667
  z-index: 1;
1668
1668
  pointer-events: auto;
@@ -1672,7 +1672,7 @@
1672
1672
  align-items: center;
1673
1673
  vertical-align: middle;
1674
1674
  }
1675
- `,document.head.appendChild(e)}var Ct={list:"aia-list-qvLqO"};var et=require("react/jsx-runtime"),fa=[125,69];function Ht(e){return e===0?"first":e===1?"next":"last"}function dt({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:i,rounded:o,loading:r}){return r&&e.length===0?(0,et.jsx)("span",{className:Ct.list,"data-aia-pill-list-loading":"",children:fa.map((n,p)=>(0,et.jsx)("span",{"data-aia-pill-skeleton":"",className:`${fe.pill} ${o?fe.rounded:""} ${fe.skeleton}`,style:{width:n,opacity:kt[Ht(p)]}},`skel-${n}`))}):(0,et.jsx)("span",{className:Ct.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((n,p)=>{let l=!!i&&p===a;return(0,et.jsx)(Ft,{label:n.text,state:l?"selected":Ht(p),selected:l,rounded:o,loading:r,smartSuggestion:(0,lt.isSmartSuggestion)(n),completionHeader:(0,lt.isTraditionalAutocompleteSuggestion)(n),onClick:()=>t(p)},`${n.parameter}-${n.text}`)})})}var be=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
1675
+ `,document.head.appendChild(e)}var kt={list:"aia-list-qvLqO"};var Je=require("react/jsx-runtime"),ga=[125,69];function Nt(e){return e===0?"first":e===1?"next":"last"}function st({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:i,rounded:o,loading:r}){return r&&e.length===0?(0,Je.jsx)("span",{className:kt.list,"data-aia-pill-list-loading":"",children:ga.map((n,p)=>(0,Je.jsx)("span",{"data-aia-pill-skeleton":"",className:`${ge.pill} ${o?ge.rounded:""} ${ge.skeleton}`,style:{width:n,opacity:yt[Nt(p)]}},`skel-${n}`))}):(0,Je.jsx)("span",{className:kt.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((n,p)=>{let l=!!i&&p===a;return(0,Je.jsx)(Mt,{label:n.text,state:l?"selected":Nt(p),selected:l,rounded:o,loading:r,smartSuggestion:(0,rt.isSmartSuggestion)(n),completionHeader:(0,rt.isTraditionalAutocompleteSuggestion)(n),onClick:()=>t(p)},`${n.parameter}-${n.text}`)})})}var fe=require("@magicx-eng/ai-autocomplete-vanilla"),Ue=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
1676
1676
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1677
1677
  theming one package sees the same result in the other.
1678
1678
 
@@ -1975,7 +1975,7 @@
1975
1975
  letter-spacing: 0.02em;
1976
1976
  text-align: center;
1977
1977
  }
1978
- `,document.head.appendChild(e)}var re={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",badge:"aia-badge-j9Hcd"};var Q=require("react/jsx-runtime");function Bt({products:e,listboxId:a,onSelect:t,onFocusChange:i,focusable:o=!0,layout:r="row",imageFallback:n="image",strings:p=(0,be.uiStringsFor)()}){let l=e.length>0,g=(0,Ve.useRef)(null);if((0,Ve.useEffect)(()=>{let E=g.current;if(!(!l||!E))return(0,be.attachProductRowWheel)(E)},[l]),!l)return null;let k=`${a}-products-label`;return(0,Q.jsxs)("section",{className:re.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":k,children:[(0,Q.jsx)("div",{className:re.label,id:k,"data-aia-products-label":"",children:p.products}),(0,Q.jsx)("div",{ref:g,className:re.row,"data-aia-products-row":"",children:e.map((E,b)=>(0,Q.jsx)(ba,{product:E,id:`${a}-product-${b}`,onSelect:t,onFocusChange:i,focusable:o,imageFallback:n,soldOut:p.soldOut},E.id))})]})}function ba({product:e,id:a,onSelect:t,onFocusChange:i,focusable:o,imageFallback:r,soldOut:n}){let p=l=>{l.metaKey||l.ctrlKey||l.shiftKey||l.altKey||l.button!==0||(l.preventDefault(),t(e))};return(0,Q.jsxs)("a",{id:a,className:re.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,role:"option","aria-selected":!1,href:e.url,tabIndex:o?0:-1,onClick:p,onKeyDown:l=>{l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),t(e))},onFocus:()=>i?.(!0),onBlur:l=>{l.relatedTarget?.closest("[data-aia-dropdown]")||i?.(!1)},children:[(0,Q.jsx)(wa,{sources:(0,be.productImageSources)(e.imageUrl),title:e.title,fallback:r},(0,be.productImageSrc)(e.imageUrl)??""),(0,Q.jsxs)("span",{className:re.body,children:[e.vendor?(0,Q.jsx)("span",{className:re.vendor,children:e.vendor}):null,(0,Q.jsx)("span",{className:re.title,children:e.title}),e.price?(0,Q.jsx)("span",{className:re.price,children:e.price}):null,e.available===!1?(0,Q.jsx)("span",{className:re.badge,children:n}):null]})]})}function wa({sources:e,title:a,fallback:t}){let[i,o]=(0,Ve.useState)(0),r=e[i],n=!!r,[p,l]=(0,Ve.useState)(null),g=!n&&t==="initial";return(0,Q.jsxs)("span",{className:re.media,"aria-hidden":"true","data-aia-product-placeholder":!n&&!g?"":void 0,"data-aia-product-initial":g?"":void 0,"data-aia-image-loaded":n&&p===r?"":void 0,children:[n?(0,Q.jsx)("img",{className:re.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:()=>l(r),onError:()=>o(k=>k+1)}):null,g?(0,be.productInitial)(a):null]})}var _=require("@magicx-eng/ai-autocomplete-vanilla"),we=require("react");var Kt=require("@magicx-eng/ai-autocomplete-vanilla"),ct=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 {
1978
+ `,document.head.appendChild(e)}var se={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",badge:"aia-badge-j9Hcd"};var Z=require("react/jsx-runtime");function Ft({products:e,listboxId:a,onSelect:t,onFocusChange:i,focusable:o=!0,layout:r="row",imageFallback:n="image",strings:p=(0,fe.uiStringsFor)()}){let l=e.length>0,g=(0,Ue.useRef)(null);if((0,Ue.useEffect)(()=>{let E=g.current;if(!(!l||!E))return(0,fe.attachProductRowWheel)(E)},[l]),!l)return null;let k=`${a}-products-label`;return(0,Z.jsxs)("section",{className:se.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":k,children:[(0,Z.jsx)("div",{className:se.label,id:k,"data-aia-products-label":"",children:p.products}),(0,Z.jsx)("div",{ref:g,className:se.row,"data-aia-products-row":"",children:e.map((E,b)=>(0,Z.jsx)(fa,{product:E,id:`${a}-product-${b}`,onSelect:t,onFocusChange:i,focusable:o,imageFallback:n,soldOut:p.soldOut},E.id))})]})}function fa({product:e,id:a,onSelect:t,onFocusChange:i,focusable:o,imageFallback:r,soldOut:n}){let p=l=>{l.metaKey||l.ctrlKey||l.shiftKey||l.altKey||l.button!==0||(l.preventDefault(),t(e))};return(0,Z.jsxs)("a",{id:a,className:se.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,role:"option","aria-selected":!1,href:e.url,tabIndex:o?0:-1,onClick:p,onKeyDown:l=>{l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),t(e))},onFocus:()=>i?.(!0),onBlur:l=>{l.relatedTarget?.closest("[data-aia-dropdown]")||i?.(!1)},children:[(0,Z.jsx)(ba,{sources:(0,fe.productImageSources)(e.imageUrl),title:e.title,fallback:r},(0,fe.productImageSrc)(e.imageUrl)??""),(0,Z.jsxs)("span",{className:se.body,children:[e.vendor?(0,Z.jsx)("span",{className:se.vendor,children:e.vendor}):null,(0,Z.jsx)("span",{className:se.title,children:e.title}),e.price?(0,Z.jsx)("span",{className:se.price,children:e.price}):null,e.available===!1?(0,Z.jsx)("span",{className:se.badge,children:n}):null]})]})}function ba({sources:e,title:a,fallback:t}){let[i,o]=(0,Ue.useState)(0),r=e[i],n=!!r,[p,l]=(0,Ue.useState)(null),g=!n&&t==="initial";return(0,Z.jsxs)("span",{className:se.media,"aria-hidden":"true","data-aia-product-placeholder":!n&&!g?"":void 0,"data-aia-product-initial":g?"":void 0,"data-aia-image-loaded":n&&p===r?"":void 0,children:[n?(0,Z.jsx)("img",{className:se.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:()=>l(r),onError:()=>o(k=>k+1)}):null,g?(0,fe.productInitial)(a):null]})}var _=require("@magicx-eng/ai-autocomplete-vanilla"),be=require("react");var Ht=require("@magicx-eng/ai-autocomplete-vanilla"),lt=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 {
1979
1979
  display: grid;
1980
1980
  grid-template-columns: repeat(
1981
1981
  auto-fit,
@@ -2011,7 +2011,7 @@
2011
2011
  .aia-grid[data-scroll]::-webkit-scrollbar {
2012
2012
  display: none;
2013
2013
  }
2014
- `,document.head.appendChild(e)}var Wt=require("react/jsx-runtime");function Gt({min:e="16rem",max:a,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:r,cols:n,template:p,innerRef:l,className:g,children:k,...E}){let b=(0,ct.useRef)(null);(0,ct.useLayoutEffect)(()=>{if(r===void 0)return;let A=b.current;A&&(A.scrollTop=0)},[r]);let x={"--aia-grid-min":e};return a&&(x["--aia-grid-max"]=a),t&&(x["--aia-grid-gap"]=t),o&&(x["--aia-grid-max-height"]=o),n&&(x.gridTemplateColumns=(0,Kt.optionsGridTemplateColumns)(n)),p&&(x.gridTemplateColumns=p),(0,Wt.jsx)("div",{ref:A=>{b.current=A,l?.(A)},className:g?`aia-grid ${g}`:"aia-grid","data-scroll":i||void 0,style:x,...E,children:k})}var oe=require("@magicx-eng/ai-autocomplete-vanilla"),pe=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 {
2014
+ `,document.head.appendChild(e)}var Kt=require("react/jsx-runtime");function Bt({min:e="16rem",max:a,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:r,cols:n,template:p,innerRef:l,className:g,children:k,...E}){let b=(0,lt.useRef)(null);(0,lt.useLayoutEffect)(()=>{if(r===void 0)return;let A=b.current;A&&(A.scrollTop=0)},[r]);let y={"--aia-grid-min":e};return a&&(y["--aia-grid-max"]=a),t&&(y["--aia-grid-gap"]=t),o&&(y["--aia-grid-max-height"]=o),n&&(y.gridTemplateColumns=(0,Ht.optionsGridTemplateColumns)(n)),p&&(y.gridTemplateColumns=p),(0,Kt.jsx)("div",{ref:A=>{b.current=A,l?.(A)},className:g?`aia-grid ${g}`:"aia-grid","data-scroll":i||void 0,style:y,...E,children:k})}var ne=require("@magicx-eng/ai-autocomplete-vanilla"),ce=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 {
2015
2015
  position: relative;
2016
2016
  /* Clip, not visible: the entrance rise below runs on the inner content,
2017
2017
  and a transformed box extends its scroll container's scrollable area.
@@ -2469,7 +2469,7 @@
2469
2469
  opacity: 0;
2470
2470
  }
2471
2471
  }
2472
- `,document.head.appendChild(e)}var Z={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd"};var $=require("react/jsx-runtime");function _t({option:e,isHighlighted:a,onSelect:t,onHighlight:i,onUnhighlight:o,id:r,loading:n,showIcon:p=!0,showImage:l=!0,showCount:g=!0,scrollHint:k,enterDelayMs:E=0}){let[b]=(0,pe.useState)(E),[x,A]=(0,pe.useState)(!1),R=l?(0,oe.optionImageSources)(e.image_url):[],B=R[0]??null,[Y,X]=(0,pe.useState)([]),T=R.find(O=>!Y.includes(O))??null,[z,K]=(0,pe.useState)(null),C=(0,pe.useMemo)(()=>!B&&p&&e.icon_svg?(0,oe.sanitizeOptionIconSvg)(e.icon_svg):null,[B,p,e.icon_svg]),J=g?(0,oe.formatOptionCount)(e.item_count):null,W=(0,pe.useRef)(void 0);(0,pe.useEffect)(()=>()=>clearTimeout(W.current),[]);let V=()=>{n||!e.is_tappable||x||(A(!0),t(e),clearTimeout(W.current),W.current=setTimeout(()=>A(!1),170))},se=[Z.item,a&&!n?Z.highlighted:"",e.is_tappable?Z.tappable:Z.nonTappable,x?Z.pressed:"",k?Z.scrollHint:""].filter(Boolean).join(" ");return(0,$.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":n?"":void 0,"data-aia-icon":C&&e.icon?e.icon:void 0,"data-aia-image":B?"":void 0,"data-aia-item-count":J!==null?e.item_count:void 0,"aria-selected":a,className:se,style:{[oe.OPTION_ENTER_DELAY_VAR]:`${b}ms`},tabIndex:n||!e.is_tappable?-1:0,onClick:V,onKeyDown:O=>{!n&&e.is_tappable&&(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),V())},onMouseEnter:!n&&e.is_tappable?i:void 0,onMouseLeave:o,children:(0,$.jsxs)("span",{className:Z.content,children:[B&&(0,$.jsx)("span",{className:`${Z.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":T!==null&&z===T?"":void 0,children:(0,$.jsx)("img",{src:T??B,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:T===null,onLoad:()=>K(T),onError:()=>{T!==null&&X(O=>[...O,T])}})}),C&&(0,$.jsx)("span",{className:`${Z.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:C}}),(0,$.jsxs)("span",{className:Z.text,children:[e.matchedText?(0,oe.highlightParts)((0,oe.optionLabel)(e),e.matchedText).map((O,ee)=>O.bold?(0,$.jsx)("strong",{className:`${Z.match} magicx-aia-option-match`,children:O.text},ee):O.text):(0,oe.optionLabel)(e),e.parameterLabel&&(0,$.jsxs)($.Fragment,{children:[" ",(0,$.jsx)("span",{className:`${Z.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,$.jsx)("span",{className:Z.tag,children:e.tag}),J!==null&&(0,$.jsx)("span",{className:`${Z.count} magicx-aia-option-count`,children:J})]})})}var St=require("react/jsx-runtime");function va(){let[e,a]=(0,we.useState)(_.isOptionsGridMobileViewport);return(0,we.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(_.OPTIONS_GRID_MOBILE_QUERY),i=()=>a(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function qt({options:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n,groupKey:p="",optionsPosition:l="below",showIcons:g=!0,showImages:k=!0,showCounts:E=!0}){let b=va(),x=(0,we.useRef)(null),[A,R]=(0,we.useState)(null),B=(0,we.useRef)(null);(0,we.useLayoutEffect)(()=>{if(n&&(0,_.sameOptionRows)(B.current,e))return;B.current=n?null:e;let T=x.current,K=T&&!n&&(0,_.needsOptionsGridMeasurement)(e.length,b)?(0,_.measureOptionsGrid)(T):null;R(K?(0,_.planOptionsGrid)(e.length,b,K.rowWidths,K.gridWidth):null)},[e,b,n]);let Y=A??(0,_.planOptionsGrid)(e.length,b,null,null),X=(0,_.optionsShowLeadingVisuals)(e,g,k);return(0,St.jsx)(Gt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:p,template:Y.template,maxHeight:Y.maxHeight,innerRef:T=>{x.current=T},"data-aia-group":p,children:e.map((T,z)=>(0,St.jsx)(_t,{option:T,isHighlighted:z===a,onSelect:t,onHighlight:()=>i(z),onUnhighlight:o?()=>o(z):void 0,id:`${r}-option-${z}`,loading:n,showIcon:g&&X,showImage:k&&X,showCount:E,scrollHint:!n&&Y.scrollHintIndices.includes(z),enterDelayMs:n?0:(0,_.optionEnterDelayMs)(z,Y.cols,e.length,l)},`${p}\0${T.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
2472
+ `,document.head.appendChild(e)}var $={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd"};var X=require("react/jsx-runtime");function Gt({option:e,isHighlighted:a,onSelect:t,onHighlight:i,onUnhighlight:o,id:r,loading:n,showIcon:p=!0,showImage:l=!0,showCount:g=!0,scrollHint:k,enterDelayMs:E=0}){let[b]=(0,ce.useState)(E),[y,A]=(0,ce.useState)(!1),R=l?(0,ne.optionImageSources)(e.image_url):[],B=R[0]??null,[Y,J]=(0,ce.useState)([]),T=R.find(L=>!Y.includes(L))??null,[z,K]=(0,ce.useState)(null),C=(0,ce.useMemo)(()=>!B&&p&&e.icon_svg?(0,ne.sanitizeOptionIconSvg)(e.icon_svg):null,[B,p,e.icon_svg]),ee=g?(0,ne.formatOptionCount)(e.item_count):null,W=(0,ce.useRef)(void 0);(0,ce.useEffect)(()=>()=>clearTimeout(W.current),[]);let V=()=>{n||!e.is_tappable||y||(A(!0),t(e),clearTimeout(W.current),W.current=setTimeout(()=>A(!1),170))},le=[$.item,a&&!n?$.highlighted:"",e.is_tappable?$.tappable:$.nonTappable,y?$.pressed:"",k?$.scrollHint:""].filter(Boolean).join(" ");return(0,X.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":n?"":void 0,"data-aia-icon":C&&e.icon?e.icon:void 0,"data-aia-image":B?"":void 0,"data-aia-item-count":ee!==null?e.item_count:void 0,"aria-selected":a,className:le,style:{[ne.OPTION_ENTER_DELAY_VAR]:`${b}ms`},tabIndex:n||!e.is_tappable?-1:0,onClick:V,onKeyDown:L=>{!n&&e.is_tappable&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),V())},onMouseEnter:!n&&e.is_tappable?i:void 0,onMouseLeave:o,children:(0,X.jsxs)("span",{className:$.content,children:[B&&(0,X.jsx)("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":T!==null&&z===T?"":void 0,children:(0,X.jsx)("img",{src:T??B,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:T===null,onLoad:()=>K(T),onError:()=>{T!==null&&J(L=>[...L,T])}})}),C&&(0,X.jsx)("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:C}}),(0,X.jsxs)("span",{className:$.text,children:[e.matchedText?(0,ne.highlightParts)((0,ne.optionLabel)(e),e.matchedText).map((L,te)=>L.bold?(0,X.jsx)("strong",{className:`${$.match} magicx-aia-option-match`,children:L.text},te):L.text):(0,ne.optionLabel)(e),e.parameterLabel&&(0,X.jsxs)(X.Fragment,{children:[" ",(0,X.jsx)("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,X.jsx)("span",{className:$.tag,children:e.tag}),ee!==null&&(0,X.jsx)("span",{className:`${$.count} magicx-aia-option-count`,children:ee})]})})}var Ct=require("react/jsx-runtime");function wa(){let[e,a]=(0,be.useState)(_.isOptionsGridMobileViewport);return(0,be.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(_.OPTIONS_GRID_MOBILE_QUERY),i=()=>a(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function Wt({options:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n,groupKey:p="",optionsPosition:l="below",showIcons:g=!0,showImages:k=!0,showCounts:E=!0}){let b=wa(),y=(0,be.useRef)(null),[A,R]=(0,be.useState)(null),B=(0,be.useRef)(null);(0,be.useLayoutEffect)(()=>{if(n&&(0,_.sameOptionRows)(B.current,e))return;B.current=n?null:e;let T=y.current,K=T&&!n&&(0,_.needsOptionsGridMeasurement)(e.length,b)?(0,_.measureOptionsGrid)(T):null;R(K?(0,_.planOptionsGrid)(e.length,b,K.rowWidths,K.gridWidth):null)},[e,b,n]);let Y=A??(0,_.planOptionsGrid)(e.length,b,null,null),J=(0,_.optionsShowLeadingVisuals)(e,g,k);return(0,Ct.jsx)(Bt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:p,template:Y.template,maxHeight:Y.maxHeight,innerRef:T=>{y.current=T},"data-aia-group":p,children:e.map((T,z)=>(0,Ct.jsx)(Gt,{option:T,isHighlighted:z===a,onSelect:t,onHighlight:()=>i(z),onUnhighlight:o?()=>o(z):void 0,id:`${r}-option-${z}`,loading:n,showIcon:g&&J,showImage:k&&J,showCount:E,scrollHint:!n&&Y.scrollHintIndices.includes(z),enterDelayMs:n?0:(0,_.optionEnterDelayMs)(z,Y.cols,e.length,l)},`${p}\0${T.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
2473
2473
  display: flex;
2474
2474
  flex-direction: column;
2475
2475
  gap: var(--aia-stack-space, 0.5rem);
@@ -2484,7 +2484,7 @@
2484
2484
  align-items: end;
2485
2485
  }
2486
2486
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
2487
- `,document.head.appendChild(e)}var Vt=require("react/jsx-runtime");function Ut({space:e,align:a="stretch",className:t,children:i,...o}){let r=e?{"--aia-stack-space":e}:void 0;return(0,Vt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:r,...o,children:i})}var q=require("react/jsx-runtime"),xa=[159,119,164],ya=()=>{},jt=()=>{};function ka(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,j.useState)(a);if((0,j.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>i(o.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Ca(e,a){let t=(0,j.useRef)(null);(0,j.useEffect)(()=>{let i=e.current,o=a.current;if(!i||!o)return;let r=i.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:(0,ie.attachScrollArrow)({dropdown:i,grid:r,button:o})};return}t.current?.controller.update()}),(0,j.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Sa(e,a){let t=(0,j.useRef)(a);t.current=a;let i=(0,j.useRef)(null);(0,j.useEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,ie.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),(0,j.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function pt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:r,id:n,className:p,pills:l,onPillClick:g,showPills:k=!0,onSkip:E,showSkipButton:b=!0,showOptionIcons:x=!0,showOptionImages:A=!0,showOptionCounts:R=!0,skipDisabled:B=!1,activeSelected:Y=!1,isLoading:X=!1,skeletonExiting:T=!1,isInputEmpty:z=!1,language:K,products:C,onProductSelect:J,onProductFocusChange:W,productsLayout:V="row",productImageFallback:se="image",formatType:O="options",dateView:ee=null,selectedDateIso:ve=null,selectedDateRange:Pe=null,dateRangeStart:We=null,onPreviousMonth:Ie,onNextMonth:m,optionsPosition:Te="below",mode:Ee}){let xe=ka(Ee),Ae=xe!==void 0,ne=(0,j.useRef)(null),ye=(0,j.useRef)(null);Ca(ne,ye),(0,j.useEffect)(()=>{if(ne.current)return(0,ie.containScroll)(ne.current)},[]);let d=e[0]?.options??[],f=!!(l&&l.length>0&&g),w=!!(C&&C.length>0),v=r&&(d.length>0||k&&f||X||w);Sa(ne,v);let S={suggestions:e,activeIndex:a,pills:l,showPills:k,showSkipButton:b,showOptionIcons:x,showOptionImages:A,showOptionCounts:R,skipDisabled:B,activeSelected:Y,isLoading:X,skeletonExiting:T,isInputEmpty:z,products:C,formatType:O,dateView:ee,selectedDateIso:ve,selectedDateRange:Pe,dateRangeStart:We},N=(0,j.useRef)(S);v&&(N.current=S);let h=v?S:N.current,G=(0,ie.uiStringsFor)(K),le=h.suggestions[0],de=le?.options??[],Re=h.activeIndex>=0&&!!de[h.activeIndex]?.is_tappable,ce=(0,ie.labelTraditionalAutocomplete)(h.pills??[],G.keepTyping),Oe=!!(ce.length>0&&g),De=h.showPills&&Oe,Le=h.showPills&&!Oe&&h.isLoading,ze=De||Le,y=Oe&&(0,ie.hasSkippablePill)(ce)&&h.showSkipButton&&!h.isInputEmpty&&!!E,Me=ce[0]?.text,Ne=(0,ie.isCalendarFormat)(h.formatType)&&h.dateView!=null,ke=de.length>0&&!Ne,u=de.length>0&&Ne&&!h.isLoading,je=h.isLoading&&!ke&&!u,Ye=h.products??[];return(0,q.jsxs)("div",{ref:ne,id:n,role:"listbox","data-aia-dropdown":"","data-options-position":Te,"data-mode":xe,"data-aia-loading":h.isLoading?"":void 0,"data-aia-skeleton-exiting":h.skeletonExiting?"":void 0,"data-aia-has-products":Ye.length>0?"":void 0,className:`${Ae?"magicx-aia ":""}${Ce.dropdown} ${v?Ce.visible:""} ${p??""}`,onMouseDown:ue=>ue.preventDefault(),children:[(0,q.jsxs)(Ut,{space:"8px",children:[(ze||y)&&(0,q.jsxs)(Je,{noWrap:!0,className:Ce.pillBar,"data-aia-pillbar":"",children:[ze&&(0,q.jsx)("span",{className:Ce.pillScroll,"data-aia-pill-scroll":"",children:(0,q.jsx)(dt,{pills:ce,activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:g??(()=>{}),rounded:!0,loading:h.isLoading})}),y&&(0,q.jsx)("button",{type:"button",tabIndex:-1,className:Ce.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":Me?`${G.skipLabel} ${Me}`:G.skipLabel,onClick:E,children:G.skip})]}),ke&&(0,q.jsx)(qt,{options:de,activeIndex:h.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:n,loading:h.isLoading,groupKey:le?`${le.parameter} ${le.text}`:"",optionsPosition:Te,showIcons:h.showOptionIcons,showImages:h.showOptionImages,showCounts:h.showOptionCounts}),u&&h.dateView&&(0,q.jsx)(zt,{options:de,activeIndex:h.activeIndex,listboxId:n,view:h.dateView,selection:{selectedIso:h.selectedDateIso??null,selectedRange:h.selectedDateRange??null,rangeStart:h.dateRangeStart??null},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:Ie??jt,onNextMonth:m??jt}),je&&(0,q.jsx)("div",{className:Ce.skeletonBars,"data-aia-skeleton-bars":"",children:xa.map(ue=>(0,q.jsx)("span",{className:Ce.skeletonBar,style:{width:ue}},`bar-${ue}`))}),(0,q.jsx)(Bt,{products:Ye,listboxId:n,onSelect:J??ya,onFocusChange:W,focusable:v,layout:V,imageFallback:se,strings:G}),(0,q.jsx)(Mt,{isOptionHighlighted:Re,isInputEmpty:h.isInputEmpty,strings:G})]}),(0,q.jsx)("button",{ref:ye,type:"button",tabIndex:-1,className:Ce.scrollArrow,"data-aia-scroll-arrow":"","aria-label":G.scrollArrow,"aria-hidden":"true",children:(0,q.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,q.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Ge=require("@magicx-eng/ai-autocomplete-vanilla");var Qt=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 {
2487
+ `,document.head.appendChild(e)}var qt=require("react/jsx-runtime");function _t({space:e,align:a="stretch",className:t,children:i,...o}){let r=e?{"--aia-stack-space":e}:void 0;return(0,qt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:r,...o,children:i})}var q=require("react/jsx-runtime"),va=[159,119,164],xa=()=>{},Ut=()=>{};function ya(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,j.useState)(a);if((0,j.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>i(o.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ka(e,a){let t=(0,j.useRef)(null);(0,j.useEffect)(()=>{let i=e.current,o=a.current;if(!i||!o)return;let r=i.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:(0,oe.attachScrollArrow)({dropdown:i,grid:r,button:o})};return}t.current?.controller.update()}),(0,j.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ca(e,a){let t=(0,j.useRef)(a);t.current=a;let i=(0,j.useRef)(null);(0,j.useEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,oe.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),(0,j.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function dt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:r,id:n,className:p,pills:l,onPillClick:g,showPills:k=!0,onSkip:E,showSkipButton:b=!0,showOptionIcons:y=!0,showOptionImages:A=!0,showOptionCounts:R=!0,skipDisabled:B=!1,activeSelected:Y=!1,isLoading:J=!1,skeletonExiting:T=!1,isInputEmpty:z=!1,language:K,products:C,onProductSelect:ee,onProductFocusChange:W,productsLayout:V="row",productImageFallback:le="image",formatType:L="options",dateView:te=null,selectedDateIso:we=null,selectedDateRange:Te=null,dateRangeStart:Ke=null,onPreviousMonth:Ee,onNextMonth:m,optionsPosition:Ae="below",mode:Re}){let ve=ya(Re),Oe=ve!==void 0,re=(0,j.useRef)(null),xe=(0,j.useRef)(null);ka(re,xe),(0,j.useEffect)(()=>{if(re.current)return(0,oe.containScroll)(re.current)},[]);let d=e[0]?.options??[],f=!!(l&&l.length>0&&g),w=!!(C&&C.length>0),v=r&&(d.length>0||k&&f||J||w);Ca(re,v);let S={suggestions:e,activeIndex:a,pills:l,showPills:k,showSkipButton:b,showOptionIcons:y,showOptionImages:A,showOptionCounts:R,skipDisabled:B,activeSelected:Y,isLoading:J,skeletonExiting:T,isInputEmpty:z,products:C,formatType:L,dateView:te,selectedDateIso:we,selectedDateRange:Te,dateRangeStart:Ke},N=(0,j.useRef)(S);v&&(N.current=S);let h=v?S:N.current,G=(0,oe.uiStringsFor)(K),de=h.suggestions[0],ye=de?.options??[],ke=h.activeIndex>=0&&!!ye[h.activeIndex]?.is_tappable,he=(0,oe.labelTraditionalAutocomplete)(h.pills??[],G.keepTyping),De=!!(he.length>0&&g),Ce=h.showPills&&De,Le=h.showPills&&!De&&h.isLoading,Se=Ce||Le,x=De&&(0,oe.hasSkippablePill)(he)&&h.showSkipButton&&!h.isInputEmpty&&!!E,Ve=he[0]?.text,je=(0,oe.isCalendarFormat)(h.formatType)&&h.dateView!=null,ze=ye.length>0&&!je,u=ye.length>0&&je&&!h.isLoading,Ge=h.isLoading&&!ze&&!u,We=h.products??[];return(0,q.jsxs)("div",{ref:re,id:n,role:"listbox","data-aia-dropdown":"","data-options-position":Ae,"data-mode":ve,"data-aia-loading":h.isLoading?"":void 0,"data-aia-skeleton-exiting":h.skeletonExiting?"":void 0,"data-aia-has-products":We.length>0?"":void 0,className:`${Oe?"magicx-aia ":""}${Pe.dropdown} ${v?Pe.visible:""} ${p??""}`,onMouseDown:ue=>ue.preventDefault(),children:[(0,q.jsxs)(_t,{space:"8px",children:[(Se||x)&&(0,q.jsxs)(Xe,{noWrap:!0,className:Pe.pillBar,"data-aia-pillbar":"",children:[Se&&(0,q.jsx)("span",{className:Pe.pillScroll,"data-aia-pill-scroll":"",children:(0,q.jsx)(st,{pills:he,activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:g??(()=>{}),rounded:!0,loading:h.isLoading})}),x&&(0,q.jsx)("button",{type:"button",tabIndex:-1,className:Pe.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":Ve?`${G.skipLabel} ${Ve}`:G.skipLabel,onClick:E,children:G.skip})]}),ze&&(0,q.jsx)(Wt,{options:ye,activeIndex:h.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:n,loading:h.isLoading,groupKey:de?`${de.parameter} ${de.text}`:"",optionsPosition:Ae,showIcons:h.showOptionIcons,showImages:h.showOptionImages,showCounts:h.showOptionCounts}),u&&h.dateView&&(0,q.jsx)(Dt,{options:ye,activeIndex:h.activeIndex,listboxId:n,view:h.dateView,selection:{selectedIso:h.selectedDateIso??null,selectedRange:h.selectedDateRange??null,rangeStart:h.dateRangeStart??null},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:Ee??Ut,onNextMonth:m??Ut}),Ge&&(0,q.jsx)("div",{className:Pe.skeletonBars,"data-aia-skeleton-bars":"",children:va.map(ue=>(0,q.jsx)("span",{className:Pe.skeletonBar,style:{width:ue}},`bar-${ue}`))}),(0,q.jsx)(Ft,{products:We,listboxId:n,onSelect:ee??xa,onFocusChange:W,focusable:v,layout:V,imageFallback:le,strings:G}),(0,q.jsx)(Lt,{isOptionHighlighted:ke,isInputEmpty:h.isInputEmpty,strings:G})]}),(0,q.jsx)("button",{ref:xe,type:"button",tabIndex:-1,className:Pe.scrollArrow,"data-aia-scroll-arrow":"","aria-label":G.scrollArrow,"aria-hidden":"true",children:(0,q.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,q.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Be=require("@magicx-eng/ai-autocomplete-vanilla");var jt=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 {
2488
2488
  flex-shrink: 0;
2489
2489
  width: 32px;
2490
2490
  height: 32px;
@@ -2537,5 +2537,5 @@
2537
2537
  );
2538
2538
  cursor: default;
2539
2539
  }
2540
- `,document.head.appendChild(e)}var Yt={submitButton:"aia-submitButton-otz7H"};var ht=require("react/jsx-runtime");function Zt({disabled:e,onClick:a,label:t=(0,Qt.uiStringsFor)().submit}){return(0,ht.jsx)("button",{type:"button","data-aia-submit":"",className:Yt.submitButton,disabled:e,onClick:i=>{i.stopPropagation(),a()},"aria-label":t,children:(0,ht.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:(0,ht.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 Pt=require("react");function $t(e){let a=(0,Pt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Pt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let r of Object.keys(e??{})){let n=(p,l,g)=>{let k=a.current?.[r];return k?k(p,l,g):[]};o[r]=n}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var It=require("react");function Xt(e){let a=(0,It.useRef)(e);a.current=e;let t=(0,It.useRef)(null);t.current===null&&(t.current={fetch:(o,r)=>{let n=a.current;return n?n.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var Pa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function ut({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:r,additionalContext:n,language:p,currency:l,productId:g,visitorId:k,columns:E=2,dropdownTrigger:b,optionsPosition:x,closeDropdownOnBlur:A,showNonTappableOptions:R,showOptionIcons:B,showOptionImages:Y,showOptionCounts:X,showSkipButton:T,showProducts:z,productImageFallback:K="image",onFocus:C,onBlur:J,value:W,completedParams:V,onChange:se,onParamsChange:O,products:ee,mapProducts:ve,onProductSelect:Pe,source:We,setCursor:Ie}){let m=(0,P.useRef)(null),[Te,Ee]=(0,P.useState)(null),xe=(0,P.useRef)(e);xe.current=e;let Ae=(0,P.useRef)(a);Ae.current=a;let ne=(0,P.useRef)(t);ne.current=t;let ye=(0,P.useRef)(se);ye.current=se;let d=(0,P.useRef)(O);d.current=O;let f=(0,P.useRef)(C);f.current=C;let w=(0,P.useRef)(J);w.current=J;let v=(0,P.useRef)(Ie);v.current=Ie;let S=(0,P.useRef)(Pe);S.current=Pe;let N=(0,P.useRef)(k);N.current=k;let h=(0,P.useRef)(()=>{let c=N.current;return typeof c=="function"?c():c}).current,G=Xt(ee),le=(0,P.useRef)(ve);le.current=ve;let de=(0,P.useRef)((c,te)=>{let D=le.current;return D?D(c,te):c}).current,Re=ve?de:void 0,ce=$t(i);(0,P.useEffect)(()=>{if(typeof document>"u")return;let c=new Ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:n,language:p,currency:l,productId:g,visitorId:h,optionOverrides:ce.overrides,maskCompletedText:o,columns:E,dropdownTrigger:b,optionsPosition:x,closeDropdownOnBlur:A,showNonTappableOptions:R,showProducts:z,source:We,value:W,completedParams:V,onSubmit:(...D)=>xe.current?.(...D),onResult:(...D)=>Ae.current?.(...D),onError:(...D)=>ne.current?.(...D),onChange:(...D)=>ye.current?.(...D),onParamsChange:(...D)=>d.current?.(...D),onFocus:()=>f.current?.(),onBlur:()=>w.current?.(),onProductSelect:D=>S.current?.(D),setCursor:D=>v.current?.(D),products:G.config,mapProducts:Re});m.current=c,Ee(c.getState());let te=c.subscribe(D=>Ee(D));return()=>{te(),c.destroy(),m.current===c&&(m.current=null)}},[]),(0,P.useEffect)(()=>{W!==void 0&&m.current?.setValue(W)},[W]),(0,P.useEffect)(()=>{V!==void 0&&m.current?.setCompletedParams(V)},[V]);let Oe=JSON.stringify(r??null),De;try{De=JSON.stringify(n??null)}catch{De="[unstringifiable]"}(0,P.useEffect)(()=>{m.current?.update({apiConfig:r,additionalContext:n,language:p,currency:l,productId:g,optionOverrides:ce.overrides,dropdownTrigger:b,optionsPosition:x,closeDropdownOnBlur:A,showNonTappableOptions:R,showProducts:z})},[Oe,De,p,l?.code,l?.rate,l?.country,g,ce.key,b,x,A,R,z]);let Le=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!Le.current){Le.current=!0;return}m.current?.update({products:G.config})},[G.enabled]),(0,P.useEffect)(()=>{m.current?.update({mapProducts:Re})},[Re]);let ze=(0,P.useRef)(null);ze.current===null&&(ze.current={handleTextChange:c=>m.current?.handleTextChange(c),handleKeyDown:c=>{let te="nativeEvent"in c?c.nativeEvent:c;m.current?.handleKeyDown(te)},setFocused:c=>m.current?.setFocused(c),startEditingParam:c=>m.current?.startEditingParam(c),exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:c=>m.current?.handleCaretAfterInput(c),handleCaretMove:c=>m.current?.handleCaretMove(c),replaceEditingRange:c=>m.current?.replaceEditingRange(c)??!1,setActivePill:c=>m.current?.setActivePill(c),skipActivePill:()=>m.current?.skipActivePill(),removeLastParam:()=>m.current?.removeLastParam(),clearNewParamId:()=>m.current?.clearNewParamId(),reset:()=>m.current?.reset(),refreshProducts:()=>m.current?.refreshProducts(),recordSubmit:c=>m.current?.recordSubmit(c),selectOption:c=>m.current?.selectOption(c),selectProduct:c=>m.current?.selectProduct(c),setActiveDropdownIndex:c=>m.current?.setActiveDropdownIndex(c),clearHighlight:c=>m.current?.clearHighlight(c),showPreviousMonth:()=>m.current?.showPreviousMonth(),showNextMonth:()=>m.current?.showNextMonth(),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let y=ze.current,Me=(0,P.useCallback)(c=>{let te=c.target.value,bt=te.length>0&&!c.nativeEvent?.isComposing&&te[0]!==te[0].toUpperCase()?te[0].toUpperCase()+te.slice(1):te;m.current?.handleTextChange(bt)},[]),Ne=(0,P.useCallback)(c=>{m.current?.handleKeyDown(c.nativeEvent)},[]),ke=m.current,u=Te??Pa,je=W!==void 0?W:u.text,Ye=V!==void 0?V:u.completedParams,ue=u.actionableSuggestions,Qe=ue[0],tt=(0,Ke.withoutTraditionalAutocomplete)(ue),_e=ke?.listboxId??"",gt=u.activeDropdownIndex>=0&&ke?`${_e}-option-${u.activeDropdownIndex}`:void 0,Fe=u.editingParam,qe=u.editingIdentified,Ze=Fe?{parameter:Fe.suggestionParameter,text:Fe.suggestionPlaceholder,required:!0,options:Fe.options}:qe?{parameter:qe.parameter,text:(0,Ke.identifiedParamLabel)(qe.parameter),required:!0,options:[]}:null,at=u.dropdownSuggestion??Ze??Qe,ft=Ze?[Ze]:ue,$e=(0,Ke.dateSelectionFor)(u),it=!ke||u.dropdownLoading;return{completedParams:Ye,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:tt,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:y.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:it,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:_e,error:u.error,products:u.products,customFields:u.customFields,selectProduct:y.selectProduct,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Fe,editingIdentified:qe,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:je,placeholder:u.placeholderText||void 0,onChange:Me,onKeyDown:Ne,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":gt,"aria-autocomplete":"list","aria-controls":_e},reset:y.reset,refreshProducts:y.refreshProducts,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:at?[{...at,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:u.isDropdownOpen,id:_e,pills:ft,activeSelected:u.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(T??!0)&&!Fe&&!qe,showOptionIcons:B??!0,showOptionImages:Y??!0,showOptionCounts:X??!0,skipDisabled:u.inSelectionAnimation,isLoading:it,skeletonExiting:u.skeletonExiting,isInputEmpty:je.trim().length===0,language:p,products:u.products,productImageFallback:K,onProductSelect:y.selectProduct,onProductFocusChange:y.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:$e.selectedIso,selectedDateRange:$e.selectedRange,dateRangeStart:$e.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,optionsPosition:x??"below"}}}var U=require("@magicx-eng/ai-autocomplete-vanilla"),I=require("react"),mt;function Ia(){if(mt!==void 0)return mt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),mt=e.contentEditable==="plaintext-only",mt}function Jt(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:r,editingIdentified:n,editingAnchor:p,caretOffset:l,placeholderText:g,isFocused:k,isDropdownOpen:E,listboxId:b,activeDescendantId:x,autoFocus:A,handleTextChange:R,handleKeyDown:B,handleCaretAfterInput:Y,handleCaretMove:X,startEditingParam:T,replaceEditingRange:z,setFocused:K}=e,C=(0,I.useRef)(null),J=(0,I.useRef)(!1),W=(0,I.useRef)(""),V=(0,I.useRef)(""),se=(0,I.useRef)(null),O=(0,I.useRef)(0);se.current=l,(0,I.useEffect)(()=>{if(!A)return;let d=C.current;if(!d)return;document.activeElement===d?K(!0):d.focus();let f=d.ownerDocument??document,w=f.getSelection(),v=w&&w.rangeCount>0&&d.contains(w.anchorNode);if(w&&!v){let S=f.createRange();S.selectNodeContents(d),S.collapse(!0),w.removeAllRanges(),w.addRange(S)}},[A,K]),(0,I.useEffect)(()=>{let d=C.current;if(!d)return;let f=d.ownerDocument??document,w=()=>{let v=f.getSelection();if(!v||v.rangeCount===0||!v.anchorNode||!d.contains(v.anchorNode))return;let S=v.anchorNode,N=S.nodeType===Node.ELEMENT_NODE?S:S.parentElement,G=(v.isCollapsed?N?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,le=r?.id??n?.id??null;if(G&&G!==le){T(G);return}performance.now()-O.current<50||X((0,U.getCursorOffset)(d))};return f.addEventListener("selectionchange",w),()=>f.removeEventListener("selectionchange",w)},[r,n,T,X]),(0,I.useEffect)(()=>{let d=C.current;if(!d)return;let f=w=>{let v=(0,U.chipIdFromTap)(d,w.target);v&&(T(v),(0,U.keepCaretOnChip)(d,v))};return d.addEventListener("click",f),()=>d.removeEventListener("click",f)},[T]),(0,I.useLayoutEffect)(()=>{let d=C.current;d&&(0,U.renderEditableContent)({input:d,segments:a,newParamId:o,editingParamId:r?.id??null,placeholderText:g??"",isFocused:k,showChipIcons:t,showChipImages:i})},[a,o,r,g,k,t,i]),(0,I.useLayoutEffect)(()=>{let d=W.current,f=o??"";if(W.current=f,!f||f===d)return;let w=C.current;if(!w)return;w.focus();let v=se.current??(0,U.plainTextLength)(w);(0,U.setCursorOffset)(w,v)},[o]),(0,I.useLayoutEffect)(()=>{let d=V.current,f=r?.id??"";if(V.current=f,!f||f===d||p==null)return;let w=C.current;w&&(0,U.setCursorOffset)(w,p)},[r,p]);let ee=(0,I.useCallback)(()=>{if(J.current)return;let d=C.current;if(!d)return;let f=(0,U.extractPlainText)(d),v=f.length>0&&f[0]!==f[0].toUpperCase()?f[0].toUpperCase()+f.slice(1):f;R(v)},[R]),ve=(0,I.useCallback)(()=>{O.current=performance.now(),ee();let d=C.current;d&&Y((0,U.getCursorOffset)(d))},[ee,Y]);(0,I.useEffect)(()=>{let d=C.current;if(!d)return;let f=w=>{let v=w,S=v.inputType;if(S==="insertParagraph"||S==="insertLineBreak"||S==="insertFromDrop"){w.preventDefault();return}if(S.startsWith("insert")||S.startsWith("delete")){let N=S.startsWith("delete")?"":v.data??"";z(N)&&w.preventDefault()}};return d.addEventListener("beforeinput",f),()=>d.removeEventListener("beforeinput",f)},[z]);let Pe=(0,I.useCallback)(()=>{J.current=!0,C.current?.setAttribute("data-aia-composing","true")},[]),We=(0,I.useCallback)(()=>{J.current=!1,C.current?.removeAttribute("data-aia-composing"),ee()},[ee]),Ie=(0,I.useCallback)(d=>{d.preventDefault();let f=C.current;if(!f)return;let w=(d.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!w)return;let v=f.ownerDocument??document,S=v.getSelection();if(!S||S.rangeCount===0)return;let N=S.getRangeAt(0);if(!f.contains(N.startContainer))return;N.deleteContents();let h=v.createTextNode(w);N.insertNode(h),N.setStartAfter(h),N.collapse(!0),S.removeAllRanges(),S.addRange(N),ee()},[ee]),m=(0,I.useCallback)(d=>B(d),[B]),Te=(0,I.useCallback)(()=>K(!0),[K]),Ee=(0,I.useCallback)(()=>K(!1),[K]),xe=(0,I.useCallback)(()=>C.current?.focus(),[]),Ae=(0,I.useCallback)(()=>C.current?.blur(),[]),ne=(0,I.useCallback)(()=>{let d=C.current;return d?(0,U.extractPlainText)(d):""},[]),ye=Ia()?"plaintext-only":"true";return{inputRef:C,editorProps:{ref:C,contentEditable:ye,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":b,"aria-expanded":E,"aria-activedescendant":x,spellCheck:!0,enterKeyHint:"send",onInput:ve,onKeyDown:m,onCompositionStart:Pe,onCompositionEnd:We,onPaste:Ie,onFocus:Te,onBlur:Ee},getPlainText:ne,focus:xe,blur:Ae}}var he=require("react/jsx-runtime");function Ta(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var ea=(0,H.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,className:n,apiConfig:p,additionalContext:l,language:g,currency:k,productId:E,visitorId:b,columns:x,pillPlacement:A="dropdown",mode:R="auto",optionsPosition:B="below",animations:Y=!0,dropdownTrigger:X,closeDropdownOnBlur:T,showNonTappableOptions:z,showOptionIcons:K=!0,showChipIcons:C=!0,showChipImages:J=!0,showOptionImages:W=!0,showOptionCounts:V=!0,showSkipButton:se,showProducts:O,productsLayout:ee,productImageFallback:ve,autoFocus:Pe=!0,onFocus:We,onBlur:Ie,value:m,completedParams:Te,onChange:Ee,onParamsChange:xe,products:Ae,mapProducts:ne,onProductSelect:ye,submitButton:d,resetOnSubmit:f=!0},w){let v=(0,H.useRef)(null),S=(0,H.useRef)(null),N=(0,H.useRef)(()=>{}),h=(0,H.useRef)(null),G=(0,H.useRef)(null);(0,H.useEffect)(()=>{let L=v.current;if(L)return h.current?h.current.setMode(R):h.current=new Ge.ModeController(L,R),()=>{h.current?.destroy(),h.current=null}},[R]);let le=(0,H.useCallback)(L=>{let me=G.current?.current;me&&(me.focus(),(0,Ge.setCursorOffset)(me,L))},[]),{completedParams:de,skippedParams:Re,identifiedParams:ce,isReady:Oe,customFields:De,suggestionPills:Le,setActivePill:ze,skipActivePill:y,segments:Me,newParamId:Ne,clearNewParamId:ke,placeholderText:u,isFocused:je,isDropdownOpen:Ye,isActivePillSelected:ue,isLoading:Qe,activeIndex:tt,listboxId:_e,handleTextChange:gt,handleKeyDown:Fe,setFocused:qe,editingParam:Ze,editingIdentified:at,editingAnchor:ft,caretOffset:$e,startEditingParam:it,handleCaretAfterInput:c,handleCaretMove:te,replaceEditingRange:D,dropdownProps:bt,reset:ot,refreshProducts:Tt,recordSubmit:Et}=ut({onSubmit:L=>N.current(L),onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,apiConfig:p,additionalContext:l,language:g,currency:k,productId:E,visitorId:b,columns:x,dropdownTrigger:X,optionsPosition:B,closeDropdownOnBlur:T,showNonTappableOptions:z,showOptionIcons:K,showOptionImages:W,showOptionCounts:V,showSkipButton:se,showProducts:O,onFocus:We,onBlur:Ie,value:m,completedParams:Te,onChange:Ee,onParamsChange:xe,products:Ae,mapProducts:ne,onProductSelect:ye,source:"full-sdk",setCursor:le});(0,H.useEffect)(()=>{if(!Ne)return;let L=window.setTimeout(()=>ke(),650);return()=>window.clearTimeout(L)},[Ne,ke]);let ta=tt>=0?`${_e}-option-${tt}`:void 0,{inputRef:wt,editorProps:aa,focus:nt,blur:At,getPlainText:Rt}=Jt({segments:Me,newParamId:Ne,editingParam:Ze,editingIdentified:at,editingAnchor:ft,caretOffset:$e,placeholderText:u,isFocused:je,showChipIcons:C,showChipImages:J,isDropdownOpen:Ye,listboxId:_e,activeDescendantId:ta,autoFocus:Pe,handleTextChange:gt,handleKeyDown:Fe,handleCaretAfterInput:c,handleCaretMove:te,startEditingParam:it,replaceEditingRange:D,setFocused:qe});G.current=wt,(0,H.useLayoutEffect)(()=>{let L=S.current,me=wt.current;if(!L||!me)return;let Xe=()=>{let Dt=L.firstElementChild;if(!Dt)return;let ra=Dt.getBoundingClientRect(),sa=me.getBoundingClientRect();ra.top>=sa.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};Xe();let Ot=new ResizeObserver(Xe);return Ot.observe(me),()=>Ot.disconnect()},[Me,Le.length,Qe,wt]),(0,H.useImperativeHandle)(w,()=>({focus:nt,blur:At,reset:ot,refreshProducts:Tt,setMode:L=>h.current?.setMode(L),skipActivePill:y}),[nt,At,ot,Tt,y]);let rt=!!Me.length||de.length>0,vt=(0,H.useCallback)(L=>{if(!rt)return;let me=Rt(),Xe=(0,Ge.buildSubmitResult)(me,de,Re,{identifiedParams:ce,isReady:Oe,customFields:De});L&&Et(Xe),a(Xe),f&&ot()},[Et,f,rt,de,Re,ce,Oe,De,a,ot,Rt]);N.current=()=>vt(!1);let ia=(0,H.useCallback)(L=>{L.target?.closest("[data-aia-pill]")||nt()},[nt]),oa=A==="inline",na=A==="dropdown";return(0,he.jsxs)("div",{ref:v,className:`magicx-aia ${Ue.container} ${n??""}`,"data-pill-placement":A,"data-options-position":B,"data-animations":Y?"on":"off","data-mode":Ta(R),children:[(0,he.jsx)(pt,{...bt,showPills:na,productsLayout:ee,productImageFallback:ve}),(0,he.jsxs)("div",{className:Ue.inputWrapper,"data-aia-input-wrapper":"",onClick:ia,children:[(0,he.jsxs)("div",{className:Ue.editorArea,"data-aia-editor":"",children:[(0,he.jsx)("div",{...aa,className:Ue.input,"data-aia-input":""}),oa&&(Qe||Le.length>0)&&(0,he.jsx)("span",{ref:S,className:Ue.pillListContainer,"data-aia-pill-list-container":"",children:(0,he.jsx)(dt,{pills:Le,activePillIndex:0,activeSelected:ue,onSelectPill:ze,loading:Qe})})]}),d===null?null:d===void 0?(0,he.jsx)(Zt,{disabled:!rt,onClick:()=>vt(!0),label:(0,Ge.uiStringsFor)(g).submit}):(0,he.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ue.submitSlot,onClick:L=>{rt&&(L.stopPropagation(),vt(!0))},children:d})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
2540
+ `,document.head.appendChild(e)}var Vt={submitButton:"aia-submitButton-otz7H"};var ct=require("react/jsx-runtime");function Yt({disabled:e,onClick:a,label:t=(0,jt.uiStringsFor)().submit}){return(0,ct.jsx)("button",{type:"button","data-aia-submit":"",className:Vt.submitButton,disabled:e,onClick:i=>{i.stopPropagation(),a()},"aria-label":t,children:(0,ct.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:(0,ct.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var He=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react");var St=require("react");function Qt(e){let a=(0,St.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,St.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let r of Object.keys(e??{})){let n=(p,l,g)=>{let k=a.current?.[r];return k?k(p,l,g):[]};o[r]=n}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var Pt=require("react");function Zt(e){let a=(0,Pt.useRef)(e);a.current=e;let t=(0,Pt.useRef)(null);t.current===null&&(t.current={fetch:(o,r)=>{let n=a.current;return n?n.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var $t={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function pt({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:r,additionalContext:n,language:p,currency:l,productId:g,visitorId:k,columns:E=2,dropdownTrigger:b,optionsPosition:y,closeDropdownOnBlur:A,showNonTappableOptions:R,showOptionIcons:B,showOptionImages:Y,showOptionCounts:J,showSkipButton:T,showProducts:z,productImageFallback:K="image",onFocus:C,onBlur:ee,value:W,completedParams:V,onChange:le,onParamsChange:L,products:te,mapProducts:we,onProductSelect:Te,source:Ke,setCursor:Ee}){let m=(0,P.useRef)(null),[Ae,Re]=(0,P.useState)(null),ve=(0,P.useRef)(e);ve.current=e;let Oe=(0,P.useRef)(a);Oe.current=a;let re=(0,P.useRef)(t);re.current=t;let xe=(0,P.useRef)(le);xe.current=le;let d=(0,P.useRef)(L);d.current=L;let f=(0,P.useRef)(C);f.current=C;let w=(0,P.useRef)(ee);w.current=ee;let v=(0,P.useRef)(Ee);v.current=Ee;let S=(0,P.useRef)(Te);S.current=Te;let N=(0,P.useRef)(k);N.current=k;let h=(0,P.useRef)(()=>{let c=N.current;return typeof c=="function"?c():c}).current,G=Zt(te),de=(0,P.useRef)(we);de.current=we;let ye=(0,P.useRef)((c,Q)=>{let O=de.current;return O?O(c,Q):c}).current,ke=we?ye:void 0,he=Qt(i);(0,P.useEffect)(()=>{if(typeof document>"u")return;let c=new He.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:n,language:p,currency:l,productId:g,visitorId:h,optionOverrides:he.overrides,maskCompletedText:o,columns:E,dropdownTrigger:b,optionsPosition:y,closeDropdownOnBlur:A,showNonTappableOptions:R,showProducts:z,source:Ke,value:W,completedParams:V,onSubmit:(...O)=>ve.current?.(...O),onResult:(...O)=>Oe.current?.(...O),onError:(...O)=>re.current?.(...O),onChange:(...O)=>xe.current?.(...O),onParamsChange:(...O)=>d.current?.(...O),onFocus:()=>f.current?.(),onBlur:()=>w.current?.(),onProductSelect:O=>S.current?.(O),setCursor:O=>v.current?.(O),products:G.config,mapProducts:ke});m.current=c,Re(c.getState());let Q=c.subscribe(O=>Re(O));return()=>{Q(),c.destroy(),m.current===c&&(m.current=null)}},[]),(0,P.useEffect)(()=>{W!==void 0&&m.current?.setValue(W)},[W]),(0,P.useEffect)(()=>{V!==void 0&&m.current?.setCompletedParams(V)},[V]);let De=JSON.stringify(r??null),Ce;try{Ce=JSON.stringify(n??null)}catch{Ce="[unstringifiable]"}(0,P.useEffect)(()=>{m.current?.update({apiConfig:r,additionalContext:n,language:p,currency:l,productId:g,optionOverrides:he.overrides,dropdownTrigger:b,optionsPosition:y,closeDropdownOnBlur:A,showNonTappableOptions:R,showProducts:z})},[De,Ce,p,l?.code,l?.rate,l?.country,g,he.key,b,y,A,R,z]);let Le=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!Le.current){Le.current=!0;return}m.current?.update({products:G.config})},[G.enabled]),(0,P.useEffect)(()=>{m.current?.update({mapProducts:ke})},[ke]);let Se=(0,P.useRef)(null);Se.current===null&&(Se.current={handleTextChange:c=>m.current?.handleTextChange(c),handleKeyDown:c=>{let Q="nativeEvent"in c?c.nativeEvent:c;m.current?.handleKeyDown(Q)},setFocused:c=>m.current?.setFocused(c),startEditingParam:c=>m.current?.startEditingParam(c),exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:c=>m.current?.handleCaretAfterInput(c),handleCaretMove:c=>m.current?.handleCaretMove(c),replaceEditingRange:c=>m.current?.replaceEditingRange(c)??!1,setActivePill:c=>m.current?.setActivePill(c),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()??$t,recordSubmit:c=>m.current?.recordSubmit(c),selectOption:c=>m.current?.selectOption(c),selectProduct:c=>m.current?.selectProduct(c),setActiveDropdownIndex:c=>m.current?.setActiveDropdownIndex(c),clearHighlight:c=>m.current?.clearHighlight(c),showPreviousMonth:()=>m.current?.showPreviousMonth(),showNextMonth:()=>m.current?.showNextMonth(),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let x=Se.current,Ve=(0,P.useCallback)(c=>{let Q=c.target.value,at=Q.length>0&&!c.nativeEvent?.isComposing&&Q[0]!==Q[0].toUpperCase()?Q[0].toUpperCase()+Q.slice(1):Q;m.current?.handleTextChange(at)},[]),je=(0,P.useCallback)(c=>{m.current?.handleKeyDown(c.nativeEvent)},[]),ze=m.current,u=Ae??$t,Ge=W!==void 0?W:u.text,We=V!==void 0?V:u.completedParams,ue=u.actionableSuggestions,ut=ue[0],mt=(0,He.withoutTraditionalAutocomplete)(ue),Ye=ze?.listboxId??"",gt=u.activeDropdownIndex>=0&&ze?`${Ye}-option-${u.activeDropdownIndex}`:void 0,Me=u.editingParam,_e=u.editingIdentified,Qe=Me?{parameter:Me.suggestionParameter,text:Me.suggestionPlaceholder,required:!0,options:Me.options}:_e?{parameter:_e.parameter,text:(0,He.identifiedParamLabel)(_e.parameter),required:!0,options:[]}:null,et=u.dropdownSuggestion??Qe??ut,ft=Qe?[Qe]:ue,Ze=(0,He.dateSelectionFor)(u),tt=!ze||u.dropdownLoading;return{completedParams:We,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:mt,setActivePill:x.setActivePill,skipActivePill:x.skipActivePill,removeLastParam:x.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:x.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:tt,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:Ye,error:u.error,products:u.products,customFields:u.customFields,selectProduct:x.selectProduct,handleTextChange:x.handleTextChange,handleKeyDown:x.handleKeyDown,setFocused:x.setFocused,editingParam:Me,editingIdentified:_e,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:x.startEditingParam,exitEditMode:x.exitEditMode,handleCaretAfterInput:x.handleCaretAfterInput,handleCaretMove:x.handleCaretMove,replaceEditingRange:x.replaceEditingRange,inputProps:{value:Ge,placeholder:u.placeholderText||void 0,onChange:Ve,onKeyDown:je,onFocus:x.handleFocus,onBlur:x.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":gt,"aria-autocomplete":"list","aria-controls":Ye},reset:x.reset,refreshProducts:x.refreshProducts,prepareSubmit:x.prepareSubmit,getState:x.getState,recordSubmit:x.recordSubmit,dropdownProps:{suggestions:et?[{...et,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:x.selectOption,onHighlight:x.setActiveDropdownIndex,onUnhighlight:x.clearHighlight,isOpen:u.isDropdownOpen,id:Ye,pills:ft,activeSelected:u.isActivePillSelected,onPillClick:x.setActivePill,onSkip:x.skipActivePill,showSkipButton:(T??!0)&&!Me&&!_e,showOptionIcons:B??!0,showOptionImages:Y??!0,showOptionCounts:J??!0,skipDisabled:u.inSelectionAnimation,isLoading:tt,skeletonExiting:u.skeletonExiting,isInputEmpty:Ge.trim().length===0,language:p,products:u.products,productImageFallback:K,onProductSelect:x.selectProduct,onProductFocusChange:x.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:Ze.selectedIso,selectedDateRange:Ze.selectedRange,dateRangeStart:Ze.rangeStart,onPreviousMonth:x.showPreviousMonth,onNextMonth:x.showNextMonth,optionsPosition:y??"below"}}}var U=require("@magicx-eng/ai-autocomplete-vanilla"),I=require("react"),ht;function Sa(){if(ht!==void 0)return ht;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),ht=e.contentEditable==="plaintext-only",ht}function Xt(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:r,editingIdentified:n,editingAnchor:p,caretOffset:l,placeholderText:g,isFocused:k,isDropdownOpen:E,listboxId:b,activeDescendantId:y,autoFocus:A,handleTextChange:R,handleKeyDown:B,handleCaretAfterInput:Y,handleCaretMove:J,startEditingParam:T,replaceEditingRange:z,setFocused:K}=e,C=(0,I.useRef)(null),ee=(0,I.useRef)(!1),W=(0,I.useRef)(""),V=(0,I.useRef)(""),le=(0,I.useRef)(null),L=(0,I.useRef)(0);le.current=l,(0,I.useEffect)(()=>{if(!A)return;let d=C.current;if(!d)return;document.activeElement===d?K(!0):d.focus();let f=d.ownerDocument??document,w=f.getSelection(),v=w&&w.rangeCount>0&&d.contains(w.anchorNode);if(w&&!v){let S=f.createRange();S.selectNodeContents(d),S.collapse(!0),w.removeAllRanges(),w.addRange(S)}},[A,K]),(0,I.useEffect)(()=>{let d=C.current;if(!d)return;let f=d.ownerDocument??document,w=()=>{let v=f.getSelection();if(!v||v.rangeCount===0||!v.anchorNode||!d.contains(v.anchorNode))return;let S=v.anchorNode,N=S.nodeType===Node.ELEMENT_NODE?S:S.parentElement,G=(v.isCollapsed?N?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,de=r?.id??n?.id??null;if(G&&G!==de){T(G);return}performance.now()-L.current<50||J((0,U.getCursorOffset)(d))};return f.addEventListener("selectionchange",w),()=>f.removeEventListener("selectionchange",w)},[r,n,T,J]),(0,I.useEffect)(()=>{let d=C.current;if(!d)return;let f=w=>{let v=(0,U.chipIdFromTap)(d,w.target);v&&(T(v),(0,U.keepCaretOnChip)(d,v))};return d.addEventListener("click",f),()=>d.removeEventListener("click",f)},[T]),(0,I.useLayoutEffect)(()=>{let d=C.current;d&&(0,U.renderEditableContent)({input:d,segments:a,newParamId:o,editingParamId:r?.id??null,placeholderText:g??"",isFocused:k,showChipIcons:t,showChipImages:i})},[a,o,r,g,k,t,i]),(0,I.useLayoutEffect)(()=>{let d=W.current,f=o??"";if(W.current=f,!f||f===d)return;let w=C.current;if(!w)return;w.focus();let v=le.current??(0,U.plainTextLength)(w);(0,U.setCursorOffset)(w,v)},[o]),(0,I.useLayoutEffect)(()=>{let d=V.current,f=r?.id??"";if(V.current=f,!f||f===d||p==null)return;let w=C.current;w&&(0,U.setCursorOffset)(w,p)},[r,p]);let te=(0,I.useCallback)(()=>{if(ee.current)return;let d=C.current;if(!d)return;let f=(0,U.extractPlainText)(d),v=f.length>0&&f[0]!==f[0].toUpperCase()?f[0].toUpperCase()+f.slice(1):f;R(v)},[R]),we=(0,I.useCallback)(()=>{L.current=performance.now(),te();let d=C.current;d&&Y((0,U.getCursorOffset)(d))},[te,Y]);(0,I.useEffect)(()=>{let d=C.current;if(!d)return;let f=w=>{let v=w,S=v.inputType;if(S==="insertParagraph"||S==="insertLineBreak"||S==="insertFromDrop"){w.preventDefault();return}if(S.startsWith("insert")||S.startsWith("delete")){let N=S.startsWith("delete")?"":v.data??"";z(N)&&w.preventDefault()}};return d.addEventListener("beforeinput",f),()=>d.removeEventListener("beforeinput",f)},[z]);let Te=(0,I.useCallback)(()=>{ee.current=!0,C.current?.setAttribute("data-aia-composing","true")},[]),Ke=(0,I.useCallback)(()=>{ee.current=!1,C.current?.removeAttribute("data-aia-composing"),te()},[te]),Ee=(0,I.useCallback)(d=>{d.preventDefault();let f=C.current;if(!f)return;let w=(d.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!w)return;let v=f.ownerDocument??document,S=v.getSelection();if(!S||S.rangeCount===0)return;let N=S.getRangeAt(0);if(!f.contains(N.startContainer))return;N.deleteContents();let h=v.createTextNode(w);N.insertNode(h),N.setStartAfter(h),N.collapse(!0),S.removeAllRanges(),S.addRange(N),te()},[te]),m=(0,I.useCallback)(d=>B(d),[B]),Ae=(0,I.useCallback)(()=>K(!0),[K]),Re=(0,I.useCallback)(()=>K(!1),[K]),ve=(0,I.useCallback)(()=>C.current?.focus(),[]),Oe=(0,I.useCallback)(()=>C.current?.blur(),[]),re=(0,I.useCallback)(()=>{let d=C.current;return d?(0,U.extractPlainText)(d):""},[]),xe=Sa()?"plaintext-only":"true";return{inputRef:C,editorProps:{ref:C,contentEditable:xe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":b,"aria-expanded":E,"aria-activedescendant":y,spellCheck:!0,enterKeyHint:"send",onInput:we,onKeyDown:m,onCompositionStart:Te,onCompositionEnd:Ke,onPaste:Ee,onFocus:Ae,onBlur:Re},getPlainText:re,focus:ve,blur:Oe}}var pe=require("react/jsx-runtime");function Pa(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Jt=(0,H.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,className:n,apiConfig:p,additionalContext:l,language:g,currency:k,productId:E,visitorId:b,columns:y,pillPlacement:A="dropdown",mode:R="auto",optionsPosition:B="below",animations:Y=!0,dropdownTrigger:J,closeDropdownOnBlur:T,showNonTappableOptions:z,showOptionIcons:K=!0,showChipIcons:C=!0,showChipImages:ee=!0,showOptionImages:W=!0,showOptionCounts:V=!0,showSkipButton:le,showProducts:L,productsLayout:te,productImageFallback:we,autoFocus:Te=!0,onFocus:Ke,onBlur:Ee,value:m,completedParams:Ae,onChange:Re,onParamsChange:ve,products:Oe,mapProducts:re,onProductSelect:xe,submitButton:d,resetOnSubmit:f=!0},w){let v=(0,H.useRef)(null),S=(0,H.useRef)(null),N=(0,H.useRef)(()=>{}),h=(0,H.useRef)(null),G=(0,H.useRef)(null);(0,H.useEffect)(()=>{let D=v.current;if(D)return h.current?h.current.setMode(R):h.current=new Be.ModeController(D,R),()=>{h.current?.destroy(),h.current=null}},[R]);let de=(0,H.useCallback)(D=>{let ae=G.current?.current;ae&&(ae.focus(),(0,Be.setCursorOffset)(ae,D))},[]),{completedParams:ye,suggestionPills:ke,setActivePill:he,skipActivePill:De,segments:Ce,newParamId:Le,clearNewParamId:Se,placeholderText:x,isFocused:Ve,isDropdownOpen:je,isActivePillSelected:ze,isLoading:u,activeIndex:Ge,listboxId:We,handleTextChange:ue,handleKeyDown:ut,setFocused:mt,editingParam:Ye,editingIdentified:gt,editingAnchor:Me,caretOffset:_e,startEditingParam:Qe,handleCaretAfterInput:et,handleCaretMove:ft,replaceEditingRange:Ze,dropdownProps:tt,reset:c,refreshProducts:Q,prepareSubmit:O,getState:at,recordSubmit:It}=pt({onSubmit:D=>N.current(D),onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,apiConfig:p,additionalContext:l,language:g,currency:k,productId:E,visitorId:b,columns:y,dropdownTrigger:J,optionsPosition:B,closeDropdownOnBlur:T,showNonTappableOptions:z,showOptionIcons:K,showOptionImages:W,showOptionCounts:V,showSkipButton:le,showProducts:L,onFocus:Ke,onBlur:Ee,value:m,completedParams:Ae,onChange:Re,onParamsChange:ve,products:Oe,mapProducts:re,onProductSelect:xe,source:"full-sdk",setCursor:de});(0,H.useEffect)(()=>{if(!Le)return;let D=window.setTimeout(()=>Se(),650);return()=>window.clearTimeout(D)},[Le,Se]);let ea=Ge>=0?`${We}-option-${Ge}`:void 0,{inputRef:bt,editorProps:ta,focus:it,blur:Tt,getPlainText:Et}=Xt({segments:Ce,newParamId:Le,editingParam:Ye,editingIdentified:gt,editingAnchor:Me,caretOffset:_e,placeholderText:x,isFocused:Ve,showChipIcons:C,showChipImages:ee,isDropdownOpen:je,listboxId:We,activeDescendantId:ea,autoFocus:Te,handleTextChange:ue,handleKeyDown:ut,handleCaretAfterInput:et,handleCaretMove:ft,startEditingParam:Qe,replaceEditingRange:Ze,setFocused:mt});G.current=bt,(0,H.useLayoutEffect)(()=>{let D=S.current,ae=bt.current;if(!D||!ae)return;let $e=()=>{let Rt=D.firstElementChild;if(!Rt)return;let na=Rt.getBoundingClientRect(),ra=ae.getBoundingClientRect();na.top>=ra.bottom-2?D.setAttribute("data-aia-pill-wrapped",""):D.removeAttribute("data-aia-pill-wrapped")};$e();let At=new ResizeObserver($e);return At.observe(ae),()=>At.disconnect()},[Ce,ke.length,u,bt]),(0,H.useImperativeHandle)(w,()=>({focus:it,blur:Tt,reset:c,refreshProducts:Q,setMode:D=>h.current?.setMode(D),skipActivePill:De}),[it,Tt,c,Q,De]);let ot=!!Ce.length||ye.length>0,wt=(0,H.useCallback)(D=>{if(!ot)return;D&&O();let ae=at(),$e=(0,Be.buildSubmitResult)(Et(),ae.completedParams,ae.skippedParams,{identifiedParams:ae.identifiedParams,isReady:ae.isReady,customFields:ae.customFields});D&&It($e),a($e),f&&c()},[It,f,ot,O,at,a,c,Et]);N.current=()=>wt(!1);let aa=(0,H.useCallback)(D=>{D.target?.closest("[data-aia-pill]")||it()},[it]),ia=A==="inline",oa=A==="dropdown";return(0,pe.jsxs)("div",{ref:v,className:`magicx-aia ${qe.container} ${n??""}`,"data-pill-placement":A,"data-options-position":B,"data-animations":Y?"on":"off","data-mode":Pa(R),children:[(0,pe.jsx)(dt,{...tt,showPills:oa,productsLayout:te,productImageFallback:we}),(0,pe.jsxs)("div",{className:qe.inputWrapper,"data-aia-input-wrapper":"",onClick:aa,children:[(0,pe.jsxs)("div",{className:qe.editorArea,"data-aia-editor":"",children:[(0,pe.jsx)("div",{...ta,className:qe.input,"data-aia-input":""}),ia&&(u||ke.length>0)&&(0,pe.jsx)("span",{ref:S,className:qe.pillListContainer,"data-aia-pill-list-container":"",children:(0,pe.jsx)(st,{pills:ke,activePillIndex:0,activeSelected:ze,onSelectPill:he,loading:u})})]}),d===null?null:d===void 0?(0,pe.jsx)(Yt,{disabled:!ot,onClick:()=>wt(!0),label:(0,Be.uiStringsFor)(g).submit}):(0,pe.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:qe.submitSlot,onClick:D=>{ot&&(D.stopPropagation(),wt(!0))},children:d})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
2541
2541
  //# sourceMappingURL=index.js.map