@magicx-eng/ai-autocomplete-react 0.66.2 → 0.66.3
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/dist/index.js +81 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -42
- 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 Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END as Ks,DATE_RANGE_META_START as qs,DEFAULT_OPTION_COUNT_UNIT as _s,dateCellMarks as Vs,focusesInputOnSelect as Us,formatDate as Qs,formatDateRange as Ys,formatOptionCount as js,formatPlace as $s,formatTime as Zs,isoDate as Xs,isTouchPrimary as Js,LOCATION_META_KEY as el,monthLabel as tl,optionCountLabel as al,optionHasImage as il,optionImageSources as ol,optionImageSrc as nl,optionLabel as rl,optionsShowLeadingVisuals as sl,PRODUCT_PATH_PREFIX as ll,parseDate as dl,parseLooseDate as cl,parseLooseDateRange as pl,parseTime as hl,productFromMatchedItem as ul,productImageSources as ml,productsFromCustomFields as gl,sanitizeOptionIconSvg as fl,selectedRangeFor as bl,TIME_META_KEY as wl,visibleDateRange as vl,WEEKDAY_LABELS as xl,withSkippedParams as yl}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Sn,useCallback as Dt,useEffect as Xt,useImperativeHandle as Cn,useLayoutEffect as Tn,useRef as ft}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
|
|
@@ -439,7 +439,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
439
439
|
transition: none;
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
|
-
`,document.head.appendChild(e)}var Je={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
|
|
442
|
+
`,document.head.appendChild(e)}var Je={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 Po,attachViewportFit as Io,containScroll as Ao,dateFloorFor as Eo,destroyPanelMorph as Ro,findMultiSelectDone as zo,fitMultiSelectDone as Lo,hasSkippablePill as Oo,isCalendarFormat as Do,labelTraditionalAutocomplete as Mo,panelMorphKey as No,queryLive as Fo,settlePanelMorph as Ho,syncPanelHug as Bo,uiStringsFor as Wo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as tt,useLayoutEffect as Qt,useRef as mt,useState as Go}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
443
443
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
444
444
|
* Consumer CSS always wins without !important.
|
|
445
445
|
*
|
|
@@ -1164,13 +1164,15 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
1164
1164
|
);
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
-
/* While the panel glides
|
|
1168
|
-
the width it lands at
|
|
1169
|
-
|
|
1170
|
-
|
|
1167
|
+
/* While the panel glides to a new width (panelMorph.ts), its new content is
|
|
1168
|
+
laid out at the width it lands at, so it never rewraps under the glide:
|
|
1169
|
+
wider, the panel, which clips, reveals it as it opens; narrower, it starts
|
|
1170
|
+
at its final width instead of squeezing frame by frame. The leaving copy
|
|
1171
|
+
keeps its own width. */
|
|
1171
1172
|
[data-aia-dropdown][data-aia-glide-width]
|
|
1172
1173
|
> :not(.magicx-aia-panel-ghost):not([data-aia-scroll-arrow]) {
|
|
1173
1174
|
min-width: var(--aia-glide-content-width, auto);
|
|
1175
|
+
max-width: var(--aia-glide-content-width, none);
|
|
1174
1176
|
}
|
|
1175
1177
|
/* The All row's tile shows the first options' pictures together: two side by
|
|
1176
1178
|
side, three as a tall half and two quarters, four in a 2x2 grid. Each is
|
|
@@ -1811,7 +1813,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
1811
1813
|
opacity: 1;
|
|
1812
1814
|
}
|
|
1813
1815
|
}
|
|
1814
|
-
`,document.head.appendChild(e)}var
|
|
1816
|
+
`,document.head.appendChild(e)}var he={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",seeAllSpin:"aia-seeAllSpin-jlsZP",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as ni,cellIso as yt,dateCellMarks as ri,isDimmedDay as si,isoDate as li,monthLabel as di,visibleDateRange as ci,WEEKDAY_LABELS as pi}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as hi}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) ---
|
|
1815
1817
|
|
|
1816
1818
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1817
1819
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -2008,7 +2010,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
2008
2010
|
opacity: 0.8;
|
|
2009
2011
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
2010
2012
|
}
|
|
2011
|
-
`,document.head.appendChild(e)}var
|
|
2013
|
+
`,document.head.appendChild(e)}var q={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 Pe,jsxs as pa}from"react/jsx-runtime";var ui=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ha({options:e,activeIndex:r,listboxId:t,view:o,selection:n,onSelect:d,onHighlight:s,onUnhighlight:c,onPreviousMonth:f,onNextMonth:x}){let y=li(new Date),m=ci({pendingStart:n.rangeStart,highlightedIso:yt(e[r]),selected:n.selectedRange,floor:n.floor});return pa("div",{className:q.datepicker,"data-aia-datepicker":"",children:[pa("div",{className:q.header,children:[Pe("button",{type:"button",tabIndex:-1,className:q.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:f,children:"\u2039"}),Pe("span",{className:q.month,"data-aia-date-month":"","aria-live":"polite",children:di(o)}),Pe("button",{type:"button",tabIndex:-1,className:q.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:x,children:"\u203A"})]}),Pe("div",{className:q.weekdays,"aria-hidden":"true",children:pi.map((p,h)=>Pe("span",{className:q.weekday,children:p},ui[h]))}),Pe("div",{className:q.grid,"data-aia-date-grid":"",children:e.map((p,h)=>Pe(mi,{option:p,id:`${t}-option-${h}`,index:h,isHighlighted:h===r&&p.is_tappable,isToday:yt(p)===y,isPast:si(yt(p),y,n.floor),marks:ri(yt(p),{selectedIso:n.selectedIso,range:m,references:n.references}),onSelect:d,onHighlight:s,onUnhighlight:c},yt(p)??`pad-${h}`))})]})}function mi({option:e,id:r,index:t,isHighlighted:o,isToday:n,isPast:d,marks:s,onSelect:c,onHighlight:f,onUnhighlight:x}){let[y,m]=hi(!1),p=ni(e);if(p==null)return Pe("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${q.cell} ${q.blank}`});let h=()=>{m(!0),c(e),setTimeout(()=>m(!1),170)},k=[q.cell,q.day,d?q.past:"",o?q.highlighted:"",n?q.today:"",s.inRange?q.inRange:"",s.selected?q.selected:"",s.reference?q.reference:"",y?q.pressed:""].filter(Boolean).join(" ");return Pe("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":o,"aria-label":e.text,tabIndex:0,className:k,onClick:h,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),h())},onMouseEnter:()=>f(t),onMouseLeave:x?()=>x(t):void 0,children:Pe("span",{className:q.number,children:p})})}import{ATTRIBUTION_URL as gi,buildAttributionUrl as fi,getFooterHint as bi,uiStringsFor as wi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as vi,useState as xi}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 {
|
|
2012
2014
|
display: flex;
|
|
2013
2015
|
flex-wrap: wrap;
|
|
2014
2016
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -2048,7 +2050,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
2048
2050
|
.aia-cluster[data-justify="around"] {
|
|
2049
2051
|
justify-content: space-around;
|
|
2050
2052
|
}
|
|
2051
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
2053
|
+
`,document.head.appendChild(e)}import{jsx as ua}from"react/jsx-runtime";function kt({gap:e,align:r="center",justify:t="start",noWrap:o=!1,inline:n=!1,className:d,children:s,...c}){let f=e?{"--aia-cluster-gap":e}:void 0,x={className:d?`aia-cluster ${d}`:"aia-cluster","data-align":r,"data-justify":t,"data-nowrap":o||void 0,"data-inline":n||void 0,style:f,...c};return n?ua("span",{...x,children:s}):ua("div",{...x,children:s})}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
|
|
2052
2054
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
2053
2055
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
2054
2056
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -2196,7 +2198,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
2196
2198
|
justify-content: flex-end;
|
|
2197
2199
|
}
|
|
2198
2200
|
}
|
|
2199
|
-
`,document.head.appendChild(e)}var
|
|
2201
|
+
`,document.head.appendChild(e)}var Ne={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 ht,jsxs as ma}from"react/jsx-runtime";function ga({isOptionHighlighted:e=!1,isInputEmpty:r=!1,strings:t=wi()}){let{key:o,hint:n}=bi(e,r,t),[d,s]=xi(gi);return vi(()=>{s(fi())},[]),ht("footer",{className:Ne.footer,"data-aia-footer":"",children:ma(kt,{justify:"between",noWrap:!0,className:Ne.row,children:[ma(kt,{gap:"5px",className:Ne.hintGroup,children:[ht("kbd",{className:Ne.key,children:o}),ht("span",{className:Ne.hint,children:n})]}),ht("a",{className:Ne.brandLink,href:d,target:"_blank",rel:"noopener noreferrer",children:ht("span",{className:Ne.badge,children:ht("span",{className:Ne.brand,children:"Powered by Intent-1"})})})]})})}import{useEffect as fa,useLayoutEffect as yi,useRef as ue}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
|
|
2200
2202
|
Angular copy). The three are kept identical by
|
|
2201
2203
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
2202
2204
|
.aia-location-6-fsr {
|
|
@@ -2330,7 +2332,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
2330
2332
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2331
2333
|
width: 60%;
|
|
2332
2334
|
}
|
|
2333
|
-
`,document.head.appendChild(e)}var
|
|
2335
|
+
`,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 ne,jsxs as Ge}from"react/jsx-runtime";var ki=0;function St(e){return e.getRootNode().activeElement??null}function va(e){return e.getRootNode().getSelection?.()??document.getSelection()}function ba(e){if(!e.isContentEditable)return null;let r=va(e);if(!r||r.rangeCount===0)return null;let t=r.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function wa(e,r){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=va(e);if(!t)return;let o=r;(!o||!o.startContainer.isConnected||!e.contains(o.startContainer))&&(o=document.createRange(),o.selectNodeContents(e),o.collapse(!1)),t.removeAllRanges(),t.addRange(o)}var Si=Ge("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[ne("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),ne("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Ci=Ge("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[ne("circle",{cx:"11",cy:"11",r:"7"}),ne("path",{d:"m20 20-3.5-3.5"})]});function xa({view:e,searchLabel:r,noResultsLabel:t,useTypedLabel:o,widgetFocused:n,reediting:d=!1,visible:s=!0,interactive:c=!0,onQuery:f,onMove:x,onCommit:y,onFocusChange:m}){let p=ue(null),h=ue(null),k=ue(null),S=ue(null),T=ue(null),O=ue(!1),L=ue(!1),Y=ue(!1),N=ue(!1),A=ue(n);A.current=n;let D=ue(m);D.current=m;let F=a=>{N.current=a,m(a)},W=()=>{let a=p.current;return a!=null&&St(a)===a},re=()=>{let a=h.current;if(!a)return;let v=St(a);v instanceof HTMLElement&&v!==p.current&&v!==document.body&&!a.contains(v)&&(S.current=v,T.current=ba(v))},G=a=>{let v=h.current;!v||!(a instanceof HTMLElement)||a===S.current||a===document.body||v.contains(a)||(S.current=a,T.current=ba(a))},P=ue(null);P.current===null&&(P.current=`aia-location-${++ki}`);let j=`${P.current}-row-`;fa(()=>{let a=p.current;a&&a.value!==e.query&&St(a)!==a&&(a.value=e.query)},[e.query]),fa(()=>{n&&(d&&!Y.current&&(L.current=!1),Y.current=d);let a=p.current;if(a){if(!s&&W()){L.current=!0,K();return}if(!n){setTimeout(()=>{if(A.current)return;let v=S.current;v&&St(v)===v||(L.current=!1)},0);return}if(!(!d||L.current||!c||W())){if(re(),F(!0),a.focus({preventScroll:!0}),!W()){L.current=!0,F(!1);return}a.value&&a.select()}}}),yi(()=>()=>{if(!N.current)return;let a=p.current,v=S.current;v?.isConnected&&a&&St(a)===a&&(O.current=!0,wa(v,T.current),O.current=!1),N.current=!1,D.current(!1)},[]);let K=(a=!1)=>{a&&(L.current=!0);let v=S.current;v?.isConnected&&W()&&(O.current=!0,wa(v,T.current),O.current=!1),F(!1)},se=e.query.trim(),le=e.highlighted>=0&&e.highlighted<e.places.length?`${j}${e.highlighted}`:void 0,ee=null;return e.places.length>0?ee=e.places.map((a,v)=>Ge("div",{id:`${j}${v}`,role:"option","aria-selected":v===e.highlighted,className:v===e.highlighted?`${U.row} ${U.highlighted}`:U.row,"data-aia-location-row":"","data-aia-index":v,onClick:()=>{c&&(K(!0),y(v))},children:[ne("span",{className:U.pin,children:Si}),Ge("span",{className:U.text,children:[ne("span",{className:U.name,children:a.name}),a.secondary&&ne("span",{className:U.secondary,children:a.secondary})]})]},a.id)):e.status==="loading"?ee=Ge("div",{className:U.loading,"data-aia-location-loading":"",children:[ne("span",{className:U.loadingBar}),ne("span",{className:U.loadingBar}),ne("span",{className:U.loadingBar})]}):se&&(ee=Ge("div",{className:U.note,"data-aia-location-note":"",children:[e.status==="done"&&ne("span",{className:U.empty,children:t}),ne("span",{children:o})]})),Ge("div",{ref:h,className:U.location,"data-aia-location":"",onMouseDown:a=>{!(a.target instanceof Node)||!k.current?.contains(a.target)||(a.stopPropagation(),re(),F(!0))},children:[Ge("label",{ref:k,className:U.field,children:[Ci,ne("input",{ref:p,type:"text",className:U.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:r,"aria-label":r,"aria-activedescendant":le,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:s?0:-1,onChange:a=>f(a.target.value),onFocus:a=>{G(a.relatedTarget),F(!0)},onBlur:()=>{O.current||(L.current=!0,F(!1))},onKeyDown:a=>{if(!a.nativeEvent.isComposing)switch(a.key){case"ArrowDown":case"ArrowUp":a.preventDefault(),x(a.key==="ArrowDown"?1:-1);return;case"Enter":if(a.preventDefault(),!c)return;K(!0),y();return;case"Escape":a.preventDefault(),a.stopPropagation(),L.current=!0,K();return;case"Backspace":if(a.currentTarget.value!=="")return;a.preventDefault(),L.current=!0,K();return}}})]}),ne("div",{className:U.results,"data-aia-location-results":"","aria-live":"polite",children:ee})]})}import{isSmartSuggestion as Ai,isTraditionalAutocompleteSuggestion as Ei}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Ti}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,
|
|
2334
2336
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2335
2337
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2336
2338
|
as it was when the outline was dashed. */
|
|
@@ -2488,7 +2490,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
2488
2490
|
opacity: 0;
|
|
2489
2491
|
}
|
|
2490
2492
|
}
|
|
2491
|
-
`,document.head.appendChild(e)}var
|
|
2493
|
+
`,document.head.appendChild(e)}var Ie={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 Pi,jsx as Ht,jsxs as Ii}from"react/jsx-runtime";var Bt={selected:1,first:.7,next:.4,last:.2};function ya({label:e,state:r,active:t,rounded:o,loading:n,smartSuggestion:d,completionHeader:s,onClick:c}){let f=[Ie.pill,o?Ie.rounded:"",n?Ie.skeleton:""].filter(Boolean).join(" ");return Ht("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":n?"":void 0,"data-aia-smart-suggestion":d?s?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:f,style:{"--aia-pill-opacity":Bt[r]},onMouseDown:x=>x.preventDefault(),onClick:n?void 0:c,disabled:n,children:d?Ii(Pi,{children:[Ht("span",{className:`${Ie.smartText} magicx-aia-smart-suggestion-text`,children:e}),Ht("span",{className:`${Ie.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Ti}})]}):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 {
|
|
2492
2494
|
position: relative;
|
|
2493
2495
|
z-index: 1;
|
|
2494
2496
|
pointer-events: auto;
|
|
@@ -2498,7 +2500,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
2498
2500
|
align-items: center;
|
|
2499
2501
|
vertical-align: middle;
|
|
2500
2502
|
}
|
|
2501
|
-
`,document.head.appendChild(e)}var Wt={list:"aia-list-qvLqO"};import{jsx as At}from"react/jsx-runtime";var
|
|
2503
|
+
`,document.head.appendChild(e)}var Wt={list:"aia-list-qvLqO"};import{jsx as At}from"react/jsx-runtime";var Ri=[125,69];function ka(e){return e===0?"first":e===1?"next":"last"}function Et({pills:e,activePillIndex:r,onSelectPill:t,activeSelected:o,rounded:n,loading:d}){return d&&e.length===0?At("span",{className:Wt.list,"data-aia-pill-list-loading":"",children:Ri.map((s,c)=>At("span",{"data-aia-pill-skeleton":"",className:`${Ie.pill} ${n?Ie.rounded:""} ${Ie.skeleton}`,style:{width:s,"--aia-pill-opacity":Bt[ka(c)]}},`skel-${s}`))}):At("span",{className:Wt.list,"data-aia-pill-list-loading":d?"":void 0,children:e.map((s,c)=>{let f=!!o&&c===r;return At(ya,{label:s.text,state:f?"selected":ka(c),selected:f,active:c===r,rounded:n,loading:d,smartSuggestion:Ai(s),completionHeader:Ei(s),onClick:()=>t(c)},`${s.parameter}-${s.text}`)})})}import{attachProductRowWheel as zi,productImageSources as Li,productImageSrc as Oi,productInitial as Di,productPhotoFill as Mi,uiStringsFor as Ni}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Gt,useRef as Rt,useState as zt}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
|
|
2502
2504
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2503
2505
|
theming one package sees the same result in the other.
|
|
2504
2506
|
|
|
@@ -3125,7 +3127,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
3125
3127
|
opacity: 0.01;
|
|
3126
3128
|
}
|
|
3127
3129
|
}
|
|
3128
|
-
`,document.head.appendChild(e)}var
|
|
3130
|
+
`,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 J,jsxs as ut}from"react/jsx-runtime";function Sa({products:e,listboxId:r,onSelect:t,busyProductId:o=null,onAddToCart:n,onFocusChange:d,focusable:s=!0,loading:c=!1,layout:f="row",imageFallback:x="image",showVendor:y=!0,strings:m=Ni()}){let p=e.length>0,h=Rt(null);if(Gt(()=>{let S=h.current;if(!(!p||!S))return zi(S)},[p]),!p)return null;let k=`${r}-products-label`;return ut("section",{className:Q.section,"data-aia-products":"","data-aia-loading":c?"":void 0,"data-aia-products-layout":f,role:"group","aria-labelledby":k,children:[J("div",{className:Q.label,id:k,"data-aia-products-label":"",children:m.products}),J("div",{ref:h,className:Q.row,"data-aia-products-row":"",children:e.map((S,T)=>J(Fi,{product:S,id:`${r}-product-${T}`,onSelect:t,busy:S.id===o,onAddToCart:n,onFocusChange:d,focusable:s,imageFallback:x,showVendor:y,soldOut:m.soldOut,addToCart:m.addToCart},S.id))})]})}function Fi({product:e,id:r,onSelect:t,busy:o,onAddToCart:n,onFocusChange:d,focusable:s,imageFallback:c,showVendor:f,soldOut:x,addToCart:y}){let m=!!n&&e.available!==!1,[p,h]=zt(null),k=T=>{T.relatedTarget?.closest("[data-aia-dropdown]")||d?.(!1)},S=T=>{T.metaKey||T.ctrlKey||T.shiftKey||T.altKey||T.button!==0||(T.preventDefault(),t(e))};return ut("a",{id:r,className:Q.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":m?"":void 0,"data-aia-product-state":o?"busy":void 0,"aria-busy":o?!0:void 0,role:"option","aria-selected":!1,style:p?{"--aia-product-photo-fill-x":String(p.x),"--aia-product-photo-fill-y":String(p.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:S,onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),t(e))},onFocus:()=>d?.(!0),onBlur:k,children:[J(Wi,{sources:Li(e.imageUrl),title:e.title,fallback:c,onPhotoFill:h},Oi(e.imageUrl)??""),ut("span",{className:Q.body,children:[f&&e.vendor?J("span",{className:Q.vendor,children:e.vendor}):null,J("span",{className:Q.title,children:e.title}),e.price?ut("span",{className:Q.price,children:[e.price,e.compareAtPrice?J("s",{className:Q.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?J("span",{className:Q.badge,children:x}):null]}),m&&n?J(Bi,{product:e,label:`${y}: ${e.title}`,focusable:s,onAddToCart:n,onFocus:()=>d?.(!0),onBlur:k},Hi(e)):null]})}function Hi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(r=>r??"").join("\0")}function Bi({product:e,label:r,focusable:t,onAddToCart:o,onFocus:n,onBlur:d}){let[s,c]=zt(null),f=Rt(null),x=Rt(e);x.current=e;let y=Rt(!0);Gt(()=>(y.current=!0,()=>{y.current=!1}),[]);let m=h=>{f.current=h,y.current&&c(h)},p=h=>{if(h.preventDefault(),h.stopPropagation(),f.current==="adding")return;m("adding");let k;try{k=Promise.resolve(o(x.current))}catch(S){k=Promise.reject(S)}k.then(()=>m("added"),()=>m(null))};return J("span",{className:Q.cart,"data-aia-product-cart":"","data-aia-cart-state":s??void 0,"aria-busy":s==="adding"?!0:void 0,role:"button","aria-label":r,tabIndex:t?0:-1,onClick:p,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||p(h)},onFocus:h=>{h.stopPropagation(),n()},onBlur:h=>{h.stopPropagation(),d(h)},children:ut("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[J("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"}),J("path",{className:Q.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),J("path",{className:Q.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),J("path",{className:Q.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),J("circle",{className:Q.cartGlyph,cx:"9",cy:"20",r:"1.3"}),J("circle",{className:Q.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Wi({sources:e,title:r,fallback:t,onPhotoFill:o}){let[n,d]=zt(0),s=e[n],c=!!s,[f,x]=zt(null),y=!c&&t==="initial";return Gt(()=>()=>o(null),[o]),ut("span",{className:Q.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!c&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":c&&f===s?"":void 0,children:[c?J("img",{className:Q.image,src:s,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{x(s),o(Mi(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{n+1>=e.length&&o(null),d(m=>m+1)}}):null,y?Di(r):null]})}import{isOptionsGridMobileViewport as ao,measureOptionsGrid as io,needsOptionsGridMeasurement as oo,OPTIONS_GRID_MOBILE_QUERY as no,optionEnterDelayMs as ro,optionsShowLeadingVisuals as so,planOptionsGrid as Aa,pointerMayHighlight as Ea,releasePanelHug as lo,sameOptionRows as co,syncHighlightScroll as po,syncPanelHug as ho}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as uo,useLayoutEffect as _t,useRef as Ra,useState as La}from"react";import{optionsGridTemplateColumns as Gi}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Ki,useRef as qi}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 {
|
|
3129
3131
|
display: grid;
|
|
3130
3132
|
grid-template-columns: repeat(
|
|
3131
3133
|
auto-fit,
|
|
@@ -3169,7 +3171,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
3169
3171
|
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
3170
3172
|
max-height: var(--aia-grid-max-height, 120px);
|
|
3171
3173
|
}
|
|
3172
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
3174
|
+
`,document.head.appendChild(e)}import{jsx as _i}from"react/jsx-runtime";function Ca({min:e="16rem",max:r,gap:t,scroll:o=!1,maxHeight:n,scrollResetKey:d,cols:s,template:c,innerRef:f,className:x,children:y,...m}){let p=qi(null);Ki(()=>{if(d===void 0)return;let k=p.current;k&&(k.scrollTop=0)},[d]);let h={"--aia-grid-min":e};return r&&(h["--aia-grid-max"]=r),t&&(h["--aia-grid-gap"]=t),n&&(h["--aia-grid-max-height"]=n),s&&(h.gridTemplateColumns=Gi(s)),c&&(h.gridTemplateColumns=c),_i("div",{ref:k=>{p.current=k,f?.(k)},className:x?`aia-grid ${x}`:"aia-grid","data-scroll":o||void 0,style:h,...m,children:y})}import{clearPanelMorphPressLook as Vi,formatOptionCount as Ui,highlightParts as Qi,isMultiSelectToggleTap as Yi,OPTION_ENTER_DELAY_VAR as ji,optionImageSources as Ta,optionLabel as Pa,sanitizeOptionIconSvg as $i}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Zi,useMemo as Xi,useRef as Kt,useState as Ct}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 {
|
|
3173
3175
|
position: relative;
|
|
3174
3176
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
3175
3177
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3287,31 +3289,22 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
3287
3289
|
opacity: 0.5;
|
|
3288
3290
|
}
|
|
3289
3291
|
|
|
3290
|
-
/* Press feedback: the picked option
|
|
3291
|
-
|
|
3292
|
+
/* Press feedback: the picked option fills with the option background (the
|
|
3293
|
+
row's own background transition) while every other option steps back in
|
|
3294
|
+
opacity. No scale: a row that shrinks and springs back reads as a jolt,
|
|
3295
|
+
and the next question then arrives on top of it. The press stays on until
|
|
3296
|
+
the options leave, so the picked row never flashes back to normal first. */
|
|
3292
3297
|
.aia-pressed-98o-r {
|
|
3293
3298
|
color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
|
|
3294
|
-
|
|
3299
|
+
background: var(--aia-option-bg, transparent);
|
|
3300
|
+
font-weight: 500;
|
|
3295
3301
|
}
|
|
3296
3302
|
|
|
3297
3303
|
[role="listbox"]:has(.aia-pressed-98o-r) .aia-item-d4vpD:not(.aia-pressed-98o-r) {
|
|
3298
3304
|
opacity: 0.35;
|
|
3299
|
-
transition:
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
@keyframes aia-pressCompress-ICV3q {
|
|
3303
|
-
0% {
|
|
3304
|
-
transform: scale(1);
|
|
3305
|
-
}
|
|
3306
|
-
25% {
|
|
3307
|
-
transform: scale(0.93);
|
|
3308
|
-
}
|
|
3309
|
-
60% {
|
|
3310
|
-
transform: scale(0.93);
|
|
3311
|
-
}
|
|
3312
|
-
100% {
|
|
3313
|
-
transform: scale(1);
|
|
3314
|
-
}
|
|
3305
|
+
transition:
|
|
3306
|
+
background-color 180ms ease,
|
|
3307
|
+
opacity 120ms ease;
|
|
3315
3308
|
}
|
|
3316
3309
|
|
|
3317
3310
|
/* Scroll hint \u2014 the last visible row of a scrollable web grid fades toward its
|
|
@@ -3600,8 +3593,8 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
3600
3593
|
display: inline-flex;
|
|
3601
3594
|
align-items: center;
|
|
3602
3595
|
justify-content: center;
|
|
3603
|
-
/*
|
|
3604
|
-
|
|
3596
|
+
/* An indent inherited from the row (an icon row hangs its text with one)
|
|
3597
|
+
would slide the mark out of the box. */
|
|
3605
3598
|
text-indent: 0;
|
|
3606
3599
|
flex: 0 0 18px;
|
|
3607
3600
|
width: 18px;
|
|
@@ -3610,14 +3603,61 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
3610
3603
|
border-radius: 6px;
|
|
3611
3604
|
background: var(--aia-surface);
|
|
3612
3605
|
color: transparent;
|
|
3613
|
-
font-size: 11px;
|
|
3614
3606
|
line-height: 1;
|
|
3607
|
+
/* A tick animates the box alone: the row stays put (no press, no dimming),
|
|
3608
|
+
since a multi-select tap keeps the list open for the next tick. */
|
|
3609
|
+
transition:
|
|
3610
|
+
background-color 140ms ease,
|
|
3611
|
+
border-color 140ms ease,
|
|
3612
|
+
color 140ms ease;
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
/* The tick is drawn, not typed: a rounded stroke with a short left leg and a
|
|
3616
|
+
long right one, shaped like Apple's SF Symbols "checkmark". The text "\u2713"
|
|
3617
|
+
it replaces changes with the font and reads thin and cheap. It is painted
|
|
3618
|
+
in the box's text colour, so it fades in with the fill. */
|
|
3619
|
+
.aia-checkbox-KGRhg::after {
|
|
3620
|
+
content: "";
|
|
3621
|
+
width: 14px;
|
|
3622
|
+
height: 14px;
|
|
3623
|
+
background: currentColor;
|
|
3624
|
+
-webkit-mask:
|
|
3625
|
+
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.2 12.6l4.6 4.6 9-10.6' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
|
|
3626
|
+
center / contain no-repeat;
|
|
3627
|
+
mask:
|
|
3628
|
+
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.2 12.6l4.6 4.6 9-10.6' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
|
|
3629
|
+
center / contain no-repeat;
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3632
|
+
/* Forced colours replace backgrounds with Canvas, which would hide a tick
|
|
3633
|
+
painted as a background; draw it in the forced text colour instead. */
|
|
3634
|
+
@media (forced-colors: active) {
|
|
3635
|
+
.aia-checkbox-KGRhg[data-checked="true"]::after {
|
|
3636
|
+
forced-color-adjust: none;
|
|
3637
|
+
background: CanvasText;
|
|
3638
|
+
}
|
|
3615
3639
|
}
|
|
3616
3640
|
|
|
3617
3641
|
.aia-checkbox-KGRhg[data-checked="true"] {
|
|
3618
3642
|
background: var(--aia-confirm-bg, #262626);
|
|
3619
3643
|
border-color: var(--aia-confirm-bg, #262626);
|
|
3620
3644
|
color: var(--aia-confirm-color, #ffffff);
|
|
3645
|
+
animation: aia-checkPop-CCWRW 160ms ease-out;
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
@keyframes aia-checkPop-CCWRW {
|
|
3649
|
+
0% {
|
|
3650
|
+
transform: scale(0.82);
|
|
3651
|
+
}
|
|
3652
|
+
100% {
|
|
3653
|
+
transform: scale(1);
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
|
|
3657
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3658
|
+
.aia-checkbox-KGRhg[data-checked="true"] {
|
|
3659
|
+
animation: none;
|
|
3660
|
+
}
|
|
3621
3661
|
}
|
|
3622
3662
|
|
|
3623
3663
|
.aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
|
|
@@ -3693,9 +3733,8 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
3693
3733
|
width: 18px;
|
|
3694
3734
|
height: 18px;
|
|
3695
3735
|
border-radius: 6px;
|
|
3696
|
-
font-size: 11px;
|
|
3697
3736
|
}
|
|
3698
|
-
`,document.head.appendChild(e)}var
|
|
3737
|
+
`,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",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",checkPop:"aia-checkPop-CCWRW"};import{Fragment as to,jsx as ve,jsxs as qt}from"react/jsx-runtime";var Ji=2e3,eo=170;function Ia({option:e,isHighlighted:r,checked:t,onSelect:o,onHighlight:n,onUnhighlight:d,id:s,loading:c,showIcon:f=!0,showImage:x=!0,showCount:y=!0,scrollHint:m,enterDelayMs:p=0}){let[h]=Ct(p),[k,S]=Ct(!1),T=x?Ta(e.image_url):[],O=T[0]??null,[L,Y]=Ct([]),N=T.find(a=>!L.includes(a))??null,A=x?(e.imageCollage??[]).map(a=>Ta(a)[0]).filter(a=>a!==void 0):[],[D,F]=Ct(!1),[W,re]=Ct(null),G=Xi(()=>!O&&f&&e.icon_svg?$i(e.icon_svg):null,[O,f,e.icon_svg]),P=y?Ui(e.item_count):null,j=Kt(void 0),K=Kt(null),se=Kt(Number.NEGATIVE_INFINITY);Zi(()=>()=>clearTimeout(j.current),[]);let le=a=>{if(c||!e.is_tappable)return;let v=a?.currentTarget,te=t!==void 0&&v!==void 0&&a!==void 0&&!Yi(v,v.querySelector("[data-aia-checkbox]"),a),me=t!==void 0&&!te;if(!me){let oe=performance.now();if(oe-se.current<eo)return;se.current=oe}te?o(e,{commit:!0}):o(e),!me&&(S(!0),clearTimeout(j.current),j.current=setTimeout(()=>{S(!1),Vi(K.current?.closest("[data-aia-dropdown]"))},Ji))},ee=[$.item,r&&!c?$.highlighted:"",e.liveMatch&&!c?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,k?$.pressed:"",m?$.scrollHint:""].filter(Boolean).join(" ");return ve("div",{ref:K,id:s,role:"option","data-aia-option":"","data-aia-loading":c?"":void 0,"data-aia-icon":G&&e.icon?e.icon:void 0,"data-aia-image":O?"":void 0,"data-aia-item-count":P!==null?e.item_count:void 0,"aria-selected":t??r,className:ee,style:{[ji]:`${h}ms`},tabIndex:c||!e.is_tappable?-1:0,onClick:le,onKeyDown:a=>{!c&&e.is_tappable&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),le())},onMouseEnter:!c&&e.is_tappable?n:void 0,onMouseLeave:d,children:qt("span",{className:$.content,children:[t!==void 0&&e.is_tappable&&ve("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t}),O&&A.length>1&&ve("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":A.length,"data-aia-image-loaded":D?"":void 0,children:A.map(a=>ve("img",{src:a,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>F(!0),onError:v=>{v.currentTarget.hidden=!0}},a))}),O&&A.length<=1&&ve("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":N!==null&&W===N?"":void 0,children:ve("img",{src:N??O,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:N===null,onLoad:()=>re(N),onError:()=>{N!==null&&Y(a=>[...a,N])}})}),G&&ve("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:G}}),qt("span",{className:$.text,children:[e.matchedText?Qi(Pa(e),e.matchedText).map((a,v)=>a.bold?ve("strong",{className:`${$.match} magicx-aia-option-match`,"data-aia-match-partial":a.partial?"":void 0,children:a.text},v):a.text):Pa(e),e.parameterLabel&&qt(to,{children:[" ",ve("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ve("span",{className:$.tag,children:e.tag}),P!==null&&ve("span",{className:`${$.count} magicx-aia-option-count`,children:P})]})})}import{jsx as za}from"react/jsx-runtime";function mo(){let[e,r]=La(ao);return uo(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(no),o=()=>r(t.matches);return o(),t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[]),e}function Oa({options:e,activeIndex:r,picked:t,onSelect:o,onHighlight:n,onUnhighlight:d,listboxId:s,loading:c,groupKey:f="",optionsPosition:x="below",showIcons:y=!0,showImages:m=!0,showCounts:p=!0}){let h=mo(),k=Ra(null),[S,T]=La(null),O=Ra(null);_t(()=>{if(c&&co(O.current,e))return;O.current=c?null:e;let A=k.current,D=A&&!c&&oo(e.length,h),F=A?.closest("[data-aia-dropdown]");D&&F&&lo(F);let W=D?io(A):null;T(W?Aa(e.length,h,W.rowWidths,W.gridWidth):null)},[e,h,c]);let L=S??Aa(e.length,h,null,null);_t(()=>{let A=k.current?.closest("[data-aia-dropdown]");A&&ho(A)},[L.template,h]);let Y=c?-1:r;_t(()=>{k.current&&po(k.current,Y)},[Y]);let N=so(e,y,m);return za(Ca,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:f,template:L.template,maxHeight:L.maxHeight,innerRef:A=>{k.current=A},"data-aia-group":f,children:e.map((A,D)=>za(Ia,{option:A,isHighlighted:D===r,checked:t?t.includes(A.text):void 0,onSelect:o,onHighlight:F=>{Ea(k.current,D,F)&&n(D)},onUnhighlight:d?F=>{Ea(k.current,-1,F)&&d(D)}:void 0,id:`${s}-option-${D}`,loading:c,showIcon:y&&N,showImage:m&&N,showCount:p,scrollHint:!c&&L.scrollHintIndices.includes(D),enterDelayMs:c?0:ro(D,L.cols,e.length,x)},`${f}\0${A.parameter??""}\0${A.text}`))})}import{formatTime as go,TIME_WHEEL_COLUMNS as fo,TIME_WHEEL_ROW_HEIGHT as bo,timeWheelIndex as Da,timeWheelIndexFromScroll as wo,timeWheelRows as vo,withTimeWheelIndex as Ma}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as xo,useEffect as yo,useLayoutEffect as ko,useRef as Lt}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) ---
|
|
3699
3738
|
|
|
3700
3739
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3701
3740
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3817,7 +3856,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
3817
3856
|
.aia-done-llNY5:hover {
|
|
3818
3857
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3819
3858
|
}
|
|
3820
|
-
`,document.head.appendChild(e)}var
|
|
3859
|
+
`,document.head.appendChild(e)}var xe={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 et,jsxs as Vt}from"react/jsx-runtime";var So=120;function Na({view:e,label:r,doneLabel:t,interactive:o=!0,onTimeChange:n,onTimeCommit:d}){return Vt("div",{className:xe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":r,onMouseDown:s=>s.preventDefault(),children:[et("span",{className:xe.value,"data-aia-time-value":"","aria-live":"polite",children:go(e.minutes)}),Vt("div",{className:xe.columns,"aria-hidden":"true",children:[et("div",{className:xe.band}),fo.map(s=>Vt(xo,{children:[s==="minute"&&et("span",{className:xe.separator,children:":"}),et(Co,{column:s,minutes:e.minutes,interactive:o,onTimeChange:n})]},s))]}),et("button",{type:"button",tabIndex:-1,className:xe.done,"data-aia-time-done":"",onClick:()=>{o&&d()},children:t})]})}function Co({column:e,minutes:r,interactive:t,onTimeChange:o}){let n=Lt(null),d=Lt(null),s=Lt(null),c=Lt({minutes:r,interactive:t,onTimeChange:o});c.current={minutes:r,interactive:t,onTimeChange:o};let f=Da(e,r);ko(()=>{let m=n.current;if(!m||s.current)return;let p=f*bo;Math.abs(m.scrollTop-p)<1||(d.current=p,m.scrollTop=p)},[f]),yo(()=>()=>{s.current&&clearTimeout(s.current)},[]);let x=()=>{s.current=null;let m=n.current,p=c.current;if(!m||!p.interactive)return;let h=wo(e,m.scrollTop);h!==Da(e,p.minutes)&&p.onTimeChange(Ma(e,p.minutes,h))},y=()=>{let m=n.current;if(m){if(d.current!=null&&Math.abs(m.scrollTop-d.current)<1){d.current=null;return}d.current=null,s.current&&clearTimeout(s.current),s.current=setTimeout(x,So)}};return et("div",{ref:n,className:xe.column,"data-aia-time-column":e,onScroll:y,children:vo(e).map((m,p)=>et("div",{className:p===f?`${xe.row} ${xe.selected}`:xe.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{c.current.interactive&&o(Ma(e,c.current.minutes,p))},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 {
|
|
3821
3860
|
display: flex;
|
|
3822
3861
|
flex-direction: column;
|
|
3823
3862
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3832,7 +3871,7 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
3832
3871
|
align-items: end;
|
|
3833
3872
|
}
|
|
3834
3873
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3835
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
3874
|
+
`,document.head.appendChild(e)}import{jsx as To}from"react/jsx-runtime";function Fa({space:e,align:r="stretch",className:t,children:o,...n}){let d=e?{"--aia-stack-space":e}:void 0;return To("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":r,style:d,...n,children:o})}import{jsx as Z,jsxs as Ut}from"react/jsx-runtime";var Ko=typeof window>"u"?tt:Qt,qo=[159,119,164],_o=()=>{},Ha=()=>{},Vo=e=>{},Uo=()=>{},Qo=e=>{},Yo=e=>{},jo=e=>{},$o=e=>{};function Zo(e){let r=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,o]=Go(r);if(tt(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),d=()=>o(n.matches);return n.addEventListener("change",d),()=>n.removeEventListener("change",d)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Xo(e,r){let t=mt(null);tt(()=>{let o=e.current,n=r.current;if(!o||!n)return;let d=Fo(o,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==d&&(t.current.controller.destroy(),t.current=null),d&&!t.current){t.current={grid:d,controller:Po({dropdown:o,grid:d,button:n})};return}t.current?.controller.update()}),tt(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Jo(e,r){let t=mt(r);t.current=r;let o=mt(null);Qt(()=>{let n=e.current;if(n){if(!o.current){o.current=Io({dropdown:n,isOpen:()=>t.current});return}o.current.update()}}),tt(()=>()=>{o.current?.destroy(),o.current=null},[])}function Yt({suggestions:e,activeIndex:r,onSelect:t,onHighlight:o,onUnhighlight:n,isOpen:d,id:s,className:c,pills:f,onPillClick:x,showPills:y=!0,onSkip:m,showSkipButton:p=!0,showOptionIcons:h=!0,showOptionImages:k=!0,showOptionCounts:S=!0,skipDisabled:T=!1,activeSelected:O=!1,isLoading:L=!1,skeletonExiting:Y=!1,isInputEmpty:N=!1,language:A,products:D,onProductSelect:F,onProductAddToCart:W,onProductFocusChange:re,productsLayout:G="row",productImageFallback:P="image",showProductVendor:j=!0,formatType:K="options",dateView:se=null,selectedDateIso:le=null,selectedDateRange:ee=null,dateRangeStart:a=null,dateReferences:v,onPreviousMonth:te,onNextMonth:me,timeView:oe=null,multiSelectView:qe=null,onMultiSelectCommit:Ae,onSeeAllResults:Ee,seeAllBusy:ge=!1,busyProductId:_e=null,fullWidth:Fe=!1,onTimeChange:u,onTimeCommit:Ve,locationView:g=null,isReediting:C=!1,onLocationQuery:E,onLocationMove:R,onLocationCommit:M,onLocationFocusChange:X,isFocused:ke=!1,optionsPosition:ae="below",mode:Se}){let Re=Zo(Se),Ue=Re!==void 0,ie=mt(null),ze=mt(null);Xo(ie,ze),tt(()=>{if(ie.current)return Ao(ie.current)},[]);let fe=e[0]?.options??[],Qe=!!(f&&f.length>0&&x),ce=!!(D&&D.length>0),He=K==="time"&&oe!=null,it=K==="location"&&g!=null,de=d&&(fe.length>0||y&&Qe||L||ce||He||it);Jo(ie,de),Ko(()=>{let I=ie.current;I&&(Lo(I,zo(I)),Bo(I))});let pe={suggestions:e,activeIndex:r,pills:f,showPills:y,showSkipButton:p,showOptionIcons:h,showOptionImages:k,showOptionCounts:S,skipDisabled:T,activeSelected:O,isLoading:L,skeletonExiting:Y,isInputEmpty:N,products:D,formatType:K,dateView:se,selectedDateIso:le,selectedDateRange:ee,dateRangeStart:a,dateReferences:v,timeView:oe,multiSelectView:qe,locationView:g,isReediting:C,showsSeeAll:!!Ee},Be=mt(pe);de&&(Be.current=pe);let i=de?pe:Be.current,B=Wo(A),be=i.suggestions[0],Ce=be?.options??[],Ye=i.activeIndex>=0&&!!Ce[i.activeIndex]?.is_tappable,Te=Mo(i.pills??[],B.keepTyping),Le=!!(Te.length>0&&x),w=i.showPills&&Le,je=i.showPills&&!Le&&i.isLoading,ot=w||je,Oe=Le&&Oo(Te)&&i.showSkipButton&&!i.isInputEmpty&&!!m,b=Te[0]?.text,$e=Do(i.formatType)&&i.dateView!=null,nt=Ce.length>0&&!$e,De=Ce.length>0&&$e&&!i.isLoading,rt=i.formatType==="time"&&i.timeView!=null&&!i.isLoading,st=i.formatType==="location"&&i.locationView!=null&&!i.isLoading,We=i.isLoading&&!nt&&!De&&!rt&&!st,lt=i.products??[],Me=No(w?Te:[]);return Qt(()=>{ie.current&&Ho(ie.current,Me,{visible:de,anchorBottom:ae==="above"})},[Me,de,ae,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,G,A]),tt(()=>{let I=ie.current;return()=>{I&&Ro(I)}},[]),Ut("div",{ref:ie,id:s,role:"listbox","aria-multiselectable":!!i.multiSelectView,"data-aia-dropdown":"","data-options-position":ae,"data-mode":Re,"data-aia-loading":i.isLoading?"":void 0,"data-aia-skeleton-exiting":i.skeletonExiting?"":void 0,"data-aia-has-products":lt.length>0?"":void 0,"data-aia-full-width":Fe?"":void 0,className:`${Ue?"magicx-aia ":""}${he.dropdown} ${de?he.visible:""} ${c??""}`,onMouseDown:I=>I.preventDefault(),children:[Ut(Fa,{space:"8px",children:[(ot||Oe)&&Ut(kt,{noWrap:!0,className:he.pillBar,"data-aia-pillbar":"",children:[ot&&Z("span",{className:he.pillScroll,"data-aia-pill-scroll":"",children:Z(Et,{pills:Te,activePillIndex:0,activeSelected:i.activeSelected,onSelectPill:x??(()=>{}),rounded:!0,loading:i.isLoading})}),Oe&&Z("button",{type:"button",tabIndex:-1,className:he.skip,"data-aia-skip":"",disabled:i.isLoading||i.skipDisabled,"aria-label":b?`${B.skipLabel} ${b}`:B.skipLabel,onClick:m,children:B.skip})]}),nt&&Z(Oa,{options:Ce,activeIndex:i.activeIndex,onSelect:t,onHighlight:o,onUnhighlight:n,listboxId:s,loading:i.isLoading,groupKey:be?`${be.parameter} ${be.text}`:"",optionsPosition:ae,showIcons:i.showOptionIcons,showImages:i.showOptionImages,showCounts:i.showOptionCounts,picked:i.multiSelectView?.picked}),i.multiSelectView&&Z("div",{"data-aia-multi-actions":"",onClick:I=>{I.target.closest("[data-aia-multi-done]")&&!i.skipDisabled&&!i.isLoading&&Ae?.()},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:he.multiDone,ref:I=>{I&&(I.disabled=!0,I.offsetHeight,I.disabled=i.skipDisabled||i.isLoading)},children:B.done})}),De&&i.dateView&&Z(ha,{options:Ce,activeIndex:i.activeIndex,listboxId:s,view:i.dateView,selection:{selectedIso:i.selectedDateIso??null,selectedRange:i.selectedDateRange??null,rangeStart:i.dateRangeStart??null,floor:Eo(i.formatType,i.dateRangeStart),references:i.dateReferences??[]},onSelect:t,onHighlight:o,onUnhighlight:n,onPreviousMonth:te??Ha,onNextMonth:me??Ha}),rt&&i.timeView&&Z(Na,{view:i.timeView,label:B.timeLabel,doneLabel:B.done,interactive:!i.skipDisabled,onTimeChange:u??Vo,onTimeCommit:Ve??Uo}),st&&i.locationView&&Z(xa,{view:i.locationView,searchLabel:B.locationSearch,noResultsLabel:B.locationNoResults,useTypedLabel:B.locationUseTyped,widgetFocused:ke&&de,reediting:i.isReediting,visible:de,interactive:!i.skipDisabled,onQuery:E??Qo,onMove:R??Yo,onCommit:M??jo,onFocusChange:X??$o}),We&&Z("div",{className:he.skeletonBars,"data-aia-skeleton-bars":"",children:qo.map(I=>Z("span",{className:he.skeletonBar,style:{width:I}},`bar-${I}`))}),Z(Sa,{products:lt,listboxId:s,onSelect:F??_o,busyProductId:_e,onAddToCart:W,onFocusChange:re,focusable:de&&!i.isLoading,loading:i.isLoading,layout:G,imageFallback:P,showVendor:j,strings:B}),i.showsSeeAll&&Z("div",{className:he.seeAllRow,"data-aia-see-all":"",onClick:I=>{I.target.closest("[data-aia-see-all-button]")&&(I.stopPropagation(),!(i.isLoading||ge)&&Ee?.())},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":ge?"busy":void 0,"aria-busy":ge?!0:void 0,className:he.seeAll,ref:I=>{I&&(I.disabled=!0,I.offsetHeight,I.disabled=i.isLoading)},children:B.seeAllResults})}),Z(ga,{isOptionHighlighted:Ye,isInputEmpty:i.isInputEmpty,strings:B})]}),Z("button",{ref:ze,type:"button",tabIndex:-1,className:he.scrollArrow,"data-aia-scroll-arrow":"","aria-label":B.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 Pn,focusEditorFromTap as In,ModeController as An,setCursorOffset as En,uiStringsFor as Rn,watchEditorHeight as zn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as en}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 {
|
|
3836
3875
|
flex-shrink: 0;
|
|
3837
3876
|
width: 32px;
|
|
3838
3877
|
height: 32px;
|
|
@@ -3936,5 +3975,5 @@ import{buildSubmitResult as Ns,cellDay as Fs,cellIso as Hs,DATE_RANGE_META_END a
|
|
|
3936
3975
|
transition: none;
|
|
3937
3976
|
}
|
|
3938
3977
|
}
|
|
3939
|
-
`,document.head.appendChild(e)}var Ha={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};import{jsx as Yt}from"react/jsx-runtime";function Ba({disabled:e,ready:n,busy:t=!1,onClick:i,label:o=Zo().submit}){return Yt("button",{type:"button","data-aia-submit":"",className:Ha.submitButton,disabled:e,"data-aia-ready":n?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:l=>{l.stopPropagation(),i()},"aria-label":o,children:Yt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":o,children:Yt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Xo,dateSelectionFor as Jo,dropdownPillsFor as en,editingSuggestion as tn,HANDOFF_NOT_HANDLED as an,identifiedParamLabel as on,withoutTraditionalAutocomplete as nn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as _a,useEffect as Ke,useMemo as rn,useRef as U,useState as sn}from"react";import{useRef as Wa}from"react";function Ga(e){let n=Wa(e);n.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=Wa({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let l of Object.keys(e??{})){let r=(d,f,v)=>{let x=n.current?.[l];return x?x(d,f,v):[]};o[l]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}import{useRef as Ka}from"react";function qa(e){let n=Ka(e);n.current=e;let t=Ka(null);t.current===null&&(t.current={fetch:(o,l)=>{let r=n.current;return r?r.fetch(o,l):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var ln={query:"",raw_query:"",completed_params:[],identified_params:[],is_ready:!1},Va={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,highlightByPointer:!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,isSubmitting:!1,selectingProductId:null,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 jt({onSubmit:e,onResult:n,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:l,additionalContext:r,language:d,currency:f,productId:v,visitorId:x,analyticsConsent:m,columns:p=2,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:D,prependPlaceholder:O,allOption:$,showNonTappableOptions:F,locationSearch:E,showOptionIcons:M,showOptionImages:H,showOptionCounts:K,showSkipButton:ne,showProducts:q,submitProgress:P,awaitAnswerOnSubmit:Z,submitAnswerTimeoutMs:_,productImageFallback:se="image",showProductVendor:A=!0,onFocus:G,onBlur:c,value:k,completedParams:le,onChange:Ne,onParamsChange:ue,products:qe,mapProducts:Ie,onProductSelect:Ae,onProductAddToCart:me,source:_e,setCursor:Fe}){let u=U(null),[Ve,g]=sn(null),C=U(e);C.current=e;let R=U(n);R.current=n;let z=U(t);z.current=t;let N=U(Ne);N.current=Ne;let ee=U(ue);ee.current=ue;let ye=U(G);ye.current=G;let ae=U(c);ae.current=c;let ke=U(Fe);ke.current=Fe;let Ee=U(Ae);Ee.current=Ae;let Ue=U(me);Ue.current=me;let ie=U(x);ie.current=x;let Re=U(()=>{let s=ie.current;return typeof s=="function"?s():s}).current,ge=x!==void 0,Qe=U(m);Qe.current=m;let de=U(()=>{let s=Qe.current;return typeof s=="function"?s():s}).current,He=qa(qe),it=U(Ie);it.current=Ie;let re=U((s,Q)=>{let B=it.current;return B?B(s,Q):s}).current,ce=Ie?re:void 0,Be=Ga(i);Ke(()=>{if(typeof document>"u")return;let s=new Xo(document.createElement("div"),{renderMode:"headless",apiConfig:l,additionalContext:r,language:d,currency:f,productId:v,visitorId:ge?Re:void 0,analyticsConsent:de,optionOverrides:Be.overrides,maskCompletedText:o,columns:p,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:D,prependPlaceholder:O,allOption:$,showNonTappableOptions:F,locationSearch:E,showProducts:q,submitProgress:P,awaitAnswerOnSubmit:Z,submitAnswerTimeoutMs:_,source:_e,value:k,completedParams:le,onSubmit:(...B)=>C.current?.(...B),onResult:(...B)=>R.current?.(...B),onError:(...B)=>z.current?.(...B),onChange:(...B)=>N.current?.(...B),onParamsChange:(...B)=>ee.current?.(...B),onFocus:()=>ye.current?.(),onBlur:()=>ae.current?.(),onProductSelect:B=>Ee.current?Ee.current(B):an,onProductAddToCart:B=>Ue.current?.(B),setCursor:B=>ke.current?.(B),products:He.config,mapProducts:ce});u.current=s,g(s.getState());let Q=s.subscribe(B=>g(B));return()=>{Q(),s.destroy(),u.current===s&&(u.current=null)}},[]);let a=U(ge);Ke(()=>{a.current!==ge&&(a.current=ge,u.current?.update({visitorId:ge?Re:void 0,analyticsConsent:de}))},[ge,Re,de]);let W=typeof m=="function"?"function":m,fe=U(W);Ke(()=>{fe.current!==W&&(fe.current=W,u.current?.refreshAnalyticsConsent())},[W]),Ke(()=>{k!==void 0&&u.current?.setValue(k)},[k]),Ke(()=>{le!==void 0&&u.current?.setCompletedParams(le)},[le]);let Se=JSON.stringify(l??null),Ye;try{Ye=JSON.stringify(r??null)}catch{Ye="[unstringifiable]"}Ke(()=>{u.current?.update({apiConfig:l,additionalContext:r,language:d,currency:f,productId:v,optionOverrides:Be.overrides,dropdownTrigger:h,optionsPosition:y,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:D,prependPlaceholder:O,allOption:$,showNonTappableOptions:F,locationSearch:E,showProducts:q,submitProgress:P,awaitAnswerOnSubmit:Z,submitAnswerTimeoutMs:_})},[Se,Ye,d,f?.code,f?.rate,f?.country,v,Be.key,h,y,S,T,D,O,$,F,E,q,P,Z,_]);let Ce=U(!1);Ke(()=>{if(!Ce.current){Ce.current=!0;return}u.current?.update({products:He.config})},[He.enabled]),Ke(()=>{u.current?.update({mapProducts:ce})},[ce]);let ze=U(null);ze.current===null&&(ze.current={handleTextChange:s=>u.current?.handleTextChange(s),handleCompositionText:s=>u.current?.handleCompositionText(s),handleKeyDown:s=>{let Q="nativeEvent"in s?s.nativeEvent:s;u.current?.handleKeyDown(Q)},setFocused:s=>u.current?.setFocused(s),startEditingParam:s=>u.current?.startEditingParam(s),removeParam:s=>u.current?.removeParam(s)??!1,exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:s=>u.current?.handleCaretAfterInput(s),handleCaretMove:s=>u.current?.handleCaretMove(s),replaceEditingRange:s=>u.current?.replaceEditingRange(s)??!1,setActivePill:s=>u.current?.setActivePill(s),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),refreshProducts:()=>u.current?.refreshProducts(),prepareSubmit:()=>u.current?.prepareSubmit(),getState:()=>u.current?.getState()??Va,getResult:()=>u.current?.getResult()??ln,awaitSubmitResult:()=>u.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:s=>u.current?.recordSubmit(s),holdSubmit:s=>u.current?.holdSubmit(s),endSubmitProgress:()=>u.current?.endSubmitProgress(),getSearchId:()=>u.current?.getSearchId(),getVisitorId:()=>u.current?.getVisitorId(),refreshAnalyticsConsent:()=>u.current?.refreshAnalyticsConsent(),selectOption:(s,Q)=>u.current?.selectOption(s,Q),selectProduct:s=>u.current?.selectProduct(s),addProductToCart:s=>{let Q=u.current;return!Q||!Ue.current?Promise.resolve():Q.addProductToCart(s)},setActiveDropdownIndex:s=>u.current?.setActiveDropdownIndex(s),clearHighlight:s=>u.current?.clearHighlight(s),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),setTime:s=>u.current?.setTime(s),commitTime:()=>u.current?.commitTime(),toggleMultiSelectOption:s=>u.current?.toggleMultiSelectOption(s),commitMultiSelect:()=>u.current?.commitMultiSelect(),setLocationQuery:s=>u.current?.setLocationQuery(s),moveLocationHighlight:s=>u.current?.moveLocationHighlight(s),commitLocation:s=>u.current?.commitLocation(s),setLocationFieldFocused:s=>u.current?.setLocationFieldFocused(s),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let w=ze.current,je=_a(s=>{let Q=s.target.value,ct=Q.length>0&&!s.nativeEvent?.isComposing&&Q[0]!==Q[0].toUpperCase()?Q[0].toUpperCase()+Q.slice(1):Q;u.current?.handleTextChange(ct)},[]),ot=_a(s=>{u.current?.handleKeyDown(s.nativeEvent)},[]),Le=u.current,b=Ve??Va,$e=k!==void 0?k:b.text,nt=le!==void 0?le:b.completedParams,Oe=b.actionableSuggestions,rt=Oe[0],st=rn(()=>nn(Oe),[Oe]),We=Le?.listboxId??"",lt=b.activeDropdownIndex>=0&&Le?`${We}-option-${b.activeDropdownIndex}`:void 0,De=b.editingParam,I=b.editingIdentified,Tt=De?tn(De):I?{parameter:I.parameter,text:on(I.parameter),required:!0,options:[]}:null,Pt=b.dropdownSuggestion??Tt??rt,Mt=en(b.dropdownSuggestion,Tt,Oe),dt=Jo(b),wt=!Le||b.dropdownLoading;return{completedParams:nt,multiSelectView:b.multiSelectView,toggleMultiSelectOption:w.toggleMultiSelectOption,commitMultiSelect:w.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:st,setActivePill:w.setActivePill,skipActivePill:w.skipActivePill,removeLastParam:w.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:w.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:wt,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:We,error:b.error,products:b.products,customFields:b.customFields,selectProduct:w.selectProduct,addProductToCart:w.addProductToCart,handleTextChange:w.handleTextChange,handleCompositionText:w.handleCompositionText,handleKeyDown:w.handleKeyDown,setFocused:w.setFocused,editingParam:De,editingIdentified:I,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:w.startEditingParam,removeParam:w.removeParam,exitEditMode:w.exitEditMode,handleCaretAfterInput:w.handleCaretAfterInput,handleCaretMove:w.handleCaretMove,replaceEditingRange:w.replaceEditingRange,inputProps:{value:$e,placeholder:b.placeholderText||void 0,onChange:je,onKeyDown:ot,onFocus:w.handleFocus,onBlur:w.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":We},reset:w.reset,refreshProducts:w.refreshProducts,prepareSubmit:w.prepareSubmit,getState:w.getState,getResult:w.getResult,awaitSubmitResult:w.awaitSubmitResult,recordSubmit:w.recordSubmit,holdSubmit:w.holdSubmit,endSubmitProgress:w.endSubmitProgress,getSearchId:w.getSearchId,getVisitorId:w.getVisitorId,refreshAnalyticsConsent:w.refreshAnalyticsConsent,isSubmitting:b.isSubmitting,selectingProductId:b.selectingProductId,dropdownProps:{suggestions:Pt?[{...Pt,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:w.selectOption,onHighlight:w.setActiveDropdownIndex,onUnhighlight:w.clearHighlight,isOpen:b.isDropdownOpen,id:We,pills:Mt,activeSelected:b.isActivePillSelected,onPillClick:w.setActivePill,onSkip:w.skipActivePill,showSkipButton:(ne??!0)&&!De&&!I,showOptionIcons:M??!0,showOptionImages:H??!0,showOptionCounts:K??!0,skipDisabled:b.inSelectionAnimation,isLoading:wt,skeletonExiting:b.skeletonExiting,isInputEmpty:$e.trim().length===0,language:d,products:b.products,productImageFallback:se,showProductVendor:A,onProductSelect:w.selectProduct,busyProductId:b.selectingProductId,seeAllBusy:b.isSubmitting,onProductAddToCart:me?w.addProductToCart:void 0,onProductFocusChange:w.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:dt.selectedIso,selectedDateRange:dt.selectedRange,dateRangeStart:dt.rangeStart,dateReferences:dt.references,onPreviousMonth:w.showPreviousMonth,onNextMonth:w.showNextMonth,timeView:b.timeView,multiSelectView:b.dropdownMultiSelect,onMultiSelectCommit:w.commitMultiSelect,onTimeChange:w.setTime,onTimeCommit:w.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:w.setLocationQuery,onLocationMove:w.moveLocationHighlight,onLocationCommit:w.commitLocation,onLocationFocusChange:w.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:y??"below"}}}import{attachChipRemove as dn,cancelStartingHint as cn,chipIdFromTap as pn,extractPlainText as Ua,focusesInputOnSelect as hn,getCursorOffset as Qa,keepCaretOnChip as un,plainTextLength as mn,renderEditableContent as gn,setCursorOffset as fn,settlePickFocus as bn,startingHintOptions as wn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as xe,useEffect as gt,useLayoutEffect as $t,useRef as at}from"react";var Ot;function vn(){if(Ot!==void 0)return Ot;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ot=e.contentEditable==="plaintext-only",Ot}function Ya(e){let{segments:n,showChipIcons:t=!0,showChipImages:i=!0,showChipRemove:o=!1,focusInputOnSelect:l,removeParam:r,newParamId:d,editingParam:f,editingIdentified:v,editingAnchor:x,caretOffset:m,placeholderText:p,hintSuggestions:h,isFocused:y,isDropdownOpen:S,listboxId:T,activeDescendantId:D,autoFocus:O,handleTextChange:$,handleCompositionText:F,handleKeyDown:E,handleCaretAfterInput:M,handleCaretMove:H,startEditingParam:K,replaceEditingRange:ne,setFocused:q}=e,P=at(null),Z=at(!1),_=at(""),se=at(""),A=at(null),G=at(0);A.current=m;let c=at(l);c.current=l,gt(()=>{if(!O)return;let g=P.current;if(!g)return;document.activeElement===g?q(!0):g.focus();let C=g.ownerDocument??document,R=C.getSelection(),z=R&&R.rangeCount>0&&g.contains(R.anchorNode);if(R&&!z){let N=C.createRange();N.selectNodeContents(g),N.collapse(!0),R.removeAllRanges(),R.addRange(N)}},[O,q]),gt(()=>{let g=P.current;if(!g)return;let C=g.ownerDocument??document,R=()=>{let z=C.getSelection();if(!z||z.rangeCount===0||!z.anchorNode||!g.contains(z.anchorNode))return;let N=z.anchorNode,ee=N.nodeType===Node.ELEMENT_NODE?N:N.parentElement,ae=(z.isCollapsed?ee?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ke=f?.id??v?.id??null;if(ae&&ae!==ke){K(ae);return}performance.now()-G.current<50||H(Qa(g))};return C.addEventListener("selectionchange",R),()=>C.removeEventListener("selectionchange",R)},[f,v,K,H]),gt(()=>{let g=P.current;if(!g)return;let C=R=>{let z=pn(g,R.target);z&&(K(z),un(g,z))};return g.addEventListener("click",C),()=>g.removeEventListener("click",C)},[K]),gt(()=>{let g=P.current;if(!(!g||!r||!o))return dn(g,r)},[r,o]),$t(()=>{let g=P.current;g&&gn({input:g,segments:n,newParamId:d,editingParamId:f?.id??null,placeholderText:p??"",isFocused:y,showChipIcons:t,showChipImages:i,showChipRemove:o,hintOptions:wn(h??[])})},[n,d,f,p,h,y,t,i,o]),gt(()=>{let g=P.current;return()=>{g&&cn(g)}},[]),$t(()=>{let g=_.current,C=d??"";if(_.current=C,!C||C===g)return;let R=P.current;if(!R)return;let z=A.current??mn(R);bn(R,z,hn(c.current))},[d]),$t(()=>{let g=se.current,C=f?.id??"";if(se.current=C,!C||C===g||x==null)return;let R=P.current;R&&fn(R,x)},[f,x]);let k=xe(()=>{let g=P.current;if(!g)return;let C=Ua(g),z=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(Z.current){F(z);return}$(z)},[$,F]),le=xe(()=>{G.current=performance.now(),k();let g=P.current;g&&M(Qa(g))},[k,M]);gt(()=>{let g=P.current;if(!g)return;let C=R=>{let z=R,N=z.inputType;if(N==="insertParagraph"||N==="insertLineBreak"||N==="insertFromDrop"){R.preventDefault();return}if(N.startsWith("insert")||N.startsWith("delete")){let ee=N.startsWith("delete")?"":z.data??"";ne(ee)&&R.preventDefault()}};return g.addEventListener("beforeinput",C),()=>g.removeEventListener("beforeinput",C)},[ne]);let Ne=xe(()=>{Z.current=!0,P.current?.setAttribute("data-aia-composing","true")},[]),ue=xe(()=>{Z.current=!1,P.current?.removeAttribute("data-aia-composing"),k()},[k]),qe=xe(g=>{g.preventDefault();let C=P.current;if(!C)return;let R=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!R)return;let z=C.ownerDocument??document,N=z.getSelection();if(!N||N.rangeCount===0)return;let ee=N.getRangeAt(0);if(!C.contains(ee.startContainer))return;ee.deleteContents();let ye=z.createTextNode(R);ee.insertNode(ye),ee.setStartAfter(ye),ee.collapse(!0),N.removeAllRanges(),N.addRange(ee),k()},[k]),Ie=xe(g=>E(g),[E]),Ae=xe(()=>q(!0),[q]),me=xe(()=>q(!1),[q]),_e=xe(()=>P.current?.focus(),[]),Fe=xe(()=>P.current?.blur(),[]),u=xe(()=>{let g=P.current;return g?Ua(g):""},[]),Ve=vn()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:Ve,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":T,"aria-expanded":S,"aria-activedescendant":D,spellCheck:!0,enterKeyHint:"send",onInput:le,onKeyDown:Ie,onCompositionStart:Ne,onCompositionEnd:ue,onPaste:qe,onFocus:Ae,onBlur:me},getPlainText:u,focus:_e,blur:Fe}}import{jsx as bt,jsxs as Xt}from"react/jsx-runtime";function En(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Rn=xn(function({onSubmit:n,onResult:t,onError:i,optionOverrides:o,maskCompletedText:l,className:r,apiConfig:d,additionalContext:f,language:v,currency:x,productId:m,visitorId:p,analyticsConsent:h,columns:y,pillPlacement:S="dropdown",mode:T="auto",optionsPosition:D="below",animations:O=!0,optionsStyle:$="floating",dropdownTrigger:F,closeDropdownOnBlur:E,focusInputOnSelect:M,startingState:H,prependPlaceholder:K,allOption:ne,showNonTappableOptions:q,locationSearch:P,showOptionIcons:Z=!0,showChipIcons:_=!0,showChipImages:se=!0,showChipRemove:A=!1,showOptionImages:G=!0,showOptionCounts:c=!0,showSkipButton:k,showProducts:le,submitProgress:Ne,awaitAnswerOnSubmit:ue,submitAnswerTimeoutMs:qe,productsLayout:Ie,productImageFallback:Ae,showProductVendor:me,autoFocus:_e=!0,onFocus:Fe,onBlur:u,value:Ve,completedParams:g,onChange:C,onParamsChange:R,products:z,mapProducts:N,onProductSelect:ee,onProductAddToCart:ye,submitButton:ae,resetOnSubmit:ke=!0,seeAllResults:Ee=!1},Ue){let ie=ft(null),Re=ft(null),ge=ft(null),Qe=ft(()=>{}),de=ft(null),He=ft(null);Zt(()=>{let L=ie.current;if(L)return de.current?de.current.setMode(T):de.current=new Tn(L,T),()=>{de.current?.destroy(),de.current=null}},[T]);let it=Dt(L=>{let be=He.current?.current;be&&(be.focus(),Pn(be,L))},[]),{completedParams:re,suggestionPills:ce,setActivePill:Be,skipActivePill:a,segments:W,newParamId:fe,clearNewParamId:Se,placeholderText:Ye,isFocused:Ce,isDropdownOpen:ze,isActivePillSelected:w,isLoading:je,isReady:ot,activeIndex:Le,listboxId:b,handleTextChange:$e,handleCompositionText:nt,handleKeyDown:Oe,setFocused:rt,editingParam:st,editingIdentified:We,editingAnchor:lt,caretOffset:De,startEditingParam:I,removeParam:Tt,handleCaretAfterInput:Pt,handleCaretMove:Mt,replaceEditingRange:dt,dropdownProps:wt,reset:s,refreshProducts:Q,prepareSubmit:B,getState:ct,getResult:Jt,awaitSubmitResult:ea,recordSubmit:ta,holdSubmit:aa,endSubmitProgress:ia,getSearchId:oa,getVisitorId:na,refreshAnalyticsConsent:ra,isSubmitting:Nt}=jt({onSubmit:L=>Qe.current(L),onResult:t,onError:i,optionOverrides:o,maskCompletedText:l,apiConfig:d,additionalContext:f,language:v,currency:x,productId:m,visitorId:p,analyticsConsent:h,columns:y,dropdownTrigger:F,optionsPosition:D,closeDropdownOnBlur:E,focusInputOnSelect:M,startingState:H,prependPlaceholder:K,allOption:ne,showNonTappableOptions:q,locationSearch:P,showOptionIcons:Z,showOptionImages:G,showOptionCounts:c,showSkipButton:k,showProducts:le,submitProgress:Ne,awaitAnswerOnSubmit:ue,submitAnswerTimeoutMs:qe,onFocus:Fe,onBlur:u,value:Ve,completedParams:g,onChange:C,onParamsChange:R,products:z,mapProducts:N,onProductSelect:ee,onProductAddToCart:ye,source:"full-sdk",setCursor:it});Zt(()=>{if(!fe)return;let L=window.setTimeout(()=>Se(),650);return()=>window.clearTimeout(L)},[fe,Se]);let ja=Le>=0?`${b}-option-${Le}`:void 0,{inputRef:pt,editorProps:$a,focus:sa,blur:la,getPlainText:da}=Ya({segments:W,newParamId:fe,editingParam:st,editingIdentified:We,editingAnchor:lt,caretOffset:De,placeholderText:Ye,hintSuggestions:S==="inline"?[]:ce,isFocused:Ce,showChipIcons:_,showChipImages:se,showChipRemove:A,removeParam:Tt,focusInputOnSelect:M,isDropdownOpen:ze,listboxId:b,activeDescendantId:ja,autoFocus:_e,handleTextChange:$e,handleCompositionText:nt,handleKeyDown:Oe,handleCaretAfterInput:Pt,handleCaretMove:Mt,startEditingParam:I,replaceEditingRange:dt,setFocused:rt});He.current=pt,kn(()=>{let L=Re.current,be=pt.current;if(!L||!be)return;let Xe=()=>{let xt=L.firstElementChild;if(!xt)return;let ai=xt.getBoundingClientRect(),ii=be.getBoundingClientRect();ai.top>=ii.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};Xe();let vt=new ResizeObserver(Xe);return vt.observe(be),()=>vt.disconnect()},[W,ce.length,je,pt]),Zt(()=>{let L=ge.current;if(L)return An(L)},[]),yn(Ue,()=>({focus:sa,blur:la,reset:s,refreshProducts:Q,setMode:L=>de.current?.setMode(L),skipActivePill:a,endSubmitProgress:ia,getSearchId:oa,getVisitorId:na,refreshAnalyticsConsent:ra}),[sa,la,s,Q,a,ia,oa,na,ra]);let Ze=!!W.length||re.length>0,It=Dt((L,be)=>{let Xe=ct(),vt=Sn(da(),Xe.completedParams,Xe.skippedParams,{identifiedParams:Xe.identifiedParams,isReady:Xe.isReady,customFields:be.custom_fields??null,customFieldsStale:be.custom_fields_stale===!0});L&&ta(vt);let xt=n(vt);return L&&!ke&&aa(xt),ke&&s(),xt},[ta,aa,ke,ct,n,s,da]),Ft=Dt(()=>{if(Ze&&!ct().isSubmitting){if(ue){ea().then(L=>{L&&It(!0,L)});return}B(),It(!0,Jt())}},[Ze,ct,ue,ea,B,Jt,It]);Qe.current=L=>Ze?It(!1,L):void 0;let Za=Ee&&!wt.isInputEmpty&&Ze,Xa=Ft,Ja=Dt(L=>{L.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||pt.current&&Cn(pt.current)},[pt]),ei=S==="inline",ti=S==="dropdown";return Xt("div",{ref:ie,className:`magicx-aia ${Je.container} ${r??""}`,"data-pill-placement":S,"data-options-position":D,"data-animations":O?"on":"off","data-aia-options-style":$,"data-mode":En(T),children:[bt(Qt,{...wt,showPills:ti,productsLayout:Ie,productImageFallback:Ae,showProductVendor:me,onSeeAllResults:Za?Xa:void 0,fullWidth:Ee}),Xt("div",{className:Je.inputWrapper,"data-aia-input-wrapper":"",onClick:Ja,children:[Xt("div",{ref:ge,className:Je.editorArea,"data-aia-editor":"",children:[bt("div",{...$a,className:Je.input,"data-aia-input":""}),ei&&(je||ce.length>0)&&bt("span",{ref:Re,className:Je.pillListContainer,"data-aia-pill-list-container":"",children:bt(Et,{pills:ce,activePillIndex:0,activeSelected:w,onSelectPill:Be,loading:je})})]}),ae===null?null:ae===void 0?bt(Ba,{disabled:!Ze,ready:Ze&&ot,busy:Nt,onClick:Ft,label:In(v).submit}):bt("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Nt?"busy":void 0,"aria-busy":Nt?!0:void 0,className:Je.submitSlot,onClick:L=>{Ze&&(L.stopPropagation(),Ft())},children:ae})]})]})});export{Rn as AIAutocomplete,Qt as AIAutocompleteDropdown,Bs as DATE_RANGE_META_END,Ws as DATE_RANGE_META_START,Gs as DEFAULT_OPTION_COUNT_UNIT,Zs as LOCATION_META_KEY,nl as PRODUCT_PATH_PREFIX,gl as TIME_META_KEY,bl as WEEKDAY_LABELS,Ns as buildSubmitResult,Fs as cellDay,Hs as cellIso,Ks as dateCellMarks,qs as focusesInputOnSelect,_s as formatDate,Vs as formatDateRange,Us as formatOptionCount,Qs as formatPlace,Ys as formatTime,$s as isTouchPrimary,js as isoDate,Xs as monthLabel,Js as optionCountLabel,el as optionHasImage,tl as optionImageSources,al as optionImageSrc,il as optionLabel,ol as optionsShowLeadingVisuals,rl as parseDate,sl as parseLooseDate,ll as parseLooseDateRange,dl as parseTime,cl as productFromMatchedItem,pl as productImageSources,hl as productsFromCustomFields,ul as sanitizeOptionIconSvg,ml as selectedRangeFor,jt as useAIAutocomplete,fl as visibleDateRange,wl as withSkippedParams};
|
|
3978
|
+
`,document.head.appendChild(e)}var Ba={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};import{jsx as jt}from"react/jsx-runtime";function Wa({disabled:e,ready:r,busy:t=!1,onClick:o,label:n=en().submit}){return jt("button",{type:"button","data-aia-submit":"",className:Ba.submitButton,disabled:e,"data-aia-ready":r?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:d=>{d.stopPropagation(),o()},"aria-label":n,children:jt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":n,children:jt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as tn,dateSelectionFor as an,dropdownPillsFor as on,editingSuggestion as nn,HANDOFF_NOT_HANDLED as rn,identifiedParamLabel as sn,withoutTraditionalAutocomplete as ln}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Va,useEffect as Ke,useMemo as dn,useRef as _,useState as cn}from"react";import{useRef as Ga}from"react";function Ka(e){let r=Ga(e);r.current=e;let t=Object.keys(e??{}).sort().join("\0"),o=Ga({key:"",overrides:void 0});if(o.current.key!==t){let n={};for(let d of Object.keys(e??{})){let s=(c,f,x)=>{let y=r.current?.[d];return y?y(c,f,x):[]};n[d]=s}o.current={key:t,overrides:e?n:void 0}}return{overrides:o.current.overrides,key:t}}import{useRef as qa}from"react";function _a(e){let r=qa(e);r.current=e;let t=qa(null);t.current===null&&(t.current={fetch:(n,d)=>{let s=r.current;return s?s.fetch(n,d):Promise.reject(new Error("products config removed"))},transform:n=>r.current?.transform(n)??[],get limit(){return r.current?.limit}});let o=e!==void 0;return{config:o?t.current:void 0,enabled:o}}var pn={query:"",raw_query:"",completed_params:[],identified_params:[],is_ready:!1},Ua={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,highlightByPointer:!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,isSubmitting:!1,selectingProductId:null,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 $t({onSubmit:e,onResult:r,onError:t,optionOverrides:o,maskCompletedText:n,apiConfig:d,additionalContext:s,language:c,currency:f,productId:x,visitorId:y,analyticsConsent:m,columns:p=2,dropdownTrigger:h,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:Y,showNonTappableOptions:N,locationSearch:A,showOptionIcons:D,showOptionImages:F,showOptionCounts:W,showSkipButton:re,showProducts:G,submitProgress:P,awaitAnswerOnSubmit:j,submitAnswerTimeoutMs:K,productImageFallback:se="image",showProductVendor:le=!0,onFocus:ee,onBlur:a,value:v,completedParams:te,onChange:me,onParamsChange:oe,products:qe,mapProducts:Ae,onProductSelect:Ee,onProductAddToCart:ge,source:_e,setCursor:Fe}){let u=_(null),[Ve,g]=cn(null),C=_(e);C.current=e;let E=_(r);E.current=r;let R=_(t);R.current=t;let M=_(me);M.current=me;let X=_(oe);X.current=oe;let ke=_(ee);ke.current=ee;let ae=_(a);ae.current=a;let Se=_(Fe);Se.current=Fe;let Re=_(Ee);Re.current=Ee;let Ue=_(ge);Ue.current=ge;let ie=_(y);ie.current=y;let ze=_(()=>{let l=ie.current;return typeof l=="function"?l():l}).current,fe=y!==void 0,Qe=_(m);Qe.current=m;let ce=_(()=>{let l=Qe.current;return typeof l=="function"?l():l}).current,He=_a(qe),it=_(Ae);it.current=Ae;let de=_((l,V)=>{let H=it.current;return H?H(l,V):l}).current,pe=Ae?de:void 0,Be=Ka(o);Ke(()=>{if(typeof document>"u")return;let l=new tn(document.createElement("div"),{renderMode:"headless",apiConfig:d,additionalContext:s,language:c,currency:f,productId:x,visitorId:fe?ze:void 0,analyticsConsent:ce,optionOverrides:Be.overrides,maskCompletedText:n,columns:p,dropdownTrigger:h,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:Y,showNonTappableOptions:N,locationSearch:A,showProducts:G,submitProgress:P,awaitAnswerOnSubmit:j,submitAnswerTimeoutMs:K,source:_e,value:v,completedParams:te,onSubmit:(...H)=>C.current?.(...H),onResult:(...H)=>E.current?.(...H),onError:(...H)=>R.current?.(...H),onChange:(...H)=>M.current?.(...H),onParamsChange:(...H)=>X.current?.(...H),onFocus:()=>ke.current?.(),onBlur:()=>ae.current?.(),onProductSelect:H=>Re.current?Re.current(H):rn,onProductAddToCart:H=>Ue.current?.(H),setCursor:H=>Se.current?.(H),products:He.config,mapProducts:pe});u.current=l,g(l.getState());let V=l.subscribe(H=>g(H));return()=>{V(),l.destroy(),u.current===l&&(u.current=null)}},[]);let i=_(fe);Ke(()=>{i.current!==fe&&(i.current=fe,u.current?.update({visitorId:fe?ze:void 0,analyticsConsent:ce}))},[fe,ze,ce]);let B=typeof m=="function"?"function":m,be=_(B);Ke(()=>{be.current!==B&&(be.current=B,u.current?.refreshAnalyticsConsent())},[B]),Ke(()=>{v!==void 0&&u.current?.setValue(v)},[v]),Ke(()=>{te!==void 0&&u.current?.setCompletedParams(te)},[te]);let Ce=JSON.stringify(d??null),Ye;try{Ye=JSON.stringify(s??null)}catch{Ye="[unstringifiable]"}Ke(()=>{u.current?.update({apiConfig:d,additionalContext:s,language:c,currency:f,productId:x,optionOverrides:Be.overrides,dropdownTrigger:h,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:Y,showNonTappableOptions:N,locationSearch:A,showProducts:G,submitProgress:P,awaitAnswerOnSubmit:j,submitAnswerTimeoutMs:K})},[Ce,Ye,c,f?.code,f?.rate,f?.country,x,Be.key,h,k,S,T,O,L,Y,N,A,G,P,j,K]);let Te=_(!1);Ke(()=>{if(!Te.current){Te.current=!0;return}u.current?.update({products:He.config})},[He.enabled]),Ke(()=>{u.current?.update({mapProducts:pe})},[pe]);let Le=_(null);Le.current===null&&(Le.current={handleTextChange:l=>u.current?.handleTextChange(l),handleCompositionText:l=>u.current?.handleCompositionText(l),handleKeyDown:l=>{let V="nativeEvent"in l?l.nativeEvent:l;u.current?.handleKeyDown(V)},setFocused:l=>u.current?.setFocused(l),startEditingParam:l=>u.current?.startEditingParam(l),removeParam:l=>u.current?.removeParam(l)??!1,exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:l=>u.current?.handleCaretAfterInput(l),handleCaretMove:l=>u.current?.handleCaretMove(l),replaceEditingRange:l=>u.current?.replaceEditingRange(l)??!1,setActivePill:l=>u.current?.setActivePill(l),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),refreshProducts:()=>u.current?.refreshProducts(),prepareSubmit:()=>u.current?.prepareSubmit(),getState:()=>u.current?.getState()??Ua,getResult:()=>u.current?.getResult()??pn,awaitSubmitResult:()=>u.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:l=>u.current?.recordSubmit(l),holdSubmit:l=>u.current?.holdSubmit(l),endSubmitProgress:()=>u.current?.endSubmitProgress(),getSearchId:()=>u.current?.getSearchId(),getVisitorId:()=>u.current?.getVisitorId(),refreshAnalyticsConsent:()=>u.current?.refreshAnalyticsConsent(),selectOption:(l,V)=>u.current?.selectOption(l,V),selectProduct:l=>u.current?.selectProduct(l),addProductToCart:l=>{let V=u.current;return!V||!Ue.current?Promise.resolve():V.addProductToCart(l)},setActiveDropdownIndex:l=>u.current?.setActiveDropdownIndex(l),clearHighlight:l=>u.current?.clearHighlight(l),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),setTime:l=>u.current?.setTime(l),commitTime:()=>u.current?.commitTime(),toggleMultiSelectOption:l=>u.current?.toggleMultiSelectOption(l),commitMultiSelect:()=>u.current?.commitMultiSelect(),setLocationQuery:l=>u.current?.setLocationQuery(l),moveLocationHighlight:l=>u.current?.moveLocationHighlight(l),commitLocation:l=>u.current?.commitLocation(l),setLocationFieldFocused:l=>u.current?.setLocationFieldFocused(l),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let w=Le.current,je=Va(l=>{let V=l.target.value,ct=V.length>0&&!l.nativeEvent?.isComposing&&V[0]!==V[0].toUpperCase()?V[0].toUpperCase()+V.slice(1):V;u.current?.handleTextChange(ct)},[]),ot=Va(l=>{u.current?.handleKeyDown(l.nativeEvent)},[]),Oe=u.current,b=Ve??Ua,$e=v!==void 0?v:b.text,nt=te!==void 0?te:b.completedParams,De=b.actionableSuggestions,rt=De[0],st=dn(()=>ln(De),[De]),We=Oe?.listboxId??"",lt=b.activeDropdownIndex>=0&&Oe?`${We}-option-${b.activeDropdownIndex}`:void 0,Me=b.editingParam,I=b.editingIdentified,Tt=Me?nn(Me):I?{parameter:I.parameter,text:sn(I.parameter),required:!0,options:[]}:null,Pt=b.dropdownSuggestion??Tt??rt,Mt=on(b.dropdownSuggestion,Tt,De),dt=an(b),wt=!Oe||b.dropdownLoading;return{completedParams:nt,multiSelectView:b.multiSelectView,toggleMultiSelectOption:w.toggleMultiSelectOption,commitMultiSelect:w.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:st,setActivePill:w.setActivePill,skipActivePill:w.skipActivePill,removeLastParam:w.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:w.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:wt,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:We,error:b.error,products:b.products,customFields:b.customFields,selectProduct:w.selectProduct,addProductToCart:w.addProductToCart,handleTextChange:w.handleTextChange,handleCompositionText:w.handleCompositionText,handleKeyDown:w.handleKeyDown,setFocused:w.setFocused,editingParam:Me,editingIdentified:I,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:w.startEditingParam,removeParam:w.removeParam,exitEditMode:w.exitEditMode,handleCaretAfterInput:w.handleCaretAfterInput,handleCaretMove:w.handleCaretMove,replaceEditingRange:w.replaceEditingRange,inputProps:{value:$e,placeholder:b.placeholderText||void 0,onChange:je,onKeyDown:ot,onFocus:w.handleFocus,onBlur:w.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":We},reset:w.reset,refreshProducts:w.refreshProducts,prepareSubmit:w.prepareSubmit,getState:w.getState,getResult:w.getResult,awaitSubmitResult:w.awaitSubmitResult,recordSubmit:w.recordSubmit,holdSubmit:w.holdSubmit,endSubmitProgress:w.endSubmitProgress,getSearchId:w.getSearchId,getVisitorId:w.getVisitorId,refreshAnalyticsConsent:w.refreshAnalyticsConsent,isSubmitting:b.isSubmitting,selectingProductId:b.selectingProductId,dropdownProps:{suggestions:Pt?[{...Pt,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:w.selectOption,onHighlight:w.setActiveDropdownIndex,onUnhighlight:w.clearHighlight,isOpen:b.isDropdownOpen,id:We,pills:Mt,activeSelected:b.isActivePillSelected,onPillClick:w.setActivePill,onSkip:w.skipActivePill,showSkipButton:(re??!0)&&!Me&&!I,showOptionIcons:D??!0,showOptionImages:F??!0,showOptionCounts:W??!0,skipDisabled:b.inSelectionAnimation,isLoading:wt,skeletonExiting:b.skeletonExiting,isInputEmpty:$e.trim().length===0,language:c,products:b.products,productImageFallback:se,showProductVendor:le,onProductSelect:w.selectProduct,busyProductId:b.selectingProductId,seeAllBusy:b.isSubmitting,onProductAddToCart:ge?w.addProductToCart:void 0,onProductFocusChange:w.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:dt.selectedIso,selectedDateRange:dt.selectedRange,dateRangeStart:dt.rangeStart,dateReferences:dt.references,onPreviousMonth:w.showPreviousMonth,onNextMonth:w.showNextMonth,timeView:b.timeView,multiSelectView:b.dropdownMultiSelect,onMultiSelectCommit:w.commitMultiSelect,onTimeChange:w.setTime,onTimeCommit:w.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:w.setLocationQuery,onLocationMove:w.moveLocationHighlight,onLocationCommit:w.commitLocation,onLocationFocusChange:w.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:k??"below"}}}import{attachChipRemove as hn,cancelStartingHint as un,chipIdFromTap as mn,extractPlainText as Qa,focusesInputOnSelect as gn,getCursorOffset as Ya,keepCaretOnChip as fn,plainTextLength as bn,renderEditableContent as wn,setCursorOffset as vn,settlePickFocus as xn,startingHintOptions as yn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ye,useEffect as gt,useLayoutEffect as Zt,useRef as at}from"react";var Ot;function kn(){if(Ot!==void 0)return Ot;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ot=e.contentEditable==="plaintext-only",Ot}function ja(e){let{segments:r,showChipIcons:t=!0,showChipImages:o=!0,showChipRemove:n=!1,focusInputOnSelect:d,removeParam:s,newParamId:c,editingParam:f,editingIdentified:x,editingAnchor:y,caretOffset:m,placeholderText:p,hintSuggestions:h,isFocused:k,isDropdownOpen:S,listboxId:T,activeDescendantId:O,autoFocus:L,handleTextChange:Y,handleCompositionText:N,handleKeyDown:A,handleCaretAfterInput:D,handleCaretMove:F,startEditingParam:W,replaceEditingRange:re,setFocused:G}=e,P=at(null),j=at(!1),K=at(""),se=at(""),le=at(null),ee=at(0);le.current=m;let a=at(d);a.current=d,gt(()=>{if(!L)return;let g=P.current;if(!g)return;document.activeElement===g?G(!0):g.focus();let C=g.ownerDocument??document,E=C.getSelection(),R=E&&E.rangeCount>0&&g.contains(E.anchorNode);if(E&&!R){let M=C.createRange();M.selectNodeContents(g),M.collapse(!0),E.removeAllRanges(),E.addRange(M)}},[L,G]),gt(()=>{let g=P.current;if(!g)return;let C=g.ownerDocument??document,E=()=>{let R=C.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!g.contains(R.anchorNode))return;let M=R.anchorNode,X=M.nodeType===Node.ELEMENT_NODE?M:M.parentElement,ae=(R.isCollapsed?X?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Se=f?.id??x?.id??null;if(ae&&ae!==Se){W(ae);return}performance.now()-ee.current<50||F(Ya(g))};return C.addEventListener("selectionchange",E),()=>C.removeEventListener("selectionchange",E)},[f,x,W,F]),gt(()=>{let g=P.current;if(!g)return;let C=E=>{let R=mn(g,E.target);R&&(W(R),fn(g,R))};return g.addEventListener("click",C),()=>g.removeEventListener("click",C)},[W]),gt(()=>{let g=P.current;if(!(!g||!s||!n))return hn(g,s)},[s,n]),Zt(()=>{let g=P.current;g&&wn({input:g,segments:r,newParamId:c,editingParamId:f?.id??null,placeholderText:p??"",isFocused:k,showChipIcons:t,showChipImages:o,showChipRemove:n,hintOptions:yn(h??[])})},[r,c,f,p,h,k,t,o,n]),gt(()=>{let g=P.current;return()=>{g&&un(g)}},[]),Zt(()=>{let g=K.current,C=c??"";if(K.current=C,!C||C===g)return;let E=P.current;if(!E)return;let R=le.current??bn(E);xn(E,R,gn(a.current))},[c]),Zt(()=>{let g=se.current,C=f?.id??"";if(se.current=C,!C||C===g||y==null)return;let E=P.current;E&&vn(E,y)},[f,y]);let v=ye(()=>{let g=P.current;if(!g)return;let C=Qa(g),R=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(j.current){N(R);return}Y(R)},[Y,N]),te=ye(()=>{ee.current=performance.now(),v();let g=P.current;g&&D(Ya(g))},[v,D]);gt(()=>{let g=P.current;if(!g)return;let C=E=>{let R=E,M=R.inputType;if(M==="insertParagraph"||M==="insertLineBreak"||M==="insertFromDrop"){E.preventDefault();return}if(M.startsWith("insert")||M.startsWith("delete")){let X=M.startsWith("delete")?"":R.data??"";re(X)&&E.preventDefault()}};return g.addEventListener("beforeinput",C),()=>g.removeEventListener("beforeinput",C)},[re]);let me=ye(()=>{j.current=!0,P.current?.setAttribute("data-aia-composing","true")},[]),oe=ye(()=>{j.current=!1,P.current?.removeAttribute("data-aia-composing"),v()},[v]),qe=ye(g=>{g.preventDefault();let C=P.current;if(!C)return;let E=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!E)return;let R=C.ownerDocument??document,M=R.getSelection();if(!M||M.rangeCount===0)return;let X=M.getRangeAt(0);if(!C.contains(X.startContainer))return;X.deleteContents();let ke=R.createTextNode(E);X.insertNode(ke),X.setStartAfter(ke),X.collapse(!0),M.removeAllRanges(),M.addRange(X),v()},[v]),Ae=ye(g=>A(g),[A]),Ee=ye(()=>G(!0),[G]),ge=ye(()=>G(!1),[G]),_e=ye(()=>P.current?.focus(),[]),Fe=ye(()=>P.current?.blur(),[]),u=ye(()=>{let g=P.current;return g?Qa(g):""},[]),Ve=kn()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:Ve,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":T,"aria-expanded":S,"aria-activedescendant":O,spellCheck:!0,enterKeyHint:"send",onInput:te,onKeyDown:Ae,onCompositionStart:me,onCompositionEnd:oe,onPaste:qe,onFocus:Ee,onBlur:ge},getPlainText:u,focus:_e,blur:Fe}}import{jsx as bt,jsxs as Jt}from"react/jsx-runtime";function Ln(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var On=Sn(function({onSubmit:r,onResult:t,onError:o,optionOverrides:n,maskCompletedText:d,className:s,apiConfig:c,additionalContext:f,language:x,currency:y,productId:m,visitorId:p,analyticsConsent:h,columns:k,pillPlacement:S="dropdown",mode:T="auto",optionsPosition:O="below",animations:L=!0,optionsStyle:Y="floating",dropdownTrigger:N,closeDropdownOnBlur:A,focusInputOnSelect:D,startingState:F,prependPlaceholder:W,allOption:re,showNonTappableOptions:G,locationSearch:P,showOptionIcons:j=!0,showChipIcons:K=!0,showChipImages:se=!0,showChipRemove:le=!1,showOptionImages:ee=!0,showOptionCounts:a=!0,showSkipButton:v,showProducts:te,submitProgress:me,awaitAnswerOnSubmit:oe,submitAnswerTimeoutMs:qe,productsLayout:Ae,productImageFallback:Ee,showProductVendor:ge,autoFocus:_e=!0,onFocus:Fe,onBlur:u,value:Ve,completedParams:g,onChange:C,onParamsChange:E,products:R,mapProducts:M,onProductSelect:X,onProductAddToCart:ke,submitButton:ae,resetOnSubmit:Se=!0,seeAllResults:Re=!1},Ue){let ie=ft(null),ze=ft(null),fe=ft(null),Qe=ft(()=>{}),ce=ft(null),He=ft(null);Xt(()=>{let z=ie.current;if(z)return ce.current?ce.current.setMode(T):ce.current=new An(z,T),()=>{ce.current?.destroy(),ce.current=null}},[T]);let it=Dt(z=>{let we=He.current?.current;we&&(we.focus(),En(we,z))},[]),{completedParams:de,suggestionPills:pe,setActivePill:Be,skipActivePill:i,segments:B,newParamId:be,clearNewParamId:Ce,placeholderText:Ye,isFocused:Te,isDropdownOpen:Le,isActivePillSelected:w,isLoading:je,isReady:ot,activeIndex:Oe,listboxId:b,handleTextChange:$e,handleCompositionText:nt,handleKeyDown:De,setFocused:rt,editingParam:st,editingIdentified:We,editingAnchor:lt,caretOffset:Me,startEditingParam:I,removeParam:Tt,handleCaretAfterInput:Pt,handleCaretMove:Mt,replaceEditingRange:dt,dropdownProps:wt,reset:l,refreshProducts:V,prepareSubmit:H,getState:ct,getResult:ea,awaitSubmitResult:ta,recordSubmit:aa,holdSubmit:ia,endSubmitProgress:oa,getSearchId:na,getVisitorId:ra,refreshAnalyticsConsent:sa,isSubmitting:Nt}=$t({onSubmit:z=>Qe.current(z),onResult:t,onError:o,optionOverrides:n,maskCompletedText:d,apiConfig:c,additionalContext:f,language:x,currency:y,productId:m,visitorId:p,analyticsConsent:h,columns:k,dropdownTrigger:N,optionsPosition:O,closeDropdownOnBlur:A,focusInputOnSelect:D,startingState:F,prependPlaceholder:W,allOption:re,showNonTappableOptions:G,locationSearch:P,showOptionIcons:j,showOptionImages:ee,showOptionCounts:a,showSkipButton:v,showProducts:te,submitProgress:me,awaitAnswerOnSubmit:oe,submitAnswerTimeoutMs:qe,onFocus:Fe,onBlur:u,value:Ve,completedParams:g,onChange:C,onParamsChange:E,products:R,mapProducts:M,onProductSelect:X,onProductAddToCart:ke,source:"full-sdk",setCursor:it});Xt(()=>{if(!be)return;let z=window.setTimeout(()=>Ce(),650);return()=>window.clearTimeout(z)},[be,Ce]);let $a=Oe>=0?`${b}-option-${Oe}`:void 0,{inputRef:pt,editorProps:Za,focus:la,blur:da,getPlainText:ca}=ja({segments:B,newParamId:be,editingParam:st,editingIdentified:We,editingAnchor:lt,caretOffset:Me,placeholderText:Ye,hintSuggestions:S==="inline"?[]:pe,isFocused:Te,showChipIcons:K,showChipImages:se,showChipRemove:le,removeParam:Tt,focusInputOnSelect:D,isDropdownOpen:Le,listboxId:b,activeDescendantId:$a,autoFocus:_e,handleTextChange:$e,handleCompositionText:nt,handleKeyDown:De,handleCaretAfterInput:Pt,handleCaretMove:Mt,startEditingParam:I,replaceEditingRange:dt,setFocused:rt});He.current=pt,Tn(()=>{let z=ze.current,we=pt.current;if(!z||!we)return;let Xe=()=>{let xt=z.firstElementChild;if(!xt)return;let ii=xt.getBoundingClientRect(),oi=we.getBoundingClientRect();ii.top>=oi.bottom-2?z.setAttribute("data-aia-pill-wrapped",""):z.removeAttribute("data-aia-pill-wrapped")};Xe();let vt=new ResizeObserver(Xe);return vt.observe(we),()=>vt.disconnect()},[B,pe.length,je,pt]),Xt(()=>{let z=fe.current;if(z)return zn(z)},[]),Cn(Ue,()=>({focus:la,blur:da,reset:l,refreshProducts:V,setMode:z=>ce.current?.setMode(z),skipActivePill:i,endSubmitProgress:oa,getSearchId:na,getVisitorId:ra,refreshAnalyticsConsent:sa}),[la,da,l,V,i,oa,na,ra,sa]);let Ze=!!B.length||de.length>0,It=Dt((z,we)=>{let Xe=ct(),vt=Pn(ca(),Xe.completedParams,Xe.skippedParams,{identifiedParams:Xe.identifiedParams,isReady:Xe.isReady,customFields:we.custom_fields??null,customFieldsStale:we.custom_fields_stale===!0});z&&aa(vt);let xt=r(vt);return z&&!Se&&ia(xt),Se&&l(),xt},[aa,ia,Se,ct,r,l,ca]),Ft=Dt(()=>{if(Ze&&!ct().isSubmitting){if(oe){ta().then(z=>{z&&It(!0,z)});return}H(),It(!0,ea())}},[Ze,ct,oe,ta,H,ea,It]);Qe.current=z=>Ze?It(!1,z):void 0;let Xa=Re&&!wt.isInputEmpty&&Ze,Ja=Ft,ei=Dt(z=>{z.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||pt.current&&In(pt.current)},[pt]),ti=S==="inline",ai=S==="dropdown";return Jt("div",{ref:ie,className:`magicx-aia ${Je.container} ${s??""}`,"data-pill-placement":S,"data-options-position":O,"data-animations":L?"on":"off","data-aia-options-style":Y,"data-mode":Ln(T),children:[bt(Yt,{...wt,showPills:ai,productsLayout:Ae,productImageFallback:Ee,showProductVendor:ge,onSeeAllResults:Xa?Ja:void 0,fullWidth:Re}),Jt("div",{className:Je.inputWrapper,"data-aia-input-wrapper":"",onClick:ei,children:[Jt("div",{ref:fe,className:Je.editorArea,"data-aia-editor":"",children:[bt("div",{...Za,className:Je.input,"data-aia-input":""}),ti&&(je||pe.length>0)&&bt("span",{ref:ze,className:Je.pillListContainer,"data-aia-pill-list-container":"",children:bt(Et,{pills:pe,activePillIndex:0,activeSelected:w,onSelectPill:Be,loading:je})})]}),ae===null?null:ae===void 0?bt(Wa,{disabled:!Ze,ready:Ze&&ot,busy:Nt,onClick:Ft,label:Rn(x).submit}):bt("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Nt?"busy":void 0,"aria-busy":Nt?!0:void 0,className:Je.submitSlot,onClick:z=>{Ze&&(z.stopPropagation(),Ft())},children:ae})]})]})});export{On as AIAutocomplete,Yt as AIAutocompleteDropdown,Ks as DATE_RANGE_META_END,qs as DATE_RANGE_META_START,_s as DEFAULT_OPTION_COUNT_UNIT,el as LOCATION_META_KEY,ll as PRODUCT_PATH_PREFIX,wl as TIME_META_KEY,xl as WEEKDAY_LABELS,Bs as buildSubmitResult,Ws as cellDay,Gs as cellIso,Vs as dateCellMarks,Us as focusesInputOnSelect,Qs as formatDate,Ys as formatDateRange,js as formatOptionCount,$s as formatPlace,Zs as formatTime,Js as isTouchPrimary,Xs as isoDate,tl as monthLabel,al as optionCountLabel,il as optionHasImage,ol as optionImageSources,nl as optionImageSrc,rl as optionLabel,sl as optionsShowLeadingVisuals,dl as parseDate,cl as parseLooseDate,pl as parseLooseDateRange,hl as parseTime,ul as productFromMatchedItem,ml as productImageSources,gl as productsFromCustomFields,fl as sanitizeOptionIconSvg,bl as selectedRangeFor,$t as useAIAutocomplete,vl as visibleDateRange,yl as withSkippedParams};
|
|
3940
3979
|
//# sourceMappingURL=index.mjs.map
|