@magicx-eng/ai-autocomplete-react 0.57.2 → 0.59.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 +3 -1
- package/REFERENCE.md +5 -2
- package/dist/index.d.mts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +118 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{buildSubmitResult as
|
|
1
|
+
import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END as ms,DATE_RANGE_META_START as gs,DEFAULT_OPTION_COUNT_UNIT as fs,dateCellMarks as bs,formatDate as ws,formatDateRange as vs,formatOptionCount as xs,formatPlace as ys,formatTime as ks,isoDate as Cs,LOCATION_META_KEY as Ss,monthLabel as Ts,optionCountLabel as Ps,optionHasImage as Is,optionImageSources as Es,optionImageSrc as As,optionLabel as Rs,optionsShowLeadingVisuals as Os,PRODUCT_PATH_PREFIX as Ls,parseDate as zs,parseLooseDate as Ds,parseLooseDateRange as Ms,parseTime as Ns,productFromMatchedItem as Fs,productImageSources as Hs,productsFromCustomFields as Bs,sanitizeOptionIconSvg as Ws,selectedRangeFor as Gs,TIME_META_KEY as Ks,visibleDateRange as qs,WEEKDAY_LABELS as _s,withSkippedParams as Vs}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as jo,useCallback as ya,useEffect as Na,useImperativeHandle as $o,useLayoutEffect as Zo,useRef as ta}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
|
|
2
2
|
position: relative;
|
|
3
3
|
/* Inherits the host page's font by default. Consumers can pin a specific
|
|
4
4
|
font on the library via \`--aia-font-family: 'Custom Font'\` without
|
|
@@ -406,7 +406,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
406
406
|
transition: none;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
`,document.head.appendChild(e)}var
|
|
409
|
+
`,document.head.appendChild(e)}var _e={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"};import{attachScrollArrow as oo,attachViewportFit as no,containScroll as ro,dateFloorFor as so,destroyPanelMorph as lo,findMultiSelectDone as co,fitMultiSelectDone as po,hasSkippablePill as ho,isCalendarFormat as uo,labelTraditionalAutocomplete as mo,panelMorphKey as go,queryLive as fo,settlePanelMorph as bo,syncPanelHug as wo,uiStringsFor as vo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ue,useLayoutEffect as Oa,useRef as Xe,useState as xo}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
410
410
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
411
411
|
* Consumer CSS always wins without !important.
|
|
412
412
|
*
|
|
@@ -653,6 +653,11 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
653
653
|
--aia-done-bg: #e4e8f0;
|
|
654
654
|
--aia-done-bg-hover: #d8dde8;
|
|
655
655
|
--aia-done-color: #2a3150;
|
|
656
|
+
/* The opt-in "See all results" button (\`seeAllResults\`): a solid
|
|
657
|
+
near-black button under white text. */
|
|
658
|
+
--aia-see-all-bg: #2b2b2b;
|
|
659
|
+
--aia-see-all-bg-hover: #3d3d3d;
|
|
660
|
+
--aia-see-all-color: #ffffff;
|
|
656
661
|
|
|
657
662
|
--aia-footer-hint-color: var(--aia-primitive-neutral-500);
|
|
658
663
|
--aia-footer-brand-color: var(--aia-primitive-neutral-700);
|
|
@@ -719,6 +724,11 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
719
724
|
--aia-done-bg: var(--aia-confirm-bg);
|
|
720
725
|
--aia-done-bg-hover: var(--aia-confirm-bg-hover);
|
|
721
726
|
--aia-done-color: var(--aia-confirm-color);
|
|
727
|
+
/* A black pill vanishes on the dark surface, so "See all results" takes the
|
|
728
|
+
dark theme's confirm colors too. */
|
|
729
|
+
--aia-see-all-bg: var(--aia-confirm-bg);
|
|
730
|
+
--aia-see-all-bg-hover: var(--aia-confirm-bg-hover);
|
|
731
|
+
--aia-see-all-color: var(--aia-confirm-color);
|
|
722
732
|
|
|
723
733
|
--aia-footer-hint-color: var(--aia-primitive-neutral-700);
|
|
724
734
|
--aia-footer-brand-color: var(--aia-primitive-neutral-500);
|
|
@@ -1107,6 +1117,37 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
1107
1117
|
);
|
|
1108
1118
|
}
|
|
1109
1119
|
}
|
|
1120
|
+
/* While the panel glides wider (panelMorph.ts), its new content is laid out at
|
|
1121
|
+
the width it lands at and the panel, which clips, reveals it as it opens:
|
|
1122
|
+
squeezed into the narrow width it starts from, two columns would wrap. The
|
|
1123
|
+
leaving copy keeps its own width. */
|
|
1124
|
+
[data-aia-dropdown][data-aia-glide-width]
|
|
1125
|
+
> :not(.magicx-aia-panel-ghost):not([data-aia-scroll-arrow]) {
|
|
1126
|
+
min-width: var(--aia-glide-content-width, auto);
|
|
1127
|
+
}
|
|
1128
|
+
/* The All row's tile shows the first options' pictures together: two side by
|
|
1129
|
+
side, three as a tall half and two quarters, four in a 2x2 grid. Each is
|
|
1130
|
+
cropped to its cell, since a contained picture would leave the cells
|
|
1131
|
+
mostly empty. */
|
|
1132
|
+
[data-aia-option] [data-aia-collage] {
|
|
1133
|
+
display: grid;
|
|
1134
|
+
grid-template-columns: 1fr 1fr;
|
|
1135
|
+
gap: 1px;
|
|
1136
|
+
}
|
|
1137
|
+
[data-aia-option] [data-aia-collage="3"],
|
|
1138
|
+
[data-aia-option] [data-aia-collage="4"] {
|
|
1139
|
+
grid-template-rows: 1fr 1fr;
|
|
1140
|
+
}
|
|
1141
|
+
[data-aia-option] [data-aia-collage="3"] > img:first-child {
|
|
1142
|
+
grid-row: 1 / span 2;
|
|
1143
|
+
}
|
|
1144
|
+
[data-aia-option] [data-aia-collage] > img {
|
|
1145
|
+
width: 100%;
|
|
1146
|
+
height: 100%;
|
|
1147
|
+
min-width: 0;
|
|
1148
|
+
min-height: 0;
|
|
1149
|
+
object-fit: cover;
|
|
1150
|
+
}
|
|
1110
1151
|
/* Done spans the panel, whatever the panel's width. */
|
|
1111
1152
|
[data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *)) [data-aia-multi-done] {
|
|
1112
1153
|
width: var(--aia-multi-done-width, 100%);
|
|
@@ -1317,7 +1358,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
1317
1358
|
A bare down chevron at the bottom-centre of the option list, shown while
|
|
1318
1359
|
there is more to scroll to \u2014 no disc, border or shadow around it. It rests
|
|
1319
1360
|
just above the grid's reserved band, or \u2014 when a product strip follows the
|
|
1320
|
-
grid \u2014 centred on the strip's "
|
|
1361
|
+
grid \u2014 centred on the strip's "Items" label row, off the last option row
|
|
1321
1362
|
(--aia-scroll-arrow-bottom is measured and set inline by the controller so
|
|
1322
1363
|
it tracks the layout). It never travels with the scroll: the controller toggles
|
|
1323
1364
|
data-aia-visible and the only thing that transitions is opacity \u2014 a slow,
|
|
@@ -1541,6 +1582,45 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
1541
1582
|
background: var(--aia-multi-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
1542
1583
|
}
|
|
1543
1584
|
|
|
1585
|
+
/* With a "See all results" button in the same panel, that button is the
|
|
1586
|
+
filled one: Done drops its fill so the panel does not end on two solid
|
|
1587
|
+
bars (vanilla's styles.css explains the two tokens). */
|
|
1588
|
+
.aia-dropdown-yz2KC:has([data-aia-see-all]) .aia-multiDone-y12U7:not(:hover) {
|
|
1589
|
+
background: var(--aia-multi-done-bg-beside-see-all, transparent);
|
|
1590
|
+
color: var(--aia-multi-done-color-beside-see-all, var(--aia-option-color-selected, #2a3150));
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
/* --- See all results (opt-in: \`seeAllResults\`) ---
|
|
1594
|
+
A button under the products that submits the query: near-black in light
|
|
1595
|
+
mode, the confirm gray in dark (appearance.css sets both). The same box as
|
|
1596
|
+
the multi-select Done above it. Declarations match vanilla's styles.css
|
|
1597
|
+
(seeAllResultsParity.test.ts). */
|
|
1598
|
+
.aia-seeAllRow-icrau {
|
|
1599
|
+
padding: 4px 0 0;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
.aia-seeAll-0Zbgc {
|
|
1603
|
+
display: block;
|
|
1604
|
+
width: 100%;
|
|
1605
|
+
min-height: var(--aia-see-all-height, 48px);
|
|
1606
|
+
padding: 0 16px;
|
|
1607
|
+
border: none;
|
|
1608
|
+
border-radius: var(--aia-see-all-radius, 12px);
|
|
1609
|
+
background: var(--aia-see-all-bg, #2b2b2b);
|
|
1610
|
+
color: var(--aia-see-all-color, #ffffff);
|
|
1611
|
+
font-family: inherit;
|
|
1612
|
+
font-size: var(--aia-see-all-font-size, 16px);
|
|
1613
|
+
font-weight: 700;
|
|
1614
|
+
line-height: 20px;
|
|
1615
|
+
text-align: center;
|
|
1616
|
+
cursor: pointer;
|
|
1617
|
+
transition: background-color 150ms ease-out;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
.aia-seeAll-0Zbgc:hover {
|
|
1621
|
+
background: var(--aia-see-all-bg-hover, #3d3d3d);
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1544
1624
|
/* The open panel's leaving ghost (panelMorph.ts) is a frozen copy of the
|
|
1545
1625
|
last step: the rows' own entrance must not replay in it while it fades. */
|
|
1546
1626
|
.aia-dropdown-yz2KC .magicx-aia-panel-ghost,
|
|
@@ -1607,7 +1687,29 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
1607
1687
|
animation: aia-multiActionsFadeIn-zbGTG 160ms ease-out;
|
|
1608
1688
|
}
|
|
1609
1689
|
|
|
1690
|
+
/* "See all results" leaves and returns with the options the same way. */
|
|
1691
|
+
.aia-dropdown-yz2KC[data-aia-loading] [data-aia-see-all] {
|
|
1692
|
+
pointer-events: none;
|
|
1693
|
+
animation: aia-seeAllLoadingOut-THnrl 160ms ease-in forwards;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
.aia-dropdown-yz2KC:not([data-aia-loading]) [data-aia-see-all] {
|
|
1697
|
+
animation: aia-seeAllFadeIn-1GWpl 160ms ease-out;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1610
1700
|
/* Ends and starts a hair above zero: iOS cancels a tap on an element at 0. */
|
|
1701
|
+
@keyframes aia-seeAllLoadingOut-THnrl {
|
|
1702
|
+
to {
|
|
1703
|
+
opacity: 0.01;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
@keyframes aia-seeAllFadeIn-1GWpl {
|
|
1708
|
+
from {
|
|
1709
|
+
opacity: 0.01;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1611
1713
|
@keyframes aia-multiActionsLoadingOut-lSdMh {
|
|
1612
1714
|
to {
|
|
1613
1715
|
opacity: 0.01;
|
|
@@ -1622,7 +1724,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
1622
1724
|
opacity: 1;
|
|
1623
1725
|
}
|
|
1624
1726
|
}
|
|
1625
|
-
`,document.head.appendChild(e)}var
|
|
1727
|
+
`,document.head.appendChild(e)}var ce={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as Gt,cellIso as la,dateCellMarks as Kt,isDimmedDay as qt,isoDate as _t,monthLabel as Vt,visibleDateRange as Ut,WEEKDAY_LABELS as Qt}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Yt}from"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) ---
|
|
1626
1728
|
|
|
1627
1729
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1628
1730
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1819,7 +1921,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
1819
1921
|
opacity: 0.8;
|
|
1820
1922
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1821
1923
|
}
|
|
1822
|
-
`,document.head.appendChild(e)}var
|
|
1924
|
+
`,document.head.appendChild(e)}var K={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};import{jsx as xe,jsxs as Qa}from"react/jsx-runtime";var jt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ya({options:e,activeIndex:n,listboxId:a,view:t,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:f,onNextMonth:w}){let y=_t(new Date),m=Ut({pendingStart:o.rangeStart,highlightedIso:la(e[n]),selected:o.selectedRange,floor:o.floor});return Qa("div",{className:K.datepicker,"data-aia-datepicker":"",children:[Qa("div",{className:K.header,children:[xe("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:f,children:"\u2039"}),xe("span",{className:K.month,"data-aia-date-month":"","aria-live":"polite",children:Vt(t)}),xe("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:w,children:"\u203A"})]}),xe("div",{className:K.weekdays,"aria-hidden":"true",children:Qt.map((h,c)=>xe("span",{className:K.weekday,children:h},jt[c]))}),xe("div",{className:K.grid,"data-aia-date-grid":"",children:e.map((h,c)=>xe($t,{option:h,id:`${a}-option-${c}`,index:c,isHighlighted:c===n&&h.is_tappable,isToday:la(h)===y,isPast:qt(la(h),y,o.floor),marks:Kt(la(h),{selectedIso:o.selectedIso,range:m,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},la(h)??`pad-${c}`))})]})}function $t({option:e,id:n,index:a,isHighlighted:t,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:f,onUnhighlight:w}){let[y,m]=Yt(!1),h=Gt(e);if(h==null)return xe("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${K.cell} ${K.blank}`});let c=()=>{m(!0),l(e),setTimeout(()=>m(!1),170)},v=[K.cell,K.day,s?K.past:"",t?K.highlighted:"",o?K.today:"",r.inRange?K.inRange:"",r.selected?K.selected:"",r.reference?K.reference:"",y?K.pressed:""].filter(Boolean).join(" ");return xe("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":t,"aria-label":e.text,tabIndex:0,className:v,onClick:c,onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),c())},onMouseEnter:()=>f(a),onMouseLeave:w?()=>w(a):void 0,children:xe("span",{className:K.number,children:h})})}import{ATTRIBUTION_URL as Zt,buildAttributionUrl as Xt,getFooterHint as Jt,uiStringsFor as ei}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ai,useState as ti}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
|
|
1823
1925
|
display: flex;
|
|
1824
1926
|
flex-wrap: wrap;
|
|
1825
1927
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1859,7 +1961,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
1859
1961
|
.aia-cluster[data-justify="around"] {
|
|
1860
1962
|
justify-content: space-around;
|
|
1861
1963
|
}
|
|
1862
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
1964
|
+
`,document.head.appendChild(e)}import{jsx as ja}from"react/jsx-runtime";function da({gap:e,align:n="center",justify:a="start",noWrap:t=!1,inline:o=!1,className:s,children:r,...l}){let f=e?{"--aia-cluster-gap":e}:void 0,w={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":n,"data-justify":a,"data-nowrap":t||void 0,"data-inline":o||void 0,style:f,...l};return o?ja("span",{...w,children:r}):ja("div",{...w,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
|
|
1863
1965
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1864
1966
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1865
1967
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -2006,7 +2108,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
2006
2108
|
justify-content: flex-end;
|
|
2007
2109
|
}
|
|
2008
2110
|
}
|
|
2009
|
-
`,document.head.appendChild(e)}var
|
|
2111
|
+
`,document.head.appendChild(e)}var Ae={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"};import{jsx as ca,jsxs as Ca}from"react/jsx-runtime";function $a({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:a=ei()}){let{key:t,hint:o}=Jt(e,n,a),[s,r]=ti(Zt);return ai(()=>{r(Xt())},[]),ca("footer",{className:Ae.footer,"data-aia-footer":"",children:Ca(da,{justify:"between",noWrap:!0,className:Ae.row,children:[Ca(da,{gap:"5px",className:Ae.hintGroup,children:[ca("kbd",{className:Ae.key,children:t}),ca("span",{className:Ae.hint,children:o})]}),Ca("a",{className:Ae.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[ca("span",{className:Ae.brand,children:"AI"}),ca("span",{className:Ae.badge,children:"Autocomplete"})]})]})})}import{useEffect as Za,useLayoutEffect as ii,useRef as pe}from"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
|
|
2010
2112
|
Angular copy). The three are kept identical by
|
|
2011
2113
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
2012
2114
|
.aia-location-6-fsr {
|
|
@@ -2140,7 +2242,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
2140
2242
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2141
2243
|
width: 60%;
|
|
2142
2244
|
}
|
|
2143
|
-
`,document.head.appendChild(e)}var U={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"};import{jsx as
|
|
2245
|
+
`,document.head.appendChild(e)}var U={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"};import{jsx as le,jsxs as Ne}from"react/jsx-runtime";var oi=0;function pa(e){return e.getRootNode().activeElement??null}function et(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Xa(e){if(!e.isContentEditable)return null;let n=et(e);if(!n||n.rangeCount===0)return null;let a=n.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function Ja(e,n){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=et(e);if(!a)return;let t=n;(!t||!t.startContainer.isConnected||!e.contains(t.startContainer))&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1)),a.removeAllRanges(),a.addRange(t)}var ni=Ne("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[le("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),le("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),ri=Ne("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[le("circle",{cx:"11",cy:"11",r:"7"}),le("path",{d:"m20 20-3.5-3.5"})]});function at({view:e,searchLabel:n,noResultsLabel:a,useTypedLabel:t,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:f,onMove:w,onCommit:y,onFocusChange:m}){let h=pe(null),c=pe(null),v=pe(null),I=pe(null),q=pe(null),D=pe(!1),O=pe(!1),te=pe(!1),T=pe(!1),z=pe(o);z.current=o;let _=pe(m);_.current=m;let F=d=>{T.current=d,m(d)},Y=()=>{let d=h.current;return d!=null&&pa(d)===d},E=()=>{let d=c.current;if(!d)return;let S=pa(d);S instanceof HTMLElement&&S!==h.current&&S!==document.body&&!d.contains(S)&&(I.current=S,q.current=Xa(S))},X=d=>{let S=c.current;!S||!(d instanceof HTMLElement)||d===I.current||d===document.body||S.contains(d)||(I.current=d,q.current=Xa(d))},G=pe(null);G.current===null&&(G.current=`aia-location-${++oi}`);let H=`${G.current}-row-`;Za(()=>{let d=h.current;d&&d.value!==e.query&&pa(d)!==d&&(d.value=e.query)},[e.query]),Za(()=>{o&&(s&&!te.current&&(O.current=!1),te.current=s);let d=h.current;if(d){if(!r&&Y()){O.current=!0,j();return}if(!o){setTimeout(()=>{if(z.current)return;let S=I.current;S&&pa(S)===S||(O.current=!1)},0);return}if(!(!s||O.current||!l||Y())){if(E(),F(!0),d.focus({preventScroll:!0}),!Y()){O.current=!0,F(!1);return}d.value&&d.select()}}}),ii(()=>()=>{if(!T.current)return;let d=h.current,S=I.current;S?.isConnected&&d&&pa(d)===d&&(D.current=!0,Ja(S,q.current),D.current=!1),T.current=!1,_.current(!1)},[]);let j=(d=!1)=>{d&&(O.current=!0);let S=I.current;S?.isConnected&&Y()&&(D.current=!0,Ja(S,q.current),D.current=!1),F(!1)},de=e.query.trim(),C=e.highlighted>=0&&e.highlighted<e.places.length?`${H}${e.highlighted}`:void 0,B=null;return e.places.length>0?B=e.places.map((d,S)=>Ne("div",{id:`${H}${S}`,role:"option","aria-selected":S===e.highlighted,className:S===e.highlighted?`${U.row} ${U.highlighted}`:U.row,"data-aia-location-row":"","data-aia-index":S,onClick:()=>{l&&(j(!0),y(S))},children:[le("span",{className:U.pin,children:ni}),Ne("span",{className:U.text,children:[le("span",{className:U.name,children:d.name}),d.secondary&&le("span",{className:U.secondary,children:d.secondary})]})]},d.id)):e.status==="loading"?B=Ne("div",{className:U.loading,"data-aia-location-loading":"",children:[le("span",{className:U.loadingBar}),le("span",{className:U.loadingBar}),le("span",{className:U.loadingBar})]}):de&&(B=Ne("div",{className:U.note,"data-aia-location-note":"",children:[e.status==="done"&&le("span",{className:U.empty,children:a}),le("span",{children:t})]})),Ne("div",{ref:c,className:U.location,"data-aia-location":"",onMouseDown:d=>{!(d.target instanceof Node)||!v.current?.contains(d.target)||(d.stopPropagation(),E(),F(!0))},children:[Ne("label",{ref:v,className:U.field,children:[ri,le("input",{ref:h,type:"text",className:U.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:n,"aria-label":n,"aria-activedescendant":C,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:d=>f(d.target.value),onFocus:d=>{X(d.relatedTarget),F(!0)},onBlur:()=>{D.current||(O.current=!0,F(!1))},onKeyDown:d=>{if(!d.nativeEvent.isComposing)switch(d.key){case"ArrowDown":case"ArrowUp":d.preventDefault(),w(d.key==="ArrowDown"?1:-1);return;case"Enter":if(d.preventDefault(),!l)return;j(!0),y();return;case"Escape":d.preventDefault(),d.stopPropagation(),O.current=!0,j();return;case"Backspace":if(d.currentTarget.value!=="")return;d.preventDefault(),O.current=!0,j();return}}})]}),le("div",{className:U.results,"data-aia-location-results":"","aria-live":"polite",children:B})]})}import{isSmartSuggestion as ci,isTraditionalAutocompleteSuggestion as pi}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as si}from"@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,
|
|
2144
2246
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2145
2247
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2146
2248
|
as it was when the outline was dashed. */
|
|
@@ -2298,7 +2400,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
2298
2400
|
opacity: 0;
|
|
2299
2401
|
}
|
|
2300
2402
|
}
|
|
2301
|
-
`,document.head.appendChild(e)}var
|
|
2403
|
+
`,document.head.appendChild(e)}var ye={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};import{Fragment as li,jsx as Sa,jsxs as di}from"react/jsx-runtime";var Ta={selected:1,first:.7,next:.4,last:.2};function tt({label:e,state:n,active:a,rounded:t,loading:o,smartSuggestion:s,completionHeader:r,onClick:l}){let f=[ye.pill,t?ye.rounded:"",o?ye.skeleton:""].filter(Boolean).join(" ");return Sa("button",{type:"button","data-aia-pill":"","data-aia-pill-active":a?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:f,style:{"--aia-pill-opacity":Ta[n]},onMouseDown:w=>w.preventDefault(),onClick:o?void 0:l,disabled:o,children:s?di(li,{children:[Sa("span",{className:`${ye.smartText} magicx-aia-smart-suggestion-text`,children:e}),Sa("span",{className:`${ye.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:si}})]}):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 {
|
|
2302
2404
|
position: relative;
|
|
2303
2405
|
z-index: 1;
|
|
2304
2406
|
pointer-events: auto;
|
|
@@ -2308,7 +2410,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
2308
2410
|
align-items: center;
|
|
2309
2411
|
vertical-align: middle;
|
|
2310
2412
|
}
|
|
2311
|
-
`,document.head.appendChild(e)}var
|
|
2413
|
+
`,document.head.appendChild(e)}var Pa={list:"aia-list-qvLqO"};import{jsx as ga}from"react/jsx-runtime";var hi=[125,69];function it(e){return e===0?"first":e===1?"next":"last"}function fa({pills:e,activePillIndex:n,onSelectPill:a,activeSelected:t,rounded:o,loading:s}){return s&&e.length===0?ga("span",{className:Pa.list,"data-aia-pill-list-loading":"",children:hi.map((r,l)=>ga("span",{"data-aia-pill-skeleton":"",className:`${ye.pill} ${o?ye.rounded:""} ${ye.skeleton}`,style:{width:r,"--aia-pill-opacity":Ta[it(l)]}},`skel-${r}`))}):ga("span",{className:Pa.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let f=!!t&&l===n;return ga(tt,{label:r.text,state:f?"selected":it(l),selected:f,active:l===n,rounded:o,loading:s,smartSuggestion:ci(r),completionHeader:pi(r),onClick:()=>a(l)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as ui,productImageSources as mi,productImageSrc as gi,productInitial as fi,productPhotoFill as bi,uiStringsFor as wi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ia,useRef as ba,useState as wa}from"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
|
|
2312
2414
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2313
2415
|
theming one package sees the same result in the other.
|
|
2314
2416
|
|
|
@@ -2901,7 +3003,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
2901
3003
|
opacity: 0.01;
|
|
2902
3004
|
}
|
|
2903
3005
|
}
|
|
2904
|
-
`,document.head.appendChild(e)}var Q={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};import{jsx as
|
|
3006
|
+
`,document.head.appendChild(e)}var Q={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};import{jsx as ee,jsxs as Ze}from"react/jsx-runtime";function ot({products:e,listboxId:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s=!0,loading:r=!1,layout:l="row",imageFallback:f="image",strings:w=wi()}){let y=e.length>0,m=ba(null);if(Ia(()=>{let c=m.current;if(!(!y||!c))return ui(c)},[y]),!y)return null;let h=`${n}-products-label`;return Ze("section",{className:Q.section,"data-aia-products":"","data-aia-loading":r?"":void 0,"data-aia-products-layout":l,role:"group","aria-labelledby":h,children:[ee("div",{className:Q.label,id:h,"data-aia-products-label":"",children:w.products}),ee("div",{ref:m,className:Q.row,"data-aia-products-row":"",children:e.map((c,v)=>ee(vi,{product:c,id:`${n}-product-${v}`,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:f,soldOut:w.soldOut,addToCart:w.addToCart},c.id))})]})}function vi({product:e,id:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:r,soldOut:l,addToCart:f}){let w=!!t&&e.available!==!1,[y,m]=wa(null),h=v=>{v.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},c=v=>{v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||v.button!==0||(v.preventDefault(),a(e))};return Ze("a",{id:n,className:Q.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":w?"":void 0,role:"option","aria-selected":!1,style:y?{"--aia-product-photo-fill-x":String(y.x),"--aia-product-photo-fill-y":String(y.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:c,onKeyDown:v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),a(e))},onFocus:()=>o?.(!0),onBlur:h,children:[ee(ki,{sources:mi(e.imageUrl),title:e.title,fallback:r,onPhotoFill:m},gi(e.imageUrl)??""),Ze("span",{className:Q.body,children:[e.vendor?ee("span",{className:Q.vendor,children:e.vendor}):null,ee("span",{className:Q.title,children:e.title}),e.price?Ze("span",{className:Q.price,children:[e.price,e.compareAtPrice?ee("s",{className:Q.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?ee("span",{className:Q.badge,children:l}):null]}),w&&t?ee(yi,{product:e,label:`${f}: ${e.title}`,focusable:s,onAddToCart:t,onFocus:()=>o?.(!0),onBlur:h},xi(e)):null]})}function xi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function yi({product:e,label:n,focusable:a,onAddToCart:t,onFocus:o,onBlur:s}){let[r,l]=wa(null),f=ba(null),w=ba(e);w.current=e;let y=ba(!0);Ia(()=>(y.current=!0,()=>{y.current=!1}),[]);let m=c=>{f.current=c,y.current&&l(c)},h=c=>{if(c.preventDefault(),c.stopPropagation(),f.current==="adding")return;m("adding");let v;try{v=Promise.resolve(t(w.current))}catch(I){v=Promise.reject(I)}v.then(()=>m("added"),()=>m(null))};return ee("span",{className:Q.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:a?0:-1,onClick:h,onKeyDown:c=>{c.key!=="Enter"&&c.key!==" "||h(c)},onFocus:c=>{c.stopPropagation(),o()},onBlur:c=>{c.stopPropagation(),s(c)},children:Ze("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[ee("path",{className:Q.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"}),ee("path",{className:Q.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),ee("path",{className:Q.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),ee("path",{className:Q.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),ee("circle",{className:Q.cartGlyph,cx:"9",cy:"20",r:"1.3"}),ee("circle",{className:Q.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function ki({sources:e,title:n,fallback:a,onPhotoFill:t}){let[o,s]=wa(0),r=e[o],l=!!r,[f,w]=wa(null),y=!l&&a==="initial";return Ia(()=>()=>t(null),[t]),Ze("span",{className:Q.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":l&&f===r?"":void 0,children:[l?ee("img",{className:Q.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{w(r),t(bi(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&t(null),s(m=>m+1)}}):null,y?fi(n):null]})}import{isOptionsGridMobileViewport as Ni,measureOptionsGrid as Fi,needsOptionsGridMeasurement as Hi,OPTIONS_GRID_MOBILE_QUERY as Bi,optionEnterDelayMs as Wi,optionsShowLeadingVisuals as Gi,planOptionsGrid as dt,releasePanelHug as Ki,sameOptionRows as qi,syncPanelHug as _i}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Vi,useLayoutEffect as ct,useRef as pt,useState as ut}from"react";import{optionsGridTemplateColumns as Ci}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Si,useRef as Ti}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
|
|
2905
3007
|
display: grid;
|
|
2906
3008
|
grid-template-columns: repeat(
|
|
2907
3009
|
auto-fit,
|
|
@@ -2945,7 +3047,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
2945
3047
|
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
2946
3048
|
max-height: var(--aia-grid-max-height, 120px);
|
|
2947
3049
|
}
|
|
2948
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
3050
|
+
`,document.head.appendChild(e)}import{jsx as Pi}from"react/jsx-runtime";function nt({min:e="16rem",max:n,gap:a,scroll:t=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:f,className:w,children:y,...m}){let h=Ti(null);Si(()=>{if(s===void 0)return;let v=h.current;v&&(v.scrollTop=0)},[s]);let c={"--aia-grid-min":e};return n&&(c["--aia-grid-max"]=n),a&&(c["--aia-grid-gap"]=a),o&&(c["--aia-grid-max-height"]=o),r&&(c.gridTemplateColumns=Ci(r)),l&&(c.gridTemplateColumns=l),Pi("div",{ref:v=>{h.current=v,f?.(v)},className:w?`aia-grid ${w}`:"aia-grid","data-scroll":t||void 0,style:c,...m,children:y})}import{formatOptionCount as Ii,highlightParts as Ei,isMultiSelectToggleTap as Ai,OPTION_ENTER_DELAY_VAR as Ri,optionImageSources as rt,optionLabel as st,sanitizeOptionIconSvg as Oi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Li,useMemo as zi,useRef as Di,useState as ha}from"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 {
|
|
2949
3051
|
position: relative;
|
|
2950
3052
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
2951
3053
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3465,7 +3567,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
3465
3567
|
border-radius: 6px;
|
|
3466
3568
|
font-size: 11px;
|
|
3467
3569
|
}
|
|
3468
|
-
`,document.head.appendChild(e)}var
|
|
3570
|
+
`,document.head.appendChild(e)}var $={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};import{Fragment as Mi,jsx as me,jsxs as Ea}from"react/jsx-runtime";function lt({option:e,isHighlighted:n,checked:a,onSelect:t,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:f=!0,showImage:w=!0,showCount:y=!0,scrollHint:m,enterDelayMs:h=0}){let[c]=ha(h),[v,I]=ha(!1),q=w?rt(e.image_url):[],D=q[0]??null,[O,te]=ha([]),T=q.find(C=>!O.includes(C))??null,z=w?(e.imageCollage??[]).map(C=>rt(C)[0]).filter(C=>C!==void 0):[],[_,F]=ha(!1),[Y,E]=ha(null),X=zi(()=>!D&&f&&e.icon_svg?Oi(e.icon_svg):null,[D,f,e.icon_svg]),G=y?Ii(e.item_count):null,H=Di(void 0);Li(()=>()=>clearTimeout(H.current),[]);let j=C=>{if(l||!e.is_tappable||v&&a===void 0)return;I(!0);let B=C?.currentTarget;a!==void 0&&B!==void 0&&C!==void 0&&!Ai(B,B.querySelector("[data-aia-checkbox]"),C)?t(e,{commit:!0}):t(e),clearTimeout(H.current),H.current=setTimeout(()=>I(!1),170)},de=[$.item,n&&!l?$.highlighted:"",e.liveMatch&&!l?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,v?$.pressed:"",m?$.scrollHint:""].filter(Boolean).join(" ");return me("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":X&&e.icon?e.icon:void 0,"data-aia-image":D?"":void 0,"data-aia-item-count":G!==null?e.item_count:void 0,"aria-selected":a??n,className:de,style:{[Ri]:`${c}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:j,onKeyDown:C=>{!l&&e.is_tappable&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),j())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:Ea("span",{className:$.content,children:[a!==void 0&&e.is_tappable&&me("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),D&&z.length>1&&me("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":z.length,"data-aia-image-loaded":_?"":void 0,children:z.map(C=>me("img",{src:C,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>F(!0),onError:B=>{B.currentTarget.hidden=!0}},C))}),D&&z.length<=1&&me("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":T!==null&&Y===T?"":void 0,children:me("img",{src:T??D,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:T===null,onLoad:()=>E(T),onError:()=>{T!==null&&te(C=>[...C,T])}})}),X&&me("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:X}}),Ea("span",{className:$.text,children:[e.matchedText?Ei(st(e),e.matchedText).map((C,B)=>C.bold?me("strong",{className:`${$.match} magicx-aia-option-match`,children:C.text},B):C.text):st(e),e.parameterLabel&&Ea(Mi,{children:[" ",me("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&me("span",{className:$.tag,children:e.tag}),G!==null&&me("span",{className:`${$.count} magicx-aia-option-count`,children:G})]})})}import{jsx as ht}from"react/jsx-runtime";function Ui(){let[e,n]=ut(Ni);return Vi(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(Bi),t=()=>n(a.matches);return t(),a.addEventListener("change",t),()=>a.removeEventListener("change",t)},[]),e}function mt({options:e,activeIndex:n,picked:a,onSelect:t,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:f="",optionsPosition:w="below",showIcons:y=!0,showImages:m=!0,showCounts:h=!0}){let c=Ui(),v=pt(null),[I,q]=ut(null),D=pt(null);ct(()=>{if(l&&qi(D.current,e))return;D.current=l?null:e;let T=v.current,z=T&&!l&&Hi(e.length,c),_=T?.closest("[data-aia-dropdown]");z&&_&&Ki(_);let F=z?Fi(T):null;q(F?dt(e.length,c,F.rowWidths,F.gridWidth):null)},[e,c,l]);let O=I??dt(e.length,c,null,null);ct(()=>{let T=v.current?.closest("[data-aia-dropdown]");T&&_i(T)},[O.template,c]);let te=Gi(e,y,m);return ht(nt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:f,template:O.template,maxHeight:O.maxHeight,innerRef:T=>{v.current=T},"data-aia-group":f,children:e.map((T,z)=>ht(lt,{option:T,isHighlighted:z===n,checked:a?a.includes(T.text):void 0,onSelect:t,onHighlight:()=>o(z),onUnhighlight:s?()=>s(z):void 0,id:`${r}-option-${z}`,loading:l,showIcon:y&&te,showImage:m&&te,showCount:h,scrollHint:!l&&O.scrollHintIndices.includes(z),enterDelayMs:l?0:Wi(z,O.cols,e.length,w)},`${f}\0${T.parameter??""}\0${T.text}`))})}import{formatTime as Qi,TIME_WHEEL_COLUMNS as Yi,TIME_WHEEL_ROW_HEIGHT as ji,timeWheelIndex as gt,timeWheelIndexFromScroll as $i,timeWheelRows as Zi,withTimeWheelIndex as ft}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as Xi,useEffect as Ji,useLayoutEffect as eo,useRef as va}from"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) ---
|
|
3469
3571
|
|
|
3470
3572
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3471
3573
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3587,7 +3689,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
3587
3689
|
.aia-done-llNY5:hover {
|
|
3588
3690
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3589
3691
|
}
|
|
3590
|
-
`,document.head.appendChild(e)}var
|
|
3692
|
+
`,document.head.appendChild(e)}var ge={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"};import{jsx as Ve,jsxs as Aa}from"react/jsx-runtime";var ao=120;function bt({view:e,label:n,doneLabel:a,interactive:t=!0,onTimeChange:o,onTimeCommit:s}){return Aa("div",{className:ge.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:r=>r.preventDefault(),children:[Ve("span",{className:ge.value,"data-aia-time-value":"","aria-live":"polite",children:Qi(e.minutes)}),Aa("div",{className:ge.columns,"aria-hidden":"true",children:[Ve("div",{className:ge.band}),Yi.map(r=>Aa(Xi,{children:[r==="minute"&&Ve("span",{className:ge.separator,children:":"}),Ve(to,{column:r,minutes:e.minutes,interactive:t,onTimeChange:o})]},r))]}),Ve("button",{type:"button",tabIndex:-1,className:ge.done,"data-aia-time-done":"",onClick:()=>{t&&s()},children:a})]})}function to({column:e,minutes:n,interactive:a,onTimeChange:t}){let o=va(null),s=va(null),r=va(null),l=va({minutes:n,interactive:a,onTimeChange:t});l.current={minutes:n,interactive:a,onTimeChange:t};let f=gt(e,n);eo(()=>{let m=o.current;if(!m||r.current)return;let h=f*ji;Math.abs(m.scrollTop-h)<1||(s.current=h,m.scrollTop=h)},[f]),Ji(()=>()=>{r.current&&clearTimeout(r.current)},[]);let w=()=>{r.current=null;let m=o.current,h=l.current;if(!m||!h.interactive)return;let c=$i(e,m.scrollTop);c!==gt(e,h.minutes)&&h.onTimeChange(ft(e,h.minutes,c))},y=()=>{let m=o.current;if(m){if(s.current!=null&&Math.abs(m.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(w,ao)}};return Ve("div",{ref:o,className:ge.column,"data-aia-time-column":e,onScroll:y,children:Zi(e).map((m,h)=>Ve("div",{className:h===f?`${ge.row} ${ge.selected}`:ge.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{l.current.interactive&&t(ft(e,l.current.minutes,h))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
|
|
3591
3693
|
display: flex;
|
|
3592
3694
|
flex-direction: column;
|
|
3593
3695
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3602,7 +3704,7 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
3602
3704
|
align-items: end;
|
|
3603
3705
|
}
|
|
3604
3706
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3605
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
3707
|
+
`,document.head.appendChild(e)}import{jsx as io}from"react/jsx-runtime";function wt({space:e,align:n="stretch",className:a,children:t,...o}){let s=e?{"--aia-stack-space":e}:void 0;return io("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":n,style:s,...o,children:t})}import{jsx as Z,jsxs as Ra}from"react/jsx-runtime";var yo=typeof window>"u"?Ue:Oa,ko=[159,119,164],Co=()=>{},vt=()=>{},So=e=>{},To=()=>{},Po=e=>{},Io=e=>{},Eo=e=>{},Ao=e=>{};function Ro(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,t]=xo(n);if(Ue(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>t(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Oo(e,n){let a=Xe(null);Ue(()=>{let t=e.current,o=n.current;if(!t||!o)return;let s=fo(t,".aia-grid[data-scroll]");if(a.current&&a.current.grid!==s&&(a.current.controller.destroy(),a.current=null),s&&!a.current){a.current={grid:s,controller:oo({dropdown:t,grid:s,button:o})};return}a.current?.controller.update()}),Ue(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function Lo(e,n){let a=Xe(n);a.current=n;let t=Xe(null);Oa(()=>{let o=e.current;if(o){if(!t.current){t.current=no({dropdown:o,isOpen:()=>a.current});return}t.current.update()}}),Ue(()=>()=>{t.current?.destroy(),t.current=null},[])}function La({suggestions:e,activeIndex:n,onSelect:a,onHighlight:t,onUnhighlight:o,isOpen:s,id:r,className:l,pills:f,onPillClick:w,showPills:y=!0,onSkip:m,showSkipButton:h=!0,showOptionIcons:c=!0,showOptionImages:v=!0,showOptionCounts:I=!0,skipDisabled:q=!1,activeSelected:D=!1,isLoading:O=!1,skeletonExiting:te=!1,isInputEmpty:T=!1,language:z,products:_,onProductSelect:F,onProductAddToCart:Y,onProductFocusChange:E,productsLayout:X="row",productImageFallback:G="image",formatType:H="options",dateView:j=null,selectedDateIso:de=null,selectedDateRange:C=null,dateRangeStart:B=null,dateReferences:d,onPreviousMonth:S,onNextMonth:Fe,timeView:ke=null,multiSelectView:g=null,onMultiSelectCommit:He,onSeeAllResults:Ce,onTimeChange:Re,onTimeCommit:Oe,locationView:Se=null,isReediting:u=!1,onLocationQuery:k,onLocationMove:P,onLocationCommit:A,onLocationFocusChange:L,isFocused:J=!1,optionsPosition:ne="below",mode:he}){let Te=Ro(he),Le=Te!==void 0,oe=Xe(null),ue=Xe(null);Oo(oe,ue),Ue(()=>{if(oe.current)return ro(oe.current)},[]);let ze=e[0]?.options??[],Be=!!(f&&f.length>0&&w),oa=!!(_&&_.length>0),be=H==="time"&&ke!=null,Qe=H==="location"&&Se!=null,ie=s&&(ze.length>0||y&&Be||O||oa||be||Qe);Lo(oe,ie),yo(()=>{let R=oe.current;R&&(po(R,co(R)),wo(R))});let x={suggestions:e,activeIndex:n,pills:f,showPills:y,showSkipButton:h,showOptionIcons:c,showOptionImages:v,showOptionCounts:I,skipDisabled:q,activeSelected:D,isLoading:O,skeletonExiting:te,isInputEmpty:T,products:_,formatType:H,dateView:j,selectedDateIso:de,selectedDateRange:C,dateRangeStart:B,dateReferences:d,timeView:ke,multiSelectView:g,locationView:Se,isReediting:u,showsSeeAll:!!Ce},De=Xe(x);ie&&(De.current=x);let i=ie?x:De.current,V=vo(z),b=i.suggestions[0],we=b?.options??[],na=i.activeIndex>=0&&!!we[i.activeIndex]?.is_tappable,re=mo(i.pills??[],V.keepTyping),We=!!(re.length>0&&w),Ge=i.showPills&&We,Pe=i.showPills&&!We&&i.isLoading,Ye=Ge||Pe,Ie=We&&ho(re)&&i.showSkipButton&&!i.isInputEmpty&&!!m,ve=re[0]?.text,Me=uo(i.formatType)&&i.dateView!=null,Ke=we.length>0&&!Me,je=we.length>0&&Me&&!i.isLoading,Ee=i.formatType==="time"&&i.timeView!=null&&!i.isLoading,qe=i.formatType==="location"&&i.locationView!=null&&!i.isLoading,p=i.isLoading&&!Ke&&!je&&!Ee&&!qe,W=i.products??[],M=go(Ge?re:[]);return Oa(()=>{oe.current&&bo(oe.current,M,{visible:ie,anchorBottom:ne==="above"})},[M,ie,ne,i.suggestions,i.pills,i.isLoading,i.skeletonExiting,i.isInputEmpty,i.products,i.formatType,i.dateView,i.selectedDateIso,i.selectedDateRange,i.dateRangeStart,i.dateReferences,i.timeView,i.multiSelectView,i.locationView,i.showPills,i.showSkipButton,i.showOptionIcons,i.showOptionImages,i.showOptionCounts,i.showsSeeAll,X,z]),Ue(()=>{let R=oe.current;return()=>{R&&lo(R)}},[]),Ra("div",{ref:oe,id:r,role:"listbox","aria-multiselectable":!!i.multiSelectView,"data-aia-dropdown":"","data-options-position":ne,"data-mode":Te,"data-aia-loading":i.isLoading?"":void 0,"data-aia-skeleton-exiting":i.skeletonExiting?"":void 0,"data-aia-has-products":W.length>0?"":void 0,className:`${Le?"magicx-aia ":""}${ce.dropdown} ${ie?ce.visible:""} ${l??""}`,onMouseDown:R=>R.preventDefault(),children:[Ra(wt,{space:"8px",children:[(Ye||Ie)&&Ra(da,{noWrap:!0,className:ce.pillBar,"data-aia-pillbar":"",children:[Ye&&Z("span",{className:ce.pillScroll,"data-aia-pill-scroll":"",children:Z(fa,{pills:re,activePillIndex:0,activeSelected:i.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:i.isLoading})}),Ie&&Z("button",{type:"button",tabIndex:-1,className:ce.skip,"data-aia-skip":"",disabled:i.isLoading||i.skipDisabled,"aria-label":ve?`${V.skipLabel} ${ve}`:V.skipLabel,onClick:m,children:V.skip})]}),Ke&&Z(mt,{options:we,activeIndex:i.activeIndex,onSelect:a,onHighlight:t,onUnhighlight:o,listboxId:r,loading:i.isLoading,groupKey:b?`${b.parameter} ${b.text}`:"",optionsPosition:ne,showIcons:i.showOptionIcons,showImages:i.showOptionImages,showCounts:i.showOptionCounts,picked:i.multiSelectView?.picked}),i.multiSelectView&&Z("div",{"data-aia-multi-actions":"",onClick:R=>{R.target.closest("[data-aia-multi-done]")&&!i.skipDisabled&&!i.isLoading&&He?.()},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:ce.multiDone,ref:R=>{R&&(R.disabled=!0,R.offsetHeight,R.disabled=i.skipDisabled||i.isLoading)},children:V.done})}),je&&i.dateView&&Z(Ya,{options:we,activeIndex:i.activeIndex,listboxId:r,view:i.dateView,selection:{selectedIso:i.selectedDateIso??null,selectedRange:i.selectedDateRange??null,rangeStart:i.dateRangeStart??null,floor:so(i.formatType,i.dateRangeStart),references:i.dateReferences??[]},onSelect:a,onHighlight:t,onUnhighlight:o,onPreviousMonth:S??vt,onNextMonth:Fe??vt}),Ee&&i.timeView&&Z(bt,{view:i.timeView,label:V.timeLabel,doneLabel:V.done,interactive:!i.skipDisabled,onTimeChange:Re??So,onTimeCommit:Oe??To}),qe&&i.locationView&&Z(at,{view:i.locationView,searchLabel:V.locationSearch,noResultsLabel:V.locationNoResults,useTypedLabel:V.locationUseTyped,widgetFocused:J&&ie,reediting:i.isReediting,visible:ie,interactive:!i.skipDisabled,onQuery:k??Po,onMove:P??Io,onCommit:A??Eo,onFocusChange:L??Ao}),p&&Z("div",{className:ce.skeletonBars,"data-aia-skeleton-bars":"",children:ko.map(R=>Z("span",{className:ce.skeletonBar,style:{width:R}},`bar-${R}`))}),Z(ot,{products:W,listboxId:r,onSelect:F??Co,onAddToCart:Y,onFocusChange:E,focusable:ie&&!i.isLoading,loading:i.isLoading,layout:X,imageFallback:G,strings:V}),i.showsSeeAll&&Z("div",{className:ce.seeAllRow,"data-aia-see-all":"",onClick:R=>{R.target.closest("[data-aia-see-all-button]")&&(R.stopPropagation(),!i.isLoading&&Ce?.())},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"",className:ce.seeAll,ref:R=>{R&&(R.disabled=!0,R.offsetHeight,R.disabled=i.isLoading)},children:V.seeAllResults})}),Z($a,{isOptionHighlighted:na,isInputEmpty:i.isInputEmpty,strings:V})]}),Z("button",{ref:ue,type:"button",tabIndex:-1,className:ce.scrollArrow,"data-aia-scroll-arrow":"","aria-label":V.scrollArrow,"aria-hidden":"true",children:Z("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:Z("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Xo,ModeController as Jo,setCursorOffset as en,uiStringsFor as an,watchEditorHeight as tn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as zo}from"@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 {
|
|
3606
3708
|
flex-shrink: 0;
|
|
3607
3709
|
width: 32px;
|
|
3608
3710
|
height: 32px;
|
|
@@ -3673,5 +3775,5 @@ import{buildSubmitResult as rs,cellDay as ss,cellIso as ls,DATE_RANGE_META_END a
|
|
|
3673
3775
|
transition: none;
|
|
3674
3776
|
}
|
|
3675
3777
|
}
|
|
3676
|
-
`,document.head.appendChild(e)}var ba={submitButton:"aia-submitButton-otz7H"};import{jsx as Rt}from"react/jsx-runtime";function wa({disabled:e,ready:o,onClick:t,label:a=Ao().submit}){return Rt("button",{type:"button","data-aia-submit":"",className:ba.submitButton,disabled:e,"data-aia-ready":o?"":void 0,onClick:i=>{i.stopPropagation(),t()},"aria-label":a,children:Rt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":a,children:Rt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Oo,dateSelectionFor as Ro,identifiedParamLabel as Lo,withoutTraditionalAutocomplete as zo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Ca,useEffect as Je,useMemo as Do,useRef as ee,useState as Mo}from"react";import{useRef as va}from"react";function xa(e){let o=va(e);o.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=va({key:"",overrides:void 0});if(a.current.key!==t){let i={};for(let s of Object.keys(e??{})){let r=(l,f,w)=>{let y=o.current?.[s];return y?y(l,f,w):[]};i[s]=r}a.current={key:t,overrides:e?i:void 0}}return{overrides:a.current.overrides,key:t}}import{useRef as ya}from"react";function ka(e){let o=ya(e);o.current=e;let t=ya(null);t.current===null&&(t.current={fetch:(i,s)=>{let r=o.current;return r?r.fetch(i,s):Promise.reject(new Error("products config removed"))},transform:i=>o.current?.transform(i)??[],get limit(){return o.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var Sa={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,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Lt({onSubmit:e,onResult:o,onError:t,optionOverrides:a,maskCompletedText:i,apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,visitorId:y,columns:g=2,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,showNonTappableOptions:_,locationSearch:z,showOptionIcons:O,showOptionImages:te,showOptionCounts:S,showSkipButton:M,showProducts:H,productImageFallback:N="image",onFocus:B,onBlur:T,value:V,completedParams:Y,onChange:E,onParamsChange:K,products:de,mapProducts:ae,onProductSelect:re,onProductAddToCart:d,source:P,setCursor:Te}){let m=ee(null),[Me,Pe]=Mo(null),Ie=ee(e);Ie.current=e;let Ee=ee(o);Ee.current=o;let ye=ee(t);ye.current=t;let Ae=ee(E);Ae.current=E;let u=ee(K);u.current=K;let k=ee(B);k.current=B;let C=ee(T);C.current=T;let A=ee(Te);A.current=Te;let R=ee(re);R.current=re;let W=ee(d);W.current=d;let ce=ee(y);ce.current=y;let pe=ee(()=>{let p=ce.current;return typeof p=="function"?p():p}).current,ge=ka(de),j=ee(ae);j.current=ae;let Ne=ee((p,G)=>{let L=j.current;return L?L(p,G):p}).current,Fe=ae?Ne:void 0,He=xa(a);Je(()=>{if(typeof document>"u")return;let p=new Oo(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,visitorId:pe,optionOverrides:He.overrides,maskCompletedText:i,columns:g,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,showNonTappableOptions:_,locationSearch:z,showProducts:H,source:P,value:V,completedParams:Y,onSubmit:(...L)=>Ie.current?.(...L),onResult:(...L)=>Ee.current?.(...L),onError:(...L)=>ye.current?.(...L),onChange:(...L)=>Ae.current?.(...L),onParamsChange:(...L)=>u.current?.(...L),onFocus:()=>k.current?.(),onBlur:()=>C.current?.(),onProductSelect:L=>R.current?.(L),onProductAddToCart:L=>W.current?.(L),setCursor:L=>A.current?.(L),products:ge.config,mapProducts:Fe});m.current=p,Pe(p.getState());let G=p.subscribe(L=>Pe(L));return()=>{G(),p.destroy(),m.current===p&&(m.current=null)}},[]),Je(()=>{V!==void 0&&m.current?.setValue(V)},[V]),Je(()=>{Y!==void 0&&m.current?.setCompletedParams(Y)},[Y]);let Oe=JSON.stringify(s??null),Be;try{Be=JSON.stringify(r??null)}catch{Be="[unstringifiable]"}Je(()=>{m.current?.update({apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,optionOverrides:He.overrides,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,showNonTappableOptions:_,locationSearch:z,showProducts:H})},[Oe,Be,l,f?.code,f?.rate,f?.country,w,He.key,h,c,v,I,_,z,H]);let We=ee(!1);Je(()=>{if(!We.current){We.current=!0;return}m.current?.update({products:ge.config})},[ge.enabled]),Je(()=>{m.current?.update({mapProducts:Fe})},[Fe]);let Z=ee(null);Z.current===null&&(Z.current={handleTextChange:p=>m.current?.handleTextChange(p),handleKeyDown:p=>{let G="nativeEvent"in p?p.nativeEvent:p;m.current?.handleKeyDown(G)},setFocused:p=>m.current?.setFocused(p),startEditingParam:p=>m.current?.startEditingParam(p),removeParam:p=>m.current?.removeParam(p)??!1,exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:p=>m.current?.handleCaretAfterInput(p),handleCaretMove:p=>m.current?.handleCaretMove(p),replaceEditingRange:p=>m.current?.replaceEditingRange(p)??!1,setActivePill:p=>m.current?.setActivePill(p),skipActivePill:()=>m.current?.skipActivePill(),removeLastParam:()=>m.current?.removeLastParam(),clearNewParamId:()=>m.current?.clearNewParamId(),reset:()=>m.current?.reset(),refreshProducts:()=>m.current?.refreshProducts(),prepareSubmit:()=>m.current?.prepareSubmit(),getState:()=>m.current?.getState()??Sa,recordSubmit:p=>m.current?.recordSubmit(p),selectOption:(p,G)=>m.current?.selectOption(p,G),selectProduct:p=>m.current?.selectProduct(p),addProductToCart:p=>{let G=m.current;return!G||!W.current?Promise.resolve():G.addProductToCart(p)},setActiveDropdownIndex:p=>m.current?.setActiveDropdownIndex(p),clearHighlight:p=>m.current?.clearHighlight(p),showPreviousMonth:()=>m.current?.showPreviousMonth(),showNextMonth:()=>m.current?.showNextMonth(),setTime:p=>m.current?.setTime(p),commitTime:()=>m.current?.commitTime(),toggleMultiSelectOption:p=>m.current?.toggleMultiSelectOption(p),commitMultiSelect:()=>m.current?.commitMultiSelect(),setLocationQuery:p=>m.current?.setLocationQuery(p),moveLocationHighlight:p=>m.current?.moveLocationHighlight(p),commitLocation:p=>m.current?.commitLocation(p),setLocationFieldFocused:p=>m.current?.setLocationFieldFocused(p),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let x=Z.current,Ge=Ca(p=>{let G=p.target.value,F=G.length>0&&!p.nativeEvent?.isComposing&&G[0]!==G[0].toUpperCase()?G[0].toUpperCase()+G.slice(1):G;m.current?.handleTextChange(F)},[]),n=Ca(p=>{m.current?.handleKeyDown(p.nativeEvent)},[]),$=m.current,b=Me??Sa,fe=V!==void 0?V:b.text,Ke=Y!==void 0?Y:b.completedParams,se=b.actionableSuggestions,Re=se[0],qe=Do(()=>zo(se),[se]),Le=$?.listboxId??"",je=b.activeDropdownIndex>=0&&$?`${Le}-option-${b.activeDropdownIndex}`:void 0,he=b.editingParam,be=b.editingIdentified,ze=he?{parameter:he.suggestionParameter,text:he.suggestionPlaceholder,required:!0,options:he.options}:be?{parameter:be.parameter,text:Lo(be.parameter),required:!0,options:[]}:null,_e=b.dropdownSuggestion??ze??Re,$e=ze?[ze]:se,ke=Ro(b),Ve=!$||b.dropdownLoading;return{completedParams:Ke,multiSelectView:b.multiSelectView,toggleMultiSelectOption:x.toggleMultiSelectOption,commitMultiSelect:x.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:qe,setActivePill:x.setActivePill,skipActivePill:x.skipActivePill,removeLastParam:x.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:x.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:Ve,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:Le,error:b.error,products:b.products,customFields:b.customFields,selectProduct:x.selectProduct,addProductToCart:x.addProductToCart,handleTextChange:x.handleTextChange,handleKeyDown:x.handleKeyDown,setFocused:x.setFocused,editingParam:he,editingIdentified:be,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:x.startEditingParam,removeParam:x.removeParam,exitEditMode:x.exitEditMode,handleCaretAfterInput:x.handleCaretAfterInput,handleCaretMove:x.handleCaretMove,replaceEditingRange:x.replaceEditingRange,inputProps:{value:fe,placeholder:b.placeholderText||void 0,onChange:Ge,onKeyDown:n,onFocus:x.handleFocus,onBlur:x.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":je,"aria-autocomplete":"list","aria-controls":Le},reset:x.reset,refreshProducts:x.refreshProducts,prepareSubmit:x.prepareSubmit,getState:x.getState,recordSubmit:x.recordSubmit,dropdownProps:{suggestions:_e?[{..._e,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:x.selectOption,onHighlight:x.setActiveDropdownIndex,onUnhighlight:x.clearHighlight,isOpen:b.isDropdownOpen,id:Le,pills:$e,activeSelected:b.isActivePillSelected,onPillClick:x.setActivePill,onSkip:x.skipActivePill,showSkipButton:(M??!0)&&!he&&!be,showOptionIcons:O??!0,showOptionImages:te??!0,showOptionCounts:S??!0,skipDisabled:b.inSelectionAnimation,isLoading:Ve,skeletonExiting:b.skeletonExiting,isInputEmpty:fe.trim().length===0,language:l,products:b.products,productImageFallback:N,onProductSelect:x.selectProduct,onProductAddToCart:d?x.addProductToCart:void 0,onProductFocusChange:x.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:ke.selectedIso,selectedDateRange:ke.selectedRange,dateRangeStart:ke.rangeStart,dateReferences:ke.references,onPreviousMonth:x.showPreviousMonth,onNextMonth:x.showNextMonth,timeView:b.timeView,multiSelectView:b.dropdownMultiSelect,onMultiSelectCommit:x.commitMultiSelect,onTimeChange:x.setTime,onTimeCommit:x.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:x.setLocationQuery,onLocationMove:x.moveLocationHighlight,onLocationCommit:x.commitLocation,onLocationFocusChange:x.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:c??"below"}}}import{attachChipRemove as No,cancelStartingHint as Fo,chipIdFromTap as Ho,extractPlainText as Ta,getCursorOffset as Pa,keepCaretOnChip as Bo,plainTextLength as Wo,renderEditableContent as Go,setCursorOffset as Ia,startingHintOptions as Ko}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as me,useEffect as et,useLayoutEffect as zt,useRef as tt}from"react";var wt;function qo(){if(wt!==void 0)return wt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),wt=e.contentEditable==="plaintext-only",wt}function Ea(e){let{segments:o,showChipIcons:t=!0,showChipImages:a=!0,showChipRemove:i=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:f,editingAnchor:w,caretOffset:y,placeholderText:g,hintSuggestions:h,isFocused:c,isDropdownOpen:v,listboxId:I,activeDescendantId:_,autoFocus:z,handleTextChange:O,handleKeyDown:te,handleCaretAfterInput:S,handleCaretMove:M,startEditingParam:H,replaceEditingRange:N,setFocused:B}=e,T=tt(null),V=tt(!1),Y=tt(""),E=tt(""),K=tt(null),de=tt(0);K.current=y,et(()=>{if(!z)return;let u=T.current;if(!u)return;document.activeElement===u?B(!0):u.focus();let k=u.ownerDocument??document,C=k.getSelection(),A=C&&C.rangeCount>0&&u.contains(C.anchorNode);if(C&&!A){let R=k.createRange();R.selectNodeContents(u),R.collapse(!0),C.removeAllRanges(),C.addRange(R)}},[z,B]),et(()=>{let u=T.current;if(!u)return;let k=u.ownerDocument??document,C=()=>{let A=k.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!u.contains(A.anchorNode))return;let R=A.anchorNode,W=R.nodeType===Node.ELEMENT_NODE?R:R.parentElement,pe=(A.isCollapsed?W?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ge=l?.id??f?.id??null;if(pe&&pe!==ge){H(pe);return}performance.now()-de.current<50||M(Pa(u))};return k.addEventListener("selectionchange",C),()=>k.removeEventListener("selectionchange",C)},[l,f,H,M]),et(()=>{let u=T.current;if(!u)return;let k=C=>{let A=Ho(u,C.target);A&&(H(A),Bo(u,A))};return u.addEventListener("click",k),()=>u.removeEventListener("click",k)},[H]),et(()=>{let u=T.current;if(!(!u||!s||!i))return No(u,s)},[s,i]),zt(()=>{let u=T.current;u&&Go({input:u,segments:o,newParamId:r,editingParamId:l?.id??null,placeholderText:g??"",isFocused:c,showChipIcons:t,showChipImages:a,showChipRemove:i,hintOptions:Ko(h??[])})},[o,r,l,g,h,c,t,a,i]),et(()=>{let u=T.current;return()=>{u&&Fo(u)}},[]),zt(()=>{let u=Y.current,k=r??"";if(Y.current=k,!k||k===u)return;let C=T.current;if(!C)return;C.focus();let A=K.current??Wo(C);Ia(C,A)},[r]),zt(()=>{let u=E.current,k=l?.id??"";if(E.current=k,!k||k===u||w==null)return;let C=T.current;C&&Ia(C,w)},[l,w]);let ae=me(()=>{if(V.current)return;let u=T.current;if(!u)return;let k=Ta(u),A=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;O(A)},[O]),re=me(()=>{de.current=performance.now(),ae();let u=T.current;u&&S(Pa(u))},[ae,S]);et(()=>{let u=T.current;if(!u)return;let k=C=>{let A=C,R=A.inputType;if(R==="insertParagraph"||R==="insertLineBreak"||R==="insertFromDrop"){C.preventDefault();return}if(R.startsWith("insert")||R.startsWith("delete")){let W=R.startsWith("delete")?"":A.data??"";N(W)&&C.preventDefault()}};return u.addEventListener("beforeinput",k),()=>u.removeEventListener("beforeinput",k)},[N]);let d=me(()=>{V.current=!0,T.current?.setAttribute("data-aia-composing","true")},[]),P=me(()=>{V.current=!1,T.current?.removeAttribute("data-aia-composing"),ae()},[ae]),Te=me(u=>{u.preventDefault();let k=T.current;if(!k)return;let C=(u.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!C)return;let A=k.ownerDocument??document,R=A.getSelection();if(!R||R.rangeCount===0)return;let W=R.getRangeAt(0);if(!k.contains(W.startContainer))return;W.deleteContents();let ce=A.createTextNode(C);W.insertNode(ce),W.setStartAfter(ce),W.collapse(!0),R.removeAllRanges(),R.addRange(W),ae()},[ae]),m=me(u=>te(u),[te]),Me=me(()=>B(!0),[B]),Pe=me(()=>B(!1),[B]),Ie=me(()=>T.current?.focus(),[]),Ee=me(()=>T.current?.blur(),[]),ye=me(()=>{let u=T.current;return u?Ta(u):""},[]),Ae=qo()?"plaintext-only":"true";return{inputRef:T,editorProps:{ref:T,contentEditable:Ae,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":I,"aria-expanded":v,"aria-activedescendant":_,spellCheck:!0,enterKeyHint:"send",onInput:re,onKeyDown:m,onCompositionStart:d,onCompositionEnd:P,onPaste:Te,onFocus:Me,onBlur:Pe},getPlainText:ye,focus:Ie,blur:Ee}}import{jsx as it,jsxs as Nt}from"react/jsx-runtime";function Xo(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Jo=_o(function({onSubmit:o,onResult:t,onError:a,optionOverrides:i,maskCompletedText:s,className:r,apiConfig:l,additionalContext:f,language:w,currency:y,productId:g,visitorId:h,columns:c,pillPlacement:v="dropdown",mode:I="auto",optionsPosition:_="below",animations:z=!0,optionsStyle:O="floating",dropdownTrigger:te,closeDropdownOnBlur:S,prependPlaceholder:M,showNonTappableOptions:H,locationSearch:N,showOptionIcons:B=!0,showChipIcons:T=!0,showChipImages:V=!0,showChipRemove:Y=!1,showOptionImages:E=!0,showOptionCounts:K=!0,showSkipButton:de,showProducts:ae,productsLayout:re,productImageFallback:d,autoFocus:P=!0,onFocus:Te,onBlur:m,value:Me,completedParams:Pe,onChange:Ie,onParamsChange:Ee,products:ye,mapProducts:Ae,onProductSelect:u,onProductAddToCart:k,submitButton:C,resetOnSubmit:A=!0},R){let W=at(null),ce=at(null),pe=at(null),ge=at(()=>{}),j=at(null),Ne=at(null);Mt(()=>{let D=W.current;if(D)return j.current?j.current.setMode(I):j.current=new Yo(D,I),()=>{j.current?.destroy(),j.current=null}},[I]);let Fe=Dt(D=>{let oe=Ne.current?.current;oe&&(oe.focus(),jo(oe,D))},[]),{completedParams:He,suggestionPills:Oe,setActivePill:Be,skipActivePill:We,segments:Z,newParamId:x,clearNewParamId:Ge,placeholderText:n,isFocused:$,isDropdownOpen:b,isActivePillSelected:fe,isLoading:Ke,isReady:se,activeIndex:Re,listboxId:qe,handleTextChange:Le,handleKeyDown:je,setFocused:he,editingParam:be,editingIdentified:ze,editingAnchor:_e,caretOffset:$e,startEditingParam:ke,removeParam:Ve,handleCaretAfterInput:p,handleCaretMove:G,replaceEditingRange:L,dropdownProps:F,reset:ct,refreshProducts:Ft,prepareSubmit:Ht,getState:Bt,recordSubmit:Wt}=Lt({onSubmit:D=>ge.current(D),onResult:t,onError:a,optionOverrides:i,maskCompletedText:s,apiConfig:l,additionalContext:f,language:w,currency:y,productId:g,visitorId:h,columns:c,dropdownTrigger:te,optionsPosition:_,closeDropdownOnBlur:S,prependPlaceholder:M,showNonTappableOptions:H,locationSearch:N,showOptionIcons:B,showOptionImages:E,showOptionCounts:K,showSkipButton:de,showProducts:ae,onFocus:Te,onBlur:m,value:Me,completedParams:Pe,onChange:Ie,onParamsChange:Ee,products:ye,mapProducts:Ae,onProductSelect:u,onProductAddToCart:k,source:"full-sdk",setCursor:Fe});Mt(()=>{if(!x)return;let D=window.setTimeout(()=>Ge(),650);return()=>window.clearTimeout(D)},[x,Ge]);let Aa=Re>=0?`${qe}-option-${Re}`:void 0,{inputRef:vt,editorProps:Oa,focus:pt,blur:Gt,getPlainText:Kt}=Ea({segments:Z,newParamId:x,editingParam:be,editingIdentified:ze,editingAnchor:_e,caretOffset:$e,placeholderText:n,hintSuggestions:v==="inline"?[]:Oe,isFocused:$,showChipIcons:T,showChipImages:V,showChipRemove:Y,removeParam:Ve,isDropdownOpen:b,listboxId:qe,activeDescendantId:Aa,autoFocus:P,handleTextChange:Le,handleKeyDown:je,handleCaretAfterInput:p,handleCaretMove:G,startEditingParam:ke,replaceEditingRange:L,setFocused:he});Ne.current=vt,Uo(()=>{let D=ce.current,oe=vt.current;if(!D||!oe)return;let nt=()=>{let _t=D.firstElementChild;if(!_t)return;let Da=_t.getBoundingClientRect(),Ma=oe.getBoundingClientRect();Da.top>=Ma.bottom-2?D.setAttribute("data-aia-pill-wrapped",""):D.removeAttribute("data-aia-pill-wrapped")};nt();let qt=new ResizeObserver(nt);return qt.observe(oe),()=>qt.disconnect()},[Z,Oe.length,Ke,vt]),Mt(()=>{let D=pe.current;if(D)return Zo(D)},[]),Vo(R,()=>({focus:pt,blur:Gt,reset:ct,refreshProducts:Ft,setMode:D=>j.current?.setMode(D),skipActivePill:We}),[pt,Gt,ct,Ft,We]);let ot=!!Z.length||He.length>0,xt=Dt(D=>{if(!ot)return;D&&Ht();let oe=Bt(),nt=Qo(Kt(),oe.completedParams,oe.skippedParams,{identifiedParams:oe.identifiedParams,isReady:oe.isReady,customFields:oe.customFields});D&&Wt(nt),o(nt),A&&ct()},[Wt,A,ot,Ht,Bt,o,ct,Kt]);ge.current=()=>xt(!1);let Ra=Dt(D=>{D.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||pt()},[pt]),La=v==="inline",za=v==="dropdown";return Nt("div",{ref:W,className:`magicx-aia ${Ue.container} ${r??""}`,"data-pill-placement":v,"data-options-position":_,"data-animations":z?"on":"off","data-aia-options-style":O,"data-mode":Xo(I),children:[it(Ot,{...F,showPills:za,productsLayout:re,productImageFallback:d}),Nt("div",{className:Ue.inputWrapper,"data-aia-input-wrapper":"",onClick:Ra,children:[Nt("div",{ref:pe,className:Ue.editorArea,"data-aia-editor":"",children:[it("div",{...Oa,className:Ue.input,"data-aia-input":""}),La&&(Ke||Oe.length>0)&&it("span",{ref:ce,className:Ue.pillListContainer,"data-aia-pill-list-container":"",children:it(ut,{pills:Oe,activePillIndex:0,activeSelected:fe,onSelectPill:Be,loading:Ke})})]}),C===null?null:C===void 0?it(wa,{disabled:!ot,ready:ot&&se,onClick:()=>xt(!0),label:$o(w).submit}):it("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ue.submitSlot,onClick:D=>{ot&&(D.stopPropagation(),xt(!0))},children:C})]})]})});export{Jo as AIAutocomplete,Ot as AIAutocompleteDropdown,ds as DATE_RANGE_META_END,cs as DATE_RANGE_META_START,ps as DEFAULT_OPTION_COUNT_UNIT,vs as LOCATION_META_KEY,Is as PRODUCT_PATH_PREFIX,Fs as TIME_META_KEY,Bs as WEEKDAY_LABELS,rs as buildSubmitResult,ss as cellDay,ls as cellIso,hs as dateCellMarks,us as formatDate,ms as formatDateRange,gs as formatOptionCount,fs as formatPlace,bs as formatTime,ws as isoDate,xs as monthLabel,ys as optionCountLabel,ks as optionHasImage,Cs as optionImageSources,Ss as optionImageSrc,Ts as optionLabel,Ps as optionsShowLeadingVisuals,Es as parseDate,As as parseLooseDate,Os as parseLooseDateRange,Rs as parseTime,Ls as productFromMatchedItem,zs as productImageSources,Ds as productsFromCustomFields,Ms as sanitizeOptionIconSvg,Ns as selectedRangeFor,Lt as useAIAutocomplete,Hs as visibleDateRange,Ws as withSkippedParams};
|
|
3778
|
+
`,document.head.appendChild(e)}var xt={submitButton:"aia-submitButton-otz7H"};import{jsx as za}from"react/jsx-runtime";function yt({disabled:e,ready:n,onClick:a,label:t=zo().submit}){return za("button",{type:"button","data-aia-submit":"",className:xt.submitButton,disabled:e,"data-aia-ready":n?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":t,children:za("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:za("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Do,dateSelectionFor as Mo,editingSuggestion as No,identifiedParamLabel as Fo,withoutTraditionalAutocomplete as Ho}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Pt,useEffect as Je,useMemo as Bo,useRef as ae,useState as Wo}from"react";import{useRef as kt}from"react";function Ct(e){let n=kt(e);n.current=e;let a=Object.keys(e??{}).sort().join("\0"),t=kt({key:"",overrides:void 0});if(t.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,f,w)=>{let y=n.current?.[s];return y?y(l,f,w):[]};o[s]=r}t.current={key:a,overrides:e?o:void 0}}return{overrides:t.current.overrides,key:a}}import{useRef as St}from"react";function Tt(e){let n=St(e);n.current=e;let a=St(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=n.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let t=e!==void 0;return{config:t?a.current:void 0,enabled:t}}var It={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,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Da({onSubmit:e,onResult:n,onError:a,optionOverrides:t,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,visitorId:y,columns:m=2,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showOptionIcons:te,showOptionImages:T,showOptionCounts:z,showSkipButton:_,showProducts:F,productImageFallback:Y="image",onFocus:E,onBlur:X,value:G,completedParams:H,onChange:j,onParamsChange:de,products:C,mapProducts:B,onProductSelect:d,onProductAddToCart:S,source:Fe,setCursor:ke}){let g=ae(null),[He,Ce]=Wo(null),Re=ae(e);Re.current=e;let Oe=ae(n);Oe.current=n;let Se=ae(a);Se.current=a;let u=ae(j);u.current=j;let k=ae(de);k.current=de;let P=ae(E);P.current=E;let A=ae(X);A.current=X;let L=ae(ke);L.current=ke;let J=ae(d);J.current=d;let ne=ae(S);ne.current=S;let he=ae(y);he.current=y;let Te=ae(()=>{let p=he.current;return typeof p=="function"?p():p}).current,Le=Tt(C),oe=ae(B);oe.current=B;let ue=ae((p,W)=>{let M=oe.current;return M?M(p,W):p}).current,ze=B?ue:void 0,Be=Ct(t);Je(()=>{if(typeof document>"u")return;let p=new Do(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,visitorId:Te,optionOverrides:Be.overrides,maskCompletedText:o,columns:m,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showProducts:F,source:Fe,value:G,completedParams:H,onSubmit:(...M)=>Re.current?.(...M),onResult:(...M)=>Oe.current?.(...M),onError:(...M)=>Se.current?.(...M),onChange:(...M)=>u.current?.(...M),onParamsChange:(...M)=>k.current?.(...M),onFocus:()=>P.current?.(),onBlur:()=>A.current?.(),onProductSelect:M=>J.current?.(M),onProductAddToCart:M=>ne.current?.(M),setCursor:M=>L.current?.(M),products:Le.config,mapProducts:ze});g.current=p,Ce(p.getState());let W=p.subscribe(M=>Ce(M));return()=>{W(),p.destroy(),g.current===p&&(g.current=null)}},[]),Je(()=>{G!==void 0&&g.current?.setValue(G)},[G]),Je(()=>{H!==void 0&&g.current?.setCompletedParams(H)},[H]);let oa=JSON.stringify(s??null),be;try{be=JSON.stringify(r??null)}catch{be="[unstringifiable]"}Je(()=>{g.current?.update({apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,optionOverrides:Be.overrides,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showProducts:F})},[oa,be,l,f?.code,f?.rate,f?.country,w,Be.key,h,c,v,I,q,D,O,F]);let Qe=ae(!1);Je(()=>{if(!Qe.current){Qe.current=!0;return}g.current?.update({products:Le.config})},[Le.enabled]),Je(()=>{g.current?.update({mapProducts:ze})},[ze]);let ie=ae(null);ie.current===null&&(ie.current={handleTextChange:p=>g.current?.handleTextChange(p),handleKeyDown:p=>{let W="nativeEvent"in p?p.nativeEvent:p;g.current?.handleKeyDown(W)},setFocused:p=>g.current?.setFocused(p),startEditingParam:p=>g.current?.startEditingParam(p),removeParam:p=>g.current?.removeParam(p)??!1,exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:p=>g.current?.handleCaretAfterInput(p),handleCaretMove:p=>g.current?.handleCaretMove(p),replaceEditingRange:p=>g.current?.replaceEditingRange(p)??!1,setActivePill:p=>g.current?.setActivePill(p),skipActivePill:()=>g.current?.skipActivePill(),removeLastParam:()=>g.current?.removeLastParam(),clearNewParamId:()=>g.current?.clearNewParamId(),reset:()=>g.current?.reset(),refreshProducts:()=>g.current?.refreshProducts(),prepareSubmit:()=>g.current?.prepareSubmit(),getState:()=>g.current?.getState()??It,recordSubmit:p=>g.current?.recordSubmit(p),selectOption:(p,W)=>g.current?.selectOption(p,W),selectProduct:p=>g.current?.selectProduct(p),addProductToCart:p=>{let W=g.current;return!W||!ne.current?Promise.resolve():W.addProductToCart(p)},setActiveDropdownIndex:p=>g.current?.setActiveDropdownIndex(p),clearHighlight:p=>g.current?.clearHighlight(p),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),setTime:p=>g.current?.setTime(p),commitTime:()=>g.current?.commitTime(),toggleMultiSelectOption:p=>g.current?.toggleMultiSelectOption(p),commitMultiSelect:()=>g.current?.commitMultiSelect(),setLocationQuery:p=>g.current?.setLocationQuery(p),moveLocationHighlight:p=>g.current?.moveLocationHighlight(p),commitLocation:p=>g.current?.commitLocation(p),setLocationFieldFocused:p=>g.current?.setLocationFieldFocused(p),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let x=ie.current,De=Pt(p=>{let W=p.target.value,R=W.length>0&&!p.nativeEvent?.isComposing&&W[0]!==W[0].toUpperCase()?W[0].toUpperCase()+W.slice(1):W;g.current?.handleTextChange(R)},[]),i=Pt(p=>{g.current?.handleKeyDown(p.nativeEvent)},[]),V=g.current,b=He??It,we=G!==void 0?G:b.text,na=H!==void 0?H:b.completedParams,re=b.actionableSuggestions,We=re[0],Ge=Bo(()=>Ho(re),[re]),Pe=V?.listboxId??"",Ye=b.activeDropdownIndex>=0&&V?`${Pe}-option-${b.activeDropdownIndex}`:void 0,Ie=b.editingParam,ve=b.editingIdentified,Me=Ie?No(Ie):ve?{parameter:ve.parameter,text:Fo(ve.parameter),required:!0,options:[]}:null,Ke=b.dropdownSuggestion??Me??We,je=Me?[Me]:re,Ee=Mo(b),qe=!V||b.dropdownLoading;return{completedParams:na,multiSelectView:b.multiSelectView,toggleMultiSelectOption:x.toggleMultiSelectOption,commitMultiSelect:x.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:Ge,setActivePill:x.setActivePill,skipActivePill:x.skipActivePill,removeLastParam:x.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:x.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:qe,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:Pe,error:b.error,products:b.products,customFields:b.customFields,selectProduct:x.selectProduct,addProductToCart:x.addProductToCart,handleTextChange:x.handleTextChange,handleKeyDown:x.handleKeyDown,setFocused:x.setFocused,editingParam:Ie,editingIdentified:ve,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:x.startEditingParam,removeParam:x.removeParam,exitEditMode:x.exitEditMode,handleCaretAfterInput:x.handleCaretAfterInput,handleCaretMove:x.handleCaretMove,replaceEditingRange:x.replaceEditingRange,inputProps:{value:we,placeholder:b.placeholderText||void 0,onChange:De,onKeyDown:i,onFocus:x.handleFocus,onBlur:x.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":Ye,"aria-autocomplete":"list","aria-controls":Pe},reset:x.reset,refreshProducts:x.refreshProducts,prepareSubmit:x.prepareSubmit,getState:x.getState,recordSubmit:x.recordSubmit,dropdownProps:{suggestions:Ke?[{...Ke,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:x.selectOption,onHighlight:x.setActiveDropdownIndex,onUnhighlight:x.clearHighlight,isOpen:b.isDropdownOpen,id:Pe,pills:je,activeSelected:b.isActivePillSelected,onPillClick:x.setActivePill,onSkip:x.skipActivePill,showSkipButton:(_??!0)&&!Ie&&!ve,showOptionIcons:te??!0,showOptionImages:T??!0,showOptionCounts:z??!0,skipDisabled:b.inSelectionAnimation,isLoading:qe,skeletonExiting:b.skeletonExiting,isInputEmpty:we.trim().length===0,language:l,products:b.products,productImageFallback:Y,onProductSelect:x.selectProduct,onProductAddToCart:S?x.addProductToCart:void 0,onProductFocusChange:x.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:Ee.selectedIso,selectedDateRange:Ee.selectedRange,dateRangeStart:Ee.rangeStart,dateReferences:Ee.references,onPreviousMonth:x.showPreviousMonth,onNextMonth:x.showNextMonth,timeView:b.timeView,multiSelectView:b.dropdownMultiSelect,onMultiSelectCommit:x.commitMultiSelect,onTimeChange:x.setTime,onTimeCommit:x.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:x.setLocationQuery,onLocationMove:x.moveLocationHighlight,onLocationCommit:x.commitLocation,onLocationFocusChange:x.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:c??"below"}}}import{attachChipRemove as Go,cancelStartingHint as Ko,chipIdFromTap as qo,extractPlainText as Et,getCursorOffset as At,keepCaretOnChip as _o,plainTextLength as Vo,renderEditableContent as Uo,setCursorOffset as Rt,startingHintOptions as Qo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as fe,useEffect as ea,useLayoutEffect as Ma,useRef as aa}from"react";var xa;function Yo(){if(xa!==void 0)return xa;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),xa=e.contentEditable==="plaintext-only",xa}function Ot(e){let{segments:n,showChipIcons:a=!0,showChipImages:t=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:f,editingAnchor:w,caretOffset:y,placeholderText:m,hintSuggestions:h,isFocused:c,isDropdownOpen:v,listboxId:I,activeDescendantId:q,autoFocus:D,handleTextChange:O,handleKeyDown:te,handleCaretAfterInput:T,handleCaretMove:z,startEditingParam:_,replaceEditingRange:F,setFocused:Y}=e,E=aa(null),X=aa(!1),G=aa(""),H=aa(""),j=aa(null),de=aa(0);j.current=y,ea(()=>{if(!D)return;let u=E.current;if(!u)return;document.activeElement===u?Y(!0):u.focus();let k=u.ownerDocument??document,P=k.getSelection(),A=P&&P.rangeCount>0&&u.contains(P.anchorNode);if(P&&!A){let L=k.createRange();L.selectNodeContents(u),L.collapse(!0),P.removeAllRanges(),P.addRange(L)}},[D,Y]),ea(()=>{let u=E.current;if(!u)return;let k=u.ownerDocument??document,P=()=>{let A=k.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!u.contains(A.anchorNode))return;let L=A.anchorNode,J=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,he=(A.isCollapsed?J?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Te=l?.id??f?.id??null;if(he&&he!==Te){_(he);return}performance.now()-de.current<50||z(At(u))};return k.addEventListener("selectionchange",P),()=>k.removeEventListener("selectionchange",P)},[l,f,_,z]),ea(()=>{let u=E.current;if(!u)return;let k=P=>{let A=qo(u,P.target);A&&(_(A),_o(u,A))};return u.addEventListener("click",k),()=>u.removeEventListener("click",k)},[_]),ea(()=>{let u=E.current;if(!(!u||!s||!o))return Go(u,s)},[s,o]),Ma(()=>{let u=E.current;u&&Uo({input:u,segments:n,newParamId:r,editingParamId:l?.id??null,placeholderText:m??"",isFocused:c,showChipIcons:a,showChipImages:t,showChipRemove:o,hintOptions:Qo(h??[])})},[n,r,l,m,h,c,a,t,o]),ea(()=>{let u=E.current;return()=>{u&&Ko(u)}},[]),Ma(()=>{let u=G.current,k=r??"";if(G.current=k,!k||k===u)return;let P=E.current;if(!P)return;P.focus();let A=j.current??Vo(P);Rt(P,A)},[r]),Ma(()=>{let u=H.current,k=l?.id??"";if(H.current=k,!k||k===u||w==null)return;let P=E.current;P&&Rt(P,w)},[l,w]);let C=fe(()=>{if(X.current)return;let u=E.current;if(!u)return;let k=Et(u),A=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;O(A)},[O]),B=fe(()=>{de.current=performance.now(),C();let u=E.current;u&&T(At(u))},[C,T]);ea(()=>{let u=E.current;if(!u)return;let k=P=>{let A=P,L=A.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){P.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let J=L.startsWith("delete")?"":A.data??"";F(J)&&P.preventDefault()}};return u.addEventListener("beforeinput",k),()=>u.removeEventListener("beforeinput",k)},[F]);let d=fe(()=>{X.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),S=fe(()=>{X.current=!1,E.current?.removeAttribute("data-aia-composing"),C()},[C]),Fe=fe(u=>{u.preventDefault();let k=E.current;if(!k)return;let P=(u.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!P)return;let A=k.ownerDocument??document,L=A.getSelection();if(!L||L.rangeCount===0)return;let J=L.getRangeAt(0);if(!k.contains(J.startContainer))return;J.deleteContents();let ne=A.createTextNode(P);J.insertNode(ne),J.setStartAfter(ne),J.collapse(!0),L.removeAllRanges(),L.addRange(J),C()},[C]),ke=fe(u=>te(u),[te]),g=fe(()=>Y(!0),[Y]),He=fe(()=>Y(!1),[Y]),Ce=fe(()=>E.current?.focus(),[]),Re=fe(()=>E.current?.blur(),[]),Oe=fe(()=>{let u=E.current;return u?Et(u):""},[]),Se=Yo()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:Se,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":I,"aria-expanded":v,"aria-activedescendant":q,spellCheck:!0,enterKeyHint:"send",onInput:B,onKeyDown:ke,onCompositionStart:d,onCompositionEnd:S,onPaste:Fe,onFocus:g,onBlur:He},getPlainText:Oe,focus:Ce,blur:Re}}import{jsx as ia,jsxs as Fa}from"react/jsx-runtime";function on(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var nn=jo(function({onSubmit:n,onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:f,language:w,currency:y,productId:m,visitorId:h,columns:c,pillPlacement:v="dropdown",mode:I="auto",optionsPosition:q="below",animations:D=!0,optionsStyle:O="floating",dropdownTrigger:te,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:_,showNonTappableOptions:F,locationSearch:Y,showOptionIcons:E=!0,showChipIcons:X=!0,showChipImages:G=!0,showChipRemove:H=!1,showOptionImages:j=!0,showOptionCounts:de=!0,showSkipButton:C,showProducts:B,productsLayout:d,productImageFallback:S,autoFocus:Fe=!0,onFocus:ke,onBlur:g,value:He,completedParams:Ce,onChange:Re,onParamsChange:Oe,products:Se,mapProducts:u,onProductSelect:k,onProductAddToCart:P,submitButton:A,resetOnSubmit:L=!0,seeAllResults:J=!1},ne){let he=ta(null),Te=ta(null),Le=ta(null),oe=ta(()=>{}),ue=ta(null),ze=ta(null);Na(()=>{let N=he.current;if(N)return ue.current?ue.current.setMode(I):ue.current=new Jo(N,I),()=>{ue.current?.destroy(),ue.current=null}},[I]);let Be=ya(N=>{let se=ze.current?.current;se&&(se.focus(),en(se,N))},[]),{completedParams:oa,suggestionPills:be,setActivePill:Qe,skipActivePill:ie,segments:x,newParamId:De,clearNewParamId:i,placeholderText:V,isFocused:b,isDropdownOpen:we,isActivePillSelected:na,isLoading:re,isReady:We,activeIndex:Ge,listboxId:Pe,handleTextChange:Ye,handleKeyDown:Ie,setFocused:ve,editingParam:Me,editingIdentified:Ke,editingAnchor:je,caretOffset:Ee,startEditingParam:qe,removeParam:p,handleCaretAfterInput:W,handleCaretMove:M,replaceEditingRange:R,dropdownProps:Ha,reset:ua,refreshProducts:Ba,prepareSubmit:Wa,getState:Ga,recordSubmit:Ka}=Da({onSubmit:N=>oe.current(N),onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:f,language:w,currency:y,productId:m,visitorId:h,columns:c,dropdownTrigger:te,optionsPosition:q,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:_,showNonTappableOptions:F,locationSearch:Y,showOptionIcons:E,showOptionImages:j,showOptionCounts:de,showSkipButton:C,showProducts:B,onFocus:ke,onBlur:g,value:He,completedParams:Ce,onChange:Re,onParamsChange:Oe,products:Se,mapProducts:u,onProductSelect:k,onProductAddToCart:P,source:"full-sdk",setCursor:Be});Na(()=>{if(!De)return;let N=window.setTimeout(()=>i(),650);return()=>window.clearTimeout(N)},[De,i]);let Lt=Ge>=0?`${Pe}-option-${Ge}`:void 0,{inputRef:ka,editorProps:zt,focus:ma,blur:qa,getPlainText:_a}=Ot({segments:x,newParamId:De,editingParam:Me,editingIdentified:Ke,editingAnchor:je,caretOffset:Ee,placeholderText:V,hintSuggestions:v==="inline"?[]:be,isFocused:b,showChipIcons:X,showChipImages:G,showChipRemove:H,removeParam:p,isDropdownOpen:we,listboxId:Pe,activeDescendantId:Lt,autoFocus:Fe,handleTextChange:Ye,handleKeyDown:Ie,handleCaretAfterInput:W,handleCaretMove:M,startEditingParam:qe,replaceEditingRange:R,setFocused:ve});ze.current=ka,Zo(()=>{let N=Te.current,se=ka.current;if(!N||!se)return;let sa=()=>{let Ua=N.firstElementChild;if(!Ua)return;let Bt=Ua.getBoundingClientRect(),Wt=se.getBoundingClientRect();Bt.top>=Wt.bottom-2?N.setAttribute("data-aia-pill-wrapped",""):N.removeAttribute("data-aia-pill-wrapped")};sa();let Va=new ResizeObserver(sa);return Va.observe(se),()=>Va.disconnect()},[x,be.length,re,ka]),Na(()=>{let N=Le.current;if(N)return tn(N)},[]),$o(ne,()=>({focus:ma,blur:qa,reset:ua,refreshProducts:Ba,setMode:N=>ue.current?.setMode(N),skipActivePill:ie}),[ma,qa,ua,Ba,ie]);let $e=!!x.length||oa.length>0,ra=ya(N=>{if(!$e)return;N&&Wa();let se=Ga(),sa=Xo(_a(),se.completedParams,se.skippedParams,{identifiedParams:se.identifiedParams,isReady:se.isReady,customFields:se.customFields});N&&Ka(sa),n(sa),L&&ua()},[Ka,L,$e,Wa,Ga,n,ua,_a]);oe.current=()=>ra(!1);let Dt=J&&!Ha.isInputEmpty&&$e,Mt=ya(()=>ra(!0),[ra]),Nt=ya(N=>{N.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||ma()},[ma]),Ft=v==="inline",Ht=v==="dropdown";return Fa("div",{ref:he,className:`magicx-aia ${_e.container} ${r??""}`,"data-pill-placement":v,"data-options-position":q,"data-animations":D?"on":"off","data-aia-options-style":O,"data-mode":on(I),children:[ia(La,{...Ha,showPills:Ht,productsLayout:d,productImageFallback:S,onSeeAllResults:Dt?Mt:void 0}),Fa("div",{className:_e.inputWrapper,"data-aia-input-wrapper":"",onClick:Nt,children:[Fa("div",{ref:Le,className:_e.editorArea,"data-aia-editor":"",children:[ia("div",{...zt,className:_e.input,"data-aia-input":""}),Ft&&(re||be.length>0)&&ia("span",{ref:Te,className:_e.pillListContainer,"data-aia-pill-list-container":"",children:ia(fa,{pills:be,activePillIndex:0,activeSelected:na,onSelectPill:Qe,loading:re})})]}),A===null?null:A===void 0?ia(yt,{disabled:!$e,ready:$e&&We,onClick:()=>ra(!0),label:an(w).submit}):ia("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:_e.submitSlot,onClick:N=>{$e&&(N.stopPropagation(),ra(!0))},children:A})]})]})});export{nn as AIAutocomplete,La as AIAutocompleteDropdown,ms as DATE_RANGE_META_END,gs as DATE_RANGE_META_START,fs as DEFAULT_OPTION_COUNT_UNIT,Ss as LOCATION_META_KEY,Ls as PRODUCT_PATH_PREFIX,Ks as TIME_META_KEY,_s as WEEKDAY_LABELS,ps as buildSubmitResult,hs as cellDay,us as cellIso,bs as dateCellMarks,ws as formatDate,vs as formatDateRange,xs as formatOptionCount,ys as formatPlace,ks as formatTime,Cs as isoDate,Ts as monthLabel,Ps as optionCountLabel,Is as optionHasImage,Es as optionImageSources,As as optionImageSrc,Rs as optionLabel,Os as optionsShowLeadingVisuals,zs as parseDate,Ds as parseLooseDate,Ms as parseLooseDateRange,Ns as parseTime,Fs as productFromMatchedItem,Hs as productImageSources,Bs as productsFromCustomFields,Ws as sanitizeOptionIconSvg,Gs as selectedRangeFor,Da as useAIAutocomplete,qs as visibleDateRange,Vs as withSkippedParams};
|
|
3677
3779
|
//# sourceMappingURL=index.mjs.map
|