@magicx-eng/ai-autocomplete-react 0.18.2 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var et=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var qt=Object.prototype.hasOwnProperty;var Ut=(e,o)=>{for(var a in o)et(e,a,{get:o[a],enumerable:!0})},jt=(e,o,a,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Wt(o))!qt.call(e,n)&&n!==a&&et(e,n,{get:()=>o[n],enumerable:!(r=Kt(o,n))||r.enumerable});return e};var $t=e=>jt(et({},"__esModule",{value:!0}),e);var ra={};Ut(ra,{AIAutocomplete:()=>Rt,AIAutocompleteDropdown:()=>je,DATE_RANGE_META_END:()=>u.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>u.DATE_RANGE_META_START,WEEKDAY_LABELS:()=>u.WEEKDAY_LABELS,buildSubmitResult:()=>u.buildSubmitResult,cellDay:()=>u.cellDay,cellIso:()=>u.cellIso,dateCellMarks:()=>u.dateCellMarks,formatDate:()=>u.formatDate,formatDateRange:()=>u.formatDateRange,isoDate:()=>u.isoDate,monthLabel:()=>u.monthLabel,optionLabel:()=>u.optionLabel,parseDate:()=>u.parseDate,parseLooseDate:()=>u.parseLooseDate,parseLooseDateRange:()=>u.parseLooseDateRange,sanitizeOptionIconSvg:()=>u.sanitizeOptionIconSvg,selectedRangeFor:()=>u.selectedRangeFor,useAIAutocomplete:()=>Ve,visibleDateRange:()=>u.visibleDateRange,withSkippedParams:()=>u.withSkippedParams});module.exports=$t(ra);var u=require("@magicx-eng/ai-autocomplete-vanilla");var R=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.AIAutocomplete-module_container_KKjFU {
1
+ "use strict";var tt=Object.defineProperty;var qt=Object.getOwnPropertyDescriptor;var Ut=Object.getOwnPropertyNames;var jt=Object.prototype.hasOwnProperty;var $t=(e,o)=>{for(var a in o)tt(e,a,{get:o[a],enumerable:!0})},Vt=(e,o,a,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Ut(o))!jt.call(e,n)&&n!==a&&tt(e,n,{get:()=>o[n],enumerable:!(r=qt(o,n))||r.enumerable});return e};var Qt=e=>Vt(tt({},"__esModule",{value:!0}),e);var la={};$t(la,{AIAutocomplete:()=>Ot,AIAutocompleteDropdown:()=>$e,DATE_RANGE_META_END:()=>c.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>c.DATE_RANGE_META_START,PRODUCT_PATH_PREFIX:()=>c.PRODUCT_PATH_PREFIX,WEEKDAY_LABELS:()=>c.WEEKDAY_LABELS,buildSubmitResult:()=>c.buildSubmitResult,cellDay:()=>c.cellDay,cellIso:()=>c.cellIso,dateCellMarks:()=>c.dateCellMarks,formatDate:()=>c.formatDate,formatDateRange:()=>c.formatDateRange,isoDate:()=>c.isoDate,monthLabel:()=>c.monthLabel,optionLabel:()=>c.optionLabel,parseDate:()=>c.parseDate,parseLooseDate:()=>c.parseLooseDate,parseLooseDateRange:()=>c.parseLooseDateRange,productFromMatchedItem:()=>c.productFromMatchedItem,productsFromCustomFields:()=>c.productsFromCustomFields,sanitizeOptionIconSvg:()=>c.sanitizeOptionIconSvg,selectedRangeFor:()=>c.selectedRangeFor,useAIAutocomplete:()=>Qe,visibleDateRange:()=>c.visibleDateRange,withSkippedParams:()=>c.withSkippedParams});module.exports=Qt(la);var c=require("@magicx-eng/ai-autocomplete-vanilla");var T=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.AIAutocomplete-module_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
@@ -220,7 +220,7 @@
220
220
  opacity: 0;
221
221
  }
222
222
  }
223
- `,document.head.appendChild(e)}var Pe={container:"AIAutocomplete-module_container_KKjFU",inputWrapper:"AIAutocomplete-module_inputWrapper_FLq1b",editorArea:"AIAutocomplete-module_editorArea_7rBWq",input:"AIAutocomplete-module_input_IW-P-",pillListContainer:"AIAutocomplete-module_pillListContainer_h92IA",submitSlot:"AIAutocomplete-module_submitSlot_GhuCM",aiaPillReveal:"AIAutocomplete-module_aiaPillReveal_wf05b"};var Te=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=`/*
223
+ `,document.head.appendChild(e)}var Se={container:"AIAutocomplete-module_container_KKjFU",inputWrapper:"AIAutocomplete-module_inputWrapper_FLq1b",editorArea:"AIAutocomplete-module_editorArea_7rBWq",input:"AIAutocomplete-module_input_IW-P-",pillListContainer:"AIAutocomplete-module_pillListContainer_h92IA",submitSlot:"AIAutocomplete-module_submitSlot_GhuCM",aiaPillReveal:"AIAutocomplete-module_aiaPillReveal_wf05b"};var Re=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=`/*
224
224
  * Built-in appearance defaults \u2014 zero specificity via :where().
225
225
  * Consumer CSS always wins without !important.
226
226
  *
@@ -813,7 +813,7 @@
813
813
  opacity: 0.25;
814
814
  }
815
815
  }
816
- `,document.head.appendChild(e)}var me={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",scrollArrow:"AIAutocompleteDropdown-module_scrollArrow_uUzV0",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",pillScroll:"AIAutocompleteDropdown-module_pillScroll_Tpzus",skip:"AIAutocompleteDropdown-module_skip_7-olS",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};var T=require("@magicx-eng/ai-autocomplete-vanilla"),ut=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) ---
816
+ `,document.head.appendChild(e)}var ue={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",scrollArrow:"AIAutocompleteDropdown-module_scrollArrow_uUzV0",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",pillScroll:"AIAutocompleteDropdown-module_pillScroll_Tpzus",skip:"AIAutocompleteDropdown-module_skip_7-olS",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};var E=require("@magicx-eng/ai-autocomplete-vanilla"),ht=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) ---
817
817
 
818
818
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
819
819
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -976,7 +976,7 @@
976
976
  opacity: 0.8;
977
977
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
978
978
  }
979
- `,document.head.appendChild(e)}var C={datepicker:"DateGrid-module_datepicker_6RrTs",header:"DateGrid-module_header_z4LRk",month:"DateGrid-module_month_urB2T",nav:"DateGrid-module_nav_ap4AN",weekdays:"DateGrid-module_weekdays_3EA3q",grid:"DateGrid-module_grid_mQCgw",weekday:"DateGrid-module_weekday_3lF4B",cell:"DateGrid-module_cell_59k0y",number:"DateGrid-module_number_aoT01",day:"DateGrid-module_day_cB3u9",blank:"DateGrid-module_blank_ivgRC",past:"DateGrid-module_past_CEZsj",highlighted:"DateGrid-module_highlighted_YIdtK",today:"DateGrid-module_today_iI3ME",inRange:"DateGrid-module_inRange_r9S2q",selected:"DateGrid-module_selected_28KDn",pressed:"DateGrid-module_pressed_bEyyN"};var G=require("react/jsx-runtime"),Vt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ht({options:e,activeIndex:o,listboxId:a,view:r,selection:n,onSelect:i,onHighlight:s,onPreviousMonth:f,onNextMonth:w}){let b=(0,T.isoDate)(new Date),y=(0,T.visibleDateRange)({pendingStart:n.rangeStart,highlightedIso:(0,T.cellIso)(e[o]),selected:n.selectedRange});return(0,G.jsxs)("div",{className:C.datepicker,"data-aia-datepicker":"",children:[(0,G.jsxs)("div",{className:C.header,children:[(0,G.jsx)("button",{type:"button",tabIndex:-1,className:C.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:m=>m.preventDefault(),onClick:f,children:"\u2039"}),(0,G.jsx)("span",{className:C.month,"data-aia-date-month":"","aria-live":"polite",children:(0,T.monthLabel)(r)}),(0,G.jsx)("button",{type:"button",tabIndex:-1,className:C.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:m=>m.preventDefault(),onClick:w,children:"\u203A"})]}),(0,G.jsx)("div",{className:C.weekdays,"aria-hidden":"true",children:T.WEEKDAY_LABELS.map((m,_)=>(0,G.jsx)("span",{className:C.weekday,children:m},Vt[_]))}),(0,G.jsx)("div",{className:C.grid,"data-aia-date-grid":"",children:e.map((m,_)=>(0,G.jsx)(Qt,{option:m,id:`${a}-option-${_}`,index:_,isHighlighted:_===o&&m.is_tappable,isToday:(0,T.cellIso)(m)===b,isPast:(0,T.cellIso)(m)!=null&&(0,T.cellIso)(m)<b,marks:(0,T.dateCellMarks)((0,T.cellIso)(m),{selectedIso:n.selectedIso,range:y}),onSelect:i,onHighlight:s},(0,T.cellIso)(m)??`pad-${_}`))})]})}function Qt({option:e,id:o,index:a,isHighlighted:r,isToday:n,isPast:i,marks:s,onSelect:f,onHighlight:w}){let[b,y]=(0,ut.useState)(!1),m=(0,T.cellDay)(e);if(m==null)return(0,G.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${C.cell} ${C.blank}`});let _=()=>{y(!0),f(e),setTimeout(()=>y(!1),170)},P=[C.cell,C.day,i?C.past:"",r?C.highlighted:"",n?C.today:"",s.inRange?C.inRange:"",s.selected?C.selected:"",b?C.pressed:""].filter(Boolean).join(" ");return(0,G.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":r,"aria-label":e.text,tabIndex:0,className:P,onClick:_,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),_())},onMouseEnter:()=>w(a),children:(0,G.jsx)("span",{className:C.number,children:m})})}var Ce=require("@magicx-eng/ai-autocomplete-vanilla"),We=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`@layer layout {
979
+ `,document.head.appendChild(e)}var D={datepicker:"DateGrid-module_datepicker_6RrTs",header:"DateGrid-module_header_z4LRk",month:"DateGrid-module_month_urB2T",nav:"DateGrid-module_nav_ap4AN",weekdays:"DateGrid-module_weekdays_3EA3q",grid:"DateGrid-module_grid_mQCgw",weekday:"DateGrid-module_weekday_3lF4B",cell:"DateGrid-module_cell_59k0y",number:"DateGrid-module_number_aoT01",day:"DateGrid-module_day_cB3u9",blank:"DateGrid-module_blank_ivgRC",past:"DateGrid-module_past_CEZsj",highlighted:"DateGrid-module_highlighted_YIdtK",today:"DateGrid-module_today_iI3ME",inRange:"DateGrid-module_inRange_r9S2q",selected:"DateGrid-module_selected_28KDn",pressed:"DateGrid-module_pressed_bEyyN"};var B=require("react/jsx-runtime"),Yt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function mt({options:e,activeIndex:o,listboxId:a,view:r,selection:n,onSelect:i,onHighlight:s,onPreviousMonth:f,onNextMonth:w}){let b=(0,E.isoDate)(new Date),x=(0,E.visibleDateRange)({pendingStart:n.rangeStart,highlightedIso:(0,E.cellIso)(e[o]),selected:n.selectedRange});return(0,B.jsxs)("div",{className:D.datepicker,"data-aia-datepicker":"",children:[(0,B.jsxs)("div",{className:D.header,children:[(0,B.jsx)("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:m=>m.preventDefault(),onClick:f,children:"\u2039"}),(0,B.jsx)("span",{className:D.month,"data-aia-date-month":"","aria-live":"polite",children:(0,E.monthLabel)(r)}),(0,B.jsx)("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:m=>m.preventDefault(),onClick:w,children:"\u203A"})]}),(0,B.jsx)("div",{className:D.weekdays,"aria-hidden":"true",children:E.WEEKDAY_LABELS.map((m,y)=>(0,B.jsx)("span",{className:D.weekday,children:m},Yt[y]))}),(0,B.jsx)("div",{className:D.grid,"data-aia-date-grid":"",children:e.map((m,y)=>(0,B.jsx)(Xt,{option:m,id:`${a}-option-${y}`,index:y,isHighlighted:y===o&&m.is_tappable,isToday:(0,E.cellIso)(m)===b,isPast:(0,E.cellIso)(m)!=null&&(0,E.cellIso)(m)<b,marks:(0,E.dateCellMarks)((0,E.cellIso)(m),{selectedIso:n.selectedIso,range:x}),onSelect:i,onHighlight:s},(0,E.cellIso)(m)??`pad-${y}`))})]})}function Xt({option:e,id:o,index:a,isHighlighted:r,isToday:n,isPast:i,marks:s,onSelect:f,onHighlight:w}){let[b,x]=(0,ht.useState)(!1),m=(0,E.cellDay)(e);if(m==null)return(0,B.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${D.cell} ${D.blank}`});let y=()=>{x(!0),f(e),setTimeout(()=>x(!1),170)},P=[D.cell,D.day,i?D.past:"",r?D.highlighted:"",n?D.today:"",s.inRange?D.inRange:"",s.selected?D.selected:"",b?D.pressed:""].filter(Boolean).join(" ");return(0,B.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":r,"aria-label":e.text,tabIndex:0,className:P,onClick:y,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),y())},onMouseEnter:()=>w(a),children:(0,B.jsx)("span",{className:D.number,children:m})})}var Ee=require("@magicx-eng/ai-autocomplete-vanilla"),qe=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`@layer layout {
980
980
  .aia-cluster {
981
981
  display: flex;
982
982
  flex-wrap: wrap;
@@ -1018,7 +1018,7 @@
1018
1018
  justify-content: space-around;
1019
1019
  }
1020
1020
  }
1021
- `,document.head.appendChild(e)}var tt=require("react/jsx-runtime");function ze({gap:e,align:o="center",justify:a="start",noWrap:r=!1,inline:n=!1,className:i,children:s,...f}){let w=e?{"--aia-cluster-gap":e}:void 0,b={className:i?`aia-cluster ${i}`:"aia-cluster","data-align":o,"data-justify":a,"data-nowrap":r||void 0,"data-inline":n||void 0,style:w,...f};return n?(0,tt.jsx)("span",{...b,children:s}):(0,tt.jsx)("div",{...b,children:s})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
1021
+ `,document.head.appendChild(e)}var at=require("react/jsx-runtime");function Ne({gap:e,align:o="center",justify:a="start",noWrap:r=!1,inline:n=!1,className:i,children:s,...f}){let w=e?{"--aia-cluster-gap":e}:void 0,b={className:i?`aia-cluster ${i}`:"aia-cluster","data-align":o,"data-justify":a,"data-nowrap":r||void 0,"data-inline":n||void 0,style:w,...f};return n?(0,at.jsx)("span",{...b,children:s}):(0,at.jsx)("div",{...b,children:s})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
1022
1022
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1023
1023
  room above the hint/branding row so the footer doesn't butt against the last
1024
1024
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1152,7 +1152,7 @@
1152
1152
  justify-content: flex-end;
1153
1153
  }
1154
1154
  }
1155
- `,document.head.appendChild(e)}var ge={footer:"DropdownFooter-module_footer_qQQ7x",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg",row:"DropdownFooter-module_row_BgZ6Q"};var ie=require("react/jsx-runtime");function mt({isOptionHighlighted:e=!1,isInputEmpty:o=!1}){let{key:a,hint:r}=(0,Ce.getFooterHint)(e,o),[n,i]=(0,We.useState)(Ce.ATTRIBUTION_URL);return(0,We.useEffect)(()=>{i((0,Ce.buildAttributionUrl)())},[]),(0,ie.jsx)("footer",{className:ge.footer,"data-aia-footer":"",children:(0,ie.jsxs)(ze,{justify:"between",noWrap:!0,className:ge.row,children:[(0,ie.jsxs)(ze,{gap:"5px",className:ge.hintGroup,children:[(0,ie.jsx)("kbd",{className:ge.key,children:a}),(0,ie.jsx)("span",{className:ge.hint,children:r})]}),(0,ie.jsxs)("a",{className:ge.brandLink,href:n,target:"_blank",rel:"noopener noreferrer",children:[(0,ie.jsx)("span",{className:ge.brand,children:"AI"}),(0,ie.jsx)("span",{className:ge.badge,children:"Autocomplete"})]})]})})}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,
1155
+ `,document.head.appendChild(e)}var he={footer:"DropdownFooter-module_footer_qQQ7x",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg",row:"DropdownFooter-module_row_BgZ6Q"};var ne=require("react/jsx-runtime");function gt({isOptionHighlighted:e=!1,isInputEmpty:o=!1}){let{key:a,hint:r}=(0,Ee.getFooterHint)(e,o),[n,i]=(0,qe.useState)(Ee.ATTRIBUTION_URL);return(0,qe.useEffect)(()=>{i((0,Ee.buildAttributionUrl)())},[]),(0,ne.jsx)("footer",{className:he.footer,"data-aia-footer":"",children:(0,ne.jsxs)(Ne,{justify:"between",noWrap:!0,className:he.row,children:[(0,ne.jsxs)(Ne,{gap:"5px",className:he.hintGroup,children:[(0,ne.jsx)("kbd",{className:he.key,children:a}),(0,ne.jsx)("span",{className:he.hint,children:r})]}),(0,ne.jsxs)("a",{className:he.brandLink,href:n,target:"_blank",rel:"noopener noreferrer",children:[(0,ne.jsx)("span",{className:he.brand,children:"AI"}),(0,ne.jsx)("span",{className:he.badge,children:"Autocomplete"})]})]})})}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,
1156
1156
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1157
1157
  The border is kept as a 1px transparent line so the box stays the same size
1158
1158
  as it was when the outline was dashed. */
@@ -1209,7 +1209,7 @@
1209
1209
  opacity: 0;
1210
1210
  }
1211
1211
  }
1212
- `,document.head.appendChild(e)}var ke={pill:"ParamPill-module_pill_6Ga7S",fadeIn:"ParamPill-module_fadeIn_Ux4eQ",rounded:"ParamPill-module_rounded_y7xA9",skeleton:"ParamPill-module_skeleton_57P0T",skeletonPulse:"ParamPill-module_skeletonPulse_xGcUy"};var ft=require("react/jsx-runtime"),at={selected:1,first:.7,next:.4,last:.2};function gt({label:e,state:o,rounded:a,loading:r,onClick:n}){let i=[ke.pill,a?ke.rounded:"",r?ke.skeleton:""].filter(Boolean).join(" ");return(0,ft.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":r?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:i,style:{opacity:at[o]},onMouseDown:s=>s.preventDefault(),onClick:r?void 0:n,disabled:r,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.PillList-module_list_qvLqO {
1212
+ `,document.head.appendChild(e)}var Ie={pill:"ParamPill-module_pill_6Ga7S",fadeIn:"ParamPill-module_fadeIn_Ux4eQ",rounded:"ParamPill-module_rounded_y7xA9",skeleton:"ParamPill-module_skeleton_57P0T",skeletonPulse:"ParamPill-module_skeletonPulse_xGcUy"};var bt=require("react/jsx-runtime"),ot={selected:1,first:.7,next:.4,last:.2};function ft({label:e,state:o,rounded:a,loading:r,onClick:n}){let i=[Ie.pill,a?Ie.rounded:"",r?Ie.skeleton:""].filter(Boolean).join(" ");return(0,bt.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":r?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:i,style:{opacity:ot[o]},onMouseDown:s=>s.preventDefault(),onClick:r?void 0:n,disabled:r,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.PillList-module_list_qvLqO {
1213
1213
  position: relative;
1214
1214
  z-index: 1;
1215
1215
  pointer-events: auto;
@@ -1219,7 +1219,7 @@
1219
1219
  align-items: center;
1220
1220
  vertical-align: middle;
1221
1221
  }
1222
- `,document.head.appendChild(e)}var ot={list:"PillList-module_list_qvLqO"};var Ne=require("react/jsx-runtime"),Yt=[125,69];function bt(e){return e===0?"first":e===1?"next":"last"}function qe({pills:e,activePillIndex:o,onSelectPill:a,activeSelected:r,rounded:n,loading:i}){return i&&e.length===0?(0,Ne.jsx)("span",{className:ot.list,"data-aia-pill-list-loading":"",children:Yt.map((s,f)=>(0,Ne.jsx)("span",{"data-aia-pill-skeleton":"",className:`${ke.pill} ${n?ke.rounded:""} ${ke.skeleton}`,style:{width:s,opacity:at[bt(f)]}},`skel-${s}`))}):(0,Ne.jsx)("span",{className:ot.list,"data-aia-pill-list-loading":i?"":void 0,children:e.map((s,f)=>{let w=!!r&&f===o;return(0,Ne.jsx)(gt,{label:s.text,state:w?"selected":bt(f),selected:w,rounded:n,loading:i,onClick:()=>a(f)},`${s.type}-${s.text}`)})})}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
1222
+ `,document.head.appendChild(e)}var it={list:"PillList-module_list_qvLqO"};var Fe=require("react/jsx-runtime"),Zt=[125,69];function vt(e){return e===0?"first":e===1?"next":"last"}function Ue({pills:e,activePillIndex:o,onSelectPill:a,activeSelected:r,rounded:n,loading:i}){return i&&e.length===0?(0,Fe.jsx)("span",{className:it.list,"data-aia-pill-list-loading":"",children:Zt.map((s,f)=>(0,Fe.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ie.pill} ${n?Ie.rounded:""} ${Ie.skeleton}`,style:{width:s,opacity:ot[vt(f)]}},`skel-${s}`))}):(0,Fe.jsx)("span",{className:it.list,"data-aia-pill-list-loading":i?"":void 0,children:e.map((s,f)=>{let w=!!r&&f===o;return(0,Fe.jsx)(ft,{label:s.text,state:w?"selected":vt(f),selected:w,rounded:n,loading:i,onClick:()=>a(f)},`${s.type}-${s.text}`)})})}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
1223
1223
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1224
1224
  theming one package sees the same result in the other.
1225
1225
 
@@ -1386,7 +1386,7 @@
1386
1386
  var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
1387
1387
  );
1388
1388
  }
1389
- `,document.head.appendChild(e)}var Z={section:"ProductStrip-module_section_Hugfg",label:"ProductStrip-module_label_nuc93",row:"ProductStrip-module_row_WDVBX",card:"ProductStrip-module_card_JBGYT",media:"ProductStrip-module_media_RrbGe",image:"ProductStrip-module_image_5pNL7",body:"ProductStrip-module_body_ly032",vendor:"ProductStrip-module_vendor_Gvu7G",title:"ProductStrip-module_title_gCNmq",price:"ProductStrip-module_price_gULcE"};var K=require("react/jsx-runtime");function vt({products:e,listboxId:o,onSelect:a,onFocusChange:r,focusable:n=!0}){if(e.length===0)return null;let i=`${o}-products-label`;return(0,K.jsxs)("section",{className:Z.section,"data-aia-products":"",role:"group","aria-labelledby":i,children:[(0,K.jsx)("div",{className:Z.label,id:i,children:"Products"}),(0,K.jsx)("div",{className:Z.row,"data-aia-products-row":"",children:e.map((s,f)=>(0,K.jsx)(Xt,{product:s,id:`${o}-product-${f}`,onSelect:a,onFocusChange:r,focusable:n},s.id))})]})}function Xt({product:e,id:o,onSelect:a,onFocusChange:r,focusable:n}){let i=s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.button!==0||(s.preventDefault(),a(e))};return(0,K.jsxs)("a",{id:o,className:Z.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:n?0:-1,onClick:i,onKeyDown:s=>{s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),a(e))},onFocus:()=>r?.(!0),onBlur:s=>{s.relatedTarget?.closest("[data-aia-dropdown]")||r?.(!1)},children:[(0,K.jsx)("span",{className:Z.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?(0,K.jsx)("img",{className:Z.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),(0,K.jsxs)("span",{className:Z.body,children:[e.vendor?(0,K.jsx)("span",{className:Z.vendor,children:e.vendor}):null,(0,K.jsx)("span",{className:Z.title,children:e.title}),e.price?(0,K.jsx)("span",{className:Z.price,children:e.price}):null]})]})}var W=require("@magicx-eng/ai-autocomplete-vanilla"),be=require("react");var wt=require("@magicx-eng/ai-autocomplete-vanilla"),Ue=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`@layer layout {
1389
+ `,document.head.appendChild(e)}var X={section:"ProductStrip-module_section_Hugfg",label:"ProductStrip-module_label_nuc93",row:"ProductStrip-module_row_WDVBX",card:"ProductStrip-module_card_JBGYT",media:"ProductStrip-module_media_RrbGe",image:"ProductStrip-module_image_5pNL7",body:"ProductStrip-module_body_ly032",vendor:"ProductStrip-module_vendor_Gvu7G",title:"ProductStrip-module_title_gCNmq",price:"ProductStrip-module_price_gULcE"};var q=require("react/jsx-runtime");function wt({products:e,listboxId:o,onSelect:a,onFocusChange:r,focusable:n=!0}){if(e.length===0)return null;let i=`${o}-products-label`;return(0,q.jsxs)("section",{className:X.section,"data-aia-products":"",role:"group","aria-labelledby":i,children:[(0,q.jsx)("div",{className:X.label,id:i,children:"Products"}),(0,q.jsx)("div",{className:X.row,"data-aia-products-row":"",children:e.map((s,f)=>(0,q.jsx)(Jt,{product:s,id:`${o}-product-${f}`,onSelect:a,onFocusChange:r,focusable:n},s.id))})]})}function Jt({product:e,id:o,onSelect:a,onFocusChange:r,focusable:n}){let i=s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.button!==0||(s.preventDefault(),a(e))};return(0,q.jsxs)("a",{id:o,className:X.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:n?0:-1,onClick:i,onKeyDown:s=>{s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),a(e))},onFocus:()=>r?.(!0),onBlur:s=>{s.relatedTarget?.closest("[data-aia-dropdown]")||r?.(!1)},children:[(0,q.jsx)("span",{className:X.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?(0,q.jsx)("img",{className:X.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),(0,q.jsxs)("span",{className:X.body,children:[e.vendor?(0,q.jsx)("span",{className:X.vendor,children:e.vendor}):null,(0,q.jsx)("span",{className:X.title,children:e.title}),e.price?(0,q.jsx)("span",{className:X.price,children:e.price}):null]})]})}var U=require("@magicx-eng/ai-autocomplete-vanilla"),ge=require("react");var xt=require("@magicx-eng/ai-autocomplete-vanilla"),je=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`@layer layout {
1390
1390
  .aia-grid {
1391
1391
  display: grid;
1392
1392
  grid-template-columns: repeat(
@@ -1421,7 +1421,7 @@
1421
1421
  border-radius: 3px;
1422
1422
  }
1423
1423
  }
1424
- `,document.head.appendChild(e)}var yt=require("react/jsx-runtime");function xt({min:e="16rem",max:o,gap:a,scroll:r=!1,maxHeight:n,scrollResetKey:i,cols:s,template:f,innerRef:w,className:b,children:y,...m}){let _=(0,Ue.useRef)(null);(0,Ue.useLayoutEffect)(()=>{if(i===void 0)return;let v=_.current;v&&(v.scrollTop=0)},[i]);let P={"--aia-grid-min":e};return o&&(P["--aia-grid-max"]=o),a&&(P["--aia-grid-gap"]=a),n&&(P["--aia-grid-max-height"]=n),s&&(P.gridTemplateColumns=(0,wt.optionsGridTemplateColumns)(s)),f&&(P.gridTemplateColumns=f),(0,yt.jsx)("div",{ref:v=>{_.current=v,w?.(v)},className:b?`aia-grid ${b}`:"aia-grid","data-scroll":r||void 0,style:P,...m,children:y})}var Ee=require("@magicx-eng/ai-autocomplete-vanilla"),fe=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.SuggestionItem-module_item_d4vpD {
1424
+ `,document.head.appendChild(e)}var _t=require("react/jsx-runtime");function yt({min:e="16rem",max:o,gap:a,scroll:r=!1,maxHeight:n,scrollResetKey:i,cols:s,template:f,innerRef:w,className:b,children:x,...m}){let y=(0,je.useRef)(null);(0,je.useLayoutEffect)(()=>{if(i===void 0)return;let v=y.current;v&&(v.scrollTop=0)},[i]);let P={"--aia-grid-min":e};return o&&(P["--aia-grid-max"]=o),a&&(P["--aia-grid-gap"]=a),n&&(P["--aia-grid-max-height"]=n),s&&(P.gridTemplateColumns=(0,xt.optionsGridTemplateColumns)(s)),f&&(P.gridTemplateColumns=f),(0,_t.jsx)("div",{ref:v=>{y.current=v,w?.(v)},className:b?`aia-grid ${b}`:"aia-grid","data-scroll":r||void 0,style:P,...m,children:x})}var Te=require("@magicx-eng/ai-autocomplete-vanilla"),me=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.SuggestionItem-module_item_d4vpD {
1425
1425
  position: relative;
1426
1426
  overflow: visible;
1427
1427
  display: flex;
@@ -1612,7 +1612,7 @@
1612
1612
  filter: brightness(0.55);
1613
1613
  }
1614
1614
  }
1615
- `,document.head.appendChild(e)}var J={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",riseIn:"SuggestionItem-module_riseIn_etXZT",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",pressCompress:"SuggestionItem-module_pressCompress_ICV3q",scrollHint:"SuggestionItem-module_scrollHint_xKXPt",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9",icon:"SuggestionItem-module_icon_Qw938"};var Ie=require("react/jsx-runtime");function _t({option:e,isHighlighted:o,onSelect:a,onHighlight:r,id:n,loading:i,showIcon:s=!0,scrollHint:f,enterDelayMs:w=0}){let[b]=(0,fe.useState)(w),[y,m]=(0,fe.useState)(!1),_=(0,fe.useMemo)(()=>s&&e.icon_svg?(0,Ee.sanitizeOptionIconSvg)(e.icon_svg):null,[s,e.icon_svg]),P=(0,fe.useRef)(void 0);(0,fe.useEffect)(()=>()=>clearTimeout(P.current),[]);let v=()=>{i||!e.is_tappable||y||(m(!0),a(e),clearTimeout(P.current),P.current=setTimeout(()=>m(!1),170))},E=[J.item,o&&!i?J.highlighted:"",e.is_tappable?J.tappable:J.nonTappable,y?J.pressed:"",f?J.scrollHint:""].filter(Boolean).join(" ");return(0,Ie.jsx)("div",{id:n,role:"option","data-aia-option":"","data-aia-loading":i?"":void 0,"data-aia-icon":_&&e.icon?e.icon:void 0,"aria-selected":o,className:E,style:{[Ee.OPTION_ENTER_DELAY_VAR]:`${b}ms`},tabIndex:i||!e.is_tappable?-1:0,onClick:v,onKeyDown:S=>{!i&&e.is_tappable&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),v())},onMouseEnter:!i&&e.is_tappable?r:void 0,children:(0,Ie.jsxs)("span",{className:J.content,children:[_&&(0,Ie.jsx)("span",{className:`${J.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:_}}),(0,Ie.jsx)("span",{className:J.text,children:(0,Ee.optionLabel)(e)}),e.tag&&(0,Ie.jsx)("span",{className:J.tag,children:e.tag})]})})}var it=require("react/jsx-runtime");function Zt(){let[e,o]=(0,be.useState)(W.isOptionsGridMobileViewport);return(0,be.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(W.OPTIONS_GRID_MOBILE_QUERY),r=()=>o(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[]),e}function kt({options:e,activeIndex:o,onSelect:a,onHighlight:r,listboxId:n,loading:i,groupKey:s="",optionsPosition:f="below",showIcons:w=!0}){let b=Zt(),y=(0,be.useRef)(null),[m,_]=(0,be.useState)(null);(0,be.useLayoutEffect)(()=>{let v=y.current,S=v&&!i&&(0,W.needsOptionsGridMeasurement)(e.length,b)?(0,W.measureOptionsGrid)(v):null;_(S?(0,W.planOptionsGrid)(e.length,b,S.rowWidths,S.gridWidth):null)},[e,b,i]);let P=m??(0,W.planOptionsGrid)(e.length,b,null,null);return(0,it.jsx)(xt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:s,template:P.template,maxHeight:P.maxHeight,innerRef:v=>{y.current=v},"data-aia-group":s,children:e.map((v,E)=>(0,it.jsx)(_t,{option:v,isHighlighted:E===o,onSelect:a,onHighlight:()=>r(E),id:`${n}-option-${E}`,loading:i,showIcon:w,scrollHint:!i&&P.scrollHintIndices.includes(E),enterDelayMs:i?0:(0,W.optionEnterDelayMs)(E,P.cols,e.length,f)},`${s}\0${v.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
1615
+ `,document.head.appendChild(e)}var Z={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",riseIn:"SuggestionItem-module_riseIn_etXZT",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",pressCompress:"SuggestionItem-module_pressCompress_ICV3q",scrollHint:"SuggestionItem-module_scrollHint_xKXPt",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9",icon:"SuggestionItem-module_icon_Qw938"};var Ae=require("react/jsx-runtime");function kt({option:e,isHighlighted:o,onSelect:a,onHighlight:r,id:n,loading:i,showIcon:s=!0,scrollHint:f,enterDelayMs:w=0}){let[b]=(0,me.useState)(w),[x,m]=(0,me.useState)(!1),y=(0,me.useMemo)(()=>s&&e.icon_svg?(0,Te.sanitizeOptionIconSvg)(e.icon_svg):null,[s,e.icon_svg]),P=(0,me.useRef)(void 0);(0,me.useEffect)(()=>()=>clearTimeout(P.current),[]);let v=()=>{i||!e.is_tappable||x||(m(!0),a(e),clearTimeout(P.current),P.current=setTimeout(()=>m(!1),170))},C=[Z.item,o&&!i?Z.highlighted:"",e.is_tappable?Z.tappable:Z.nonTappable,x?Z.pressed:"",f?Z.scrollHint:""].filter(Boolean).join(" ");return(0,Ae.jsx)("div",{id:n,role:"option","data-aia-option":"","data-aia-loading":i?"":void 0,"data-aia-icon":y&&e.icon?e.icon:void 0,"aria-selected":o,className:C,style:{[Te.OPTION_ENTER_DELAY_VAR]:`${b}ms`},tabIndex:i||!e.is_tappable?-1:0,onClick:v,onKeyDown:O=>{!i&&e.is_tappable&&(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),v())},onMouseEnter:!i&&e.is_tappable?r:void 0,children:(0,Ae.jsxs)("span",{className:Z.content,children:[y&&(0,Ae.jsx)("span",{className:`${Z.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:y}}),(0,Ae.jsx)("span",{className:Z.text,children:(0,Te.optionLabel)(e)}),e.tag&&(0,Ae.jsx)("span",{className:Z.tag,children:e.tag})]})})}var nt=require("react/jsx-runtime");function ea(){let[e,o]=(0,ge.useState)(U.isOptionsGridMobileViewport);return(0,ge.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(U.OPTIONS_GRID_MOBILE_QUERY),r=()=>o(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[]),e}function Pt({options:e,activeIndex:o,onSelect:a,onHighlight:r,listboxId:n,loading:i,groupKey:s="",optionsPosition:f="below",showIcons:w=!0}){let b=ea(),x=(0,ge.useRef)(null),[m,y]=(0,ge.useState)(null);(0,ge.useLayoutEffect)(()=>{let v=x.current,O=v&&!i&&(0,U.needsOptionsGridMeasurement)(e.length,b)?(0,U.measureOptionsGrid)(v):null;y(O?(0,U.planOptionsGrid)(e.length,b,O.rowWidths,O.gridWidth):null)},[e,b,i]);let P=m??(0,U.planOptionsGrid)(e.length,b,null,null);return(0,nt.jsx)(yt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:s,template:P.template,maxHeight:P.maxHeight,innerRef:v=>{x.current=v},"data-aia-group":s,children:e.map((v,C)=>(0,nt.jsx)(kt,{option:v,isHighlighted:C===o,onSelect:a,onHighlight:()=>r(C),id:`${n}-option-${C}`,loading:i,showIcon:w,scrollHint:!i&&P.scrollHintIndices.includes(C),enterDelayMs:i?0:(0,U.optionEnterDelayMs)(C,P.cols,e.length,f)},`${s}\0${v.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
1616
1616
  .aia-stack {
1617
1617
  display: flex;
1618
1618
  flex-direction: column;
@@ -1629,7 +1629,7 @@
1629
1629
  }
1630
1630
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
1631
1631
  }
1632
- `,document.head.appendChild(e)}var It=require("react/jsx-runtime");function Pt({space:e,align:o="stretch",className:a,children:r,...n}){let i=e?{"--aia-stack-space":e}:void 0;return(0,It.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":o,style:i,...n,children:r})}var M=require("react/jsx-runtime"),Jt=[159,119,164],ea=()=>{},St=()=>{};function ta(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,r]=(0,ee.useState)(o);if((0,ee.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(n.matches);return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function aa(e,o){let a=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let r=e.current,n=o.current;if(!r||!n)return;let i=r.querySelector(".aia-grid[data-scroll]");if(a.current&&a.current.grid!==i&&(a.current.controller.destroy(),a.current=null),i&&!a.current){a.current={grid:i,controller:(0,Te.attachScrollArrow)({dropdown:r,grid:i,button:n})};return}a.current?.controller.update()}),(0,ee.useEffect)(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function je({suggestions:e,activeIndex:o,onSelect:a,onHighlight:r,isOpen:n,id:i,className:s,pills:f,onPillClick:w,showPills:b=!0,onSkip:y,showSkipButton:m=!0,showOptionIcons:_=!0,skipDisabled:P=!1,activeSelected:v=!1,isLoading:E=!1,isInputEmpty:S=!1,products:z,onProductSelect:ne,onProductFocusChange:re,formatType:U="options",dateView:A=null,selectedDateIso:se=null,selectedDateRange:le=null,dateRangeStart:h=null,onPreviousMonth:ve,onNextMonth:de,optionsPosition:N="below",mode:we}){let Y=ta(we),xe=Y!==void 0,ae=(0,ee.useRef)(null),oe=(0,ee.useRef)(null);aa(ae,oe);let ce=e[0]?.options??[],B=!!(f&&f.length>0&&w),pe=!!(z&&z.length>0),j=n&&(ce.length>0||b&&B||E||pe),F={suggestions:e,activeIndex:o,pills:f,showPills:b,showSkipButton:m,showOptionIcons:_,skipDisabled:P,activeSelected:v,isLoading:E,isInputEmpty:S,products:z,formatType:U,dateView:A,selectedDateIso:se,selectedDateRange:le,dateRangeStart:h},ue=(0,ee.useRef)(F);j&&(ue.current=F);let t=j?F:ue.current,c=t.suggestions[0],p=c?.options??[],l=t.activeIndex>=0&&!!p[t.activeIndex]?.is_tappable,x=!!(t.pills&&t.pills.length>0&&w),O=t.showPills&&x,H=t.showPills&&!x&&t.isLoading,d=O||H,he=x&&t.showSkipButton&&!t.isInputEmpty&&!!y,Se=t.pills?.[0]?.text,ye=(0,Te.isCalendarFormat)(t.formatType)&&t.dateView!=null,Ae=p.length>0&&!ye,X=p.length>0&&ye&&!t.isLoading,De=t.isLoading&&!Ae&&!X,$=t.products??[];return(0,M.jsxs)("div",{ref:ae,id:i,role:"listbox","data-aia-dropdown":"","data-options-position":N,"data-mode":Y,"data-aia-loading":t.isLoading?"":void 0,"data-aia-has-products":$.length>0?"":void 0,className:`${xe?"magicx-aia ":""}${me.dropdown} ${j?me.visible:""} ${s??""}`,onMouseDown:V=>V.preventDefault(),children:[(0,M.jsxs)(Pt,{space:"8px",children:[(d||he)&&(0,M.jsxs)(ze,{noWrap:!0,className:me.pillBar,"data-aia-pillbar":"",children:[d&&(0,M.jsx)("span",{className:me.pillScroll,"data-aia-pill-scroll":"",children:(0,M.jsx)(qe,{pills:t.pills??[],activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:t.isLoading})}),he&&(0,M.jsx)("button",{type:"button",tabIndex:-1,className:me.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":Se?`Skip ${Se}`:"Skip",onClick:y,children:"skip"})]}),Ae&&(0,M.jsx)(kt,{options:p,activeIndex:t.activeIndex,onSelect:a,onHighlight:r,listboxId:i,loading:t.isLoading,groupKey:c?`${c.type} ${c.text}`:"",optionsPosition:N,showIcons:t.showOptionIcons}),X&&t.dateView&&(0,M.jsx)(ht,{options:p,activeIndex:t.activeIndex,listboxId:i,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null},onSelect:a,onHighlight:r,onPreviousMonth:ve??St,onNextMonth:de??St}),De&&(0,M.jsx)("div",{className:me.skeletonBars,"data-aia-skeleton-bars":"",children:Jt.map(V=>(0,M.jsx)("span",{className:me.skeletonBar,style:{width:V}},`bar-${V}`))}),(0,M.jsx)(vt,{products:$,listboxId:i,onSelect:ne??ea,onFocusChange:re,focusable:j}),(0,M.jsx)(mt,{isOptionHighlighted:l,isInputEmpty:t.isInputEmpty})]}),(0,M.jsx)("button",{ref:oe,type:"button",tabIndex:-1,className:me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Te.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,M.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,M.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Oe=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=`.SubmitButton-module_submitButton_otz7H {
1632
+ `,document.head.appendChild(e)}var St=require("react/jsx-runtime");function It({space:e,align:o="stretch",className:a,children:r,...n}){let i=e?{"--aia-stack-space":e}:void 0;return(0,St.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":o,style:i,...n,children:r})}var L=require("react/jsx-runtime"),ta=[159,119,164],aa=()=>{},At=()=>{};function oa(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,r]=(0,J.useState)(o);if((0,J.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(n.matches);return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function ia(e,o){let a=(0,J.useRef)(null);(0,J.useEffect)(()=>{let r=e.current,n=o.current;if(!r||!n)return;let i=r.querySelector(".aia-grid[data-scroll]");if(a.current&&a.current.grid!==i&&(a.current.controller.destroy(),a.current=null),i&&!a.current){a.current={grid:i,controller:(0,Re.attachScrollArrow)({dropdown:r,grid:i,button:n})};return}a.current?.controller.update()}),(0,J.useEffect)(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function $e({suggestions:e,activeIndex:o,onSelect:a,onHighlight:r,isOpen:n,id:i,className:s,pills:f,onPillClick:w,showPills:b=!0,onSkip:x,showSkipButton:m=!0,showOptionIcons:y=!0,skipDisabled:P=!1,activeSelected:v=!1,isLoading:C=!1,isInputEmpty:O=!1,products:z,onProductSelect:H,onProductFocusChange:re,formatType:K="options",dateView:A=null,selectedDateIso:te=null,selectedDateRange:fe=null,dateRangeStart:se=null,onPreviousMonth:u,onNextMonth:be,optionsPosition:N="below",mode:ve}){let le=oa(ve),ae=le!==void 0,de=(0,J.useRef)(null),oe=(0,J.useRef)(null);ia(de,oe);let ce=e[0]?.options??[],pe=!!(f&&f.length>0&&w),W=!!(z&&z.length>0),$=n&&(ce.length>0||b&&pe||C||W),Y={suggestions:e,activeIndex:o,pills:f,showPills:b,showSkipButton:m,showOptionIcons:y,skipDisabled:P,activeSelected:v,isLoading:C,isInputEmpty:O,products:z,formatType:K,dateView:A,selectedDateIso:te,selectedDateRange:fe,dateRangeStart:se},V=(0,J.useRef)(Y);$&&(V.current=Y);let t=$?Y:V.current,p=t.suggestions[0],h=p?.options??[],_=t.activeIndex>=0&&!!h[t.activeIndex]?.is_tappable,l=!!(t.pills&&t.pills.length>0&&w),M=t.showPills&&l,ie=t.showPills&&!l&&t.isLoading,F=M||ie,d=l&&t.showSkipButton&&!t.isInputEmpty&&!!x,we=t.pills?.[0]?.text,De=(0,Re.isCalendarFormat)(t.formatType)&&t.dateView!=null,xe=h.length>0&&!De,Ce=h.length>0&&De&&!t.isLoading,ye=t.isLoading&&!xe&&!Ce,_e=t.products??[];return(0,L.jsxs)("div",{ref:de,id:i,role:"listbox","data-aia-dropdown":"","data-options-position":N,"data-mode":le,"data-aia-loading":t.isLoading?"":void 0,"data-aia-has-products":_e.length>0?"":void 0,className:`${ae?"magicx-aia ":""}${ue.dropdown} ${$?ue.visible:""} ${s??""}`,onMouseDown:G=>G.preventDefault(),children:[(0,L.jsxs)(It,{space:"8px",children:[(F||d)&&(0,L.jsxs)(Ne,{noWrap:!0,className:ue.pillBar,"data-aia-pillbar":"",children:[F&&(0,L.jsx)("span",{className:ue.pillScroll,"data-aia-pill-scroll":"",children:(0,L.jsx)(Ue,{pills:t.pills??[],activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:t.isLoading})}),d&&(0,L.jsx)("button",{type:"button",tabIndex:-1,className:ue.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":we?`Skip ${we}`:"Skip",onClick:x,children:"skip"})]}),xe&&(0,L.jsx)(Pt,{options:h,activeIndex:t.activeIndex,onSelect:a,onHighlight:r,listboxId:i,loading:t.isLoading,groupKey:p?`${p.type} ${p.text}`:"",optionsPosition:N,showIcons:t.showOptionIcons}),Ce&&t.dateView&&(0,L.jsx)(mt,{options:h,activeIndex:t.activeIndex,listboxId:i,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null},onSelect:a,onHighlight:r,onPreviousMonth:u??At,onNextMonth:be??At}),ye&&(0,L.jsx)("div",{className:ue.skeletonBars,"data-aia-skeleton-bars":"",children:ta.map(G=>(0,L.jsx)("span",{className:ue.skeletonBar,style:{width:G}},`bar-${G}`))}),(0,L.jsx)(wt,{products:_e,listboxId:i,onSelect:H??aa,onFocusChange:re,focusable:$}),(0,L.jsx)(gt,{isOptionHighlighted:_,isInputEmpty:t.isInputEmpty})]}),(0,L.jsx)("button",{ref:oe,type:"button",tabIndex:-1,className:ue.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Re.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,L.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,L.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Le=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=`.SubmitButton-module_submitButton_otz7H {
1633
1633
  flex-shrink: 0;
1634
1634
  width: 32px;
1635
1635
  height: 32px;
@@ -1664,5 +1664,5 @@
1664
1664
  );
1665
1665
  cursor: default;
1666
1666
  }
1667
- `,document.head.appendChild(e)}var At={submitButton:"SubmitButton-module_submitButton_otz7H"};var $e=require("react/jsx-runtime");function Dt({disabled:e,onClick:o}){return(0,$e.jsx)("button",{type:"button","data-aia-submit":"",className:At.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),o()},"aria-label":"Submit",children:(0,$e.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,$e.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Re=require("@magicx-eng/ai-autocomplete-vanilla"),I=require("react");var nt=require("react");function Ct(e){let o=(0,nt.useRef)(e);o.current=e;let a=Object.keys(e??{}).sort().join("\0"),r=(0,nt.useRef)({key:"",overrides:void 0});if(r.current.key!==a){let n={};for(let i of Object.keys(e??{})){let s=(f,w,b)=>{let y=o.current?.[i];return y?y(f,w,b):[]};n[i]=s}r.current={key:a,overrides:e?n:void 0}}return{overrides:r.current.overrides,key:a}}var rt=require("react");function Et(e){let o=(0,rt.useRef)(e);o.current=e;let a=(0,rt.useRef)(null);a.current===null&&(a.current={fetch:(n,i)=>{let s=o.current;return s?s.fetch(n,i):Promise.reject(new Error("products config removed"))},transform:n=>o.current?.transform(n)??[],get limit(){return o.current?.limit}});let r=e!==void 0;return{config:r?a.current:void 0,enabled:r}}var oa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],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 Ve({onSubmit:e,onResult:o,onError:a,optionOverrides:r,maskCompletedText:n,apiConfig:i,additionalContext:s,columns:f=2,dropdownTrigger:w,optionsPosition:b,closeDropdownOnBlur:y,showNonTappableOptions:m,showOptionIcons:_,showSkipButton:P,onFocus:v,onBlur:E,value:S,completedParams:z,onChange:ne,onParamsChange:re,products:U,onProductSelect:A,source:se,setCursor:le}){let h=(0,I.useRef)(null),[ve,de]=(0,I.useState)(null),N=(0,I.useRef)(e);N.current=e;let we=(0,I.useRef)(o);we.current=o;let Y=(0,I.useRef)(a);Y.current=a;let xe=(0,I.useRef)(ne);xe.current=ne;let ae=(0,I.useRef)(re);ae.current=re;let oe=(0,I.useRef)(v);oe.current=v;let ce=(0,I.useRef)(E);ce.current=E;let B=(0,I.useRef)(le);B.current=le;let pe=(0,I.useRef)(A);pe.current=A;let j=Et(U),F=Ct(r);(0,I.useEffect)(()=>{if(typeof document>"u")return;let g=new Re.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:i,additionalContext:s,optionOverrides:F.overrides,maskCompletedText:n,columns:f,dropdownTrigger:w,optionsPosition:b,closeDropdownOnBlur:y,showNonTappableOptions:m,source:se,value:S,completedParams:z,onSubmit:(...L)=>N.current?.(...L),onResult:(...L)=>we.current?.(...L),onError:(...L)=>Y.current?.(...L),onChange:(...L)=>xe.current?.(...L),onParamsChange:(...L)=>ae.current?.(...L),onFocus:()=>oe.current?.(),onBlur:()=>ce.current?.(),onProductSelect:L=>pe.current?.(L),setCursor:L=>B.current?.(L),products:j.config});h.current=g,de(g.getState());let Q=g.subscribe(L=>de(L));return()=>{Q(),g.destroy(),h.current===g&&(h.current=null)}},[]),(0,I.useEffect)(()=>{S!==void 0&&h.current?.setValue(S)},[S]),(0,I.useEffect)(()=>{z!==void 0&&h.current?.setCompletedParams(z)},[z]);let ue=JSON.stringify(i??null),t;try{t=JSON.stringify(s??null)}catch{t="[unstringifiable]"}(0,I.useEffect)(()=>{h.current?.update({apiConfig:i,additionalContext:s,optionOverrides:F.overrides,dropdownTrigger:w,optionsPosition:b,closeDropdownOnBlur:y,showNonTappableOptions:m})},[ue,t,F.key,w,b,y,m]);let c=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!c.current){c.current=!0;return}h.current?.update({products:j.config})},[j.enabled]);let p=(0,I.useRef)(null);p.current===null&&(p.current={handleTextChange:g=>h.current?.handleTextChange(g),handleKeyDown:g=>{let Q="nativeEvent"in g?g.nativeEvent:g;h.current?.handleKeyDown(Q)},setFocused:g=>h.current?.setFocused(g),startEditingParam:g=>h.current?.startEditingParam(g),exitEditMode:()=>h.current?.exitEditMode(),handleCaretAfterInput:g=>h.current?.handleCaretAfterInput(g),handleCaretMove:g=>h.current?.handleCaretMove(g),replaceEditingRange:g=>h.current?.replaceEditingRange(g)??!1,setActivePill:g=>h.current?.setActivePill(g),skipActivePill:()=>h.current?.skipActivePill(),removeLastParam:()=>h.current?.removeLastParam(),clearNewParamId:()=>h.current?.clearNewParamId(),reset:()=>h.current?.reset(),selectOption:g=>h.current?.selectOption(g),selectProduct:g=>h.current?.selectProduct(g),setActiveDropdownIndex:g=>h.current?.setActiveDropdownIndex(g),showPreviousMonth:()=>h.current?.showPreviousMonth(),showNextMonth:()=>h.current?.showNextMonth(),handleFocus:()=>h.current?.setFocused(!0),handleBlur:()=>h.current?.setFocused(!1)});let l=p.current,x=(0,I.useCallback)(g=>{let Q=g.target.value,Xe=Q.length>0&&!g.nativeEvent?.isComposing&&Q[0]!==Q[0].toUpperCase()?Q[0].toUpperCase()+Q.slice(1):Q;h.current?.handleTextChange(Xe)},[]),O=(0,I.useCallback)(g=>{h.current?.handleKeyDown(g.nativeEvent)},[]),H=h.current,d=ve??oa,he=S!==void 0?S:d.text,Se=z!==void 0?z:d.completedParams,ye=d.actionableSuggestions,Ae=ye[0],X=H?.listboxId??"",De=d.activeDropdownIndex>=0&&H?`${X}-option-${d.activeDropdownIndex}`:void 0,$=d.editingParam,V=d.editingIdentified,Le=$?{type:$.suggestionType,text:$.suggestionPlaceholder,required:!0,options:$.options}:V?{type:V.type,text:(0,Re.identifiedParamLabel)(V.type),required:!0,options:[]}:null,Ge=Le??Ae,Ye=Le?[Le]:ye,Me=(0,Re.dateSelectionFor)(d),Be=!H||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:Se,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:ye,setActivePill:l.setActivePill,skipActivePill:l.skipActivePill,removeLastParam:l.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:l.clearNewParamId,suggestions:d.suggestions,activeIndex:d.activeDropdownIndex,isReady:d.isReady,isLoading:Be,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:X,error:d.error,products:d.products,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:$,editingIdentified:V,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:he,placeholder:d.placeholderText||void 0,onChange:x,onKeyDown:O,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":De,"aria-autocomplete":"list","aria-controls":X},reset:l.reset,dropdownProps:{suggestions:Ge?[{...Ge,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:X,pills:Ye,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(P??!0)&&!$&&!V,showOptionIcons:_??!0,skipDisabled:d.inSelectionAnimation,isLoading:Be,isInputEmpty:he.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:Me.selectedIso,selectedDateRange:Me.selectedRange,dateRangeStart:Me.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:b??"below"}}}var q=require("@magicx-eng/ai-autocomplete-vanilla"),k=require("react"),Qe;function ia(){if(Qe!==void 0)return Qe;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Qe=e.contentEditable==="plaintext-only",Qe}function Tt(e){let{segments:o,showChipIcons:a=!0,newParamId:r,editingParam:n,editingIdentified:i,editingAnchor:s,caretOffset:f,placeholderText:w,isFocused:b,isDropdownOpen:y,listboxId:m,activeDescendantId:_,autoFocus:P,handleTextChange:v,handleKeyDown:E,handleCaretAfterInput:S,handleCaretMove:z,startEditingParam:ne,replaceEditingRange:re,setFocused:U}=e,A=(0,k.useRef)(null),se=(0,k.useRef)(!1),le=(0,k.useRef)(""),h=(0,k.useRef)(""),ve=(0,k.useRef)(null),de=(0,k.useRef)(0);ve.current=f,(0,k.useEffect)(()=>{if(!P)return;let t=A.current;if(!t)return;document.activeElement===t?U(!0):t.focus();let c=t.ownerDocument??document,p=c.getSelection(),l=p&&p.rangeCount>0&&t.contains(p.anchorNode);if(p&&!l){let x=c.createRange();x.selectNodeContents(t),x.collapse(!0),p.removeAllRanges(),p.addRange(x)}},[P,U]),(0,k.useEffect)(()=>{let t=A.current;if(!t)return;let c=t.ownerDocument??document,p=()=>{let l=c.getSelection();if(!l||l.rangeCount===0||!l.anchorNode||!t.contains(l.anchorNode))return;let x=l.anchorNode,O=x.nodeType===Node.ELEMENT_NODE?x:x.parentElement,d=(l.isCollapsed?O?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,he=n?.id??i?.id??null;if(d&&d!==he){ne(d);return}performance.now()-de.current<50||z((0,q.getCursorOffset)(t))};return c.addEventListener("selectionchange",p),()=>c.removeEventListener("selectionchange",p)},[n,i,ne,z]),(0,k.useLayoutEffect)(()=>{let t=A.current;t&&(0,q.renderEditableContent)({input:t,segments:o,newParamId:r,editingParamId:n?.id??null,placeholderText:w??"",isFocused:b,showChipIcons:a})},[o,r,n,w,b,a]),(0,k.useLayoutEffect)(()=>{let t=le.current,c=r??"";if(le.current=c,!c||c===t)return;let p=A.current;if(!p)return;p.focus();let l=ve.current??(0,q.plainTextLength)(p);(0,q.setCursorOffset)(p,l)},[r]),(0,k.useLayoutEffect)(()=>{let t=h.current,c=n?.id??"";if(h.current=c,!c||c===t||s==null)return;let p=A.current;p&&(0,q.setCursorOffset)(p,s)},[n,s]);let N=(0,k.useCallback)(()=>{if(se.current)return;let t=A.current;if(!t)return;let c=(0,q.extractPlainText)(t),l=c.length>0&&c[0]!==c[0].toUpperCase()?c[0].toUpperCase()+c.slice(1):c;v(l)},[v]),we=(0,k.useCallback)(()=>{de.current=performance.now(),N();let t=A.current;t&&S((0,q.getCursorOffset)(t))},[N,S]);(0,k.useEffect)(()=>{let t=A.current;if(!t)return;let c=p=>{let l=p,x=l.inputType;if(x==="insertParagraph"||x==="insertLineBreak"||x==="insertFromDrop"){p.preventDefault();return}if(x.startsWith("insert")||x.startsWith("delete")){let O=x.startsWith("delete")?"":l.data??"";re(O)&&p.preventDefault()}};return t.addEventListener("beforeinput",c),()=>t.removeEventListener("beforeinput",c)},[re]);let Y=(0,k.useCallback)(()=>{se.current=!0},[]),xe=(0,k.useCallback)(()=>{se.current=!1,N()},[N]),ae=(0,k.useCallback)(t=>{t.preventDefault();let c=A.current;if(!c)return;let p=(t.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!p)return;let l=c.ownerDocument??document,x=l.getSelection();if(!x||x.rangeCount===0)return;let O=x.getRangeAt(0);if(!c.contains(O.startContainer))return;O.deleteContents();let H=l.createTextNode(p);O.insertNode(H),O.setStartAfter(H),O.collapse(!0),x.removeAllRanges(),x.addRange(O),N()},[N]),oe=(0,k.useCallback)(t=>E(t),[E]),ce=(0,k.useCallback)(()=>U(!0),[U]),B=(0,k.useCallback)(()=>U(!1),[U]),pe=(0,k.useCallback)(()=>A.current?.focus(),[]),j=(0,k.useCallback)(()=>A.current?.blur(),[]),F=(0,k.useCallback)(()=>{let t=A.current;return t?(0,q.extractPlainText)(t):""},[]),ue=ia()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:ue,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":m,"aria-expanded":y,"aria-activedescendant":_,spellCheck:!0,enterKeyHint:"send",onInput:we,onKeyDown:oe,onCompositionStart:Y,onCompositionEnd:xe,onPaste:ae,onFocus:ce,onBlur:B},getPlainText:F,focus:pe,blur:j}}var te=require("react/jsx-runtime");function na(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Rt=(0,R.forwardRef)(function({onSubmit:o,onResult:a,onError:r,optionOverrides:n,maskCompletedText:i,className:s,apiConfig:f,additionalContext:w,columns:b,pillPlacement:y="dropdown",mode:m="auto",optionsPosition:_="below",animations:P=!0,dropdownTrigger:v,closeDropdownOnBlur:E,showNonTappableOptions:S,showOptionIcons:z=!0,showChipIcons:ne=!0,showSkipButton:re,autoFocus:U=!0,onFocus:A,onBlur:se,value:le,completedParams:h,onChange:ve,onParamsChange:de,products:N,onProductSelect:we,submitButton:Y},xe){let ae=(0,R.useRef)(null),oe=(0,R.useRef)(null),ce=(0,R.useRef)(()=>{}),B=(0,R.useRef)(null),pe=(0,R.useRef)(null);(0,R.useEffect)(()=>{let D=ae.current;if(D)return B.current?B.current.setMode(m):B.current=new Oe.ModeController(D,m),()=>{B.current?.destroy(),B.current=null}},[m]);let j=(0,R.useCallback)(D=>{let _e=pe.current?.current;_e&&(_e.focus(),(0,Oe.setCursorOffset)(_e,D))},[]),{completedParams:F,skippedParams:ue,identifiedParams:t,isReady:c,suggestionPills:p,setActivePill:l,skipActivePill:x,segments:O,newParamId:H,clearNewParamId:d,placeholderText:he,isFocused:Se,isDropdownOpen:ye,isActivePillSelected:Ae,isLoading:X,activeIndex:De,listboxId:$,handleTextChange:V,handleKeyDown:Le,setFocused:Ge,editingParam:Ye,editingIdentified:Me,editingAnchor:Be,caretOffset:g,startEditingParam:Q,handleCaretAfterInput:L,handleCaretMove:Xe,replaceEditingRange:Ot,dropdownProps:Lt,reset:Fe}=Ve({onSubmit:D=>ce.current(D),onResult:a,onError:r,optionOverrides:n,maskCompletedText:i,apiConfig:f,additionalContext:w,columns:b,dropdownTrigger:v,optionsPosition:_,closeDropdownOnBlur:E,showNonTappableOptions:S,showOptionIcons:z,showSkipButton:re,onFocus:A,onBlur:se,value:le,completedParams:h,onChange:ve,onParamsChange:de,products:N,onProductSelect:we,source:"full-sdk",setCursor:j});(0,R.useEffect)(()=>{if(!H)return;let D=window.setTimeout(()=>d(),650);return()=>window.clearTimeout(D)},[H,d]);let Mt=De>=0?`${$}-option-${De}`:void 0,{inputRef:Ze,editorProps:zt,focus:He,blur:st,getPlainText:lt}=Tt({segments:O,newParamId:H,editingParam:Ye,editingIdentified:Me,editingAnchor:Be,caretOffset:g,placeholderText:he,isFocused:Se,showChipIcons:ne,isDropdownOpen:ye,listboxId:$,activeDescendantId:Mt,autoFocus:U,handleTextChange:V,handleKeyDown:Le,handleCaretAfterInput:L,handleCaretMove:Xe,startEditingParam:Q,replaceEditingRange:Ot,setFocused:Ge});pe.current=Ze,(0,R.useLayoutEffect)(()=>{let D=oe.current,_e=Ze.current;if(!D||!_e)return;let dt=()=>{let pt=D.firstElementChild;if(!pt)return;let Ft=pt.getBoundingClientRect(),Ht=_e.getBoundingClientRect();Ft.top>=Ht.bottom-2?D.setAttribute("data-aia-pill-wrapped",""):D.removeAttribute("data-aia-pill-wrapped")};dt();let ct=new ResizeObserver(dt);return ct.observe(_e),()=>ct.disconnect()},[O,p.length,X,Ze]),(0,R.useImperativeHandle)(xe,()=>({focus:He,blur:st,reset:Fe,setMode:D=>B.current?.setMode(D),skipActivePill:x}),[He,st,Fe,x]);let Ke=!!O.length||F.length>0,Je=(0,R.useCallback)(()=>{if(!Ke)return;let D=lt();o((0,Oe.buildSubmitResult)(D,F,ue,{identifiedParams:t,isReady:c})),Fe()},[Ke,F,ue,t,c,o,Fe,lt]);ce.current=Je;let Nt=(0,R.useCallback)(D=>{D.target?.closest("[data-aia-pill]")||He()},[He]),Gt=y==="inline",Bt=y==="dropdown";return(0,te.jsxs)("div",{ref:ae,className:`magicx-aia ${Pe.container} ${s??""}`,"data-pill-placement":y,"data-options-position":_,"data-animations":P?"on":"off","data-mode":na(m),children:[(0,te.jsx)(je,{...Lt,showPills:Bt}),(0,te.jsxs)("div",{className:Pe.inputWrapper,onClick:Nt,children:[(0,te.jsxs)("div",{className:Pe.editorArea,"data-aia-editor":"",children:[(0,te.jsx)("div",{...zt,className:Pe.input,"data-aia-input":""}),Gt&&(X||p.length>0)&&(0,te.jsx)("span",{ref:oe,className:Pe.pillListContainer,"data-aia-pill-list-container":"",children:(0,te.jsx)(qe,{pills:p,activePillIndex:0,activeSelected:Ae,onSelectPill:l,loading:X})})]}),Y===null?null:Y===void 0?(0,te.jsx)(Dt,{disabled:!Ke,onClick:Je}):(0,te.jsx)("span",{"data-aia-submit":"",className:Pe.submitSlot,onClick:D=>{Ke&&(D.stopPropagation(),Je())},children:Y})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,isoDate,monthLabel,optionLabel,parseDate,parseLooseDate,parseLooseDateRange,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
1667
+ `,document.head.appendChild(e)}var Dt={submitButton:"SubmitButton-module_submitButton_otz7H"};var Ve=require("react/jsx-runtime");function Ct({disabled:e,onClick:o}){return(0,Ve.jsx)("button",{type:"button","data-aia-submit":"",className:Dt.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),o()},"aria-label":"Submit",children:(0,Ve.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Ve.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Oe=require("@magicx-eng/ai-autocomplete-vanilla"),I=require("react");var rt=require("react");function Et(e){let o=(0,rt.useRef)(e);o.current=e;let a=Object.keys(e??{}).sort().join("\0"),r=(0,rt.useRef)({key:"",overrides:void 0});if(r.current.key!==a){let n={};for(let i of Object.keys(e??{})){let s=(f,w,b)=>{let x=o.current?.[i];return x?x(f,w,b):[]};n[i]=s}r.current={key:a,overrides:e?n:void 0}}return{overrides:r.current.overrides,key:a}}var st=require("react");function Tt(e){let o=(0,st.useRef)(e);o.current=e;let a=(0,st.useRef)(null);a.current===null&&(a.current={fetch:(n,i)=>{let s=o.current;return s?s.fetch(n,i):Promise.reject(new Error("products config removed"))},transform:n=>o.current?.transform(n)??[],get limit(){return o.current?.limit}});let r=e!==void 0;return{config:r?a.current:void 0,enabled:r}}var na={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:[],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 Qe({onSubmit:e,onResult:o,onError:a,optionOverrides:r,maskCompletedText:n,apiConfig:i,additionalContext:s,columns:f=2,dropdownTrigger:w,optionsPosition:b,closeDropdownOnBlur:x,showNonTappableOptions:m,showOptionIcons:y,showSkipButton:P,showProducts:v,onFocus:C,onBlur:O,value:z,completedParams:H,onChange:re,onParamsChange:K,products:A,onProductSelect:te,source:fe,setCursor:se}){let u=(0,I.useRef)(null),[be,N]=(0,I.useState)(null),ve=(0,I.useRef)(e);ve.current=e;let le=(0,I.useRef)(o);le.current=o;let ae=(0,I.useRef)(a);ae.current=a;let de=(0,I.useRef)(re);de.current=re;let oe=(0,I.useRef)(K);oe.current=K;let ce=(0,I.useRef)(C);ce.current=C;let pe=(0,I.useRef)(O);pe.current=O;let W=(0,I.useRef)(se);W.current=se;let $=(0,I.useRef)(te);$.current=te;let Y=Tt(A),V=Et(r);(0,I.useEffect)(()=>{if(typeof document>"u")return;let g=new Oe.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:i,additionalContext:s,optionOverrides:V.overrides,maskCompletedText:n,columns:f,dropdownTrigger:w,optionsPosition:b,closeDropdownOnBlur:x,showNonTappableOptions:m,showProducts:v,source:fe,value:z,completedParams:H,onSubmit:(...R)=>ve.current?.(...R),onResult:(...R)=>le.current?.(...R),onError:(...R)=>ae.current?.(...R),onChange:(...R)=>de.current?.(...R),onParamsChange:(...R)=>oe.current?.(...R),onFocus:()=>ce.current?.(),onBlur:()=>pe.current?.(),onProductSelect:R=>$.current?.(R),setCursor:R=>W.current?.(R),products:Y.config});u.current=g,N(g.getState());let Q=g.subscribe(R=>N(R));return()=>{Q(),g.destroy(),u.current===g&&(u.current=null)}},[]),(0,I.useEffect)(()=>{z!==void 0&&u.current?.setValue(z)},[z]),(0,I.useEffect)(()=>{H!==void 0&&u.current?.setCompletedParams(H)},[H]);let t=JSON.stringify(i??null),p;try{p=JSON.stringify(s??null)}catch{p="[unstringifiable]"}(0,I.useEffect)(()=>{u.current?.update({apiConfig:i,additionalContext:s,optionOverrides:V.overrides,dropdownTrigger:w,optionsPosition:b,closeDropdownOnBlur:x,showNonTappableOptions:m,showProducts:v})},[t,p,V.key,w,b,x,m,v]);let h=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!h.current){h.current=!0;return}u.current?.update({products:Y.config})},[Y.enabled]);let _=(0,I.useRef)(null);_.current===null&&(_.current={handleTextChange:g=>u.current?.handleTextChange(g),handleKeyDown:g=>{let Q="nativeEvent"in g?g.nativeEvent:g;u.current?.handleKeyDown(Q)},setFocused:g=>u.current?.setFocused(g),startEditingParam:g=>u.current?.startEditingParam(g),exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:g=>u.current?.handleCaretAfterInput(g),handleCaretMove:g=>u.current?.handleCaretMove(g),replaceEditingRange:g=>u.current?.replaceEditingRange(g)??!1,setActivePill:g=>u.current?.setActivePill(g),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),selectOption:g=>u.current?.selectOption(g),selectProduct:g=>u.current?.selectProduct(g),setActiveDropdownIndex:g=>u.current?.setActiveDropdownIndex(g),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let l=_.current,M=(0,I.useCallback)(g=>{let Q=g.target.value,Ze=Q.length>0&&!g.nativeEvent?.isComposing&&Q[0]!==Q[0].toUpperCase()?Q[0].toUpperCase()+Q.slice(1):Q;u.current?.handleTextChange(Ze)},[]),ie=(0,I.useCallback)(g=>{u.current?.handleKeyDown(g.nativeEvent)},[]),F=u.current,d=be??na,we=z!==void 0?z:d.text,De=H!==void 0?H:d.completedParams,xe=d.actionableSuggestions,Ce=xe[0],ye=F?.listboxId??"",_e=d.activeDropdownIndex>=0&&F?`${ye}-option-${d.activeDropdownIndex}`:void 0,G=d.editingParam,ke=d.editingIdentified,Me=G?{type:G.suggestionType,text:G.suggestionPlaceholder,required:!0,options:G.options}:ke?{type:ke.type,text:(0,Oe.identifiedParamLabel)(ke.type),required:!0,options:[]}:null,Ge=Me??Ce,Xe=Me?[Me]:xe,ze=(0,Oe.dateSelectionFor)(d),Be=!F||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:De,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:xe,setActivePill:l.setActivePill,skipActivePill:l.skipActivePill,removeLastParam:l.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:l.clearNewParamId,suggestions:d.suggestions,activeIndex:d.activeDropdownIndex,isReady:d.isReady,isLoading:Be,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:ye,error:d.error,products:d.products,customFields:d.customFields,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:G,editingIdentified:ke,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:we,placeholder:d.placeholderText||void 0,onChange:M,onKeyDown:ie,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":_e,"aria-autocomplete":"list","aria-controls":ye},reset:l.reset,dropdownProps:{suggestions:Ge?[{...Ge,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:ye,pills:Xe,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(P??!0)&&!G&&!ke,showOptionIcons:y??!0,skipDisabled:d.inSelectionAnimation,isLoading:Be,isInputEmpty:we.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:ze.selectedIso,selectedDateRange:ze.selectedRange,dateRangeStart:ze.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:b??"below"}}}var j=require("@magicx-eng/ai-autocomplete-vanilla"),k=require("react"),Ye;function ra(){if(Ye!==void 0)return Ye;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ye=e.contentEditable==="plaintext-only",Ye}function Rt(e){let{segments:o,showChipIcons:a=!0,newParamId:r,editingParam:n,editingIdentified:i,editingAnchor:s,caretOffset:f,placeholderText:w,isFocused:b,isDropdownOpen:x,listboxId:m,activeDescendantId:y,autoFocus:P,handleTextChange:v,handleKeyDown:C,handleCaretAfterInput:O,handleCaretMove:z,startEditingParam:H,replaceEditingRange:re,setFocused:K}=e,A=(0,k.useRef)(null),te=(0,k.useRef)(!1),fe=(0,k.useRef)(""),se=(0,k.useRef)(""),u=(0,k.useRef)(null),be=(0,k.useRef)(0);u.current=f,(0,k.useEffect)(()=>{if(!P)return;let t=A.current;if(!t)return;document.activeElement===t?K(!0):t.focus();let p=t.ownerDocument??document,h=p.getSelection(),_=h&&h.rangeCount>0&&t.contains(h.anchorNode);if(h&&!_){let l=p.createRange();l.selectNodeContents(t),l.collapse(!0),h.removeAllRanges(),h.addRange(l)}},[P,K]),(0,k.useEffect)(()=>{let t=A.current;if(!t)return;let p=t.ownerDocument??document,h=()=>{let _=p.getSelection();if(!_||_.rangeCount===0||!_.anchorNode||!t.contains(_.anchorNode))return;let l=_.anchorNode,M=l.nodeType===Node.ELEMENT_NODE?l:l.parentElement,F=(_.isCollapsed?M?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,d=n?.id??i?.id??null;if(F&&F!==d){H(F);return}performance.now()-be.current<50||z((0,j.getCursorOffset)(t))};return p.addEventListener("selectionchange",h),()=>p.removeEventListener("selectionchange",h)},[n,i,H,z]),(0,k.useLayoutEffect)(()=>{let t=A.current;t&&(0,j.renderEditableContent)({input:t,segments:o,newParamId:r,editingParamId:n?.id??null,placeholderText:w??"",isFocused:b,showChipIcons:a})},[o,r,n,w,b,a]),(0,k.useLayoutEffect)(()=>{let t=fe.current,p=r??"";if(fe.current=p,!p||p===t)return;let h=A.current;if(!h)return;h.focus();let _=u.current??(0,j.plainTextLength)(h);(0,j.setCursorOffset)(h,_)},[r]),(0,k.useLayoutEffect)(()=>{let t=se.current,p=n?.id??"";if(se.current=p,!p||p===t||s==null)return;let h=A.current;h&&(0,j.setCursorOffset)(h,s)},[n,s]);let N=(0,k.useCallback)(()=>{if(te.current)return;let t=A.current;if(!t)return;let p=(0,j.extractPlainText)(t),_=p.length>0&&p[0]!==p[0].toUpperCase()?p[0].toUpperCase()+p.slice(1):p;v(_)},[v]),ve=(0,k.useCallback)(()=>{be.current=performance.now(),N();let t=A.current;t&&O((0,j.getCursorOffset)(t))},[N,O]);(0,k.useEffect)(()=>{let t=A.current;if(!t)return;let p=h=>{let _=h,l=_.inputType;if(l==="insertParagraph"||l==="insertLineBreak"||l==="insertFromDrop"){h.preventDefault();return}if(l.startsWith("insert")||l.startsWith("delete")){let M=l.startsWith("delete")?"":_.data??"";re(M)&&h.preventDefault()}};return t.addEventListener("beforeinput",p),()=>t.removeEventListener("beforeinput",p)},[re]);let le=(0,k.useCallback)(()=>{te.current=!0},[]),ae=(0,k.useCallback)(()=>{te.current=!1,N()},[N]),de=(0,k.useCallback)(t=>{t.preventDefault();let p=A.current;if(!p)return;let h=(t.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!h)return;let _=p.ownerDocument??document,l=_.getSelection();if(!l||l.rangeCount===0)return;let M=l.getRangeAt(0);if(!p.contains(M.startContainer))return;M.deleteContents();let ie=_.createTextNode(h);M.insertNode(ie),M.setStartAfter(ie),M.collapse(!0),l.removeAllRanges(),l.addRange(M),N()},[N]),oe=(0,k.useCallback)(t=>C(t),[C]),ce=(0,k.useCallback)(()=>K(!0),[K]),pe=(0,k.useCallback)(()=>K(!1),[K]),W=(0,k.useCallback)(()=>A.current?.focus(),[]),$=(0,k.useCallback)(()=>A.current?.blur(),[]),Y=(0,k.useCallback)(()=>{let t=A.current;return t?(0,j.extractPlainText)(t):""},[]),V=ra()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:V,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":m,"aria-expanded":x,"aria-activedescendant":y,spellCheck:!0,enterKeyHint:"send",onInput:ve,onKeyDown:oe,onCompositionStart:le,onCompositionEnd:ae,onPaste:de,onFocus:ce,onBlur:pe},getPlainText:Y,focus:W,blur:$}}var ee=require("react/jsx-runtime");function sa(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ot=(0,T.forwardRef)(function({onSubmit:o,onResult:a,onError:r,optionOverrides:n,maskCompletedText:i,className:s,apiConfig:f,additionalContext:w,columns:b,pillPlacement:x="dropdown",mode:m="auto",optionsPosition:y="below",animations:P=!0,dropdownTrigger:v,closeDropdownOnBlur:C,showNonTappableOptions:O,showOptionIcons:z=!0,showChipIcons:H=!0,showSkipButton:re,showProducts:K,autoFocus:A=!0,onFocus:te,onBlur:fe,value:se,completedParams:u,onChange:be,onParamsChange:N,products:ve,onProductSelect:le,submitButton:ae},de){let oe=(0,T.useRef)(null),ce=(0,T.useRef)(null),pe=(0,T.useRef)(()=>{}),W=(0,T.useRef)(null),$=(0,T.useRef)(null);(0,T.useEffect)(()=>{let S=oe.current;if(S)return W.current?W.current.setMode(m):W.current=new Le.ModeController(S,m),()=>{W.current?.destroy(),W.current=null}},[m]);let Y=(0,T.useCallback)(S=>{let Pe=$.current?.current;Pe&&(Pe.focus(),(0,Le.setCursorOffset)(Pe,S))},[]),{completedParams:V,skippedParams:t,identifiedParams:p,isReady:h,customFields:_,suggestionPills:l,setActivePill:M,skipActivePill:ie,segments:F,newParamId:d,clearNewParamId:we,placeholderText:De,isFocused:xe,isDropdownOpen:Ce,isActivePillSelected:ye,isLoading:_e,activeIndex:G,listboxId:ke,handleTextChange:Me,handleKeyDown:Ge,setFocused:Xe,editingParam:ze,editingIdentified:Be,editingAnchor:g,caretOffset:Q,startEditingParam:R,handleCaretAfterInput:Ze,handleCaretMove:Lt,replaceEditingRange:Mt,dropdownProps:zt,reset:He}=Qe({onSubmit:S=>pe.current(S),onResult:a,onError:r,optionOverrides:n,maskCompletedText:i,apiConfig:f,additionalContext:w,columns:b,dropdownTrigger:v,optionsPosition:y,closeDropdownOnBlur:C,showNonTappableOptions:O,showOptionIcons:z,showSkipButton:re,showProducts:K,onFocus:te,onBlur:fe,value:se,completedParams:u,onChange:be,onParamsChange:N,products:ve,onProductSelect:le,source:"full-sdk",setCursor:Y});(0,T.useEffect)(()=>{if(!d)return;let S=window.setTimeout(()=>we(),650);return()=>window.clearTimeout(S)},[d,we]);let Nt=G>=0?`${ke}-option-${G}`:void 0,{inputRef:Je,editorProps:Ft,focus:Ke,blur:lt,getPlainText:dt}=Rt({segments:F,newParamId:d,editingParam:ze,editingIdentified:Be,editingAnchor:g,caretOffset:Q,placeholderText:De,isFocused:xe,showChipIcons:H,isDropdownOpen:Ce,listboxId:ke,activeDescendantId:Nt,autoFocus:A,handleTextChange:Me,handleKeyDown:Ge,handleCaretAfterInput:Ze,handleCaretMove:Lt,startEditingParam:R,replaceEditingRange:Mt,setFocused:Xe});$.current=Je,(0,T.useLayoutEffect)(()=>{let S=ce.current,Pe=Je.current;if(!S||!Pe)return;let ct=()=>{let ut=S.firstElementChild;if(!ut)return;let Kt=ut.getBoundingClientRect(),Wt=Pe.getBoundingClientRect();Kt.top>=Wt.bottom-2?S.setAttribute("data-aia-pill-wrapped",""):S.removeAttribute("data-aia-pill-wrapped")};ct();let pt=new ResizeObserver(ct);return pt.observe(Pe),()=>pt.disconnect()},[F,l.length,_e,Je]),(0,T.useImperativeHandle)(de,()=>({focus:Ke,blur:lt,reset:He,setMode:S=>W.current?.setMode(S),skipActivePill:ie}),[Ke,lt,He,ie]);let We=!!F.length||V.length>0,et=(0,T.useCallback)(()=>{if(!We)return;let S=dt();o((0,Le.buildSubmitResult)(S,V,t,{identifiedParams:p,isReady:h,customFields:_})),He()},[We,V,t,p,h,_,o,He,dt]);pe.current=et;let Gt=(0,T.useCallback)(S=>{S.target?.closest("[data-aia-pill]")||Ke()},[Ke]),Bt=x==="inline",Ht=x==="dropdown";return(0,ee.jsxs)("div",{ref:oe,className:`magicx-aia ${Se.container} ${s??""}`,"data-pill-placement":x,"data-options-position":y,"data-animations":P?"on":"off","data-mode":sa(m),children:[(0,ee.jsx)($e,{...zt,showPills:Ht}),(0,ee.jsxs)("div",{className:Se.inputWrapper,onClick:Gt,children:[(0,ee.jsxs)("div",{className:Se.editorArea,"data-aia-editor":"",children:[(0,ee.jsx)("div",{...Ft,className:Se.input,"data-aia-input":""}),Bt&&(_e||l.length>0)&&(0,ee.jsx)("span",{ref:ce,className:Se.pillListContainer,"data-aia-pill-list-container":"",children:(0,ee.jsx)(Ue,{pills:l,activePillIndex:0,activeSelected:ye,onSelectPill:M,loading:_e})})]}),ae===null?null:ae===void 0?(0,ee.jsx)(Ct,{disabled:!We,onClick:et}):(0,ee.jsx)("span",{"data-aia-submit":"",className:Se.submitSlot,onClick:S=>{We&&(S.stopPropagation(),et())},children:ae})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,isoDate,monthLabel,optionLabel,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
1668
1668
  //# sourceMappingURL=index.js.map