@magicx-eng/ai-autocomplete-react 0.46.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/index.js +22 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -11
- 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 cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END as ur,DATE_RANGE_META_START as mr,DEFAULT_OPTION_COUNT_UNIT as gr,dateCellMarks as fr,formatDate as br,formatDateRange as wr,formatOptionCount as vr,formatTime as xr,isoDate as yr,monthLabel as kr,optionCountLabel as
|
|
1
|
+
import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END as ur,DATE_RANGE_META_START as mr,DEFAULT_OPTION_COUNT_UNIT as gr,dateCellMarks as fr,formatDate as br,formatDateRange as wr,formatOptionCount as vr,formatTime as xr,isoDate as yr,monthLabel as kr,optionCountLabel as Cr,optionHasImage as Sr,optionImageSources as Tr,optionImageSrc as Pr,optionLabel as Ir,optionsShowLeadingVisuals as Er,PRODUCT_PATH_PREFIX as Ar,parseDate as Rr,parseLooseDate as Or,parseLooseDateRange as Dr,parseTime as Lr,productFromMatchedItem as Mr,productImageSources as zr,productsFromCustomFields as Nr,sanitizeOptionIconSvg as Hr,selectedRangeFor as Fr,TIME_META_KEY as Br,visibleDateRange as Wr,WEEKDAY_LABELS as Gr,withSkippedParams as Kr}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as eo,useCallback as Tt,useEffect as da,useImperativeHandle as to,useLayoutEffect as ao,useRef as Ze}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
|
|
@@ -280,7 +280,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
280
280
|
opacity: 0;
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
-
`,document.head.appendChild(e)}var De={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaPillReveal:"aia-aiaPillReveal-wf05b"};import{attachScrollArrow as Ei,attachViewportFit as Ai,containScroll as Ri,hasSkippablePill as Oi,isCalendarFormat as Di,labelTraditionalAutocomplete as Li,uiStringsFor as Mi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as
|
|
283
|
+
`,document.head.appendChild(e)}var De={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaPillReveal:"aia-aiaPillReveal-wf05b"};import{attachScrollArrow as Ei,attachViewportFit as Ai,containScroll as Ri,hasSkippablePill as Oi,isCalendarFormat as Di,labelTraditionalAutocomplete as Li,uiStringsFor as Mi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as We,useRef as Be,useState as zi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
284
284
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
285
285
|
* Consumer CSS always wins without !important.
|
|
286
286
|
*
|
|
@@ -1162,7 +1162,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
1162
1162
|
font-weight: inherit;
|
|
1163
1163
|
cursor: pointer;
|
|
1164
1164
|
}
|
|
1165
|
-
`,document.head.appendChild(e)}var se={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q",multiDone:"aia-multiDone-y12U7"};import{cellDay as ba,cellIso as He,dateCellMarks as wa,isoDate as va,monthLabel as xa,visibleDateRange as ya,WEEKDAY_LABELS as ka}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as
|
|
1165
|
+
`,document.head.appendChild(e)}var se={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q",multiDone:"aia-multiDone-y12U7"};import{cellDay as ba,cellIso as He,dateCellMarks as wa,isoDate as va,monthLabel as xa,visibleDateRange as ya,WEEKDAY_LABELS as ka}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Ca}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) ---
|
|
1166
1166
|
|
|
1167
1167
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1168
1168
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1325,7 +1325,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
1325
1325
|
opacity: 0.8;
|
|
1326
1326
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1327
1327
|
}
|
|
1328
|
-
`,document.head.appendChild(e)}var D={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};import{jsx as le,jsxs as Ot}from"react/jsx-runtime";var
|
|
1328
|
+
`,document.head.appendChild(e)}var D={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};import{jsx as le,jsxs as Ot}from"react/jsx-runtime";var Sa=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Dt({options:e,activeIndex:n,listboxId:t,view:a,selection:i,onSelect:r,onHighlight:o,onUnhighlight:s,onPreviousMonth:h,onNextMonth:b}){let x=va(new Date),m=ya({pendingStart:i.rangeStart,highlightedIso:He(e[n]),selected:i.selectedRange});return Ot("div",{className:D.datepicker,"data-aia-datepicker":"",children:[Ot("div",{className:D.header,children:[le("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:l=>l.preventDefault(),onClick:h,children:"\u2039"}),le("span",{className:D.month,"data-aia-date-month":"","aria-live":"polite",children:xa(a)}),le("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:l=>l.preventDefault(),onClick:b,children:"\u203A"})]}),le("div",{className:D.weekdays,"aria-hidden":"true",children:ka.map((l,d)=>le("span",{className:D.weekday,children:l},Sa[d]))}),le("div",{className:D.grid,"data-aia-date-grid":"",children:e.map((l,d)=>le(Ta,{option:l,id:`${t}-option-${d}`,index:d,isHighlighted:d===n&&l.is_tappable,isToday:He(l)===x,isPast:He(l)!=null&&He(l)<x,marks:wa(He(l),{selectedIso:i.selectedIso,range:m}),onSelect:r,onHighlight:o,onUnhighlight:s},He(l)??`pad-${d}`))})]})}function Ta({option:e,id:n,index:t,isHighlighted:a,isToday:i,isPast:r,marks:o,onSelect:s,onHighlight:h,onUnhighlight:b}){let[x,m]=Ca(!1),l=ba(e);if(l==null)return le("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${D.cell} ${D.blank}`});let d=()=>{m(!0),s(e),setTimeout(()=>m(!1),170)},w=[D.cell,D.day,r?D.past:"",a?D.highlighted:"",i?D.today:"",o.inRange?D.inRange:"",o.selected?D.selected:"",x?D.pressed:""].filter(Boolean).join(" ");return le("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:w,onClick:d,onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),d())},onMouseEnter:()=>h(t),onMouseLeave:b?()=>b(t):void 0,children:le("span",{className:D.number,children:l})})}import{ATTRIBUTION_URL as Pa,buildAttributionUrl as Ia,getFooterHint as Ea,uiStringsFor as Aa}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ra,useState as Oa}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 {
|
|
1329
1329
|
display: flex;
|
|
1330
1330
|
flex-wrap: wrap;
|
|
1331
1331
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1365,7 +1365,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
1365
1365
|
.aia-cluster[data-justify="around"] {
|
|
1366
1366
|
justify-content: space-around;
|
|
1367
1367
|
}
|
|
1368
|
-
`,document.head.appendChild(e)}import{jsx as Lt}from"react/jsx-runtime";function
|
|
1368
|
+
`,document.head.appendChild(e)}import{jsx as Lt}from"react/jsx-runtime";function Qe({gap:e,align:n="center",justify:t="start",noWrap:a=!1,inline:i=!1,className:r,children:o,...s}){let h=e?{"--aia-cluster-gap":e}:void 0,b={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":n,"data-justify":t,"data-nowrap":a||void 0,"data-inline":i||void 0,style:h,...s};return i?Lt("span",{...b,children:o}):Lt("div",{...b,children:o})}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
|
|
1369
1369
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1370
1370
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1371
1371
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -1512,7 +1512,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
1512
1512
|
justify-content: flex-end;
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
|
-
`,document.head.appendChild(e)}var me={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
|
|
1515
|
+
`,document.head.appendChild(e)}var me={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 $e,jsxs as ut}from"react/jsx-runtime";function Mt({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:t=Aa()}){let{key:a,hint:i}=Ea(e,n,t),[r,o]=Oa(Pa);return Ra(()=>{o(Ia())},[]),$e("footer",{className:me.footer,"data-aia-footer":"",children:ut(Qe,{justify:"between",noWrap:!0,className:me.row,children:[ut(Qe,{gap:"5px",className:me.hintGroup,children:[$e("kbd",{className:me.key,children:a}),$e("span",{className:me.hint,children:i})]}),ut("a",{className:me.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[$e("span",{className:me.brand,children:"AI"}),$e("span",{className:me.badge,children:"Autocomplete"})]})]})})}import{isSmartSuggestion as za,isTraditionalAutocompleteSuggestion as Na}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Da}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,
|
|
1516
1516
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
1517
1517
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
1518
1518
|
as it was when the outline was dashed. */
|
|
@@ -1913,6 +1913,22 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
1913
1913
|
--aia-product-price-color,
|
|
1914
1914
|
var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
|
|
1915
1915
|
);
|
|
1916
|
+
/* The price and the struck price are two items on one line that wrap as
|
|
1917
|
+
whole figures: a long pair drops the struck price to the next line rather
|
|
1918
|
+
than running past the card's edge. */
|
|
1919
|
+
display: flex;
|
|
1920
|
+
flex-wrap: wrap;
|
|
1921
|
+
align-items: baseline;
|
|
1922
|
+
column-gap: 4px;
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
/* The price before a markdown, struck through after the price, on the same
|
|
1926
|
+
line when both fit. It inherits the price's size and takes its colour dimmed, so it reads
|
|
1927
|
+
as secondary on any surface without a second theming control. */
|
|
1928
|
+
.aia-compareAt-ewE54 {
|
|
1929
|
+
font-weight: 400;
|
|
1930
|
+
color: var(--aia-product-compare-at-color, currentColor);
|
|
1931
|
+
opacity: var(--aia-product-compare-at-opacity, 0.6);
|
|
1916
1932
|
}
|
|
1917
1933
|
|
|
1918
1934
|
/* Sold-out badge. It sits last in the text column, so the card's accessible
|
|
@@ -2146,7 +2162,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
2146
2162
|
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT[data-aia-product-has-cart] {
|
|
2147
2163
|
padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
|
|
2148
2164
|
}
|
|
2149
|
-
`,document.head.appendChild(e)}var
|
|
2165
|
+
`,document.head.appendChild(e)}var L={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"};import{jsx as W,jsxs as Fe}from"react/jsx-runtime";function Ht({products:e,listboxId:n,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:r=!0,layout:o="row",imageFallback:s="image",strings:h=qa()}){let b=e.length>0,x=ot(null);if(bt(()=>{let l=x.current;if(!(!b||!l))return Fa(l)},[b]),!b)return null;let m=`${n}-products-label`;return Fe("section",{className:L.section,"data-aia-products":"","data-aia-products-layout":o,role:"group","aria-labelledby":m,children:[W("div",{className:L.label,id:m,"data-aia-products-label":"",children:h.products}),W("div",{ref:x,className:L.row,"data-aia-products-row":"",children:e.map((l,d)=>W(_a,{product:l,id:`${n}-product-${d}`,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:r,imageFallback:s,soldOut:h.soldOut,addToCart:h.addToCart},l.id))})]})}function _a({product:e,id:n,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:r,imageFallback:o,soldOut:s,addToCart:h}){let b=!!a&&e.available!==!1,[x,m]=nt(null),l=w=>{w.relatedTarget?.closest("[data-aia-dropdown]")||i?.(!1)},d=w=>{w.metaKey||w.ctrlKey||w.shiftKey||w.altKey||w.button!==0||(w.preventDefault(),t(e))};return Fe("a",{id:n,className:L.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":b?"":void 0,role:"option","aria-selected":!1,style:x?{"--aia-product-photo-fill-x":String(x.x),"--aia-product-photo-fill-y":String(x.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:d,onKeyDown:w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),t(e))},onFocus:()=>i?.(!0),onBlur:l,children:[W(Ya,{sources:Ba(e.imageUrl),title:e.title,fallback:o,onPhotoFill:m},Wa(e.imageUrl)??""),Fe("span",{className:L.body,children:[e.vendor?W("span",{className:L.vendor,children:e.vendor}):null,W("span",{className:L.title,children:e.title}),e.price?Fe("span",{className:L.price,children:[e.price,e.compareAtPrice?W("s",{className:L.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?W("span",{className:L.badge,children:s}):null]}),b&&a?W(Va,{product:e,label:`${h}: ${e.title}`,focusable:r,onAddToCart:a,onFocus:()=>i?.(!0),onBlur:l},Ua(e)):null]})}function Ua(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function Va({product:e,label:n,focusable:t,onAddToCart:a,onFocus:i,onBlur:r}){let[o,s]=nt(null),h=ot(null),b=ot(e);b.current=e;let x=ot(!0);bt(()=>(x.current=!0,()=>{x.current=!1}),[]);let m=d=>{h.current=d,x.current&&s(d)},l=d=>{if(d.preventDefault(),d.stopPropagation(),h.current==="adding")return;m("adding");let w;try{w=Promise.resolve(a(b.current))}catch(I){w=Promise.reject(I)}w.then(()=>m("added"),()=>m(null))};return W("span",{className:L.cart,"data-aia-product-cart":"","data-aia-cart-state":o??void 0,"aria-busy":o==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:t?0:-1,onClick:l,onKeyDown:d=>{d.key!=="Enter"&&d.key!==" "||l(d)},onFocus:d=>{d.stopPropagation(),i()},onBlur:d=>{d.stopPropagation(),r(d)},children:Fe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[W("path",{className:L.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"}),W("path",{className:L.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),W("path",{className:L.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),W("path",{className:L.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),W("circle",{className:L.cartGlyph,cx:"9",cy:"20",r:"1.3"}),W("circle",{className:L.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ya({sources:e,title:n,fallback:t,onPhotoFill:a}){let[i,r]=nt(0),o=e[i],s=!!o,[h,b]=nt(null),x=!s&&t==="initial";return bt(()=>()=>a(null),[a]),Fe("span",{className:L.media,"aria-hidden":"true","data-aia-product-placeholder":!s&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":s&&h===o?"":void 0,children:[s?W("img",{className:L.image,src:o,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{b(o),a(Ka(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{i+1>=e.length&&a(null),r(m=>m+1)}}):null,x?Ga(n):null]})}import{isOptionsGridMobileViewport as si,measureOptionsGrid as li,needsOptionsGridMeasurement as di,OPTIONS_GRID_MOBILE_QUERY as ci,optionEnterDelayMs as pi,optionsShowLeadingVisuals as hi,planOptionsGrid as Gt,sameOptionRows as ui}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as mi,useLayoutEffect as gi,useRef as Kt,useState as _t}from"react";import{optionsGridTemplateColumns as ja}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Qa,useRef as $a}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 {
|
|
2150
2166
|
display: grid;
|
|
2151
2167
|
grid-template-columns: repeat(
|
|
2152
2168
|
auto-fit,
|
|
@@ -2671,7 +2687,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
2671
2687
|
.aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
|
|
2672
2688
|
background: var(--aia-option-bg, transparent);
|
|
2673
2689
|
}
|
|
2674
|
-
`,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",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd",checkbox:"aia-checkbox-KGRhg"};import{Fragment as ri,jsx as ge,jsxs as wt}from"react/jsx-runtime";function Wt({option:e,isHighlighted:n,checked:t,onSelect:a,onHighlight:i,onUnhighlight:r,id:o,loading:s,showIcon:h=!0,showImage:b=!0,showCount:x=!0,scrollHint:m,enterDelayMs:l=0}){let[d]=rt(l),[w,I]=rt(!1),j=b?ti(e.image_url):[],H=j[0]??null,[K,U]=rt([]),P=j.find(E=>!K.includes(E))??null,[R,
|
|
2690
|
+
`,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",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd",checkbox:"aia-checkbox-KGRhg"};import{Fragment as ri,jsx as ge,jsxs as wt}from"react/jsx-runtime";function Wt({option:e,isHighlighted:n,checked:t,onSelect:a,onHighlight:i,onUnhighlight:r,id:o,loading:s,showIcon:h=!0,showImage:b=!0,showCount:x=!0,scrollHint:m,enterDelayMs:l=0}){let[d]=rt(l),[w,I]=rt(!1),j=b?ti(e.image_url):[],H=j[0]??null,[K,U]=rt([]),P=j.find(E=>!K.includes(E))??null,[R,C]=rt(null),Q=oi(()=>!H&&h&&e.icon_svg?ai(e.icon_svg):null,[H,h,e.icon_svg]),F=x?Xa(e.item_count):null,B=ni(void 0);ii(()=>()=>clearTimeout(B.current),[]);let Z=()=>{s||!e.is_tappable||w&&t===void 0||(I(!0),a(e),clearTimeout(B.current),B.current=setTimeout(()=>I(!1),170))},ee=[_.item,n&&!s?_.highlighted:"",e.is_tappable?_.tappable:_.nonTappable,w?_.pressed:"",m?_.scrollHint:""].filter(Boolean).join(" ");return ge("div",{id:o,role:"option","data-aia-option":"","data-aia-loading":s?"":void 0,"data-aia-icon":Q&&e.icon?e.icon:void 0,"data-aia-image":H?"":void 0,"data-aia-item-count":F!==null?e.item_count:void 0,"aria-selected":t??n,className:ee,style:{[ei]:`${d}ms`},tabIndex:s||!e.is_tappable?-1:0,onClick:Z,onKeyDown:E=>{!s&&e.is_tappable&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Z())},onMouseEnter:!s&&e.is_tappable?i:void 0,onMouseLeave:r,children:wt("span",{className:_.content,children:[t!==void 0&&ge("span",{className:_.checkbox,"aria-hidden":"true","data-checked":t,children:t?"\u2713":""}),H&&ge("span",{className:`${_.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":P!==null&&R===P?"":void 0,children:ge("img",{src:P??H,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:P===null,onLoad:()=>C(P),onError:()=>{P!==null&&U(E=>[...E,P])}})}),Q&&ge("span",{className:`${_.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:Q}}),wt("span",{className:_.text,children:[e.matchedText?Ja(Bt(e),e.matchedText).map((E,te)=>E.bold?ge("strong",{className:`${_.match} magicx-aia-option-match`,children:E.text},te):E.text):Bt(e),e.parameterLabel&&wt(ri,{children:[" ",ge("span",{className:`${_.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ge("span",{className:_.tag,children:e.tag}),F!==null&&ge("span",{className:`${_.count} magicx-aia-option-count`,children:F})]})})}import{jsx as qt}from"react/jsx-runtime";function fi(){let[e,n]=_t(si);return mi(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(ci),a=()=>n(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function Ut({options:e,activeIndex:n,picked:t,onSelect:a,onHighlight:i,onUnhighlight:r,listboxId:o,loading:s,groupKey:h="",optionsPosition:b="below",showIcons:x=!0,showImages:m=!0,showCounts:l=!0}){let d=fi(),w=Kt(null),[I,j]=_t(null),H=Kt(null);gi(()=>{if(s&&ui(H.current,e))return;H.current=s?null:e;let P=w.current,C=P&&!s&&di(e.length,d)?li(P):null;j(C?Gt(e.length,d,C.rowWidths,C.gridWidth):null)},[e,d,s]);let K=I??Gt(e.length,d,null,null),U=hi(e,x,m);return qt(Ft,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:h,template:K.template,maxHeight:K.maxHeight,innerRef:P=>{w.current=P},"data-aia-group":h,children:e.map((P,R)=>qt(Wt,{option:P,isHighlighted:R===n,checked:t?t.includes(P.text):void 0,onSelect:a,onHighlight:()=>i(R),onUnhighlight:r?()=>r(R):void 0,id:`${o}-option-${R}`,loading:s,showIcon:x&&U,showImage:m&&U,showCount:l,scrollHint:!s&&K.scrollHintIndices.includes(R),enterDelayMs:s?0:pi(R,K.cols,e.length,b)},`${h}\0${P.text}`))})}import{formatTime as bi,TIME_WHEEL_COLUMNS as wi,TIME_WHEEL_ROW_HEIGHT as vi,timeWheelIndex as Vt,timeWheelIndexFromScroll as xi,timeWheelRows as yi,withTimeWheelIndex as Yt}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as ki,useEffect as Ci,useLayoutEffect as Si,useRef as st}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) ---
|
|
2675
2691
|
|
|
2676
2692
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
2677
2693
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -2796,7 +2812,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
2796
2812
|
.aia-done-llNY5:hover {
|
|
2797
2813
|
background: var(--aia-time-done-bg-hover, rgba(var(--aia-streak-rgb, 255, 255, 255), 0.16));
|
|
2798
2814
|
}
|
|
2799
|
-
`,document.head.appendChild(e)}var oe={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 Le,jsxs as vt}from"react/jsx-runtime";var Ti=120;function jt({view:e,label:n,doneLabel:t,interactive:a=!0,onTimeChange:i,onTimeCommit:r}){return vt("div",{className:oe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:o=>o.preventDefault(),children:[Le("span",{className:oe.value,"data-aia-time-value":"","aria-live":"polite",children:bi(e.minutes)}),vt("div",{className:oe.columns,"aria-hidden":"true",children:[Le("div",{className:oe.band}),wi.map(o=>vt(ki,{children:[o==="minute"&&Le("span",{className:oe.separator,children:":"}),Le(Pi,{column:o,minutes:e.minutes,interactive:a,onTimeChange:i})]},o))]}),Le("button",{type:"button",tabIndex:-1,className:oe.done,"data-aia-time-done":"",onClick:()=>{a&&r()},children:t})]})}function Pi({column:e,minutes:n,interactive:t,onTimeChange:a}){let i=st(null),r=st(null),o=st(null),s=st({minutes:n,interactive:t,onTimeChange:a});s.current={minutes:n,interactive:t,onTimeChange:a};let h=Vt(e,n);
|
|
2815
|
+
`,document.head.appendChild(e)}var oe={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 Le,jsxs as vt}from"react/jsx-runtime";var Ti=120;function jt({view:e,label:n,doneLabel:t,interactive:a=!0,onTimeChange:i,onTimeCommit:r}){return vt("div",{className:oe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:o=>o.preventDefault(),children:[Le("span",{className:oe.value,"data-aia-time-value":"","aria-live":"polite",children:bi(e.minutes)}),vt("div",{className:oe.columns,"aria-hidden":"true",children:[Le("div",{className:oe.band}),wi.map(o=>vt(ki,{children:[o==="minute"&&Le("span",{className:oe.separator,children:":"}),Le(Pi,{column:o,minutes:e.minutes,interactive:a,onTimeChange:i})]},o))]}),Le("button",{type:"button",tabIndex:-1,className:oe.done,"data-aia-time-done":"",onClick:()=>{a&&r()},children:t})]})}function Pi({column:e,minutes:n,interactive:t,onTimeChange:a}){let i=st(null),r=st(null),o=st(null),s=st({minutes:n,interactive:t,onTimeChange:a});s.current={minutes:n,interactive:t,onTimeChange:a};let h=Vt(e,n);Si(()=>{let m=i.current;if(!m||o.current)return;let l=h*vi;Math.abs(m.scrollTop-l)<1||(r.current=l,m.scrollTop=l)},[h]),Ci(()=>()=>{o.current&&clearTimeout(o.current)},[]);let b=()=>{o.current=null;let m=i.current,l=s.current;if(!m||!l.interactive)return;let d=xi(e,m.scrollTop);d!==Vt(e,l.minutes)&&l.onTimeChange(Yt(e,l.minutes,d))},x=()=>{let m=i.current;if(m){if(r.current!=null&&Math.abs(m.scrollTop-r.current)<1){r.current=null;return}r.current=null,o.current&&clearTimeout(o.current),o.current=setTimeout(b,Ti)}};return Le("div",{ref:i,className:oe.column,"data-aia-time-column":e,onScroll:x,children:yi(e).map((m,l)=>Le("div",{className:l===h?`${oe.row} ${oe.selected}`:oe.row,"data-aia-time-row":"","data-aia-index":l,onClick:()=>{s.current.interactive&&a(Yt(e,s.current.minutes,l))},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 {
|
|
2800
2816
|
display: flex;
|
|
2801
2817
|
flex-direction: column;
|
|
2802
2818
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -2811,7 +2827,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
2811
2827
|
align-items: end;
|
|
2812
2828
|
}
|
|
2813
2829
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
2814
|
-
`,document.head.appendChild(e)}import{jsx as Ii}from"react/jsx-runtime";function Qt({space:e,align:n="stretch",className:t,children:a,...i}){let r=e?{"--aia-stack-space":e}:void 0;return Ii("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":n,style:r,...i,children:a})}import{jsx as Y,jsxs as xt}from"react/jsx-runtime";var Ni=[159,119,164],Hi=()=>{},$t=()=>{},Fi=e=>{},Bi=()=>{};function Wi(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=zi(n);if(
|
|
2830
|
+
`,document.head.appendChild(e)}import{jsx as Ii}from"react/jsx-runtime";function Qt({space:e,align:n="stretch",className:t,children:a,...i}){let r=e?{"--aia-stack-space":e}:void 0;return Ii("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":n,style:r,...i,children:a})}import{jsx as Y,jsxs as xt}from"react/jsx-runtime";var Ni=[159,119,164],Hi=()=>{},$t=()=>{},Fi=e=>{},Bi=()=>{};function Wi(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=zi(n);if(We(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let i=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>a(i.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Gi(e,n){let t=Be(null);We(()=>{let a=e.current,i=n.current;if(!a||!i)return;let r=a.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:Ei({dropdown:a,grid:r,button:i})};return}t.current?.controller.update()}),We(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ki(e,n){let t=Be(n);t.current=n;let a=Be(null);We(()=>{let i=e.current;if(i){if(!a.current){a.current=Ai({dropdown:i,isOpen:()=>t.current});return}a.current.update()}}),We(()=>()=>{a.current?.destroy(),a.current=null},[])}function yt({suggestions:e,activeIndex:n,onSelect:t,onHighlight:a,onUnhighlight:i,isOpen:r,id:o,className:s,pills:h,onPillClick:b,showPills:x=!0,onSkip:m,showSkipButton:l=!0,showOptionIcons:d=!0,showOptionImages:w=!0,showOptionCounts:I=!0,skipDisabled:j=!1,activeSelected:H=!1,isLoading:K=!1,skeletonExiting:U=!1,isInputEmpty:P=!1,language:R,products:C,onProductSelect:Q,onProductAddToCart:F,onProductFocusChange:B,productsLayout:Z="row",productImageFallback:ee="image",formatType:E="options",dateView:te=null,selectedDateIso:fe=null,selectedDateRange:ce=null,dateRangeStart:Ie=null,onPreviousMonth:be,onNextMonth:g,timeView:we=null,multiSelectView:ve=null,onMultiSelectCommit:xe,onTimeChange:ye,onTimeCommit:ke,optionsPosition:u="below",mode:y}){let k=Wi(y),T=k!==void 0,S=Be(null),M=Be(null);Gi(S,M),We(()=>{if(S.current)return Ri(S.current)},[]);let X=e[0]?.options??[],V=!!(h&&h.length>0&&b),Ce=!!(C&&C.length>0),Ee=E==="time"&&we!=null,re=r&&(X.length>0||x&&V||K||Ce||Ee);Ki(S,re);let pe={suggestions:e,activeIndex:n,pills:h,showPills:x,showSkipButton:l,showOptionIcons:d,showOptionImages:w,showOptionCounts:I,skipDisabled:j,activeSelected:H,isLoading:K,skeletonExiting:U,isInputEmpty:P,products:C,formatType:E,dateView:te,selectedDateIso:fe,selectedDateRange:ce,dateRangeStart:Ie,timeView:we,multiSelectView:ve},Se=Be(pe);re&&(Se.current=pe);let p=re?pe:Se.current,q=Mi(R),J=p.suggestions[0],ae=J?.options??[],Ae=p.activeIndex>=0&&!!ae[p.activeIndex]?.is_tappable,v=Li(p.pills??[],q.keepTyping),Re=!!(v.length>0&&b),_e=p.showPills&&Re,he=p.showPills&&!Re&&p.isLoading,f=_e||he,Te=Re&&Oi(v)&&p.showSkipButton&&!p.isInputEmpty&&!!m,Me=v[0]?.text,Pe=Di(p.formatType)&&p.dateView!=null,ze=ae.length>0&&!Pe,Ne=ae.length>0&&Pe&&!p.isLoading,ue=p.formatType==="time"&&p.timeView!=null&&!p.isLoading,Ue=p.isLoading&&!ze&&!Ne&&!ue,ie=p.products??[];return xt("div",{ref:S,id:o,role:"listbox","aria-multiselectable":!!p.multiSelectView,"data-aia-dropdown":"","data-options-position":u,"data-mode":k,"data-aia-loading":p.isLoading?"":void 0,"data-aia-skeleton-exiting":p.skeletonExiting?"":void 0,"data-aia-has-products":ie.length>0?"":void 0,className:`${T?"magicx-aia ":""}${se.dropdown} ${re?se.visible:""} ${s??""}`,onMouseDown:z=>z.preventDefault(),children:[xt(Qt,{space:"8px",children:[(f||Te)&&xt(Qe,{noWrap:!0,className:se.pillBar,"data-aia-pillbar":"",children:[f&&Y("span",{className:se.pillScroll,"data-aia-pill-scroll":"",children:Y(it,{pills:v,activePillIndex:0,activeSelected:p.activeSelected,onSelectPill:b??(()=>{}),rounded:!0,loading:p.isLoading})}),Te&&Y("button",{type:"button",tabIndex:-1,className:se.skip,"data-aia-skip":"",disabled:p.isLoading||p.skipDisabled,"aria-label":Me?`${q.skipLabel} ${Me}`:q.skipLabel,onClick:m,children:q.skip})]}),ze&&Y(Ut,{options:ae,activeIndex:p.activeIndex,onSelect:t,onHighlight:a,onUnhighlight:i,listboxId:o,loading:p.isLoading,groupKey:J?`${J.parameter} ${J.text}`:"",optionsPosition:u,showIcons:p.showOptionIcons,showImages:p.showOptionImages,showCounts:p.showOptionCounts,picked:p.isLoading?void 0:p.multiSelectView?.picked}),p.multiSelectView&&!p.isLoading&&Y("div",{onClick:z=>{z.target.closest("[data-aia-multi-done]")&&!p.skipDisabled&&xe?.()},children:Y("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:se.multiDone,ref:z=>{z&&(z.disabled=!0,z.offsetHeight,z.disabled=p.skipDisabled)},children:q.done})}),Ne&&p.dateView&&Y(Dt,{options:ae,activeIndex:p.activeIndex,listboxId:o,view:p.dateView,selection:{selectedIso:p.selectedDateIso??null,selectedRange:p.selectedDateRange??null,rangeStart:p.dateRangeStart??null},onSelect:t,onHighlight:a,onUnhighlight:i,onPreviousMonth:be??$t,onNextMonth:g??$t}),ue&&p.timeView&&Y(jt,{view:p.timeView,label:q.timeLabel,doneLabel:q.done,interactive:!p.skipDisabled,onTimeChange:ye??Fi,onTimeCommit:ke??Bi}),Ue&&Y("div",{className:se.skeletonBars,"data-aia-skeleton-bars":"",children:Ni.map(z=>Y("span",{className:se.skeletonBar,style:{width:z}},`bar-${z}`))}),Y(Ht,{products:ie,listboxId:o,onSelect:Q??Hi,onAddToCart:F,onFocusChange:B,focusable:re,layout:Z,imageFallback:ee,strings:q}),Y(Mt,{isOptionHighlighted:Ae,isInputEmpty:p.isInputEmpty,strings:q})]}),Y("button",{ref:M,type:"button",tabIndex:-1,className:se.scrollArrow,"data-aia-scroll-arrow":"","aria-label":q.scrollArrow,"aria-hidden":"true",children:Y("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:Y("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as io,ModeController as oo,setCursorOffset as no,uiStringsFor as ro}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as qi}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 {
|
|
2815
2831
|
flex-shrink: 0;
|
|
2816
2832
|
width: 32px;
|
|
2817
2833
|
height: 32px;
|
|
@@ -2864,5 +2880,5 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
|
|
|
2864
2880
|
);
|
|
2865
2881
|
cursor: default;
|
|
2866
2882
|
}
|
|
2867
|
-
`,document.head.appendChild(e)}var Zt={submitButton:"aia-submitButton-otz7H"};import{jsx as kt}from"react/jsx-runtime";function Xt({disabled:e,onClick:n,label:t=qi().submit}){return kt("button",{type:"button","data-aia-submit":"",className:Zt.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),n()},"aria-label":t,children:kt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:kt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as _i,dateSelectionFor as Ui,identifiedParamLabel as Vi,withoutTraditionalAutocomplete as Yi}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ia,useEffect as We,useRef as G,useState as ji}from"react";import{useRef as Jt}from"react";function ea(e){let n=Jt(e);n.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=Jt({key:"",overrides:void 0});if(a.current.key!==t){let i={};for(let r of Object.keys(e??{})){let o=(s,h,b)=>{let x=n.current?.[r];return x?x(s,h,b):[]};i[r]=o}a.current={key:t,overrides:e?i:void 0}}return{overrides:a.current.overrides,key:t}}import{useRef as ta}from"react";function aa(e){let n=ta(e);n.current=e;let t=ta(null);t.current===null&&(t.current={fetch:(i,r)=>{let o=n.current;return o?o.fetch(i,r):Promise.reject(new Error("products config removed"))},transform:i=>n.current?.transform(i)??[],get limit(){return n.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var oa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,timeView:null,multiSelectView:null,multiSelectDraft:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function St({onSubmit:e,onResult:n,onError:t,optionOverrides:a,maskCompletedText:i,apiConfig:r,additionalContext:o,language:s,currency:h,productId:b,visitorId:x,columns:m=2,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:w,showNonTappableOptions:I,showOptionIcons:j,showOptionImages:H,showOptionCounts:K,showSkipButton:U,showProducts:P,productImageFallback:R="image",onFocus:S,onBlur:Q,value:F,completedParams:B,onChange:Z,onParamsChange:ee,products:E,mapProducts:te,onProductSelect:fe,onProductAddToCart:ce,source:Ie,setCursor:be}){let g=G(null),[we,ve]=ji(null),xe=G(e);xe.current=e;let ye=G(n);ye.current=n;let ke=G(t);ke.current=t;let u=G(Z);u.current=Z;let y=G(ee);y.current=ee;let k=G(S);k.current=S;let T=G(Q);T.current=Q;let C=G(be);C.current=be;let L=G(fe);L.current=fe;let X=G(ce);X.current=ce;let V=G(x);V.current=x;let Se=G(()=>{let c=V.current;return typeof c=="function"?c():c}).current,Ee=aa(E),re=G(te);re.current=te;let pe=G((c,N)=>{let A=re.current;return A?A(c,N):c}).current,Ce=te?pe:void 0,p=ea(a);We(()=>{if(typeof document>"u")return;let c=new _i(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:o,language:s,currency:h,productId:b,visitorId:Se,optionOverrides:p.overrides,maskCompletedText:i,columns:m,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:w,showNonTappableOptions:I,showProducts:P,source:Ie,value:F,completedParams:B,onSubmit:(...A)=>xe.current?.(...A),onResult:(...A)=>ye.current?.(...A),onError:(...A)=>ke.current?.(...A),onChange:(...A)=>u.current?.(...A),onParamsChange:(...A)=>y.current?.(...A),onFocus:()=>k.current?.(),onBlur:()=>T.current?.(),onProductSelect:A=>L.current?.(A),onProductAddToCart:A=>X.current?.(A),setCursor:A=>C.current?.(A),products:Ee.config,mapProducts:Ce});g.current=c,ve(c.getState());let N=c.subscribe(A=>ve(A));return()=>{N(),c.destroy(),g.current===c&&(g.current=null)}},[]),We(()=>{F!==void 0&&g.current?.setValue(F)},[F]),We(()=>{B!==void 0&&g.current?.setCompletedParams(B)},[B]);let q=JSON.stringify(r??null),J;try{J=JSON.stringify(o??null)}catch{J="[unstringifiable]"}We(()=>{g.current?.update({apiConfig:r,additionalContext:o,language:s,currency:h,productId:b,optionOverrides:p.overrides,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:w,showNonTappableOptions:I,showProducts:P})},[q,J,s,h?.code,h?.rate,h?.country,b,p.key,l,d,w,I,P]);let ae=G(!1);We(()=>{if(!ae.current){ae.current=!0;return}g.current?.update({products:Ee.config})},[Ee.enabled]),We(()=>{g.current?.update({mapProducts:Ce})},[Ce]);let Ae=G(null);Ae.current===null&&(Ae.current={handleTextChange:c=>g.current?.handleTextChange(c),handleKeyDown:c=>{let N="nativeEvent"in c?c.nativeEvent:c;g.current?.handleKeyDown(N)},setFocused:c=>g.current?.setFocused(c),startEditingParam:c=>g.current?.startEditingParam(c),exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:c=>g.current?.handleCaretAfterInput(c),handleCaretMove:c=>g.current?.handleCaretMove(c),replaceEditingRange:c=>g.current?.replaceEditingRange(c)??!1,setActivePill:c=>g.current?.setActivePill(c),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()??oa,recordSubmit:c=>g.current?.recordSubmit(c),selectOption:c=>g.current?.selectOption(c),selectProduct:c=>g.current?.selectProduct(c),addProductToCart:c=>{let N=g.current;return!N||!X.current?Promise.resolve():N.addProductToCart(c)},setActiveDropdownIndex:c=>g.current?.setActiveDropdownIndex(c),clearHighlight:c=>g.current?.clearHighlight(c),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),setTime:c=>g.current?.setTime(c),commitTime:()=>g.current?.commitTime(),toggleMultiSelectOption:c=>g.current?.toggleMultiSelectOption(c),commitMultiSelect:()=>g.current?.commitMultiSelect(),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let v=Ae.current,Re=ia(c=>{let N=c.target.value,Je=N.length>0&&!c.nativeEvent?.isComposing&&N[0]!==N[0].toUpperCase()?N[0].toUpperCase()+N.slice(1):N;g.current?.handleTextChange(Je)},[]),qe=ia(c=>{g.current?.handleKeyDown(c.nativeEvent)},[]),he=g.current,f=we??oa,Te=F!==void 0?F:f.text,Me=B!==void 0?B:f.completedParams,Pe=f.actionableSuggestions,ze=Pe[0],Ne=Yi(Pe),ue=he?.listboxId??"",_e=f.activeDropdownIndex>=0&&he?`${ue}-option-${f.activeDropdownIndex}`:void 0,ie=f.editingParam,M=f.editingIdentified,Ue=ie?{parameter:ie.suggestionParameter,text:ie.suggestionPlaceholder,required:!0,options:ie.options}:M?{parameter:M.parameter,text:Vi(M.parameter),required:!0,options:[]}:null,Xe=f.dropdownSuggestion??Ue??ze,ct=Ue?[Ue]:Pe,Ve=Ui(f),Oe=!he||f.dropdownLoading;return{completedParams:Me,multiSelectView:f.multiSelectView,toggleMultiSelectOption:v.toggleMultiSelectOption,commitMultiSelect:v.commitMultiSelect,skippedParams:f.skippedParams,identifiedParams:f.identifiedParams,suggestionPills:Ne,setActivePill:v.setActivePill,skipActivePill:v.skipActivePill,removeLastParam:v.removeLastParam,segments:f.segments,newParamId:f.newParamId,clearNewParamId:v.clearNewParamId,suggestions:f.suggestions,activeIndex:f.activeDropdownIndex,isReady:f.isReady,isLoading:Oe,isFocused:f.isFocused,isDropdownOpen:f.isDropdownOpen,isActivePillSelected:f.isActivePillSelected,placeholderText:f.placeholderText,listboxId:ue,error:f.error,products:f.products,customFields:f.customFields,selectProduct:v.selectProduct,addProductToCart:v.addProductToCart,handleTextChange:v.handleTextChange,handleKeyDown:v.handleKeyDown,setFocused:v.setFocused,editingParam:ie,editingIdentified:M,editingAnchor:f.editingAnchor,caretOffset:f.caretOffset,startEditingParam:v.startEditingParam,exitEditMode:v.exitEditMode,handleCaretAfterInput:v.handleCaretAfterInput,handleCaretMove:v.handleCaretMove,replaceEditingRange:v.replaceEditingRange,inputProps:{value:Te,placeholder:f.placeholderText||void 0,onChange:Re,onKeyDown:qe,onFocus:v.handleFocus,onBlur:v.handleBlur,role:"combobox","aria-expanded":f.isDropdownOpen,"aria-activedescendant":_e,"aria-autocomplete":"list","aria-controls":ue},reset:v.reset,refreshProducts:v.refreshProducts,prepareSubmit:v.prepareSubmit,getState:v.getState,recordSubmit:v.recordSubmit,dropdownProps:{suggestions:Xe?[{...Xe,options:f.dropdownOptions}]:[],activeIndex:f.activeDropdownIndex,onSelect:v.selectOption,onHighlight:v.setActiveDropdownIndex,onUnhighlight:v.clearHighlight,isOpen:f.isDropdownOpen,id:ue,pills:ct,activeSelected:f.isActivePillSelected,onPillClick:v.setActivePill,onSkip:v.skipActivePill,showSkipButton:(U??!0)&&!ie&&!M,showOptionIcons:j??!0,showOptionImages:H??!0,showOptionCounts:K??!0,skipDisabled:f.inSelectionAnimation,isLoading:Oe,skeletonExiting:f.skeletonExiting,isInputEmpty:Te.trim().length===0,language:s,products:f.products,productImageFallback:R,onProductSelect:v.selectProduct,onProductAddToCart:ce?v.addProductToCart:void 0,onProductFocusChange:v.setFocused,formatType:f.activeFormatType,dateView:f.dateView,selectedDateIso:Ve.selectedIso,selectedDateRange:Ve.selectedRange,dateRangeStart:Ve.rangeStart,onPreviousMonth:v.showPreviousMonth,onNextMonth:v.showNextMonth,timeView:f.timeView,multiSelectView:f.multiSelectView,onMultiSelectCommit:v.commitMultiSelect,onTimeChange:v.setTime,onTimeCommit:v.commitTime,optionsPosition:d??"below"}}}import{chipIdFromTap as Qi,extractPlainText as na,getCursorOffset as ra,keepCaretOnChip as $i,plainTextLength as Zi,renderEditableContent as Xi,setCursorOffset as sa}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ne,useEffect as lt,useLayoutEffect as Ct,useRef as Ge}from"react";var dt;function Ji(){if(dt!==void 0)return dt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),dt=e.contentEditable==="plaintext-only",dt}function la(e){let{segments:n,showChipIcons:t=!0,showChipImages:a=!0,newParamId:i,editingParam:r,editingIdentified:o,editingAnchor:s,caretOffset:h,placeholderText:b,isFocused:x,isDropdownOpen:m,listboxId:l,activeDescendantId:d,autoFocus:w,handleTextChange:I,handleKeyDown:j,handleCaretAfterInput:H,handleCaretMove:K,startEditingParam:U,replaceEditingRange:P,setFocused:R}=e,S=Ge(null),Q=Ge(!1),F=Ge(""),B=Ge(""),Z=Ge(null),ee=Ge(0);Z.current=h,lt(()=>{if(!w)return;let u=S.current;if(!u)return;document.activeElement===u?R(!0):u.focus();let y=u.ownerDocument??document,k=y.getSelection(),T=k&&k.rangeCount>0&&u.contains(k.anchorNode);if(k&&!T){let C=y.createRange();C.selectNodeContents(u),C.collapse(!0),k.removeAllRanges(),k.addRange(C)}},[w,R]),lt(()=>{let u=S.current;if(!u)return;let y=u.ownerDocument??document,k=()=>{let T=y.getSelection();if(!T||T.rangeCount===0||!T.anchorNode||!u.contains(T.anchorNode))return;let C=T.anchorNode,L=C.nodeType===Node.ELEMENT_NODE?C:C.parentElement,V=(T.isCollapsed?L?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Se=r?.id??o?.id??null;if(V&&V!==Se){U(V);return}performance.now()-ee.current<50||K(ra(u))};return y.addEventListener("selectionchange",k),()=>y.removeEventListener("selectionchange",k)},[r,o,U,K]),lt(()=>{let u=S.current;if(!u)return;let y=k=>{let T=Qi(u,k.target);T&&(U(T),$i(u,T))};return u.addEventListener("click",y),()=>u.removeEventListener("click",y)},[U]),Ct(()=>{let u=S.current;u&&Xi({input:u,segments:n,newParamId:i,editingParamId:r?.id??null,placeholderText:b??"",isFocused:x,showChipIcons:t,showChipImages:a})},[n,i,r,b,x,t,a]),Ct(()=>{let u=F.current,y=i??"";if(F.current=y,!y||y===u)return;let k=S.current;if(!k)return;k.focus();let T=Z.current??Zi(k);sa(k,T)},[i]),Ct(()=>{let u=B.current,y=r?.id??"";if(B.current=y,!y||y===u||s==null)return;let k=S.current;k&&sa(k,s)},[r,s]);let E=ne(()=>{if(Q.current)return;let u=S.current;if(!u)return;let y=na(u),T=y.length>0&&y[0]!==y[0].toUpperCase()?y[0].toUpperCase()+y.slice(1):y;I(T)},[I]),te=ne(()=>{ee.current=performance.now(),E();let u=S.current;u&&H(ra(u))},[E,H]);lt(()=>{let u=S.current;if(!u)return;let y=k=>{let T=k,C=T.inputType;if(C==="insertParagraph"||C==="insertLineBreak"||C==="insertFromDrop"){k.preventDefault();return}if(C.startsWith("insert")||C.startsWith("delete")){let L=C.startsWith("delete")?"":T.data??"";P(L)&&k.preventDefault()}};return u.addEventListener("beforeinput",y),()=>u.removeEventListener("beforeinput",y)},[P]);let fe=ne(()=>{Q.current=!0,S.current?.setAttribute("data-aia-composing","true")},[]),ce=ne(()=>{Q.current=!1,S.current?.removeAttribute("data-aia-composing"),E()},[E]),Ie=ne(u=>{u.preventDefault();let y=S.current;if(!y)return;let k=(u.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!k)return;let T=y.ownerDocument??document,C=T.getSelection();if(!C||C.rangeCount===0)return;let L=C.getRangeAt(0);if(!y.contains(L.startContainer))return;L.deleteContents();let X=T.createTextNode(k);L.insertNode(X),L.setStartAfter(X),L.collapse(!0),C.removeAllRanges(),C.addRange(L),E()},[E]),be=ne(u=>j(u),[j]),g=ne(()=>R(!0),[R]),we=ne(()=>R(!1),[R]),ve=ne(()=>S.current?.focus(),[]),xe=ne(()=>S.current?.blur(),[]),ye=ne(()=>{let u=S.current;return u?na(u):""},[]),ke=Ji()?"plaintext-only":"true";return{inputRef:S,editorProps:{ref:S,contentEditable:ke,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":l,"aria-expanded":m,"aria-activedescendant":d,spellCheck:!0,enterKeyHint:"send",onInput:te,onKeyDown:be,onCompositionStart:fe,onCompositionEnd:ce,onPaste:Ie,onFocus:g,onBlur:we},getPlainText:ye,focus:ve,blur:xe}}import{jsx as Ke,jsxs as Pt}from"react/jsx-runtime";function so(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var lo=eo(function({onSubmit:n,onResult:t,onError:a,optionOverrides:i,maskCompletedText:r,className:o,apiConfig:s,additionalContext:h,language:b,currency:x,productId:m,visitorId:l,columns:d,pillPlacement:w="dropdown",mode:I="auto",optionsPosition:j="below",animations:H=!0,dropdownTrigger:K,closeDropdownOnBlur:U,showNonTappableOptions:P,showOptionIcons:R=!0,showChipIcons:S=!0,showChipImages:Q=!0,showOptionImages:F=!0,showOptionCounts:B=!0,showSkipButton:Z,showProducts:ee,productsLayout:E,productImageFallback:te,autoFocus:fe=!0,onFocus:ce,onBlur:Ie,value:be,completedParams:g,onChange:we,onParamsChange:ve,products:xe,mapProducts:ye,onProductSelect:ke,onProductAddToCart:u,submitButton:y,resetOnSubmit:k=!0},T){let C=Ze(null),L=Ze(null),X=Ze(()=>{}),V=Ze(null),Se=Ze(null);da(()=>{let O=C.current;if(O)return V.current?V.current.setMode(I):V.current=new oo(O,I),()=>{V.current?.destroy(),V.current=null}},[I]);let Ee=Tt(O=>{let $=Se.current?.current;$&&($.focus(),no($,O))},[]),{completedParams:re,suggestionPills:pe,setActivePill:Ce,skipActivePill:p,segments:q,newParamId:J,clearNewParamId:ae,placeholderText:Ae,isFocused:v,isDropdownOpen:Re,isActivePillSelected:qe,isLoading:he,activeIndex:f,listboxId:Te,handleTextChange:Me,handleKeyDown:Pe,setFocused:ze,editingParam:Ne,editingIdentified:ue,editingAnchor:_e,caretOffset:ie,startEditingParam:M,handleCaretAfterInput:Ue,handleCaretMove:Xe,replaceEditingRange:ct,dropdownProps:Ve,reset:Oe,refreshProducts:c,prepareSubmit:N,getState:A,recordSubmit:Je}=St({onSubmit:O=>X.current(O),onResult:t,onError:a,optionOverrides:i,maskCompletedText:r,apiConfig:s,additionalContext:h,language:b,currency:x,productId:m,visitorId:l,columns:d,dropdownTrigger:K,optionsPosition:j,closeDropdownOnBlur:U,showNonTappableOptions:P,showOptionIcons:R,showOptionImages:F,showOptionCounts:B,showSkipButton:Z,showProducts:ee,onFocus:ce,onBlur:Ie,value:be,completedParams:g,onChange:we,onParamsChange:ve,products:xe,mapProducts:ye,onProductSelect:ke,onProductAddToCart:u,source:"full-sdk",setCursor:Ee});da(()=>{if(!J)return;let O=window.setTimeout(()=>ae(),650);return()=>window.clearTimeout(O)},[J,ae]);let ca=f>=0?`${Te}-option-${f}`:void 0,{inputRef:pt,editorProps:pa,focus:et,blur:It,getPlainText:Et}=la({segments:q,newParamId:J,editingParam:Ne,editingIdentified:ue,editingAnchor:_e,caretOffset:ie,placeholderText:Ae,isFocused:v,showChipIcons:S,showChipImages:Q,isDropdownOpen:Re,listboxId:Te,activeDescendantId:ca,autoFocus:fe,handleTextChange:Me,handleKeyDown:Pe,handleCaretAfterInput:Ue,handleCaretMove:Xe,startEditingParam:M,replaceEditingRange:ct,setFocused:ze});Se.current=pt,ao(()=>{let O=L.current,$=pt.current;if(!O||!$)return;let Ye=()=>{let Rt=O.firstElementChild;if(!Rt)return;let ga=Rt.getBoundingClientRect(),fa=$.getBoundingClientRect();ga.top>=fa.bottom-2?O.setAttribute("data-aia-pill-wrapped",""):O.removeAttribute("data-aia-pill-wrapped")};Ye();let At=new ResizeObserver(Ye);return At.observe($),()=>At.disconnect()},[q,pe.length,he,pt]),to(T,()=>({focus:et,blur:It,reset:Oe,refreshProducts:c,setMode:O=>V.current?.setMode(O),skipActivePill:p}),[et,It,Oe,c,p]);let tt=!!q.length||re.length>0,ht=Tt(O=>{if(!tt)return;O&&N();let $=A(),Ye=io(Et(),$.completedParams,$.skippedParams,{identifiedParams:$.identifiedParams,isReady:$.isReady,customFields:$.customFields});O&&Je(Ye),n(Ye),k&&Oe()},[Je,k,tt,N,A,n,Oe,Et]);X.current=()=>ht(!1);let ha=Tt(O=>{O.target?.closest("[data-aia-pill]")||et()},[et]),ua=w==="inline",ma=w==="dropdown";return Pt("div",{ref:C,className:`magicx-aia ${De.container} ${o??""}`,"data-pill-placement":w,"data-options-position":j,"data-animations":H?"on":"off","data-mode":so(I),children:[Ke(yt,{...Ve,showPills:ma,productsLayout:E,productImageFallback:te}),Pt("div",{className:De.inputWrapper,"data-aia-input-wrapper":"",onClick:ha,children:[Pt("div",{className:De.editorArea,"data-aia-editor":"",children:[Ke("div",{...pa,className:De.input,"data-aia-input":""}),ua&&(he||pe.length>0)&&Ke("span",{ref:L,className:De.pillListContainer,"data-aia-pill-list-container":"",children:Ke(it,{pills:pe,activePillIndex:0,activeSelected:qe,onSelectPill:Ce,loading:he})})]}),y===null?null:y===void 0?Ke(Xt,{disabled:!tt,onClick:()=>ht(!0),label:ro(b).submit}):Ke("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:De.submitSlot,onClick:O=>{tt&&(O.stopPropagation(),ht(!0))},children:y})]})]})});export{lo as AIAutocomplete,yt as AIAutocompleteDropdown,ur as DATE_RANGE_META_END,mr as DATE_RANGE_META_START,gr as DEFAULT_OPTION_COUNT_UNIT,Ar as PRODUCT_PATH_PREFIX,Br as TIME_META_KEY,Gr as WEEKDAY_LABELS,cr as buildSubmitResult,pr as cellDay,hr as cellIso,fr as dateCellMarks,br as formatDate,wr as formatDateRange,vr as formatOptionCount,xr as formatTime,yr as isoDate,kr as monthLabel,Sr as optionCountLabel,Cr as optionHasImage,Tr as optionImageSources,Pr as optionImageSrc,Ir as optionLabel,Er as optionsShowLeadingVisuals,Rr as parseDate,Or as parseLooseDate,Dr as parseLooseDateRange,Lr as parseTime,Mr as productFromMatchedItem,zr as productImageSources,Nr as productsFromCustomFields,Hr as sanitizeOptionIconSvg,Fr as selectedRangeFor,St as useAIAutocomplete,Wr as visibleDateRange,Kr as withSkippedParams};
|
|
2883
|
+
`,document.head.appendChild(e)}var Zt={submitButton:"aia-submitButton-otz7H"};import{jsx as kt}from"react/jsx-runtime";function Xt({disabled:e,onClick:n,label:t=qi().submit}){return kt("button",{type:"button","data-aia-submit":"",className:Zt.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),n()},"aria-label":t,children:kt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:kt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as _i,dateSelectionFor as Ui,identifiedParamLabel as Vi,withoutTraditionalAutocomplete as Yi}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ia,useEffect as Ge,useRef as G,useState as ji}from"react";import{useRef as Jt}from"react";function ea(e){let n=Jt(e);n.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=Jt({key:"",overrides:void 0});if(a.current.key!==t){let i={};for(let r of Object.keys(e??{})){let o=(s,h,b)=>{let x=n.current?.[r];return x?x(s,h,b):[]};i[r]=o}a.current={key:t,overrides:e?i:void 0}}return{overrides:a.current.overrides,key:t}}import{useRef as ta}from"react";function aa(e){let n=ta(e);n.current=e;let t=ta(null);t.current===null&&(t.current={fetch:(i,r)=>{let o=n.current;return o?o.fetch(i,r):Promise.reject(new Error("products config removed"))},transform:i=>n.current?.transform(i)??[],get limit(){return n.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var oa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,timeView:null,multiSelectView:null,multiSelectDraft:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Ct({onSubmit:e,onResult:n,onError:t,optionOverrides:a,maskCompletedText:i,apiConfig:r,additionalContext:o,language:s,currency:h,productId:b,visitorId:x,columns:m=2,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:w,showNonTappableOptions:I,showOptionIcons:j,showOptionImages:H,showOptionCounts:K,showSkipButton:U,showProducts:P,productImageFallback:R="image",onFocus:C,onBlur:Q,value:F,completedParams:B,onChange:Z,onParamsChange:ee,products:E,mapProducts:te,onProductSelect:fe,onProductAddToCart:ce,source:Ie,setCursor:be}){let g=G(null),[we,ve]=ji(null),xe=G(e);xe.current=e;let ye=G(n);ye.current=n;let ke=G(t);ke.current=t;let u=G(Z);u.current=Z;let y=G(ee);y.current=ee;let k=G(C);k.current=C;let T=G(Q);T.current=Q;let S=G(be);S.current=be;let M=G(fe);M.current=fe;let X=G(ce);X.current=ce;let V=G(x);V.current=x;let Ce=G(()=>{let c=V.current;return typeof c=="function"?c():c}).current,Ee=aa(E),re=G(te);re.current=te;let pe=G((c,N)=>{let A=re.current;return A?A(c,N):c}).current,Se=te?pe:void 0,p=ea(a);Ge(()=>{if(typeof document>"u")return;let c=new _i(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:o,language:s,currency:h,productId:b,visitorId:Ce,optionOverrides:p.overrides,maskCompletedText:i,columns:m,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:w,showNonTappableOptions:I,showProducts:P,source:Ie,value:F,completedParams:B,onSubmit:(...A)=>xe.current?.(...A),onResult:(...A)=>ye.current?.(...A),onError:(...A)=>ke.current?.(...A),onChange:(...A)=>u.current?.(...A),onParamsChange:(...A)=>y.current?.(...A),onFocus:()=>k.current?.(),onBlur:()=>T.current?.(),onProductSelect:A=>M.current?.(A),onProductAddToCart:A=>X.current?.(A),setCursor:A=>S.current?.(A),products:Ee.config,mapProducts:Se});g.current=c,ve(c.getState());let N=c.subscribe(A=>ve(A));return()=>{N(),c.destroy(),g.current===c&&(g.current=null)}},[]),Ge(()=>{F!==void 0&&g.current?.setValue(F)},[F]),Ge(()=>{B!==void 0&&g.current?.setCompletedParams(B)},[B]);let q=JSON.stringify(r??null),J;try{J=JSON.stringify(o??null)}catch{J="[unstringifiable]"}Ge(()=>{g.current?.update({apiConfig:r,additionalContext:o,language:s,currency:h,productId:b,optionOverrides:p.overrides,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:w,showNonTappableOptions:I,showProducts:P})},[q,J,s,h?.code,h?.rate,h?.country,b,p.key,l,d,w,I,P]);let ae=G(!1);Ge(()=>{if(!ae.current){ae.current=!0;return}g.current?.update({products:Ee.config})},[Ee.enabled]),Ge(()=>{g.current?.update({mapProducts:Se})},[Se]);let Ae=G(null);Ae.current===null&&(Ae.current={handleTextChange:c=>g.current?.handleTextChange(c),handleKeyDown:c=>{let N="nativeEvent"in c?c.nativeEvent:c;g.current?.handleKeyDown(N)},setFocused:c=>g.current?.setFocused(c),startEditingParam:c=>g.current?.startEditingParam(c),exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:c=>g.current?.handleCaretAfterInput(c),handleCaretMove:c=>g.current?.handleCaretMove(c),replaceEditingRange:c=>g.current?.replaceEditingRange(c)??!1,setActivePill:c=>g.current?.setActivePill(c),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()??oa,recordSubmit:c=>g.current?.recordSubmit(c),selectOption:c=>g.current?.selectOption(c),selectProduct:c=>g.current?.selectProduct(c),addProductToCart:c=>{let N=g.current;return!N||!X.current?Promise.resolve():N.addProductToCart(c)},setActiveDropdownIndex:c=>g.current?.setActiveDropdownIndex(c),clearHighlight:c=>g.current?.clearHighlight(c),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),setTime:c=>g.current?.setTime(c),commitTime:()=>g.current?.commitTime(),toggleMultiSelectOption:c=>g.current?.toggleMultiSelectOption(c),commitMultiSelect:()=>g.current?.commitMultiSelect(),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let v=Ae.current,Re=ia(c=>{let N=c.target.value,Je=N.length>0&&!c.nativeEvent?.isComposing&&N[0]!==N[0].toUpperCase()?N[0].toUpperCase()+N.slice(1):N;g.current?.handleTextChange(Je)},[]),_e=ia(c=>{g.current?.handleKeyDown(c.nativeEvent)},[]),he=g.current,f=we??oa,Te=F!==void 0?F:f.text,Me=B!==void 0?B:f.completedParams,Pe=f.actionableSuggestions,ze=Pe[0],Ne=Yi(Pe),ue=he?.listboxId??"",Ue=f.activeDropdownIndex>=0&&he?`${ue}-option-${f.activeDropdownIndex}`:void 0,ie=f.editingParam,z=f.editingIdentified,Ve=ie?{parameter:ie.suggestionParameter,text:ie.suggestionPlaceholder,required:!0,options:ie.options}:z?{parameter:z.parameter,text:Vi(z.parameter),required:!0,options:[]}:null,Xe=f.dropdownSuggestion??Ve??ze,ct=Ve?[Ve]:Pe,Ye=Ui(f),Oe=!he||f.dropdownLoading;return{completedParams:Me,multiSelectView:f.multiSelectView,toggleMultiSelectOption:v.toggleMultiSelectOption,commitMultiSelect:v.commitMultiSelect,skippedParams:f.skippedParams,identifiedParams:f.identifiedParams,suggestionPills:Ne,setActivePill:v.setActivePill,skipActivePill:v.skipActivePill,removeLastParam:v.removeLastParam,segments:f.segments,newParamId:f.newParamId,clearNewParamId:v.clearNewParamId,suggestions:f.suggestions,activeIndex:f.activeDropdownIndex,isReady:f.isReady,isLoading:Oe,isFocused:f.isFocused,isDropdownOpen:f.isDropdownOpen,isActivePillSelected:f.isActivePillSelected,placeholderText:f.placeholderText,listboxId:ue,error:f.error,products:f.products,customFields:f.customFields,selectProduct:v.selectProduct,addProductToCart:v.addProductToCart,handleTextChange:v.handleTextChange,handleKeyDown:v.handleKeyDown,setFocused:v.setFocused,editingParam:ie,editingIdentified:z,editingAnchor:f.editingAnchor,caretOffset:f.caretOffset,startEditingParam:v.startEditingParam,exitEditMode:v.exitEditMode,handleCaretAfterInput:v.handleCaretAfterInput,handleCaretMove:v.handleCaretMove,replaceEditingRange:v.replaceEditingRange,inputProps:{value:Te,placeholder:f.placeholderText||void 0,onChange:Re,onKeyDown:_e,onFocus:v.handleFocus,onBlur:v.handleBlur,role:"combobox","aria-expanded":f.isDropdownOpen,"aria-activedescendant":Ue,"aria-autocomplete":"list","aria-controls":ue},reset:v.reset,refreshProducts:v.refreshProducts,prepareSubmit:v.prepareSubmit,getState:v.getState,recordSubmit:v.recordSubmit,dropdownProps:{suggestions:Xe?[{...Xe,options:f.dropdownOptions}]:[],activeIndex:f.activeDropdownIndex,onSelect:v.selectOption,onHighlight:v.setActiveDropdownIndex,onUnhighlight:v.clearHighlight,isOpen:f.isDropdownOpen,id:ue,pills:ct,activeSelected:f.isActivePillSelected,onPillClick:v.setActivePill,onSkip:v.skipActivePill,showSkipButton:(U??!0)&&!ie&&!z,showOptionIcons:j??!0,showOptionImages:H??!0,showOptionCounts:K??!0,skipDisabled:f.inSelectionAnimation,isLoading:Oe,skeletonExiting:f.skeletonExiting,isInputEmpty:Te.trim().length===0,language:s,products:f.products,productImageFallback:R,onProductSelect:v.selectProduct,onProductAddToCart:ce?v.addProductToCart:void 0,onProductFocusChange:v.setFocused,formatType:f.activeFormatType,dateView:f.dateView,selectedDateIso:Ye.selectedIso,selectedDateRange:Ye.selectedRange,dateRangeStart:Ye.rangeStart,onPreviousMonth:v.showPreviousMonth,onNextMonth:v.showNextMonth,timeView:f.timeView,multiSelectView:f.multiSelectView,onMultiSelectCommit:v.commitMultiSelect,onTimeChange:v.setTime,onTimeCommit:v.commitTime,optionsPosition:d??"below"}}}import{chipIdFromTap as Qi,extractPlainText as na,getCursorOffset as ra,keepCaretOnChip as $i,plainTextLength as Zi,renderEditableContent as Xi,setCursorOffset as sa}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ne,useEffect as lt,useLayoutEffect as St,useRef as Ke}from"react";var dt;function Ji(){if(dt!==void 0)return dt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),dt=e.contentEditable==="plaintext-only",dt}function la(e){let{segments:n,showChipIcons:t=!0,showChipImages:a=!0,newParamId:i,editingParam:r,editingIdentified:o,editingAnchor:s,caretOffset:h,placeholderText:b,isFocused:x,isDropdownOpen:m,listboxId:l,activeDescendantId:d,autoFocus:w,handleTextChange:I,handleKeyDown:j,handleCaretAfterInput:H,handleCaretMove:K,startEditingParam:U,replaceEditingRange:P,setFocused:R}=e,C=Ke(null),Q=Ke(!1),F=Ke(""),B=Ke(""),Z=Ke(null),ee=Ke(0);Z.current=h,lt(()=>{if(!w)return;let u=C.current;if(!u)return;document.activeElement===u?R(!0):u.focus();let y=u.ownerDocument??document,k=y.getSelection(),T=k&&k.rangeCount>0&&u.contains(k.anchorNode);if(k&&!T){let S=y.createRange();S.selectNodeContents(u),S.collapse(!0),k.removeAllRanges(),k.addRange(S)}},[w,R]),lt(()=>{let u=C.current;if(!u)return;let y=u.ownerDocument??document,k=()=>{let T=y.getSelection();if(!T||T.rangeCount===0||!T.anchorNode||!u.contains(T.anchorNode))return;let S=T.anchorNode,M=S.nodeType===Node.ELEMENT_NODE?S:S.parentElement,V=(T.isCollapsed?M?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ce=r?.id??o?.id??null;if(V&&V!==Ce){U(V);return}performance.now()-ee.current<50||K(ra(u))};return y.addEventListener("selectionchange",k),()=>y.removeEventListener("selectionchange",k)},[r,o,U,K]),lt(()=>{let u=C.current;if(!u)return;let y=k=>{let T=Qi(u,k.target);T&&(U(T),$i(u,T))};return u.addEventListener("click",y),()=>u.removeEventListener("click",y)},[U]),St(()=>{let u=C.current;u&&Xi({input:u,segments:n,newParamId:i,editingParamId:r?.id??null,placeholderText:b??"",isFocused:x,showChipIcons:t,showChipImages:a})},[n,i,r,b,x,t,a]),St(()=>{let u=F.current,y=i??"";if(F.current=y,!y||y===u)return;let k=C.current;if(!k)return;k.focus();let T=Z.current??Zi(k);sa(k,T)},[i]),St(()=>{let u=B.current,y=r?.id??"";if(B.current=y,!y||y===u||s==null)return;let k=C.current;k&&sa(k,s)},[r,s]);let E=ne(()=>{if(Q.current)return;let u=C.current;if(!u)return;let y=na(u),T=y.length>0&&y[0]!==y[0].toUpperCase()?y[0].toUpperCase()+y.slice(1):y;I(T)},[I]),te=ne(()=>{ee.current=performance.now(),E();let u=C.current;u&&H(ra(u))},[E,H]);lt(()=>{let u=C.current;if(!u)return;let y=k=>{let T=k,S=T.inputType;if(S==="insertParagraph"||S==="insertLineBreak"||S==="insertFromDrop"){k.preventDefault();return}if(S.startsWith("insert")||S.startsWith("delete")){let M=S.startsWith("delete")?"":T.data??"";P(M)&&k.preventDefault()}};return u.addEventListener("beforeinput",y),()=>u.removeEventListener("beforeinput",y)},[P]);let fe=ne(()=>{Q.current=!0,C.current?.setAttribute("data-aia-composing","true")},[]),ce=ne(()=>{Q.current=!1,C.current?.removeAttribute("data-aia-composing"),E()},[E]),Ie=ne(u=>{u.preventDefault();let y=C.current;if(!y)return;let k=(u.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!k)return;let T=y.ownerDocument??document,S=T.getSelection();if(!S||S.rangeCount===0)return;let M=S.getRangeAt(0);if(!y.contains(M.startContainer))return;M.deleteContents();let X=T.createTextNode(k);M.insertNode(X),M.setStartAfter(X),M.collapse(!0),S.removeAllRanges(),S.addRange(M),E()},[E]),be=ne(u=>j(u),[j]),g=ne(()=>R(!0),[R]),we=ne(()=>R(!1),[R]),ve=ne(()=>C.current?.focus(),[]),xe=ne(()=>C.current?.blur(),[]),ye=ne(()=>{let u=C.current;return u?na(u):""},[]),ke=Ji()?"plaintext-only":"true";return{inputRef:C,editorProps:{ref:C,contentEditable:ke,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":l,"aria-expanded":m,"aria-activedescendant":d,spellCheck:!0,enterKeyHint:"send",onInput:te,onKeyDown:be,onCompositionStart:fe,onCompositionEnd:ce,onPaste:Ie,onFocus:g,onBlur:we},getPlainText:ye,focus:ve,blur:xe}}import{jsx as qe,jsxs as Pt}from"react/jsx-runtime";function so(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var lo=eo(function({onSubmit:n,onResult:t,onError:a,optionOverrides:i,maskCompletedText:r,className:o,apiConfig:s,additionalContext:h,language:b,currency:x,productId:m,visitorId:l,columns:d,pillPlacement:w="dropdown",mode:I="auto",optionsPosition:j="below",animations:H=!0,dropdownTrigger:K,closeDropdownOnBlur:U,showNonTappableOptions:P,showOptionIcons:R=!0,showChipIcons:C=!0,showChipImages:Q=!0,showOptionImages:F=!0,showOptionCounts:B=!0,showSkipButton:Z,showProducts:ee,productsLayout:E,productImageFallback:te,autoFocus:fe=!0,onFocus:ce,onBlur:Ie,value:be,completedParams:g,onChange:we,onParamsChange:ve,products:xe,mapProducts:ye,onProductSelect:ke,onProductAddToCart:u,submitButton:y,resetOnSubmit:k=!0},T){let S=Ze(null),M=Ze(null),X=Ze(()=>{}),V=Ze(null),Ce=Ze(null);da(()=>{let O=S.current;if(O)return V.current?V.current.setMode(I):V.current=new oo(O,I),()=>{V.current?.destroy(),V.current=null}},[I]);let Ee=Tt(O=>{let $=Ce.current?.current;$&&($.focus(),no($,O))},[]),{completedParams:re,suggestionPills:pe,setActivePill:Se,skipActivePill:p,segments:q,newParamId:J,clearNewParamId:ae,placeholderText:Ae,isFocused:v,isDropdownOpen:Re,isActivePillSelected:_e,isLoading:he,activeIndex:f,listboxId:Te,handleTextChange:Me,handleKeyDown:Pe,setFocused:ze,editingParam:Ne,editingIdentified:ue,editingAnchor:Ue,caretOffset:ie,startEditingParam:z,handleCaretAfterInput:Ve,handleCaretMove:Xe,replaceEditingRange:ct,dropdownProps:Ye,reset:Oe,refreshProducts:c,prepareSubmit:N,getState:A,recordSubmit:Je}=Ct({onSubmit:O=>X.current(O),onResult:t,onError:a,optionOverrides:i,maskCompletedText:r,apiConfig:s,additionalContext:h,language:b,currency:x,productId:m,visitorId:l,columns:d,dropdownTrigger:K,optionsPosition:j,closeDropdownOnBlur:U,showNonTappableOptions:P,showOptionIcons:R,showOptionImages:F,showOptionCounts:B,showSkipButton:Z,showProducts:ee,onFocus:ce,onBlur:Ie,value:be,completedParams:g,onChange:we,onParamsChange:ve,products:xe,mapProducts:ye,onProductSelect:ke,onProductAddToCart:u,source:"full-sdk",setCursor:Ee});da(()=>{if(!J)return;let O=window.setTimeout(()=>ae(),650);return()=>window.clearTimeout(O)},[J,ae]);let ca=f>=0?`${Te}-option-${f}`:void 0,{inputRef:pt,editorProps:pa,focus:et,blur:It,getPlainText:Et}=la({segments:q,newParamId:J,editingParam:Ne,editingIdentified:ue,editingAnchor:Ue,caretOffset:ie,placeholderText:Ae,isFocused:v,showChipIcons:C,showChipImages:Q,isDropdownOpen:Re,listboxId:Te,activeDescendantId:ca,autoFocus:fe,handleTextChange:Me,handleKeyDown:Pe,handleCaretAfterInput:Ve,handleCaretMove:Xe,startEditingParam:z,replaceEditingRange:ct,setFocused:ze});Ce.current=pt,ao(()=>{let O=M.current,$=pt.current;if(!O||!$)return;let je=()=>{let Rt=O.firstElementChild;if(!Rt)return;let ga=Rt.getBoundingClientRect(),fa=$.getBoundingClientRect();ga.top>=fa.bottom-2?O.setAttribute("data-aia-pill-wrapped",""):O.removeAttribute("data-aia-pill-wrapped")};je();let At=new ResizeObserver(je);return At.observe($),()=>At.disconnect()},[q,pe.length,he,pt]),to(T,()=>({focus:et,blur:It,reset:Oe,refreshProducts:c,setMode:O=>V.current?.setMode(O),skipActivePill:p}),[et,It,Oe,c,p]);let tt=!!q.length||re.length>0,ht=Tt(O=>{if(!tt)return;O&&N();let $=A(),je=io(Et(),$.completedParams,$.skippedParams,{identifiedParams:$.identifiedParams,isReady:$.isReady,customFields:$.customFields});O&&Je(je),n(je),k&&Oe()},[Je,k,tt,N,A,n,Oe,Et]);X.current=()=>ht(!1);let ha=Tt(O=>{O.target?.closest("[data-aia-pill]")||et()},[et]),ua=w==="inline",ma=w==="dropdown";return Pt("div",{ref:S,className:`magicx-aia ${De.container} ${o??""}`,"data-pill-placement":w,"data-options-position":j,"data-animations":H?"on":"off","data-mode":so(I),children:[qe(yt,{...Ye,showPills:ma,productsLayout:E,productImageFallback:te}),Pt("div",{className:De.inputWrapper,"data-aia-input-wrapper":"",onClick:ha,children:[Pt("div",{className:De.editorArea,"data-aia-editor":"",children:[qe("div",{...pa,className:De.input,"data-aia-input":""}),ua&&(he||pe.length>0)&&qe("span",{ref:M,className:De.pillListContainer,"data-aia-pill-list-container":"",children:qe(it,{pills:pe,activePillIndex:0,activeSelected:_e,onSelectPill:Se,loading:he})})]}),y===null?null:y===void 0?qe(Xt,{disabled:!tt,onClick:()=>ht(!0),label:ro(b).submit}):qe("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:De.submitSlot,onClick:O=>{tt&&(O.stopPropagation(),ht(!0))},children:y})]})]})});export{lo as AIAutocomplete,yt as AIAutocompleteDropdown,ur as DATE_RANGE_META_END,mr as DATE_RANGE_META_START,gr as DEFAULT_OPTION_COUNT_UNIT,Ar as PRODUCT_PATH_PREFIX,Br as TIME_META_KEY,Gr as WEEKDAY_LABELS,cr as buildSubmitResult,pr as cellDay,hr as cellIso,fr as dateCellMarks,br as formatDate,wr as formatDateRange,vr as formatOptionCount,xr as formatTime,yr as isoDate,kr as monthLabel,Cr as optionCountLabel,Sr as optionHasImage,Tr as optionImageSources,Pr as optionImageSrc,Ir as optionLabel,Er as optionsShowLeadingVisuals,Rr as parseDate,Or as parseLooseDate,Dr as parseLooseDateRange,Lr as parseTime,Mr as productFromMatchedItem,zr as productImageSources,Nr as productsFromCustomFields,Hr as sanitizeOptionIconSvg,Fr as selectedRangeFor,Ct as useAIAutocomplete,Wr as visibleDateRange,Kr as withSkippedParams};
|
|
2868
2884
|
//# sourceMappingURL=index.mjs.map
|