@magicx-eng/ai-autocomplete-react 0.43.0 → 0.44.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 +34 -5
- package/dist/index.d.mts +46 -3
- package/dist/index.d.ts +46 -3
- package/dist/index.js +124 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +124 -13
- 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 yt=Object.defineProperty;var la=Object.getOwnPropertyDescriptor;var da=Object.getOwnPropertyNames;var ca=Object.prototype.hasOwnProperty;var pa=(e,i)=>{for(var t in i)yt(e,t,{get:i[t],enumerable:!0})},ha=(e,i,t,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of da(i))!ca.call(e,o)&&o!==t&&yt(e,o,{get:()=>i[o],enumerable:!(a=la(i,o))||a.enumerable});return e};var ua=e=>ha(yt({},"__esModule",{value:!0}),e);var Aa={};pa(Aa,{AIAutocomplete:()=>ea,AIAutocompleteDropdown:()=>pt,DATE_RANGE_META_END:()=>s.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>s.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>s.DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX:()=>s.PRODUCT_PATH_PREFIX,WEEKDAY_LABELS:()=>s.WEEKDAY_LABELS,buildSubmitResult:()=>s.buildSubmitResult,cellDay:()=>s.cellDay,cellIso:()=>s.cellIso,dateCellMarks:()=>s.dateCellMarks,formatDate:()=>s.formatDate,formatDateRange:()=>s.formatDateRange,formatOptionCount:()=>s.formatOptionCount,isoDate:()=>s.isoDate,monthLabel:()=>s.monthLabel,optionCountLabel:()=>s.optionCountLabel,optionHasImage:()=>s.optionHasImage,optionImageSources:()=>s.optionImageSources,optionImageSrc:()=>s.optionImageSrc,optionLabel:()=>s.optionLabel,optionsShowLeadingVisuals:()=>s.optionsShowLeadingVisuals,parseDate:()=>s.parseDate,parseLooseDate:()=>s.parseLooseDate,parseLooseDateRange:()=>s.parseLooseDateRange,productFromMatchedItem:()=>s.productFromMatchedItem,productImageSources:()=>s.productImageSources,productsFromCustomFields:()=>s.productsFromCustomFields,sanitizeOptionIconSvg:()=>s.sanitizeOptionIconSvg,selectedRangeFor:()=>s.selectedRangeFor,useAIAutocomplete:()=>ut,visibleDateRange:()=>s.visibleDateRange,withSkippedParams:()=>s.withSkippedParams});module.exports=ua(Aa);var s=require("@magicx-eng/ai-autocomplete-vanilla");var G=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
|
|
2
2
|
position: relative;
|
|
3
3
|
/* Inherits the host page's font by default. Consumers can pin a specific
|
|
4
4
|
font on the library via \`--aia-font-family: 'Custom Font'\` without
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
opacity: 0;
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
-
`,document.head.appendChild(e)}var
|
|
283
|
+
`,document.head.appendChild(e)}var Ve={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaPillReveal:"aia-aiaPillReveal-wf05b"};var re=require("@magicx-eng/ai-autocomplete-vanilla"),Q=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
284
284
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
285
285
|
* Consumer CSS always wins without !important.
|
|
286
286
|
*
|
|
@@ -1132,7 +1132,7 @@
|
|
|
1132
1132
|
opacity: 0.25;
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
|
-
`,document.head.appendChild(e)}var
|
|
1135
|
+
`,document.head.appendChild(e)}var Te={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q"};var B=require("@magicx-eng/ai-autocomplete-vanilla"),Ot=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
|
|
1136
1136
|
|
|
1137
1137
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1138
1138
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1295,7 +1295,7 @@
|
|
|
1295
1295
|
opacity: 0.8;
|
|
1296
1296
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1297
1297
|
}
|
|
1298
|
-
`,document.head.appendChild(e)}var
|
|
1298
|
+
`,document.head.appendChild(e)}var H={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 ne=require("react/jsx-runtime"),ma=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Lt({options:e,activeIndex:i,listboxId:t,view:a,selection:o,onSelect:r,onHighlight:n,onUnhighlight:h,onPreviousMonth:m,onNextMonth:g}){let w=(0,B.isoDate)(new Date),C=(0,B.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,B.cellIso)(e[i]),selected:o.selectedRange});return(0,ne.jsxs)("div",{className:H.datepicker,"data-aia-datepicker":"",children:[(0,ne.jsxs)("div",{className:H.header,children:[(0,ne.jsx)("button",{type:"button",tabIndex:-1,className:H.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:d=>d.preventDefault(),onClick:m,children:"\u2039"}),(0,ne.jsx)("span",{className:H.month,"data-aia-date-month":"","aria-live":"polite",children:(0,B.monthLabel)(a)}),(0,ne.jsx)("button",{type:"button",tabIndex:-1,className:H.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:d=>d.preventDefault(),onClick:g,children:"\u203A"})]}),(0,ne.jsx)("div",{className:H.weekdays,"aria-hidden":"true",children:B.WEEKDAY_LABELS.map((d,v)=>(0,ne.jsx)("span",{className:H.weekday,children:d},ma[v]))}),(0,ne.jsx)("div",{className:H.grid,"data-aia-date-grid":"",children:e.map((d,v)=>(0,ne.jsx)(ga,{option:d,id:`${t}-option-${v}`,index:v,isHighlighted:v===i&&d.is_tappable,isToday:(0,B.cellIso)(d)===w,isPast:(0,B.cellIso)(d)!=null&&(0,B.cellIso)(d)<w,marks:(0,B.dateCellMarks)((0,B.cellIso)(d),{selectedIso:o.selectedIso,range:C}),onSelect:r,onHighlight:n,onUnhighlight:h},(0,B.cellIso)(d)??`pad-${v}`))})]})}function ga({option:e,id:i,index:t,isHighlighted:a,isToday:o,isPast:r,marks:n,onSelect:h,onHighlight:m,onUnhighlight:g}){let[w,C]=(0,Ot.useState)(!1),d=(0,B.cellDay)(e);if(d==null)return(0,ne.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${H.cell} ${H.blank}`});let v=()=>{C(!0),h(e),setTimeout(()=>C(!1),170)},l=[H.cell,H.day,r?H.past:"",a?H.highlighted:"",o?H.today:"",n.inRange?H.inRange:"",n.selected?H.selected:"",w?H.pressed:""].filter(Boolean).join(" ");return(0,ne.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:l,onClick:v,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),v())},onMouseEnter:()=>m(t),onMouseLeave:g?()=>g(t):void 0,children:(0,ne.jsx)("span",{className:H.number,children:d})})}var He=require("@magicx-eng/ai-autocomplete-vanilla"),st=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
|
|
1299
1299
|
display: flex;
|
|
1300
1300
|
flex-wrap: wrap;
|
|
1301
1301
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1335,7 +1335,7 @@
|
|
|
1335
1335
|
.aia-cluster[data-justify="around"] {
|
|
1336
1336
|
justify-content: space-around;
|
|
1337
1337
|
}
|
|
1338
|
-
`,document.head.appendChild(e)}var
|
|
1338
|
+
`,document.head.appendChild(e)}var kt=require("react/jsx-runtime");function tt({gap:e,align:i="center",justify:t="start",noWrap:a=!1,inline:o=!1,className:r,children:n,...h}){let m=e?{"--aia-cluster-gap":e}:void 0,g={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":i,"data-justify":t,"data-nowrap":a||void 0,"data-inline":o||void 0,style:m,...h};return o?(0,kt.jsx)("span",{...g,children:n}):(0,kt.jsx)("div",{...g,children:n})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
|
|
1339
1339
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1340
1340
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1341
1341
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -1482,7 +1482,7 @@
|
|
|
1482
1482
|
justify-content: flex-end;
|
|
1483
1483
|
}
|
|
1484
1484
|
}
|
|
1485
|
-
`,document.head.appendChild(e)}var
|
|
1485
|
+
`,document.head.appendChild(e)}var Ie={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var ve=require("react/jsx-runtime");function zt({isOptionHighlighted:e=!1,isInputEmpty:i=!1,strings:t=(0,He.uiStringsFor)()}){let{key:a,hint:o}=(0,He.getFooterHint)(e,i,t),[r,n]=(0,st.useState)(He.ATTRIBUTION_URL);return(0,st.useEffect)(()=>{n((0,He.buildAttributionUrl)())},[]),(0,ve.jsx)("footer",{className:Ie.footer,"data-aia-footer":"",children:(0,ve.jsxs)(tt,{justify:"between",noWrap:!0,className:Ie.row,children:[(0,ve.jsxs)(tt,{gap:"5px",className:Ie.hintGroup,children:[(0,ve.jsx)("kbd",{className:Ie.key,children:a}),(0,ve.jsx)("span",{className:Ie.hint,children:o})]}),(0,ve.jsxs)("a",{className:Ie.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[(0,ve.jsx)("span",{className:Ie.brand,children:"AI"}),(0,ve.jsx)("span",{className:Ie.badge,children:"Autocomplete"})]})]})})}var lt=require("@magicx-eng/ai-autocomplete-vanilla");var Mt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
|
|
1486
1486
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
1487
1487
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
1488
1488
|
as it was when the outline was dashed. */
|
|
@@ -1662,7 +1662,7 @@
|
|
|
1662
1662
|
opacity: 0;
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
|
-
`,document.head.appendChild(e)}var
|
|
1665
|
+
`,document.head.appendChild(e)}var xe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var Be=require("react/jsx-runtime"),Ct={selected:1,first:.7,next:.4,last:.2};function Nt({label:e,state:i,rounded:t,loading:a,smartSuggestion:o,completionHeader:r,onClick:n}){let h=[xe.pill,t?xe.rounded:"",a?xe.skeleton:""].filter(Boolean).join(" ");return(0,Be.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":a?"":void 0,"data-aia-smart-suggestion":o?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:h,style:{opacity:Ct[i]},onMouseDown:m=>m.preventDefault(),onClick:a?void 0:n,disabled:a,children:o?(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)("span",{className:`${xe.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,Be.jsx)("span",{className:`${xe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Mt.SMART_SUGGESTION_SPARKLE_SVG}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
|
|
1666
1666
|
position: relative;
|
|
1667
1667
|
z-index: 1;
|
|
1668
1668
|
pointer-events: auto;
|
|
@@ -1672,7 +1672,7 @@
|
|
|
1672
1672
|
align-items: center;
|
|
1673
1673
|
vertical-align: middle;
|
|
1674
1674
|
}
|
|
1675
|
-
`,document.head.appendChild(e)}var
|
|
1675
|
+
`,document.head.appendChild(e)}var St={list:"aia-list-qvLqO"};var at=require("react/jsx-runtime"),fa=[125,69];function Ft(e){return e===0?"first":e===1?"next":"last"}function dt({pills:e,activePillIndex:i,onSelectPill:t,activeSelected:a,rounded:o,loading:r}){return r&&e.length===0?(0,at.jsx)("span",{className:St.list,"data-aia-pill-list-loading":"",children:fa.map((n,h)=>(0,at.jsx)("span",{"data-aia-pill-skeleton":"",className:`${xe.pill} ${o?xe.rounded:""} ${xe.skeleton}`,style:{width:n,opacity:Ct[Ft(h)]}},`skel-${n}`))}):(0,at.jsx)("span",{className:St.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((n,h)=>{let m=!!a&&h===i;return(0,at.jsx)(Nt,{label:n.text,state:m?"selected":Ft(h),selected:m,rounded:o,loading:r,smartSuggestion:(0,lt.isSmartSuggestion)(n),completionHeader:(0,lt.isTraditionalAutocompleteSuggestion)(n),onClick:()=>t(h)},`${n.parameter}-${n.text}`)})})}var ce=require("@magicx-eng/ai-autocomplete-vanilla"),Z=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
|
|
1676
1676
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
1677
1677
|
theming one package sees the same result in the other.
|
|
1678
1678
|
|
|
@@ -1911,6 +1911,101 @@
|
|
|
1911
1911
|
pointer-events: none;
|
|
1912
1912
|
}
|
|
1913
1913
|
|
|
1914
|
+
/* Add-to-cart button (\`onProductAddToCart\`). A child of the card, lifted
|
|
1915
|
+
over the bottom right corner of the square media tile: the tile starts
|
|
1916
|
+
below the card's 6px padding and is the card's width less both paddings
|
|
1917
|
+
wide, so its bottom edge is the card width less 6px down, and the button
|
|
1918
|
+
sits 6px inside that corner. A light disc with a dark glyph, like the
|
|
1919
|
+
sold-out chip, reads on any photo; a store's accent goes in through the
|
|
1920
|
+
tokens. */
|
|
1921
|
+
.aia-cart-kSlqU {
|
|
1922
|
+
position: absolute;
|
|
1923
|
+
/* The tile's corner moved in by the margin a photo leaves when it doesn't
|
|
1924
|
+
fill the square (--aia-product-photo-fill-x / -y, set on the card when
|
|
1925
|
+
the photo loads; 1, the tile's own corner, until then). */
|
|
1926
|
+
top: calc(
|
|
1927
|
+
var(--aia-product-card-width, 116px) -
|
|
1928
|
+
12px -
|
|
1929
|
+
var(--aia-product-cart-size, 28px) -
|
|
1930
|
+
(var(--aia-product-card-width, 116px) - 12px) *
|
|
1931
|
+
(1 - var(--aia-product-photo-fill-y, 1)) /
|
|
1932
|
+
2
|
|
1933
|
+
);
|
|
1934
|
+
right: calc(
|
|
1935
|
+
12px +
|
|
1936
|
+
(var(--aia-product-card-width, 116px) - 12px) *
|
|
1937
|
+
(1 - var(--aia-product-photo-fill-x, 1)) /
|
|
1938
|
+
2
|
|
1939
|
+
);
|
|
1940
|
+
display: flex;
|
|
1941
|
+
align-items: center;
|
|
1942
|
+
justify-content: center;
|
|
1943
|
+
width: var(--aia-product-cart-size, 28px);
|
|
1944
|
+
height: var(--aia-product-cart-size, 28px);
|
|
1945
|
+
border-radius: 999px;
|
|
1946
|
+
background: var(--aia-product-cart-bg, rgba(255, 255, 255, 0.94));
|
|
1947
|
+
color: var(--aia-product-cart-color, #1f2328);
|
|
1948
|
+
box-shadow:
|
|
1949
|
+
0 0 0 1px rgba(0, 0, 0, 0.08),
|
|
1950
|
+
0 1px 3px rgba(0, 0, 0, 0.22);
|
|
1951
|
+
cursor: pointer;
|
|
1952
|
+
transition:
|
|
1953
|
+
transform 150ms ease,
|
|
1954
|
+
opacity 150ms ease;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
.aia-cart-kSlqU:hover {
|
|
1958
|
+
transform: scale(1.08);
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
.aia-cart-kSlqU:focus-visible {
|
|
1962
|
+
outline: 2px solid var(--aia-product-focus-ring, var(--aia-option-color-selected, currentColor));
|
|
1963
|
+
outline-offset: 2px;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
.aia-cart-kSlqU svg {
|
|
1967
|
+
display: block;
|
|
1968
|
+
width: 16px;
|
|
1969
|
+
height: 16px;
|
|
1970
|
+
fill: none;
|
|
1971
|
+
stroke: currentColor;
|
|
1972
|
+
stroke-width: 2;
|
|
1973
|
+
stroke-linecap: round;
|
|
1974
|
+
stroke-linejoin: round;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
/* The glyph's shapes carry no paint attributes of their own, so a page's
|
|
1978
|
+
\`path { \u2026 }\` / \`circle { \u2026 }\` would beat what they inherit from the svg;
|
|
1979
|
+
pin it by class, like the submit arrow's. */
|
|
1980
|
+
.aia-cart-kSlqU svg path {
|
|
1981
|
+
fill: none;
|
|
1982
|
+
stroke: currentColor;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
.aia-cart-kSlqU svg circle {
|
|
1986
|
+
fill: none;
|
|
1987
|
+
stroke: currentColor;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
.aia-cartCheck-YTTQ6 {
|
|
1991
|
+
display: none;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
/* While the integration's promise is in flight the button dims and ignores
|
|
1995
|
+
presses; once it resolves the cart turns into a check for a moment. */
|
|
1996
|
+
.aia-cart-kSlqU[data-aia-cart-state="adding"] {
|
|
1997
|
+
opacity: 0.6;
|
|
1998
|
+
cursor: progress;
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
.aia-cart-kSlqU[data-aia-cart-state="added"] .aia-cartGlyph-cmqAk {
|
|
2002
|
+
display: none;
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
.aia-cart-kSlqU[data-aia-cart-state="added"] .aia-cartCheck-YTTQ6 {
|
|
2006
|
+
display: inline;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
1914
2009
|
/* A sold-out product's image steps back, so the badge is not the only cue.
|
|
1915
2010
|
Desaturated rather than faded: opacity lets the panel show through, which
|
|
1916
2011
|
muddies a photo on a dark surface. */
|
|
@@ -1975,7 +2070,23 @@
|
|
|
1975
2070
|
letter-spacing: 0.02em;
|
|
1976
2071
|
text-align: center;
|
|
1977
2072
|
}
|
|
1978
|
-
|
|
2073
|
+
|
|
2074
|
+
/* In a list the button rides the row's right end, centred, and the text
|
|
2075
|
+
column stops short of it. */
|
|
2076
|
+
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-cart-kSlqU {
|
|
2077
|
+
top: 50%;
|
|
2078
|
+
right: 8px;
|
|
2079
|
+
transform: translateY(-50%);
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-cart-kSlqU:hover {
|
|
2083
|
+
transform: translateY(-50%) scale(1.08);
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT[data-aia-product-has-cart] {
|
|
2087
|
+
padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
|
|
2088
|
+
}
|
|
2089
|
+
`,document.head.appendChild(e)}var W={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk"};var O=require("react/jsx-runtime");function Ht({products:e,listboxId:i,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r=!0,layout:n="row",imageFallback:h="image",strings:m=(0,ce.uiStringsFor)()}){let g=e.length>0,w=(0,Z.useRef)(null);if((0,Z.useEffect)(()=>{let d=w.current;if(!(!g||!d))return(0,ce.attachProductRowWheel)(d)},[g]),!g)return null;let C=`${i}-products-label`;return(0,O.jsxs)("section",{className:W.section,"data-aia-products":"","data-aia-products-layout":n,role:"group","aria-labelledby":C,children:[(0,O.jsx)("div",{className:W.label,id:C,"data-aia-products-label":"",children:m.products}),(0,O.jsx)("div",{ref:w,className:W.row,"data-aia-products-row":"",children:e.map((d,v)=>(0,O.jsx)(ba,{product:d,id:`${i}-product-${v}`,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:h,soldOut:m.soldOut,addToCart:m.addToCart},d.id))})]})}function ba({product:e,id:i,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:n,soldOut:h,addToCart:m}){let g=!!a&&e.available!==!1,[w,C]=(0,Z.useState)(null),d=l=>{l.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},v=l=>{l.metaKey||l.ctrlKey||l.shiftKey||l.altKey||l.button!==0||(l.preventDefault(),t(e))};return(0,O.jsxs)("a",{id:i,className:W.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":g?"":void 0,role:"option","aria-selected":!1,style:w?{"--aia-product-photo-fill-x":String(w.x),"--aia-product-photo-fill-y":String(w.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:v,onKeyDown:l=>{l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:d,children:[(0,O.jsx)(xa,{sources:(0,ce.productImageSources)(e.imageUrl),title:e.title,fallback:n,onPhotoFill:C},(0,ce.productImageSrc)(e.imageUrl)??""),(0,O.jsxs)("span",{className:W.body,children:[e.vendor?(0,O.jsx)("span",{className:W.vendor,children:e.vendor}):null,(0,O.jsx)("span",{className:W.title,children:e.title}),e.price?(0,O.jsx)("span",{className:W.price,children:e.price}):null,e.available===!1?(0,O.jsx)("span",{className:W.badge,children:h}):null]}),g&&a?(0,O.jsx)(va,{product:e,label:`${m}: ${e.title}`,focusable:r,onAddToCart:a,onFocus:()=>o?.(!0),onBlur:d}):null]})}var wa=1500;function va({product:e,label:i,focusable:t,onAddToCart:a,onFocus:o,onBlur:r}){let[n,h]=(0,Z.useState)(null),m=(0,Z.useRef)(null),g=(0,Z.useRef)(e);g.current=e;let w=(0,Z.useRef)(void 0),C=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>(C.current=!0,()=>{C.current=!1,clearTimeout(w.current)}),[]);let d=l=>{m.current=l,C.current&&h(l)},v=l=>{if(l.preventDefault(),l.stopPropagation(),m.current==="adding")return;clearTimeout(w.current),d("adding");let A;try{A=Promise.resolve(a(g.current))}catch(M){A=Promise.reject(M)}A.then(()=>{d("added"),w.current=setTimeout(()=>d(null),wa)},()=>d(null))};return(0,O.jsx)("span",{className:W.cart,"data-aia-product-cart":"","data-aia-cart-state":n??void 0,"aria-busy":n==="adding"?!0:void 0,role:"button","aria-label":i,tabIndex:t?0:-1,onClick:v,onKeyDown:l=>{l.key!=="Enter"&&l.key!==" "||v(l)},onFocus:l=>{l.stopPropagation(),o()},onBlur:l=>{l.stopPropagation(),r(l)},children:(0,O.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,O.jsx)("path",{className:W.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,O.jsx)("path",{className:W.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,O.jsx)("path",{className:W.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,O.jsx)("circle",{className:W.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,O.jsx)("circle",{className:W.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function xa({sources:e,title:i,fallback:t,onPhotoFill:a}){let[o,r]=(0,Z.useState)(0),n=e[o],h=!!n,[m,g]=(0,Z.useState)(null),w=!h&&t==="initial";return(0,Z.useEffect)(()=>()=>a(null),[a]),(0,O.jsxs)("span",{className:W.media,"aria-hidden":"true","data-aia-product-placeholder":!h&&!w?"":void 0,"data-aia-product-initial":w?"":void 0,"data-aia-image-loaded":h&&m===n?"":void 0,children:[h?(0,O.jsx)("img",{className:W.image,src:n,alt:"",loading:"lazy",decoding:"async",onLoad:C=>{g(n),a((0,ce.productPhotoFill)(C.currentTarget.naturalWidth,C.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&a(null),r(C=>C+1)}}):null,w?(0,ce.productInitial)(i):null]})}var _=require("@magicx-eng/ai-autocomplete-vanilla"),ye=require("react");var Bt=require("@magicx-eng/ai-autocomplete-vanilla"),ct=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
|
|
1979
2090
|
display: grid;
|
|
1980
2091
|
grid-template-columns: repeat(
|
|
1981
2092
|
auto-fit,
|
|
@@ -2011,7 +2122,7 @@
|
|
|
2011
2122
|
.aia-grid[data-scroll]::-webkit-scrollbar {
|
|
2012
2123
|
display: none;
|
|
2013
2124
|
}
|
|
2014
|
-
`,document.head.appendChild(e)}var
|
|
2125
|
+
`,document.head.appendChild(e)}var Kt=require("react/jsx-runtime");function Gt({min:e="16rem",max:i,gap:t,scroll:a=!1,maxHeight:o,scrollResetKey:r,cols:n,template:h,innerRef:m,className:g,children:w,...C}){let d=(0,ct.useRef)(null);(0,ct.useLayoutEffect)(()=>{if(r===void 0)return;let l=d.current;l&&(l.scrollTop=0)},[r]);let v={"--aia-grid-min":e};return i&&(v["--aia-grid-max"]=i),t&&(v["--aia-grid-gap"]=t),o&&(v["--aia-grid-max-height"]=o),n&&(v.gridTemplateColumns=(0,Bt.optionsGridTemplateColumns)(n)),h&&(v.gridTemplateColumns=h),(0,Kt.jsx)("div",{ref:l=>{d.current=l,m?.(l)},className:g?`aia-grid ${g}`:"aia-grid","data-scroll":a||void 0,style:v,...C,children:w})}var le=require("@magicx-eng/ai-autocomplete-vanilla"),he=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
|
|
2015
2126
|
position: relative;
|
|
2016
2127
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
2017
2128
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -2469,7 +2580,7 @@
|
|
|
2469
2580
|
opacity: 0;
|
|
2470
2581
|
}
|
|
2471
2582
|
}
|
|
2472
|
-
`,document.head.appendChild(e)}var
|
|
2583
|
+
`,document.head.appendChild(e)}var X={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd"};var J=require("react/jsx-runtime");function qt({option:e,isHighlighted:i,onSelect:t,onHighlight:a,onUnhighlight:o,id:r,loading:n,showIcon:h=!0,showImage:m=!0,showCount:g=!0,scrollHint:w,enterDelayMs:C=0}){let[d]=(0,he.useState)(C),[v,l]=(0,he.useState)(!1),A=m?(0,le.optionImageSources)(e.image_url):[],M=A[0]??null,[$,ee]=(0,he.useState)([]),R=A.find(z=>!$.includes(z))??null,[N,K]=(0,he.useState)(null),P=(0,he.useMemo)(()=>!M&&h&&e.icon_svg?(0,le.sanitizeOptionIconSvg)(e.icon_svg):null,[M,h,e.icon_svg]),te=g?(0,le.formatOptionCount)(e.item_count):null,U=(0,he.useRef)(void 0);(0,he.useEffect)(()=>()=>clearTimeout(U.current),[]);let Y=()=>{n||!e.is_tappable||v||(l(!0),t(e),clearTimeout(U.current),U.current=setTimeout(()=>l(!1),170))},pe=[X.item,i&&!n?X.highlighted:"",e.is_tappable?X.tappable:X.nonTappable,v?X.pressed:"",w?X.scrollHint:""].filter(Boolean).join(" ");return(0,J.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":n?"":void 0,"data-aia-icon":P&&e.icon?e.icon:void 0,"data-aia-image":M?"":void 0,"data-aia-item-count":te!==null?e.item_count:void 0,"aria-selected":i,className:pe,style:{[le.OPTION_ENTER_DELAY_VAR]:`${d}ms`},tabIndex:n||!e.is_tappable?-1:0,onClick:Y,onKeyDown:z=>{!n&&e.is_tappable&&(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),Y())},onMouseEnter:!n&&e.is_tappable?a:void 0,onMouseLeave:o,children:(0,J.jsxs)("span",{className:X.content,children:[M&&(0,J.jsx)("span",{className:`${X.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":R!==null&&N===R?"":void 0,children:(0,J.jsx)("img",{src:R??M,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:R===null,onLoad:()=>K(R),onError:()=>{R!==null&&ee(z=>[...z,R])}})}),P&&(0,J.jsx)("span",{className:`${X.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:P}}),(0,J.jsxs)("span",{className:X.text,children:[e.matchedText?(0,le.highlightParts)((0,le.optionLabel)(e),e.matchedText).map((z,ae)=>z.bold?(0,J.jsx)("strong",{className:`${X.match} magicx-aia-option-match`,children:z.text},ae):z.text):(0,le.optionLabel)(e),e.parameterLabel&&(0,J.jsxs)(J.Fragment,{children:[" ",(0,J.jsx)("span",{className:`${X.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,J.jsx)("span",{className:X.tag,children:e.tag}),te!==null&&(0,J.jsx)("span",{className:`${X.count} magicx-aia-option-count`,children:te})]})})}var Pt=require("react/jsx-runtime");function ya(){let[e,i]=(0,ye.useState)(_.isOptionsGridMobileViewport);return(0,ye.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(_.OPTIONS_GRID_MOBILE_QUERY),a=()=>i(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function Wt({options:e,activeIndex:i,onSelect:t,onHighlight:a,onUnhighlight:o,listboxId:r,loading:n,groupKey:h="",optionsPosition:m="below",showIcons:g=!0,showImages:w=!0,showCounts:C=!0}){let d=ya(),v=(0,ye.useRef)(null),[l,A]=(0,ye.useState)(null),M=(0,ye.useRef)(null);(0,ye.useLayoutEffect)(()=>{if(n&&(0,_.sameOptionRows)(M.current,e))return;M.current=n?null:e;let R=v.current,K=R&&!n&&(0,_.needsOptionsGridMeasurement)(e.length,d)?(0,_.measureOptionsGrid)(R):null;A(K?(0,_.planOptionsGrid)(e.length,d,K.rowWidths,K.gridWidth):null)},[e,d,n]);let $=l??(0,_.planOptionsGrid)(e.length,d,null,null),ee=(0,_.optionsShowLeadingVisuals)(e,g,w);return(0,Pt.jsx)(Gt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:h,template:$.template,maxHeight:$.maxHeight,innerRef:R=>{v.current=R},"data-aia-group":h,children:e.map((R,N)=>(0,Pt.jsx)(qt,{option:R,isHighlighted:N===i,onSelect:t,onHighlight:()=>a(N),onUnhighlight:o?()=>o(N):void 0,id:`${r}-option-${N}`,loading:n,showIcon:g&&ee,showImage:w&&ee,showCount:C,scrollHint:!n&&$.scrollHintIndices.includes(N),enterDelayMs:n?0:(0,_.optionEnterDelayMs)(N,$.cols,e.length,m)},`${h}\0${R.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
|
|
2473
2584
|
display: flex;
|
|
2474
2585
|
flex-direction: column;
|
|
2475
2586
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -2484,7 +2595,7 @@
|
|
|
2484
2595
|
align-items: end;
|
|
2485
2596
|
}
|
|
2486
2597
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
2487
|
-
`,document.head.appendChild(e)}var
|
|
2598
|
+
`,document.head.appendChild(e)}var _t=require("react/jsx-runtime");function Ut({space:e,align:i="stretch",className:t,children:a,...o}){let r=e?{"--aia-stack-space":e}:void 0;return(0,_t.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":i,style:r,...o,children:a})}var j=require("react/jsx-runtime"),ka=[159,119,164],Ca=()=>{},jt=()=>{};function Sa(e){let i=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=(0,Q.useState)(i);if((0,Q.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>a(o.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Pa(e,i){let t=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let a=e.current,o=i.current;if(!a||!o)return;let r=a.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:(0,re.attachScrollArrow)({dropdown:a,grid:r,button:o})};return}t.current?.controller.update()}),(0,Q.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ta(e,i){let t=(0,Q.useRef)(i);t.current=i;let a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let o=e.current;if(o){if(!a.current){a.current=(0,re.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}a.current.update()}}),(0,Q.useEffect)(()=>()=>{a.current?.destroy(),a.current=null},[])}function pt({suggestions:e,activeIndex:i,onSelect:t,onHighlight:a,onUnhighlight:o,isOpen:r,id:n,className:h,pills:m,onPillClick:g,showPills:w=!0,onSkip:C,showSkipButton:d=!0,showOptionIcons:v=!0,showOptionImages:l=!0,showOptionCounts:A=!0,skipDisabled:M=!1,activeSelected:$=!1,isLoading:ee=!1,skeletonExiting:R=!1,isInputEmpty:N=!1,language:K,products:P,onProductSelect:te,onProductAddToCart:U,onProductFocusChange:Y,productsLayout:pe="row",productImageFallback:z="image",formatType:ae="options",dateView:ke=null,selectedDateIso:Ee=null,selectedDateRange:Ce=null,dateRangeStart:qe=null,onPreviousMonth:Ae,onNextMonth:f,optionsPosition:Re="below",mode:De}){let Se=Sa(De),Oe=Se!==void 0,de=(0,Q.useRef)(null),c=(0,Q.useRef)(null);Pa(de,c),(0,Q.useEffect)(()=>{if(de.current)return(0,re.containScroll)(de.current)},[]);let x=e[0]?.options??[],k=!!(m&&m.length>0&&g),I=!!(P&&P.length>0),S=r&&(x.length>0||w&&k||ee||I);Ta(de,S);let F={suggestions:e,activeIndex:i,pills:m,showPills:w,showSkipButton:d,showOptionIcons:v,showOptionImages:l,showOptionCounts:A,skipDisabled:M,activeSelected:$,isLoading:ee,skeletonExiting:R,isInputEmpty:N,products:P,formatType:ae,dateView:ke,selectedDateIso:Ee,selectedDateRange:Ce,dateRangeStart:qe},se=(0,Q.useRef)(F);S&&(se.current=F);let u=S?F:se.current,ie=(0,re.uiStringsFor)(K),me=u.suggestions[0],ge=me?.options??[],We=u.activeIndex>=0&&!!ge[u.activeIndex]?.is_tappable,fe=(0,re.labelTraditionalAutocomplete)(u.pills??[],ie.keepTyping),be=!!(fe.length>0&&g),Ue=u.showPills&&be,Pe=u.showPills&&!be&&u.isLoading,Le=Ue||Pe,ze=be&&(0,re.hasSkippablePill)(fe)&&u.showSkipButton&&!u.isInputEmpty&&!!C,y=fe[0]?.text,Ye=(0,re.isCalendarFormat)(u.formatType)&&u.dateView!=null,Qe=ge.length>0&&!Ye,we=ge.length>0&&Ye&&!u.isLoading,b=u.isLoading&&!Qe&&!we,Me=u.products??[];return(0,j.jsxs)("div",{ref:de,id:n,role:"listbox","data-aia-dropdown":"","data-options-position":Re,"data-mode":Se,"data-aia-loading":u.isLoading?"":void 0,"data-aia-skeleton-exiting":u.skeletonExiting?"":void 0,"data-aia-has-products":Me.length>0?"":void 0,className:`${Oe?"magicx-aia ":""}${Te.dropdown} ${S?Te.visible:""} ${h??""}`,onMouseDown:Ne=>Ne.preventDefault(),children:[(0,j.jsxs)(Ut,{space:"8px",children:[(Le||ze)&&(0,j.jsxs)(tt,{noWrap:!0,className:Te.pillBar,"data-aia-pillbar":"",children:[Le&&(0,j.jsx)("span",{className:Te.pillScroll,"data-aia-pill-scroll":"",children:(0,j.jsx)(dt,{pills:fe,activePillIndex:0,activeSelected:u.activeSelected,onSelectPill:g??(()=>{}),rounded:!0,loading:u.isLoading})}),ze&&(0,j.jsx)("button",{type:"button",tabIndex:-1,className:Te.skip,"data-aia-skip":"",disabled:u.isLoading||u.skipDisabled,"aria-label":y?`${ie.skipLabel} ${y}`:ie.skipLabel,onClick:C,children:ie.skip})]}),Qe&&(0,j.jsx)(Wt,{options:ge,activeIndex:u.activeIndex,onSelect:t,onHighlight:a,onUnhighlight:o,listboxId:n,loading:u.isLoading,groupKey:me?`${me.parameter} ${me.text}`:"",optionsPosition:Re,showIcons:u.showOptionIcons,showImages:u.showOptionImages,showCounts:u.showOptionCounts}),we&&u.dateView&&(0,j.jsx)(Lt,{options:ge,activeIndex:u.activeIndex,listboxId:n,view:u.dateView,selection:{selectedIso:u.selectedDateIso??null,selectedRange:u.selectedDateRange??null,rangeStart:u.dateRangeStart??null},onSelect:t,onHighlight:a,onUnhighlight:o,onPreviousMonth:Ae??jt,onNextMonth:f??jt}),b&&(0,j.jsx)("div",{className:Te.skeletonBars,"data-aia-skeleton-bars":"",children:ka.map(Ne=>(0,j.jsx)("span",{className:Te.skeletonBar,style:{width:Ne}},`bar-${Ne}`))}),(0,j.jsx)(Ht,{products:Me,listboxId:n,onSelect:te??Ca,onAddToCart:U,onFocusChange:Y,focusable:S,layout:pe,imageFallback:z,strings:ie}),(0,j.jsx)(zt,{isOptionHighlighted:We,isInputEmpty:u.isInputEmpty,strings:ie})]}),(0,j.jsx)("button",{ref:c,type:"button",tabIndex:-1,className:Te.scrollArrow,"data-aia-scroll-arrow":"","aria-label":ie.scrollArrow,"aria-hidden":"true",children:(0,j.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,j.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Ke=require("@magicx-eng/ai-autocomplete-vanilla");var Yt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
|
|
2488
2599
|
flex-shrink: 0;
|
|
2489
2600
|
width: 32px;
|
|
2490
2601
|
height: 32px;
|
|
@@ -2537,5 +2648,5 @@
|
|
|
2537
2648
|
);
|
|
2538
2649
|
cursor: default;
|
|
2539
2650
|
}
|
|
2540
|
-
`,document.head.appendChild(e)}var Yt={submitButton:"aia-submitButton-otz7H"};var ht=require("react/jsx-runtime");function Zt({disabled:e,onClick:a,label:t=(0,Qt.uiStringsFor)().submit}){return(0,ht.jsx)("button",{type:"button","data-aia-submit":"",className:Yt.submitButton,disabled:e,onClick:i=>{i.stopPropagation(),a()},"aria-label":t,children:(0,ht.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:(0,ht.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ke=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react");var Pt=require("react");function $t(e){let a=(0,Pt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Pt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let r of Object.keys(e??{})){let n=(p,l,g)=>{let k=a.current?.[r];return k?k(p,l,g):[]};o[r]=n}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var It=require("react");function Xt(e){let a=(0,It.useRef)(e);a.current=e;let t=(0,It.useRef)(null);t.current===null&&(t.current={fetch:(o,r)=>{let n=a.current;return n?n.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var Pa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function ut({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:r,additionalContext:n,language:p,currency:l,productId:g,visitorId:k,columns:E=2,dropdownTrigger:b,optionsPosition:x,closeDropdownOnBlur:A,showNonTappableOptions:R,showOptionIcons:B,showOptionImages:Y,showOptionCounts:X,showSkipButton:T,showProducts:z,productImageFallback:K="image",onFocus:C,onBlur:J,value:W,completedParams:V,onChange:se,onParamsChange:O,products:ee,mapProducts:ve,onProductSelect:Pe,source:We,setCursor:Ie}){let m=(0,P.useRef)(null),[Te,Ee]=(0,P.useState)(null),xe=(0,P.useRef)(e);xe.current=e;let Ae=(0,P.useRef)(a);Ae.current=a;let ne=(0,P.useRef)(t);ne.current=t;let ye=(0,P.useRef)(se);ye.current=se;let d=(0,P.useRef)(O);d.current=O;let f=(0,P.useRef)(C);f.current=C;let w=(0,P.useRef)(J);w.current=J;let v=(0,P.useRef)(Ie);v.current=Ie;let S=(0,P.useRef)(Pe);S.current=Pe;let N=(0,P.useRef)(k);N.current=k;let h=(0,P.useRef)(()=>{let c=N.current;return typeof c=="function"?c():c}).current,G=Xt(ee),le=(0,P.useRef)(ve);le.current=ve;let de=(0,P.useRef)((c,te)=>{let D=le.current;return D?D(c,te):c}).current,Re=ve?de:void 0,ce=$t(i);(0,P.useEffect)(()=>{if(typeof document>"u")return;let c=new Ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:n,language:p,currency:l,productId:g,visitorId:h,optionOverrides:ce.overrides,maskCompletedText:o,columns:E,dropdownTrigger:b,optionsPosition:x,closeDropdownOnBlur:A,showNonTappableOptions:R,showProducts:z,source:We,value:W,completedParams:V,onSubmit:(...D)=>xe.current?.(...D),onResult:(...D)=>Ae.current?.(...D),onError:(...D)=>ne.current?.(...D),onChange:(...D)=>ye.current?.(...D),onParamsChange:(...D)=>d.current?.(...D),onFocus:()=>f.current?.(),onBlur:()=>w.current?.(),onProductSelect:D=>S.current?.(D),setCursor:D=>v.current?.(D),products:G.config,mapProducts:Re});m.current=c,Ee(c.getState());let te=c.subscribe(D=>Ee(D));return()=>{te(),c.destroy(),m.current===c&&(m.current=null)}},[]),(0,P.useEffect)(()=>{W!==void 0&&m.current?.setValue(W)},[W]),(0,P.useEffect)(()=>{V!==void 0&&m.current?.setCompletedParams(V)},[V]);let Oe=JSON.stringify(r??null),De;try{De=JSON.stringify(n??null)}catch{De="[unstringifiable]"}(0,P.useEffect)(()=>{m.current?.update({apiConfig:r,additionalContext:n,language:p,currency:l,productId:g,optionOverrides:ce.overrides,dropdownTrigger:b,optionsPosition:x,closeDropdownOnBlur:A,showNonTappableOptions:R,showProducts:z})},[Oe,De,p,l?.code,l?.rate,l?.country,g,ce.key,b,x,A,R,z]);let Le=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!Le.current){Le.current=!0;return}m.current?.update({products:G.config})},[G.enabled]),(0,P.useEffect)(()=>{m.current?.update({mapProducts:Re})},[Re]);let ze=(0,P.useRef)(null);ze.current===null&&(ze.current={handleTextChange:c=>m.current?.handleTextChange(c),handleKeyDown:c=>{let te="nativeEvent"in c?c.nativeEvent:c;m.current?.handleKeyDown(te)},setFocused:c=>m.current?.setFocused(c),startEditingParam:c=>m.current?.startEditingParam(c),exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:c=>m.current?.handleCaretAfterInput(c),handleCaretMove:c=>m.current?.handleCaretMove(c),replaceEditingRange:c=>m.current?.replaceEditingRange(c)??!1,setActivePill:c=>m.current?.setActivePill(c),skipActivePill:()=>m.current?.skipActivePill(),removeLastParam:()=>m.current?.removeLastParam(),clearNewParamId:()=>m.current?.clearNewParamId(),reset:()=>m.current?.reset(),refreshProducts:()=>m.current?.refreshProducts(),recordSubmit:c=>m.current?.recordSubmit(c),selectOption:c=>m.current?.selectOption(c),selectProduct:c=>m.current?.selectProduct(c),setActiveDropdownIndex:c=>m.current?.setActiveDropdownIndex(c),clearHighlight:c=>m.current?.clearHighlight(c),showPreviousMonth:()=>m.current?.showPreviousMonth(),showNextMonth:()=>m.current?.showNextMonth(),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let y=ze.current,Me=(0,P.useCallback)(c=>{let te=c.target.value,bt=te.length>0&&!c.nativeEvent?.isComposing&&te[0]!==te[0].toUpperCase()?te[0].toUpperCase()+te.slice(1):te;m.current?.handleTextChange(bt)},[]),Ne=(0,P.useCallback)(c=>{m.current?.handleKeyDown(c.nativeEvent)},[]),ke=m.current,u=Te??Pa,je=W!==void 0?W:u.text,Ye=V!==void 0?V:u.completedParams,ue=u.actionableSuggestions,Qe=ue[0],tt=(0,Ke.withoutTraditionalAutocomplete)(ue),_e=ke?.listboxId??"",gt=u.activeDropdownIndex>=0&&ke?`${_e}-option-${u.activeDropdownIndex}`:void 0,Fe=u.editingParam,qe=u.editingIdentified,Ze=Fe?{parameter:Fe.suggestionParameter,text:Fe.suggestionPlaceholder,required:!0,options:Fe.options}:qe?{parameter:qe.parameter,text:(0,Ke.identifiedParamLabel)(qe.parameter),required:!0,options:[]}:null,at=u.dropdownSuggestion??Ze??Qe,ft=Ze?[Ze]:ue,$e=(0,Ke.dateSelectionFor)(u),it=!ke||u.dropdownLoading;return{completedParams:Ye,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:tt,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:y.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:it,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:_e,error:u.error,products:u.products,customFields:u.customFields,selectProduct:y.selectProduct,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Fe,editingIdentified:qe,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:je,placeholder:u.placeholderText||void 0,onChange:Me,onKeyDown:Ne,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":gt,"aria-autocomplete":"list","aria-controls":_e},reset:y.reset,refreshProducts:y.refreshProducts,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:at?[{...at,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:u.isDropdownOpen,id:_e,pills:ft,activeSelected:u.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(T??!0)&&!Fe&&!qe,showOptionIcons:B??!0,showOptionImages:Y??!0,showOptionCounts:X??!0,skipDisabled:u.inSelectionAnimation,isLoading:it,skeletonExiting:u.skeletonExiting,isInputEmpty:je.trim().length===0,language:p,products:u.products,productImageFallback:K,onProductSelect:y.selectProduct,onProductFocusChange:y.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:$e.selectedIso,selectedDateRange:$e.selectedRange,dateRangeStart:$e.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,optionsPosition:x??"below"}}}var U=require("@magicx-eng/ai-autocomplete-vanilla"),I=require("react"),mt;function Ia(){if(mt!==void 0)return mt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),mt=e.contentEditable==="plaintext-only",mt}function Jt(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:r,editingIdentified:n,editingAnchor:p,caretOffset:l,placeholderText:g,isFocused:k,isDropdownOpen:E,listboxId:b,activeDescendantId:x,autoFocus:A,handleTextChange:R,handleKeyDown:B,handleCaretAfterInput:Y,handleCaretMove:X,startEditingParam:T,replaceEditingRange:z,setFocused:K}=e,C=(0,I.useRef)(null),J=(0,I.useRef)(!1),W=(0,I.useRef)(""),V=(0,I.useRef)(""),se=(0,I.useRef)(null),O=(0,I.useRef)(0);se.current=l,(0,I.useEffect)(()=>{if(!A)return;let d=C.current;if(!d)return;document.activeElement===d?K(!0):d.focus();let f=d.ownerDocument??document,w=f.getSelection(),v=w&&w.rangeCount>0&&d.contains(w.anchorNode);if(w&&!v){let S=f.createRange();S.selectNodeContents(d),S.collapse(!0),w.removeAllRanges(),w.addRange(S)}},[A,K]),(0,I.useEffect)(()=>{let d=C.current;if(!d)return;let f=d.ownerDocument??document,w=()=>{let v=f.getSelection();if(!v||v.rangeCount===0||!v.anchorNode||!d.contains(v.anchorNode))return;let S=v.anchorNode,N=S.nodeType===Node.ELEMENT_NODE?S:S.parentElement,G=(v.isCollapsed?N?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,le=r?.id??n?.id??null;if(G&&G!==le){T(G);return}performance.now()-O.current<50||X((0,U.getCursorOffset)(d))};return f.addEventListener("selectionchange",w),()=>f.removeEventListener("selectionchange",w)},[r,n,T,X]),(0,I.useEffect)(()=>{let d=C.current;if(!d)return;let f=w=>{let v=(0,U.chipIdFromTap)(d,w.target);v&&(T(v),(0,U.keepCaretOnChip)(d,v))};return d.addEventListener("click",f),()=>d.removeEventListener("click",f)},[T]),(0,I.useLayoutEffect)(()=>{let d=C.current;d&&(0,U.renderEditableContent)({input:d,segments:a,newParamId:o,editingParamId:r?.id??null,placeholderText:g??"",isFocused:k,showChipIcons:t,showChipImages:i})},[a,o,r,g,k,t,i]),(0,I.useLayoutEffect)(()=>{let d=W.current,f=o??"";if(W.current=f,!f||f===d)return;let w=C.current;if(!w)return;w.focus();let v=se.current??(0,U.plainTextLength)(w);(0,U.setCursorOffset)(w,v)},[o]),(0,I.useLayoutEffect)(()=>{let d=V.current,f=r?.id??"";if(V.current=f,!f||f===d||p==null)return;let w=C.current;w&&(0,U.setCursorOffset)(w,p)},[r,p]);let ee=(0,I.useCallback)(()=>{if(J.current)return;let d=C.current;if(!d)return;let f=(0,U.extractPlainText)(d),v=f.length>0&&f[0]!==f[0].toUpperCase()?f[0].toUpperCase()+f.slice(1):f;R(v)},[R]),ve=(0,I.useCallback)(()=>{O.current=performance.now(),ee();let d=C.current;d&&Y((0,U.getCursorOffset)(d))},[ee,Y]);(0,I.useEffect)(()=>{let d=C.current;if(!d)return;let f=w=>{let v=w,S=v.inputType;if(S==="insertParagraph"||S==="insertLineBreak"||S==="insertFromDrop"){w.preventDefault();return}if(S.startsWith("insert")||S.startsWith("delete")){let N=S.startsWith("delete")?"":v.data??"";z(N)&&w.preventDefault()}};return d.addEventListener("beforeinput",f),()=>d.removeEventListener("beforeinput",f)},[z]);let Pe=(0,I.useCallback)(()=>{J.current=!0,C.current?.setAttribute("data-aia-composing","true")},[]),We=(0,I.useCallback)(()=>{J.current=!1,C.current?.removeAttribute("data-aia-composing"),ee()},[ee]),Ie=(0,I.useCallback)(d=>{d.preventDefault();let f=C.current;if(!f)return;let w=(d.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!w)return;let v=f.ownerDocument??document,S=v.getSelection();if(!S||S.rangeCount===0)return;let N=S.getRangeAt(0);if(!f.contains(N.startContainer))return;N.deleteContents();let h=v.createTextNode(w);N.insertNode(h),N.setStartAfter(h),N.collapse(!0),S.removeAllRanges(),S.addRange(N),ee()},[ee]),m=(0,I.useCallback)(d=>B(d),[B]),Te=(0,I.useCallback)(()=>K(!0),[K]),Ee=(0,I.useCallback)(()=>K(!1),[K]),xe=(0,I.useCallback)(()=>C.current?.focus(),[]),Ae=(0,I.useCallback)(()=>C.current?.blur(),[]),ne=(0,I.useCallback)(()=>{let d=C.current;return d?(0,U.extractPlainText)(d):""},[]),ye=Ia()?"plaintext-only":"true";return{inputRef:C,editorProps:{ref:C,contentEditable:ye,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":b,"aria-expanded":E,"aria-activedescendant":x,spellCheck:!0,enterKeyHint:"send",onInput:ve,onKeyDown:m,onCompositionStart:Pe,onCompositionEnd:We,onPaste:Ie,onFocus:Te,onBlur:Ee},getPlainText:ne,focus:xe,blur:Ae}}var he=require("react/jsx-runtime");function Ta(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var ea=(0,H.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,className:n,apiConfig:p,additionalContext:l,language:g,currency:k,productId:E,visitorId:b,columns:x,pillPlacement:A="dropdown",mode:R="auto",optionsPosition:B="below",animations:Y=!0,dropdownTrigger:X,closeDropdownOnBlur:T,showNonTappableOptions:z,showOptionIcons:K=!0,showChipIcons:C=!0,showChipImages:J=!0,showOptionImages:W=!0,showOptionCounts:V=!0,showSkipButton:se,showProducts:O,productsLayout:ee,productImageFallback:ve,autoFocus:Pe=!0,onFocus:We,onBlur:Ie,value:m,completedParams:Te,onChange:Ee,onParamsChange:xe,products:Ae,mapProducts:ne,onProductSelect:ye,submitButton:d,resetOnSubmit:f=!0},w){let v=(0,H.useRef)(null),S=(0,H.useRef)(null),N=(0,H.useRef)(()=>{}),h=(0,H.useRef)(null),G=(0,H.useRef)(null);(0,H.useEffect)(()=>{let L=v.current;if(L)return h.current?h.current.setMode(R):h.current=new Ge.ModeController(L,R),()=>{h.current?.destroy(),h.current=null}},[R]);let le=(0,H.useCallback)(L=>{let me=G.current?.current;me&&(me.focus(),(0,Ge.setCursorOffset)(me,L))},[]),{completedParams:de,skippedParams:Re,identifiedParams:ce,isReady:Oe,customFields:De,suggestionPills:Le,setActivePill:ze,skipActivePill:y,segments:Me,newParamId:Ne,clearNewParamId:ke,placeholderText:u,isFocused:je,isDropdownOpen:Ye,isActivePillSelected:ue,isLoading:Qe,activeIndex:tt,listboxId:_e,handleTextChange:gt,handleKeyDown:Fe,setFocused:qe,editingParam:Ze,editingIdentified:at,editingAnchor:ft,caretOffset:$e,startEditingParam:it,handleCaretAfterInput:c,handleCaretMove:te,replaceEditingRange:D,dropdownProps:bt,reset:ot,refreshProducts:Tt,recordSubmit:Et}=ut({onSubmit:L=>N.current(L),onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,apiConfig:p,additionalContext:l,language:g,currency:k,productId:E,visitorId:b,columns:x,dropdownTrigger:X,optionsPosition:B,closeDropdownOnBlur:T,showNonTappableOptions:z,showOptionIcons:K,showOptionImages:W,showOptionCounts:V,showSkipButton:se,showProducts:O,onFocus:We,onBlur:Ie,value:m,completedParams:Te,onChange:Ee,onParamsChange:xe,products:Ae,mapProducts:ne,onProductSelect:ye,source:"full-sdk",setCursor:le});(0,H.useEffect)(()=>{if(!Ne)return;let L=window.setTimeout(()=>ke(),650);return()=>window.clearTimeout(L)},[Ne,ke]);let ta=tt>=0?`${_e}-option-${tt}`:void 0,{inputRef:wt,editorProps:aa,focus:nt,blur:At,getPlainText:Rt}=Jt({segments:Me,newParamId:Ne,editingParam:Ze,editingIdentified:at,editingAnchor:ft,caretOffset:$e,placeholderText:u,isFocused:je,showChipIcons:C,showChipImages:J,isDropdownOpen:Ye,listboxId:_e,activeDescendantId:ta,autoFocus:Pe,handleTextChange:gt,handleKeyDown:Fe,handleCaretAfterInput:c,handleCaretMove:te,startEditingParam:it,replaceEditingRange:D,setFocused:qe});G.current=wt,(0,H.useLayoutEffect)(()=>{let L=S.current,me=wt.current;if(!L||!me)return;let Xe=()=>{let Dt=L.firstElementChild;if(!Dt)return;let ra=Dt.getBoundingClientRect(),sa=me.getBoundingClientRect();ra.top>=sa.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};Xe();let Ot=new ResizeObserver(Xe);return Ot.observe(me),()=>Ot.disconnect()},[Me,Le.length,Qe,wt]),(0,H.useImperativeHandle)(w,()=>({focus:nt,blur:At,reset:ot,refreshProducts:Tt,setMode:L=>h.current?.setMode(L),skipActivePill:y}),[nt,At,ot,Tt,y]);let rt=!!Me.length||de.length>0,vt=(0,H.useCallback)(L=>{if(!rt)return;let me=Rt(),Xe=(0,Ge.buildSubmitResult)(me,de,Re,{identifiedParams:ce,isReady:Oe,customFields:De});L&&Et(Xe),a(Xe),f&&ot()},[Et,f,rt,de,Re,ce,Oe,De,a,ot,Rt]);N.current=()=>vt(!1);let ia=(0,H.useCallback)(L=>{L.target?.closest("[data-aia-pill]")||nt()},[nt]),oa=A==="inline",na=A==="dropdown";return(0,he.jsxs)("div",{ref:v,className:`magicx-aia ${Ue.container} ${n??""}`,"data-pill-placement":A,"data-options-position":B,"data-animations":Y?"on":"off","data-mode":Ta(R),children:[(0,he.jsx)(pt,{...bt,showPills:na,productsLayout:ee,productImageFallback:ve}),(0,he.jsxs)("div",{className:Ue.inputWrapper,"data-aia-input-wrapper":"",onClick:ia,children:[(0,he.jsxs)("div",{className:Ue.editorArea,"data-aia-editor":"",children:[(0,he.jsx)("div",{...aa,className:Ue.input,"data-aia-input":""}),oa&&(Qe||Le.length>0)&&(0,he.jsx)("span",{ref:S,className:Ue.pillListContainer,"data-aia-pill-list-container":"",children:(0,he.jsx)(dt,{pills:Le,activePillIndex:0,activeSelected:ue,onSelectPill:ze,loading:Qe})})]}),d===null?null:d===void 0?(0,he.jsx)(Zt,{disabled:!rt,onClick:()=>vt(!0),label:(0,Ge.uiStringsFor)(g).submit}):(0,he.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ue.submitSlot,onClick:L=>{rt&&(L.stopPropagation(),vt(!0))},children:d})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
2651
|
+
`,document.head.appendChild(e)}var Vt={submitButton:"aia-submitButton-otz7H"};var ht=require("react/jsx-runtime");function Qt({disabled:e,onClick:i,label:t=(0,Yt.uiStringsFor)().submit}){return(0,ht.jsx)("button",{type:"button","data-aia-submit":"",className:Vt.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),i()},"aria-label":t,children:(0,ht.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:(0,ht.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ge=require("@magicx-eng/ai-autocomplete-vanilla"),T=require("react");var Tt=require("react");function $t(e){let i=(0,Tt.useRef)(e);i.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=(0,Tt.useRef)({key:"",overrides:void 0});if(a.current.key!==t){let o={};for(let r of Object.keys(e??{})){let n=(h,m,g)=>{let w=i.current?.[r];return w?w(h,m,g):[]};o[r]=n}a.current={key:t,overrides:e?o:void 0}}return{overrides:a.current.overrides,key:t}}var It=require("react");function Zt(e){let i=(0,It.useRef)(e);i.current=e;let t=(0,It.useRef)(null);t.current===null&&(t.current={fetch:(o,r)=>{let n=i.current;return n?n.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>i.current?.transform(o)??[],get limit(){return i.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var Xt={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function ut({onSubmit:e,onResult:i,onError:t,optionOverrides:a,maskCompletedText:o,apiConfig:r,additionalContext:n,language:h,currency:m,productId:g,visitorId:w,columns:C=2,dropdownTrigger:d,optionsPosition:v,closeDropdownOnBlur:l,showNonTappableOptions:A,showOptionIcons:M,showOptionImages:$,showOptionCounts:ee,showSkipButton:R,showProducts:N,productImageFallback:K="image",onFocus:P,onBlur:te,value:U,completedParams:Y,onChange:pe,onParamsChange:z,products:ae,mapProducts:ke,onProductSelect:Ee,onProductAddToCart:Ce,source:qe,setCursor:Ae}){let f=(0,T.useRef)(null),[Re,De]=(0,T.useState)(null),Se=(0,T.useRef)(e);Se.current=e;let Oe=(0,T.useRef)(i);Oe.current=i;let de=(0,T.useRef)(t);de.current=t;let c=(0,T.useRef)(pe);c.current=pe;let x=(0,T.useRef)(z);x.current=z;let k=(0,T.useRef)(P);k.current=P;let I=(0,T.useRef)(te);I.current=te;let S=(0,T.useRef)(Ae);S.current=Ae;let F=(0,T.useRef)(Ee);F.current=Ee;let se=(0,T.useRef)(Ce);se.current=Ce;let u=(0,T.useRef)(w);u.current=w;let ie=(0,T.useRef)(()=>{let p=u.current;return typeof p=="function"?p():p}).current,me=Zt(ae),ge=(0,T.useRef)(ke);ge.current=ke;let We=(0,T.useRef)((p,q)=>{let D=ge.current;return D?D(p,q):p}).current,fe=ke?We:void 0,be=$t(a);(0,T.useEffect)(()=>{if(typeof document>"u")return;let p=new Ge.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:n,language:h,currency:m,productId:g,visitorId:ie,optionOverrides:be.overrides,maskCompletedText:o,columns:C,dropdownTrigger:d,optionsPosition:v,closeDropdownOnBlur:l,showNonTappableOptions:A,showProducts:N,source:qe,value:U,completedParams:Y,onSubmit:(...D)=>Se.current?.(...D),onResult:(...D)=>Oe.current?.(...D),onError:(...D)=>de.current?.(...D),onChange:(...D)=>c.current?.(...D),onParamsChange:(...D)=>x.current?.(...D),onFocus:()=>k.current?.(),onBlur:()=>I.current?.(),onProductSelect:D=>F.current?.(D),onProductAddToCart:D=>se.current?.(D),setCursor:D=>S.current?.(D),products:me.config,mapProducts:fe});f.current=p,De(p.getState());let q=p.subscribe(D=>De(D));return()=>{q(),p.destroy(),f.current===p&&(f.current=null)}},[]),(0,T.useEffect)(()=>{U!==void 0&&f.current?.setValue(U)},[U]),(0,T.useEffect)(()=>{Y!==void 0&&f.current?.setCompletedParams(Y)},[Y]);let Ue=JSON.stringify(r??null),Pe;try{Pe=JSON.stringify(n??null)}catch{Pe="[unstringifiable]"}(0,T.useEffect)(()=>{f.current?.update({apiConfig:r,additionalContext:n,language:h,currency:m,productId:g,optionOverrides:be.overrides,dropdownTrigger:d,optionsPosition:v,closeDropdownOnBlur:l,showNonTappableOptions:A,showProducts:N})},[Ue,Pe,h,m?.code,m?.rate,m?.country,g,be.key,d,v,l,A,N]);let Le=(0,T.useRef)(!1);(0,T.useEffect)(()=>{if(!Le.current){Le.current=!0;return}f.current?.update({products:me.config})},[me.enabled]),(0,T.useEffect)(()=>{f.current?.update({mapProducts:fe})},[fe]);let ze=(0,T.useRef)(null);ze.current===null&&(ze.current={handleTextChange:p=>f.current?.handleTextChange(p),handleKeyDown:p=>{let q="nativeEvent"in p?p.nativeEvent:p;f.current?.handleKeyDown(q)},setFocused:p=>f.current?.setFocused(p),startEditingParam:p=>f.current?.startEditingParam(p),exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:p=>f.current?.handleCaretAfterInput(p),handleCaretMove:p=>f.current?.handleCaretMove(p),replaceEditingRange:p=>f.current?.replaceEditingRange(p)??!1,setActivePill:p=>f.current?.setActivePill(p),skipActivePill:()=>f.current?.skipActivePill(),removeLastParam:()=>f.current?.removeLastParam(),clearNewParamId:()=>f.current?.clearNewParamId(),reset:()=>f.current?.reset(),refreshProducts:()=>f.current?.refreshProducts(),prepareSubmit:()=>f.current?.prepareSubmit(),getState:()=>f.current?.getState()??Xt,recordSubmit:p=>f.current?.recordSubmit(p),selectOption:p=>f.current?.selectOption(p),selectProduct:p=>f.current?.selectProduct(p),addProductToCart:p=>{let q=f.current;return!q||!se.current?Promise.resolve():q.addProductToCart(p)},setActiveDropdownIndex:p=>f.current?.setActiveDropdownIndex(p),clearHighlight:p=>f.current?.clearHighlight(p),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let y=ze.current,Ye=(0,T.useCallback)(p=>{let q=p.target.value,ot=q.length>0&&!p.nativeEvent?.isComposing&&q[0]!==q[0].toUpperCase()?q[0].toUpperCase()+q.slice(1):q;f.current?.handleTextChange(ot)},[]),Qe=(0,T.useCallback)(p=>{f.current?.handleKeyDown(p.nativeEvent)},[]),we=f.current,b=Re??Xt,Me=U!==void 0?U:b.text,Ne=Y!==void 0?Y:b.completedParams,Ze=b.actionableSuggestions,gt=Ze[0],ft=(0,Ge.withoutTraditionalAutocomplete)(Ze),$e=we?.listboxId??"",bt=b.activeDropdownIndex>=0&&we?`${$e}-option-${b.activeDropdownIndex}`:void 0,Fe=b.editingParam,_e=b.editingIdentified,Xe=Fe?{parameter:Fe.suggestionParameter,text:Fe.suggestionPlaceholder,required:!0,options:Fe.options}:_e?{parameter:_e.parameter,text:(0,Ge.identifiedParamLabel)(_e.parameter),required:!0,options:[]}:null,it=b.dropdownSuggestion??Xe??gt,wt=Xe?[Xe]:Ze,Je=(0,Ge.dateSelectionFor)(b),je=!we||b.dropdownLoading;return{completedParams:Ne,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:ft,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:y.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:je,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:$e,error:b.error,products:b.products,customFields:b.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Fe,editingIdentified:_e,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:Me,placeholder:b.placeholderText||void 0,onChange:Ye,onKeyDown:Qe,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":bt,"aria-autocomplete":"list","aria-controls":$e},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:it?[{...it,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:b.isDropdownOpen,id:$e,pills:wt,activeSelected:b.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(R??!0)&&!Fe&&!_e,showOptionIcons:M??!0,showOptionImages:$??!0,showOptionCounts:ee??!0,skipDisabled:b.inSelectionAnimation,isLoading:je,skeletonExiting:b.skeletonExiting,isInputEmpty:Me.trim().length===0,language:h,products:b.products,productImageFallback:K,onProductSelect:y.selectProduct,onProductAddToCart:Ce?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:Je.selectedIso,selectedDateRange:Je.selectedRange,dateRangeStart:Je.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,optionsPosition:v??"below"}}}var V=require("@magicx-eng/ai-autocomplete-vanilla"),E=require("react"),mt;function Ia(){if(mt!==void 0)return mt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),mt=e.contentEditable==="plaintext-only",mt}function Jt(e){let{segments:i,showChipIcons:t=!0,showChipImages:a=!0,newParamId:o,editingParam:r,editingIdentified:n,editingAnchor:h,caretOffset:m,placeholderText:g,isFocused:w,isDropdownOpen:C,listboxId:d,activeDescendantId:v,autoFocus:l,handleTextChange:A,handleKeyDown:M,handleCaretAfterInput:$,handleCaretMove:ee,startEditingParam:R,replaceEditingRange:N,setFocused:K}=e,P=(0,E.useRef)(null),te=(0,E.useRef)(!1),U=(0,E.useRef)(""),Y=(0,E.useRef)(""),pe=(0,E.useRef)(null),z=(0,E.useRef)(0);pe.current=m,(0,E.useEffect)(()=>{if(!l)return;let c=P.current;if(!c)return;document.activeElement===c?K(!0):c.focus();let x=c.ownerDocument??document,k=x.getSelection(),I=k&&k.rangeCount>0&&c.contains(k.anchorNode);if(k&&!I){let S=x.createRange();S.selectNodeContents(c),S.collapse(!0),k.removeAllRanges(),k.addRange(S)}},[l,K]),(0,E.useEffect)(()=>{let c=P.current;if(!c)return;let x=c.ownerDocument??document,k=()=>{let I=x.getSelection();if(!I||I.rangeCount===0||!I.anchorNode||!c.contains(I.anchorNode))return;let S=I.anchorNode,F=S.nodeType===Node.ELEMENT_NODE?S:S.parentElement,u=(I.isCollapsed?F?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ie=r?.id??n?.id??null;if(u&&u!==ie){R(u);return}performance.now()-z.current<50||ee((0,V.getCursorOffset)(c))};return x.addEventListener("selectionchange",k),()=>x.removeEventListener("selectionchange",k)},[r,n,R,ee]),(0,E.useEffect)(()=>{let c=P.current;if(!c)return;let x=k=>{let I=(0,V.chipIdFromTap)(c,k.target);I&&(R(I),(0,V.keepCaretOnChip)(c,I))};return c.addEventListener("click",x),()=>c.removeEventListener("click",x)},[R]),(0,E.useLayoutEffect)(()=>{let c=P.current;c&&(0,V.renderEditableContent)({input:c,segments:i,newParamId:o,editingParamId:r?.id??null,placeholderText:g??"",isFocused:w,showChipIcons:t,showChipImages:a})},[i,o,r,g,w,t,a]),(0,E.useLayoutEffect)(()=>{let c=U.current,x=o??"";if(U.current=x,!x||x===c)return;let k=P.current;if(!k)return;k.focus();let I=pe.current??(0,V.plainTextLength)(k);(0,V.setCursorOffset)(k,I)},[o]),(0,E.useLayoutEffect)(()=>{let c=Y.current,x=r?.id??"";if(Y.current=x,!x||x===c||h==null)return;let k=P.current;k&&(0,V.setCursorOffset)(k,h)},[r,h]);let ae=(0,E.useCallback)(()=>{if(te.current)return;let c=P.current;if(!c)return;let x=(0,V.extractPlainText)(c),I=x.length>0&&x[0]!==x[0].toUpperCase()?x[0].toUpperCase()+x.slice(1):x;A(I)},[A]),ke=(0,E.useCallback)(()=>{z.current=performance.now(),ae();let c=P.current;c&&$((0,V.getCursorOffset)(c))},[ae,$]);(0,E.useEffect)(()=>{let c=P.current;if(!c)return;let x=k=>{let I=k,S=I.inputType;if(S==="insertParagraph"||S==="insertLineBreak"||S==="insertFromDrop"){k.preventDefault();return}if(S.startsWith("insert")||S.startsWith("delete")){let F=S.startsWith("delete")?"":I.data??"";N(F)&&k.preventDefault()}};return c.addEventListener("beforeinput",x),()=>c.removeEventListener("beforeinput",x)},[N]);let Ee=(0,E.useCallback)(()=>{te.current=!0,P.current?.setAttribute("data-aia-composing","true")},[]),Ce=(0,E.useCallback)(()=>{te.current=!1,P.current?.removeAttribute("data-aia-composing"),ae()},[ae]),qe=(0,E.useCallback)(c=>{c.preventDefault();let x=P.current;if(!x)return;let k=(c.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!k)return;let I=x.ownerDocument??document,S=I.getSelection();if(!S||S.rangeCount===0)return;let F=S.getRangeAt(0);if(!x.contains(F.startContainer))return;F.deleteContents();let se=I.createTextNode(k);F.insertNode(se),F.setStartAfter(se),F.collapse(!0),S.removeAllRanges(),S.addRange(F),ae()},[ae]),Ae=(0,E.useCallback)(c=>M(c),[M]),f=(0,E.useCallback)(()=>K(!0),[K]),Re=(0,E.useCallback)(()=>K(!1),[K]),De=(0,E.useCallback)(()=>P.current?.focus(),[]),Se=(0,E.useCallback)(()=>P.current?.blur(),[]),Oe=(0,E.useCallback)(()=>{let c=P.current;return c?(0,V.extractPlainText)(c):""},[]),de=Ia()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:de,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":d,"aria-expanded":C,"aria-activedescendant":v,spellCheck:!0,enterKeyHint:"send",onInput:ke,onKeyDown:Ae,onCompositionStart:Ee,onCompositionEnd:Ce,onPaste:qe,onFocus:f,onBlur:Re},getPlainText:Oe,focus:De,blur:Se}}var ue=require("react/jsx-runtime");function Ea(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var ea=(0,G.forwardRef)(function({onSubmit:i,onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,className:n,apiConfig:h,additionalContext:m,language:g,currency:w,productId:C,visitorId:d,columns:v,pillPlacement:l="dropdown",mode:A="auto",optionsPosition:M="below",animations:$=!0,dropdownTrigger:ee,closeDropdownOnBlur:R,showNonTappableOptions:N,showOptionIcons:K=!0,showChipIcons:P=!0,showChipImages:te=!0,showOptionImages:U=!0,showOptionCounts:Y=!0,showSkipButton:pe,showProducts:z,productsLayout:ae,productImageFallback:ke,autoFocus:Ee=!0,onFocus:Ce,onBlur:qe,value:Ae,completedParams:f,onChange:Re,onParamsChange:De,products:Se,mapProducts:Oe,onProductSelect:de,onProductAddToCart:c,submitButton:x,resetOnSubmit:k=!0},I){let S=(0,G.useRef)(null),F=(0,G.useRef)(null),se=(0,G.useRef)(()=>{}),u=(0,G.useRef)(null),ie=(0,G.useRef)(null);(0,G.useEffect)(()=>{let L=S.current;if(L)return u.current?u.current.setMode(A):u.current=new Ke.ModeController(L,A),()=>{u.current?.destroy(),u.current=null}},[A]);let me=(0,G.useCallback)(L=>{let oe=ie.current?.current;oe&&(oe.focus(),(0,Ke.setCursorOffset)(oe,L))},[]),{completedParams:ge,suggestionPills:We,setActivePill:fe,skipActivePill:be,segments:Ue,newParamId:Pe,clearNewParamId:Le,placeholderText:ze,isFocused:y,isDropdownOpen:Ye,isActivePillSelected:Qe,isLoading:we,activeIndex:b,listboxId:Me,handleTextChange:Ne,handleKeyDown:Ze,setFocused:gt,editingParam:ft,editingIdentified:$e,editingAnchor:bt,caretOffset:Fe,startEditingParam:_e,handleCaretAfterInput:Xe,handleCaretMove:it,replaceEditingRange:wt,dropdownProps:Je,reset:je,refreshProducts:p,prepareSubmit:q,getState:D,recordSubmit:ot}=ut({onSubmit:L=>se.current(L),onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,apiConfig:h,additionalContext:m,language:g,currency:w,productId:C,visitorId:d,columns:v,dropdownTrigger:ee,optionsPosition:M,closeDropdownOnBlur:R,showNonTappableOptions:N,showOptionIcons:K,showOptionImages:U,showOptionCounts:Y,showSkipButton:pe,showProducts:z,onFocus:Ce,onBlur:qe,value:Ae,completedParams:f,onChange:Re,onParamsChange:De,products:Se,mapProducts:Oe,onProductSelect:de,onProductAddToCart:c,source:"full-sdk",setCursor:me});(0,G.useEffect)(()=>{if(!Pe)return;let L=window.setTimeout(()=>Le(),650);return()=>window.clearTimeout(L)},[Pe,Le]);let ta=b>=0?`${Me}-option-${b}`:void 0,{inputRef:vt,editorProps:aa,focus:nt,blur:Et,getPlainText:At}=Jt({segments:Ue,newParamId:Pe,editingParam:ft,editingIdentified:$e,editingAnchor:bt,caretOffset:Fe,placeholderText:ze,isFocused:y,showChipIcons:P,showChipImages:te,isDropdownOpen:Ye,listboxId:Me,activeDescendantId:ta,autoFocus:Ee,handleTextChange:Ne,handleKeyDown:Ze,handleCaretAfterInput:Xe,handleCaretMove:it,startEditingParam:_e,replaceEditingRange:wt,setFocused:gt});ie.current=vt,(0,G.useLayoutEffect)(()=>{let L=F.current,oe=vt.current;if(!L||!oe)return;let et=()=>{let Dt=L.firstElementChild;if(!Dt)return;let ra=Dt.getBoundingClientRect(),sa=oe.getBoundingClientRect();ra.top>=sa.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};et();let Rt=new ResizeObserver(et);return Rt.observe(oe),()=>Rt.disconnect()},[Ue,We.length,we,vt]),(0,G.useImperativeHandle)(I,()=>({focus:nt,blur:Et,reset:je,refreshProducts:p,setMode:L=>u.current?.setMode(L),skipActivePill:be}),[nt,Et,je,p,be]);let rt=!!Ue.length||ge.length>0,xt=(0,G.useCallback)(L=>{if(!rt)return;L&&q();let oe=D(),et=(0,Ke.buildSubmitResult)(At(),oe.completedParams,oe.skippedParams,{identifiedParams:oe.identifiedParams,isReady:oe.isReady,customFields:oe.customFields});L&&ot(et),i(et),k&&je()},[ot,k,rt,q,D,i,je,At]);se.current=()=>xt(!1);let ia=(0,G.useCallback)(L=>{L.target?.closest("[data-aia-pill]")||nt()},[nt]),oa=l==="inline",na=l==="dropdown";return(0,ue.jsxs)("div",{ref:S,className:`magicx-aia ${Ve.container} ${n??""}`,"data-pill-placement":l,"data-options-position":M,"data-animations":$?"on":"off","data-mode":Ea(A),children:[(0,ue.jsx)(pt,{...Je,showPills:na,productsLayout:ae,productImageFallback:ke}),(0,ue.jsxs)("div",{className:Ve.inputWrapper,"data-aia-input-wrapper":"",onClick:ia,children:[(0,ue.jsxs)("div",{className:Ve.editorArea,"data-aia-editor":"",children:[(0,ue.jsx)("div",{...aa,className:Ve.input,"data-aia-input":""}),oa&&(we||We.length>0)&&(0,ue.jsx)("span",{ref:F,className:Ve.pillListContainer,"data-aia-pill-list-container":"",children:(0,ue.jsx)(dt,{pills:We,activePillIndex:0,activeSelected:Qe,onSelectPill:fe,loading:we})})]}),x===null?null:x===void 0?(0,ue.jsx)(Qt,{disabled:!rt,onClick:()=>xt(!0),label:(0,Ke.uiStringsFor)(g).submit}):(0,ue.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ve.submitSlot,onClick:L=>{rt&&(L.stopPropagation(),xt(!0))},children:x})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
2541
2652
|
//# sourceMappingURL=index.js.map
|