@magicx-eng/ai-autocomplete-react 0.52.0 → 0.53.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 +2 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +315 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +315 -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 Ot=Object.defineProperty;var Pa=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var Ea=Object.prototype.hasOwnProperty;var Aa=(e,a)=>{for(var t in a)Ot(e,t,{get:a[t],enumerable:!0})},Ra=(e,a,t,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of Ia(a))!Ea.call(e,o)&&o!==t&&Ot(e,o,{get:()=>a[o],enumerable:!(i=Pa(a,o))||i.enumerable});return e};var Oa=e=>Ra(Ot({},"__esModule",{value:!0}),e);var ni={};Aa(ni,{AIAutocomplete:()=>wa,AIAutocompleteDropdown:()=>Tt,DATE_RANGE_META_END:()=>l.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>l.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>l.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>l.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>l.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>l.TIME_META_KEY,WEEKDAY_LABELS:()=>l.WEEKDAY_LABELS,buildSubmitResult:()=>l.buildSubmitResult,cellDay:()=>l.cellDay,cellIso:()=>l.cellIso,dateCellMarks:()=>l.dateCellMarks,formatDate:()=>l.formatDate,formatDateRange:()=>l.formatDateRange,formatOptionCount:()=>l.formatOptionCount,formatPlace:()=>l.formatPlace,formatTime:()=>l.formatTime,isoDate:()=>l.isoDate,monthLabel:()=>l.monthLabel,optionCountLabel:()=>l.optionCountLabel,optionHasImage:()=>l.optionHasImage,optionImageSources:()=>l.optionImageSources,optionImageSrc:()=>l.optionImageSrc,optionLabel:()=>l.optionLabel,optionsShowLeadingVisuals:()=>l.optionsShowLeadingVisuals,parseDate:()=>l.parseDate,parseLooseDate:()=>l.parseLooseDate,parseLooseDateRange:()=>l.parseLooseDateRange,parseTime:()=>l.parseTime,productFromMatchedItem:()=>l.productFromMatchedItem,productImageSources:()=>l.productImageSources,productsFromCustomFields:()=>l.productsFromCustomFields,sanitizeOptionIconSvg:()=>l.sanitizeOptionIconSvg,selectedRangeFor:()=>l.selectedRangeFor,useAIAutocomplete:()=>It,visibleDateRange:()=>l.visibleDateRange,withSkippedParams:()=>l.withSkippedParams});module.exports=Oa(ni);var l=require("@magicx-eng/ai-autocomplete-vanilla");var U=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
|
|
@@ -346,7 +346,7 @@
|
|
|
346
346
|
transition: none;
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
|
-
`,document.head.appendChild(e)}var
|
|
349
|
+
`,document.head.appendChild(e)}var rt={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 D=require("@magicx-eng/ai-autocomplete-vanilla"),V=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
350
350
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
351
351
|
* Consumer CSS always wins without !important.
|
|
352
352
|
*
|
|
@@ -1032,6 +1032,71 @@
|
|
|
1032
1032
|
opacity: 0.45;
|
|
1033
1033
|
}
|
|
1034
1034
|
/* End floating options box. */
|
|
1035
|
+
|
|
1036
|
+
/* Classic options box (optionsStyle: "classic"): the panel as it was
|
|
1037
|
+
before the floating box: it unfolds out of the input with a stroke, at
|
|
1038
|
+
full size. Generated from the values the floating-box changes replaced;
|
|
1039
|
+
keep in step across the vanilla, React and Angular copies. */
|
|
1040
|
+
/* The attribute may sit on the themed root itself (Tier 1) or on an ancestor
|
|
1041
|
+
of it: a standalone dropdown given \`mode\` carries \`.magicx-aia\` on its own
|
|
1042
|
+
root, below the element the consumer marks classic. Both forms are zero
|
|
1043
|
+
specificity and come after the floating tokens, so they win on order while
|
|
1044
|
+
a consumer's own value still beats them. */
|
|
1045
|
+
:where(.magicx-aia[data-aia-options-style="classic"]),
|
|
1046
|
+
:where(.magicx-aia[data-aia-options-style="classic"][data-mode="light"]),
|
|
1047
|
+
:where([data-aia-options-style="classic"] .magicx-aia),
|
|
1048
|
+
:where([data-aia-options-style="classic"] .magicx-aia[data-mode="light"]) {
|
|
1049
|
+
--aia-dropdown-border: var(--aia-primitive-neutral-900-a50);
|
|
1050
|
+
--aia-option-font-size: 16px;
|
|
1051
|
+
}
|
|
1052
|
+
:where(.magicx-aia[data-aia-options-style="classic"][data-mode="dark"]),
|
|
1053
|
+
:where([data-aia-options-style="classic"] .magicx-aia[data-mode="dark"]) {
|
|
1054
|
+
--aia-dropdown-border: var(--aia-primitive-neutral-400-a50);
|
|
1055
|
+
--aia-option-font-size: 16px;
|
|
1056
|
+
}
|
|
1057
|
+
:where(.magicx-aia[data-aia-options-style="classic"][data-options-position="above"])
|
|
1058
|
+
[data-aia-dropdown],
|
|
1059
|
+
:where([data-aia-options-style="classic"]) [data-aia-dropdown][data-options-position="above"] {
|
|
1060
|
+
transform-origin: 50% 100%;
|
|
1061
|
+
}
|
|
1062
|
+
:where([data-aia-options-style="classic"]) [data-aia-dropdown] [data-aia-pillbar] [data-aia-pill] {
|
|
1063
|
+
padding-block: 5px;
|
|
1064
|
+
}
|
|
1065
|
+
:where([data-aia-options-style="classic"])
|
|
1066
|
+
[data-aia-dropdown][aria-multiselectable="true"]
|
|
1067
|
+
.aia-grid[data-scroll] {
|
|
1068
|
+
max-height: min(var(--aia-grid-max-height, 120px), calc(3 * var(--aia-option-row-height, 37px)));
|
|
1069
|
+
}
|
|
1070
|
+
:where([data-aia-options-style="classic"])
|
|
1071
|
+
[data-aia-dropdown][data-aia-fit][aria-multiselectable="true"]
|
|
1072
|
+
.aia-grid[data-scroll] {
|
|
1073
|
+
min-height: var(--aia-option-row-height, 37px);
|
|
1074
|
+
max-height: min(var(--aia-grid-max-height, 120px), calc(3 * var(--aia-option-row-height, 37px)));
|
|
1075
|
+
}
|
|
1076
|
+
:where([data-aia-options-style="classic"])
|
|
1077
|
+
[data-aia-dropdown]
|
|
1078
|
+
[data-aia-pillbar]
|
|
1079
|
+
[data-aia-pill][data-aia-pill-active] {
|
|
1080
|
+
font-size: var(--aia-param-label-font-size, 13.5px);
|
|
1081
|
+
}
|
|
1082
|
+
:where([data-aia-options-style="classic"]) [data-aia-dropdown] [data-aia-pillbar] [data-aia-skip] {
|
|
1083
|
+
padding-inline: 8px;
|
|
1084
|
+
font-size: var(--aia-skip-font-size, 13.5px);
|
|
1085
|
+
}
|
|
1086
|
+
:where([data-aia-options-style="classic"])
|
|
1087
|
+
[data-aia-dropdown]
|
|
1088
|
+
[data-aia-pillbar]
|
|
1089
|
+
[data-aia-pill-scroll]
|
|
1090
|
+
+ [data-aia-skip]::before {
|
|
1091
|
+
margin-inline-end: 8px;
|
|
1092
|
+
margin-inline-start: -4px;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
/* Classic options box: full-size rows. On the element carrying the
|
|
1096
|
+
attribute, at zero specificity, so a value the consumer sets wins. */
|
|
1097
|
+
:where([data-aia-options-style="classic"]) {
|
|
1098
|
+
--aia-option-row-height: 37px;
|
|
1099
|
+
}
|
|
1035
1100
|
`,document.head.appendChild(e)}if(typeof document<"u"&&!document.getElementById("ac-style-3819c762")){let e=document.createElement("style");e.id="ac-style-3819c762",e.textContent=`.aia-dropdown-yz2KC {
|
|
1036
1101
|
position: absolute;
|
|
1037
1102
|
left: 0;
|
|
@@ -1402,7 +1467,49 @@
|
|
|
1402
1467
|
/* biome-ignore lint/complexity/noImportantStyles: a row's own pointer-events: auto must not make the leaving copy catch taps */
|
|
1403
1468
|
pointer-events: none !important;
|
|
1404
1469
|
}
|
|
1405
|
-
|
|
1470
|
+
|
|
1471
|
+
/* Classic options box (optionsStyle: "classic"): the panel as it was
|
|
1472
|
+
before the floating box: it unfolds out of the input with a stroke, at
|
|
1473
|
+
full size. Generated from the values the floating-box changes replaced;
|
|
1474
|
+
keep in step across the vanilla, React and Angular copies. */
|
|
1475
|
+
:where([data-aia-options-style="classic"]) .aia-dropdown-yz2KC {
|
|
1476
|
+
filter: none;
|
|
1477
|
+
/* Closed, the panel is only squashed (scaleY), which leaves it in hit
|
|
1478
|
+
testing and the tab order. Hidden once the 400ms fade has run, as the
|
|
1479
|
+
floating box is; the open rule shows it again at once. */
|
|
1480
|
+
visibility: hidden;
|
|
1481
|
+
transition:
|
|
1482
|
+
opacity 400ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
1483
|
+
transform 0s 400ms,
|
|
1484
|
+
visibility 0s linear 400ms;
|
|
1485
|
+
border: 1px solid var(--aia-dropdown-border, rgba(231, 231, 231, 0.5));
|
|
1486
|
+
transform-origin: 50% 0;
|
|
1487
|
+
transform: scaleY(var(--aia-dropdown-reveal-scale, 0.02));
|
|
1488
|
+
}
|
|
1489
|
+
:where([data-aia-options-style="classic"]) .aia-visible-QCoXj {
|
|
1490
|
+
filter: none;
|
|
1491
|
+
visibility: visible;
|
|
1492
|
+
transition:
|
|
1493
|
+
opacity 100ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
1494
|
+
transform 320ms cubic-bezier(0.22, 1.28, 0.36, 1),
|
|
1495
|
+
visibility 0s;
|
|
1496
|
+
transform: scaleY(1);
|
|
1497
|
+
}
|
|
1498
|
+
:where([data-aia-options-style="classic"]) .aia-skip-7-olS {
|
|
1499
|
+
padding: 5px 8px;
|
|
1500
|
+
border-radius: 6px;
|
|
1501
|
+
font-size: var(--aia-skip-font-size, 13.5px);
|
|
1502
|
+
line-height: 18px;
|
|
1503
|
+
}
|
|
1504
|
+
/* Reduced motion still wins over the classic transitions above. */
|
|
1505
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1506
|
+
:where([data-aia-options-style="classic"]) .aia-dropdown-yz2KC,
|
|
1507
|
+
:where([data-aia-options-style="classic"]) .aia-visible-QCoXj {
|
|
1508
|
+
transition-duration: 0s;
|
|
1509
|
+
transition-delay: 0s;
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
`,document.head.appendChild(e)}var Me={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q",multiDone:"aia-multiDone-y12U7"};var Z=require("@magicx-eng/ai-autocomplete-vanilla"),Vt=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) ---
|
|
1406
1513
|
|
|
1407
1514
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1408
1515
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1589,7 +1696,7 @@
|
|
|
1589
1696
|
opacity: 0.8;
|
|
1590
1697
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1591
1698
|
}
|
|
1592
|
-
`,document.head.appendChild(e)}var
|
|
1699
|
+
`,document.head.appendChild(e)}var $={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var be=require("react/jsx-runtime"),La=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ut({options:e,activeIndex:a,listboxId:t,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:d,onPreviousMonth:m,onNextMonth:v}){let k=(0,Z.isoDate)(new Date),f=(0,Z.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,Z.cellIso)(e[a]),selected:o.selectedRange,floor:o.floor});return(0,be.jsxs)("div",{className:$.datepicker,"data-aia-datepicker":"",children:[(0,be.jsxs)("div",{className:$.header,children:[(0,be.jsx)("button",{type:"button",tabIndex:-1,className:$.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:m,children:"\u2039"}),(0,be.jsx)("span",{className:$.month,"data-aia-date-month":"","aria-live":"polite",children:(0,Z.monthLabel)(i)}),(0,be.jsx)("button",{type:"button",tabIndex:-1,className:$.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:v,children:"\u203A"})]}),(0,be.jsx)("div",{className:$.weekdays,"aria-hidden":"true",children:Z.WEEKDAY_LABELS.map((p,u)=>(0,be.jsx)("span",{className:$.weekday,children:p},La[u]))}),(0,be.jsx)("div",{className:$.grid,"data-aia-date-grid":"",children:e.map((p,u)=>(0,be.jsx)(za,{option:p,id:`${t}-option-${u}`,index:u,isHighlighted:u===a&&p.is_tappable,isToday:(0,Z.cellIso)(p)===k,isPast:(0,Z.isDimmedDay)((0,Z.cellIso)(p),k,o.floor),marks:(0,Z.dateCellMarks)((0,Z.cellIso)(p),{selectedIso:o.selectedIso,range:f}),onSelect:s,onHighlight:r,onUnhighlight:d},(0,Z.cellIso)(p)??`pad-${u}`))})]})}function za({option:e,id:a,index:t,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:d,onHighlight:m,onUnhighlight:v}){let[k,f]=(0,Vt.useState)(!1),p=(0,Z.cellDay)(e);if(p==null)return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${$.cell} ${$.blank}`});let u=()=>{f(!0),d(e),setTimeout(()=>f(!1),170)},x=[$.cell,$.day,s?$.past:"",i?$.highlighted:"",o?$.today:"",r.inRange?$.inRange:"",r.selected?$.selected:"",k?$.pressed:""].filter(Boolean).join(" ");return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:x,onClick:u,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),u())},onMouseEnter:()=>m(t),onMouseLeave:v?()=>v(t):void 0,children:(0,be.jsx)("span",{className:$.number,children:p})})}var Je=require("@magicx-eng/ai-autocomplete-vanilla"),yt=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 {
|
|
1593
1700
|
display: flex;
|
|
1594
1701
|
flex-wrap: wrap;
|
|
1595
1702
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1629,7 +1736,7 @@
|
|
|
1629
1736
|
.aia-cluster[data-justify="around"] {
|
|
1630
1737
|
justify-content: space-around;
|
|
1631
1738
|
}
|
|
1632
|
-
`,document.head.appendChild(e)}var
|
|
1739
|
+
`,document.head.appendChild(e)}var Lt=require("react/jsx-runtime");function ft({gap:e,align:a="center",justify:t="start",noWrap:i=!1,inline:o=!1,className:s,children:r,...d}){let m=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":i||void 0,"data-inline":o||void 0,style:m,...d};return o?(0,Lt.jsx)("span",{...v,children:r}):(0,Lt.jsx)("div",{...v,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
|
|
1633
1740
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1634
1741
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1635
1742
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -1776,7 +1883,7 @@
|
|
|
1776
1883
|
justify-content: flex-end;
|
|
1777
1884
|
}
|
|
1778
1885
|
}
|
|
1779
|
-
`,document.head.appendChild(e)}var
|
|
1886
|
+
`,document.head.appendChild(e)}var _e={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 Ne=require("react/jsx-runtime");function Yt({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,Je.uiStringsFor)()}){let{key:i,hint:o}=(0,Je.getFooterHint)(e,a,t),[s,r]=(0,yt.useState)(Je.ATTRIBUTION_URL);return(0,yt.useEffect)(()=>{r((0,Je.buildAttributionUrl)())},[]),(0,Ne.jsx)("footer",{className:_e.footer,"data-aia-footer":"",children:(0,Ne.jsxs)(ft,{justify:"between",noWrap:!0,className:_e.row,children:[(0,Ne.jsxs)(ft,{gap:"5px",className:_e.hintGroup,children:[(0,Ne.jsx)("kbd",{className:_e.key,children:i}),(0,Ne.jsx)("span",{className:_e.hint,children:o})]}),(0,Ne.jsxs)("a",{className:_e.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,Ne.jsx)("span",{className:_e.brand,children:"AI"}),(0,Ne.jsx)("span",{className:_e.badge,children:"Autocomplete"})]})]})})}var ne=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
|
|
1780
1887
|
Angular copy). The three are kept identical by
|
|
1781
1888
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
1782
1889
|
.aia-location-6-fsr {
|
|
@@ -1910,7 +2017,7 @@
|
|
|
1910
2017
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
1911
2018
|
width: 60%;
|
|
1912
2019
|
}
|
|
1913
|
-
`,document.head.appendChild(e)}var
|
|
2020
|
+
`,document.head.appendChild(e)}var X={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 W=require("react/jsx-runtime"),Da=0;function bt(e){return e.getRootNode().activeElement??null}function $t(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Qt(e){if(!e.isContentEditable)return null;let a=$t(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function jt(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=$t(e);if(!t)return;let i=a;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}var Ma=(0,W.jsxs)("svg",{className:X.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,W.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,W.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Na=(0,W.jsxs)("svg",{className:X.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,W.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,W.jsx)("path",{d:"m20 20-3.5-3.5"})]});function Zt({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:d=!0,onQuery:m,onMove:v,onCommit:k,onFocusChange:f}){let p=(0,ne.useRef)(null),u=(0,ne.useRef)(null),x=(0,ne.useRef)(null),A=(0,ne.useRef)(null),q=(0,ne.useRef)(null),H=(0,ne.useRef)(!1),N=(0,ne.useRef)(!1),ae=(0,ne.useRef)(!1),O=(0,ne.useRef)(!1),F=(0,ne.useRef)(o);F.current=o;let T=(0,ne.useRef)(f);T.current=f;let Y=c=>{O.current=c,f(c)},ie=()=>{let c=p.current;return c!=null&&bt(c)===c},ce=()=>{let c=u.current;if(!c)return;let E=bt(c);E instanceof HTMLElement&&E!==p.current&&E!==document.body&&!c.contains(E)&&(A.current=E,q.current=Qt(E))},ee=c=>{let E=u.current;!E||!(c instanceof HTMLElement)||c===A.current||c===document.body||E.contains(c)||(A.current=c,q.current=Qt(c))},te=(0,ne.useRef)(null);te.current===null&&(te.current=`aia-location-${++Da}`);let P=`${te.current}-row-`;(0,ne.useEffect)(()=>{let c=p.current;c&&c.value!==e.query&&bt(c)!==c&&(c.value=e.query)},[e.query]),(0,ne.useEffect)(()=>{o&&(s&&!ae.current&&(N.current=!1),ae.current=s);let c=p.current;if(c){if(!r&&ie()){N.current=!0,Q();return}if(!o){setTimeout(()=>{if(F.current)return;let E=A.current;E&&bt(E)===E||(N.current=!1)},0);return}if(!(!s||N.current||!d||ie())){if(ce(),Y(!0),c.focus({preventScroll:!0}),!ie()){N.current=!0,Y(!1);return}c.value&&c.select()}}}),(0,ne.useLayoutEffect)(()=>()=>{if(!O.current)return;let c=p.current,E=A.current;E?.isConnected&&c&&bt(c)===c&&(H.current=!0,jt(E,q.current),H.current=!1),O.current=!1,T.current(!1)},[]);let Q=(c=!1)=>{c&&(N.current=!0);let E=A.current;E?.isConnected&&ie()&&(H.current=!0,jt(E,q.current),H.current=!1),Y(!1)},Ae=e.query.trim(),ke=e.highlighted>=0&&e.highlighted<e.places.length?`${P}${e.highlighted}`:void 0,ve=null;return e.places.length>0?ve=e.places.map((c,E)=>(0,W.jsxs)("div",{id:`${P}${E}`,role:"option","aria-selected":E===e.highlighted,className:E===e.highlighted?`${X.row} ${X.highlighted}`:X.row,"data-aia-location-row":"","data-aia-index":E,onClick:()=>{d&&(Q(!0),k(E))},children:[(0,W.jsx)("span",{className:X.pin,children:Ma}),(0,W.jsxs)("span",{className:X.text,children:[(0,W.jsx)("span",{className:X.name,children:c.name}),c.secondary&&(0,W.jsx)("span",{className:X.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?ve=(0,W.jsxs)("div",{className:X.loading,"data-aia-location-loading":"",children:[(0,W.jsx)("span",{className:X.loadingBar}),(0,W.jsx)("span",{className:X.loadingBar}),(0,W.jsx)("span",{className:X.loadingBar})]}):Ae&&(ve=(0,W.jsxs)("div",{className:X.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,W.jsx)("span",{className:X.empty,children:t}),(0,W.jsx)("span",{children:i})]})),(0,W.jsxs)("div",{ref:u,className:X.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),ce(),Y(!0))},children:[(0,W.jsxs)("label",{ref:x,className:X.field,children:[Na,(0,W.jsx)("input",{ref:p,type:"text",className:X.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":ke,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>m(c.target.value),onFocus:c=>{ee(c.relatedTarget),Y(!0)},onBlur:()=>{H.current||(N.current=!0,Y(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!d)return;Q(!0),k();return;case"Escape":c.preventDefault(),c.stopPropagation(),N.current=!0,Q();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),N.current=!0,Q();return}}})]}),(0,W.jsx)("div",{className:X.results,"data-aia-location-results":"","aria-live":"polite",children:ve})]})}var kt=require("@magicx-eng/ai-autocomplete-vanilla");var Xt=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,
|
|
1914
2021
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
1915
2022
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
1916
2023
|
as it was when the outline was dashed. */
|
|
@@ -2093,7 +2200,7 @@
|
|
|
2093
2200
|
opacity: 0;
|
|
2094
2201
|
}
|
|
2095
2202
|
}
|
|
2096
|
-
`,document.head.appendChild(e)}var
|
|
2203
|
+
`,document.head.appendChild(e)}var Fe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var et=require("react/jsx-runtime"),zt={selected:1,first:.7,next:.4,last:.2};function Jt({label:e,state:a,active:t,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:d}){let m=[Fe.pill,i?Fe.rounded:"",o?Fe.skeleton:""].filter(Boolean).join(" ");return(0,et.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:m,style:{"--aia-pill-opacity":zt[a]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:d,disabled:o,children:s?(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)("span",{className:`${Fe.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,et.jsx)("span",{className:`${Fe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Xt.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 {
|
|
2097
2204
|
position: relative;
|
|
2098
2205
|
z-index: 1;
|
|
2099
2206
|
pointer-events: auto;
|
|
@@ -2103,7 +2210,7 @@
|
|
|
2103
2210
|
align-items: center;
|
|
2104
2211
|
vertical-align: middle;
|
|
2105
2212
|
}
|
|
2106
|
-
`,document.head.appendChild(e)}var
|
|
2213
|
+
`,document.head.appendChild(e)}var Dt={list:"aia-list-qvLqO"};var wt=require("react/jsx-runtime"),Fa=[125,69];function ea(e){return e===0?"first":e===1?"next":"last"}function Ct({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":"",children:Fa.map((r,d)=>(0,wt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Fe.pill} ${o?Fe.rounded:""} ${Fe.skeleton}`,style:{width:r,"--aia-pill-opacity":zt[ea(d)]}},`skel-${r}`))}):(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,d)=>{let m=!!i&&d===a;return(0,wt.jsx)(Jt,{label:r.text,state:m?"selected":ea(d),selected:m,active:d===a,rounded:o,loading:s,smartSuggestion:(0,kt.isSmartSuggestion)(r),completionHeader:(0,kt.isTraditionalAutocompleteSuggestion)(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}var xe=require("@magicx-eng/ai-autocomplete-vanilla"),we=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
|
|
2107
2214
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2108
2215
|
theming one package sees the same result in the other.
|
|
2109
2216
|
|
|
@@ -2559,7 +2666,120 @@
|
|
|
2559
2666
|
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT[data-aia-product-has-cart] {
|
|
2560
2667
|
padding-right: calc(var(--aia-product-cart-size, 19.6px) + 11.2px);
|
|
2561
2668
|
}
|
|
2562
|
-
|
|
2669
|
+
|
|
2670
|
+
/* Classic options box (optionsStyle: "classic"): the panel as it was
|
|
2671
|
+
before the floating box: it unfolds out of the input with a stroke, at
|
|
2672
|
+
full size. Generated from the values the floating-box changes replaced;
|
|
2673
|
+
keep in step across the vanilla, React and Angular copies. */
|
|
2674
|
+
:where([data-aia-options-style="classic"]) .aia-section-Hugfg {
|
|
2675
|
+
gap: 6px;
|
|
2676
|
+
}
|
|
2677
|
+
:where([data-aia-options-style="classic"]) .aia-label-nuc93 {
|
|
2678
|
+
font-size: var(--aia-products-label-font-size, 11px);
|
|
2679
|
+
line-height: 18px;
|
|
2680
|
+
}
|
|
2681
|
+
:where([data-aia-options-style="classic"]) .aia-row-WDVBX {
|
|
2682
|
+
gap: var(--aia-product-gap, 8px);
|
|
2683
|
+
padding-bottom: 2px;
|
|
2684
|
+
margin-inline: -6px;
|
|
2685
|
+
}
|
|
2686
|
+
:where([data-aia-options-style="classic"]) .aia-card-JBGYT {
|
|
2687
|
+
gap: 6px;
|
|
2688
|
+
width: var(--aia-product-card-width, 116px);
|
|
2689
|
+
padding: 6px;
|
|
2690
|
+
border-radius: 10px;
|
|
2691
|
+
}
|
|
2692
|
+
:where([data-aia-options-style="classic"]) .aia-media-RrbGe {
|
|
2693
|
+
border-radius: 8px;
|
|
2694
|
+
}
|
|
2695
|
+
:where([data-aia-options-style="classic"]) .aia-image-5pNL7 {
|
|
2696
|
+
border-radius: var(--aia-product-image-radius, 8px);
|
|
2697
|
+
}
|
|
2698
|
+
:where([data-aia-options-style="classic"]) .aia-media-RrbGe:where([data-aia-product-initial]) {
|
|
2699
|
+
font-size: 24px;
|
|
2700
|
+
}
|
|
2701
|
+
:where([data-aia-options-style="classic"]) .aia-body-ly032 {
|
|
2702
|
+
gap: 2px;
|
|
2703
|
+
}
|
|
2704
|
+
:where([data-aia-options-style="classic"]) .aia-vendor-Gvu7G {
|
|
2705
|
+
font-size: var(--aia-product-vendor-font-size, 10px);
|
|
2706
|
+
line-height: 14px;
|
|
2707
|
+
}
|
|
2708
|
+
:where([data-aia-options-style="classic"]) .aia-title-gCNmq {
|
|
2709
|
+
font-size: var(--aia-product-title-font-size, 12px);
|
|
2710
|
+
line-height: 16px;
|
|
2711
|
+
}
|
|
2712
|
+
:where([data-aia-options-style="classic"]) .aia-price-gULcE {
|
|
2713
|
+
font-size: var(--aia-product-price-font-size, 11px);
|
|
2714
|
+
line-height: 15px;
|
|
2715
|
+
column-gap: 4px;
|
|
2716
|
+
}
|
|
2717
|
+
:where([data-aia-options-style="classic"]) .aia-badge-j9Hcd {
|
|
2718
|
+
top: var(--aia-product-badge-inset, 12px);
|
|
2719
|
+
left: var(--aia-product-badge-inset, 12px);
|
|
2720
|
+
padding: 3px 6px;
|
|
2721
|
+
border-radius: 4px;
|
|
2722
|
+
font-size: var(--aia-product-badge-font-size, 9px);
|
|
2723
|
+
}
|
|
2724
|
+
:where([data-aia-options-style="classic"]) .aia-cart-kSlqU {
|
|
2725
|
+
top: calc(
|
|
2726
|
+
var(--aia-product-card-width, 116px) -
|
|
2727
|
+
12px -
|
|
2728
|
+
var(--aia-product-cart-size, 28px) -
|
|
2729
|
+
(var(--aia-product-card-width, 116px) - 12px) *
|
|
2730
|
+
(1 - var(--aia-product-photo-fill-y, 1)) /
|
|
2731
|
+
2
|
|
2732
|
+
);
|
|
2733
|
+
right: calc(
|
|
2734
|
+
12px +
|
|
2735
|
+
(var(--aia-product-card-width, 116px) - 12px) *
|
|
2736
|
+
(1 - var(--aia-product-photo-fill-x, 1)) /
|
|
2737
|
+
2
|
|
2738
|
+
);
|
|
2739
|
+
width: var(--aia-product-cart-size, 28px);
|
|
2740
|
+
height: var(--aia-product-cart-size, 28px);
|
|
2741
|
+
}
|
|
2742
|
+
:where([data-aia-options-style="classic"]) .aia-cart-kSlqU svg {
|
|
2743
|
+
width: 16px;
|
|
2744
|
+
height: 16px;
|
|
2745
|
+
}
|
|
2746
|
+
:where([data-aia-options-style="classic"]) .aia-section-Hugfg[data-aia-products-layout="list"] .aia-row-WDVBX {
|
|
2747
|
+
gap: var(--aia-product-list-gap, 2px);
|
|
2748
|
+
max-height: var(--aia-product-list-max-height, 320px);
|
|
2749
|
+
}
|
|
2750
|
+
:where([data-aia-options-style="classic"])
|
|
2751
|
+
.aia-section-Hugfg[data-aia-products-layout="list"]
|
|
2752
|
+
.aia-card-JBGYT {
|
|
2753
|
+
gap: 10px;
|
|
2754
|
+
padding: 6px 8px;
|
|
2755
|
+
}
|
|
2756
|
+
:where([data-aia-options-style="classic"])
|
|
2757
|
+
.aia-section-Hugfg[data-aia-products-layout="list"]
|
|
2758
|
+
.aia-media-RrbGe {
|
|
2759
|
+
width: var(--aia-product-list-media-size, 44px);
|
|
2760
|
+
height: var(--aia-product-list-media-size, 44px);
|
|
2761
|
+
}
|
|
2762
|
+
:where([data-aia-options-style="classic"])
|
|
2763
|
+
.aia-section-Hugfg[data-aia-products-layout="list"]
|
|
2764
|
+
.aia-badge-j9Hcd {
|
|
2765
|
+
top: calc(50% + var(--aia-product-list-media-size, 44px) / 2);
|
|
2766
|
+
left: 8px;
|
|
2767
|
+
width: var(--aia-product-list-media-size, 44px);
|
|
2768
|
+
padding: 2px 0;
|
|
2769
|
+
border-radius: 0 0 8px 8px;
|
|
2770
|
+
font-size: var(--aia-product-badge-list-font-size, 7px);
|
|
2771
|
+
}
|
|
2772
|
+
:where([data-aia-options-style="classic"])
|
|
2773
|
+
.aia-section-Hugfg[data-aia-products-layout="list"]
|
|
2774
|
+
.aia-cart-kSlqU {
|
|
2775
|
+
right: 8px;
|
|
2776
|
+
}
|
|
2777
|
+
:where([data-aia-options-style="classic"])
|
|
2778
|
+
.aia-section-Hugfg[data-aia-products-layout="list"]
|
|
2779
|
+
.aia-card-JBGYT[data-aia-product-has-cart] {
|
|
2780
|
+
padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
|
|
2781
|
+
}
|
|
2782
|
+
`,document.head.appendChild(e)}var J={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"};var G=require("react/jsx-runtime");function ta({products:e,listboxId:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s=!0,layout:r="row",imageFallback:d="image",strings:m=(0,xe.uiStringsFor)()}){let v=e.length>0,k=(0,we.useRef)(null);if((0,we.useEffect)(()=>{let p=k.current;if(!(!v||!p))return(0,xe.attachProductRowWheel)(p)},[v]),!v)return null;let f=`${a}-products-label`;return(0,G.jsxs)("section",{className:J.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":f,children:[(0,G.jsx)("div",{className:J.label,id:f,"data-aia-products-label":"",children:m.products}),(0,G.jsx)("div",{ref:k,className:J.row,"data-aia-products-row":"",children:e.map((p,u)=>(0,G.jsx)(Ha,{product:p,id:`${a}-product-${u}`,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:d,soldOut:m.soldOut,addToCart:m.addToCart},p.id))})]})}function Ha({product:e,id:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:r,soldOut:d,addToCart:m}){let v=!!i&&e.available!==!1,[k,f]=(0,we.useState)(null),p=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},u=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),t(e))};return(0,G.jsxs)("a",{id:a,className:J.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:k?{"--aia-product-photo-fill-x":String(k.x),"--aia-product-photo-fill-y":String(k.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:u,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:p,children:[(0,G.jsx)(Wa,{sources:(0,xe.productImageSources)(e.imageUrl),title:e.title,fallback:r,onPhotoFill:f},(0,xe.productImageSrc)(e.imageUrl)??""),(0,G.jsxs)("span",{className:J.body,children:[e.vendor?(0,G.jsx)("span",{className:J.vendor,children:e.vendor}):null,(0,G.jsx)("span",{className:J.title,children:e.title}),e.price?(0,G.jsxs)("span",{className:J.price,children:[e.price,e.compareAtPrice?(0,G.jsx)("s",{className:J.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,G.jsx)("span",{className:J.badge,children:d}):null]}),v&&i?(0,G.jsx)(Ga,{product:e,label:`${m}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>o?.(!0),onBlur:p},Ba(e)):null]})}function Ba(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function Ga({product:e,label:a,focusable:t,onAddToCart:i,onFocus:o,onBlur:s}){let[r,d]=(0,we.useState)(null),m=(0,we.useRef)(null),v=(0,we.useRef)(e);v.current=e;let k=(0,we.useRef)(!0);(0,we.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let f=u=>{m.current=u,k.current&&d(u)},p=u=>{if(u.preventDefault(),u.stopPropagation(),m.current==="adding")return;f("adding");let x;try{x=Promise.resolve(i(v.current))}catch(A){x=Promise.reject(A)}x.then(()=>f("added"),()=>f(null))};return(0,G.jsx)("span",{className:J.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:p,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||p(u)},onFocus:u=>{u.stopPropagation(),o()},onBlur:u=>{u.stopPropagation(),s(u)},children:(0,G.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,G.jsx)("path",{className:J.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,G.jsx)("path",{className:J.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,G.jsx)("path",{className:J.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,G.jsx)("path",{className:J.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,G.jsx)("circle",{className:J.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,G.jsx)("circle",{className:J.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Wa({sources:e,title:a,fallback:t,onPhotoFill:i}){let[o,s]=(0,we.useState)(0),r=e[o],d=!!r,[m,v]=(0,we.useState)(null),k=!d&&t==="initial";return(0,we.useEffect)(()=>()=>i(null),[i]),(0,G.jsxs)("span",{className:J.media,"aria-hidden":"true","data-aia-product-placeholder":!d&&!k?"":void 0,"data-aia-product-initial":k?"":void 0,"data-aia-image-loaded":d&&m===r?"":void 0,children:[d?(0,G.jsx)("img",{className:J.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:f=>{v(r),i((0,xe.productPhotoFill)(f.currentTarget.naturalWidth,f.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(f=>f+1)}}):null,k?(0,xe.productInitial)(a):null]})}var le=require("@magicx-eng/ai-autocomplete-vanilla"),He=require("react");var aa=require("@magicx-eng/ai-autocomplete-vanilla"),St=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 {
|
|
2563
2783
|
display: grid;
|
|
2564
2784
|
grid-template-columns: repeat(
|
|
2565
2785
|
auto-fit,
|
|
@@ -2595,7 +2815,15 @@
|
|
|
2595
2815
|
.aia-grid[data-scroll]::-webkit-scrollbar {
|
|
2596
2816
|
display: none;
|
|
2597
2817
|
}
|
|
2598
|
-
|
|
2818
|
+
|
|
2819
|
+
/* Classic options box (optionsStyle: "classic"): the panel as it was
|
|
2820
|
+
before the floating box: it unfolds out of the input with a stroke, at
|
|
2821
|
+
full size. Generated from the values the floating-box changes replaced;
|
|
2822
|
+
keep in step across the vanilla, React and Angular copies. */
|
|
2823
|
+
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
2824
|
+
max-height: var(--aia-grid-max-height, 120px);
|
|
2825
|
+
}
|
|
2826
|
+
`,document.head.appendChild(e)}var oa=require("react/jsx-runtime");function ia({min:e="16rem",max:a,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:d,innerRef:m,className:v,children:k,...f}){let p=(0,St.useRef)(null);(0,St.useLayoutEffect)(()=>{if(s===void 0)return;let x=p.current;x&&(x.scrollTop=0)},[s]);let u={"--aia-grid-min":e};return a&&(u["--aia-grid-max"]=a),t&&(u["--aia-grid-gap"]=t),o&&(u["--aia-grid-max-height"]=o),r&&(u.gridTemplateColumns=(0,aa.optionsGridTemplateColumns)(r)),d&&(u.gridTemplateColumns=d),(0,oa.jsx)("div",{ref:x=>{p.current=x,m?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:u,...f,children:k})}var me=require("@magicx-eng/ai-autocomplete-vanilla"),Te=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 {
|
|
2599
2827
|
position: relative;
|
|
2600
2828
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
2601
2829
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3121,7 +3349,79 @@
|
|
|
3121
3349
|
.aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
|
|
3122
3350
|
background: var(--aia-option-bg, transparent);
|
|
3123
3351
|
}
|
|
3124
|
-
|
|
3352
|
+
|
|
3353
|
+
/* Classic options box (optionsStyle: "classic"): the panel as it was
|
|
3354
|
+
before the floating box: it unfolds out of the input with a stroke, at
|
|
3355
|
+
full size. Generated from the values the floating-box changes replaced;
|
|
3356
|
+
keep in step across the vanilla, React and Angular copies. */
|
|
3357
|
+
:where([data-aia-options-style="classic"]) .aia-item-d4vpD {
|
|
3358
|
+
font-size: var(--aia-option-font-size, 16px);
|
|
3359
|
+
line-height: 21px;
|
|
3360
|
+
border-radius: 8px;
|
|
3361
|
+
padding: 8px 10px;
|
|
3362
|
+
}
|
|
3363
|
+
:where([data-aia-options-style="classic"]) .aia-tag-e3Fwe {
|
|
3364
|
+
font-size: 11px;
|
|
3365
|
+
margin-left: 6px;
|
|
3366
|
+
}
|
|
3367
|
+
:where([data-aia-options-style="classic"]) .aia-parameter-Dt2zF {
|
|
3368
|
+
font-size: var(--aia-option-parameter-font-size, 12px);
|
|
3369
|
+
line-height: 16px;
|
|
3370
|
+
}
|
|
3371
|
+
:where([data-aia-options-style="classic"]) .aia-icon-Qw938 {
|
|
3372
|
+
height: 21px;
|
|
3373
|
+
margin-right: 8px;
|
|
3374
|
+
}
|
|
3375
|
+
:where([data-aia-options-style="classic"]) .aia-content-T-Qba:not(:has(.aia-count-IpYbQ)):has(.aia-icon-Qw938) {
|
|
3376
|
+
padding-left: calc(1em + 8px);
|
|
3377
|
+
text-indent: calc(-1em - 8px);
|
|
3378
|
+
}
|
|
3379
|
+
:where([data-aia-options-style="classic"]) .aia-content-T-Qba:has(.aia-image-YZAbO) {
|
|
3380
|
+
gap: var(--aia-option-image-gap, 12px);
|
|
3381
|
+
}
|
|
3382
|
+
:where([data-aia-options-style="classic"]) .aia-image-YZAbO {
|
|
3383
|
+
width: var(--aia-option-image-size, 40px);
|
|
3384
|
+
height: var(--aia-option-image-size, 40px);
|
|
3385
|
+
border-radius: var(--aia-option-image-radius, 12px);
|
|
3386
|
+
}
|
|
3387
|
+
:where([data-aia-options-style="classic"]) .aia-image-YZAbO img {
|
|
3388
|
+
border-radius: var(--aia-option-picture-radius, 6px);
|
|
3389
|
+
}
|
|
3390
|
+
:where([data-aia-options-style="classic"]) .aia-count-IpYbQ {
|
|
3391
|
+
padding-left: 12px;
|
|
3392
|
+
font-size: var(--aia-option-count-font-size, 12px);
|
|
3393
|
+
line-height: 21px;
|
|
3394
|
+
}
|
|
3395
|
+
:where([data-aia-options-style="classic"]) [data-aia-group]:has(.aia-parameter-Dt2zF) {
|
|
3396
|
+
--aia-option-row-height: 53px;
|
|
3397
|
+
}
|
|
3398
|
+
:where([data-aia-options-style="classic"]) [data-aia-group]:has(.aia-image-YZAbO) {
|
|
3399
|
+
--aia-option-row-height: calc(var(--aia-option-image-size, 40px) + 16px);
|
|
3400
|
+
}
|
|
3401
|
+
:where([data-aia-options-style="classic"])
|
|
3402
|
+
[data-aia-group]:has(.aia-image-YZAbO)
|
|
3403
|
+
.aia-content-T-Qba:not(:has(.aia-image-YZAbO)) {
|
|
3404
|
+
gap: var(--aia-option-image-gap, 12px);
|
|
3405
|
+
min-height: var(--aia-option-image-size, 40px);
|
|
3406
|
+
}
|
|
3407
|
+
:where([data-aia-options-style="classic"])
|
|
3408
|
+
[data-aia-group]:has(.aia-image-YZAbO)
|
|
3409
|
+
.aia-content-T-Qba:not(:has(.aia-image-YZAbO))
|
|
3410
|
+
.aia-icon-Qw938 {
|
|
3411
|
+
width: var(--aia-option-image-size, 40px);
|
|
3412
|
+
height: var(--aia-option-image-size, 40px);
|
|
3413
|
+
}
|
|
3414
|
+
:where([data-aia-options-style="classic"]) .aia-content-T-Qba:has(.aia-checkbox-KGRhg) {
|
|
3415
|
+
gap: 10px;
|
|
3416
|
+
}
|
|
3417
|
+
:where([data-aia-options-style="classic"]) .aia-checkbox-KGRhg {
|
|
3418
|
+
flex: 0 0 18px;
|
|
3419
|
+
width: 18px;
|
|
3420
|
+
height: 18px;
|
|
3421
|
+
border-radius: 6px;
|
|
3422
|
+
font-size: 11px;
|
|
3423
|
+
}
|
|
3424
|
+
`,document.head.appendChild(e)}var se={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",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd",checkbox:"aia-checkbox-KGRhg"};var he=require("react/jsx-runtime");function na({option:e,isHighlighted:a,checked:t,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:d,showIcon:m=!0,showImage:v=!0,showCount:k=!0,scrollHint:f,enterDelayMs:p=0}){let[u]=(0,Te.useState)(p),[x,A]=(0,Te.useState)(!1),q=v?(0,me.optionImageSources)(e.image_url):[],H=q[0]??null,[N,ae]=(0,Te.useState)([]),O=q.find(P=>!N.includes(P))??null,[F,T]=(0,Te.useState)(null),Y=(0,Te.useMemo)(()=>!H&&m&&e.icon_svg?(0,me.sanitizeOptionIconSvg)(e.icon_svg):null,[H,m,e.icon_svg]),ie=k?(0,me.formatOptionCount)(e.item_count):null,ce=(0,Te.useRef)(void 0);(0,Te.useEffect)(()=>()=>clearTimeout(ce.current),[]);let ee=P=>{if(d||!e.is_tappable||x&&t===void 0)return;A(!0);let Q=P?.currentTarget;t!==void 0&&Q!==void 0&&P!==void 0&&!(0,me.isMultiSelectToggleTap)(Q,Q.querySelector("[data-aia-checkbox]"),P)?i(e,{commit:!0}):i(e),clearTimeout(ce.current),ce.current=setTimeout(()=>A(!1),170)},te=[se.item,a&&!d?se.highlighted:"",e.liveMatch&&!d?se.liveMatch:"",e.is_tappable?se.tappable:se.nonTappable,x?se.pressed:"",f?se.scrollHint:""].filter(Boolean).join(" ");return(0,he.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":Y&&e.icon?e.icon:void 0,"data-aia-image":H?"":void 0,"data-aia-item-count":ie!==null?e.item_count:void 0,"aria-selected":t??a,className:te,style:{[me.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:ee,onKeyDown:P=>{!d&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),ee())},onMouseEnter:!d&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,he.jsxs)("span",{className:se.content,children:[t!==void 0&&e.is_tappable&&(0,he.jsx)("span",{className:se.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),H&&(0,he.jsx)("span",{className:`${se.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":O!==null&&F===O?"":void 0,children:(0,he.jsx)("img",{src:O??H,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:O===null,onLoad:()=>T(O),onError:()=>{O!==null&&ae(P=>[...P,O])}})}),Y&&(0,he.jsx)("span",{className:`${se.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:Y}}),(0,he.jsxs)("span",{className:se.text,children:[e.matchedText?(0,me.highlightParts)((0,me.optionLabel)(e),e.matchedText).map((P,Q)=>P.bold?(0,he.jsx)("strong",{className:`${se.match} magicx-aia-option-match`,children:P.text},Q):P.text):(0,me.optionLabel)(e),e.parameterLabel&&(0,he.jsxs)(he.Fragment,{children:[" ",(0,he.jsx)("span",{className:`${se.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,he.jsx)("span",{className:se.tag,children:e.tag}),ie!==null&&(0,he.jsx)("span",{className:`${se.count} magicx-aia-option-count`,children:ie})]})})}var Mt=require("react/jsx-runtime");function Ka(){let[e,a]=(0,He.useState)(le.isOptionsGridMobileViewport);return(0,He.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(le.OPTIONS_GRID_MOBILE_QUERY),i=()=>a(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function ra({options:e,activeIndex:a,picked:t,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:d,groupKey:m="",optionsPosition:v="below",showIcons:k=!0,showImages:f=!0,showCounts:p=!0}){let u=Ka(),x=(0,He.useRef)(null),[A,q]=(0,He.useState)(null),H=(0,He.useRef)(null);(0,He.useLayoutEffect)(()=>{if(d&&(0,le.sameOptionRows)(H.current,e))return;H.current=d?null:e;let O=x.current,T=O&&!d&&(0,le.needsOptionsGridMeasurement)(e.length,u)?(0,le.measureOptionsGrid)(O):null;q(T?(0,le.planOptionsGrid)(e.length,u,T.rowWidths,T.gridWidth):null)},[e,u,d]);let N=A??(0,le.planOptionsGrid)(e.length,u,null,null),ae=(0,le.optionsShowLeadingVisuals)(e,k,f);return(0,Mt.jsx)(ia,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:m,template:N.template,maxHeight:N.maxHeight,innerRef:O=>{x.current=O},"data-aia-group":m,children:e.map((O,F)=>(0,Mt.jsx)(na,{option:O,isHighlighted:F===a,checked:t?t.includes(O.text):void 0,onSelect:i,onHighlight:()=>o(F),onUnhighlight:s?()=>s(F):void 0,id:`${r}-option-${F}`,loading:d,showIcon:k&&ae,showImage:f&&ae,showCount:p,scrollHint:!d&&N.scrollHintIndices.includes(F),enterDelayMs:d?0:(0,le.optionEnterDelayMs)(F,N.cols,e.length,v)},`${m}\0${O.text}`))})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),Ie=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) ---
|
|
3125
3425
|
|
|
3126
3426
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3127
3427
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3243,7 +3543,7 @@
|
|
|
3243
3543
|
.aia-done-llNY5:hover {
|
|
3244
3544
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3245
3545
|
}
|
|
3246
|
-
`,document.head.appendChild(e)}var Pe={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 ye=require("react/jsx-runtime"),
|
|
3546
|
+
`,document.head.appendChild(e)}var Pe={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 ye=require("react/jsx-runtime"),qa=120;function sa({view:e,label:a,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return(0,ye.jsxs)("div",{className:Pe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:r=>r.preventDefault(),children:[(0,ye.jsx)("span",{className:Pe.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ue.formatTime)(e.minutes)}),(0,ye.jsxs)("div",{className:Pe.columns,"aria-hidden":"true",children:[(0,ye.jsx)("div",{className:Pe.band}),ue.TIME_WHEEL_COLUMNS.map(r=>(0,ye.jsxs)(Ie.Fragment,{children:[r==="minute"&&(0,ye.jsx)("span",{className:Pe.separator,children:":"}),(0,ye.jsx)(_a,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),(0,ye.jsx)("button",{type:"button",tabIndex:-1,className:Pe.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:t})]})}function _a({column:e,minutes:a,interactive:t,onTimeChange:i}){let o=(0,Ie.useRef)(null),s=(0,Ie.useRef)(null),r=(0,Ie.useRef)(null),d=(0,Ie.useRef)({minutes:a,interactive:t,onTimeChange:i});d.current={minutes:a,interactive:t,onTimeChange:i};let m=(0,ue.timeWheelIndex)(e,a);(0,Ie.useLayoutEffect)(()=>{let f=o.current;if(!f||r.current)return;let p=m*ue.TIME_WHEEL_ROW_HEIGHT;Math.abs(f.scrollTop-p)<1||(s.current=p,f.scrollTop=p)},[m]),(0,Ie.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let f=o.current,p=d.current;if(!f||!p.interactive)return;let u=(0,ue.timeWheelIndexFromScroll)(e,f.scrollTop);u!==(0,ue.timeWheelIndex)(e,p.minutes)&&p.onTimeChange((0,ue.withTimeWheelIndex)(e,p.minutes,u))},k=()=>{let f=o.current;if(f){if(s.current!=null&&Math.abs(f.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,qa)}};return(0,ye.jsx)("div",{ref:o,className:Pe.column,"data-aia-time-column":e,onScroll:k,children:(0,ue.timeWheelRows)(e).map((f,p)=>(0,ye.jsx)("div",{className:p===m?`${Pe.row} ${Pe.selected}`:Pe.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{d.current.interactive&&i((0,ue.withTimeWheelIndex)(e,d.current.minutes,p))},children:f.label},f.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
|
|
3247
3547
|
display: flex;
|
|
3248
3548
|
flex-direction: column;
|
|
3249
3549
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3258,7 +3558,7 @@
|
|
|
3258
3558
|
align-items: end;
|
|
3259
3559
|
}
|
|
3260
3560
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3261
|
-
`,document.head.appendChild(e)}var
|
|
3561
|
+
`,document.head.appendChild(e)}var da=require("react/jsx-runtime");function la({space:e,align:a="stretch",className:t,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,da.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:s,...o,children:i})}var _=require("react/jsx-runtime"),Va=typeof window>"u"?V.useEffect:V.useLayoutEffect,Ua=[159,119,164],Ya=()=>{},ca=()=>{},Qa=e=>{},ja=()=>{},$a=e=>{},Za=e=>{},Xa=e=>{},Ja=e=>{};function ei(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,V.useState)(a);if((0,V.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"?t?"dark":"light":e}function ti(e,a){let t=(0,V.useRef)(null);(0,V.useEffect)(()=>{let i=e.current,o=a.current;if(!i||!o)return;let s=(0,D.queryLive)(i,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:(0,D.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}t.current?.controller.update()}),(0,V.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function ai(e,a){let t=(0,V.useRef)(a);t.current=a;let i=(0,V.useRef)(null);(0,V.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,D.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),(0,V.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Tt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:d,pills:m,onPillClick:v,showPills:k=!0,onSkip:f,showSkipButton:p=!0,showOptionIcons:u=!0,showOptionImages:x=!0,showOptionCounts:A=!0,skipDisabled:q=!1,activeSelected:H=!1,isLoading:N=!1,skeletonExiting:ae=!1,isInputEmpty:O=!1,language:F,products:T,onProductSelect:Y,onProductAddToCart:ie,onProductFocusChange:ce,productsLayout:ee="row",productImageFallback:te="image",formatType:P="options",dateView:Q=null,selectedDateIso:Ae=null,selectedDateRange:ke=null,dateRangeStart:ve=null,onPreviousMonth:c,onNextMonth:E,timeView:Ge=null,multiSelectView:b=null,onMultiSelectCommit:at,onTimeChange:Ve,onTimeCommit:Ue,locationView:w=null,isReediting:S=!1,onLocationQuery:I,onLocationMove:L,onLocationCommit:z,onLocationFocusChange:oe,isFocused:Re=!1,optionsPosition:ge="below",mode:Oe}){let Ye=ei(Oe),st=Ye!==void 0,j=(0,V.useRef)(null),Qe=(0,V.useRef)(null);ti(j,Qe),(0,V.useEffect)(()=>{if(j.current)return(0,D.containScroll)(j.current)},[]);let pt=e[0]?.options??[],it=!!(m&&m.length>0&&v),We=!!(T&&T.length>0),ht=P==="time"&&Ge!=null,je=P==="location"&&w!=null,pe=s&&(pt.length>0||k&&it||N||We||ht||je);ai(j,pe),Va(()=>{let C=j.current;C&&(0,D.fitMultiSelectDone)(C,(0,D.findMultiSelectDone)(C))});let Ce={suggestions:e,activeIndex:a,pills:m,showPills:k,showSkipButton:p,showOptionIcons:u,showOptionImages:x,showOptionCounts:A,skipDisabled:q,activeSelected:H,isLoading:N,skeletonExiting:ae,isInputEmpty:O,products:T,formatType:P,dateView:Q,selectedDateIso:Ae,selectedDateRange:ke,dateRangeStart:ve,timeView:Ge,multiSelectView:b,locationView:w,isReediting:S},y=(0,V.useRef)(Ce);pe&&(y.current=Ce);let n=pe?Ce:y.current,re=(0,D.uiStringsFor)(F),Le=n.suggestions[0],g=Le?.options??[],$e=n.activeIndex>=0&&!!g[n.activeIndex]?.is_tappable,Ke=(0,D.labelTraditionalAutocomplete)(n.pills??[],re.keepTyping),ze=!!(Ke.length>0&&v),ot=n.showPills&&ze,ut=n.showPills&&!ze&&n.isLoading,qe=ot||ut,lt=ze&&(0,D.hasSkippablePill)(Ke)&&n.showSkipButton&&!n.isInputEmpty&&!!f,Se=Ke[0]?.text,De=(0,D.isCalendarFormat)(n.formatType)&&n.dateView!=null,Ze=g.length>0&&!De,nt=g.length>0&&De&&!n.isLoading,dt=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,Xe=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,ct=n.isLoading&&!Ze&&!nt&&!dt&&!Xe,h=n.products??[],K=(0,D.panelMorphKey)(ot?Ke:[]);return(0,V.useLayoutEffect)(()=>{j.current&&(0,D.settlePanelMorph)(j.current,K,{visible:pe,anchorBottom:ge==="above"})},[K,pe,ge,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,ee,F]),(0,V.useEffect)(()=>{let C=j.current;return()=>{C&&(0,D.destroyPanelMorph)(C)}},[]),(0,_.jsxs)("div",{ref:j,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":ge,"data-mode":Ye,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":h.length>0?"":void 0,className:`${st?"magicx-aia ":""}${Me.dropdown} ${pe?Me.visible:""} ${d??""}`,onMouseDown:C=>C.preventDefault(),children:[(0,_.jsxs)(la,{space:"8px",children:[(qe||lt)&&(0,_.jsxs)(ft,{noWrap:!0,className:Me.pillBar,"data-aia-pillbar":"",children:[qe&&(0,_.jsx)("span",{className:Me.pillScroll,"data-aia-pill-scroll":"",children:(0,_.jsx)(Ct,{pills:Ke,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:n.isLoading})}),lt&&(0,_.jsx)("button",{type:"button",tabIndex:-1,className:Me.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":Se?`${re.skipLabel} ${Se}`:re.skipLabel,onClick:f,children:re.skip})]}),Ze&&(0,_.jsx)(ra,{options:g,activeIndex:n.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n.isLoading,groupKey:Le?`${Le.parameter} ${Le.text}`:"",optionsPosition:ge,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.isLoading?void 0:n.multiSelectView?.picked}),n.multiSelectView&&!n.isLoading&&(0,_.jsx)("div",{onClick:C=>{C.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&at?.()},children:(0,_.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Me.multiDone,ref:C=>{C&&(C.disabled=!0,C.offsetHeight,C.disabled=n.skipDisabled)},children:re.done})}),nt&&n.dateView&&(0,_.jsx)(Ut,{options:g,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,D.dateFloorFor)(n.formatType,n.dateRangeStart)},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:c??ca,onNextMonth:E??ca}),dt&&n.timeView&&(0,_.jsx)(sa,{view:n.timeView,label:re.timeLabel,doneLabel:re.done,interactive:!n.skipDisabled,onTimeChange:Ve??Qa,onTimeCommit:Ue??ja}),Xe&&n.locationView&&(0,_.jsx)(Zt,{view:n.locationView,searchLabel:re.locationSearch,noResultsLabel:re.locationNoResults,useTypedLabel:re.locationUseTyped,widgetFocused:Re&&pe,reediting:n.isReediting,visible:pe,interactive:!n.skipDisabled,onQuery:I??$a,onMove:L??Za,onCommit:z??Xa,onFocusChange:oe??Ja}),ct&&(0,_.jsx)("div",{className:Me.skeletonBars,"data-aia-skeleton-bars":"",children:Ua.map(C=>(0,_.jsx)("span",{className:Me.skeletonBar,style:{width:C}},`bar-${C}`))}),(0,_.jsx)(ta,{products:h,listboxId:r,onSelect:Y??Ya,onAddToCart:ie,onFocusChange:ce,focusable:pe,layout:ee,imageFallback:te,strings:re}),(0,_.jsx)(Yt,{isOptionHighlighted:$e,isInputEmpty:n.isInputEmpty,strings:re})]}),(0,_.jsx)("button",{ref:Qe,type:"button",tabIndex:-1,className:Me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":re.scrollArrow,"aria-hidden":"true",children:(0,_.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,_.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Be=require("@magicx-eng/ai-autocomplete-vanilla");var ha=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 {
|
|
3262
3562
|
flex-shrink: 0;
|
|
3263
3563
|
width: 32px;
|
|
3264
3564
|
height: 32px;
|
|
@@ -3329,5 +3629,5 @@
|
|
|
3329
3629
|
transition: none;
|
|
3330
3630
|
}
|
|
3331
3631
|
}
|
|
3332
|
-
`,document.head.appendChild(e)}var ca={submitButton:"aia-submitButton-otz7H"};var Pt=require("react/jsx-runtime");function ha({disabled:e,ready:a,onClick:t,label:i=(0,pa.uiStringsFor)().submit}){return(0,Pt.jsx)("button",{type:"button","data-aia-submit":"",className:ca.submitButton,disabled:e,"data-aia-ready":a?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":i,children:(0,Pt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Pt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var et=require("@magicx-eng/ai-autocomplete-vanilla"),L=require("react");var Nt=require("react");function ua(e){let a=(0,Nt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Nt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(d,g,v)=>{let y=a.current?.[s];return y?y(d,g,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var Ft=require("react");function ma(e){let a=(0,Ft.useRef)(e);a.current=e;let t=(0,Ft.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=a.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var ga={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateFloor:null,timeView:null,multiSelectView: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 It({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:d,currency:g,productId:v,visitorId:y,columns:f=2,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showOptionIcons:N,showOptionImages:te,showOptionCounts:O,showSkipButton:F,showProducts:T,productImageFallback:Q="image",onFocus:ae,onBlur:de,value:J,completedParams:ee,onChange:P,onParamsChange:Y,products:Ae,mapProducts:ke,onProductSelect:ve,onProductAddToCart:c,source:E,setCursor:Ge}){let b=(0,L.useRef)(null),[tt,Qe]=(0,L.useState)(null),Ye=(0,L.useRef)(e);Ye.current=e;let w=(0,L.useRef)(a);w.current=a;let S=(0,L.useRef)(t);S.current=t;let I=(0,L.useRef)(P);I.current=P;let R=(0,L.useRef)(Y);R.current=Y;let D=(0,L.useRef)(ae);D.current=ae;let oe=(0,L.useRef)(de);oe.current=de;let Ce=(0,L.useRef)(Ge);Ce.current=Ge;let ge=(0,L.useRef)(ve);ge.current=ve;let Re=(0,L.useRef)(c);Re.current=c;let je=(0,L.useRef)(y);je.current=y;let Le=(0,L.useRef)(()=>{let h=je.current;return typeof h=="function"?h():h}).current,ce=ma(Ae),at=(0,L.useRef)(ke);at.current=ke;let ht=(0,L.useRef)((h,B)=>{let C=at.current;return C?C(h,B):h}).current,qe=ke?ht:void 0,it=ua(i);(0,L.useEffect)(()=>{if(typeof document>"u")return;let h=new et.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:g,productId:v,visitorId:Le,optionOverrides:it.overrides,maskCompletedText:o,columns:f,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showProducts:T,source:E,value:J,completedParams:ee,onSubmit:(...C)=>Ye.current?.(...C),onResult:(...C)=>w.current?.(...C),onError:(...C)=>S.current?.(...C),onChange:(...C)=>I.current?.(...C),onParamsChange:(...C)=>R.current?.(...C),onFocus:()=>D.current?.(),onBlur:()=>oe.current?.(),onProductSelect:C=>ge.current?.(C),onProductAddToCart:C=>Re.current?.(C),setCursor:C=>Ce.current?.(C),products:ce.config,mapProducts:qe});b.current=h,Qe(h.getState());let B=h.subscribe(C=>Qe(C));return()=>{B(),h.destroy(),b.current===h&&(b.current=null)}},[]),(0,L.useEffect)(()=>{J!==void 0&&b.current?.setValue(J)},[J]),(0,L.useEffect)(()=>{ee!==void 0&&b.current?.setCompletedParams(ee)},[ee]);let rt=JSON.stringify(s??null),_e;try{_e=JSON.stringify(r??null)}catch{_e="[unstringifiable]"}(0,L.useEffect)(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:d,currency:g,productId:v,optionOverrides:it.overrides,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showProducts:T})},[rt,_e,d,g?.code,g?.rate,g?.country,v,it.key,p,u,x,A,q,H,T]);let pe=(0,L.useRef)(!1);(0,L.useEffect)(()=>{if(!pe.current){pe.current=!0;return}b.current?.update({products:ce.config})},[ce.enabled]),(0,L.useEffect)(()=>{b.current?.update({mapProducts:qe})},[qe]);let Oe=(0,L.useRef)(null);Oe.current===null&&(Oe.current={handleTextChange:h=>b.current?.handleTextChange(h),handleKeyDown:h=>{let B="nativeEvent"in h?h.nativeEvent:h;b.current?.handleKeyDown(B)},setFocused:h=>b.current?.setFocused(h),startEditingParam:h=>b.current?.startEditingParam(h),exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:h=>b.current?.handleCaretAfterInput(h),handleCaretMove:h=>b.current?.handleCaretMove(h),replaceEditingRange:h=>b.current?.replaceEditingRange(h)??!1,setActivePill:h=>b.current?.setActivePill(h),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()??ga,recordSubmit:h=>b.current?.recordSubmit(h),selectOption:(h,B)=>b.current?.selectOption(h,B),selectProduct:h=>b.current?.selectProduct(h),addProductToCart:h=>{let B=b.current;return!B||!Re.current?Promise.resolve():B.addProductToCart(h)},setActiveDropdownIndex:h=>b.current?.setActiveDropdownIndex(h),clearHighlight:h=>b.current?.clearHighlight(h),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:h=>b.current?.setTime(h),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:h=>b.current?.toggleMultiSelectOption(h),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:h=>b.current?.setLocationQuery(h),moveLocationHighlight:h=>b.current?.moveLocationHighlight(h),commitLocation:h=>b.current?.commitLocation(h),setLocationFieldFocused:h=>b.current?.setLocationFieldFocused(h),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let k=Oe.current,n=(0,L.useCallback)(h=>{let B=h.target.value,vt=B.length>0&&!h.nativeEvent?.isComposing&&B[0]!==B[0].toUpperCase()?B[0].toUpperCase()+B.slice(1):B;b.current?.handleTextChange(vt)},[]),ne=(0,L.useCallback)(h=>{b.current?.handleKeyDown(h.nativeEvent)},[]),De=b.current,m=tt??ga,st=J!==void 0?J:m.text,Me=ee!==void 0?ee:m.completedParams,ze=m.actionableSuggestions,lt=ze[0],ut=(0,et.withoutTraditionalAutocomplete)(ze),Ve=De?.listboxId??"",dt=m.activeDropdownIndex>=0&&De?`${Ve}-option-${m.activeDropdownIndex}`:void 0,Se=m.editingParam,Ne=m.editingIdentified,$e=Se?{parameter:Se.suggestionParameter,text:Se.suggestionPlaceholder,required:!0,options:Se.options}:Ne?{parameter:Ne.parameter,text:(0,et.identifiedParamLabel)(Ne.parameter),required:!0,options:[]}:null,ot=m.dropdownSuggestion??$e??lt,ct=$e?[$e]:ze,Ze=(0,et.dateSelectionFor)(m),pt=!De||m.dropdownLoading;return{completedParams:Me,multiSelectView:m.multiSelectView,toggleMultiSelectOption:k.toggleMultiSelectOption,commitMultiSelect:k.commitMultiSelect,skippedParams:m.skippedParams,identifiedParams:m.identifiedParams,suggestionPills:ut,setActivePill:k.setActivePill,skipActivePill:k.skipActivePill,removeLastParam:k.removeLastParam,segments:m.segments,newParamId:m.newParamId,clearNewParamId:k.clearNewParamId,suggestions:m.suggestions,activeIndex:m.activeDropdownIndex,isReady:m.isReady,isLoading:pt,isFocused:m.isFocused,isDropdownOpen:m.isDropdownOpen,isActivePillSelected:m.isActivePillSelected,placeholderText:m.placeholderText,listboxId:Ve,error:m.error,products:m.products,customFields:m.customFields,selectProduct:k.selectProduct,addProductToCart:k.addProductToCart,handleTextChange:k.handleTextChange,handleKeyDown:k.handleKeyDown,setFocused:k.setFocused,editingParam:Se,editingIdentified:Ne,editingAnchor:m.editingAnchor,caretOffset:m.caretOffset,startEditingParam:k.startEditingParam,exitEditMode:k.exitEditMode,handleCaretAfterInput:k.handleCaretAfterInput,handleCaretMove:k.handleCaretMove,replaceEditingRange:k.replaceEditingRange,inputProps:{value:st,placeholder:m.placeholderText||void 0,onChange:n,onKeyDown:ne,onFocus:k.handleFocus,onBlur:k.handleBlur,role:"combobox","aria-expanded":m.isDropdownOpen,"aria-activedescendant":dt,"aria-autocomplete":"list","aria-controls":Ve},reset:k.reset,refreshProducts:k.refreshProducts,prepareSubmit:k.prepareSubmit,getState:k.getState,recordSubmit:k.recordSubmit,dropdownProps:{suggestions:ot?[{...ot,options:m.dropdownOptions}]:[],activeIndex:m.activeDropdownIndex,onSelect:k.selectOption,onHighlight:k.setActiveDropdownIndex,onUnhighlight:k.clearHighlight,isOpen:m.isDropdownOpen,id:Ve,pills:ct,activeSelected:m.isActivePillSelected,onPillClick:k.setActivePill,onSkip:k.skipActivePill,showSkipButton:(F??!0)&&!Se&&!Ne,showOptionIcons:N??!0,showOptionImages:te??!0,showOptionCounts:O??!0,skipDisabled:m.inSelectionAnimation,isLoading:pt,skeletonExiting:m.skeletonExiting,isInputEmpty:st.trim().length===0,language:d,products:m.products,productImageFallback:Q,onProductSelect:k.selectProduct,onProductAddToCart:c?k.addProductToCart:void 0,onProductFocusChange:k.setFocused,formatType:m.activeFormatType,dateView:m.dateView,selectedDateIso:Ze.selectedIso,selectedDateRange:Ze.selectedRange,dateRangeStart:Ze.rangeStart,onPreviousMonth:k.showPreviousMonth,onNextMonth:k.showNextMonth,timeView:m.timeView,multiSelectView:m.multiSelectView,onMultiSelectCommit:k.commitMultiSelect,onTimeChange:k.setTime,onTimeCommit:k.commitTime,locationView:m.locationView,isReediting:m.editingParam!=null,onLocationQuery:k.setLocationQuery,onLocationMove:k.moveLocationHighlight,onLocationCommit:k.commitLocation,onLocationFocusChange:k.setLocationFieldFocused,isFocused:m.isFocused||m.locationFieldFocused,optionsPosition:u??"below"}}}var le=require("@magicx-eng/ai-autocomplete-vanilla"),z=require("react"),Et;function ai(){if(Et!==void 0)return Et;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Et=e.contentEditable==="plaintext-only",Et}function fa(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:s,editingIdentified:r,editingAnchor:d,caretOffset:g,placeholderText:v,isFocused:y,isDropdownOpen:f,listboxId:p,activeDescendantId:u,autoFocus:x,handleTextChange:A,handleKeyDown:q,handleCaretAfterInput:H,handleCaretMove:N,startEditingParam:te,replaceEditingRange:O,setFocused:F}=e,T=(0,z.useRef)(null),Q=(0,z.useRef)(!1),ae=(0,z.useRef)(""),de=(0,z.useRef)(""),J=(0,z.useRef)(null),ee=(0,z.useRef)(0);J.current=g,(0,z.useEffect)(()=>{if(!x)return;let w=T.current;if(!w)return;document.activeElement===w?F(!0):w.focus();let S=w.ownerDocument??document,I=S.getSelection(),R=I&&I.rangeCount>0&&w.contains(I.anchorNode);if(I&&!R){let D=S.createRange();D.selectNodeContents(w),D.collapse(!0),I.removeAllRanges(),I.addRange(D)}},[x,F]),(0,z.useEffect)(()=>{let w=T.current;if(!w)return;let S=w.ownerDocument??document,I=()=>{let R=S.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!w.contains(R.anchorNode))return;let D=R.anchorNode,oe=D.nodeType===Node.ELEMENT_NODE?D:D.parentElement,ge=(R.isCollapsed?oe?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Re=s?.id??r?.id??null;if(ge&&ge!==Re){te(ge);return}performance.now()-ee.current<50||N((0,le.getCursorOffset)(w))};return S.addEventListener("selectionchange",I),()=>S.removeEventListener("selectionchange",I)},[s,r,te,N]),(0,z.useEffect)(()=>{let w=T.current;if(!w)return;let S=I=>{let R=(0,le.chipIdFromTap)(w,I.target);R&&(te(R),(0,le.keepCaretOnChip)(w,R))};return w.addEventListener("click",S),()=>w.removeEventListener("click",S)},[te]),(0,z.useLayoutEffect)(()=>{let w=T.current;w&&(0,le.renderEditableContent)({input:w,segments:a,newParamId:o,editingParamId:s?.id??null,placeholderText:v??"",isFocused:y,showChipIcons:t,showChipImages:i})},[a,o,s,v,y,t,i]),(0,z.useLayoutEffect)(()=>{let w=ae.current,S=o??"";if(ae.current=S,!S||S===w)return;let I=T.current;if(!I)return;I.focus();let R=J.current??(0,le.plainTextLength)(I);(0,le.setCursorOffset)(I,R)},[o]),(0,z.useLayoutEffect)(()=>{let w=de.current,S=s?.id??"";if(de.current=S,!S||S===w||d==null)return;let I=T.current;I&&(0,le.setCursorOffset)(I,d)},[s,d]);let P=(0,z.useCallback)(()=>{if(Q.current)return;let w=T.current;if(!w)return;let S=(0,le.extractPlainText)(w),R=S.length>0&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;A(R)},[A]),Y=(0,z.useCallback)(()=>{ee.current=performance.now(),P();let w=T.current;w&&H((0,le.getCursorOffset)(w))},[P,H]);(0,z.useEffect)(()=>{let w=T.current;if(!w)return;let S=I=>{let R=I,D=R.inputType;if(D==="insertParagraph"||D==="insertLineBreak"||D==="insertFromDrop"){I.preventDefault();return}if(D.startsWith("insert")||D.startsWith("delete")){let oe=D.startsWith("delete")?"":R.data??"";O(oe)&&I.preventDefault()}};return w.addEventListener("beforeinput",S),()=>w.removeEventListener("beforeinput",S)},[O]);let Ae=(0,z.useCallback)(()=>{Q.current=!0,T.current?.setAttribute("data-aia-composing","true")},[]),ke=(0,z.useCallback)(()=>{Q.current=!1,T.current?.removeAttribute("data-aia-composing"),P()},[P]),ve=(0,z.useCallback)(w=>{w.preventDefault();let S=T.current;if(!S)return;let I=(w.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let R=S.ownerDocument??document,D=R.getSelection();if(!D||D.rangeCount===0)return;let oe=D.getRangeAt(0);if(!S.contains(oe.startContainer))return;oe.deleteContents();let Ce=R.createTextNode(I);oe.insertNode(Ce),oe.setStartAfter(Ce),oe.collapse(!0),D.removeAllRanges(),D.addRange(oe),P()},[P]),c=(0,z.useCallback)(w=>q(w),[q]),E=(0,z.useCallback)(()=>F(!0),[F]),Ge=(0,z.useCallback)(()=>F(!1),[F]),b=(0,z.useCallback)(()=>T.current?.focus(),[]),tt=(0,z.useCallback)(()=>T.current?.blur(),[]),Qe=(0,z.useCallback)(()=>{let w=T.current;return w?(0,le.extractPlainText)(w):""},[]),Ye=ai()?"plaintext-only":"true";return{inputRef:T,editorProps:{ref:T,contentEditable:Ye,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":p,"aria-expanded":f,"aria-activedescendant":u,spellCheck:!0,enterKeyHint:"send",onInput:Y,onKeyDown:c,onCompositionStart:Ae,onCompositionEnd:ke,onPaste:ve,onFocus:E,onBlur:Ge},getPlainText:Qe,focus:b,blur:tt}}var Ee=require("react/jsx-runtime");function ii(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var ba=(0,U.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:d,additionalContext:g,language:v,currency:y,productId:f,visitorId:p,columns:u,pillPlacement:x="dropdown",mode:A="auto",optionsPosition:q="below",animations:H=!0,dropdownTrigger:N,closeDropdownOnBlur:te,prependPlaceholder:O,showNonTappableOptions:F,locationSearch:T,showOptionIcons:Q=!0,showChipIcons:ae=!0,showChipImages:de=!0,showOptionImages:J=!0,showOptionCounts:ee=!0,showSkipButton:P,showProducts:Y,productsLayout:Ae,productImageFallback:ke,autoFocus:ve=!0,onFocus:c,onBlur:E,value:Ge,completedParams:b,onChange:tt,onParamsChange:Qe,products:Ye,mapProducts:w,onProductSelect:S,onProductAddToCart:I,submitButton:R,resetOnSubmit:D=!0},oe){let Ce=(0,U.useRef)(null),ge=(0,U.useRef)(null),Re=(0,U.useRef)(null),je=(0,U.useRef)(()=>{}),Le=(0,U.useRef)(null),ce=(0,U.useRef)(null);(0,U.useEffect)(()=>{let W=Ce.current;if(W)return Le.current?Le.current.setMode(A):Le.current=new Ke.ModeController(W,A),()=>{Le.current?.destroy(),Le.current=null}},[A]);let at=(0,U.useCallback)(W=>{let fe=ce.current?.current;fe&&(fe.focus(),(0,Ke.setCursorOffset)(fe,W))},[]),{completedParams:ht,suggestionPills:qe,setActivePill:it,skipActivePill:rt,segments:_e,newParamId:pe,clearNewParamId:Oe,placeholderText:k,isFocused:n,isDropdownOpen:ne,isActivePillSelected:De,isLoading:m,isReady:st,activeIndex:Me,listboxId:ze,handleTextChange:lt,handleKeyDown:ut,setFocused:Ve,editingParam:dt,editingIdentified:Se,editingAnchor:Ne,caretOffset:$e,startEditingParam:ot,handleCaretAfterInput:ct,handleCaretMove:Ze,replaceEditingRange:pt,dropdownProps:h,reset:B,refreshProducts:C,prepareSubmit:vt,getState:Ht,recordSubmit:Bt}=It({onSubmit:W=>je.current(W),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:d,additionalContext:g,language:v,currency:y,productId:f,visitorId:p,columns:u,dropdownTrigger:N,optionsPosition:q,closeDropdownOnBlur:te,prependPlaceholder:O,showNonTappableOptions:F,locationSearch:T,showOptionIcons:Q,showOptionImages:J,showOptionCounts:ee,showSkipButton:P,showProducts:Y,onFocus:c,onBlur:E,value:Ge,completedParams:b,onChange:tt,onParamsChange:Qe,products:Ye,mapProducts:w,onProductSelect:S,onProductAddToCart:I,source:"full-sdk",setCursor:at});(0,U.useEffect)(()=>{if(!pe)return;let W=window.setTimeout(()=>Oe(),650);return()=>window.clearTimeout(W)},[pe,Oe]);let wa=Me>=0?`${ze}-option-${Me}`:void 0,{inputRef:At,editorProps:va,focus:xt,blur:Wt,getPlainText:Kt}=fa({segments:_e,newParamId:pe,editingParam:dt,editingIdentified:Se,editingAnchor:Ne,caretOffset:$e,placeholderText:k,isFocused:n,showChipIcons:ae,showChipImages:de,isDropdownOpen:ne,listboxId:ze,activeDescendantId:wa,autoFocus:ve,handleTextChange:lt,handleKeyDown:ut,handleCaretAfterInput:ct,handleCaretMove:Ze,startEditingParam:ot,replaceEditingRange:pt,setFocused:Ve});ce.current=At,(0,U.useLayoutEffect)(()=>{let W=ge.current,fe=At.current;if(!W||!fe)return;let gt=()=>{let qt=W.firstElementChild;if(!qt)return;let Ca=qt.getBoundingClientRect(),Sa=fe.getBoundingClientRect();Ca.top>=Sa.bottom-2?W.setAttribute("data-aia-pill-wrapped",""):W.removeAttribute("data-aia-pill-wrapped")};gt();let Gt=new ResizeObserver(gt);return Gt.observe(fe),()=>Gt.disconnect()},[_e,qe.length,m,At]),(0,U.useEffect)(()=>{let W=Re.current;if(W)return(0,Ke.watchEditorHeight)(W)},[]),(0,U.useImperativeHandle)(oe,()=>({focus:xt,blur:Wt,reset:B,refreshProducts:C,setMode:W=>Le.current?.setMode(W),skipActivePill:rt}),[xt,Wt,B,C,rt]);let mt=!!_e.length||ht.length>0,Rt=(0,U.useCallback)(W=>{if(!mt)return;W&&vt();let fe=Ht(),gt=(0,Ke.buildSubmitResult)(Kt(),fe.completedParams,fe.skippedParams,{identifiedParams:fe.identifiedParams,isReady:fe.isReady,customFields:fe.customFields});W&&Bt(gt),a(gt),D&&B()},[Bt,D,mt,vt,Ht,a,B,Kt]);je.current=()=>Rt(!1);let xa=(0,U.useCallback)(W=>{W.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||xt()},[xt]),ya=x==="inline",ka=x==="dropdown";return(0,Ee.jsxs)("div",{ref:Ce,className:`magicx-aia ${nt.container} ${r??""}`,"data-pill-placement":x,"data-options-position":q,"data-animations":H?"on":"off","data-mode":ii(A),children:[(0,Ee.jsx)(Tt,{...h,showPills:ka,productsLayout:Ae,productImageFallback:ke}),(0,Ee.jsxs)("div",{className:nt.inputWrapper,"data-aia-input-wrapper":"",onClick:xa,children:[(0,Ee.jsxs)("div",{ref:Re,className:nt.editorArea,"data-aia-editor":"",children:[(0,Ee.jsx)("div",{...va,className:nt.input,"data-aia-input":""}),ya&&(m||qe.length>0)&&(0,Ee.jsx)("span",{ref:ge,className:nt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ee.jsx)(Ct,{pills:qe,activePillIndex:0,activeSelected:De,onSelectPill:it,loading:m})})]}),R===null?null:R===void 0?(0,Ee.jsx)(ha,{disabled:!mt,ready:mt&&st,onClick:()=>Rt(!0),label:(0,Ke.uiStringsFor)(v).submit}):(0,Ee.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:nt.submitSlot,onClick:W=>{mt&&(W.stopPropagation(),Rt(!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});
|
|
3632
|
+
`,document.head.appendChild(e)}var pa={submitButton:"aia-submitButton-otz7H"};var Pt=require("react/jsx-runtime");function ua({disabled:e,ready:a,onClick:t,label:i=(0,ha.uiStringsFor)().submit}){return(0,Pt.jsx)("button",{type:"button","data-aia-submit":"",className:pa.submitButton,disabled:e,"data-aia-ready":a?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":i,children:(0,Pt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Pt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var tt=require("@magicx-eng/ai-autocomplete-vanilla"),R=require("react");var Nt=require("react");function ma(e){let a=(0,Nt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Nt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(d,m,v)=>{let k=a.current?.[s];return k?k(d,m,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var Ft=require("react");function ga(e){let a=(0,Ft.useRef)(e);a.current=e;let t=(0,Ft.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=a.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var fa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateFloor:null,timeView:null,multiSelectView: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 It({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:k,columns:f=2,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showOptionIcons:N,showOptionImages:ae,showOptionCounts:O,showSkipButton:F,showProducts:T,productImageFallback:Y="image",onFocus:ie,onBlur:ce,value:ee,completedParams:te,onChange:P,onParamsChange:Q,products:Ae,mapProducts:ke,onProductSelect:ve,onProductAddToCart:c,source:E,setCursor:Ge}){let b=(0,R.useRef)(null),[at,Ve]=(0,R.useState)(null),Ue=(0,R.useRef)(e);Ue.current=e;let w=(0,R.useRef)(a);w.current=a;let S=(0,R.useRef)(t);S.current=t;let I=(0,R.useRef)(P);I.current=P;let L=(0,R.useRef)(Q);L.current=Q;let z=(0,R.useRef)(ie);z.current=ie;let oe=(0,R.useRef)(ce);oe.current=ce;let Re=(0,R.useRef)(Ge);Re.current=Ge;let ge=(0,R.useRef)(ve);ge.current=ve;let Oe=(0,R.useRef)(c);Oe.current=c;let Ye=(0,R.useRef)(k);Ye.current=k;let st=(0,R.useRef)(()=>{let h=Ye.current;return typeof h=="function"?h():h}).current,j=ga(Ae),Qe=(0,R.useRef)(ke);Qe.current=ke;let pt=(0,R.useRef)((h,K)=>{let C=Qe.current;return C?C(h,K):h}).current,it=ke?pt:void 0,We=ma(i);(0,R.useEffect)(()=>{if(typeof document>"u")return;let h=new tt.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:st,optionOverrides:We.overrides,maskCompletedText:o,columns:f,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showProducts:T,source:E,value:ee,completedParams:te,onSubmit:(...C)=>Ue.current?.(...C),onResult:(...C)=>w.current?.(...C),onError:(...C)=>S.current?.(...C),onChange:(...C)=>I.current?.(...C),onParamsChange:(...C)=>L.current?.(...C),onFocus:()=>z.current?.(),onBlur:()=>oe.current?.(),onProductSelect:C=>ge.current?.(C),onProductAddToCart:C=>Oe.current?.(C),setCursor:C=>Re.current?.(C),products:j.config,mapProducts:it});b.current=h,Ve(h.getState());let K=h.subscribe(C=>Ve(C));return()=>{K(),h.destroy(),b.current===h&&(b.current=null)}},[]),(0,R.useEffect)(()=>{ee!==void 0&&b.current?.setValue(ee)},[ee]),(0,R.useEffect)(()=>{te!==void 0&&b.current?.setCompletedParams(te)},[te]);let ht=JSON.stringify(s??null),je;try{je=JSON.stringify(r??null)}catch{je="[unstringifiable]"}(0,R.useEffect)(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,optionOverrides:We.overrides,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showProducts:T})},[ht,je,d,m?.code,m?.rate,m?.country,v,We.key,p,u,x,A,q,H,T]);let pe=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(!pe.current){pe.current=!0;return}b.current?.update({products:j.config})},[j.enabled]),(0,R.useEffect)(()=>{b.current?.update({mapProducts:it})},[it]);let Ce=(0,R.useRef)(null);Ce.current===null&&(Ce.current={handleTextChange:h=>b.current?.handleTextChange(h),handleKeyDown:h=>{let K="nativeEvent"in h?h.nativeEvent:h;b.current?.handleKeyDown(K)},setFocused:h=>b.current?.setFocused(h),startEditingParam:h=>b.current?.startEditingParam(h),exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:h=>b.current?.handleCaretAfterInput(h),handleCaretMove:h=>b.current?.handleCaretMove(h),replaceEditingRange:h=>b.current?.replaceEditingRange(h)??!1,setActivePill:h=>b.current?.setActivePill(h),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()??fa,recordSubmit:h=>b.current?.recordSubmit(h),selectOption:(h,K)=>b.current?.selectOption(h,K),selectProduct:h=>b.current?.selectProduct(h),addProductToCart:h=>{let K=b.current;return!K||!Oe.current?Promise.resolve():K.addProductToCart(h)},setActiveDropdownIndex:h=>b.current?.setActiveDropdownIndex(h),clearHighlight:h=>b.current?.clearHighlight(h),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:h=>b.current?.setTime(h),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:h=>b.current?.toggleMultiSelectOption(h),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:h=>b.current?.setLocationQuery(h),moveLocationHighlight:h=>b.current?.moveLocationHighlight(h),commitLocation:h=>b.current?.commitLocation(h),setLocationFieldFocused:h=>b.current?.setLocationFieldFocused(h),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let y=Ce.current,n=(0,R.useCallback)(h=>{let K=h.target.value,vt=K.length>0&&!h.nativeEvent?.isComposing&&K[0]!==K[0].toUpperCase()?K[0].toUpperCase()+K.slice(1):K;b.current?.handleTextChange(vt)},[]),re=(0,R.useCallback)(h=>{b.current?.handleKeyDown(h.nativeEvent)},[]),Le=b.current,g=at??fa,$e=ee!==void 0?ee:g.text,Ke=te!==void 0?te:g.completedParams,ze=g.actionableSuggestions,ot=ze[0],ut=(0,tt.withoutTraditionalAutocomplete)(ze),qe=Le?.listboxId??"",lt=g.activeDropdownIndex>=0&&Le?`${qe}-option-${g.activeDropdownIndex}`:void 0,Se=g.editingParam,De=g.editingIdentified,Ze=Se?{parameter:Se.suggestionParameter,text:Se.suggestionPlaceholder,required:!0,options:Se.options}:De?{parameter:De.parameter,text:(0,tt.identifiedParamLabel)(De.parameter),required:!0,options:[]}:null,nt=g.dropdownSuggestion??Ze??ot,dt=Ze?[Ze]:ze,Xe=(0,tt.dateSelectionFor)(g),ct=!Le||g.dropdownLoading;return{completedParams:Ke,multiSelectView:g.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:g.skippedParams,identifiedParams:g.identifiedParams,suggestionPills:ut,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:g.segments,newParamId:g.newParamId,clearNewParamId:y.clearNewParamId,suggestions:g.suggestions,activeIndex:g.activeDropdownIndex,isReady:g.isReady,isLoading:ct,isFocused:g.isFocused,isDropdownOpen:g.isDropdownOpen,isActivePillSelected:g.isActivePillSelected,placeholderText:g.placeholderText,listboxId:qe,error:g.error,products:g.products,customFields:g.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Se,editingIdentified:De,editingAnchor:g.editingAnchor,caretOffset:g.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:$e,placeholder:g.placeholderText||void 0,onChange:n,onKeyDown:re,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":g.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":qe},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:nt?[{...nt,options:g.dropdownOptions}]:[],activeIndex:g.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:g.isDropdownOpen,id:qe,pills:dt,activeSelected:g.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(F??!0)&&!Se&&!De,showOptionIcons:N??!0,showOptionImages:ae??!0,showOptionCounts:O??!0,skipDisabled:g.inSelectionAnimation,isLoading:ct,skeletonExiting:g.skeletonExiting,isInputEmpty:$e.trim().length===0,language:d,products:g.products,productImageFallback:Y,onProductSelect:y.selectProduct,onProductAddToCart:c?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:g.activeFormatType,dateView:g.dateView,selectedDateIso:Xe.selectedIso,selectedDateRange:Xe.selectedRange,dateRangeStart:Xe.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:g.timeView,multiSelectView:g.multiSelectView,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:g.locationView,isReediting:g.editingParam!=null,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:g.isFocused||g.locationFieldFocused,optionsPosition:u??"below"}}}var de=require("@magicx-eng/ai-autocomplete-vanilla"),M=require("react"),Et;function ii(){if(Et!==void 0)return Et;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Et=e.contentEditable==="plaintext-only",Et}function ba(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:s,editingIdentified:r,editingAnchor:d,caretOffset:m,placeholderText:v,isFocused:k,isDropdownOpen:f,listboxId:p,activeDescendantId:u,autoFocus:x,handleTextChange:A,handleKeyDown:q,handleCaretAfterInput:H,handleCaretMove:N,startEditingParam:ae,replaceEditingRange:O,setFocused:F}=e,T=(0,M.useRef)(null),Y=(0,M.useRef)(!1),ie=(0,M.useRef)(""),ce=(0,M.useRef)(""),ee=(0,M.useRef)(null),te=(0,M.useRef)(0);ee.current=m,(0,M.useEffect)(()=>{if(!x)return;let w=T.current;if(!w)return;document.activeElement===w?F(!0):w.focus();let S=w.ownerDocument??document,I=S.getSelection(),L=I&&I.rangeCount>0&&w.contains(I.anchorNode);if(I&&!L){let z=S.createRange();z.selectNodeContents(w),z.collapse(!0),I.removeAllRanges(),I.addRange(z)}},[x,F]),(0,M.useEffect)(()=>{let w=T.current;if(!w)return;let S=w.ownerDocument??document,I=()=>{let L=S.getSelection();if(!L||L.rangeCount===0||!L.anchorNode||!w.contains(L.anchorNode))return;let z=L.anchorNode,oe=z.nodeType===Node.ELEMENT_NODE?z:z.parentElement,ge=(L.isCollapsed?oe?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Oe=s?.id??r?.id??null;if(ge&&ge!==Oe){ae(ge);return}performance.now()-te.current<50||N((0,de.getCursorOffset)(w))};return S.addEventListener("selectionchange",I),()=>S.removeEventListener("selectionchange",I)},[s,r,ae,N]),(0,M.useEffect)(()=>{let w=T.current;if(!w)return;let S=I=>{let L=(0,de.chipIdFromTap)(w,I.target);L&&(ae(L),(0,de.keepCaretOnChip)(w,L))};return w.addEventListener("click",S),()=>w.removeEventListener("click",S)},[ae]),(0,M.useLayoutEffect)(()=>{let w=T.current;w&&(0,de.renderEditableContent)({input:w,segments:a,newParamId:o,editingParamId:s?.id??null,placeholderText:v??"",isFocused:k,showChipIcons:t,showChipImages:i})},[a,o,s,v,k,t,i]),(0,M.useLayoutEffect)(()=>{let w=ie.current,S=o??"";if(ie.current=S,!S||S===w)return;let I=T.current;if(!I)return;I.focus();let L=ee.current??(0,de.plainTextLength)(I);(0,de.setCursorOffset)(I,L)},[o]),(0,M.useLayoutEffect)(()=>{let w=ce.current,S=s?.id??"";if(ce.current=S,!S||S===w||d==null)return;let I=T.current;I&&(0,de.setCursorOffset)(I,d)},[s,d]);let P=(0,M.useCallback)(()=>{if(Y.current)return;let w=T.current;if(!w)return;let S=(0,de.extractPlainText)(w),L=S.length>0&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;A(L)},[A]),Q=(0,M.useCallback)(()=>{te.current=performance.now(),P();let w=T.current;w&&H((0,de.getCursorOffset)(w))},[P,H]);(0,M.useEffect)(()=>{let w=T.current;if(!w)return;let S=I=>{let L=I,z=L.inputType;if(z==="insertParagraph"||z==="insertLineBreak"||z==="insertFromDrop"){I.preventDefault();return}if(z.startsWith("insert")||z.startsWith("delete")){let oe=z.startsWith("delete")?"":L.data??"";O(oe)&&I.preventDefault()}};return w.addEventListener("beforeinput",S),()=>w.removeEventListener("beforeinput",S)},[O]);let Ae=(0,M.useCallback)(()=>{Y.current=!0,T.current?.setAttribute("data-aia-composing","true")},[]),ke=(0,M.useCallback)(()=>{Y.current=!1,T.current?.removeAttribute("data-aia-composing"),P()},[P]),ve=(0,M.useCallback)(w=>{w.preventDefault();let S=T.current;if(!S)return;let I=(w.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let L=S.ownerDocument??document,z=L.getSelection();if(!z||z.rangeCount===0)return;let oe=z.getRangeAt(0);if(!S.contains(oe.startContainer))return;oe.deleteContents();let Re=L.createTextNode(I);oe.insertNode(Re),oe.setStartAfter(Re),oe.collapse(!0),z.removeAllRanges(),z.addRange(oe),P()},[P]),c=(0,M.useCallback)(w=>q(w),[q]),E=(0,M.useCallback)(()=>F(!0),[F]),Ge=(0,M.useCallback)(()=>F(!1),[F]),b=(0,M.useCallback)(()=>T.current?.focus(),[]),at=(0,M.useCallback)(()=>T.current?.blur(),[]),Ve=(0,M.useCallback)(()=>{let w=T.current;return w?(0,de.extractPlainText)(w):""},[]),Ue=ii()?"plaintext-only":"true";return{inputRef:T,editorProps:{ref:T,contentEditable:Ue,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":p,"aria-expanded":f,"aria-activedescendant":u,spellCheck:!0,enterKeyHint:"send",onInput:Q,onKeyDown:c,onCompositionStart:Ae,onCompositionEnd:ke,onPaste:ve,onFocus:E,onBlur:Ge},getPlainText:Ve,focus:b,blur:at}}var Ee=require("react/jsx-runtime");function oi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var wa=(0,U.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:d,additionalContext:m,language:v,currency:k,productId:f,visitorId:p,columns:u,pillPlacement:x="dropdown",mode:A="auto",optionsPosition:q="below",animations:H=!0,optionsStyle:N="floating",dropdownTrigger:ae,closeDropdownOnBlur:O,prependPlaceholder:F,showNonTappableOptions:T,locationSearch:Y,showOptionIcons:ie=!0,showChipIcons:ce=!0,showChipImages:ee=!0,showOptionImages:te=!0,showOptionCounts:P=!0,showSkipButton:Q,showProducts:Ae,productsLayout:ke,productImageFallback:ve,autoFocus:c=!0,onFocus:E,onBlur:Ge,value:b,completedParams:at,onChange:Ve,onParamsChange:Ue,products:w,mapProducts:S,onProductSelect:I,onProductAddToCart:L,submitButton:z,resetOnSubmit:oe=!0},Re){let ge=(0,U.useRef)(null),Oe=(0,U.useRef)(null),Ye=(0,U.useRef)(null),st=(0,U.useRef)(()=>{}),j=(0,U.useRef)(null),Qe=(0,U.useRef)(null);(0,U.useEffect)(()=>{let B=ge.current;if(B)return j.current?j.current.setMode(A):j.current=new Be.ModeController(B,A),()=>{j.current?.destroy(),j.current=null}},[A]);let pt=(0,U.useCallback)(B=>{let fe=Qe.current?.current;fe&&(fe.focus(),(0,Be.setCursorOffset)(fe,B))},[]),{completedParams:it,suggestionPills:We,setActivePill:ht,skipActivePill:je,segments:pe,newParamId:Ce,clearNewParamId:y,placeholderText:n,isFocused:re,isDropdownOpen:Le,isActivePillSelected:g,isLoading:$e,isReady:Ke,activeIndex:ze,listboxId:ot,handleTextChange:ut,handleKeyDown:qe,setFocused:lt,editingParam:Se,editingIdentified:De,editingAnchor:Ze,caretOffset:nt,startEditingParam:dt,handleCaretAfterInput:Xe,handleCaretMove:ct,replaceEditingRange:h,dropdownProps:K,reset:C,refreshProducts:vt,prepareSubmit:Ht,getState:Bt,recordSubmit:Gt}=It({onSubmit:B=>st.current(B),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:d,additionalContext:m,language:v,currency:k,productId:f,visitorId:p,columns:u,dropdownTrigger:ae,optionsPosition:q,closeDropdownOnBlur:O,prependPlaceholder:F,showNonTappableOptions:T,locationSearch:Y,showOptionIcons:ie,showOptionImages:te,showOptionCounts:P,showSkipButton:Q,showProducts:Ae,onFocus:E,onBlur:Ge,value:b,completedParams:at,onChange:Ve,onParamsChange:Ue,products:w,mapProducts:S,onProductSelect:I,onProductAddToCart:L,source:"full-sdk",setCursor:pt});(0,U.useEffect)(()=>{if(!Ce)return;let B=window.setTimeout(()=>y(),650);return()=>window.clearTimeout(B)},[Ce,y]);let va=ze>=0?`${ot}-option-${ze}`:void 0,{inputRef:At,editorProps:xa,focus:xt,blur:Wt,getPlainText:Kt}=ba({segments:pe,newParamId:Ce,editingParam:Se,editingIdentified:De,editingAnchor:Ze,caretOffset:nt,placeholderText:n,isFocused:re,showChipIcons:ce,showChipImages:ee,isDropdownOpen:Le,listboxId:ot,activeDescendantId:va,autoFocus:c,handleTextChange:ut,handleKeyDown:qe,handleCaretAfterInput:Xe,handleCaretMove:ct,startEditingParam:dt,replaceEditingRange:h,setFocused:lt});Qe.current=At,(0,U.useLayoutEffect)(()=>{let B=Oe.current,fe=At.current;if(!B||!fe)return;let gt=()=>{let _t=B.firstElementChild;if(!_t)return;let Sa=_t.getBoundingClientRect(),Ta=fe.getBoundingClientRect();Sa.top>=Ta.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};gt();let qt=new ResizeObserver(gt);return qt.observe(fe),()=>qt.disconnect()},[pe,We.length,$e,At]),(0,U.useEffect)(()=>{let B=Ye.current;if(B)return(0,Be.watchEditorHeight)(B)},[]),(0,U.useImperativeHandle)(Re,()=>({focus:xt,blur:Wt,reset:C,refreshProducts:vt,setMode:B=>j.current?.setMode(B),skipActivePill:je}),[xt,Wt,C,vt,je]);let mt=!!pe.length||it.length>0,Rt=(0,U.useCallback)(B=>{if(!mt)return;B&&Ht();let fe=Bt(),gt=(0,Be.buildSubmitResult)(Kt(),fe.completedParams,fe.skippedParams,{identifiedParams:fe.identifiedParams,isReady:fe.isReady,customFields:fe.customFields});B&&Gt(gt),a(gt),oe&&C()},[Gt,oe,mt,Ht,Bt,a,C,Kt]);st.current=()=>Rt(!1);let ya=(0,U.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||xt()},[xt]),ka=x==="inline",Ca=x==="dropdown";return(0,Ee.jsxs)("div",{ref:ge,className:`magicx-aia ${rt.container} ${r??""}`,"data-pill-placement":x,"data-options-position":q,"data-animations":H?"on":"off","data-aia-options-style":N,"data-mode":oi(A),children:[(0,Ee.jsx)(Tt,{...K,showPills:Ca,productsLayout:ke,productImageFallback:ve}),(0,Ee.jsxs)("div",{className:rt.inputWrapper,"data-aia-input-wrapper":"",onClick:ya,children:[(0,Ee.jsxs)("div",{ref:Ye,className:rt.editorArea,"data-aia-editor":"",children:[(0,Ee.jsx)("div",{...xa,className:rt.input,"data-aia-input":""}),ka&&($e||We.length>0)&&(0,Ee.jsx)("span",{ref:Oe,className:rt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ee.jsx)(Ct,{pills:We,activePillIndex:0,activeSelected:g,onSelectPill:ht,loading:$e})})]}),z===null?null:z===void 0?(0,Ee.jsx)(ua,{disabled:!mt,ready:mt&&Ke,onClick:()=>Rt(!0),label:(0,Be.uiStringsFor)(v).submit}):(0,Ee.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:rt.submitSlot,onClick:B=>{mt&&(B.stopPropagation(),Rt(!0))},children:z})]})]})});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});
|
|
3333
3633
|
//# sourceMappingURL=index.js.map
|