@magicx-eng/ai-autocomplete-react 0.30.0 → 0.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -262,7 +262,7 @@
262
262
  opacity: 0;
263
263
  }
264
264
  }
265
- `,document.head.appendChild(e)}var ze={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 Re=require("@magicx-eng/ai-autocomplete-vanilla"),ee=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
265
+ `,document.head.appendChild(e)}var Me={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 Re=require("@magicx-eng/ai-autocomplete-vanilla"),ee=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
266
266
  * Built-in appearance defaults \u2014 zero specificity via :where().
267
267
  * Consumer CSS always wins without !important.
268
268
  *
@@ -1041,7 +1041,7 @@
1041
1041
  opacity: 0.25;
1042
1042
  }
1043
1043
  }
1044
- `,document.head.appendChild(e)}var we={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 M=require("@magicx-eng/ai-autocomplete-vanilla"),kt=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) ---
1044
+ `,document.head.appendChild(e)}var we={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 z=require("@magicx-eng/ai-autocomplete-vanilla"),kt=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) ---
1045
1045
 
1046
1046
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1047
1047
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1204,7 +1204,7 @@
1204
1204
  opacity: 0.8;
1205
1205
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1206
1206
  }
1207
- `,document.head.appendChild(e)}var z={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var Q=require("react/jsx-runtime"),ra=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ct({options:e,activeIndex:a,listboxId:t,view:n,selection:i,onSelect:r,onHighlight:o,onUnhighlight:d,onPreviousMonth:y,onNextMonth:v}){let w=(0,M.isoDate)(new Date),E=(0,M.visibleDateRange)({pendingStart:i.rangeStart,highlightedIso:(0,M.cellIso)(e[a]),selected:i.selectedRange});return(0,Q.jsxs)("div",{className:z.datepicker,"data-aia-datepicker":"",children:[(0,Q.jsxs)("div",{className:z.header,children:[(0,Q.jsx)("button",{type:"button",tabIndex:-1,className:z.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:u=>u.preventDefault(),onClick:y,children:"\u2039"}),(0,Q.jsx)("span",{className:z.month,"data-aia-date-month":"","aria-live":"polite",children:(0,M.monthLabel)(n)}),(0,Q.jsx)("button",{type:"button",tabIndex:-1,className:z.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:u=>u.preventDefault(),onClick:v,children:"\u203A"})]}),(0,Q.jsx)("div",{className:z.weekdays,"aria-hidden":"true",children:M.WEEKDAY_LABELS.map((u,x)=>(0,Q.jsx)("span",{className:z.weekday,children:u},ra[x]))}),(0,Q.jsx)("div",{className:z.grid,"data-aia-date-grid":"",children:e.map((u,x)=>(0,Q.jsx)(sa,{option:u,id:`${t}-option-${x}`,index:x,isHighlighted:x===a&&u.is_tappable,isToday:(0,M.cellIso)(u)===w,isPast:(0,M.cellIso)(u)!=null&&(0,M.cellIso)(u)<w,marks:(0,M.dateCellMarks)((0,M.cellIso)(u),{selectedIso:i.selectedIso,range:E}),onSelect:r,onHighlight:o,onUnhighlight:d},(0,M.cellIso)(u)??`pad-${x}`))})]})}function sa({option:e,id:a,index:t,isHighlighted:n,isToday:i,isPast:r,marks:o,onSelect:d,onHighlight:y,onUnhighlight:v}){let[w,E]=(0,kt.useState)(!1),u=(0,M.cellDay)(e);if(u==null)return(0,Q.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${z.cell} ${z.blank}`});let x=()=>{E(!0),d(e),setTimeout(()=>E(!1),170)},R=[z.cell,z.day,r?z.past:"",n?z.highlighted:"",i?z.today:"",o.inRange?z.inRange:"",o.selected?z.selected:"",w?z.pressed:""].filter(Boolean).join(" ");return(0,Q.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":n,"aria-label":e.text,tabIndex:0,className:R,onClick:x,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),x())},onMouseEnter:()=>y(t),onMouseLeave:v?()=>v(t):void 0,children:(0,Q.jsx)("span",{className:z.number,children:u})})}var He=require("@magicx-eng/ai-autocomplete-vanilla"),Xe=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 {
1207
+ `,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 Y=require("react/jsx-runtime"),ra=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ct({options:e,activeIndex:a,listboxId:t,view:n,selection:i,onSelect:r,onHighlight:o,onUnhighlight:d,onPreviousMonth:k,onNextMonth:w}){let x=(0,z.isoDate)(new Date),E=(0,z.visibleDateRange)({pendingStart:i.rangeStart,highlightedIso:(0,z.cellIso)(e[a]),selected:i.selectedRange});return(0,Y.jsxs)("div",{className:M.datepicker,"data-aia-datepicker":"",children:[(0,Y.jsxs)("div",{className:M.header,children:[(0,Y.jsx)("button",{type:"button",tabIndex:-1,className:M.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:m=>m.preventDefault(),onClick:k,children:"\u2039"}),(0,Y.jsx)("span",{className:M.month,"data-aia-date-month":"","aria-live":"polite",children:(0,z.monthLabel)(n)}),(0,Y.jsx)("button",{type:"button",tabIndex:-1,className:M.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:m=>m.preventDefault(),onClick:w,children:"\u203A"})]}),(0,Y.jsx)("div",{className:M.weekdays,"aria-hidden":"true",children:z.WEEKDAY_LABELS.map((m,y)=>(0,Y.jsx)("span",{className:M.weekday,children:m},ra[y]))}),(0,Y.jsx)("div",{className:M.grid,"data-aia-date-grid":"",children:e.map((m,y)=>(0,Y.jsx)(sa,{option:m,id:`${t}-option-${y}`,index:y,isHighlighted:y===a&&m.is_tappable,isToday:(0,z.cellIso)(m)===x,isPast:(0,z.cellIso)(m)!=null&&(0,z.cellIso)(m)<x,marks:(0,z.dateCellMarks)((0,z.cellIso)(m),{selectedIso:i.selectedIso,range:E}),onSelect:r,onHighlight:o,onUnhighlight:d},(0,z.cellIso)(m)??`pad-${y}`))})]})}function sa({option:e,id:a,index:t,isHighlighted:n,isToday:i,isPast:r,marks:o,onSelect:d,onHighlight:k,onUnhighlight:w}){let[x,E]=(0,kt.useState)(!1),m=(0,z.cellDay)(e);if(m==null)return(0,Y.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),d(e),setTimeout(()=>E(!1),170)},O=[M.cell,M.day,r?M.past:"",n?M.highlighted:"",i?M.today:"",o.inRange?M.inRange:"",o.selected?M.selected:"",x?M.pressed:""].filter(Boolean).join(" ");return(0,Y.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":n,"aria-label":e.text,tabIndex:0,className:O,onClick:y,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),y())},onMouseEnter:()=>k(t),onMouseLeave:w?()=>w(t):void 0,children:(0,Y.jsx)("span",{className:M.number,children:m})})}var He=require("@magicx-eng/ai-autocomplete-vanilla"),Xe=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 {
1208
1208
  display: flex;
1209
1209
  flex-wrap: wrap;
1210
1210
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1244,7 +1244,7 @@
1244
1244
  .aia-cluster[data-justify="around"] {
1245
1245
  justify-content: space-around;
1246
1246
  }
1247
- `,document.head.appendChild(e)}var pt=require("react/jsx-runtime");function Ue({gap:e,align:a="center",justify:t="start",noWrap:n=!1,inline:i=!1,className:r,children:o,...d}){let y=e?{"--aia-cluster-gap":e}:void 0,v={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":n||void 0,"data-inline":i||void 0,style:y,...d};return i?(0,pt.jsx)("span",{...v,children:o}):(0,pt.jsx)("div",{...v,children:o})}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
1247
+ `,document.head.appendChild(e)}var pt=require("react/jsx-runtime");function Ue({gap:e,align:a="center",justify:t="start",noWrap:n=!1,inline:i=!1,className:r,children:o,...d}){let k=e?{"--aia-cluster-gap":e}:void 0,w={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":n||void 0,"data-inline":i||void 0,style:k,...d};return i?(0,pt.jsx)("span",{...w,children:o}):(0,pt.jsx)("div",{...w,children:o})}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
1248
1248
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1249
1249
  room above the hint/branding row so the footer doesn't butt against the last
1250
1250
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1464,7 +1464,7 @@
1464
1464
  align-items: center;
1465
1465
  vertical-align: middle;
1466
1466
  }
1467
- `,document.head.appendChild(e)}var ut={list:"aia-list-qvLqO"};var Qe=require("react/jsx-runtime"),la=[125,69];function Et(e){return e===0?"first":e===1?"next":"last"}function Je({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:n,rounded:i,loading:r}){return r&&e.length===0?(0,Qe.jsx)("span",{className:ut.list,"data-aia-pill-list-loading":"",children:la.map((o,d)=>(0,Qe.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ae.pill} ${i?Ae.rounded:""} ${Ae.skeleton}`,style:{width:o,opacity:ht[Et(d)]}},`skel-${o}`))}):(0,Qe.jsx)("span",{className:ut.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((o,d)=>{let y=!!n&&d===a;return(0,Qe.jsx)(St,{label:o.text,state:y?"selected":Et(d),selected:y,rounded:i,loading:r,onClick:()=>t(d)},`${o.type}-${o.text}`)})})}var et=require("@magicx-eng/ai-autocomplete-vanilla"),Fe=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
1467
+ `,document.head.appendChild(e)}var ut={list:"aia-list-qvLqO"};var Qe=require("react/jsx-runtime"),la=[125,69];function Et(e){return e===0?"first":e===1?"next":"last"}function Je({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:n,rounded:i,loading:r}){return r&&e.length===0?(0,Qe.jsx)("span",{className:ut.list,"data-aia-pill-list-loading":"",children:la.map((o,d)=>(0,Qe.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ae.pill} ${i?Ae.rounded:""} ${Ae.skeleton}`,style:{width:o,opacity:ht[Et(d)]}},`skel-${o}`))}):(0,Qe.jsx)("span",{className:ut.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((o,d)=>{let k=!!n&&d===a;return(0,Qe.jsx)(St,{label:o.text,state:k?"selected":Et(d),selected:k,rounded:i,loading:r,onClick:()=>t(d)},`${o.type}-${o.text}`)})})}var et=require("@magicx-eng/ai-autocomplete-vanilla"),Fe=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
1468
1468
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1469
1469
  theming one package sees the same result in the other.
1470
1470
 
@@ -1692,7 +1692,7 @@
1692
1692
  .aia-section-Hugfg[data-aia-products-layout="list"] .aia-body-ly032 {
1693
1693
  flex: 1 1 auto;
1694
1694
  }
1695
- `,document.head.appendChild(e)}var te={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"};var Y=require("react/jsx-runtime");function Tt({products:e,listboxId:a,onSelect:t,onFocusChange:n,focusable:i=!0,layout:r="row",imageFallback:o="image"}){let d=e.length>0,y=(0,Fe.useRef)(null);if((0,Fe.useEffect)(()=>{let w=y.current;if(!(!d||!w))return(0,et.attachProductRowWheel)(w)},[d]),!d)return null;let v=`${a}-products-label`;return(0,Y.jsxs)("section",{className:te.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":v,children:[(0,Y.jsx)("div",{className:te.label,id:v,"data-aia-products-label":"",children:"Products"}),(0,Y.jsx)("div",{ref:y,className:te.row,"data-aia-products-row":"",children:e.map((w,E)=>(0,Y.jsx)(da,{product:w,id:`${a}-product-${E}`,onSelect:t,onFocusChange:n,focusable:i,imageFallback:o},w.id))})]})}function da({product:e,id:a,onSelect:t,onFocusChange:n,focusable:i,imageFallback:r}){let o=d=>{d.metaKey||d.ctrlKey||d.shiftKey||d.altKey||d.button!==0||(d.preventDefault(),t(e))};return(0,Y.jsxs)("a",{id:a,className:te.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:i?0:-1,onClick:o,onKeyDown:d=>{d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),t(e))},onFocus:()=>n?.(!0),onBlur:d=>{d.relatedTarget?.closest("[data-aia-dropdown]")||n?.(!1)},children:[(0,Y.jsx)(ca,{src:e.imageUrl?.trim(),title:e.title,fallback:r},e.imageUrl?.trim()??""),(0,Y.jsxs)("span",{className:te.body,children:[e.vendor?(0,Y.jsx)("span",{className:te.vendor,children:e.vendor}):null,(0,Y.jsx)("span",{className:te.title,children:e.title}),e.price?(0,Y.jsx)("span",{className:te.price,children:e.price}):null]})]})}function ca({src:e,title:a,fallback:t}){let[n,i]=(0,Fe.useState)(!1),r=!!e&&!n,o=!r&&t==="initial";return(0,Y.jsxs)("span",{className:te.media,"aria-hidden":"true","data-aia-product-placeholder":!r&&!o?"":void 0,"data-aia-product-initial":o?"":void 0,children:[r?(0,Y.jsx)("img",{className:te.image,src:e,alt:"",loading:"lazy",decoding:"async",onError:()=>i(!0)}):null,o?(0,et.productInitial)(a):null]})}var q=require("@magicx-eng/ai-autocomplete-vanilla"),ce=require("react");var At=require("@magicx-eng/ai-autocomplete-vanilla"),tt=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 {
1695
+ `,document.head.appendChild(e)}var te={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"};var j=require("react/jsx-runtime");function Tt({products:e,listboxId:a,onSelect:t,onFocusChange:n,focusable:i=!0,layout:r="row",imageFallback:o="image"}){let d=e.length>0,k=(0,Fe.useRef)(null);if((0,Fe.useEffect)(()=>{let x=k.current;if(!(!d||!x))return(0,et.attachProductRowWheel)(x)},[d]),!d)return null;let w=`${a}-products-label`;return(0,j.jsxs)("section",{className:te.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":w,children:[(0,j.jsx)("div",{className:te.label,id:w,"data-aia-products-label":"",children:"Products"}),(0,j.jsx)("div",{ref:k,className:te.row,"data-aia-products-row":"",children:e.map((x,E)=>(0,j.jsx)(da,{product:x,id:`${a}-product-${E}`,onSelect:t,onFocusChange:n,focusable:i,imageFallback:o},x.id))})]})}function da({product:e,id:a,onSelect:t,onFocusChange:n,focusable:i,imageFallback:r}){let o=d=>{d.metaKey||d.ctrlKey||d.shiftKey||d.altKey||d.button!==0||(d.preventDefault(),t(e))};return(0,j.jsxs)("a",{id:a,className:te.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:i?0:-1,onClick:o,onKeyDown:d=>{d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),t(e))},onFocus:()=>n?.(!0),onBlur:d=>{d.relatedTarget?.closest("[data-aia-dropdown]")||n?.(!1)},children:[(0,j.jsx)(ca,{src:e.imageUrl?.trim(),title:e.title,fallback:r},e.imageUrl?.trim()??""),(0,j.jsxs)("span",{className:te.body,children:[e.vendor?(0,j.jsx)("span",{className:te.vendor,children:e.vendor}):null,(0,j.jsx)("span",{className:te.title,children:e.title}),e.price?(0,j.jsx)("span",{className:te.price,children:e.price}):null]})]})}function ca({src:e,title:a,fallback:t}){let[n,i]=(0,Fe.useState)(!1),r=!!e&&!n,o=!r&&t==="initial";return(0,j.jsxs)("span",{className:te.media,"aria-hidden":"true","data-aia-product-placeholder":!r&&!o?"":void 0,"data-aia-product-initial":o?"":void 0,children:[r?(0,j.jsx)("img",{className:te.image,src:e,alt:"",loading:"lazy",decoding:"async",onError:()=>i(!0)}):null,o?(0,et.productInitial)(a):null]})}var U=require("@magicx-eng/ai-autocomplete-vanilla"),ce=require("react");var At=require("@magicx-eng/ai-autocomplete-vanilla"),tt=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 {
1696
1696
  display: grid;
1697
1697
  grid-template-columns: repeat(
1698
1698
  auto-fit,
@@ -1728,7 +1728,7 @@
1728
1728
  .aia-grid[data-scroll]::-webkit-scrollbar {
1729
1729
  display: none;
1730
1730
  }
1731
- `,document.head.appendChild(e)}var Ot=require("react/jsx-runtime");function Rt({min:e="16rem",max:a,gap:t,scroll:n=!1,maxHeight:i,scrollResetKey:r,cols:o,template:d,innerRef:y,className:v,children:w,...E}){let u=(0,tt.useRef)(null);(0,tt.useLayoutEffect)(()=>{if(r===void 0)return;let R=u.current;R&&(R.scrollTop=0)},[r]);let x={"--aia-grid-min":e};return a&&(x["--aia-grid-max"]=a),t&&(x["--aia-grid-gap"]=t),i&&(x["--aia-grid-max-height"]=i),o&&(x.gridTemplateColumns=(0,At.optionsGridTemplateColumns)(o)),d&&(x.gridTemplateColumns=d),(0,Ot.jsx)("div",{ref:R=>{u.current=R,y?.(R)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":n||void 0,style:x,...E,children:w})}var de=require("@magicx-eng/ai-autocomplete-vanilla"),le=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 {
1731
+ `,document.head.appendChild(e)}var Ot=require("react/jsx-runtime");function Rt({min:e="16rem",max:a,gap:t,scroll:n=!1,maxHeight:i,scrollResetKey:r,cols:o,template:d,innerRef:k,className:w,children:x,...E}){let m=(0,tt.useRef)(null);(0,tt.useLayoutEffect)(()=>{if(r===void 0)return;let O=m.current;O&&(O.scrollTop=0)},[r]);let y={"--aia-grid-min":e};return a&&(y["--aia-grid-max"]=a),t&&(y["--aia-grid-gap"]=t),i&&(y["--aia-grid-max-height"]=i),o&&(y.gridTemplateColumns=(0,At.optionsGridTemplateColumns)(o)),d&&(y.gridTemplateColumns=d),(0,Ot.jsx)("div",{ref:O=>{m.current=O,k?.(O)},className:w?`aia-grid ${w}`:"aia-grid","data-scroll":n||void 0,style:y,...E,children:x})}var de=require("@magicx-eng/ai-autocomplete-vanilla"),le=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 {
1732
1732
  position: relative;
1733
1733
  /* Clip, not visible: the entrance rise below runs on the inner content,
1734
1734
  and a transformed box extends its scroll container's scrollable area.
@@ -2125,7 +2125,7 @@
2125
2125
  opacity: 0;
2126
2126
  }
2127
2127
  }
2128
- `,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",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd"};var se=require("react/jsx-runtime");function Dt({option:e,isHighlighted:a,onSelect:t,onHighlight:n,onUnhighlight:i,id:r,loading:o,showIcon:d=!0,showImage:y=!0,showCount:v=!0,scrollHint:w,enterDelayMs:E=0}){let[u]=(0,le.useState)(E),[x,R]=(0,le.useState)(!1),T=y?(0,de.optionImageSrc)(e.image_url):null,[j,H]=(0,le.useState)(null),O=(0,le.useMemo)(()=>!T&&d&&e.icon_svg?(0,de.sanitizeOptionIconSvg)(e.icon_svg):null,[T,d,e.icon_svg]),D=v?(0,de.formatOptionCount)(e.item_count):null,F=(0,le.useRef)(void 0);(0,le.useEffect)(()=>()=>clearTimeout(F.current),[]);let A=()=>{o||!e.is_tappable||x||(R(!0),t(e),clearTimeout(F.current),F.current=setTimeout(()=>R(!1),170))},P=[$.item,a&&!o?$.highlighted:"",e.is_tappable?$.tappable:$.nonTappable,x?$.pressed:"",w?$.scrollHint:""].filter(Boolean).join(" ");return(0,se.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":o?"":void 0,"data-aia-icon":O&&e.icon?e.icon:void 0,"data-aia-image":T?"":void 0,"data-aia-item-count":D!==null?e.item_count:void 0,"aria-selected":a,className:P,style:{[de.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:o||!e.is_tappable?-1:0,onClick:A,onKeyDown:U=>{!o&&e.is_tappable&&(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),A())},onMouseEnter:!o&&e.is_tappable?n:void 0,onMouseLeave:i,children:(0,se.jsxs)("span",{className:$.content,children:[T&&(0,se.jsx)("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true",children:(0,se.jsx)("img",{src:T,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:j===T,onError:()=>H(T)})}),O&&(0,se.jsx)("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:O}}),(0,se.jsx)("span",{className:$.text,children:(0,de.optionLabel)(e)}),e.tag&&(0,se.jsx)("span",{className:$.tag,children:e.tag}),D!==null&&(0,se.jsx)("span",{className:`${$.count} magicx-aia-option-count`,children:D})]})})}var mt=require("react/jsx-runtime");function pa(){let[e,a]=(0,ce.useState)(q.isOptionsGridMobileViewport);return(0,ce.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(q.OPTIONS_GRID_MOBILE_QUERY),n=()=>a(t.matches);return n(),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e}function Lt({options:e,activeIndex:a,onSelect:t,onHighlight:n,onUnhighlight:i,listboxId:r,loading:o,groupKey:d="",optionsPosition:y="below",showIcons:v=!0,showImages:w=!0,showCounts:E=!0}){let u=pa(),x=(0,ce.useRef)(null),[R,T]=(0,ce.useState)(null),j=(0,ce.useRef)(null);(0,ce.useLayoutEffect)(()=>{if(o&&(0,q.sameOptionRows)(j.current,e))return;j.current=o?null:e;let O=x.current,F=O&&!o&&(0,q.needsOptionsGridMeasurement)(e.length,u)?(0,q.measureOptionsGrid)(O):null;T(F?(0,q.planOptionsGrid)(e.length,u,F.rowWidths,F.gridWidth):null)},[e,u,o]);let H=R??(0,q.planOptionsGrid)(e.length,u,null,null);return(0,mt.jsx)(Rt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:d,template:H.template,maxHeight:H.maxHeight,innerRef:O=>{x.current=O},"data-aia-group":d,children:e.map((O,D)=>(0,mt.jsx)(Dt,{option:O,isHighlighted:D===a,onSelect:t,onHighlight:()=>n(D),onUnhighlight:i?()=>i(D):void 0,id:`${r}-option-${D}`,loading:o,showIcon:v,showImage:w,showCount:E,scrollHint:!o&&H.scrollHintIndices.includes(D),enterDelayMs:o?0:(0,q.optionEnterDelayMs)(D,H.cols,e.length,y)},`${d}\0${O.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
2128
+ `,document.head.appendChild(e)}var V={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",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd"};var se=require("react/jsx-runtime");function Dt({option:e,isHighlighted:a,onSelect:t,onHighlight:n,onUnhighlight:i,id:r,loading:o,showIcon:d=!0,showImage:k=!0,showCount:w=!0,scrollHint:x,enterDelayMs:E=0}){let[m]=(0,le.useState)(E),[y,O]=(0,le.useState)(!1),A=k?(0,de.optionImageSrc)(e.image_url):null,[Z,H]=(0,le.useState)(null),D=(0,le.useMemo)(()=>!A&&d&&e.icon_svg?(0,de.sanitizeOptionIconSvg)(e.icon_svg):null,[A,d,e.icon_svg]),T=w?(0,de.formatOptionCount)(e.item_count):null,F=(0,le.useRef)(void 0);(0,le.useEffect)(()=>()=>clearTimeout(F.current),[]);let R=()=>{o||!e.is_tappable||y||(O(!0),t(e),clearTimeout(F.current),F.current=setTimeout(()=>O(!1),170))},P=[V.item,a&&!o?V.highlighted:"",e.is_tappable?V.tappable:V.nonTappable,y?V.pressed:"",x?V.scrollHint:""].filter(Boolean).join(" ");return(0,se.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":o?"":void 0,"data-aia-icon":D&&e.icon?e.icon:void 0,"data-aia-image":A?"":void 0,"data-aia-item-count":T!==null?e.item_count:void 0,"aria-selected":a,className:P,style:{[de.OPTION_ENTER_DELAY_VAR]:`${m}ms`},tabIndex:o||!e.is_tappable?-1:0,onClick:R,onKeyDown:Q=>{!o&&e.is_tappable&&(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),R())},onMouseEnter:!o&&e.is_tappable?n:void 0,onMouseLeave:i,children:(0,se.jsxs)("span",{className:V.content,children:[A&&(0,se.jsx)("span",{className:`${V.image} magicx-aia-option-image`,"aria-hidden":"true",children:(0,se.jsx)("img",{src:A,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:Z===A,onError:()=>H(A)})}),D&&(0,se.jsx)("span",{className:`${V.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:D}}),(0,se.jsx)("span",{className:V.text,children:(0,de.optionLabel)(e)}),e.tag&&(0,se.jsx)("span",{className:V.tag,children:e.tag}),T!==null&&(0,se.jsx)("span",{className:`${V.count} magicx-aia-option-count`,children:T})]})})}var mt=require("react/jsx-runtime");function pa(){let[e,a]=(0,ce.useState)(U.isOptionsGridMobileViewport);return(0,ce.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(U.OPTIONS_GRID_MOBILE_QUERY),n=()=>a(t.matches);return n(),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e}function Lt({options:e,activeIndex:a,onSelect:t,onHighlight:n,onUnhighlight:i,listboxId:r,loading:o,groupKey:d="",optionsPosition:k="below",showIcons:w=!0,showImages:x=!0,showCounts:E=!0}){let m=pa(),y=(0,ce.useRef)(null),[O,A]=(0,ce.useState)(null),Z=(0,ce.useRef)(null);(0,ce.useLayoutEffect)(()=>{if(o&&(0,U.sameOptionRows)(Z.current,e))return;Z.current=o?null:e;let D=y.current,F=D&&!o&&(0,U.needsOptionsGridMeasurement)(e.length,m)?(0,U.measureOptionsGrid)(D):null;A(F?(0,U.planOptionsGrid)(e.length,m,F.rowWidths,F.gridWidth):null)},[e,m,o]);let H=O??(0,U.planOptionsGrid)(e.length,m,null,null);return(0,mt.jsx)(Rt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:d,template:H.template,maxHeight:H.maxHeight,innerRef:D=>{y.current=D},"data-aia-group":d,children:e.map((D,T)=>(0,mt.jsx)(Dt,{option:D,isHighlighted:T===a,onSelect:t,onHighlight:()=>n(T),onUnhighlight:i?()=>i(T):void 0,id:`${r}-option-${T}`,loading:o,showIcon:w,showImage:x,showCount:E,scrollHint:!o&&H.scrollHintIndices.includes(T),enterDelayMs:o?0:(0,U.optionEnterDelayMs)(T,H.cols,e.length,k)},`${d}\0${D.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
2129
2129
  display: flex;
2130
2130
  flex-direction: column;
2131
2131
  gap: var(--aia-stack-space, 0.5rem);
@@ -2140,7 +2140,7 @@
2140
2140
  align-items: end;
2141
2141
  }
2142
2142
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
2143
- `,document.head.appendChild(e)}var Mt=require("react/jsx-runtime");function zt({space:e,align:a="stretch",className:t,children:n,...i}){let r=e?{"--aia-stack-space":e}:void 0;return(0,Mt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:r,...i,children:n})}var K=require("react/jsx-runtime"),ha=[159,119,164],ua=()=>{},Nt=()=>{};function ma(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=(0,ee.useState)(a);if((0,ee.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let i=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>n(i.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ga(e,a){let t=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let n=e.current,i=a.current;if(!n||!i)return;let r=n.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,Re.attachScrollArrow)({dropdown:n,grid:r,button:i})};return}t.current?.controller.update()}),(0,ee.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function at({suggestions:e,activeIndex:a,onSelect:t,onHighlight:n,onUnhighlight:i,isOpen:r,id:o,className:d,pills:y,onPillClick:v,showPills:w=!0,onSkip:E,showSkipButton:u=!0,showOptionIcons:x=!0,showOptionImages:R=!0,showOptionCounts:T=!0,skipDisabled:j=!1,activeSelected:H=!1,isLoading:O=!1,skeletonExiting:D=!1,isInputEmpty:F=!1,products:A,onProductSelect:P,onProductFocusChange:U,productsLayout:pe="row",productImageFallback:ye="image",formatType:he="options",dateView:ke=null,selectedDateIso:Z=null,selectedDateRange:g=null,dateRangeStart:Oe=null,onPreviousMonth:Ce,onNextMonth:Pe,optionsPosition:ue="below",mode:Se}){let me=ma(Se),ie=me!==void 0,X=(0,ee.useRef)(null),ge=(0,ee.useRef)(null);ga(X,ge),(0,ee.useEffect)(()=>{if(X.current)return(0,Re.containScroll)(X.current)},[]);let fe=e[0]?.options??[],c=!!(y&&y.length>0&&v),f=!!(A&&A.length>0),m=r&&(fe.length>0||w&&c||O||f),k={suggestions:e,activeIndex:a,pills:y,showPills:w,showSkipButton:u,showOptionIcons:x,showOptionImages:R,showOptionCounts:T,skipDisabled:j,activeSelected:H,isLoading:O,skeletonExiting:D,isInputEmpty:F,products:A,formatType:he,dateView:ke,selectedDateIso:Z,selectedDateRange:g,dateRangeStart:Oe},C=(0,ee.useRef)(k);m&&(C.current=k);let l=m?k:C.current,G=l.suggestions[0],W=G?.options??[],oe=l.activeIndex>=0&&!!W[l.activeIndex]?.is_tappable,b=!!(l.pills&&l.pills.length>0&&v),De=l.showPills&&b,We=l.showPills&&!b&&l.isLoading,be=De||We,p=b&&l.showSkipButton&&!l.isInputEmpty&&!!E,ve=l.pills?.[0]?.text,Le=(0,Re.isCalendarFormat)(l.formatType)&&l.dateView!=null,Ie=W.length>0&&!Le,Me=W.length>0&&Le&&!l.isLoading,Ee=l.isLoading&&!Ie&&!Me,Ne=l.products??[];return(0,K.jsxs)("div",{ref:X,id:o,role:"listbox","data-aia-dropdown":"","data-options-position":ue,"data-mode":me,"data-aia-loading":l.isLoading?"":void 0,"data-aia-skeleton-exiting":l.skeletonExiting?"":void 0,"data-aia-has-products":Ne.length>0?"":void 0,className:`${ie?"magicx-aia ":""}${we.dropdown} ${m?we.visible:""} ${d??""}`,onMouseDown:_=>_.preventDefault(),children:[(0,K.jsxs)(zt,{space:"8px",children:[(be||p)&&(0,K.jsxs)(Ue,{noWrap:!0,className:we.pillBar,"data-aia-pillbar":"",children:[be&&(0,K.jsx)("span",{className:we.pillScroll,"data-aia-pill-scroll":"",children:(0,K.jsx)(Je,{pills:l.pills??[],activePillIndex:0,activeSelected:l.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:l.isLoading})}),p&&(0,K.jsx)("button",{type:"button",tabIndex:-1,className:we.skip,"data-aia-skip":"",disabled:l.isLoading||l.skipDisabled,"aria-label":ve?`Skip ${ve}`:"Skip",onClick:E,children:"skip"})]}),Ie&&(0,K.jsx)(Lt,{options:W,activeIndex:l.activeIndex,onSelect:t,onHighlight:n,onUnhighlight:i,listboxId:o,loading:l.isLoading,groupKey:G?`${G.type} ${G.text}`:"",optionsPosition:ue,showIcons:l.showOptionIcons,showImages:l.showOptionImages,showCounts:l.showOptionCounts}),Me&&l.dateView&&(0,K.jsx)(Ct,{options:W,activeIndex:l.activeIndex,listboxId:o,view:l.dateView,selection:{selectedIso:l.selectedDateIso??null,selectedRange:l.selectedDateRange??null,rangeStart:l.dateRangeStart??null},onSelect:t,onHighlight:n,onUnhighlight:i,onPreviousMonth:Ce??Nt,onNextMonth:Pe??Nt}),Ee&&(0,K.jsx)("div",{className:we.skeletonBars,"data-aia-skeleton-bars":"",children:ha.map(_=>(0,K.jsx)("span",{className:we.skeletonBar,style:{width:_}},`bar-${_}`))}),(0,K.jsx)(Tt,{products:Ne,listboxId:o,onSelect:P??ua,onFocusChange:U,focusable:m,layout:pe,imageFallback:ye}),(0,K.jsx)(Pt,{isOptionHighlighted:oe,isInputEmpty:l.isInputEmpty})]}),(0,K.jsx)("button",{ref:ge,type:"button",tabIndex:-1,className:we.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Re.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,K.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,K.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Ge=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 {
2143
+ `,document.head.appendChild(e)}var zt=require("react/jsx-runtime");function Mt({space:e,align:a="stretch",className:t,children:n,...i}){let r=e?{"--aia-stack-space":e}:void 0;return(0,zt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:r,...i,children:n})}var K=require("react/jsx-runtime"),ha=[159,119,164],ua=()=>{},Nt=()=>{};function ma(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=(0,ee.useState)(a);if((0,ee.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let i=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>n(i.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ga(e,a){let t=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let n=e.current,i=a.current;if(!n||!i)return;let r=n.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,Re.attachScrollArrow)({dropdown:n,grid:r,button:i})};return}t.current?.controller.update()}),(0,ee.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function at({suggestions:e,activeIndex:a,onSelect:t,onHighlight:n,onUnhighlight:i,isOpen:r,id:o,className:d,pills:k,onPillClick:w,showPills:x=!0,onSkip:E,showSkipButton:m=!0,showOptionIcons:y=!0,showOptionImages:O=!0,showOptionCounts:A=!0,skipDisabled:Z=!1,activeSelected:H=!1,isLoading:D=!1,skeletonExiting:T=!1,isInputEmpty:F=!1,products:R,onProductSelect:P,onProductFocusChange:Q,productsLayout:pe="row",productImageFallback:ye="image",formatType:he="options",dateView:ke=null,selectedDateIso:$=null,selectedDateRange:f=null,dateRangeStart:Oe=null,onPreviousMonth:Ce,onNextMonth:Pe,optionsPosition:ue="below",mode:Se}){let me=ma(Se),ie=me!==void 0,X=(0,ee.useRef)(null),ge=(0,ee.useRef)(null);ga(X,ge),(0,ee.useEffect)(()=>{if(X.current)return(0,Re.containScroll)(X.current)},[]);let fe=e[0]?.options??[],c=!!(k&&k.length>0&&w),g=!!(R&&R.length>0),u=r&&(fe.length>0||x&&c||D||g),b={suggestions:e,activeIndex:a,pills:k,showPills:x,showSkipButton:m,showOptionIcons:y,showOptionImages:O,showOptionCounts:A,skipDisabled:Z,activeSelected:H,isLoading:D,skeletonExiting:T,isInputEmpty:F,products:R,formatType:he,dateView:ke,selectedDateIso:$,selectedDateRange:f,dateRangeStart:Oe},C=(0,ee.useRef)(b);u&&(C.current=b);let l=u?b:C.current,W=l.suggestions[0],_=W?.options??[],oe=l.activeIndex>=0&&!!_[l.activeIndex]?.is_tappable,v=!!(l.pills&&l.pills.length>0&&w),De=l.showPills&&v,We=l.showPills&&!v&&l.isLoading,be=De||We,p=v&&l.showSkipButton&&!l.isInputEmpty&&!!E,ve=l.pills?.[0]?.text,Le=(0,Re.isCalendarFormat)(l.formatType)&&l.dateView!=null,Ie=_.length>0&&!Le,ze=_.length>0&&Le&&!l.isLoading,Ee=l.isLoading&&!Ie&&!ze,Ne=l.products??[];return(0,K.jsxs)("div",{ref:X,id:o,role:"listbox","data-aia-dropdown":"","data-options-position":ue,"data-mode":me,"data-aia-loading":l.isLoading?"":void 0,"data-aia-skeleton-exiting":l.skeletonExiting?"":void 0,"data-aia-has-products":Ne.length>0?"":void 0,className:`${ie?"magicx-aia ":""}${we.dropdown} ${u?we.visible:""} ${d??""}`,onMouseDown:q=>q.preventDefault(),children:[(0,K.jsxs)(Mt,{space:"8px",children:[(be||p)&&(0,K.jsxs)(Ue,{noWrap:!0,className:we.pillBar,"data-aia-pillbar":"",children:[be&&(0,K.jsx)("span",{className:we.pillScroll,"data-aia-pill-scroll":"",children:(0,K.jsx)(Je,{pills:l.pills??[],activePillIndex:0,activeSelected:l.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:l.isLoading})}),p&&(0,K.jsx)("button",{type:"button",tabIndex:-1,className:we.skip,"data-aia-skip":"",disabled:l.isLoading||l.skipDisabled,"aria-label":ve?`Skip ${ve}`:"Skip",onClick:E,children:"skip"})]}),Ie&&(0,K.jsx)(Lt,{options:_,activeIndex:l.activeIndex,onSelect:t,onHighlight:n,onUnhighlight:i,listboxId:o,loading:l.isLoading,groupKey:W?`${W.type} ${W.text}`:"",optionsPosition:ue,showIcons:l.showOptionIcons,showImages:l.showOptionImages,showCounts:l.showOptionCounts}),ze&&l.dateView&&(0,K.jsx)(Ct,{options:_,activeIndex:l.activeIndex,listboxId:o,view:l.dateView,selection:{selectedIso:l.selectedDateIso??null,selectedRange:l.selectedDateRange??null,rangeStart:l.dateRangeStart??null},onSelect:t,onHighlight:n,onUnhighlight:i,onPreviousMonth:Ce??Nt,onNextMonth:Pe??Nt}),Ee&&(0,K.jsx)("div",{className:we.skeletonBars,"data-aia-skeleton-bars":"",children:ha.map(q=>(0,K.jsx)("span",{className:we.skeletonBar,style:{width:q}},`bar-${q}`))}),(0,K.jsx)(Tt,{products:Ne,listboxId:o,onSelect:P??ua,onFocusChange:Q,focusable:u,layout:pe,imageFallback:ye}),(0,K.jsx)(Pt,{isOptionHighlighted:oe,isInputEmpty:l.isInputEmpty})]}),(0,K.jsx)("button",{ref:ge,type:"button",tabIndex:-1,className:we.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Re.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,K.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,K.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Ge=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 {
2144
2144
  flex-shrink: 0;
2145
2145
  width: 32px;
2146
2146
  height: 32px;
@@ -2193,5 +2193,5 @@
2193
2193
  );
2194
2194
  cursor: default;
2195
2195
  }
2196
- `,document.head.appendChild(e)}var Bt={submitButton:"aia-submitButton-otz7H"};var it=require("react/jsx-runtime");function Ht({disabled:e,onClick:a}){return(0,it.jsx)("button",{type:"button","data-aia-submit":"",className:Bt.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),a()},"aria-label":"Submit",children:(0,it.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,it.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"),I=require("react");var gt=require("react");function Ft(e){let a=(0,gt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),n=(0,gt.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let i={};for(let r of Object.keys(e??{})){let o=(d,y,v)=>{let w=a.current?.[r];return w?w(d,y,v):[]};i[r]=o}n.current={key:t,overrides:e?i:void 0}}return{overrides:n.current.overrides,key:t}}var ft=require("react");function Kt(e){let a=(0,ft.useRef)(e);a.current=e;let t=(0,ft.useRef)(null);t.current===null&&(t.current={fetch:(i,r)=>{let o=a.current;return o?o.fetch(i,r):Promise.reject(new Error("products config removed"))},transform:i=>a.current?.transform(i)??[],get limit(){return a.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var fa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],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,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function ot({onSubmit:e,onResult:a,onError:t,optionOverrides:n,maskCompletedText:i,apiConfig:r,additionalContext:o,visitorId:d,columns:y=2,dropdownTrigger:v,optionsPosition:w,closeDropdownOnBlur:E,showNonTappableOptions:u,showOptionIcons:x,showOptionImages:R,showOptionCounts:T,showSkipButton:j,showProducts:H,productImageFallback:O="image",onFocus:D,onBlur:F,value:A,completedParams:P,onChange:U,onParamsChange:pe,products:ye,onProductSelect:he,source:ke,setCursor:Z}){let g=(0,I.useRef)(null),[Oe,Ce]=(0,I.useState)(null),Pe=(0,I.useRef)(e);Pe.current=e;let ue=(0,I.useRef)(a);ue.current=a;let Se=(0,I.useRef)(t);Se.current=t;let me=(0,I.useRef)(U);me.current=U;let ie=(0,I.useRef)(pe);ie.current=pe;let X=(0,I.useRef)(D);X.current=D;let ge=(0,I.useRef)(F);ge.current=F;let fe=(0,I.useRef)(Z);fe.current=Z;let c=(0,I.useRef)(he);c.current=he;let f=(0,I.useRef)(d);f.current=d;let m=(0,I.useRef)(()=>{let h=f.current;return typeof h=="function"?h():h}).current,k=Kt(ye),C=Ft(n);(0,I.useEffect)(()=>{if(typeof document>"u")return;let h=new Ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:o,visitorId:m,optionOverrides:C.overrides,maskCompletedText:i,columns:y,dropdownTrigger:v,optionsPosition:w,closeDropdownOnBlur:E,showNonTappableOptions:u,showProducts:H,source:ke,value:A,completedParams:P,onSubmit:(...B)=>Pe.current?.(...B),onResult:(...B)=>ue.current?.(...B),onError:(...B)=>Se.current?.(...B),onChange:(...B)=>me.current?.(...B),onParamsChange:(...B)=>ie.current?.(...B),onFocus:()=>X.current?.(),onBlur:()=>ge.current?.(),onProductSelect:B=>c.current?.(B),setCursor:B=>fe.current?.(B),products:k.config});g.current=h,Ce(h.getState());let J=h.subscribe(B=>Ce(B));return()=>{J(),h.destroy(),g.current===h&&(g.current=null)}},[]),(0,I.useEffect)(()=>{A!==void 0&&g.current?.setValue(A)},[A]),(0,I.useEffect)(()=>{P!==void 0&&g.current?.setCompletedParams(P)},[P]);let l=JSON.stringify(r??null),G;try{G=JSON.stringify(o??null)}catch{G="[unstringifiable]"}(0,I.useEffect)(()=>{g.current?.update({apiConfig:r,additionalContext:o,optionOverrides:C.overrides,dropdownTrigger:v,optionsPosition:w,closeDropdownOnBlur:E,showNonTappableOptions:u,showProducts:H})},[l,G,C.key,v,w,E,u,H]);let W=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!W.current){W.current=!0;return}g.current?.update({products:k.config})},[k.enabled]);let oe=(0,I.useRef)(null);oe.current===null&&(oe.current={handleTextChange:h=>g.current?.handleTextChange(h),handleKeyDown:h=>{let J="nativeEvent"in h?h.nativeEvent:h;g.current?.handleKeyDown(J)},setFocused:h=>g.current?.setFocused(h),startEditingParam:h=>g.current?.startEditingParam(h),exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:h=>g.current?.handleCaretAfterInput(h),handleCaretMove:h=>g.current?.handleCaretMove(h),replaceEditingRange:h=>g.current?.replaceEditingRange(h)??!1,setActivePill:h=>g.current?.setActivePill(h),skipActivePill:()=>g.current?.skipActivePill(),removeLastParam:()=>g.current?.removeLastParam(),clearNewParamId:()=>g.current?.clearNewParamId(),reset:()=>g.current?.reset(),recordSubmit:h=>g.current?.recordSubmit(h),selectOption:h=>g.current?.selectOption(h),selectProduct:h=>g.current?.selectProduct(h),setActiveDropdownIndex:h=>g.current?.setActiveDropdownIndex(h),clearHighlight:h=>g.current?.clearHighlight(h),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let b=oe.current,De=(0,I.useCallback)(h=>{let J=h.target.value,st=J.length>0&&!h.nativeEvent?.isComposing&&J[0]!==J[0].toUpperCase()?J[0].toUpperCase()+J.slice(1):J;g.current?.handleTextChange(st)},[]),We=(0,I.useCallback)(h=>{g.current?.handleKeyDown(h.nativeEvent)},[]),be=g.current,p=Oe??fa,ve=A!==void 0?A:p.text,Le=P!==void 0?P:p.completedParams,Ie=p.actionableSuggestions,Me=Ie[0],Ee=be?.listboxId??"",Ne=p.activeDropdownIndex>=0&&be?`${Ee}-option-${p.activeDropdownIndex}`:void 0,_=p.editingParam,Te=p.editingIdentified,Be=_?{type:_.suggestionType,text:_.suggestionPlaceholder,required:!0,options:_.options}:Te?{type:Te.type,text:(0,Ke.identifiedParamLabel)(Te.type),required:!0,options:[]}:null,Ye=p.dropdownSuggestion??Be??Me,rt=Be?[Be]:Ie,_e=(0,Ke.dateSelectionFor)(p),je=!be||p.dropdownLoading;return{completedParams:Le,skippedParams:p.skippedParams,identifiedParams:p.identifiedParams,suggestionPills:Ie,setActivePill:b.setActivePill,skipActivePill:b.skipActivePill,removeLastParam:b.removeLastParam,segments:p.segments,newParamId:p.newParamId,clearNewParamId:b.clearNewParamId,suggestions:p.suggestions,activeIndex:p.activeDropdownIndex,isReady:p.isReady,isLoading:je,isFocused:p.isFocused,isDropdownOpen:p.isDropdownOpen,isActivePillSelected:p.isActivePillSelected,placeholderText:p.placeholderText,listboxId:Ee,error:p.error,products:p.products,customFields:p.customFields,selectProduct:b.selectProduct,handleTextChange:b.handleTextChange,handleKeyDown:b.handleKeyDown,setFocused:b.setFocused,editingParam:_,editingIdentified:Te,editingAnchor:p.editingAnchor,caretOffset:p.caretOffset,startEditingParam:b.startEditingParam,exitEditMode:b.exitEditMode,handleCaretAfterInput:b.handleCaretAfterInput,handleCaretMove:b.handleCaretMove,replaceEditingRange:b.replaceEditingRange,inputProps:{value:ve,placeholder:p.placeholderText||void 0,onChange:De,onKeyDown:We,onFocus:b.handleFocus,onBlur:b.handleBlur,role:"combobox","aria-expanded":p.isDropdownOpen,"aria-activedescendant":Ne,"aria-autocomplete":"list","aria-controls":Ee},reset:b.reset,recordSubmit:b.recordSubmit,dropdownProps:{suggestions:Ye?[{...Ye,options:p.dropdownOptions}]:[],activeIndex:p.activeDropdownIndex,onSelect:b.selectOption,onHighlight:b.setActiveDropdownIndex,onUnhighlight:b.clearHighlight,isOpen:p.isDropdownOpen,id:Ee,pills:rt,activeSelected:p.isActivePillSelected,onPillClick:b.setActivePill,onSkip:b.skipActivePill,showSkipButton:(j??!0)&&!_&&!Te,showOptionIcons:x??!0,showOptionImages:R??!0,showOptionCounts:T??!0,skipDisabled:p.inSelectionAnimation,isLoading:je,skeletonExiting:p.skeletonExiting,isInputEmpty:ve.trim().length===0,products:p.products,productImageFallback:O,onProductSelect:b.selectProduct,onProductFocusChange:b.setFocused,formatType:p.activeFormatType,dateView:p.dateView,selectedDateIso:_e.selectedIso,selectedDateRange:_e.selectedRange,dateRangeStart:_e.rangeStart,onPreviousMonth:b.showPreviousMonth,onNextMonth:b.showNextMonth,optionsPosition:w??"below"}}}var V=require("@magicx-eng/ai-autocomplete-vanilla"),S=require("react"),nt;function ba(){if(nt!==void 0)return nt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),nt=e.contentEditable==="plaintext-only",nt}function Gt(e){let{segments:a,showChipIcons:t=!0,showChipImages:n=!0,newParamId:i,editingParam:r,editingIdentified:o,editingAnchor:d,caretOffset:y,placeholderText:v,isFocused:w,isDropdownOpen:E,listboxId:u,activeDescendantId:x,autoFocus:R,handleTextChange:T,handleKeyDown:j,handleCaretAfterInput:H,handleCaretMove:O,startEditingParam:D,replaceEditingRange:F,setFocused:A}=e,P=(0,S.useRef)(null),U=(0,S.useRef)(!1),pe=(0,S.useRef)(""),ye=(0,S.useRef)(""),he=(0,S.useRef)(null),ke=(0,S.useRef)(0);he.current=y,(0,S.useEffect)(()=>{if(!R)return;let c=P.current;if(!c)return;document.activeElement===c?A(!0):c.focus();let f=c.ownerDocument??document,m=f.getSelection(),k=m&&m.rangeCount>0&&c.contains(m.anchorNode);if(m&&!k){let C=f.createRange();C.selectNodeContents(c),C.collapse(!0),m.removeAllRanges(),m.addRange(C)}},[R,A]),(0,S.useEffect)(()=>{let c=P.current;if(!c)return;let f=c.ownerDocument??document,m=()=>{let k=f.getSelection();if(!k||k.rangeCount===0||!k.anchorNode||!c.contains(k.anchorNode))return;let C=k.anchorNode,l=C.nodeType===Node.ELEMENT_NODE?C:C.parentElement,W=(k.isCollapsed?l?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,oe=r?.id??o?.id??null;if(W&&W!==oe){D(W);return}performance.now()-ke.current<50||O((0,V.getCursorOffset)(c))};return f.addEventListener("selectionchange",m),()=>f.removeEventListener("selectionchange",m)},[r,o,D,O]),(0,S.useLayoutEffect)(()=>{let c=P.current;c&&(0,V.renderEditableContent)({input:c,segments:a,newParamId:i,editingParamId:r?.id??null,placeholderText:v??"",isFocused:w,showChipIcons:t,showChipImages:n})},[a,i,r,v,w,t,n]),(0,S.useLayoutEffect)(()=>{let c=pe.current,f=i??"";if(pe.current=f,!f||f===c)return;let m=P.current;if(!m)return;m.focus();let k=he.current??(0,V.plainTextLength)(m);(0,V.setCursorOffset)(m,k)},[i]),(0,S.useLayoutEffect)(()=>{let c=ye.current,f=r?.id??"";if(ye.current=f,!f||f===c||d==null)return;let m=P.current;m&&(0,V.setCursorOffset)(m,d)},[r,d]);let Z=(0,S.useCallback)(()=>{if(U.current)return;let c=P.current;if(!c)return;let f=(0,V.extractPlainText)(c),k=f.length>0&&f[0]!==f[0].toUpperCase()?f[0].toUpperCase()+f.slice(1):f;T(k)},[T]),g=(0,S.useCallback)(()=>{ke.current=performance.now(),Z();let c=P.current;c&&H((0,V.getCursorOffset)(c))},[Z,H]);(0,S.useEffect)(()=>{let c=P.current;if(!c)return;let f=m=>{let k=m,C=k.inputType;if(C==="insertParagraph"||C==="insertLineBreak"||C==="insertFromDrop"){m.preventDefault();return}if(C.startsWith("insert")||C.startsWith("delete")){let l=C.startsWith("delete")?"":k.data??"";F(l)&&m.preventDefault()}};return c.addEventListener("beforeinput",f),()=>c.removeEventListener("beforeinput",f)},[F]);let Oe=(0,S.useCallback)(()=>{U.current=!0},[]),Ce=(0,S.useCallback)(()=>{U.current=!1,Z()},[Z]),Pe=(0,S.useCallback)(c=>{c.preventDefault();let f=P.current;if(!f)return;let m=(c.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!m)return;let k=f.ownerDocument??document,C=k.getSelection();if(!C||C.rangeCount===0)return;let l=C.getRangeAt(0);if(!f.contains(l.startContainer))return;l.deleteContents();let G=k.createTextNode(m);l.insertNode(G),l.setStartAfter(G),l.collapse(!0),C.removeAllRanges(),C.addRange(l),Z()},[Z]),ue=(0,S.useCallback)(c=>j(c),[j]),Se=(0,S.useCallback)(()=>A(!0),[A]),me=(0,S.useCallback)(()=>A(!1),[A]),ie=(0,S.useCallback)(()=>P.current?.focus(),[]),X=(0,S.useCallback)(()=>P.current?.blur(),[]),ge=(0,S.useCallback)(()=>{let c=P.current;return c?(0,V.extractPlainText)(c):""},[]),fe=ba()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:fe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":u,"aria-expanded":E,"aria-activedescendant":x,spellCheck:!0,enterKeyHint:"send",onInput:g,onKeyDown:ue,onCompositionStart:Oe,onCompositionEnd:Ce,onPaste:Pe,onFocus:Se,onBlur:me},getPlainText:ge,focus:ie,blur:X}}var ae=require("react/jsx-runtime");function va(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Wt=(0,N.forwardRef)(function({onSubmit:a,onResult:t,onError:n,optionOverrides:i,maskCompletedText:r,className:o,apiConfig:d,additionalContext:y,visitorId:v,columns:w,pillPlacement:E="dropdown",mode:u="auto",optionsPosition:x="below",animations:R=!0,dropdownTrigger:T,closeDropdownOnBlur:j,showNonTappableOptions:H,showOptionIcons:O=!0,showChipIcons:D=!0,showChipImages:F=!0,showOptionImages:A=!0,showOptionCounts:P=!0,showSkipButton:U,showProducts:pe,productsLayout:ye,productImageFallback:he,autoFocus:ke=!0,onFocus:Z,onBlur:g,value:Oe,completedParams:Ce,onChange:Pe,onParamsChange:ue,products:Se,onProductSelect:me,submitButton:ie,resetOnSubmit:X=!0},ge){let fe=(0,N.useRef)(null),c=(0,N.useRef)(null),f=(0,N.useRef)(()=>{}),m=(0,N.useRef)(null),k=(0,N.useRef)(null);(0,N.useEffect)(()=>{let L=fe.current;if(L)return m.current?m.current.setMode(u):m.current=new Ge.ModeController(L,u),()=>{m.current?.destroy(),m.current=null}},[u]);let C=(0,N.useCallback)(L=>{let ne=k.current?.current;ne&&(ne.focus(),(0,Ge.setCursorOffset)(ne,L))},[]),{completedParams:l,skippedParams:G,identifiedParams:W,isReady:oe,customFields:b,suggestionPills:De,setActivePill:We,skipActivePill:be,segments:p,newParamId:ve,clearNewParamId:Le,placeholderText:Ie,isFocused:Me,isDropdownOpen:Ee,isActivePillSelected:Ne,isLoading:_,activeIndex:Te,listboxId:Be,handleTextChange:Ye,handleKeyDown:rt,setFocused:_e,editingParam:je,editingIdentified:h,editingAnchor:J,caretOffset:B,startEditingParam:st,handleCaretAfterInput:_t,handleCaretMove:qt,replaceEditingRange:Ut,dropdownProps:Qt,reset:Ze,recordSubmit:bt}=ot({onSubmit:L=>f.current(L),onResult:t,onError:n,optionOverrides:i,maskCompletedText:r,apiConfig:d,additionalContext:y,visitorId:v,columns:w,dropdownTrigger:T,optionsPosition:x,closeDropdownOnBlur:j,showNonTappableOptions:H,showOptionIcons:O,showOptionImages:A,showOptionCounts:P,showSkipButton:U,showProducts:pe,onFocus:Z,onBlur:g,value:Oe,completedParams:Ce,onChange:Pe,onParamsChange:ue,products:Se,onProductSelect:me,source:"full-sdk",setCursor:C});(0,N.useEffect)(()=>{if(!ve)return;let L=window.setTimeout(()=>Le(),650);return()=>window.clearTimeout(L)},[ve,Le]);let Yt=Te>=0?`${Be}-option-${Te}`:void 0,{inputRef:lt,editorProps:jt,focus:$e,blur:vt,getPlainText:wt}=Gt({segments:p,newParamId:ve,editingParam:je,editingIdentified:h,editingAnchor:J,caretOffset:B,placeholderText:Ie,isFocused:Me,showChipIcons:D,showChipImages:F,isDropdownOpen:Ee,listboxId:Be,activeDescendantId:Yt,autoFocus:ke,handleTextChange:Ye,handleKeyDown:rt,handleCaretAfterInput:_t,handleCaretMove:qt,startEditingParam:st,replaceEditingRange:Ut,setFocused:_e});k.current=lt,(0,N.useLayoutEffect)(()=>{let L=c.current,ne=lt.current;if(!L||!ne)return;let qe=()=>{let yt=L.firstElementChild;if(!yt)return;let Xt=yt.getBoundingClientRect(),Jt=ne.getBoundingClientRect();Xt.top>=Jt.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};qe();let xt=new ResizeObserver(qe);return xt.observe(ne),()=>xt.disconnect()},[p,De.length,_,lt]),(0,N.useImperativeHandle)(ge,()=>({focus:$e,blur:vt,reset:Ze,setMode:L=>m.current?.setMode(L),skipActivePill:be}),[$e,vt,Ze,be]);let Ve=!!p.length||l.length>0,dt=(0,N.useCallback)(L=>{if(!Ve)return;let ne=wt(),qe=(0,Ge.buildSubmitResult)(ne,l,G,{identifiedParams:W,isReady:oe,customFields:b});L&&bt(qe),a(qe),X&&Ze()},[bt,X,Ve,l,G,W,oe,b,a,Ze,wt]);f.current=()=>dt(!1);let Zt=(0,N.useCallback)(L=>{L.target?.closest("[data-aia-pill]")||$e()},[$e]),$t=E==="inline",Vt=E==="dropdown";return(0,ae.jsxs)("div",{ref:fe,className:`magicx-aia ${ze.container} ${o??""}`,"data-pill-placement":E,"data-options-position":x,"data-animations":R?"on":"off","data-mode":va(u),children:[(0,ae.jsx)(at,{...Qt,showPills:Vt,productsLayout:ye,productImageFallback:he}),(0,ae.jsxs)("div",{className:ze.inputWrapper,"data-aia-input-wrapper":"",onClick:Zt,children:[(0,ae.jsxs)("div",{className:ze.editorArea,"data-aia-editor":"",children:[(0,ae.jsx)("div",{...jt,className:ze.input,"data-aia-input":""}),$t&&(_||De.length>0)&&(0,ae.jsx)("span",{ref:c,className:ze.pillListContainer,"data-aia-pill-list-container":"",children:(0,ae.jsx)(Je,{pills:De,activePillIndex:0,activeSelected:Ne,onSelectPill:We,loading:_})})]}),ie===null?null:ie===void 0?(0,ae.jsx)(Ht,{disabled:!Ve,onClick:()=>dt(!0)}):(0,ae.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:ze.submitSlot,onClick:L=>{Ve&&(L.stopPropagation(),dt(!0))},children:ie})]})]})});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,optionImageSrc,optionLabel,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
2196
+ `,document.head.appendChild(e)}var Bt={submitButton:"aia-submitButton-otz7H"};var it=require("react/jsx-runtime");function Ht({disabled:e,onClick:a}){return(0,it.jsx)("button",{type:"button","data-aia-submit":"",className:Bt.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),a()},"aria-label":"Submit",children:(0,it.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,it.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"),I=require("react");var gt=require("react");function Ft(e){let a=(0,gt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),n=(0,gt.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let i={};for(let r of Object.keys(e??{})){let o=(d,k,w)=>{let x=a.current?.[r];return x?x(d,k,w):[]};i[r]=o}n.current={key:t,overrides:e?i:void 0}}return{overrides:n.current.overrides,key:t}}var ft=require("react");function Kt(e){let a=(0,ft.useRef)(e);a.current=e;let t=(0,ft.useRef)(null);t.current===null&&(t.current={fetch:(i,r)=>{let o=a.current;return o?o.fetch(i,r):Promise.reject(new Error("products config removed"))},transform:i=>a.current?.transform(i)??[],get limit(){return a.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var fa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],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,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function ot({onSubmit:e,onResult:a,onError:t,optionOverrides:n,maskCompletedText:i,apiConfig:r,additionalContext:o,visitorId:d,columns:k=2,dropdownTrigger:w,optionsPosition:x,closeDropdownOnBlur:E,showNonTappableOptions:m,showOptionIcons:y,showOptionImages:O,showOptionCounts:A,showSkipButton:Z,showProducts:H,productImageFallback:D="image",onFocus:T,onBlur:F,value:R,completedParams:P,onChange:Q,onParamsChange:pe,products:ye,onProductSelect:he,source:ke,setCursor:$}){let f=(0,I.useRef)(null),[Oe,Ce]=(0,I.useState)(null),Pe=(0,I.useRef)(e);Pe.current=e;let ue=(0,I.useRef)(a);ue.current=a;let Se=(0,I.useRef)(t);Se.current=t;let me=(0,I.useRef)(Q);me.current=Q;let ie=(0,I.useRef)(pe);ie.current=pe;let X=(0,I.useRef)(T);X.current=T;let ge=(0,I.useRef)(F);ge.current=F;let fe=(0,I.useRef)($);fe.current=$;let c=(0,I.useRef)(he);c.current=he;let g=(0,I.useRef)(d);g.current=d;let u=(0,I.useRef)(()=>{let h=g.current;return typeof h=="function"?h():h}).current,b=Kt(ye),C=Ft(n);(0,I.useEffect)(()=>{if(typeof document>"u")return;let h=new Ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:o,visitorId:u,optionOverrides:C.overrides,maskCompletedText:i,columns:k,dropdownTrigger:w,optionsPosition:x,closeDropdownOnBlur:E,showNonTappableOptions:m,showProducts:H,source:ke,value:R,completedParams:P,onSubmit:(...B)=>Pe.current?.(...B),onResult:(...B)=>ue.current?.(...B),onError:(...B)=>Se.current?.(...B),onChange:(...B)=>me.current?.(...B),onParamsChange:(...B)=>ie.current?.(...B),onFocus:()=>X.current?.(),onBlur:()=>ge.current?.(),onProductSelect:B=>c.current?.(B),setCursor:B=>fe.current?.(B),products:b.config});f.current=h,Ce(h.getState());let J=h.subscribe(B=>Ce(B));return()=>{J(),h.destroy(),f.current===h&&(f.current=null)}},[]),(0,I.useEffect)(()=>{R!==void 0&&f.current?.setValue(R)},[R]),(0,I.useEffect)(()=>{P!==void 0&&f.current?.setCompletedParams(P)},[P]);let l=JSON.stringify(r??null),W;try{W=JSON.stringify(o??null)}catch{W="[unstringifiable]"}(0,I.useEffect)(()=>{f.current?.update({apiConfig:r,additionalContext:o,optionOverrides:C.overrides,dropdownTrigger:w,optionsPosition:x,closeDropdownOnBlur:E,showNonTappableOptions:m,showProducts:H})},[l,W,C.key,w,x,E,m,H]);let _=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!_.current){_.current=!0;return}f.current?.update({products:b.config})},[b.enabled]);let oe=(0,I.useRef)(null);oe.current===null&&(oe.current={handleTextChange:h=>f.current?.handleTextChange(h),handleKeyDown:h=>{let J="nativeEvent"in h?h.nativeEvent:h;f.current?.handleKeyDown(J)},setFocused:h=>f.current?.setFocused(h),startEditingParam:h=>f.current?.startEditingParam(h),exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:h=>f.current?.handleCaretAfterInput(h),handleCaretMove:h=>f.current?.handleCaretMove(h),replaceEditingRange:h=>f.current?.replaceEditingRange(h)??!1,setActivePill:h=>f.current?.setActivePill(h),skipActivePill:()=>f.current?.skipActivePill(),removeLastParam:()=>f.current?.removeLastParam(),clearNewParamId:()=>f.current?.clearNewParamId(),reset:()=>f.current?.reset(),recordSubmit:h=>f.current?.recordSubmit(h),selectOption:h=>f.current?.selectOption(h),selectProduct:h=>f.current?.selectProduct(h),setActiveDropdownIndex:h=>f.current?.setActiveDropdownIndex(h),clearHighlight:h=>f.current?.clearHighlight(h),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let v=oe.current,De=(0,I.useCallback)(h=>{let J=h.target.value,st=J.length>0&&!h.nativeEvent?.isComposing&&J[0]!==J[0].toUpperCase()?J[0].toUpperCase()+J.slice(1):J;f.current?.handleTextChange(st)},[]),We=(0,I.useCallback)(h=>{f.current?.handleKeyDown(h.nativeEvent)},[]),be=f.current,p=Oe??fa,ve=R!==void 0?R:p.text,Le=P!==void 0?P:p.completedParams,Ie=p.actionableSuggestions,ze=Ie[0],Ee=be?.listboxId??"",Ne=p.activeDropdownIndex>=0&&be?`${Ee}-option-${p.activeDropdownIndex}`:void 0,q=p.editingParam,Te=p.editingIdentified,Be=q?{type:q.suggestionType,text:q.suggestionPlaceholder,required:!0,options:q.options}:Te?{type:Te.type,text:(0,Ke.identifiedParamLabel)(Te.type),required:!0,options:[]}:null,Ye=p.dropdownSuggestion??Be??ze,rt=Be?[Be]:Ie,_e=(0,Ke.dateSelectionFor)(p),je=!be||p.dropdownLoading;return{completedParams:Le,skippedParams:p.skippedParams,identifiedParams:p.identifiedParams,suggestionPills:Ie,setActivePill:v.setActivePill,skipActivePill:v.skipActivePill,removeLastParam:v.removeLastParam,segments:p.segments,newParamId:p.newParamId,clearNewParamId:v.clearNewParamId,suggestions:p.suggestions,activeIndex:p.activeDropdownIndex,isReady:p.isReady,isLoading:je,isFocused:p.isFocused,isDropdownOpen:p.isDropdownOpen,isActivePillSelected:p.isActivePillSelected,placeholderText:p.placeholderText,listboxId:Ee,error:p.error,products:p.products,customFields:p.customFields,selectProduct:v.selectProduct,handleTextChange:v.handleTextChange,handleKeyDown:v.handleKeyDown,setFocused:v.setFocused,editingParam:q,editingIdentified:Te,editingAnchor:p.editingAnchor,caretOffset:p.caretOffset,startEditingParam:v.startEditingParam,exitEditMode:v.exitEditMode,handleCaretAfterInput:v.handleCaretAfterInput,handleCaretMove:v.handleCaretMove,replaceEditingRange:v.replaceEditingRange,inputProps:{value:ve,placeholder:p.placeholderText||void 0,onChange:De,onKeyDown:We,onFocus:v.handleFocus,onBlur:v.handleBlur,role:"combobox","aria-expanded":p.isDropdownOpen,"aria-activedescendant":Ne,"aria-autocomplete":"list","aria-controls":Ee},reset:v.reset,recordSubmit:v.recordSubmit,dropdownProps:{suggestions:Ye?[{...Ye,options:p.dropdownOptions}]:[],activeIndex:p.activeDropdownIndex,onSelect:v.selectOption,onHighlight:v.setActiveDropdownIndex,onUnhighlight:v.clearHighlight,isOpen:p.isDropdownOpen,id:Ee,pills:rt,activeSelected:p.isActivePillSelected,onPillClick:v.setActivePill,onSkip:v.skipActivePill,showSkipButton:(Z??!0)&&!q&&!Te,showOptionIcons:y??!0,showOptionImages:O??!0,showOptionCounts:A??!0,skipDisabled:p.inSelectionAnimation,isLoading:je,skeletonExiting:p.skeletonExiting,isInputEmpty:ve.trim().length===0,products:p.products,productImageFallback:D,onProductSelect:v.selectProduct,onProductFocusChange:v.setFocused,formatType:p.activeFormatType,dateView:p.dateView,selectedDateIso:_e.selectedIso,selectedDateRange:_e.selectedRange,dateRangeStart:_e.rangeStart,onPreviousMonth:v.showPreviousMonth,onNextMonth:v.showNextMonth,optionsPosition:x??"below"}}}var G=require("@magicx-eng/ai-autocomplete-vanilla"),S=require("react"),nt;function ba(){if(nt!==void 0)return nt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),nt=e.contentEditable==="plaintext-only",nt}function Gt(e){let{segments:a,showChipIcons:t=!0,showChipImages:n=!0,newParamId:i,editingParam:r,editingIdentified:o,editingAnchor:d,caretOffset:k,placeholderText:w,isFocused:x,isDropdownOpen:E,listboxId:m,activeDescendantId:y,autoFocus:O,handleTextChange:A,handleKeyDown:Z,handleCaretAfterInput:H,handleCaretMove:D,startEditingParam:T,replaceEditingRange:F,setFocused:R}=e,P=(0,S.useRef)(null),Q=(0,S.useRef)(!1),pe=(0,S.useRef)(""),ye=(0,S.useRef)(""),he=(0,S.useRef)(null),ke=(0,S.useRef)(0);he.current=k,(0,S.useEffect)(()=>{if(!O)return;let c=P.current;if(!c)return;document.activeElement===c?R(!0):c.focus();let g=c.ownerDocument??document,u=g.getSelection(),b=u&&u.rangeCount>0&&c.contains(u.anchorNode);if(u&&!b){let C=g.createRange();C.selectNodeContents(c),C.collapse(!0),u.removeAllRanges(),u.addRange(C)}},[O,R]),(0,S.useEffect)(()=>{let c=P.current;if(!c)return;let g=c.ownerDocument??document,u=()=>{let b=g.getSelection();if(!b||b.rangeCount===0||!b.anchorNode||!c.contains(b.anchorNode))return;let C=b.anchorNode,l=C.nodeType===Node.ELEMENT_NODE?C:C.parentElement,_=(b.isCollapsed?l?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,oe=r?.id??o?.id??null;if(_&&_!==oe){T(_);return}performance.now()-ke.current<50||D((0,G.getCursorOffset)(c))};return g.addEventListener("selectionchange",u),()=>g.removeEventListener("selectionchange",u)},[r,o,T,D]),(0,S.useEffect)(()=>{let c=P.current;if(!c)return;let g=u=>{let b=(0,G.chipIdFromTap)(c,u.target);b&&(T(b),(0,G.keepCaretOnChip)(c,b))};return c.addEventListener("click",g),()=>c.removeEventListener("click",g)},[T]),(0,S.useLayoutEffect)(()=>{let c=P.current;c&&(0,G.renderEditableContent)({input:c,segments:a,newParamId:i,editingParamId:r?.id??null,placeholderText:w??"",isFocused:x,showChipIcons:t,showChipImages:n})},[a,i,r,w,x,t,n]),(0,S.useLayoutEffect)(()=>{let c=pe.current,g=i??"";if(pe.current=g,!g||g===c)return;let u=P.current;if(!u)return;u.focus();let b=he.current??(0,G.plainTextLength)(u);(0,G.setCursorOffset)(u,b)},[i]),(0,S.useLayoutEffect)(()=>{let c=ye.current,g=r?.id??"";if(ye.current=g,!g||g===c||d==null)return;let u=P.current;u&&(0,G.setCursorOffset)(u,d)},[r,d]);let $=(0,S.useCallback)(()=>{if(Q.current)return;let c=P.current;if(!c)return;let g=(0,G.extractPlainText)(c),b=g.length>0&&g[0]!==g[0].toUpperCase()?g[0].toUpperCase()+g.slice(1):g;A(b)},[A]),f=(0,S.useCallback)(()=>{ke.current=performance.now(),$();let c=P.current;c&&H((0,G.getCursorOffset)(c))},[$,H]);(0,S.useEffect)(()=>{let c=P.current;if(!c)return;let g=u=>{let b=u,C=b.inputType;if(C==="insertParagraph"||C==="insertLineBreak"||C==="insertFromDrop"){u.preventDefault();return}if(C.startsWith("insert")||C.startsWith("delete")){let l=C.startsWith("delete")?"":b.data??"";F(l)&&u.preventDefault()}};return c.addEventListener("beforeinput",g),()=>c.removeEventListener("beforeinput",g)},[F]);let Oe=(0,S.useCallback)(()=>{Q.current=!0},[]),Ce=(0,S.useCallback)(()=>{Q.current=!1,$()},[$]),Pe=(0,S.useCallback)(c=>{c.preventDefault();let g=P.current;if(!g)return;let u=(c.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!u)return;let b=g.ownerDocument??document,C=b.getSelection();if(!C||C.rangeCount===0)return;let l=C.getRangeAt(0);if(!g.contains(l.startContainer))return;l.deleteContents();let W=b.createTextNode(u);l.insertNode(W),l.setStartAfter(W),l.collapse(!0),C.removeAllRanges(),C.addRange(l),$()},[$]),ue=(0,S.useCallback)(c=>Z(c),[Z]),Se=(0,S.useCallback)(()=>R(!0),[R]),me=(0,S.useCallback)(()=>R(!1),[R]),ie=(0,S.useCallback)(()=>P.current?.focus(),[]),X=(0,S.useCallback)(()=>P.current?.blur(),[]),ge=(0,S.useCallback)(()=>{let c=P.current;return c?(0,G.extractPlainText)(c):""},[]),fe=ba()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:fe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":m,"aria-expanded":E,"aria-activedescendant":y,spellCheck:!0,enterKeyHint:"send",onInput:f,onKeyDown:ue,onCompositionStart:Oe,onCompositionEnd:Ce,onPaste:Pe,onFocus:Se,onBlur:me},getPlainText:ge,focus:ie,blur:X}}var ae=require("react/jsx-runtime");function va(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Wt=(0,N.forwardRef)(function({onSubmit:a,onResult:t,onError:n,optionOverrides:i,maskCompletedText:r,className:o,apiConfig:d,additionalContext:k,visitorId:w,columns:x,pillPlacement:E="dropdown",mode:m="auto",optionsPosition:y="below",animations:O=!0,dropdownTrigger:A,closeDropdownOnBlur:Z,showNonTappableOptions:H,showOptionIcons:D=!0,showChipIcons:T=!0,showChipImages:F=!0,showOptionImages:R=!0,showOptionCounts:P=!0,showSkipButton:Q,showProducts:pe,productsLayout:ye,productImageFallback:he,autoFocus:ke=!0,onFocus:$,onBlur:f,value:Oe,completedParams:Ce,onChange:Pe,onParamsChange:ue,products:Se,onProductSelect:me,submitButton:ie,resetOnSubmit:X=!0},ge){let fe=(0,N.useRef)(null),c=(0,N.useRef)(null),g=(0,N.useRef)(()=>{}),u=(0,N.useRef)(null),b=(0,N.useRef)(null);(0,N.useEffect)(()=>{let L=fe.current;if(L)return u.current?u.current.setMode(m):u.current=new Ge.ModeController(L,m),()=>{u.current?.destroy(),u.current=null}},[m]);let C=(0,N.useCallback)(L=>{let ne=b.current?.current;ne&&(ne.focus(),(0,Ge.setCursorOffset)(ne,L))},[]),{completedParams:l,skippedParams:W,identifiedParams:_,isReady:oe,customFields:v,suggestionPills:De,setActivePill:We,skipActivePill:be,segments:p,newParamId:ve,clearNewParamId:Le,placeholderText:Ie,isFocused:ze,isDropdownOpen:Ee,isActivePillSelected:Ne,isLoading:q,activeIndex:Te,listboxId:Be,handleTextChange:Ye,handleKeyDown:rt,setFocused:_e,editingParam:je,editingIdentified:h,editingAnchor:J,caretOffset:B,startEditingParam:st,handleCaretAfterInput:_t,handleCaretMove:qt,replaceEditingRange:Ut,dropdownProps:Qt,reset:Ze,recordSubmit:bt}=ot({onSubmit:L=>g.current(L),onResult:t,onError:n,optionOverrides:i,maskCompletedText:r,apiConfig:d,additionalContext:k,visitorId:w,columns:x,dropdownTrigger:A,optionsPosition:y,closeDropdownOnBlur:Z,showNonTappableOptions:H,showOptionIcons:D,showOptionImages:R,showOptionCounts:P,showSkipButton:Q,showProducts:pe,onFocus:$,onBlur:f,value:Oe,completedParams:Ce,onChange:Pe,onParamsChange:ue,products:Se,onProductSelect:me,source:"full-sdk",setCursor:C});(0,N.useEffect)(()=>{if(!ve)return;let L=window.setTimeout(()=>Le(),650);return()=>window.clearTimeout(L)},[ve,Le]);let Yt=Te>=0?`${Be}-option-${Te}`:void 0,{inputRef:lt,editorProps:jt,focus:$e,blur:vt,getPlainText:wt}=Gt({segments:p,newParamId:ve,editingParam:je,editingIdentified:h,editingAnchor:J,caretOffset:B,placeholderText:Ie,isFocused:ze,showChipIcons:T,showChipImages:F,isDropdownOpen:Ee,listboxId:Be,activeDescendantId:Yt,autoFocus:ke,handleTextChange:Ye,handleKeyDown:rt,handleCaretAfterInput:_t,handleCaretMove:qt,startEditingParam:st,replaceEditingRange:Ut,setFocused:_e});b.current=lt,(0,N.useLayoutEffect)(()=>{let L=c.current,ne=lt.current;if(!L||!ne)return;let qe=()=>{let yt=L.firstElementChild;if(!yt)return;let Xt=yt.getBoundingClientRect(),Jt=ne.getBoundingClientRect();Xt.top>=Jt.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};qe();let xt=new ResizeObserver(qe);return xt.observe(ne),()=>xt.disconnect()},[p,De.length,q,lt]),(0,N.useImperativeHandle)(ge,()=>({focus:$e,blur:vt,reset:Ze,setMode:L=>u.current?.setMode(L),skipActivePill:be}),[$e,vt,Ze,be]);let Ve=!!p.length||l.length>0,dt=(0,N.useCallback)(L=>{if(!Ve)return;let ne=wt(),qe=(0,Ge.buildSubmitResult)(ne,l,W,{identifiedParams:_,isReady:oe,customFields:v});L&&bt(qe),a(qe),X&&Ze()},[bt,X,Ve,l,W,_,oe,v,a,Ze,wt]);g.current=()=>dt(!1);let Zt=(0,N.useCallback)(L=>{L.target?.closest("[data-aia-pill]")||$e()},[$e]),$t=E==="inline",Vt=E==="dropdown";return(0,ae.jsxs)("div",{ref:fe,className:`magicx-aia ${Me.container} ${o??""}`,"data-pill-placement":E,"data-options-position":y,"data-animations":O?"on":"off","data-mode":va(m),children:[(0,ae.jsx)(at,{...Qt,showPills:Vt,productsLayout:ye,productImageFallback:he}),(0,ae.jsxs)("div",{className:Me.inputWrapper,"data-aia-input-wrapper":"",onClick:Zt,children:[(0,ae.jsxs)("div",{className:Me.editorArea,"data-aia-editor":"",children:[(0,ae.jsx)("div",{...jt,className:Me.input,"data-aia-input":""}),$t&&(q||De.length>0)&&(0,ae.jsx)("span",{ref:c,className:Me.pillListContainer,"data-aia-pill-list-container":"",children:(0,ae.jsx)(Je,{pills:De,activePillIndex:0,activeSelected:Ne,onSelectPill:We,loading:q})})]}),ie===null?null:ie===void 0?(0,ae.jsx)(Ht,{disabled:!Ve,onClick:()=>dt(!0)}):(0,ae.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Me.submitSlot,onClick:L=>{Ve&&(L.stopPropagation(),dt(!0))},children:ie})]})]})});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,optionImageSrc,optionLabel,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
2197
2197
  //# sourceMappingURL=index.js.map