@magicx-eng/ai-autocomplete-react 0.60.3 → 0.61.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/README.md +5 -3
- package/REFERENCE.md +8 -0
- package/dist/index.d.mts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ma=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var Nt=Object.prototype.hasOwnProperty;var Ht=(e,t)=>{for(var a in t)Ma(e,a,{get:t[a],enumerable:!0})},Ft=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Mt(t))!Nt.call(e,o)&&o!==a&&Ma(e,o,{get:()=>t[o],enumerable:!(i=Dt(t,o))||i.enumerable});return e};var Bt=e=>Ft(Ma({},"__esModule",{value:!0}),e);var ui={};Ht(ui,{AIAutocomplete:()=>St,AIAutocompleteDropdown:()=>Ra,DATE_RANGE_META_END:()=>d.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>d.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>d.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>d.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>d.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>d.TIME_META_KEY,WEEKDAY_LABELS:()=>d.WEEKDAY_LABELS,buildSubmitResult:()=>d.buildSubmitResult,cellDay:()=>d.cellDay,cellIso:()=>d.cellIso,dateCellMarks:()=>d.dateCellMarks,formatDate:()=>d.formatDate,formatDateRange:()=>d.formatDateRange,formatOptionCount:()=>d.formatOptionCount,formatPlace:()=>d.formatPlace,formatTime:()=>d.formatTime,isoDate:()=>d.isoDate,monthLabel:()=>d.monthLabel,optionCountLabel:()=>d.optionCountLabel,optionHasImage:()=>d.optionHasImage,optionImageSources:()=>d.optionImageSources,optionImageSrc:()=>d.optionImageSrc,optionLabel:()=>d.optionLabel,optionsShowLeadingVisuals:()=>d.optionsShowLeadingVisuals,parseDate:()=>d.parseDate,parseLooseDate:()=>d.parseLooseDate,parseLooseDateRange:()=>d.parseLooseDateRange,parseTime:()=>d.parseTime,productFromMatchedItem:()=>d.productFromMatchedItem,productImageSources:()=>d.productImageSources,productsFromCustomFields:()=>d.productsFromCustomFields,sanitizeOptionIconSvg:()=>d.sanitizeOptionIconSvg,selectedRangeFor:()=>d.selectedRangeFor,useAIAutocomplete:()=>La,visibleDateRange:()=>d.visibleDateRange,withSkippedParams:()=>d.withSkippedParams});module.exports=Bt(ui);var d=require("@magicx-eng/ai-autocomplete-vanilla");var Y=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
|
|
2
2
|
position: relative;
|
|
3
3
|
/* Inherits the host page's font by default. Consumers can pin a specific
|
|
4
4
|
font on the library via \`--aia-font-family: 'Custom Font'\` without
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
transition: none;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
`,document.head.appendChild(e)}var
|
|
409
|
+
`,document.head.appendChild(e)}var ha={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};var L=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=`/*
|
|
410
410
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
411
411
|
* Consumer CSS always wins without !important.
|
|
412
412
|
*
|
|
@@ -1726,7 +1726,7 @@
|
|
|
1726
1726
|
opacity: 1;
|
|
1727
1727
|
}
|
|
1728
1728
|
}
|
|
1729
|
-
`,document.head.appendChild(e)}var ye={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};var ae=require("@magicx-eng/ai-autocomplete-vanilla")
|
|
1729
|
+
`,document.head.appendChild(e)}var ye={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};var ae=require("@magicx-eng/ai-autocomplete-vanilla"),Za=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) ---
|
|
1730
1730
|
|
|
1731
1731
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1732
1732
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1923,7 +1923,7 @@
|
|
|
1923
1923
|
opacity: 0.8;
|
|
1924
1924
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1925
1925
|
}
|
|
1926
|
-
`,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",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};var we=require("react/jsx-runtime"),
|
|
1926
|
+
`,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",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};var we=require("react/jsx-runtime"),Wt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Xa({options:e,activeIndex:t,listboxId:a,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:v,onNextMonth:x}){let k=(0,ae.isoDate)(new Date),b=(0,ae.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,ae.cellIso)(e[t]),selected:o.selectedRange,floor:o.floor});return(0,we.jsxs)("div",{className:Z.datepicker,"data-aia-datepicker":"",children:[(0,we.jsxs)("div",{className:Z.header,children:[(0,we.jsx)("button",{type:"button",tabIndex:-1,className:Z.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:u=>u.preventDefault(),onClick:v,children:"\u2039"}),(0,we.jsx)("span",{className:Z.month,"data-aia-date-month":"","aria-live":"polite",children:(0,ae.monthLabel)(i)}),(0,we.jsx)("button",{type:"button",tabIndex:-1,className:Z.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:u=>u.preventDefault(),onClick:x,children:"\u203A"})]}),(0,we.jsx)("div",{className:Z.weekdays,"aria-hidden":"true",children:ae.WEEKDAY_LABELS.map((u,h)=>(0,we.jsx)("span",{className:Z.weekday,children:u},Wt[h]))}),(0,we.jsx)("div",{className:Z.grid,"data-aia-date-grid":"",children:e.map((u,h)=>(0,we.jsx)(Gt,{option:u,id:`${a}-option-${h}`,index:h,isHighlighted:h===t&&u.is_tappable,isToday:(0,ae.cellIso)(u)===k,isPast:(0,ae.isDimmedDay)((0,ae.cellIso)(u),k,o.floor),marks:(0,ae.dateCellMarks)((0,ae.cellIso)(u),{selectedIso:o.selectedIso,range:b,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},(0,ae.cellIso)(u)??`pad-${h}`))})]})}function Gt({option:e,id:t,index:a,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:v,onUnhighlight:x}){let[k,b]=(0,Za.useState)(!1),u=(0,ae.cellDay)(e);if(u==null)return(0,we.jsx)("div",{id:t,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${Z.cell} ${Z.blank}`});let h=()=>{b(!0),l(e),setTimeout(()=>b(!1),170)},C=[Z.cell,Z.day,s?Z.past:"",i?Z.highlighted:"",o?Z.today:"",r.inRange?Z.inRange:"",r.selected?Z.selected:"",r.reference?Z.reference:"",k?Z.pressed:""].filter(Boolean).join(" ");return(0,we.jsx)("div",{id:t,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:C,onClick:h,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),h())},onMouseEnter:()=>v(a),onMouseLeave:x?()=>x(a):void 0,children:(0,we.jsx)("span",{className:Z.number,children:u})})}var ia=require("@magicx-eng/ai-autocomplete-vanilla"),Pa=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 {
|
|
1927
1927
|
display: flex;
|
|
1928
1928
|
flex-wrap: wrap;
|
|
1929
1929
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1963,7 +1963,7 @@
|
|
|
1963
1963
|
.aia-cluster[data-justify="around"] {
|
|
1964
1964
|
justify-content: space-around;
|
|
1965
1965
|
}
|
|
1966
|
-
`,document.head.appendChild(e)}var
|
|
1966
|
+
`,document.head.appendChild(e)}var Na=require("react/jsx-runtime");function ya({gap:e,align:t="center",justify:a="start",noWrap:i=!1,inline:o=!1,className:s,children:r,...l}){let v=e?{"--aia-cluster-gap":e}:void 0,x={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":t,"data-justify":a,"data-nowrap":i||void 0,"data-inline":o||void 0,style:v,...l};return o?(0,Na.jsx)("span",{...x,children:r}):(0,Na.jsx)("div",{...x,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
|
|
1967
1967
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1968
1968
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1969
1969
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -2110,7 +2110,7 @@
|
|
|
2110
2110
|
justify-content: flex-end;
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
|
-
`,document.head.appendChild(e)}var je={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var
|
|
2113
|
+
`,document.head.appendChild(e)}var je={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var De=require("react/jsx-runtime");function Ja({isOptionHighlighted:e=!1,isInputEmpty:t=!1,strings:a=(0,ia.uiStringsFor)()}){let{key:i,hint:o}=(0,ia.getFooterHint)(e,t,a),[s,r]=(0,Pa.useState)(ia.ATTRIBUTION_URL);return(0,Pa.useEffect)(()=>{r((0,ia.buildAttributionUrl)())},[]),(0,De.jsx)("footer",{className:je.footer,"data-aia-footer":"",children:(0,De.jsxs)(ya,{justify:"between",noWrap:!0,className:je.row,children:[(0,De.jsxs)(ya,{gap:"5px",className:je.hintGroup,children:[(0,De.jsx)("kbd",{className:je.key,children:i}),(0,De.jsx)("span",{className:je.hint,children:o})]}),(0,De.jsxs)("a",{className:je.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,De.jsx)("span",{className:je.brand,children:"AI"}),(0,De.jsx)("span",{className:je.badge,children:"Autocomplete"})]})]})})}var le=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
|
|
2114
2114
|
Angular copy). The three are kept identical by
|
|
2115
2115
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
2116
2116
|
.aia-location-6-fsr {
|
|
@@ -2244,7 +2244,7 @@
|
|
|
2244
2244
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2245
2245
|
width: 60%;
|
|
2246
2246
|
}
|
|
2247
|
-
`,document.head.appendChild(e)}var te={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};var
|
|
2247
|
+
`,document.head.appendChild(e)}var te={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};var V=require("react/jsx-runtime"),Kt=0;function ka(e){return e.getRootNode().activeElement??null}function tt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function et(e){if(!e.isContentEditable)return null;let t=tt(e);if(!t||t.rangeCount===0)return null;let a=t.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function at(e,t){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=tt(e);if(!a)return;let i=t;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),a.removeAllRanges(),a.addRange(i)}var qt=(0,V.jsxs)("svg",{className:te.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,V.jsx)("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),(0,V.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),_t=(0,V.jsxs)("svg",{className:te.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,V.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,V.jsx)("path",{d:"m20 20-3.5-3.5"})]});function it({view:e,searchLabel:t,noResultsLabel:a,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:v,onMove:x,onCommit:k,onFocusChange:b}){let u=(0,le.useRef)(null),h=(0,le.useRef)(null),C=(0,le.useRef)(null),y=(0,le.useRef)(null),j=(0,le.useRef)(null),F=(0,le.useRef)(!1),D=(0,le.useRef)(!1),he=(0,le.useRef)(!1),P=(0,le.useRef)(!1),H=(0,le.useRef)(o);H.current=o;let oe=(0,le.useRef)(b);oe.current=b;let W=c=>{P.current=c,b(c)},ge=()=>{let c=u.current;return c!=null&&ka(c)===c},pe=()=>{let c=h.current;if(!c)return;let I=ka(c);I instanceof HTMLElement&&I!==u.current&&I!==document.body&&!c.contains(I)&&(y.current=I,j.current=et(I))},A=c=>{let I=h.current;!I||!(c instanceof HTMLElement)||c===y.current||c===document.body||I.contains(c)||(y.current=c,j.current=et(c))},ne=(0,le.useRef)(null);ne.current===null&&(ne.current=`aia-location-${++Kt}`);let ee=`${ne.current}-row-`;(0,le.useEffect)(()=>{let c=u.current;c&&c.value!==e.query&&ka(c)!==c&&(c.value=e.query)},[e.query]),(0,le.useEffect)(()=>{o&&(s&&!he.current&&(D.current=!1),he.current=s);let c=u.current;if(c){if(!r&&ge()){D.current=!0,_();return}if(!o){setTimeout(()=>{if(H.current)return;let I=y.current;I&&ka(I)===I||(D.current=!1)},0);return}if(!(!s||D.current||!l||ge())){if(pe(),W(!0),c.focus({preventScroll:!0}),!ge()){D.current=!0,W(!1);return}c.value&&c.select()}}}),(0,le.useLayoutEffect)(()=>()=>{if(!P.current)return;let c=u.current,I=y.current;I?.isConnected&&c&&ka(c)===c&&(F.current=!0,at(I,j.current),F.current=!1),P.current=!1,oe.current(!1)},[]);let _=(c=!1)=>{c&&(D.current=!0);let I=y.current;I?.isConnected&&ge()&&(F.current=!0,at(I,j.current),F.current=!1),W(!1)},xe=e.query.trim(),T=e.highlighted>=0&&e.highlighted<e.places.length?`${ee}${e.highlighted}`:void 0,G=null;return e.places.length>0?G=e.places.map((c,I)=>(0,V.jsxs)("div",{id:`${ee}${I}`,role:"option","aria-selected":I===e.highlighted,className:I===e.highlighted?`${te.row} ${te.highlighted}`:te.row,"data-aia-location-row":"","data-aia-index":I,onClick:()=>{l&&(_(!0),k(I))},children:[(0,V.jsx)("span",{className:te.pin,children:qt}),(0,V.jsxs)("span",{className:te.text,children:[(0,V.jsx)("span",{className:te.name,children:c.name}),c.secondary&&(0,V.jsx)("span",{className:te.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?G=(0,V.jsxs)("div",{className:te.loading,"data-aia-location-loading":"",children:[(0,V.jsx)("span",{className:te.loadingBar}),(0,V.jsx)("span",{className:te.loadingBar}),(0,V.jsx)("span",{className:te.loadingBar})]}):xe&&(G=(0,V.jsxs)("div",{className:te.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,V.jsx)("span",{className:te.empty,children:a}),(0,V.jsx)("span",{children:i})]})),(0,V.jsxs)("div",{ref:h,className:te.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!C.current?.contains(c.target)||(c.stopPropagation(),pe(),W(!0))},children:[(0,V.jsxs)("label",{ref:C,className:te.field,children:[_t,(0,V.jsx)("input",{ref:u,type:"text",className:te.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:t,"aria-label":t,"aria-activedescendant":T,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>v(c.target.value),onFocus:c=>{A(c.relatedTarget),W(!0)},onBlur:()=>{F.current||(D.current=!0,W(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),x(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!l)return;_(!0),k();return;case"Escape":c.preventDefault(),c.stopPropagation(),D.current=!0,_();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),D.current=!0,_();return}}})]}),(0,V.jsx)("div",{className:te.results,"data-aia-location-results":"","aria-live":"polite",children:G})]})}var Ia=require("@magicx-eng/ai-autocomplete-vanilla");var ot=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
|
|
2248
2248
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2249
2249
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2250
2250
|
as it was when the outline was dashed. */
|
|
@@ -2402,7 +2402,7 @@
|
|
|
2402
2402
|
opacity: 0;
|
|
2403
2403
|
}
|
|
2404
2404
|
}
|
|
2405
|
-
`,document.head.appendChild(e)}var
|
|
2405
|
+
`,document.head.appendChild(e)}var Me={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};var oa=require("react/jsx-runtime"),Ha={selected:1,first:.7,next:.4,last:.2};function nt({label:e,state:t,active:a,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:l}){let v=[Me.pill,i?Me.rounded:"",o?Me.skeleton:""].filter(Boolean).join(" ");return(0,oa.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":a?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:v,style:{"--aia-pill-opacity":Ha[t]},onMouseDown:x=>x.preventDefault(),onClick:o?void 0:l,disabled:o,children:s?(0,oa.jsxs)(oa.Fragment,{children:[(0,oa.jsx)("span",{className:`${Me.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,oa.jsx)("span",{className:`${Me.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:ot.SMART_SUGGESTION_SPARKLE_SVG}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
|
|
2406
2406
|
position: relative;
|
|
2407
2407
|
z-index: 1;
|
|
2408
2408
|
pointer-events: auto;
|
|
@@ -2412,7 +2412,7 @@
|
|
|
2412
2412
|
align-items: center;
|
|
2413
2413
|
vertical-align: middle;
|
|
2414
2414
|
}
|
|
2415
|
-
`,document.head.appendChild(e)}var
|
|
2415
|
+
`,document.head.appendChild(e)}var Fa={list:"aia-list-qvLqO"};var Ca=require("react/jsx-runtime"),Vt=[125,69];function rt(e){return e===0?"first":e===1?"next":"last"}function Ea({pills:e,activePillIndex:t,onSelectPill:a,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?(0,Ca.jsx)("span",{className:Fa.list,"data-aia-pill-list-loading":"",children:Vt.map((r,l)=>(0,Ca.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Me.pill} ${o?Me.rounded:""} ${Me.skeleton}`,style:{width:r,"--aia-pill-opacity":Ha[rt(l)]}},`skel-${r}`))}):(0,Ca.jsx)("span",{className:Fa.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let v=!!i&&l===t;return(0,Ca.jsx)(nt,{label:r.text,state:v?"selected":rt(l),selected:v,active:l===t,rounded:o,loading:s,smartSuggestion:(0,Ia.isSmartSuggestion)(r),completionHeader:(0,Ia.isTraditionalAutocompleteSuggestion)(r),onClick:()=>a(l)},`${r.parameter}-${r.text}`)})})}var ke=require("@magicx-eng/ai-autocomplete-vanilla"),ve=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
|
|
2416
2416
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2417
2417
|
theming one package sees the same result in the other.
|
|
2418
2418
|
|
|
@@ -3005,7 +3005,7 @@
|
|
|
3005
3005
|
opacity: 0.01;
|
|
3006
3006
|
}
|
|
3007
3007
|
}
|
|
3008
|
-
`,document.head.appendChild(e)}var ie={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};var q=require("react/jsx-runtime");function
|
|
3008
|
+
`,document.head.appendChild(e)}var ie={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};var q=require("react/jsx-runtime");function st({products:e,listboxId:t,onSelect:a,onAddToCart:i,onFocusChange:o,focusable:s=!0,loading:r=!1,layout:l="row",imageFallback:v="image",showVendor:x=!0,strings:k=(0,ke.uiStringsFor)()}){let b=e.length>0,u=(0,ve.useRef)(null);if((0,ve.useEffect)(()=>{let C=u.current;if(!(!b||!C))return(0,ke.attachProductRowWheel)(C)},[b]),!b)return null;let h=`${t}-products-label`;return(0,q.jsxs)("section",{className:ie.section,"data-aia-products":"","data-aia-loading":r?"":void 0,"data-aia-products-layout":l,role:"group","aria-labelledby":h,children:[(0,q.jsx)("div",{className:ie.label,id:h,"data-aia-products-label":"",children:k.products}),(0,q.jsx)("div",{ref:u,className:ie.row,"data-aia-products-row":"",children:e.map((C,y)=>(0,q.jsx)(Ut,{product:C,id:`${t}-product-${y}`,onSelect:a,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:v,showVendor:x,soldOut:k.soldOut,addToCart:k.addToCart},C.id))})]})}function Ut({product:e,id:t,onSelect:a,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:r,showVendor:l,soldOut:v,addToCart:x}){let k=!!i&&e.available!==!1,[b,u]=(0,ve.useState)(null),h=y=>{y.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},C=y=>{y.metaKey||y.ctrlKey||y.shiftKey||y.altKey||y.button!==0||(y.preventDefault(),a(e))};return(0,q.jsxs)("a",{id:t,className:ie.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":k?"":void 0,role:"option","aria-selected":!1,style:b?{"--aia-product-photo-fill-x":String(b.x),"--aia-product-photo-fill-y":String(b.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:C,onKeyDown:y=>{y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),a(e))},onFocus:()=>o?.(!0),onBlur:h,children:[(0,q.jsx)(jt,{sources:(0,ke.productImageSources)(e.imageUrl),title:e.title,fallback:r,onPhotoFill:u},(0,ke.productImageSrc)(e.imageUrl)??""),(0,q.jsxs)("span",{className:ie.body,children:[l&&e.vendor?(0,q.jsx)("span",{className:ie.vendor,children:e.vendor}):null,(0,q.jsx)("span",{className:ie.title,children:e.title}),e.price?(0,q.jsxs)("span",{className:ie.price,children:[e.price,e.compareAtPrice?(0,q.jsx)("s",{className:ie.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,q.jsx)("span",{className:ie.badge,children:v}):null]}),k&&i?(0,q.jsx)(Yt,{product:e,label:`${x}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>o?.(!0),onBlur:h},Qt(e)):null]})}function Qt(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(t=>t??"").join("\0")}function Yt({product:e,label:t,focusable:a,onAddToCart:i,onFocus:o,onBlur:s}){let[r,l]=(0,ve.useState)(null),v=(0,ve.useRef)(null),x=(0,ve.useRef)(e);x.current=e;let k=(0,ve.useRef)(!0);(0,ve.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let b=h=>{v.current=h,k.current&&l(h)},u=h=>{if(h.preventDefault(),h.stopPropagation(),v.current==="adding")return;b("adding");let C;try{C=Promise.resolve(i(x.current))}catch(y){C=Promise.reject(y)}C.then(()=>b("added"),()=>b(null))};return(0,q.jsx)("span",{className:ie.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":t,tabIndex:a?0:-1,onClick:u,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||u(h)},onFocus:h=>{h.stopPropagation(),o()},onBlur:h=>{h.stopPropagation(),s(h)},children:(0,q.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,q.jsx)("path",{className:ie.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),(0,q.jsx)("path",{className:ie.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,q.jsx)("path",{className:ie.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,q.jsx)("path",{className:ie.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,q.jsx)("circle",{className:ie.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,q.jsx)("circle",{className:ie.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function jt({sources:e,title:t,fallback:a,onPhotoFill:i}){let[o,s]=(0,ve.useState)(0),r=e[o],l=!!r,[v,x]=(0,ve.useState)(null),k=!l&&a==="initial";return(0,ve.useEffect)(()=>()=>i(null),[i]),(0,q.jsxs)("span",{className:ie.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!k?"":void 0,"data-aia-product-initial":k?"":void 0,"data-aia-image-loaded":l&&v===r?"":void 0,children:[l?(0,q.jsx)("img",{className:ie.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:b=>{x(r),i((0,ke.productPhotoFill)(b.currentTarget.naturalWidth,b.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(b=>b+1)}}):null,k?(0,ke.productInitial)(t):null]})}var X=require("@magicx-eng/ai-autocomplete-vanilla"),Pe=require("react");var lt=require("@magicx-eng/ai-autocomplete-vanilla"),Aa=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 {
|
|
3009
3009
|
display: grid;
|
|
3010
3010
|
grid-template-columns: repeat(
|
|
3011
3011
|
auto-fit,
|
|
@@ -3049,7 +3049,7 @@
|
|
|
3049
3049
|
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
3050
3050
|
max-height: var(--aia-grid-max-height, 120px);
|
|
3051
3051
|
}
|
|
3052
|
-
`,document.head.appendChild(e)}var
|
|
3052
|
+
`,document.head.appendChild(e)}var ct=require("react/jsx-runtime");function dt({min:e="16rem",max:t,gap:a,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:v,className:x,children:k,...b}){let u=(0,Aa.useRef)(null);(0,Aa.useLayoutEffect)(()=>{if(s===void 0)return;let C=u.current;C&&(C.scrollTop=0)},[s]);let h={"--aia-grid-min":e};return t&&(h["--aia-grid-max"]=t),a&&(h["--aia-grid-gap"]=a),o&&(h["--aia-grid-max-height"]=o),r&&(h.gridTemplateColumns=(0,lt.optionsGridTemplateColumns)(r)),l&&(h.gridTemplateColumns=l),(0,ct.jsx)("div",{ref:C=>{u.current=C,v?.(C)},className:x?`aia-grid ${x}`:"aia-grid","data-scroll":i||void 0,style:h,...b,children:k})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),Ce=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
|
|
3053
3053
|
position: relative;
|
|
3054
3054
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
3055
3055
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3575,7 +3575,7 @@
|
|
|
3575
3575
|
border-radius: 6px;
|
|
3576
3576
|
font-size: 11px;
|
|
3577
3577
|
}
|
|
3578
|
-
`,document.head.appendChild(e)}var
|
|
3578
|
+
`,document.head.appendChild(e)}var de={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};var ce=require("react/jsx-runtime");function pt({option:e,isHighlighted:t,checked:a,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:v=!0,showImage:x=!0,showCount:k=!0,scrollHint:b,enterDelayMs:u=0}){let[h]=(0,Ce.useState)(u),[C,y]=(0,Ce.useState)(!1),j=x?(0,ue.optionImageSources)(e.image_url):[],F=j[0]??null,[D,he]=(0,Ce.useState)([]),P=j.find(T=>!D.includes(T))??null,H=x?(e.imageCollage??[]).map(T=>(0,ue.optionImageSources)(T)[0]).filter(T=>T!==void 0):[],[oe,W]=(0,Ce.useState)(!1),[ge,pe]=(0,Ce.useState)(null),A=(0,Ce.useMemo)(()=>!F&&v&&e.icon_svg?(0,ue.sanitizeOptionIconSvg)(e.icon_svg):null,[F,v,e.icon_svg]),ne=k?(0,ue.formatOptionCount)(e.item_count):null,ee=(0,Ce.useRef)(void 0);(0,Ce.useEffect)(()=>()=>clearTimeout(ee.current),[]);let _=T=>{if(l||!e.is_tappable||C&&a===void 0)return;y(!0);let G=T?.currentTarget;a!==void 0&&G!==void 0&&T!==void 0&&!(0,ue.isMultiSelectToggleTap)(G,G.querySelector("[data-aia-checkbox]"),T)?i(e,{commit:!0}):i(e),clearTimeout(ee.current),ee.current=setTimeout(()=>y(!1),170)},xe=[de.item,t&&!l?de.highlighted:"",e.liveMatch&&!l?de.liveMatch:"",e.is_tappable?de.tappable:de.nonTappable,C?de.pressed:"",b?de.scrollHint:""].filter(Boolean).join(" ");return(0,ce.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":A&&e.icon?e.icon:void 0,"data-aia-image":F?"":void 0,"data-aia-item-count":ne!==null?e.item_count:void 0,"aria-selected":a??t,className:xe,style:{[ue.OPTION_ENTER_DELAY_VAR]:`${h}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:_,onKeyDown:T=>{!l&&e.is_tappable&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),_())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,ce.jsxs)("span",{className:de.content,children:[a!==void 0&&e.is_tappable&&(0,ce.jsx)("span",{className:de.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),F&&H.length>1&&(0,ce.jsx)("span",{className:`${de.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":H.length,"data-aia-image-loaded":oe?"":void 0,children:H.map(T=>(0,ce.jsx)("img",{src:T,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>W(!0),onError:G=>{G.currentTarget.hidden=!0}},T))}),F&&H.length<=1&&(0,ce.jsx)("span",{className:`${de.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":P!==null&&ge===P?"":void 0,children:(0,ce.jsx)("img",{src:P??F,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:P===null,onLoad:()=>pe(P),onError:()=>{P!==null&&he(T=>[...T,P])}})}),A&&(0,ce.jsx)("span",{className:`${de.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:A}}),(0,ce.jsxs)("span",{className:de.text,children:[e.matchedText?(0,ue.highlightParts)((0,ue.optionLabel)(e),e.matchedText).map((T,G)=>T.bold?(0,ce.jsx)("strong",{className:`${de.match} magicx-aia-option-match`,"data-aia-match-partial":T.partial?"":void 0,children:T.text},G):T.text):(0,ue.optionLabel)(e),e.parameterLabel&&(0,ce.jsxs)(ce.Fragment,{children:[" ",(0,ce.jsx)("span",{className:`${de.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,ce.jsx)("span",{className:de.tag,children:e.tag}),ne!==null&&(0,ce.jsx)("span",{className:`${de.count} magicx-aia-option-count`,children:ne})]})})}var Ba=require("react/jsx-runtime");function $t(){let[e,t]=(0,Pe.useState)(X.isOptionsGridMobileViewport);return(0,Pe.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(X.OPTIONS_GRID_MOBILE_QUERY),i=()=>t(a.matches);return i(),a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[]),e}function ht({options:e,activeIndex:t,picked:a,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:v="",optionsPosition:x="below",showIcons:k=!0,showImages:b=!0,showCounts:u=!0}){let h=$t(),C=(0,Pe.useRef)(null),[y,j]=(0,Pe.useState)(null),F=(0,Pe.useRef)(null);(0,Pe.useLayoutEffect)(()=>{if(l&&(0,X.sameOptionRows)(F.current,e))return;F.current=l?null:e;let P=C.current,H=P&&!l&&(0,X.needsOptionsGridMeasurement)(e.length,h),oe=P?.closest("[data-aia-dropdown]");H&&oe&&(0,X.releasePanelHug)(oe);let W=H?(0,X.measureOptionsGrid)(P):null;j(W?(0,X.planOptionsGrid)(e.length,h,W.rowWidths,W.gridWidth):null)},[e,h,l]);let D=y??(0,X.planOptionsGrid)(e.length,h,null,null);(0,Pe.useLayoutEffect)(()=>{let P=C.current?.closest("[data-aia-dropdown]");P&&(0,X.syncPanelHug)(P)},[D.template,h]);let he=(0,X.optionsShowLeadingVisuals)(e,k,b);return(0,Ba.jsx)(dt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:v,template:D.template,maxHeight:D.maxHeight,innerRef:P=>{C.current=P},"data-aia-group":v,children:e.map((P,H)=>(0,Ba.jsx)(pt,{option:P,isHighlighted:H===t,checked:a?a.includes(P.text):void 0,onSelect:i,onHighlight:()=>o(H),onUnhighlight:s?()=>s(H):void 0,id:`${r}-option-${H}`,loading:l,showIcon:k&&he,showImage:b&&he,showCount:u,scrollHint:!l&&D.scrollHintIndices.includes(H),enterDelayMs:l?0:(0,X.optionEnterDelayMs)(H,D.cols,e.length,x)},`${v}\0${P.parameter??""}\0${P.text}`))})}var me=require("@magicx-eng/ai-autocomplete-vanilla"),Ee=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
|
|
3579
3579
|
|
|
3580
3580
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3581
3581
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3697,7 +3697,7 @@
|
|
|
3697
3697
|
.aia-done-llNY5:hover {
|
|
3698
3698
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3699
3699
|
}
|
|
3700
|
-
`,document.head.appendChild(e)}var Ie={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};var Se=require("react/jsx-runtime")
|
|
3700
|
+
`,document.head.appendChild(e)}var Ie={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};var Se=require("react/jsx-runtime"),Zt=120;function ut({view:e,label:t,doneLabel:a,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return(0,Se.jsxs)("div",{className:Ie.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":t,onMouseDown:r=>r.preventDefault(),children:[(0,Se.jsx)("span",{className:Ie.value,"data-aia-time-value":"","aria-live":"polite",children:(0,me.formatTime)(e.minutes)}),(0,Se.jsxs)("div",{className:Ie.columns,"aria-hidden":"true",children:[(0,Se.jsx)("div",{className:Ie.band}),me.TIME_WHEEL_COLUMNS.map(r=>(0,Se.jsxs)(Ee.Fragment,{children:[r==="minute"&&(0,Se.jsx)("span",{className:Ie.separator,children:":"}),(0,Se.jsx)(Xt,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),(0,Se.jsx)("button",{type:"button",tabIndex:-1,className:Ie.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:a})]})}function Xt({column:e,minutes:t,interactive:a,onTimeChange:i}){let o=(0,Ee.useRef)(null),s=(0,Ee.useRef)(null),r=(0,Ee.useRef)(null),l=(0,Ee.useRef)({minutes:t,interactive:a,onTimeChange:i});l.current={minutes:t,interactive:a,onTimeChange:i};let v=(0,me.timeWheelIndex)(e,t);(0,Ee.useLayoutEffect)(()=>{let b=o.current;if(!b||r.current)return;let u=v*me.TIME_WHEEL_ROW_HEIGHT;Math.abs(b.scrollTop-u)<1||(s.current=u,b.scrollTop=u)},[v]),(0,Ee.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let x=()=>{r.current=null;let b=o.current,u=l.current;if(!b||!u.interactive)return;let h=(0,me.timeWheelIndexFromScroll)(e,b.scrollTop);h!==(0,me.timeWheelIndex)(e,u.minutes)&&u.onTimeChange((0,me.withTimeWheelIndex)(e,u.minutes,h))},k=()=>{let b=o.current;if(b){if(s.current!=null&&Math.abs(b.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(x,Zt)}};return(0,Se.jsx)("div",{ref:o,className:Ie.column,"data-aia-time-column":e,onScroll:k,children:(0,me.timeWheelRows)(e).map((b,u)=>(0,Se.jsx)("div",{className:u===v?`${Ie.row} ${Ie.selected}`:Ie.row,"data-aia-time-row":"","data-aia-index":u,onClick:()=>{l.current.interactive&&i((0,me.withTimeWheelIndex)(e,l.current.minutes,u))},children:b.label},b.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
|
|
3701
3701
|
display: flex;
|
|
3702
3702
|
flex-direction: column;
|
|
3703
3703
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3712,7 +3712,7 @@
|
|
|
3712
3712
|
align-items: end;
|
|
3713
3713
|
}
|
|
3714
3714
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3715
|
-
`,document.head.appendChild(e)}var
|
|
3715
|
+
`,document.head.appendChild(e)}var gt=require("react/jsx-runtime");function mt({space:e,align:t="stretch",className:a,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,gt.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":t,style:s,...o,children:i})}var U=require("react/jsx-runtime"),Jt=typeof window>"u"?J.useEffect:J.useLayoutEffect,ei=[159,119,164],ai=()=>{},ft=()=>{},ti=e=>{},ii=()=>{},oi=e=>{},ni=e=>{},ri=e=>{},si=e=>{};function li(e){let t=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,i]=(0,J.useState)(t);if((0,J.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function di(e,t){let a=(0,J.useRef)(null);(0,J.useEffect)(()=>{let i=e.current,o=t.current;if(!i||!o)return;let s=(0,L.queryLive)(i,".aia-grid[data-scroll]");if(a.current&&a.current.grid!==s&&(a.current.controller.destroy(),a.current=null),s&&!a.current){a.current={grid:s,controller:(0,L.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}a.current?.controller.update()}),(0,J.useEffect)(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function ci(e,t){let a=(0,J.useRef)(t);a.current=t;let i=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,L.attachViewportFit)({dropdown:o,isOpen:()=>a.current});return}i.current.update()}}),(0,J.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Ra({suggestions:e,activeIndex:t,onSelect:a,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:l,pills:v,onPillClick:x,showPills:k=!0,onSkip:b,showSkipButton:u=!0,showOptionIcons:h=!0,showOptionImages:C=!0,showOptionCounts:y=!0,skipDisabled:j=!1,activeSelected:F=!1,isLoading:D=!1,skeletonExiting:he=!1,isInputEmpty:P=!1,language:H,products:oe,onProductSelect:W,onProductAddToCart:ge,onProductFocusChange:pe,productsLayout:A="row",productImageFallback:ne="image",showProductVendor:ee=!0,formatType:_="options",dateView:xe=null,selectedDateIso:T=null,selectedDateRange:G=null,dateRangeStart:c=null,dateReferences:I,onPreviousMonth:Fe,onNextMonth:na,timeView:Be=null,multiSelectView:w=null,onMultiSelectCommit:ra,onSeeAllResults:We,fullWidth:$e=!1,onTimeChange:Ze,onTimeCommit:Xe,locationView:g=null,isReediting:S=!1,onLocationQuery:E,onLocationMove:R,onLocationCommit:N,onLocationFocusChange:re,isFocused:Te=!1,optionsPosition:fe="below",mode:Je}){let Ge=li(Je),sa=Ge!==void 0,se=(0,J.useRef)(null),Ke=(0,J.useRef)(null);di(se,Ke),(0,J.useEffect)(()=>{if(se.current)return(0,L.containScroll)(se.current)},[]);let la=e[0]?.options??[],ba=!!(v&&v.length>0&&x),Re=!!(oe&&oe.length>0),ua=_==="time"&&Be!=null,ea=_==="location"&&g!=null,f=s&&(la.length>0||k&&ba||D||Re||ua||ea);ci(se,f),Jt(()=>{let M=se.current;M&&((0,L.fitMultiSelectDone)(M,(0,L.findMultiSelectDone)(M)),(0,L.syncPanelHug)(M))});let qe={suggestions:e,activeIndex:t,pills:v,showPills:k,showSkipButton:u,showOptionIcons:h,showOptionImages:C,showOptionCounts:y,skipDisabled:j,activeSelected:F,isLoading:D,skeletonExiting:he,isInputEmpty:P,products:oe,formatType:_,dateView:xe,selectedDateIso:T,selectedDateRange:G,dateRangeStart:c,dateReferences:I,timeView:Be,multiSelectView:w,locationView:g,isReediting:S,showsSeeAll:!!We},da=(0,J.useRef)(qe);f&&(da.current=qe);let n=f?qe:da.current,m=(0,L.uiStringsFor)(H),_e=n.suggestions[0],Ve=_e?.options??[],Oe=n.activeIndex>=0&&!!Ve[n.activeIndex]?.is_tappable,Ue=(0,L.labelTraditionalAutocomplete)(n.pills??[],m.keepTyping),aa=!!(Ue.length>0&&x),Le=n.showPills&&aa,wa=n.showPills&&!aa&&n.isLoading,Qe=Le||wa,ze=aa&&(0,L.hasSkippablePill)(Ue)&&n.showSkipButton&&!n.isInputEmpty&&!!b,ta=Ue[0]?.text,ca=(0,L.isCalendarFormat)(n.formatType)&&n.dateView!=null,ma=Ve.length>0&&!ca,Ye=Ve.length>0&&ca&&!n.isLoading,pa=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,p=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,$=n.isLoading&&!ma&&!Ye&&!pa&&!p,B=n.products??[],ga=(0,L.panelMorphKey)(Le?Ue:[]);return(0,J.useLayoutEffect)(()=>{se.current&&(0,L.settlePanelMorph)(se.current,ga,{visible:f,anchorBottom:fe==="above"})},[ga,f,fe,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.dateReferences,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,n.showsSeeAll,A,H]),(0,J.useEffect)(()=>{let M=se.current;return()=>{M&&(0,L.destroyPanelMorph)(M)}},[]),(0,U.jsxs)("div",{ref:se,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":fe,"data-mode":Ge,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":B.length>0?"":void 0,"data-aia-full-width":$e?"":void 0,className:`${sa?"magicx-aia ":""}${ye.dropdown} ${f?ye.visible:""} ${l??""}`,onMouseDown:M=>M.preventDefault(),children:[(0,U.jsxs)(mt,{space:"8px",children:[(Qe||ze)&&(0,U.jsxs)(ya,{noWrap:!0,className:ye.pillBar,"data-aia-pillbar":"",children:[Qe&&(0,U.jsx)("span",{className:ye.pillScroll,"data-aia-pill-scroll":"",children:(0,U.jsx)(Ea,{pills:Ue,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:x??(()=>{}),rounded:!0,loading:n.isLoading})}),ze&&(0,U.jsx)("button",{type:"button",tabIndex:-1,className:ye.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":ta?`${m.skipLabel} ${ta}`:m.skipLabel,onClick:b,children:m.skip})]}),ma&&(0,U.jsx)(ht,{options:Ve,activeIndex:n.activeIndex,onSelect:a,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n.isLoading,groupKey:_e?`${_e.parameter} ${_e.text}`:"",optionsPosition:fe,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.multiSelectView?.picked}),n.multiSelectView&&(0,U.jsx)("div",{"data-aia-multi-actions":"",onClick:M=>{M.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&!n.isLoading&&ra?.()},children:(0,U.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:ye.multiDone,ref:M=>{M&&(M.disabled=!0,M.offsetHeight,M.disabled=n.skipDisabled||n.isLoading)},children:m.done})}),Ye&&n.dateView&&(0,U.jsx)(Xa,{options:Ve,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,L.dateFloorFor)(n.formatType,n.dateRangeStart),references:n.dateReferences??[]},onSelect:a,onHighlight:i,onUnhighlight:o,onPreviousMonth:Fe??ft,onNextMonth:na??ft}),pa&&n.timeView&&(0,U.jsx)(ut,{view:n.timeView,label:m.timeLabel,doneLabel:m.done,interactive:!n.skipDisabled,onTimeChange:Ze??ti,onTimeCommit:Xe??ii}),p&&n.locationView&&(0,U.jsx)(it,{view:n.locationView,searchLabel:m.locationSearch,noResultsLabel:m.locationNoResults,useTypedLabel:m.locationUseTyped,widgetFocused:Te&&f,reediting:n.isReediting,visible:f,interactive:!n.skipDisabled,onQuery:E??oi,onMove:R??ni,onCommit:N??ri,onFocusChange:re??si}),$&&(0,U.jsx)("div",{className:ye.skeletonBars,"data-aia-skeleton-bars":"",children:ei.map(M=>(0,U.jsx)("span",{className:ye.skeletonBar,style:{width:M}},`bar-${M}`))}),(0,U.jsx)(st,{products:B,listboxId:r,onSelect:W??ai,onAddToCart:ge,onFocusChange:pe,focusable:f&&!n.isLoading,loading:n.isLoading,layout:A,imageFallback:ne,showVendor:ee,strings:m}),n.showsSeeAll&&(0,U.jsx)("div",{className:ye.seeAllRow,"data-aia-see-all":"",onClick:M=>{M.target.closest("[data-aia-see-all-button]")&&(M.stopPropagation(),!n.isLoading&&We?.())},children:(0,U.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"",className:ye.seeAll,ref:M=>{M&&(M.disabled=!0,M.offsetHeight,M.disabled=n.isLoading)},children:m.seeAllResults})}),(0,U.jsx)(Ja,{isOptionHighlighted:Oe,isInputEmpty:n.isInputEmpty,strings:m})]}),(0,U.jsx)("button",{ref:Ke,type:"button",tabIndex:-1,className:ye.scrollArrow,"data-aia-scroll-arrow":"","aria-label":m.scrollArrow,"aria-hidden":"true",children:(0,U.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,U.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var He=require("@magicx-eng/ai-autocomplete-vanilla");var wt=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 {
|
|
3716
3716
|
flex-shrink: 0;
|
|
3717
3717
|
width: 32px;
|
|
3718
3718
|
height: 32px;
|
|
@@ -3783,5 +3783,5 @@
|
|
|
3783
3783
|
transition: none;
|
|
3784
3784
|
}
|
|
3785
3785
|
}
|
|
3786
|
-
`,document.head.appendChild(e)}var ft={submitButton:"aia-submitButton-otz7H"};var Ra=require("react/jsx-runtime");function wt({disabled:e,ready:t,onClick:a,label:i=(0,bt.uiStringsFor)().submit}){return(0,Ra.jsx)("button",{type:"button","data-aia-submit":"",className:ft.submitButton,disabled:e,"data-aia-ready":t?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":i,children:(0,Ra.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Ra.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var He=require("@magicx-eng/ai-autocomplete-vanilla"),A=require("react");var Ba=require("react");function vt(e){let t=(0,Ba.useRef)(e);t.current=e;let a=Object.keys(e??{}).sort().join("\0"),i=(0,Ba.useRef)({key:"",overrides:void 0});if(i.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,v,x)=>{let k=t.current?.[s];return k?k(l,v,x):[]};o[s]=r}i.current={key:a,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:a}}var Wa=require("react");function xt(e){let t=(0,Wa.useRef)(e);t.current=e;let a=(0,Wa.useRef)(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=t.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>t.current?.transform(o)??[],get limit(){return t.current?.limit}});let i=e!==void 0;return{config:i?a.current:void 0,enabled:i}}var yt={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Oa({onSubmit:e,onResult:t,onError:a,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,visitorId:k,columns:w=2,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:y,prependPlaceholder:R,allOption:ee,showNonTappableOptions:B,locationSearch:D,showOptionIcons:he,showOptionImages:P,showOptionCounts:H,showSkipButton:oe,showProducts:G,productImageFallback:ge="image",onFocus:ne,onBlur:E,value:Q,completedParams:Y,onChange:re,onParamsChange:xe,products:I,mapProducts:F,onProductSelect:p,onProductAddToCart:T,source:oa,setCursor:Be}){let b=(0,A.useRef)(null),[na,We]=(0,A.useState)(null),$e=(0,A.useRef)(e);$e.current=e;let Ze=(0,A.useRef)(t);Ze.current=t;let Xe=(0,A.useRef)(a);Xe.current=a;let Ge=(0,A.useRef)(re);Ge.current=re;let f=(0,A.useRef)(xe);f.current=xe;let C=(0,A.useRef)(ne);C.current=ne;let S=(0,A.useRef)(E);S.current=E;let O=(0,A.useRef)(Be);O.current=Be;let N=(0,A.useRef)(p);N.current=p;let se=(0,A.useRef)(T);se.current=T;let fe=(0,A.useRef)(k);fe.current=k;let Re=(0,A.useRef)(()=>{let c=fe.current;return typeof c=="function"?c():c}).current,Te=xt(I),ra=(0,A.useRef)(F);ra.current=F;let le=(0,A.useRef)((c,$)=>{let W=ra.current;return W?W(c,$):c}).current,Ke=F?le:void 0,sa=vt(i);(0,A.useEffect)(()=>{if(typeof document>"u")return;let c=new He.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,visitorId:Re,optionOverrides:sa.overrides,maskCompletedText:o,columns:w,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:y,prependPlaceholder:R,allOption:ee,showNonTappableOptions:B,locationSearch:D,showProducts:G,source:oa,value:Q,completedParams:Y,onSubmit:(...W)=>$e.current?.(...W),onResult:(...W)=>Ze.current?.(...W),onError:(...W)=>Xe.current?.(...W),onChange:(...W)=>Ge.current?.(...W),onParamsChange:(...W)=>f.current?.(...W),onFocus:()=>C.current?.(),onBlur:()=>S.current?.(),onProductSelect:W=>N.current?.(W),onProductAddToCart:W=>se.current?.(W),setCursor:W=>O.current?.(W),products:Te.config,mapProducts:Ke});b.current=c,We(c.getState());let $=c.subscribe(W=>We(W));return()=>{$(),c.destroy(),b.current===c&&(b.current=null)}},[]),(0,A.useEffect)(()=>{Q!==void 0&&b.current?.setValue(Q)},[Q]),(0,A.useEffect)(()=>{Y!==void 0&&b.current?.setCompletedParams(Y)},[Y]);let fa=JSON.stringify(s??null),Oe;try{Oe=JSON.stringify(r??null)}catch{Oe="[unstringifiable]"}(0,A.useEffect)(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,optionOverrides:sa.overrides,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:y,prependPlaceholder:R,allOption:ee,showNonTappableOptions:B,locationSearch:D,showProducts:G})},[fa,Oe,l,v?.code,v?.rate,v?.country,x,sa.key,u,h,y,R,ee,B,D,G]);let ha=(0,A.useRef)(!1);(0,A.useEffect)(()=>{if(!ha.current){ha.current=!0;return}b.current?.update({products:Te.config})},[Te.enabled]),(0,A.useEffect)(()=>{b.current?.update({mapProducts:Ke})},[Ke]);let Je=(0,A.useRef)(null);Je.current===null&&(Je.current={handleTextChange:c=>b.current?.handleTextChange(c),handleCompositionText:c=>b.current?.handleCompositionText(c),handleKeyDown:c=>{let $="nativeEvent"in c?c.nativeEvent:c;b.current?.handleKeyDown($)},setFocused:c=>b.current?.setFocused(c),startEditingParam:c=>b.current?.startEditingParam(c),removeParam:c=>b.current?.removeParam(c)??!1,exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:c=>b.current?.handleCaretAfterInput(c),handleCaretMove:c=>b.current?.handleCaretMove(c),replaceEditingRange:c=>b.current?.replaceEditingRange(c)??!1,setActivePill:c=>b.current?.setActivePill(c),skipActivePill:()=>b.current?.skipActivePill(),removeLastParam:()=>b.current?.removeLastParam(),clearNewParamId:()=>b.current?.clearNewParamId(),reset:()=>b.current?.reset(),refreshProducts:()=>b.current?.refreshProducts(),prepareSubmit:()=>b.current?.prepareSubmit(),getState:()=>b.current?.getState()??yt,recordSubmit:c=>b.current?.recordSubmit(c),selectOption:(c,$)=>b.current?.selectOption(c,$),selectProduct:c=>b.current?.selectProduct(c),addProductToCart:c=>{let $=b.current;return!$||!se.current?Promise.resolve():$.addProductToCart(c)},setActiveDropdownIndex:c=>b.current?.setActiveDropdownIndex(c),clearHighlight:c=>b.current?.clearHighlight(c),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:c=>b.current?.setTime(c),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:c=>b.current?.toggleMultiSelectOption(c),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:c=>b.current?.setLocationQuery(c),moveLocationHighlight:c=>b.current?.moveLocationHighlight(c),commitLocation:c=>b.current?.commitLocation(c),setLocationFieldFocused:c=>b.current?.setLocationFieldFocused(c),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let g=Je.current,qe=(0,A.useCallback)(c=>{let $=c.target.value,ma=$.length>0&&!c.nativeEvent?.isComposing&&$[0]!==$[0].toUpperCase()?$[0].toUpperCase()+$.slice(1):$;b.current?.handleTextChange(ma)},[]),la=(0,A.useCallback)(c=>{b.current?.handleKeyDown(c.nativeEvent)},[]),n=b.current,m=na??yt,_e=Q!==void 0?Q:m.text,Ve=Y!==void 0?Y:m.completedParams,Le=m.actionableSuggestions,Ue=Le[0],ea=(0,A.useMemo)(()=>(0,He.withoutTraditionalAutocomplete)(Le),[Le]),ze=n?.listboxId??"",ba=m.activeDropdownIndex>=0&&n?`${ze}-option-${m.activeDropdownIndex}`:void 0,Qe=m.editingParam,De=m.editingIdentified,aa=Qe?(0,He.editingSuggestion)(Qe):De?{parameter:De.parameter,text:(0,He.identifiedParamLabel)(De.parameter),required:!0,options:[]}:null,da=m.dropdownSuggestion??aa??Ue,ua=aa?[aa]:Le,Ye=(0,He.dateSelectionFor)(m),ca=!n||m.dropdownLoading;return{completedParams:Ve,multiSelectView:m.multiSelectView,toggleMultiSelectOption:g.toggleMultiSelectOption,commitMultiSelect:g.commitMultiSelect,skippedParams:m.skippedParams,identifiedParams:m.identifiedParams,suggestionPills:ea,setActivePill:g.setActivePill,skipActivePill:g.skipActivePill,removeLastParam:g.removeLastParam,segments:m.segments,newParamId:m.newParamId,clearNewParamId:g.clearNewParamId,suggestions:m.suggestions,activeIndex:m.activeDropdownIndex,isReady:m.isReady,isLoading:ca,isFocused:m.isFocused,isDropdownOpen:m.isDropdownOpen,isActivePillSelected:m.isActivePillSelected,placeholderText:m.placeholderText,listboxId:ze,error:m.error,products:m.products,customFields:m.customFields,selectProduct:g.selectProduct,addProductToCart:g.addProductToCart,handleTextChange:g.handleTextChange,handleCompositionText:g.handleCompositionText,handleKeyDown:g.handleKeyDown,setFocused:g.setFocused,editingParam:Qe,editingIdentified:De,editingAnchor:m.editingAnchor,caretOffset:m.caretOffset,startEditingParam:g.startEditingParam,removeParam:g.removeParam,exitEditMode:g.exitEditMode,handleCaretAfterInput:g.handleCaretAfterInput,handleCaretMove:g.handleCaretMove,replaceEditingRange:g.replaceEditingRange,inputProps:{value:_e,placeholder:m.placeholderText||void 0,onChange:qe,onKeyDown:la,onFocus:g.handleFocus,onBlur:g.handleBlur,role:"combobox","aria-expanded":m.isDropdownOpen,"aria-activedescendant":ba,"aria-autocomplete":"list","aria-controls":ze},reset:g.reset,refreshProducts:g.refreshProducts,prepareSubmit:g.prepareSubmit,getState:g.getState,recordSubmit:g.recordSubmit,dropdownProps:{suggestions:da?[{...da,options:m.dropdownOptions}]:[],activeIndex:m.activeDropdownIndex,onSelect:g.selectOption,onHighlight:g.setActiveDropdownIndex,onUnhighlight:g.clearHighlight,isOpen:m.isDropdownOpen,id:ze,pills:ua,activeSelected:m.isActivePillSelected,onPillClick:g.setActivePill,onSkip:g.skipActivePill,showSkipButton:(oe??!0)&&!Qe&&!De,showOptionIcons:he??!0,showOptionImages:P??!0,showOptionCounts:H??!0,skipDisabled:m.inSelectionAnimation,isLoading:ca,skeletonExiting:m.skeletonExiting,isInputEmpty:_e.trim().length===0,language:l,products:m.products,productImageFallback:ge,onProductSelect:g.selectProduct,onProductAddToCart:T?g.addProductToCart:void 0,onProductFocusChange:g.setFocused,formatType:m.activeFormatType,dateView:m.dateView,selectedDateIso:Ye.selectedIso,selectedDateRange:Ye.selectedRange,dateRangeStart:Ye.rangeStart,dateReferences:Ye.references,onPreviousMonth:g.showPreviousMonth,onNextMonth:g.showNextMonth,timeView:m.timeView,multiSelectView:m.dropdownMultiSelect,onMultiSelectCommit:g.commitMultiSelect,onTimeChange:g.setTime,onTimeCommit:g.commitTime,locationView:m.locationView,isReediting:m.editingParam!=null,onLocationQuery:g.setLocationQuery,onLocationMove:g.moveLocationHighlight,onLocationCommit:g.commitLocation,onLocationFocusChange:g.setLocationFieldFocused,isFocused:m.isFocused||m.locationFieldFocused,optionsPosition:h??"below"}}}var U=require("@magicx-eng/ai-autocomplete-vanilla"),z=require("react"),La;function ci(){if(La!==void 0)return La;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),La=e.contentEditable==="plaintext-only",La}function kt(e){let{segments:t,showChipIcons:a=!0,showChipImages:i=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:v,editingAnchor:x,caretOffset:k,placeholderText:w,hintSuggestions:u,isFocused:h,isDropdownOpen:y,listboxId:R,activeDescendantId:ee,autoFocus:B,handleTextChange:D,handleCompositionText:he,handleKeyDown:P,handleCaretAfterInput:H,handleCaretMove:oe,startEditingParam:G,replaceEditingRange:ge,setFocused:ne}=e,E=(0,z.useRef)(null),Q=(0,z.useRef)(!1),Y=(0,z.useRef)(""),re=(0,z.useRef)(""),xe=(0,z.useRef)(null),I=(0,z.useRef)(0);xe.current=k,(0,z.useEffect)(()=>{if(!B)return;let f=E.current;if(!f)return;document.activeElement===f?ne(!0):f.focus();let C=f.ownerDocument??document,S=C.getSelection(),O=S&&S.rangeCount>0&&f.contains(S.anchorNode);if(S&&!O){let N=C.createRange();N.selectNodeContents(f),N.collapse(!0),S.removeAllRanges(),S.addRange(N)}},[B,ne]),(0,z.useEffect)(()=>{let f=E.current;if(!f)return;let C=f.ownerDocument??document,S=()=>{let O=C.getSelection();if(!O||O.rangeCount===0||!O.anchorNode||!f.contains(O.anchorNode))return;let N=O.anchorNode,se=N.nodeType===Node.ELEMENT_NODE?N:N.parentElement,Re=(O.isCollapsed?se?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Te=l?.id??v?.id??null;if(Re&&Re!==Te){G(Re);return}performance.now()-I.current<50||oe((0,U.getCursorOffset)(f))};return C.addEventListener("selectionchange",S),()=>C.removeEventListener("selectionchange",S)},[l,v,G,oe]),(0,z.useEffect)(()=>{let f=E.current;if(!f)return;let C=S=>{let O=(0,U.chipIdFromTap)(f,S.target);O&&(G(O),(0,U.keepCaretOnChip)(f,O))};return f.addEventListener("click",C),()=>f.removeEventListener("click",C)},[G]),(0,z.useEffect)(()=>{let f=E.current;if(!(!f||!s||!o))return(0,U.attachChipRemove)(f,s)},[s,o]),(0,z.useLayoutEffect)(()=>{let f=E.current;f&&(0,U.renderEditableContent)({input:f,segments:t,newParamId:r,editingParamId:l?.id??null,placeholderText:w??"",isFocused:h,showChipIcons:a,showChipImages:i,showChipRemove:o,hintOptions:(0,U.startingHintOptions)(u??[])})},[t,r,l,w,u,h,a,i,o]),(0,z.useEffect)(()=>{let f=E.current;return()=>{f&&(0,U.cancelStartingHint)(f)}},[]),(0,z.useLayoutEffect)(()=>{let f=Y.current,C=r??"";if(Y.current=C,!C||C===f)return;let S=E.current;if(!S)return;S.focus();let O=xe.current??(0,U.plainTextLength)(S);(0,U.setCursorOffset)(S,O)},[r]),(0,z.useLayoutEffect)(()=>{let f=re.current,C=l?.id??"";if(re.current=C,!C||C===f||x==null)return;let S=E.current;S&&(0,U.setCursorOffset)(S,x)},[l,x]);let F=(0,z.useCallback)(()=>{let f=E.current;if(!f)return;let C=(0,U.extractPlainText)(f),O=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(Q.current){he(O);return}D(O)},[D,he]),p=(0,z.useCallback)(()=>{I.current=performance.now(),F();let f=E.current;f&&H((0,U.getCursorOffset)(f))},[F,H]);(0,z.useEffect)(()=>{let f=E.current;if(!f)return;let C=S=>{let O=S,N=O.inputType;if(N==="insertParagraph"||N==="insertLineBreak"||N==="insertFromDrop"){S.preventDefault();return}if(N.startsWith("insert")||N.startsWith("delete")){let se=N.startsWith("delete")?"":O.data??"";ge(se)&&S.preventDefault()}};return f.addEventListener("beforeinput",C),()=>f.removeEventListener("beforeinput",C)},[ge]);let T=(0,z.useCallback)(()=>{Q.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),oa=(0,z.useCallback)(()=>{Q.current=!1,E.current?.removeAttribute("data-aia-composing"),F()},[F]),Be=(0,z.useCallback)(f=>{f.preventDefault();let C=E.current;if(!C)return;let S=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!S)return;let O=C.ownerDocument??document,N=O.getSelection();if(!N||N.rangeCount===0)return;let se=N.getRangeAt(0);if(!C.contains(se.startContainer))return;se.deleteContents();let fe=O.createTextNode(S);se.insertNode(fe),se.setStartAfter(fe),se.collapse(!0),N.removeAllRanges(),N.addRange(se),F()},[F]),b=(0,z.useCallback)(f=>P(f),[P]),na=(0,z.useCallback)(()=>ne(!0),[ne]),We=(0,z.useCallback)(()=>ne(!1),[ne]),$e=(0,z.useCallback)(()=>E.current?.focus(),[]),Ze=(0,z.useCallback)(()=>E.current?.blur(),[]),Xe=(0,z.useCallback)(()=>{let f=E.current;return f?(0,U.extractPlainText)(f):""},[]),Ge=ci()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:Ge,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":R,"aria-expanded":y,"aria-activedescendant":ee,spellCheck:!0,enterKeyHint:"send",onInput:p,onKeyDown:b,onCompositionStart:T,onCompositionEnd:oa,onPaste:Be,onFocus:na,onBlur:We},getPlainText:Xe,focus:$e,blur:Ze}}var Ae=require("react/jsx-runtime");function pi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ct=(0,j.forwardRef)(function({onSubmit:t,onResult:a,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:v,language:x,currency:k,productId:w,visitorId:u,columns:h,pillPlacement:y="dropdown",mode:R="auto",optionsPosition:ee="below",animations:B=!0,optionsStyle:D="floating",dropdownTrigger:he,closeDropdownOnBlur:P,prependPlaceholder:H,allOption:oe,showNonTappableOptions:G,locationSearch:ge,showOptionIcons:ne=!0,showChipIcons:E=!0,showChipImages:Q=!0,showChipRemove:Y=!1,showOptionImages:re=!0,showOptionCounts:xe=!0,showSkipButton:I,showProducts:F,productsLayout:p,productImageFallback:T,autoFocus:oa=!0,onFocus:Be,onBlur:b,value:na,completedParams:We,onChange:$e,onParamsChange:Ze,products:Xe,mapProducts:Ge,onProductSelect:f,onProductAddToCart:C,submitButton:S,resetOnSubmit:O=!0,seeAllResults:N=!1},se){let fe=(0,j.useRef)(null),Re=(0,j.useRef)(null),Te=(0,j.useRef)(null),ra=(0,j.useRef)(()=>{}),le=(0,j.useRef)(null),Ke=(0,j.useRef)(null);(0,j.useEffect)(()=>{let K=fe.current;if(K)return le.current?le.current.setMode(R):le.current=new Fe.ModeController(K,R),()=>{le.current?.destroy(),le.current=null}},[R]);let sa=(0,j.useCallback)(K=>{let be=Ke.current?.current;be&&(be.focus(),(0,Fe.setCursorOffset)(be,K))},[]),{completedParams:fa,suggestionPills:Oe,setActivePill:ha,skipActivePill:Je,segments:g,newParamId:qe,clearNewParamId:la,placeholderText:n,isFocused:m,isDropdownOpen:_e,isActivePillSelected:Ve,isLoading:Le,isReady:Ue,activeIndex:ea,listboxId:ze,handleTextChange:ba,handleCompositionText:Qe,handleKeyDown:De,setFocused:aa,editingParam:da,editingIdentified:ua,editingAnchor:Ye,caretOffset:ca,startEditingParam:c,removeParam:$,handleCaretAfterInput:W,handleCaretMove:ma,replaceEditingRange:M,dropdownProps:Ga,reset:Ca,refreshProducts:Ka,prepareSubmit:qa,getState:_a,recordSubmit:Va}=Oa({onSubmit:K=>ra.current(K),onResult:a,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:v,language:x,currency:k,productId:w,visitorId:u,columns:h,dropdownTrigger:he,optionsPosition:ee,closeDropdownOnBlur:P,prependPlaceholder:H,allOption:oe,showNonTappableOptions:G,locationSearch:ge,showOptionIcons:ne,showOptionImages:re,showOptionCounts:xe,showSkipButton:I,showProducts:F,onFocus:Be,onBlur:b,value:na,completedParams:We,onChange:$e,onParamsChange:Ze,products:Xe,mapProducts:Ge,onProductSelect:f,onProductAddToCart:C,source:"full-sdk",setCursor:sa});(0,j.useEffect)(()=>{if(!qe)return;let K=window.setTimeout(()=>la(),650);return()=>window.clearTimeout(K)},[qe,la]);let St=ea>=0?`${ze}-option-${ea}`:void 0,{inputRef:za,editorProps:Tt,focus:Sa,blur:Ua,getPlainText:Qa}=kt({segments:g,newParamId:qe,editingParam:da,editingIdentified:ua,editingAnchor:Ye,caretOffset:ca,placeholderText:n,hintSuggestions:y==="inline"?[]:Oe,isFocused:m,showChipIcons:E,showChipImages:Q,showChipRemove:Y,removeParam:$,isDropdownOpen:_e,listboxId:ze,activeDescendantId:St,autoFocus:oa,handleTextChange:ba,handleCompositionText:Qe,handleKeyDown:De,handleCaretAfterInput:W,handleCaretMove:ma,startEditingParam:c,replaceEditingRange:M,setFocused:aa});Ke.current=za,(0,j.useLayoutEffect)(()=>{let K=Re.current,be=za.current;if(!K||!be)return;let va=()=>{let ja=K.firstElementChild;if(!ja)return;let Ot=ja.getBoundingClientRect(),Lt=be.getBoundingClientRect();Ot.top>=Lt.bottom-2?K.setAttribute("data-aia-pill-wrapped",""):K.removeAttribute("data-aia-pill-wrapped")};va();let Ya=new ResizeObserver(va);return Ya.observe(be),()=>Ya.disconnect()},[g,Oe.length,Le,za]),(0,j.useEffect)(()=>{let K=Te.current;if(K)return(0,Fe.watchEditorHeight)(K)},[]),(0,j.useImperativeHandle)(se,()=>({focus:Sa,blur:Ua,reset:Ca,refreshProducts:Ka,setMode:K=>le.current?.setMode(K),skipActivePill:Je}),[Sa,Ua,Ca,Ka,Je]);let ga=!!g.length||fa.length>0,wa=(0,j.useCallback)(K=>{if(!ga)return;K&&qa();let be=_a(),va=(0,Fe.buildSubmitResult)(Qa(),be.completedParams,be.skippedParams,{identifiedParams:be.identifiedParams,isReady:be.isReady,customFields:be.customFields});K&&Va(va),t(va),O&&Ca()},[Va,O,ga,qa,_a,t,Ca,Qa]);ra.current=()=>wa(!1);let Pt=N&&!Ga.isInputEmpty&&ga,It=(0,j.useCallback)(()=>wa(!0),[wa]),Et=(0,j.useCallback)(K=>{K.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Sa()},[Sa]),At=y==="inline",Rt=y==="dropdown";return(0,Ae.jsxs)("div",{ref:fe,className:`magicx-aia ${pa.container} ${r??""}`,"data-pill-placement":y,"data-options-position":ee,"data-animations":B?"on":"off","data-aia-options-style":D,"data-mode":pi(R),children:[(0,Ae.jsx)(Aa,{...Ga,showPills:Rt,productsLayout:p,productImageFallback:T,onSeeAllResults:Pt?It:void 0,fullWidth:N}),(0,Ae.jsxs)("div",{className:pa.inputWrapper,"data-aia-input-wrapper":"",onClick:Et,children:[(0,Ae.jsxs)("div",{ref:Te,className:pa.editorArea,"data-aia-editor":"",children:[(0,Ae.jsx)("div",{...Tt,className:pa.input,"data-aia-input":""}),At&&(Le||Oe.length>0)&&(0,Ae.jsx)("span",{ref:Re,className:pa.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ae.jsx)(Ia,{pills:Oe,activePillIndex:0,activeSelected:Ve,onSelectPill:ha,loading:Le})})]}),S===null?null:S===void 0?(0,Ae.jsx)(wt,{disabled:!ga,ready:ga&&Ue,onClick:()=>wa(!0),label:(0,Fe.uiStringsFor)(x).submit}):(0,Ae.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:pa.submitSlot,onClick:K=>{ga&&(K.stopPropagation(),wa(!0))},children:S})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
3786
|
+
`,document.head.appendChild(e)}var bt={submitButton:"aia-submitButton-otz7H"};var Oa=require("react/jsx-runtime");function vt({disabled:e,ready:t,onClick:a,label:i=(0,wt.uiStringsFor)().submit}){return(0,Oa.jsx)("button",{type:"button","data-aia-submit":"",className:bt.submitButton,disabled:e,"data-aia-ready":t?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":i,children:(0,Oa.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Oa.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ne=require("@magicx-eng/ai-autocomplete-vanilla"),O=require("react");var Wa=require("react");function xt(e){let t=(0,Wa.useRef)(e);t.current=e;let a=Object.keys(e??{}).sort().join("\0"),i=(0,Wa.useRef)({key:"",overrides:void 0});if(i.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,v,x)=>{let k=t.current?.[s];return k?k(l,v,x):[]};o[s]=r}i.current={key:a,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:a}}var Ga=require("react");function yt(e){let t=(0,Ga.useRef)(e);t.current=e;let a=(0,Ga.useRef)(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=t.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>t.current?.transform(o)??[],get limit(){return t.current?.limit}});let i=e!==void 0;return{config:i?a.current:void 0,enabled:i}}var kt={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function La({onSubmit:e,onResult:t,onError:a,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,visitorId:k,columns:b=2,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:C,prependPlaceholder:y,allOption:j,showNonTappableOptions:F,locationSearch:D,showOptionIcons:he,showOptionImages:P,showOptionCounts:H,showSkipButton:oe,showProducts:W,productImageFallback:ge="image",showProductVendor:pe=!0,onFocus:A,onBlur:ne,value:ee,completedParams:_,onChange:xe,onParamsChange:T,products:G,mapProducts:c,onProductSelect:I,onProductAddToCart:Fe,source:na,setCursor:Be}){let w=(0,O.useRef)(null),[ra,We]=(0,O.useState)(null),$e=(0,O.useRef)(e);$e.current=e;let Ze=(0,O.useRef)(t);Ze.current=t;let Xe=(0,O.useRef)(a);Xe.current=a;let g=(0,O.useRef)(xe);g.current=xe;let S=(0,O.useRef)(T);S.current=T;let E=(0,O.useRef)(A);E.current=A;let R=(0,O.useRef)(ne);R.current=ne;let N=(0,O.useRef)(Be);N.current=Be;let re=(0,O.useRef)(I);re.current=I;let Te=(0,O.useRef)(Fe);Te.current=Fe;let fe=(0,O.useRef)(k);fe.current=k;let Je=(0,O.useRef)(()=>{let p=fe.current;return typeof p=="function"?p():p}).current,Ge=yt(G),sa=(0,O.useRef)(c);sa.current=c;let se=(0,O.useRef)((p,$)=>{let B=sa.current;return B?B(p,$):p}).current,Ke=c?se:void 0,la=xt(i);(0,O.useEffect)(()=>{if(typeof document>"u")return;let p=new Ne.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,visitorId:Je,optionOverrides:la.overrides,maskCompletedText:o,columns:b,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:C,prependPlaceholder:y,allOption:j,showNonTappableOptions:F,locationSearch:D,showProducts:W,source:na,value:ee,completedParams:_,onSubmit:(...B)=>$e.current?.(...B),onResult:(...B)=>Ze.current?.(...B),onError:(...B)=>Xe.current?.(...B),onChange:(...B)=>g.current?.(...B),onParamsChange:(...B)=>S.current?.(...B),onFocus:()=>E.current?.(),onBlur:()=>R.current?.(),onProductSelect:B=>re.current?.(B),onProductAddToCart:B=>Te.current?.(B),setCursor:B=>N.current?.(B),products:Ge.config,mapProducts:Ke});w.current=p,We(p.getState());let $=p.subscribe(B=>We(B));return()=>{$(),p.destroy(),w.current===p&&(w.current=null)}},[]),(0,O.useEffect)(()=>{ee!==void 0&&w.current?.setValue(ee)},[ee]),(0,O.useEffect)(()=>{_!==void 0&&w.current?.setCompletedParams(_)},[_]);let ba=JSON.stringify(s??null),Re;try{Re=JSON.stringify(r??null)}catch{Re="[unstringifiable]"}(0,O.useEffect)(()=>{w.current?.update({apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,optionOverrides:la.overrides,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:C,prependPlaceholder:y,allOption:j,showNonTappableOptions:F,locationSearch:D,showProducts:W})},[ba,Re,l,v?.code,v?.rate,v?.country,x,la.key,u,h,C,y,j,F,D,W]);let ua=(0,O.useRef)(!1);(0,O.useEffect)(()=>{if(!ua.current){ua.current=!0;return}w.current?.update({products:Ge.config})},[Ge.enabled]),(0,O.useEffect)(()=>{w.current?.update({mapProducts:Ke})},[Ke]);let ea=(0,O.useRef)(null);ea.current===null&&(ea.current={handleTextChange:p=>w.current?.handleTextChange(p),handleCompositionText:p=>w.current?.handleCompositionText(p),handleKeyDown:p=>{let $="nativeEvent"in p?p.nativeEvent:p;w.current?.handleKeyDown($)},setFocused:p=>w.current?.setFocused(p),startEditingParam:p=>w.current?.startEditingParam(p),removeParam:p=>w.current?.removeParam(p)??!1,exitEditMode:()=>w.current?.exitEditMode(),handleCaretAfterInput:p=>w.current?.handleCaretAfterInput(p),handleCaretMove:p=>w.current?.handleCaretMove(p),replaceEditingRange:p=>w.current?.replaceEditingRange(p)??!1,setActivePill:p=>w.current?.setActivePill(p),skipActivePill:()=>w.current?.skipActivePill(),removeLastParam:()=>w.current?.removeLastParam(),clearNewParamId:()=>w.current?.clearNewParamId(),reset:()=>w.current?.reset(),refreshProducts:()=>w.current?.refreshProducts(),prepareSubmit:()=>w.current?.prepareSubmit(),getState:()=>w.current?.getState()??kt,recordSubmit:p=>w.current?.recordSubmit(p),selectOption:(p,$)=>w.current?.selectOption(p,$),selectProduct:p=>w.current?.selectProduct(p),addProductToCart:p=>{let $=w.current;return!$||!Te.current?Promise.resolve():$.addProductToCart(p)},setActiveDropdownIndex:p=>w.current?.setActiveDropdownIndex(p),clearHighlight:p=>w.current?.clearHighlight(p),showPreviousMonth:()=>w.current?.showPreviousMonth(),showNextMonth:()=>w.current?.showNextMonth(),setTime:p=>w.current?.setTime(p),commitTime:()=>w.current?.commitTime(),toggleMultiSelectOption:p=>w.current?.toggleMultiSelectOption(p),commitMultiSelect:()=>w.current?.commitMultiSelect(),setLocationQuery:p=>w.current?.setLocationQuery(p),moveLocationHighlight:p=>w.current?.moveLocationHighlight(p),commitLocation:p=>w.current?.commitLocation(p),setLocationFieldFocused:p=>w.current?.setLocationFieldFocused(p),handleFocus:()=>w.current?.setFocused(!0),handleBlur:()=>w.current?.setFocused(!1)});let f=ea.current,qe=(0,O.useCallback)(p=>{let $=p.target.value,ga=$.length>0&&!p.nativeEvent?.isComposing&&$[0]!==$[0].toUpperCase()?$[0].toUpperCase()+$.slice(1):$;w.current?.handleTextChange(ga)},[]),da=(0,O.useCallback)(p=>{w.current?.handleKeyDown(p.nativeEvent)},[]),n=w.current,m=ra??kt,_e=ee!==void 0?ee:m.text,Ve=_!==void 0?_:m.completedParams,Oe=m.actionableSuggestions,Ue=Oe[0],aa=(0,O.useMemo)(()=>(0,Ne.withoutTraditionalAutocomplete)(Oe),[Oe]),Le=n?.listboxId??"",wa=m.activeDropdownIndex>=0&&n?`${Le}-option-${m.activeDropdownIndex}`:void 0,Qe=m.editingParam,ze=m.editingIdentified,ta=Qe?(0,Ne.editingSuggestion)(Qe):ze?{parameter:ze.parameter,text:(0,Ne.identifiedParamLabel)(ze.parameter),required:!0,options:[]}:null,ca=m.dropdownSuggestion??ta??Ue,ma=ta?[ta]:Oe,Ye=(0,Ne.dateSelectionFor)(m),pa=!n||m.dropdownLoading;return{completedParams:Ve,multiSelectView:m.multiSelectView,toggleMultiSelectOption:f.toggleMultiSelectOption,commitMultiSelect:f.commitMultiSelect,skippedParams:m.skippedParams,identifiedParams:m.identifiedParams,suggestionPills:aa,setActivePill:f.setActivePill,skipActivePill:f.skipActivePill,removeLastParam:f.removeLastParam,segments:m.segments,newParamId:m.newParamId,clearNewParamId:f.clearNewParamId,suggestions:m.suggestions,activeIndex:m.activeDropdownIndex,isReady:m.isReady,isLoading:pa,isFocused:m.isFocused,isDropdownOpen:m.isDropdownOpen,isActivePillSelected:m.isActivePillSelected,placeholderText:m.placeholderText,listboxId:Le,error:m.error,products:m.products,customFields:m.customFields,selectProduct:f.selectProduct,addProductToCart:f.addProductToCart,handleTextChange:f.handleTextChange,handleCompositionText:f.handleCompositionText,handleKeyDown:f.handleKeyDown,setFocused:f.setFocused,editingParam:Qe,editingIdentified:ze,editingAnchor:m.editingAnchor,caretOffset:m.caretOffset,startEditingParam:f.startEditingParam,removeParam:f.removeParam,exitEditMode:f.exitEditMode,handleCaretAfterInput:f.handleCaretAfterInput,handleCaretMove:f.handleCaretMove,replaceEditingRange:f.replaceEditingRange,inputProps:{value:_e,placeholder:m.placeholderText||void 0,onChange:qe,onKeyDown:da,onFocus:f.handleFocus,onBlur:f.handleBlur,role:"combobox","aria-expanded":m.isDropdownOpen,"aria-activedescendant":wa,"aria-autocomplete":"list","aria-controls":Le},reset:f.reset,refreshProducts:f.refreshProducts,prepareSubmit:f.prepareSubmit,getState:f.getState,recordSubmit:f.recordSubmit,dropdownProps:{suggestions:ca?[{...ca,options:m.dropdownOptions}]:[],activeIndex:m.activeDropdownIndex,onSelect:f.selectOption,onHighlight:f.setActiveDropdownIndex,onUnhighlight:f.clearHighlight,isOpen:m.isDropdownOpen,id:Le,pills:ma,activeSelected:m.isActivePillSelected,onPillClick:f.setActivePill,onSkip:f.skipActivePill,showSkipButton:(oe??!0)&&!Qe&&!ze,showOptionIcons:he??!0,showOptionImages:P??!0,showOptionCounts:H??!0,skipDisabled:m.inSelectionAnimation,isLoading:pa,skeletonExiting:m.skeletonExiting,isInputEmpty:_e.trim().length===0,language:l,products:m.products,productImageFallback:ge,showProductVendor:pe,onProductSelect:f.selectProduct,onProductAddToCart:Fe?f.addProductToCart:void 0,onProductFocusChange:f.setFocused,formatType:m.activeFormatType,dateView:m.dateView,selectedDateIso:Ye.selectedIso,selectedDateRange:Ye.selectedRange,dateRangeStart:Ye.rangeStart,dateReferences:Ye.references,onPreviousMonth:f.showPreviousMonth,onNextMonth:f.showNextMonth,timeView:m.timeView,multiSelectView:m.dropdownMultiSelect,onMultiSelectCommit:f.commitMultiSelect,onTimeChange:f.setTime,onTimeCommit:f.commitTime,locationView:m.locationView,isReediting:m.editingParam!=null,onLocationQuery:f.setLocationQuery,onLocationMove:f.moveLocationHighlight,onLocationCommit:f.commitLocation,onLocationFocusChange:f.setLocationFieldFocused,isFocused:m.isFocused||m.locationFieldFocused,optionsPosition:h??"below"}}}var Q=require("@magicx-eng/ai-autocomplete-vanilla"),z=require("react"),za;function pi(){if(za!==void 0)return za;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),za=e.contentEditable==="plaintext-only",za}function Ct(e){let{segments:t,showChipIcons:a=!0,showChipImages:i=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:v,editingAnchor:x,caretOffset:k,placeholderText:b,hintSuggestions:u,isFocused:h,isDropdownOpen:C,listboxId:y,activeDescendantId:j,autoFocus:F,handleTextChange:D,handleCompositionText:he,handleKeyDown:P,handleCaretAfterInput:H,handleCaretMove:oe,startEditingParam:W,replaceEditingRange:ge,setFocused:pe}=e,A=(0,z.useRef)(null),ne=(0,z.useRef)(!1),ee=(0,z.useRef)(""),_=(0,z.useRef)(""),xe=(0,z.useRef)(null),T=(0,z.useRef)(0);xe.current=k,(0,z.useEffect)(()=>{if(!F)return;let g=A.current;if(!g)return;document.activeElement===g?pe(!0):g.focus();let S=g.ownerDocument??document,E=S.getSelection(),R=E&&E.rangeCount>0&&g.contains(E.anchorNode);if(E&&!R){let N=S.createRange();N.selectNodeContents(g),N.collapse(!0),E.removeAllRanges(),E.addRange(N)}},[F,pe]),(0,z.useEffect)(()=>{let g=A.current;if(!g)return;let S=g.ownerDocument??document,E=()=>{let R=S.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!g.contains(R.anchorNode))return;let N=R.anchorNode,re=N.nodeType===Node.ELEMENT_NODE?N:N.parentElement,fe=(R.isCollapsed?re?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Je=l?.id??v?.id??null;if(fe&&fe!==Je){W(fe);return}performance.now()-T.current<50||oe((0,Q.getCursorOffset)(g))};return S.addEventListener("selectionchange",E),()=>S.removeEventListener("selectionchange",E)},[l,v,W,oe]),(0,z.useEffect)(()=>{let g=A.current;if(!g)return;let S=E=>{let R=(0,Q.chipIdFromTap)(g,E.target);R&&(W(R),(0,Q.keepCaretOnChip)(g,R))};return g.addEventListener("click",S),()=>g.removeEventListener("click",S)},[W]),(0,z.useEffect)(()=>{let g=A.current;if(!(!g||!s||!o))return(0,Q.attachChipRemove)(g,s)},[s,o]),(0,z.useLayoutEffect)(()=>{let g=A.current;g&&(0,Q.renderEditableContent)({input:g,segments:t,newParamId:r,editingParamId:l?.id??null,placeholderText:b??"",isFocused:h,showChipIcons:a,showChipImages:i,showChipRemove:o,hintOptions:(0,Q.startingHintOptions)(u??[])})},[t,r,l,b,u,h,a,i,o]),(0,z.useEffect)(()=>{let g=A.current;return()=>{g&&(0,Q.cancelStartingHint)(g)}},[]),(0,z.useLayoutEffect)(()=>{let g=ee.current,S=r??"";if(ee.current=S,!S||S===g)return;let E=A.current;if(!E)return;E.focus();let R=xe.current??(0,Q.plainTextLength)(E);(0,Q.setCursorOffset)(E,R)},[r]),(0,z.useLayoutEffect)(()=>{let g=_.current,S=l?.id??"";if(_.current=S,!S||S===g||x==null)return;let E=A.current;E&&(0,Q.setCursorOffset)(E,x)},[l,x]);let G=(0,z.useCallback)(()=>{let g=A.current;if(!g)return;let S=(0,Q.extractPlainText)(g),R=S.length>0&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;if(ne.current){he(R);return}D(R)},[D,he]),c=(0,z.useCallback)(()=>{T.current=performance.now(),G();let g=A.current;g&&H((0,Q.getCursorOffset)(g))},[G,H]);(0,z.useEffect)(()=>{let g=A.current;if(!g)return;let S=E=>{let R=E,N=R.inputType;if(N==="insertParagraph"||N==="insertLineBreak"||N==="insertFromDrop"){E.preventDefault();return}if(N.startsWith("insert")||N.startsWith("delete")){let re=N.startsWith("delete")?"":R.data??"";ge(re)&&E.preventDefault()}};return g.addEventListener("beforeinput",S),()=>g.removeEventListener("beforeinput",S)},[ge]);let I=(0,z.useCallback)(()=>{ne.current=!0,A.current?.setAttribute("data-aia-composing","true")},[]),Fe=(0,z.useCallback)(()=>{ne.current=!1,A.current?.removeAttribute("data-aia-composing"),G()},[G]),na=(0,z.useCallback)(g=>{g.preventDefault();let S=A.current;if(!S)return;let E=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!E)return;let R=S.ownerDocument??document,N=R.getSelection();if(!N||N.rangeCount===0)return;let re=N.getRangeAt(0);if(!S.contains(re.startContainer))return;re.deleteContents();let Te=R.createTextNode(E);re.insertNode(Te),re.setStartAfter(Te),re.collapse(!0),N.removeAllRanges(),N.addRange(re),G()},[G]),Be=(0,z.useCallback)(g=>P(g),[P]),w=(0,z.useCallback)(()=>pe(!0),[pe]),ra=(0,z.useCallback)(()=>pe(!1),[pe]),We=(0,z.useCallback)(()=>A.current?.focus(),[]),$e=(0,z.useCallback)(()=>A.current?.blur(),[]),Ze=(0,z.useCallback)(()=>{let g=A.current;return g?(0,Q.extractPlainText)(g):""},[]),Xe=pi()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:Xe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":y,"aria-expanded":C,"aria-activedescendant":j,spellCheck:!0,enterKeyHint:"send",onInput:c,onKeyDown:Be,onCompositionStart:I,onCompositionEnd:Fe,onPaste:na,onFocus:w,onBlur:ra},getPlainText:Ze,focus:We,blur:$e}}var Ae=require("react/jsx-runtime");function hi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var St=(0,Y.forwardRef)(function({onSubmit:t,onResult:a,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:v,language:x,currency:k,productId:b,visitorId:u,columns:h,pillPlacement:C="dropdown",mode:y="auto",optionsPosition:j="below",animations:F=!0,optionsStyle:D="floating",dropdownTrigger:he,closeDropdownOnBlur:P,prependPlaceholder:H,allOption:oe,showNonTappableOptions:W,locationSearch:ge,showOptionIcons:pe=!0,showChipIcons:A=!0,showChipImages:ne=!0,showChipRemove:ee=!1,showOptionImages:_=!0,showOptionCounts:xe=!0,showSkipButton:T,showProducts:G,productsLayout:c,productImageFallback:I,showProductVendor:Fe,autoFocus:na=!0,onFocus:Be,onBlur:w,value:ra,completedParams:We,onChange:$e,onParamsChange:Ze,products:Xe,mapProducts:g,onProductSelect:S,onProductAddToCart:E,submitButton:R,resetOnSubmit:N=!0,seeAllResults:re=!1},Te){let fe=(0,Y.useRef)(null),Je=(0,Y.useRef)(null),Ge=(0,Y.useRef)(null),sa=(0,Y.useRef)(()=>{}),se=(0,Y.useRef)(null),Ke=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let K=fe.current;if(K)return se.current?se.current.setMode(y):se.current=new He.ModeController(K,y),()=>{se.current?.destroy(),se.current=null}},[y]);let la=(0,Y.useCallback)(K=>{let be=Ke.current?.current;be&&(be.focus(),(0,He.setCursorOffset)(be,K))},[]),{completedParams:ba,suggestionPills:Re,setActivePill:ua,skipActivePill:ea,segments:f,newParamId:qe,clearNewParamId:da,placeholderText:n,isFocused:m,isDropdownOpen:_e,isActivePillSelected:Ve,isLoading:Oe,isReady:Ue,activeIndex:aa,listboxId:Le,handleTextChange:wa,handleCompositionText:Qe,handleKeyDown:ze,setFocused:ta,editingParam:ca,editingIdentified:ma,editingAnchor:Ye,caretOffset:pa,startEditingParam:p,removeParam:$,handleCaretAfterInput:B,handleCaretMove:ga,replaceEditingRange:M,dropdownProps:Ka,reset:Sa,refreshProducts:qa,prepareSubmit:_a,getState:Va,recordSubmit:Ua}=La({onSubmit:K=>sa.current(K),onResult:a,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:v,language:x,currency:k,productId:b,visitorId:u,columns:h,dropdownTrigger:he,optionsPosition:j,closeDropdownOnBlur:P,prependPlaceholder:H,allOption:oe,showNonTappableOptions:W,locationSearch:ge,showOptionIcons:pe,showOptionImages:_,showOptionCounts:xe,showSkipButton:T,showProducts:G,onFocus:Be,onBlur:w,value:ra,completedParams:We,onChange:$e,onParamsChange:Ze,products:Xe,mapProducts:g,onProductSelect:S,onProductAddToCart:E,source:"full-sdk",setCursor:la});(0,Y.useEffect)(()=>{if(!qe)return;let K=window.setTimeout(()=>da(),650);return()=>window.clearTimeout(K)},[qe,da]);let Tt=aa>=0?`${Le}-option-${aa}`:void 0,{inputRef:Da,editorProps:Pt,focus:Ta,blur:Qa,getPlainText:Ya}=Ct({segments:f,newParamId:qe,editingParam:ca,editingIdentified:ma,editingAnchor:Ye,caretOffset:pa,placeholderText:n,hintSuggestions:C==="inline"?[]:Re,isFocused:m,showChipIcons:A,showChipImages:ne,showChipRemove:ee,removeParam:$,isDropdownOpen:_e,listboxId:Le,activeDescendantId:Tt,autoFocus:na,handleTextChange:wa,handleCompositionText:Qe,handleKeyDown:ze,handleCaretAfterInput:B,handleCaretMove:ga,startEditingParam:p,replaceEditingRange:M,setFocused:ta});Ke.current=Da,(0,Y.useLayoutEffect)(()=>{let K=Je.current,be=Da.current;if(!K||!be)return;let xa=()=>{let $a=K.firstElementChild;if(!$a)return;let Lt=$a.getBoundingClientRect(),zt=be.getBoundingClientRect();Lt.top>=zt.bottom-2?K.setAttribute("data-aia-pill-wrapped",""):K.removeAttribute("data-aia-pill-wrapped")};xa();let ja=new ResizeObserver(xa);return ja.observe(be),()=>ja.disconnect()},[f,Re.length,Oe,Da]),(0,Y.useEffect)(()=>{let K=Ge.current;if(K)return(0,He.watchEditorHeight)(K)},[]),(0,Y.useImperativeHandle)(Te,()=>({focus:Ta,blur:Qa,reset:Sa,refreshProducts:qa,setMode:K=>se.current?.setMode(K),skipActivePill:ea}),[Ta,Qa,Sa,qa,ea]);let fa=!!f.length||ba.length>0,va=(0,Y.useCallback)(K=>{if(!fa)return;K&&_a();let be=Va(),xa=(0,He.buildSubmitResult)(Ya(),be.completedParams,be.skippedParams,{identifiedParams:be.identifiedParams,isReady:be.isReady,customFields:be.customFields});K&&Ua(xa),t(xa),N&&Sa()},[Ua,N,fa,_a,Va,t,Sa,Ya]);sa.current=()=>va(!1);let It=re&&!Ka.isInputEmpty&&fa,Et=(0,Y.useCallback)(()=>va(!0),[va]),At=(0,Y.useCallback)(K=>{K.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Ta()},[Ta]),Rt=C==="inline",Ot=C==="dropdown";return(0,Ae.jsxs)("div",{ref:fe,className:`magicx-aia ${ha.container} ${r??""}`,"data-pill-placement":C,"data-options-position":j,"data-animations":F?"on":"off","data-aia-options-style":D,"data-mode":hi(y),children:[(0,Ae.jsx)(Ra,{...Ka,showPills:Ot,productsLayout:c,productImageFallback:I,showProductVendor:Fe,onSeeAllResults:It?Et:void 0,fullWidth:re}),(0,Ae.jsxs)("div",{className:ha.inputWrapper,"data-aia-input-wrapper":"",onClick:At,children:[(0,Ae.jsxs)("div",{ref:Ge,className:ha.editorArea,"data-aia-editor":"",children:[(0,Ae.jsx)("div",{...Pt,className:ha.input,"data-aia-input":""}),Rt&&(Oe||Re.length>0)&&(0,Ae.jsx)("span",{ref:Je,className:ha.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ae.jsx)(Ea,{pills:Re,activePillIndex:0,activeSelected:Ve,onSelectPill:ua,loading:Oe})})]}),R===null?null:R===void 0?(0,Ae.jsx)(vt,{disabled:!fa,ready:fa&&Ue,onClick:()=>va(!0),label:(0,He.uiStringsFor)(x).submit}):(0,Ae.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:ha.submitSlot,onClick:K=>{fa&&(K.stopPropagation(),va(!0))},children:R})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
3787
3787
|
//# sourceMappingURL=index.js.map
|