@magicx-eng/ai-autocomplete-react 0.53.0 → 0.53.2

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 CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ot=Object.defineProperty;var Pa=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var Ea=Object.prototype.hasOwnProperty;var Aa=(e,a)=>{for(var t in a)Ot(e,t,{get:a[t],enumerable:!0})},Ra=(e,a,t,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of Ia(a))!Ea.call(e,o)&&o!==t&&Ot(e,o,{get:()=>a[o],enumerable:!(i=Pa(a,o))||i.enumerable});return e};var Oa=e=>Ra(Ot({},"__esModule",{value:!0}),e);var ni={};Aa(ni,{AIAutocomplete:()=>wa,AIAutocompleteDropdown:()=>Tt,DATE_RANGE_META_END:()=>l.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>l.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>l.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>l.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>l.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>l.TIME_META_KEY,WEEKDAY_LABELS:()=>l.WEEKDAY_LABELS,buildSubmitResult:()=>l.buildSubmitResult,cellDay:()=>l.cellDay,cellIso:()=>l.cellIso,dateCellMarks:()=>l.dateCellMarks,formatDate:()=>l.formatDate,formatDateRange:()=>l.formatDateRange,formatOptionCount:()=>l.formatOptionCount,formatPlace:()=>l.formatPlace,formatTime:()=>l.formatTime,isoDate:()=>l.isoDate,monthLabel:()=>l.monthLabel,optionCountLabel:()=>l.optionCountLabel,optionHasImage:()=>l.optionHasImage,optionImageSources:()=>l.optionImageSources,optionImageSrc:()=>l.optionImageSrc,optionLabel:()=>l.optionLabel,optionsShowLeadingVisuals:()=>l.optionsShowLeadingVisuals,parseDate:()=>l.parseDate,parseLooseDate:()=>l.parseLooseDate,parseLooseDateRange:()=>l.parseLooseDateRange,parseTime:()=>l.parseTime,productFromMatchedItem:()=>l.productFromMatchedItem,productImageSources:()=>l.productImageSources,productsFromCustomFields:()=>l.productsFromCustomFields,sanitizeOptionIconSvg:()=>l.sanitizeOptionIconSvg,selectedRangeFor:()=>l.selectedRangeFor,useAIAutocomplete:()=>It,visibleDateRange:()=>l.visibleDateRange,withSkippedParams:()=>l.withSkippedParams});module.exports=Oa(ni);var l=require("@magicx-eng/ai-autocomplete-vanilla");var U=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
1
+ "use strict";var Ot=Object.defineProperty;var Pa=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var Ea=Object.prototype.hasOwnProperty;var Aa=(e,a)=>{for(var t in a)Ot(e,t,{get:a[t],enumerable:!0})},Ra=(e,a,t,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of Ia(a))!Ea.call(e,o)&&o!==t&&Ot(e,o,{get:()=>a[o],enumerable:!(i=Pa(a,o))||i.enumerable});return e};var Oa=e=>Ra(Ot({},"__esModule",{value:!0}),e);var ni={};Aa(ni,{AIAutocomplete:()=>wa,AIAutocompleteDropdown:()=>Tt,DATE_RANGE_META_END:()=>l.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>l.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>l.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>l.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>l.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>l.TIME_META_KEY,WEEKDAY_LABELS:()=>l.WEEKDAY_LABELS,buildSubmitResult:()=>l.buildSubmitResult,cellDay:()=>l.cellDay,cellIso:()=>l.cellIso,dateCellMarks:()=>l.dateCellMarks,formatDate:()=>l.formatDate,formatDateRange:()=>l.formatDateRange,formatOptionCount:()=>l.formatOptionCount,formatPlace:()=>l.formatPlace,formatTime:()=>l.formatTime,isoDate:()=>l.isoDate,monthLabel:()=>l.monthLabel,optionCountLabel:()=>l.optionCountLabel,optionHasImage:()=>l.optionHasImage,optionImageSources:()=>l.optionImageSources,optionImageSrc:()=>l.optionImageSrc,optionLabel:()=>l.optionLabel,optionsShowLeadingVisuals:()=>l.optionsShowLeadingVisuals,parseDate:()=>l.parseDate,parseLooseDate:()=>l.parseLooseDate,parseLooseDateRange:()=>l.parseLooseDateRange,parseTime:()=>l.parseTime,productFromMatchedItem:()=>l.productFromMatchedItem,productImageSources:()=>l.productImageSources,productsFromCustomFields:()=>l.productsFromCustomFields,sanitizeOptionIconSvg:()=>l.sanitizeOptionIconSvg,selectedRangeFor:()=>l.selectedRangeFor,useAIAutocomplete:()=>It,visibleDateRange:()=>l.visibleDateRange,withSkippedParams:()=>l.withSkippedParams});module.exports=Oa(ni);var l=require("@magicx-eng/ai-autocomplete-vanilla");var Q=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
2
2
  position: relative;
3
3
  /* Inherits the host page's font by default. Consumers can pin a specific
4
4
  font on the library via \`--aia-font-family: 'Custom Font'\` without
@@ -346,7 +346,7 @@
346
346
  transition: none;
347
347
  }
348
348
  }
349
- `,document.head.appendChild(e)}var rt={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};var D=require("@magicx-eng/ai-autocomplete-vanilla"),V=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
349
+ `,document.head.appendChild(e)}var rt={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};var O=require("@magicx-eng/ai-autocomplete-vanilla"),Y=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
350
350
  * Built-in appearance defaults \u2014 zero specificity via :where().
351
351
  * Consumer CSS always wins without !important.
352
352
  *
@@ -558,8 +558,11 @@
558
558
  --aia-completed-pill-color: var(--aia-primitive-neutral-0);
559
559
 
560
560
  --aia-option-bg: var(--aia-primitive-blue-50);
561
- /* Options read bigger + darker than the small-caps param labels above them. */
562
- --aia-option-color: var(--aia-primitive-neutral-150);
561
+ /* Option text: a softer grey than the parameter label above it. */
562
+ --aia-option-color: var(--aia-primitive-neutral-500);
563
+ /* The floating box's thin options scrollbar: track and thumb. */
564
+ --aia-scrollbar-track: rgba(15, 23, 42, 0.05);
565
+ --aia-scrollbar-thumb: rgba(15, 23, 42, 0.22);
563
566
  --aia-option-color-selected: var(--aia-primitive-neutral-0);
564
567
  --aia-option-font-size: 11.2px;
565
568
 
@@ -626,8 +629,10 @@
626
629
  --aia-completed-pill-color: var(--aia-primitive-neutral-1000);
627
630
 
628
631
  --aia-option-bg: var(--aia-primitive-neutral-250);
629
- /* Options read bigger + darker/brighter than the small-caps param labels. */
630
- --aia-option-color: var(--aia-primitive-neutral-900);
632
+ /* Option text: a softer grey than the parameter label above it. */
633
+ --aia-option-color: var(--aia-primitive-neutral-750);
634
+ --aia-scrollbar-track: rgba(255, 255, 255, 0.08);
635
+ --aia-scrollbar-thumb: rgba(255, 255, 255, 0.28);
631
636
  --aia-option-color-selected: var(--aia-primitive-neutral-1000);
632
637
  --aia-option-font-size: 11.2px;
633
638
 
@@ -955,8 +960,8 @@
955
960
  }
956
961
 
957
962
  /* Floating options box (2026-11). The panel reads as a light sheet under the
958
- text: no footer, only the parameter being asked (sentence case), and "skip"
959
- right after it behind a thin rule \u2014 "Gender | skip". With no footer there is
963
+ text: no footer, only the parameter being asked (sentence case), "skip" at
964
+ the header row's trailing edge, and roomier rows. With no footer there is
960
965
  no band for the rows to slide under, so it is zeroed in every layout.
961
966
  Declared last so it follows every rule that sets the band. Mirrored in all
962
967
  four appearance copies; floatingOptionsParity.test.ts pins them together. */
@@ -993,7 +998,7 @@
993
998
  [data-aia-dropdown] [data-aia-pillbar] [data-aia-pill][data-aia-pill-active] {
994
999
  text-transform: none;
995
1000
  letter-spacing: normal;
996
- font-size: var(--aia-param-label-font-size, 9.45px);
1001
+ font-size: var(--aia-param-label-font-size, 12px);
997
1002
  font-weight: 500;
998
1003
  opacity: 1;
999
1004
  }
@@ -1015,21 +1020,83 @@
1015
1020
  padding-inline: 5.6px;
1016
1021
  font-size: var(--aia-skip-font-size, 9.45px);
1017
1022
  }
1018
- /* After the label, skip sits right beside it ("Gender | skip"). A skip-only
1019
- row (pills shown in the input, so the bar has no label) keeps the base
1020
- auto margin and stays pinned at the trailing edge, with no rule. */
1021
- [data-aia-dropdown] [data-aia-pillbar] [data-aia-pill-scroll] + [data-aia-skip] {
1022
- margin-inline-start: 0;
1023
+ /* Roomier rows: 10.5px above and below each option instead of 5.6px. The
1024
+ row height feeds the visible-rows cap (planOptionsGrid), so it moves with
1025
+ the padding; picture and parameter-line rows add the same padding to their
1026
+ own heights. Tokens on the themed root at zero specificity, like the rest,
1027
+ so a consumer's value wins and the classic block below can restore its own. */
1028
+ :where(.magicx-aia) {
1029
+ --aia-option-padding-block: 10.5px;
1030
+ --aia-option-row-height: calc(14.7px + 2 * var(--aia-option-padding-block));
1031
+ }
1032
+ /* The panel hugs its options (panelHugWidth): as wide as the widest option
1033
+ times the columns, plus the panel's padding and 36px of breathing room,
1034
+ never under the header row (the whole label and "skip") or the minimum,
1035
+ nor over the full width. Desktop only: on a phone the panel keeps the
1036
+ full width. The width is set only on a panel of plain options; pickers and
1037
+ product strips stay full width. The rules below skip optionsStyle:
1038
+ "classic", which keeps the full-width panel, the fitted Done and the
1039
+ chevron. */
1040
+ @media (min-width: 769px) {
1041
+ [data-aia-dropdown][data-aia-hug]:not(:where([data-aia-options-style="classic"] *)) {
1042
+ inset-inline-end: auto;
1043
+ width: clamp(
1044
+ min(var(--aia-panel-min-width, 160px), 100%),
1045
+ var(--aia-panel-fit-width, 100%),
1046
+ 100%
1047
+ );
1048
+ }
1049
+ }
1050
+ /* Done spans the panel, whatever the panel's width. */
1051
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *)) [data-aia-multi-done] {
1052
+ width: var(--aia-multi-done-width, 100%);
1053
+ }
1054
+ /* A long list shows a thin scrollbar on its right edge instead of the
1055
+ "more below" chevron: the same button (scrollArrow.ts), drawn as a 3px
1056
+ rounded thumb on a faint track, placed and sized by the inline
1057
+ --aia-scroll-track-* / --aia-scroll-thumb-* vars. Shown whenever the list
1058
+ overflows (data-aia-scrollable), at the top, mid-scroll and at the end;
1059
+ it takes no clicks, the list scrolls by wheel, touch and keyboard. */
1060
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *)) [data-aia-scroll-arrow] {
1061
+ top: var(--aia-scroll-track-top, 0px);
1062
+ right: var(--aia-scroll-track-right, 0px);
1063
+ bottom: auto;
1064
+ left: auto;
1065
+ width: 3px;
1066
+ height: var(--aia-scroll-track-height, 0px);
1067
+ margin: 0 2px 0 0;
1068
+ border-radius: 3px;
1069
+ background: var(--aia-scrollbar-track, rgba(15, 23, 42, 0.05));
1070
+ pointer-events: none;
1071
+ animation: none;
1072
+ transition: opacity 200ms ease-out;
1073
+ }
1074
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *)) [data-aia-scroll-arrow] svg {
1075
+ display: none;
1023
1076
  }
1024
- [data-aia-dropdown] [data-aia-pillbar] [data-aia-pill-scroll] + [data-aia-skip]::before {
1077
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *))
1078
+ [data-aia-scroll-arrow]::after {
1025
1079
  content: "";
1026
- align-self: center;
1027
- width: 1px;
1028
- height: 0.9em;
1029
- margin-inline-end: 5.6px;
1030
- margin-inline-start: -2.8px;
1031
- background: currentColor;
1032
- opacity: 0.45;
1080
+ position: absolute;
1081
+ top: var(--aia-scroll-thumb-top, 0px);
1082
+ left: 0;
1083
+ width: 100%;
1084
+ height: var(--aia-scroll-thumb-height, 0px);
1085
+ border-radius: 3px;
1086
+ background: var(--aia-scrollbar-thumb, rgba(15, 23, 42, 0.22));
1087
+ }
1088
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *))
1089
+ [data-aia-scroll-arrow][data-aia-visible] {
1090
+ pointer-events: none;
1091
+ opacity: 0;
1092
+ }
1093
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *))
1094
+ [data-aia-scroll-arrow][data-aia-scrollable] {
1095
+ opacity: 1;
1096
+ }
1097
+ /* Room between the last row and Done, so the last line reads clear of it. */
1098
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *)) [data-aia-multi-actions] {
1099
+ padding-top: 14px;
1033
1100
  }
1034
1101
  /* End floating options box. */
1035
1102
 
@@ -1048,6 +1115,10 @@
1048
1115
  :where([data-aia-options-style="classic"] .magicx-aia[data-mode="light"]) {
1049
1116
  --aia-dropdown-border: var(--aia-primitive-neutral-900-a50);
1050
1117
  --aia-option-font-size: 16px;
1118
+ /* Full-size rows with classic's own 8px padding. The first two selectors
1119
+ match in dark mode too, so the rows hold in both. */
1120
+ --aia-option-padding-block: 8px;
1121
+ --aia-option-row-height: 37px;
1051
1122
  }
1052
1123
  :where(.magicx-aia[data-aia-options-style="classic"][data-mode="dark"]),
1053
1124
  :where([data-aia-options-style="classic"] .magicx-aia[data-mode="dark"]) {
@@ -1083,20 +1154,6 @@
1083
1154
  padding-inline: 8px;
1084
1155
  font-size: var(--aia-skip-font-size, 13.5px);
1085
1156
  }
1086
- :where([data-aia-options-style="classic"])
1087
- [data-aia-dropdown]
1088
- [data-aia-pillbar]
1089
- [data-aia-pill-scroll]
1090
- + [data-aia-skip]::before {
1091
- margin-inline-end: 8px;
1092
- margin-inline-start: -4px;
1093
- }
1094
-
1095
- /* Classic options box: full-size rows. On the element carrying the
1096
- attribute, at zero specificity, so a value the consumer sets wins. */
1097
- :where([data-aia-options-style="classic"]) {
1098
- --aia-option-row-height: 37px;
1099
- }
1100
1157
  `,document.head.appendChild(e)}if(typeof document<"u"&&!document.getElementById("ac-style-3819c762")){let e=document.createElement("style");e.id="ac-style-3819c762",e.textContent=`.aia-dropdown-yz2KC {
1101
1158
  position: absolute;
1102
1159
  left: 0;
@@ -1353,7 +1410,8 @@
1353
1410
  white-space: nowrap;
1354
1411
  transition:
1355
1412
  color 150ms ease-out,
1356
- background-color 150ms ease-out;
1413
+ background-color 150ms ease-out,
1414
+ opacity 160ms ease-out;
1357
1415
  }
1358
1416
 
1359
1417
  .aia-skip-7-olS:hover {
@@ -1364,63 +1422,30 @@
1364
1422
  background: var(--aia-skip-hover-bg, var(--aia-option-bg, transparent));
1365
1423
  }
1366
1424
 
1425
+ /* Disabled while a request is in flight (and in the press window after a
1426
+ pick, which always starts one): it fades out with the options and back in
1427
+ when the response lands. */
1367
1428
  .aia-skip-7-olS:disabled {
1368
1429
  pointer-events: none;
1369
1430
  cursor: default;
1370
- opacity: 0.5;
1431
+ /* 0.01, never 0: iOS reads exactly 0 as hidden, and this button is
1432
+ re-enabled in place, so a tap in flight would be cancelled. */
1433
+ opacity: 0.01;
1371
1434
  }
1372
1435
 
1373
- /* --- Fallback loading skeleton (only when no pills/options are cached) --- */
1436
+ /* --- Fallback loading space (only when no pills/options are cached) ---
1437
+ Holds the box's height while a request is in flight; nothing is drawn. */
1374
1438
  .aia-skeletonBars-HVr9C {
1375
1439
  display: flex;
1376
1440
  flex-direction: column;
1377
1441
  gap: 20px;
1378
1442
  padding: 7px 8px;
1379
- animation: aia-skeletonBarsIn-BdPrL 100ms ease-out;
1380
- }
1381
-
1382
- /* Fades out with the option skeleton \u2014 see SuggestionItem.module.css. */
1383
- .aia-dropdown-yz2KC[data-aia-skeleton-exiting] .aia-skeletonBars-HVr9C {
1384
- animation: aia-skeletonBarsOut-TqKeD 100ms ease-in forwards;
1385
- }
1386
-
1387
- @keyframes aia-skeletonBarsOut-TqKeD {
1388
- to {
1389
- opacity: 0;
1390
- }
1391
- }
1392
-
1393
- @keyframes aia-skeletonBarsIn-BdPrL {
1394
- from {
1395
- opacity: 0;
1396
- }
1443
+ visibility: hidden;
1397
1444
  }
1398
1445
 
1399
1446
  .aia-skeletonBar-O3xIx {
1400
1447
  display: block;
1401
1448
  height: 14px;
1402
- border-radius: 999px;
1403
- background: var(--aia-skeleton-bg, var(--aia-pill-bg, rgba(189, 189, 189, 0.25)));
1404
- opacity: 0.5;
1405
- animation: aia-aiaSkeletonPulse-G8W7q 1.4s ease-in-out infinite;
1406
- }
1407
-
1408
- .aia-skeletonBar-O3xIx:nth-child(2) {
1409
- animation-delay: 150ms;
1410
- }
1411
-
1412
- .aia-skeletonBar-O3xIx:nth-child(3) {
1413
- animation-delay: 300ms;
1414
- }
1415
-
1416
- @keyframes aia-aiaSkeletonPulse-G8W7q {
1417
- 0%,
1418
- 100% {
1419
- opacity: 0.5;
1420
- }
1421
- 50% {
1422
- opacity: 0.25;
1423
- }
1424
1449
  }
1425
1450
 
1426
1451
  /* A picker with its own Done button (multi-select, time wheel) ends on that
@@ -1509,7 +1534,7 @@
1509
1534
  transition-delay: 0s;
1510
1535
  }
1511
1536
  }
1512
- `,document.head.appendChild(e)}var Me={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q",multiDone:"aia-multiDone-y12U7"};var Z=require("@magicx-eng/ai-autocomplete-vanilla"),Vt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1537
+ `,document.head.appendChild(e)}var Ne={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"};var X=require("@magicx-eng/ai-autocomplete-vanilla"),Vt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1513
1538
 
1514
1539
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1515
1540
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1696,7 +1721,7 @@
1696
1721
  opacity: 0.8;
1697
1722
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1698
1723
  }
1699
- `,document.head.appendChild(e)}var $={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var be=require("react/jsx-runtime"),La=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ut({options:e,activeIndex:a,listboxId:t,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:d,onPreviousMonth:m,onNextMonth:v}){let k=(0,Z.isoDate)(new Date),f=(0,Z.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,Z.cellIso)(e[a]),selected:o.selectedRange,floor:o.floor});return(0,be.jsxs)("div",{className:$.datepicker,"data-aia-datepicker":"",children:[(0,be.jsxs)("div",{className:$.header,children:[(0,be.jsx)("button",{type:"button",tabIndex:-1,className:$.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:m,children:"\u2039"}),(0,be.jsx)("span",{className:$.month,"data-aia-date-month":"","aria-live":"polite",children:(0,Z.monthLabel)(i)}),(0,be.jsx)("button",{type:"button",tabIndex:-1,className:$.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:v,children:"\u203A"})]}),(0,be.jsx)("div",{className:$.weekdays,"aria-hidden":"true",children:Z.WEEKDAY_LABELS.map((p,u)=>(0,be.jsx)("span",{className:$.weekday,children:p},La[u]))}),(0,be.jsx)("div",{className:$.grid,"data-aia-date-grid":"",children:e.map((p,u)=>(0,be.jsx)(za,{option:p,id:`${t}-option-${u}`,index:u,isHighlighted:u===a&&p.is_tappable,isToday:(0,Z.cellIso)(p)===k,isPast:(0,Z.isDimmedDay)((0,Z.cellIso)(p),k,o.floor),marks:(0,Z.dateCellMarks)((0,Z.cellIso)(p),{selectedIso:o.selectedIso,range:f}),onSelect:s,onHighlight:r,onUnhighlight:d},(0,Z.cellIso)(p)??`pad-${u}`))})]})}function za({option:e,id:a,index:t,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:d,onHighlight:m,onUnhighlight:v}){let[k,f]=(0,Vt.useState)(!1),p=(0,Z.cellDay)(e);if(p==null)return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${$.cell} ${$.blank}`});let u=()=>{f(!0),d(e),setTimeout(()=>f(!1),170)},x=[$.cell,$.day,s?$.past:"",i?$.highlighted:"",o?$.today:"",r.inRange?$.inRange:"",r.selected?$.selected:"",k?$.pressed:""].filter(Boolean).join(" ");return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:x,onClick:u,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),u())},onMouseEnter:()=>m(t),onMouseLeave:v?()=>v(t):void 0,children:(0,be.jsx)("span",{className:$.number,children:p})})}var Je=require("@magicx-eng/ai-autocomplete-vanilla"),yt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
1724
+ `,document.head.appendChild(e)}var Z={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var be=require("react/jsx-runtime"),La=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ut({options:e,activeIndex:a,listboxId:t,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:d,onPreviousMonth:m,onNextMonth:v}){let C=(0,X.isoDate)(new Date),f=(0,X.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,X.cellIso)(e[a]),selected:o.selectedRange,floor:o.floor});return(0,be.jsxs)("div",{className:Z.datepicker,"data-aia-datepicker":"",children:[(0,be.jsxs)("div",{className:Z.header,children:[(0,be.jsx)("button",{type:"button",tabIndex:-1,className:Z.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:m,children:"\u2039"}),(0,be.jsx)("span",{className:Z.month,"data-aia-date-month":"","aria-live":"polite",children:(0,X.monthLabel)(i)}),(0,be.jsx)("button",{type:"button",tabIndex:-1,className:Z.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:v,children:"\u203A"})]}),(0,be.jsx)("div",{className:Z.weekdays,"aria-hidden":"true",children:X.WEEKDAY_LABELS.map((p,u)=>(0,be.jsx)("span",{className:Z.weekday,children:p},La[u]))}),(0,be.jsx)("div",{className:Z.grid,"data-aia-date-grid":"",children:e.map((p,u)=>(0,be.jsx)(za,{option:p,id:`${t}-option-${u}`,index:u,isHighlighted:u===a&&p.is_tappable,isToday:(0,X.cellIso)(p)===C,isPast:(0,X.isDimmedDay)((0,X.cellIso)(p),C,o.floor),marks:(0,X.dateCellMarks)((0,X.cellIso)(p),{selectedIso:o.selectedIso,range:f}),onSelect:s,onHighlight:r,onUnhighlight:d},(0,X.cellIso)(p)??`pad-${u}`))})]})}function za({option:e,id:a,index:t,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:d,onHighlight:m,onUnhighlight:v}){let[C,f]=(0,Vt.useState)(!1),p=(0,X.cellDay)(e);if(p==null)return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${Z.cell} ${Z.blank}`});let u=()=>{f(!0),d(e),setTimeout(()=>f(!1),170)},x=[Z.cell,Z.day,s?Z.past:"",i?Z.highlighted:"",o?Z.today:"",r.inRange?Z.inRange:"",r.selected?Z.selected:"",C?Z.pressed:""].filter(Boolean).join(" ");return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:x,onClick:u,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),u())},onMouseEnter:()=>m(t),onMouseLeave:v?()=>v(t):void 0,children:(0,be.jsx)("span",{className:Z.number,children:p})})}var Je=require("@magicx-eng/ai-autocomplete-vanilla"),yt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
1700
1725
  display: flex;
1701
1726
  flex-wrap: wrap;
1702
1727
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1883,7 +1908,7 @@
1883
1908
  justify-content: flex-end;
1884
1909
  }
1885
1910
  }
1886
- `,document.head.appendChild(e)}var _e={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var Ne=require("react/jsx-runtime");function Yt({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,Je.uiStringsFor)()}){let{key:i,hint:o}=(0,Je.getFooterHint)(e,a,t),[s,r]=(0,yt.useState)(Je.ATTRIBUTION_URL);return(0,yt.useEffect)(()=>{r((0,Je.buildAttributionUrl)())},[]),(0,Ne.jsx)("footer",{className:_e.footer,"data-aia-footer":"",children:(0,Ne.jsxs)(ft,{justify:"between",noWrap:!0,className:_e.row,children:[(0,Ne.jsxs)(ft,{gap:"5px",className:_e.hintGroup,children:[(0,Ne.jsx)("kbd",{className:_e.key,children:i}),(0,Ne.jsx)("span",{className:_e.hint,children:o})]}),(0,Ne.jsxs)("a",{className:_e.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,Ne.jsx)("span",{className:_e.brand,children:"AI"}),(0,Ne.jsx)("span",{className:_e.badge,children:"Autocomplete"})]})]})})}var ne=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
1911
+ `,document.head.appendChild(e)}var _e={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var He=require("react/jsx-runtime");function Yt({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,Je.uiStringsFor)()}){let{key:i,hint:o}=(0,Je.getFooterHint)(e,a,t),[s,r]=(0,yt.useState)(Je.ATTRIBUTION_URL);return(0,yt.useEffect)(()=>{r((0,Je.buildAttributionUrl)())},[]),(0,He.jsx)("footer",{className:_e.footer,"data-aia-footer":"",children:(0,He.jsxs)(ft,{justify:"between",noWrap:!0,className:_e.row,children:[(0,He.jsxs)(ft,{gap:"5px",className:_e.hintGroup,children:[(0,He.jsx)("kbd",{className:_e.key,children:i}),(0,He.jsx)("span",{className:_e.hint,children:o})]}),(0,He.jsxs)("a",{className:_e.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,He.jsx)("span",{className:_e.brand,children:"AI"}),(0,He.jsx)("span",{className:_e.badge,children:"Autocomplete"})]})]})})}var re=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
1887
1912
  Angular copy). The three are kept identical by
1888
1913
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
1889
1914
  .aia-location-6-fsr {
@@ -2017,7 +2042,7 @@
2017
2042
  .aia-loadingBar-OLCr4:nth-child(3) {
2018
2043
  width: 60%;
2019
2044
  }
2020
- `,document.head.appendChild(e)}var X={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};var W=require("react/jsx-runtime"),Da=0;function bt(e){return e.getRootNode().activeElement??null}function $t(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Qt(e){if(!e.isContentEditable)return null;let a=$t(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function jt(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=$t(e);if(!t)return;let i=a;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}var Ma=(0,W.jsxs)("svg",{className:X.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,W.jsx)("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),(0,W.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Na=(0,W.jsxs)("svg",{className:X.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,W.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,W.jsx)("path",{d:"m20 20-3.5-3.5"})]});function Zt({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:d=!0,onQuery:m,onMove:v,onCommit:k,onFocusChange:f}){let p=(0,ne.useRef)(null),u=(0,ne.useRef)(null),x=(0,ne.useRef)(null),A=(0,ne.useRef)(null),q=(0,ne.useRef)(null),H=(0,ne.useRef)(!1),N=(0,ne.useRef)(!1),ae=(0,ne.useRef)(!1),O=(0,ne.useRef)(!1),F=(0,ne.useRef)(o);F.current=o;let T=(0,ne.useRef)(f);T.current=f;let Y=c=>{O.current=c,f(c)},ie=()=>{let c=p.current;return c!=null&&bt(c)===c},ce=()=>{let c=u.current;if(!c)return;let E=bt(c);E instanceof HTMLElement&&E!==p.current&&E!==document.body&&!c.contains(E)&&(A.current=E,q.current=Qt(E))},ee=c=>{let E=u.current;!E||!(c instanceof HTMLElement)||c===A.current||c===document.body||E.contains(c)||(A.current=c,q.current=Qt(c))},te=(0,ne.useRef)(null);te.current===null&&(te.current=`aia-location-${++Da}`);let P=`${te.current}-row-`;(0,ne.useEffect)(()=>{let c=p.current;c&&c.value!==e.query&&bt(c)!==c&&(c.value=e.query)},[e.query]),(0,ne.useEffect)(()=>{o&&(s&&!ae.current&&(N.current=!1),ae.current=s);let c=p.current;if(c){if(!r&&ie()){N.current=!0,Q();return}if(!o){setTimeout(()=>{if(F.current)return;let E=A.current;E&&bt(E)===E||(N.current=!1)},0);return}if(!(!s||N.current||!d||ie())){if(ce(),Y(!0),c.focus({preventScroll:!0}),!ie()){N.current=!0,Y(!1);return}c.value&&c.select()}}}),(0,ne.useLayoutEffect)(()=>()=>{if(!O.current)return;let c=p.current,E=A.current;E?.isConnected&&c&&bt(c)===c&&(H.current=!0,jt(E,q.current),H.current=!1),O.current=!1,T.current(!1)},[]);let Q=(c=!1)=>{c&&(N.current=!0);let E=A.current;E?.isConnected&&ie()&&(H.current=!0,jt(E,q.current),H.current=!1),Y(!1)},Ae=e.query.trim(),ke=e.highlighted>=0&&e.highlighted<e.places.length?`${P}${e.highlighted}`:void 0,ve=null;return e.places.length>0?ve=e.places.map((c,E)=>(0,W.jsxs)("div",{id:`${P}${E}`,role:"option","aria-selected":E===e.highlighted,className:E===e.highlighted?`${X.row} ${X.highlighted}`:X.row,"data-aia-location-row":"","data-aia-index":E,onClick:()=>{d&&(Q(!0),k(E))},children:[(0,W.jsx)("span",{className:X.pin,children:Ma}),(0,W.jsxs)("span",{className:X.text,children:[(0,W.jsx)("span",{className:X.name,children:c.name}),c.secondary&&(0,W.jsx)("span",{className:X.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?ve=(0,W.jsxs)("div",{className:X.loading,"data-aia-location-loading":"",children:[(0,W.jsx)("span",{className:X.loadingBar}),(0,W.jsx)("span",{className:X.loadingBar}),(0,W.jsx)("span",{className:X.loadingBar})]}):Ae&&(ve=(0,W.jsxs)("div",{className:X.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,W.jsx)("span",{className:X.empty,children:t}),(0,W.jsx)("span",{children:i})]})),(0,W.jsxs)("div",{ref:u,className:X.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),ce(),Y(!0))},children:[(0,W.jsxs)("label",{ref:x,className:X.field,children:[Na,(0,W.jsx)("input",{ref:p,type:"text",className:X.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":ke,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>m(c.target.value),onFocus:c=>{ee(c.relatedTarget),Y(!0)},onBlur:()=>{H.current||(N.current=!0,Y(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!d)return;Q(!0),k();return;case"Escape":c.preventDefault(),c.stopPropagation(),N.current=!0,Q();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),N.current=!0,Q();return}}})]}),(0,W.jsx)("div",{className:X.results,"data-aia-location-results":"","aria-live":"polite",children:ve})]})}var kt=require("@magicx-eng/ai-autocomplete-vanilla");var Xt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
2045
+ `,document.head.appendChild(e)}var J={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};var K=require("react/jsx-runtime"),Da=0;function bt(e){return e.getRootNode().activeElement??null}function $t(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Qt(e){if(!e.isContentEditable)return null;let a=$t(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function jt(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=$t(e);if(!t)return;let i=a;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}var Ma=(0,K.jsxs)("svg",{className:J.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,K.jsx)("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),(0,K.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Na=(0,K.jsxs)("svg",{className:J.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,K.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,K.jsx)("path",{d:"m20 20-3.5-3.5"})]});function Zt({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:d=!0,onQuery:m,onMove:v,onCommit:C,onFocusChange:f}){let p=(0,re.useRef)(null),u=(0,re.useRef)(null),x=(0,re.useRef)(null),R=(0,re.useRef)(null),_=(0,re.useRef)(null),F=(0,re.useRef)(!1),H=(0,re.useRef)(!1),ie=(0,re.useRef)(!1),E=(0,re.useRef)(!1),M=(0,re.useRef)(o);M.current=o;let T=(0,re.useRef)(f);T.current=f;let G=c=>{E.current=c,f(c)},oe=()=>{let c=p.current;return c!=null&&bt(c)===c},ce=()=>{let c=u.current;if(!c)return;let A=bt(c);A instanceof HTMLElement&&A!==p.current&&A!==document.body&&!c.contains(A)&&(R.current=A,_.current=Qt(A))},te=c=>{let A=u.current;!A||!(c instanceof HTMLElement)||c===R.current||c===document.body||A.contains(c)||(R.current=c,_.current=Qt(c))},ae=(0,re.useRef)(null);ae.current===null&&(ae.current=`aia-location-${++Da}`);let P=`${ae.current}-row-`;(0,re.useEffect)(()=>{let c=p.current;c&&c.value!==e.query&&bt(c)!==c&&(c.value=e.query)},[e.query]),(0,re.useEffect)(()=>{o&&(s&&!ie.current&&(H.current=!1),ie.current=s);let c=p.current;if(c){if(!r&&oe()){H.current=!0,j();return}if(!o){setTimeout(()=>{if(M.current)return;let A=R.current;A&&bt(A)===A||(H.current=!1)},0);return}if(!(!s||H.current||!d||oe())){if(ce(),G(!0),c.focus({preventScroll:!0}),!oe()){H.current=!0,G(!1);return}c.value&&c.select()}}}),(0,re.useLayoutEffect)(()=>()=>{if(!E.current)return;let c=p.current,A=R.current;A?.isConnected&&c&&bt(c)===c&&(F.current=!0,jt(A,_.current),F.current=!1),E.current=!1,T.current(!1)},[]);let j=(c=!1)=>{c&&(H.current=!0);let A=R.current;A?.isConnected&&oe()&&(F.current=!0,jt(A,_.current),F.current=!1),G(!1)},Re=e.query.trim(),ke=e.highlighted>=0&&e.highlighted<e.places.length?`${P}${e.highlighted}`:void 0,ve=null;return e.places.length>0?ve=e.places.map((c,A)=>(0,K.jsxs)("div",{id:`${P}${A}`,role:"option","aria-selected":A===e.highlighted,className:A===e.highlighted?`${J.row} ${J.highlighted}`:J.row,"data-aia-location-row":"","data-aia-index":A,onClick:()=>{d&&(j(!0),C(A))},children:[(0,K.jsx)("span",{className:J.pin,children:Ma}),(0,K.jsxs)("span",{className:J.text,children:[(0,K.jsx)("span",{className:J.name,children:c.name}),c.secondary&&(0,K.jsx)("span",{className:J.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?ve=(0,K.jsxs)("div",{className:J.loading,"data-aia-location-loading":"",children:[(0,K.jsx)("span",{className:J.loadingBar}),(0,K.jsx)("span",{className:J.loadingBar}),(0,K.jsx)("span",{className:J.loadingBar})]}):Re&&(ve=(0,K.jsxs)("div",{className:J.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,K.jsx)("span",{className:J.empty,children:t}),(0,K.jsx)("span",{children:i})]})),(0,K.jsxs)("div",{ref:u,className:J.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),ce(),G(!0))},children:[(0,K.jsxs)("label",{ref:x,className:J.field,children:[Na,(0,K.jsx)("input",{ref:p,type:"text",className:J.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":ke,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>m(c.target.value),onFocus:c=>{te(c.relatedTarget),G(!0)},onBlur:()=>{F.current||(H.current=!0,G(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!d)return;j(!0),C();return;case"Escape":c.preventDefault(),c.stopPropagation(),H.current=!0,j();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),H.current=!0,j();return}}})]}),(0,K.jsx)("div",{className:J.results,"data-aia-location-results":"","aria-live":"polite",children:ve})]})}var kt=require("@magicx-eng/ai-autocomplete-vanilla");var Xt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
2021
2046
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
2022
2047
  The border is kept as a 1px transparent line so the box stays the same size
2023
2048
  as it was when the outline was dashed. */
@@ -2096,11 +2121,6 @@
2096
2121
  animation-name: aia-smartSuggestion-sparkle-small-3VsWJ;
2097
2122
  }
2098
2123
 
2099
- .aia-skeleton-57P0T .aia-smartText-R0cfw,
2100
- .aia-skeleton-57P0T .aia-smartSparkle-IVabG {
2101
- visibility: hidden;
2102
- }
2103
-
2104
2124
  @keyframes aia-smartSuggestion-shimmer-F-yoD {
2105
2125
  0% {
2106
2126
  background-position: 100% 0;
@@ -2154,44 +2174,24 @@
2154
2174
  }
2155
2175
  }
2156
2176
 
2157
- /* Loading skeleton \u2014 preserves the pill's exact box (same width and height)
2158
- and hides the text. The base pill is now transparent, so fill the interior
2159
- with the skeleton color (inside the dashed border) and pulse it so it still
2160
- reads as a loading chip. */
2177
+ /* Loading \u2014 a pill kept from the last response fades out while the next one
2178
+ is fetched; a placeholder pill (no cached pills) only holds its space. */
2161
2179
  .aia-skeleton-57P0T {
2162
2180
  pointer-events: none;
2163
2181
  cursor: default;
2164
- color: transparent;
2165
- background: var(--aia-skeleton-bg, var(--aia-pill-bg, rgba(189, 189, 189, 0.25)));
2166
- animation:
2167
- aia-skeletonIn-54kMv 100ms ease-out,
2168
- aia-skeletonPulse-xGcUy 1.4s ease-in-out infinite;
2182
+ animation: aia-loadingOut-Aj9xO 160ms ease-in forwards;
2169
2183
  }
2170
2184
 
2171
- /* Fades out with the option skeleton \u2014 see SuggestionItem.module.css. */
2172
- [data-aia-skeleton-exiting] .aia-skeleton-57P0T {
2173
- animation: aia-skeletonOut-1sJ-r 100ms ease-in forwards;
2174
- }
2175
-
2176
- @keyframes aia-skeletonIn-54kMv {
2177
- from {
2178
- opacity: 0;
2179
- }
2185
+ .aia-skeleton-57P0T[data-aia-pill-skeleton] {
2186
+ visibility: hidden;
2187
+ animation: none;
2180
2188
  }
2181
2189
 
2182
- @keyframes aia-skeletonOut-1sJ-r {
2190
+ /* Ends a hair above zero, like magicx-aia-fadeIn starts: a pill kept by key
2191
+ is re-enabled in place, and iOS cancels a tap on an element leaving 0. */
2192
+ @keyframes aia-loadingOut-Aj9xO {
2183
2193
  to {
2184
- opacity: 0;
2185
- }
2186
- }
2187
-
2188
- @keyframes aia-skeletonPulse-xGcUy {
2189
- 0%,
2190
- 100% {
2191
- filter: brightness(1);
2192
- }
2193
- 50% {
2194
- filter: brightness(0.55);
2194
+ opacity: 0.01;
2195
2195
  }
2196
2196
  }
2197
2197
 
@@ -2200,7 +2200,7 @@
2200
2200
  opacity: 0;
2201
2201
  }
2202
2202
  }
2203
- `,document.head.appendChild(e)}var Fe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var et=require("react/jsx-runtime"),zt={selected:1,first:.7,next:.4,last:.2};function Jt({label:e,state:a,active:t,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:d}){let m=[Fe.pill,i?Fe.rounded:"",o?Fe.skeleton:""].filter(Boolean).join(" ");return(0,et.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:m,style:{"--aia-pill-opacity":zt[a]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:d,disabled:o,children:s?(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)("span",{className:`${Fe.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,et.jsx)("span",{className:`${Fe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Xt.SMART_SUGGESTION_SPARKLE_SVG}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
2203
+ `,document.head.appendChild(e)}var Fe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};var et=require("react/jsx-runtime"),zt={selected:1,first:.7,next:.4,last:.2};function Jt({label:e,state:a,active:t,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:d}){let m=[Fe.pill,i?Fe.rounded:"",o?Fe.skeleton:""].filter(Boolean).join(" ");return(0,et.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:m,style:{"--aia-pill-opacity":zt[a]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:d,disabled:o,children:s?(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)("span",{className:`${Fe.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,et.jsx)("span",{className:`${Fe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Xt.SMART_SUGGESTION_SPARKLE_SVG}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
2204
2204
  position: relative;
2205
2205
  z-index: 1;
2206
2206
  pointer-events: auto;
@@ -2210,7 +2210,7 @@
2210
2210
  align-items: center;
2211
2211
  vertical-align: middle;
2212
2212
  }
2213
- `,document.head.appendChild(e)}var Dt={list:"aia-list-qvLqO"};var wt=require("react/jsx-runtime"),Fa=[125,69];function ea(e){return e===0?"first":e===1?"next":"last"}function Ct({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":"",children:Fa.map((r,d)=>(0,wt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Fe.pill} ${o?Fe.rounded:""} ${Fe.skeleton}`,style:{width:r,"--aia-pill-opacity":zt[ea(d)]}},`skel-${r}`))}):(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,d)=>{let m=!!i&&d===a;return(0,wt.jsx)(Jt,{label:r.text,state:m?"selected":ea(d),selected:m,active:d===a,rounded:o,loading:s,smartSuggestion:(0,kt.isSmartSuggestion)(r),completionHeader:(0,kt.isTraditionalAutocompleteSuggestion)(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}var xe=require("@magicx-eng/ai-autocomplete-vanilla"),we=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
2213
+ `,document.head.appendChild(e)}var Dt={list:"aia-list-qvLqO"};var wt=require("react/jsx-runtime"),Ha=[125,69];function ea(e){return e===0?"first":e===1?"next":"last"}function Ct({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":"",children:Ha.map((r,d)=>(0,wt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Fe.pill} ${o?Fe.rounded:""} ${Fe.skeleton}`,style:{width:r,"--aia-pill-opacity":zt[ea(d)]}},`skel-${r}`))}):(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,d)=>{let m=!!i&&d===a;return(0,wt.jsx)(Jt,{label:r.text,state:m?"selected":ea(d),selected:m,active:d===a,rounded:o,loading:s,smartSuggestion:(0,kt.isSmartSuggestion)(r),completionHeader:(0,kt.isTraditionalAutocompleteSuggestion)(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}var xe=require("@magicx-eng/ai-autocomplete-vanilla"),we=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
2214
2214
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
2215
2215
  theming one package sees the same result in the other.
2216
2216
 
@@ -2779,7 +2779,7 @@
2779
2779
  .aia-card-JBGYT[data-aia-product-has-cart] {
2780
2780
  padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
2781
2781
  }
2782
- `,document.head.appendChild(e)}var J={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr"};var G=require("react/jsx-runtime");function ta({products:e,listboxId:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s=!0,layout:r="row",imageFallback:d="image",strings:m=(0,xe.uiStringsFor)()}){let v=e.length>0,k=(0,we.useRef)(null);if((0,we.useEffect)(()=>{let p=k.current;if(!(!v||!p))return(0,xe.attachProductRowWheel)(p)},[v]),!v)return null;let f=`${a}-products-label`;return(0,G.jsxs)("section",{className:J.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":f,children:[(0,G.jsx)("div",{className:J.label,id:f,"data-aia-products-label":"",children:m.products}),(0,G.jsx)("div",{ref:k,className:J.row,"data-aia-products-row":"",children:e.map((p,u)=>(0,G.jsx)(Ha,{product:p,id:`${a}-product-${u}`,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:d,soldOut:m.soldOut,addToCart:m.addToCart},p.id))})]})}function Ha({product:e,id:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:r,soldOut:d,addToCart:m}){let v=!!i&&e.available!==!1,[k,f]=(0,we.useState)(null),p=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},u=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),t(e))};return(0,G.jsxs)("a",{id:a,className:J.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:k?{"--aia-product-photo-fill-x":String(k.x),"--aia-product-photo-fill-y":String(k.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:u,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:p,children:[(0,G.jsx)(Wa,{sources:(0,xe.productImageSources)(e.imageUrl),title:e.title,fallback:r,onPhotoFill:f},(0,xe.productImageSrc)(e.imageUrl)??""),(0,G.jsxs)("span",{className:J.body,children:[e.vendor?(0,G.jsx)("span",{className:J.vendor,children:e.vendor}):null,(0,G.jsx)("span",{className:J.title,children:e.title}),e.price?(0,G.jsxs)("span",{className:J.price,children:[e.price,e.compareAtPrice?(0,G.jsx)("s",{className:J.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,G.jsx)("span",{className:J.badge,children:d}):null]}),v&&i?(0,G.jsx)(Ga,{product:e,label:`${m}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>o?.(!0),onBlur:p},Ba(e)):null]})}function Ba(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function Ga({product:e,label:a,focusable:t,onAddToCart:i,onFocus:o,onBlur:s}){let[r,d]=(0,we.useState)(null),m=(0,we.useRef)(null),v=(0,we.useRef)(e);v.current=e;let k=(0,we.useRef)(!0);(0,we.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let f=u=>{m.current=u,k.current&&d(u)},p=u=>{if(u.preventDefault(),u.stopPropagation(),m.current==="adding")return;f("adding");let x;try{x=Promise.resolve(i(v.current))}catch(A){x=Promise.reject(A)}x.then(()=>f("added"),()=>f(null))};return(0,G.jsx)("span",{className:J.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:p,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||p(u)},onFocus:u=>{u.stopPropagation(),o()},onBlur:u=>{u.stopPropagation(),s(u)},children:(0,G.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,G.jsx)("path",{className:J.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),(0,G.jsx)("path",{className:J.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,G.jsx)("path",{className:J.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,G.jsx)("path",{className:J.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,G.jsx)("circle",{className:J.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,G.jsx)("circle",{className:J.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Wa({sources:e,title:a,fallback:t,onPhotoFill:i}){let[o,s]=(0,we.useState)(0),r=e[o],d=!!r,[m,v]=(0,we.useState)(null),k=!d&&t==="initial";return(0,we.useEffect)(()=>()=>i(null),[i]),(0,G.jsxs)("span",{className:J.media,"aria-hidden":"true","data-aia-product-placeholder":!d&&!k?"":void 0,"data-aia-product-initial":k?"":void 0,"data-aia-image-loaded":d&&m===r?"":void 0,children:[d?(0,G.jsx)("img",{className:J.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:f=>{v(r),i((0,xe.productPhotoFill)(f.currentTarget.naturalWidth,f.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(f=>f+1)}}):null,k?(0,xe.productInitial)(a):null]})}var le=require("@magicx-eng/ai-autocomplete-vanilla"),He=require("react");var aa=require("@magicx-eng/ai-autocomplete-vanilla"),St=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2782
+ `,document.head.appendChild(e)}var ee={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr"};var W=require("react/jsx-runtime");function ta({products:e,listboxId:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s=!0,layout:r="row",imageFallback:d="image",strings:m=(0,xe.uiStringsFor)()}){let v=e.length>0,C=(0,we.useRef)(null);if((0,we.useEffect)(()=>{let p=C.current;if(!(!v||!p))return(0,xe.attachProductRowWheel)(p)},[v]),!v)return null;let f=`${a}-products-label`;return(0,W.jsxs)("section",{className:ee.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":f,children:[(0,W.jsx)("div",{className:ee.label,id:f,"data-aia-products-label":"",children:m.products}),(0,W.jsx)("div",{ref:C,className:ee.row,"data-aia-products-row":"",children:e.map((p,u)=>(0,W.jsx)(Fa,{product:p,id:`${a}-product-${u}`,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:d,soldOut:m.soldOut,addToCart:m.addToCart},p.id))})]})}function Fa({product:e,id:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:r,soldOut:d,addToCart:m}){let v=!!i&&e.available!==!1,[C,f]=(0,we.useState)(null),p=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},u=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),t(e))};return(0,W.jsxs)("a",{id:a,className:ee.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:C?{"--aia-product-photo-fill-x":String(C.x),"--aia-product-photo-fill-y":String(C.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:u,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:p,children:[(0,W.jsx)(Ga,{sources:(0,xe.productImageSources)(e.imageUrl),title:e.title,fallback:r,onPhotoFill:f},(0,xe.productImageSrc)(e.imageUrl)??""),(0,W.jsxs)("span",{className:ee.body,children:[e.vendor?(0,W.jsx)("span",{className:ee.vendor,children:e.vendor}):null,(0,W.jsx)("span",{className:ee.title,children:e.title}),e.price?(0,W.jsxs)("span",{className:ee.price,children:[e.price,e.compareAtPrice?(0,W.jsx)("s",{className:ee.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,W.jsx)("span",{className:ee.badge,children:d}):null]}),v&&i?(0,W.jsx)(Wa,{product:e,label:`${m}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>o?.(!0),onBlur:p},Ba(e)):null]})}function Ba(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function Wa({product:e,label:a,focusable:t,onAddToCart:i,onFocus:o,onBlur:s}){let[r,d]=(0,we.useState)(null),m=(0,we.useRef)(null),v=(0,we.useRef)(e);v.current=e;let C=(0,we.useRef)(!0);(0,we.useEffect)(()=>(C.current=!0,()=>{C.current=!1}),[]);let f=u=>{m.current=u,C.current&&d(u)},p=u=>{if(u.preventDefault(),u.stopPropagation(),m.current==="adding")return;f("adding");let x;try{x=Promise.resolve(i(v.current))}catch(R){x=Promise.reject(R)}x.then(()=>f("added"),()=>f(null))};return(0,W.jsx)("span",{className:ee.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:p,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||p(u)},onFocus:u=>{u.stopPropagation(),o()},onBlur:u=>{u.stopPropagation(),s(u)},children:(0,W.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,W.jsx)("path",{className:ee.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),(0,W.jsx)("path",{className:ee.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,W.jsx)("path",{className:ee.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,W.jsx)("path",{className:ee.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,W.jsx)("circle",{className:ee.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,W.jsx)("circle",{className:ee.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ga({sources:e,title:a,fallback:t,onPhotoFill:i}){let[o,s]=(0,we.useState)(0),r=e[o],d=!!r,[m,v]=(0,we.useState)(null),C=!d&&t==="initial";return(0,we.useEffect)(()=>()=>i(null),[i]),(0,W.jsxs)("span",{className:ee.media,"aria-hidden":"true","data-aia-product-placeholder":!d&&!C?"":void 0,"data-aia-product-initial":C?"":void 0,"data-aia-image-loaded":d&&m===r?"":void 0,children:[d?(0,W.jsx)("img",{className:ee.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:f=>{v(r),i((0,xe.productPhotoFill)(f.currentTarget.naturalWidth,f.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(f=>f+1)}}):null,C?(0,xe.productInitial)(a):null]})}var V=require("@magicx-eng/ai-autocomplete-vanilla"),Pe=require("react");var aa=require("@magicx-eng/ai-autocomplete-vanilla"),St=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2783
2783
  display: grid;
2784
2784
  grid-template-columns: repeat(
2785
2785
  auto-fit,
@@ -2823,7 +2823,7 @@
2823
2823
  :where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
2824
2824
  max-height: var(--aia-grid-max-height, 120px);
2825
2825
  }
2826
- `,document.head.appendChild(e)}var oa=require("react/jsx-runtime");function ia({min:e="16rem",max:a,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:d,innerRef:m,className:v,children:k,...f}){let p=(0,St.useRef)(null);(0,St.useLayoutEffect)(()=>{if(s===void 0)return;let x=p.current;x&&(x.scrollTop=0)},[s]);let u={"--aia-grid-min":e};return a&&(u["--aia-grid-max"]=a),t&&(u["--aia-grid-gap"]=t),o&&(u["--aia-grid-max-height"]=o),r&&(u.gridTemplateColumns=(0,aa.optionsGridTemplateColumns)(r)),d&&(u.gridTemplateColumns=d),(0,oa.jsx)("div",{ref:x=>{p.current=x,m?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:u,...f,children:k})}var me=require("@magicx-eng/ai-autocomplete-vanilla"),Te=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
2826
+ `,document.head.appendChild(e)}var oa=require("react/jsx-runtime");function ia({min:e="16rem",max:a,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:d,innerRef:m,className:v,children:C,...f}){let p=(0,St.useRef)(null);(0,St.useLayoutEffect)(()=>{if(s===void 0)return;let x=p.current;x&&(x.scrollTop=0)},[s]);let u={"--aia-grid-min":e};return a&&(u["--aia-grid-max"]=a),t&&(u["--aia-grid-gap"]=t),o&&(u["--aia-grid-max-height"]=o),r&&(u.gridTemplateColumns=(0,aa.optionsGridTemplateColumns)(r)),d&&(u.gridTemplateColumns=d),(0,oa.jsx)("div",{ref:x=>{p.current=x,m?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:u,...f,children:C})}var me=require("@magicx-eng/ai-autocomplete-vanilla"),Te=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
2827
2827
  position: relative;
2828
2828
  /* Clip, not visible: the entrance rise below runs on the inner content,
2829
2829
  and a transformed box extends its scroll container's scrollable area.
@@ -2850,7 +2850,7 @@
2850
2850
  /* 5.6px radius on the highlighted fill (--aia-option-bg), matching the Figma
2851
2851
  SuggestionItem selection at 70%. The 5.6px/10px inset is the item's own padding. */
2852
2852
  border-radius: 5.6px;
2853
- padding: 5.6px 10px;
2853
+ padding: var(--aia-option-padding-block, 5.6px) 10px;
2854
2854
  /* No entrance animation on the row itself \u2014 deliberately. The row is the
2855
2855
  tappable element, and iOS Safari drops a tap on a scripted-clickable
2856
2856
  element (a div with a click handler; a native button is exempt) whose
@@ -2984,36 +2984,29 @@
2984
2984
  mask-image: none;
2985
2985
  }
2986
2986
 
2987
- /* Loading state \u2014 preserve the row's exact dimensions. The content stays an
2988
- inline span so the line box and padding match the non-loading state byte
2989
- for byte. Just hide the text and apply a background as a skeleton bar; the
2990
- pulse provides the shimmer. */
2987
+ /* Loading \u2014 a row kept from the last response fades out while the next one
2988
+ is fetched, text and all; nothing else changes, so the box does not move. */
2991
2989
  .aia-item-d4vpD[data-aia-loading] {
2992
2990
  cursor: default;
2993
- animation: aia-skeletonPulse-plvdD 1.4s ease-in-out infinite;
2991
+ pointer-events: none;
2992
+ animation: aia-loadingOut-hI-qI 160ms ease-in forwards;
2994
2993
  }
2995
2994
 
2996
- /* Skeleton fill is on the inner text span (a true inline element) so multi-
2997
- line options wrap into one skeleton bar per line. The outer .content is a
2998
- flex item \u2014 blockified by spec \u2014 so painting the background there would
2999
- collapse all lines into one tall rectangle. \`box-decoration-break: clone\`
3000
- makes the radius render cleanly on each line bar. */
3001
- .aia-item-d4vpD[data-aia-loading] .aia-text-yqoh9 {
3002
- color: transparent;
3003
- background: var(--aia-skeleton-bg, var(--aia-pill-bg, rgba(189, 189, 189, 0.25)));
3004
- border-radius: 999px;
3005
- -webkit-box-decoration-break: clone;
3006
- box-decoration-break: clone;
3007
- animation: aia-skeletonBarIn-ZlEM0 100ms ease-out;
2995
+ .aia-item-d4vpD[data-aia-loading] .aia-content-T-Qba {
2996
+ animation: none;
3008
2997
  }
3009
2998
 
3010
- .aia-item-d4vpD[data-aia-loading] .aia-tag-e3Fwe {
3011
- display: none;
2999
+ /* Ends a hair above zero, like magicx-aia-fadeIn starts: a pill kept by key
3000
+ is re-enabled in place, and iOS cancels a tap on an element leaving 0. */
3001
+ @keyframes aia-loadingOut-hI-qI {
3002
+ to {
3003
+ opacity: 0.01;
3004
+ }
3012
3005
  }
3013
3006
 
3014
3007
  /* The parameter an option is a value of, under its text ("Flavor", "Subcategory"):
3015
3008
  muted and smaller, so options that read alike are told apart. Block inside the
3016
- text box, so a hanging indent never moves it; a skeleton row drops it. */
3009
+ text box, so a hanging indent never moves it. */
3017
3010
  .aia-parameter-Dt2zF {
3018
3011
  display: block;
3019
3012
  font-size: var(--aia-option-parameter-font-size, 8.4px);
@@ -3030,10 +3023,6 @@
3030
3023
  font-weight: 600;
3031
3024
  }
3032
3025
 
3033
- .aia-item-d4vpD[data-aia-loading] .aia-parameter-Dt2zF {
3034
- display: none;
3035
- }
3036
-
3037
3026
  /* Server-provided option icon (\`icon_svg\` on the option): a box exactly one
3038
3027
  text line tall, top-aligned, so it sits centred on the first line of a
3039
3028
  wrapped option and never grows the line box. The glyph draws in
@@ -3059,14 +3048,6 @@
3059
3048
  height: 1em;
3060
3049
  }
3061
3050
 
3062
- /* Skeleton rows keep the icon's column (hidden, not removed) and the
3063
- hanging indent below, so a row that flips into loading and back \u2014 the
3064
- same element in React, a rebuilt one in vanilla \u2014 draws its bar and its
3065
- text at the same x and nothing slides sideways. */
3066
- .aia-item-d4vpD[data-aia-loading] .aia-icon-Qw938 {
3067
- visibility: hidden;
3068
- }
3069
-
3070
3051
  /* With an icon, the content box hangs its continuation lines: a left pad the
3071
3052
  width of the icon plus its gap, and a matching negative first-line indent
3072
3053
  that pulls the icon back into that pad. Wrapped lines then start under the
@@ -3100,15 +3081,6 @@
3100
3081
  min-width: 0;
3101
3082
  }
3102
3083
 
3103
- /* A skeleton bar hugs its text. The rules above let the text grow to fill a
3104
- picture / count row (so the count sits at the trailing edge); a loading row
3105
- hides the count, and a growing text box would paint the bar across the
3106
- whole column. One compound deeper than those rules, so it wins in every
3107
- copy regardless of source order. */
3108
- .aia-item-d4vpD[data-aia-loading] .aia-content-T-Qba .aia-text-yqoh9 {
3109
- flex: 0 1 auto;
3110
- }
3111
-
3112
3084
  /* The picture: a square tile, centred on the text beside it (a one-line
3113
3085
  option reads as the reference row; a wrapped one keeps the tile on its
3114
3086
  vertical middle). Sized and rounded by token so a consumer can shrink it
@@ -3191,27 +3163,12 @@
3191
3163
  content: " " var(--aia-option-count-unit-one, var(--aia-option-count-unit, "item"));
3192
3164
  }
3193
3165
 
3194
- /* Skeleton rows fill the tile even when the picture has loaded (the fill
3195
- pulses with the row) and hide the picture, and drop the count like the
3196
- tag. */
3197
- .aia-item-d4vpD[data-aia-loading] .aia-image-YZAbO {
3198
- background: var(--aia-option-image-bg, var(--aia-skeleton-bg, rgba(189, 189, 189, 0.083)));
3199
- }
3200
-
3201
- .aia-item-d4vpD[data-aia-loading] .aia-image-YZAbO img {
3202
- visibility: hidden;
3203
- }
3204
-
3205
- .aia-item-d4vpD[data-aia-loading] .aia-count-IpYbQ {
3206
- display: none;
3207
- }
3208
-
3209
3166
  /* A grid of rows with a parameter line is taller per row: the row's text
3210
3167
  line and padding plus the parameter line, so the visible-rows cap
3211
3168
  (\`--aia-grid-max-height\`) does not cut the last row. Before the picture rule,
3212
3169
  which wins when a group has both. */
3213
3170
  [data-aia-group]:has(.aia-parameter-Dt2zF) {
3214
- --aia-option-row-height: 37.1px;
3171
+ --aia-option-row-height: calc(25.9px + 2 * var(--aia-option-padding-block, 5.6px));
3215
3172
  }
3216
3173
 
3217
3174
  /* A grid of picture rows is taller per row: the visible-rows cap
@@ -3219,7 +3176,11 @@
3219
3176
  planOptionsGrid) follows the tile's height plus the row's padding, so the
3220
3177
  same number of rows shows before the list scrolls. */
3221
3178
  [data-aia-group]:has(.aia-image-YZAbO) {
3222
- --aia-option-row-height: calc(var(--aia-option-image-size, 28px) + 11.2px);
3179
+ --aia-option-row-height: calc(
3180
+ var(--aia-option-image-size, 28px) +
3181
+ 2 *
3182
+ var(--aia-option-padding-block, 5.6px)
3183
+ );
3223
3184
  }
3224
3185
 
3225
3186
  /* A row without a picture, in a grid where other rows have one, lines up
@@ -3228,8 +3189,7 @@
3228
3189
  does. A row with neither a picture nor an icon is not indented to match:
3229
3190
  its text sits flush left, as it would in a grid with no pictures. Grids
3230
3191
  with no pictures keep the inline icon and hanging indent above. The text
3231
- is left to size itself: letting it grow here would out-rank the
3232
- loading-bar rule that makes a skeleton bar hug its text. */
3192
+ is left to size itself. */
3233
3193
  [data-aia-group]:has(.aia-image-YZAbO) .aia-content-T-Qba:not(:has(.aia-image-YZAbO)) {
3234
3194
  display: flex;
3235
3195
  flex: 1 1 auto;
@@ -3259,48 +3219,10 @@
3259
3219
  height: var(--aia-option-tile-icon-size, 1.5em);
3260
3220
  }
3261
3221
 
3262
- @keyframes aia-skeletonPulse-plvdD {
3263
- 0%,
3264
- 100% {
3265
- filter: brightness(1);
3266
- }
3267
- 50% {
3268
- filter: brightness(0.55);
3269
- }
3270
- }
3271
- /* --- Loading skeleton fades ---
3272
- Skeletons ease in and out over 100ms instead of popping. In: an option's
3273
- text crossfades into its bar (the row element persists in React / Angular
3274
- and is rebuilt in vanilla \u2014 a keyframe plays either way). Out: while the
3275
- dropdown carries data-aia-skeleton-exiting (the core holds the skeleton for
3276
- SKELETON_FADE_MS after the response lands) the skeleton rows and pills fade
3277
- to nothing before the response's options replace them. Keep 100ms in step
3278
- with SKELETON_FADE_MS in AIAutocomplete.ts. */
3279
- /* During the fade-out the skeleton rows play nothing but the fade: no
3280
- entrance, no text crossfade. Rows keep their identity through it (the core's
3281
- dropdownSuggestion), but if one were ever remounted here, replaying either
3282
- animation would bring the previous option's text back on screen. */
3283
- [data-aia-skeleton-exiting] .aia-item-d4vpD[data-aia-loading] .aia-content-T-Qba,
3284
- [data-aia-skeleton-exiting] .aia-item-d4vpD[data-aia-loading] .aia-text-yqoh9 {
3285
- animation: none;
3286
- }
3287
-
3288
- [data-aia-skeleton-exiting] .aia-item-d4vpD[data-aia-loading] {
3289
- animation: aia-skeletonOut-x6NRd 100ms ease-in forwards;
3290
- }
3291
-
3292
- @keyframes aia-skeletonBarIn-ZlEM0 {
3293
- from {
3294
- background-color: transparent;
3295
- color: inherit;
3296
- }
3297
- }
3298
-
3299
- @keyframes aia-skeletonOut-x6NRd {
3300
- to {
3301
- opacity: 0;
3302
- }
3303
- }
3222
+ /* --- Loading fades ---
3223
+ Nothing extra plays while the dropdown carries data-aia-skeleton-exiting:
3224
+ the loading rows have already faded out, and a second animation would
3225
+ restart the fade from full strength. */
3304
3226
 
3305
3227
  .aia-content-T-Qba:has(.aia-checkbox-KGRhg) {
3306
3228
  display: flex;
@@ -3421,7 +3343,7 @@
3421
3343
  border-radius: 6px;
3422
3344
  font-size: 11px;
3423
3345
  }
3424
- `,document.head.appendChild(e)}var se={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd",checkbox:"aia-checkbox-KGRhg"};var he=require("react/jsx-runtime");function na({option:e,isHighlighted:a,checked:t,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:d,showIcon:m=!0,showImage:v=!0,showCount:k=!0,scrollHint:f,enterDelayMs:p=0}){let[u]=(0,Te.useState)(p),[x,A]=(0,Te.useState)(!1),q=v?(0,me.optionImageSources)(e.image_url):[],H=q[0]??null,[N,ae]=(0,Te.useState)([]),O=q.find(P=>!N.includes(P))??null,[F,T]=(0,Te.useState)(null),Y=(0,Te.useMemo)(()=>!H&&m&&e.icon_svg?(0,me.sanitizeOptionIconSvg)(e.icon_svg):null,[H,m,e.icon_svg]),ie=k?(0,me.formatOptionCount)(e.item_count):null,ce=(0,Te.useRef)(void 0);(0,Te.useEffect)(()=>()=>clearTimeout(ce.current),[]);let ee=P=>{if(d||!e.is_tappable||x&&t===void 0)return;A(!0);let Q=P?.currentTarget;t!==void 0&&Q!==void 0&&P!==void 0&&!(0,me.isMultiSelectToggleTap)(Q,Q.querySelector("[data-aia-checkbox]"),P)?i(e,{commit:!0}):i(e),clearTimeout(ce.current),ce.current=setTimeout(()=>A(!1),170)},te=[se.item,a&&!d?se.highlighted:"",e.liveMatch&&!d?se.liveMatch:"",e.is_tappable?se.tappable:se.nonTappable,x?se.pressed:"",f?se.scrollHint:""].filter(Boolean).join(" ");return(0,he.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":Y&&e.icon?e.icon:void 0,"data-aia-image":H?"":void 0,"data-aia-item-count":ie!==null?e.item_count:void 0,"aria-selected":t??a,className:te,style:{[me.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:ee,onKeyDown:P=>{!d&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),ee())},onMouseEnter:!d&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,he.jsxs)("span",{className:se.content,children:[t!==void 0&&e.is_tappable&&(0,he.jsx)("span",{className:se.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),H&&(0,he.jsx)("span",{className:`${se.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":O!==null&&F===O?"":void 0,children:(0,he.jsx)("img",{src:O??H,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:O===null,onLoad:()=>T(O),onError:()=>{O!==null&&ae(P=>[...P,O])}})}),Y&&(0,he.jsx)("span",{className:`${se.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:Y}}),(0,he.jsxs)("span",{className:se.text,children:[e.matchedText?(0,me.highlightParts)((0,me.optionLabel)(e),e.matchedText).map((P,Q)=>P.bold?(0,he.jsx)("strong",{className:`${se.match} magicx-aia-option-match`,children:P.text},Q):P.text):(0,me.optionLabel)(e),e.parameterLabel&&(0,he.jsxs)(he.Fragment,{children:[" ",(0,he.jsx)("span",{className:`${se.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,he.jsx)("span",{className:se.tag,children:e.tag}),ie!==null&&(0,he.jsx)("span",{className:`${se.count} magicx-aia-option-count`,children:ie})]})})}var Mt=require("react/jsx-runtime");function Ka(){let[e,a]=(0,He.useState)(le.isOptionsGridMobileViewport);return(0,He.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(le.OPTIONS_GRID_MOBILE_QUERY),i=()=>a(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function ra({options:e,activeIndex:a,picked:t,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:d,groupKey:m="",optionsPosition:v="below",showIcons:k=!0,showImages:f=!0,showCounts:p=!0}){let u=Ka(),x=(0,He.useRef)(null),[A,q]=(0,He.useState)(null),H=(0,He.useRef)(null);(0,He.useLayoutEffect)(()=>{if(d&&(0,le.sameOptionRows)(H.current,e))return;H.current=d?null:e;let O=x.current,T=O&&!d&&(0,le.needsOptionsGridMeasurement)(e.length,u)?(0,le.measureOptionsGrid)(O):null;q(T?(0,le.planOptionsGrid)(e.length,u,T.rowWidths,T.gridWidth):null)},[e,u,d]);let N=A??(0,le.planOptionsGrid)(e.length,u,null,null),ae=(0,le.optionsShowLeadingVisuals)(e,k,f);return(0,Mt.jsx)(ia,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:m,template:N.template,maxHeight:N.maxHeight,innerRef:O=>{x.current=O},"data-aia-group":m,children:e.map((O,F)=>(0,Mt.jsx)(na,{option:O,isHighlighted:F===a,checked:t?t.includes(O.text):void 0,onSelect:i,onHighlight:()=>o(F),onUnhighlight:s?()=>s(F):void 0,id:`${r}-option-${F}`,loading:d,showIcon:k&&ae,showImage:f&&ae,showCount:p,scrollHint:!d&&N.scrollHintIndices.includes(F),enterDelayMs:d?0:(0,le.optionEnterDelayMs)(F,N.cols,e.length,v)},`${m}\0${O.text}`))})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),Ie=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
3346
+ `,document.head.appendChild(e)}var le={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};var he=require("react/jsx-runtime");function na({option:e,isHighlighted:a,checked:t,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:d,showIcon:m=!0,showImage:v=!0,showCount:C=!0,scrollHint:f,enterDelayMs:p=0}){let[u]=(0,Te.useState)(p),[x,R]=(0,Te.useState)(!1),_=v?(0,me.optionImageSources)(e.image_url):[],F=_[0]??null,[H,ie]=(0,Te.useState)([]),E=_.find(P=>!H.includes(P))??null,[M,T]=(0,Te.useState)(null),G=(0,Te.useMemo)(()=>!F&&m&&e.icon_svg?(0,me.sanitizeOptionIconSvg)(e.icon_svg):null,[F,m,e.icon_svg]),oe=C?(0,me.formatOptionCount)(e.item_count):null,ce=(0,Te.useRef)(void 0);(0,Te.useEffect)(()=>()=>clearTimeout(ce.current),[]);let te=P=>{if(d||!e.is_tappable||x&&t===void 0)return;R(!0);let j=P?.currentTarget;t!==void 0&&j!==void 0&&P!==void 0&&!(0,me.isMultiSelectToggleTap)(j,j.querySelector("[data-aia-checkbox]"),P)?i(e,{commit:!0}):i(e),clearTimeout(ce.current),ce.current=setTimeout(()=>R(!1),170)},ae=[le.item,a&&!d?le.highlighted:"",e.liveMatch&&!d?le.liveMatch:"",e.is_tappable?le.tappable:le.nonTappable,x?le.pressed:"",f?le.scrollHint:""].filter(Boolean).join(" ");return(0,he.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":G&&e.icon?e.icon:void 0,"data-aia-image":F?"":void 0,"data-aia-item-count":oe!==null?e.item_count:void 0,"aria-selected":t??a,className:ae,style:{[me.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:te,onKeyDown:P=>{!d&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),te())},onMouseEnter:!d&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,he.jsxs)("span",{className:le.content,children:[t!==void 0&&e.is_tappable&&(0,he.jsx)("span",{className:le.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),F&&(0,he.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":E!==null&&M===E?"":void 0,children:(0,he.jsx)("img",{src:E??F,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:E===null,onLoad:()=>T(E),onError:()=>{E!==null&&ie(P=>[...P,E])}})}),G&&(0,he.jsx)("span",{className:`${le.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:G}}),(0,he.jsxs)("span",{className:le.text,children:[e.matchedText?(0,me.highlightParts)((0,me.optionLabel)(e),e.matchedText).map((P,j)=>P.bold?(0,he.jsx)("strong",{className:`${le.match} magicx-aia-option-match`,children:P.text},j):P.text):(0,me.optionLabel)(e),e.parameterLabel&&(0,he.jsxs)(he.Fragment,{children:[" ",(0,he.jsx)("span",{className:`${le.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,he.jsx)("span",{className:le.tag,children:e.tag}),oe!==null&&(0,he.jsx)("span",{className:`${le.count} magicx-aia-option-count`,children:oe})]})})}var Mt=require("react/jsx-runtime");function Ka(){let[e,a]=(0,Pe.useState)(V.isOptionsGridMobileViewport);return(0,Pe.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(V.OPTIONS_GRID_MOBILE_QUERY),i=()=>a(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function ra({options:e,activeIndex:a,picked:t,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:d,groupKey:m="",optionsPosition:v="below",showIcons:C=!0,showImages:f=!0,showCounts:p=!0}){let u=Ka(),x=(0,Pe.useRef)(null),[R,_]=(0,Pe.useState)(null),F=(0,Pe.useRef)(null);(0,Pe.useLayoutEffect)(()=>{if(d&&(0,V.sameOptionRows)(F.current,e))return;F.current=d?null:e;let E=x.current,M=E&&!d&&(0,V.needsOptionsGridMeasurement)(e.length,u),T=E?.closest("[data-aia-dropdown]");M&&T&&(0,V.releasePanelHug)(T);let G=M?(0,V.measureOptionsGrid)(E):null;_(G?(0,V.planOptionsGrid)(e.length,u,G.rowWidths,G.gridWidth):null)},[e,u,d]);let H=R??(0,V.planOptionsGrid)(e.length,u,null,null);(0,Pe.useLayoutEffect)(()=>{let E=x.current?.closest("[data-aia-dropdown]");E&&(0,V.syncPanelHug)(E)},[H.template,u]);let ie=(0,V.optionsShowLeadingVisuals)(e,C,f);return(0,Mt.jsx)(ia,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:m,template:H.template,maxHeight:H.maxHeight,innerRef:E=>{x.current=E},"data-aia-group":m,children:e.map((E,M)=>(0,Mt.jsx)(na,{option:E,isHighlighted:M===a,checked:t?t.includes(E.text):void 0,onSelect:i,onHighlight:()=>o(M),onUnhighlight:s?()=>s(M):void 0,id:`${r}-option-${M}`,loading:d,showIcon:C&&ie,showImage:f&&ie,showCount:p,scrollHint:!d&&H.scrollHintIndices.includes(M),enterDelayMs:d?0:(0,V.optionEnterDelayMs)(M,H.cols,e.length,v)},`${m}\0${E.text}`))})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),Ee=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
3425
3347
 
3426
3348
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3427
3349
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3543,7 +3465,7 @@
3543
3465
  .aia-done-llNY5:hover {
3544
3466
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3545
3467
  }
3546
- `,document.head.appendChild(e)}var Pe={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};var ye=require("react/jsx-runtime"),qa=120;function sa({view:e,label:a,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return(0,ye.jsxs)("div",{className:Pe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:r=>r.preventDefault(),children:[(0,ye.jsx)("span",{className:Pe.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ue.formatTime)(e.minutes)}),(0,ye.jsxs)("div",{className:Pe.columns,"aria-hidden":"true",children:[(0,ye.jsx)("div",{className:Pe.band}),ue.TIME_WHEEL_COLUMNS.map(r=>(0,ye.jsxs)(Ie.Fragment,{children:[r==="minute"&&(0,ye.jsx)("span",{className:Pe.separator,children:":"}),(0,ye.jsx)(_a,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),(0,ye.jsx)("button",{type:"button",tabIndex:-1,className:Pe.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:t})]})}function _a({column:e,minutes:a,interactive:t,onTimeChange:i}){let o=(0,Ie.useRef)(null),s=(0,Ie.useRef)(null),r=(0,Ie.useRef)(null),d=(0,Ie.useRef)({minutes:a,interactive:t,onTimeChange:i});d.current={minutes:a,interactive:t,onTimeChange:i};let m=(0,ue.timeWheelIndex)(e,a);(0,Ie.useLayoutEffect)(()=>{let f=o.current;if(!f||r.current)return;let p=m*ue.TIME_WHEEL_ROW_HEIGHT;Math.abs(f.scrollTop-p)<1||(s.current=p,f.scrollTop=p)},[m]),(0,Ie.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let f=o.current,p=d.current;if(!f||!p.interactive)return;let u=(0,ue.timeWheelIndexFromScroll)(e,f.scrollTop);u!==(0,ue.timeWheelIndex)(e,p.minutes)&&p.onTimeChange((0,ue.withTimeWheelIndex)(e,p.minutes,u))},k=()=>{let f=o.current;if(f){if(s.current!=null&&Math.abs(f.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,qa)}};return(0,ye.jsx)("div",{ref:o,className:Pe.column,"data-aia-time-column":e,onScroll:k,children:(0,ue.timeWheelRows)(e).map((f,p)=>(0,ye.jsx)("div",{className:p===m?`${Pe.row} ${Pe.selected}`:Pe.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{d.current.interactive&&i((0,ue.withTimeWheelIndex)(e,d.current.minutes,p))},children:f.label},f.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3468
+ `,document.head.appendChild(e)}var Ie={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};var ye=require("react/jsx-runtime"),qa=120;function sa({view:e,label:a,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return(0,ye.jsxs)("div",{className:Ie.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:r=>r.preventDefault(),children:[(0,ye.jsx)("span",{className:Ie.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ue.formatTime)(e.minutes)}),(0,ye.jsxs)("div",{className:Ie.columns,"aria-hidden":"true",children:[(0,ye.jsx)("div",{className:Ie.band}),ue.TIME_WHEEL_COLUMNS.map(r=>(0,ye.jsxs)(Ee.Fragment,{children:[r==="minute"&&(0,ye.jsx)("span",{className:Ie.separator,children:":"}),(0,ye.jsx)(_a,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),(0,ye.jsx)("button",{type:"button",tabIndex:-1,className:Ie.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:t})]})}function _a({column:e,minutes:a,interactive:t,onTimeChange:i}){let o=(0,Ee.useRef)(null),s=(0,Ee.useRef)(null),r=(0,Ee.useRef)(null),d=(0,Ee.useRef)({minutes:a,interactive:t,onTimeChange:i});d.current={minutes:a,interactive:t,onTimeChange:i};let m=(0,ue.timeWheelIndex)(e,a);(0,Ee.useLayoutEffect)(()=>{let f=o.current;if(!f||r.current)return;let p=m*ue.TIME_WHEEL_ROW_HEIGHT;Math.abs(f.scrollTop-p)<1||(s.current=p,f.scrollTop=p)},[m]),(0,Ee.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let f=o.current,p=d.current;if(!f||!p.interactive)return;let u=(0,ue.timeWheelIndexFromScroll)(e,f.scrollTop);u!==(0,ue.timeWheelIndex)(e,p.minutes)&&p.onTimeChange((0,ue.withTimeWheelIndex)(e,p.minutes,u))},C=()=>{let f=o.current;if(f){if(s.current!=null&&Math.abs(f.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,qa)}};return(0,ye.jsx)("div",{ref:o,className:Ie.column,"data-aia-time-column":e,onScroll:C,children:(0,ue.timeWheelRows)(e).map((f,p)=>(0,ye.jsx)("div",{className:p===m?`${Ie.row} ${Ie.selected}`:Ie.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{d.current.interactive&&i((0,ue.withTimeWheelIndex)(e,d.current.minutes,p))},children:f.label},f.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3547
3469
  display: flex;
3548
3470
  flex-direction: column;
3549
3471
  gap: var(--aia-stack-space, 0.5rem);
@@ -3558,7 +3480,7 @@
3558
3480
  align-items: end;
3559
3481
  }
3560
3482
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3561
- `,document.head.appendChild(e)}var da=require("react/jsx-runtime");function la({space:e,align:a="stretch",className:t,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,da.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:s,...o,children:i})}var _=require("react/jsx-runtime"),Va=typeof window>"u"?V.useEffect:V.useLayoutEffect,Ua=[159,119,164],Ya=()=>{},ca=()=>{},Qa=e=>{},ja=()=>{},$a=e=>{},Za=e=>{},Xa=e=>{},Ja=e=>{};function ei(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,V.useState)(a);if((0,V.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ti(e,a){let t=(0,V.useRef)(null);(0,V.useEffect)(()=>{let i=e.current,o=a.current;if(!i||!o)return;let s=(0,D.queryLive)(i,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:(0,D.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}t.current?.controller.update()}),(0,V.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function ai(e,a){let t=(0,V.useRef)(a);t.current=a;let i=(0,V.useRef)(null);(0,V.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,D.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),(0,V.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Tt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:d,pills:m,onPillClick:v,showPills:k=!0,onSkip:f,showSkipButton:p=!0,showOptionIcons:u=!0,showOptionImages:x=!0,showOptionCounts:A=!0,skipDisabled:q=!1,activeSelected:H=!1,isLoading:N=!1,skeletonExiting:ae=!1,isInputEmpty:O=!1,language:F,products:T,onProductSelect:Y,onProductAddToCart:ie,onProductFocusChange:ce,productsLayout:ee="row",productImageFallback:te="image",formatType:P="options",dateView:Q=null,selectedDateIso:Ae=null,selectedDateRange:ke=null,dateRangeStart:ve=null,onPreviousMonth:c,onNextMonth:E,timeView:Ge=null,multiSelectView:b=null,onMultiSelectCommit:at,onTimeChange:Ve,onTimeCommit:Ue,locationView:w=null,isReediting:S=!1,onLocationQuery:I,onLocationMove:L,onLocationCommit:z,onLocationFocusChange:oe,isFocused:Re=!1,optionsPosition:ge="below",mode:Oe}){let Ye=ei(Oe),st=Ye!==void 0,j=(0,V.useRef)(null),Qe=(0,V.useRef)(null);ti(j,Qe),(0,V.useEffect)(()=>{if(j.current)return(0,D.containScroll)(j.current)},[]);let pt=e[0]?.options??[],it=!!(m&&m.length>0&&v),We=!!(T&&T.length>0),ht=P==="time"&&Ge!=null,je=P==="location"&&w!=null,pe=s&&(pt.length>0||k&&it||N||We||ht||je);ai(j,pe),Va(()=>{let C=j.current;C&&(0,D.fitMultiSelectDone)(C,(0,D.findMultiSelectDone)(C))});let Ce={suggestions:e,activeIndex:a,pills:m,showPills:k,showSkipButton:p,showOptionIcons:u,showOptionImages:x,showOptionCounts:A,skipDisabled:q,activeSelected:H,isLoading:N,skeletonExiting:ae,isInputEmpty:O,products:T,formatType:P,dateView:Q,selectedDateIso:Ae,selectedDateRange:ke,dateRangeStart:ve,timeView:Ge,multiSelectView:b,locationView:w,isReediting:S},y=(0,V.useRef)(Ce);pe&&(y.current=Ce);let n=pe?Ce:y.current,re=(0,D.uiStringsFor)(F),Le=n.suggestions[0],g=Le?.options??[],$e=n.activeIndex>=0&&!!g[n.activeIndex]?.is_tappable,Ke=(0,D.labelTraditionalAutocomplete)(n.pills??[],re.keepTyping),ze=!!(Ke.length>0&&v),ot=n.showPills&&ze,ut=n.showPills&&!ze&&n.isLoading,qe=ot||ut,lt=ze&&(0,D.hasSkippablePill)(Ke)&&n.showSkipButton&&!n.isInputEmpty&&!!f,Se=Ke[0]?.text,De=(0,D.isCalendarFormat)(n.formatType)&&n.dateView!=null,Ze=g.length>0&&!De,nt=g.length>0&&De&&!n.isLoading,dt=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,Xe=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,ct=n.isLoading&&!Ze&&!nt&&!dt&&!Xe,h=n.products??[],K=(0,D.panelMorphKey)(ot?Ke:[]);return(0,V.useLayoutEffect)(()=>{j.current&&(0,D.settlePanelMorph)(j.current,K,{visible:pe,anchorBottom:ge==="above"})},[K,pe,ge,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,ee,F]),(0,V.useEffect)(()=>{let C=j.current;return()=>{C&&(0,D.destroyPanelMorph)(C)}},[]),(0,_.jsxs)("div",{ref:j,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":ge,"data-mode":Ye,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":h.length>0?"":void 0,className:`${st?"magicx-aia ":""}${Me.dropdown} ${pe?Me.visible:""} ${d??""}`,onMouseDown:C=>C.preventDefault(),children:[(0,_.jsxs)(la,{space:"8px",children:[(qe||lt)&&(0,_.jsxs)(ft,{noWrap:!0,className:Me.pillBar,"data-aia-pillbar":"",children:[qe&&(0,_.jsx)("span",{className:Me.pillScroll,"data-aia-pill-scroll":"",children:(0,_.jsx)(Ct,{pills:Ke,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:n.isLoading})}),lt&&(0,_.jsx)("button",{type:"button",tabIndex:-1,className:Me.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":Se?`${re.skipLabel} ${Se}`:re.skipLabel,onClick:f,children:re.skip})]}),Ze&&(0,_.jsx)(ra,{options:g,activeIndex:n.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n.isLoading,groupKey:Le?`${Le.parameter} ${Le.text}`:"",optionsPosition:ge,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.isLoading?void 0:n.multiSelectView?.picked}),n.multiSelectView&&!n.isLoading&&(0,_.jsx)("div",{onClick:C=>{C.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&at?.()},children:(0,_.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Me.multiDone,ref:C=>{C&&(C.disabled=!0,C.offsetHeight,C.disabled=n.skipDisabled)},children:re.done})}),nt&&n.dateView&&(0,_.jsx)(Ut,{options:g,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,D.dateFloorFor)(n.formatType,n.dateRangeStart)},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:c??ca,onNextMonth:E??ca}),dt&&n.timeView&&(0,_.jsx)(sa,{view:n.timeView,label:re.timeLabel,doneLabel:re.done,interactive:!n.skipDisabled,onTimeChange:Ve??Qa,onTimeCommit:Ue??ja}),Xe&&n.locationView&&(0,_.jsx)(Zt,{view:n.locationView,searchLabel:re.locationSearch,noResultsLabel:re.locationNoResults,useTypedLabel:re.locationUseTyped,widgetFocused:Re&&pe,reediting:n.isReediting,visible:pe,interactive:!n.skipDisabled,onQuery:I??$a,onMove:L??Za,onCommit:z??Xa,onFocusChange:oe??Ja}),ct&&(0,_.jsx)("div",{className:Me.skeletonBars,"data-aia-skeleton-bars":"",children:Ua.map(C=>(0,_.jsx)("span",{className:Me.skeletonBar,style:{width:C}},`bar-${C}`))}),(0,_.jsx)(ta,{products:h,listboxId:r,onSelect:Y??Ya,onAddToCart:ie,onFocusChange:ce,focusable:pe,layout:ee,imageFallback:te,strings:re}),(0,_.jsx)(Yt,{isOptionHighlighted:$e,isInputEmpty:n.isInputEmpty,strings:re})]}),(0,_.jsx)("button",{ref:Qe,type:"button",tabIndex:-1,className:Me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":re.scrollArrow,"aria-hidden":"true",children:(0,_.jsx)("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,_.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Be=require("@magicx-eng/ai-autocomplete-vanilla");var ha=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
3483
+ `,document.head.appendChild(e)}var da=require("react/jsx-runtime");function la({space:e,align:a="stretch",className:t,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,da.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:s,...o,children:i})}var U=require("react/jsx-runtime"),Va=typeof window>"u"?Y.useEffect:Y.useLayoutEffect,Ua=[159,119,164],Ya=()=>{},ca=()=>{},Qa=e=>{},ja=()=>{},$a=e=>{},Za=e=>{},Xa=e=>{},Ja=e=>{};function ei(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,Y.useState)(a);if((0,Y.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ti(e,a){let t=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let i=e.current,o=a.current;if(!i||!o)return;let s=(0,O.queryLive)(i,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:(0,O.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}t.current?.controller.update()}),(0,Y.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function ai(e,a){let t=(0,Y.useRef)(a);t.current=a;let i=(0,Y.useRef)(null);(0,Y.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,O.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),(0,Y.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Tt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:d,pills:m,onPillClick:v,showPills:C=!0,onSkip:f,showSkipButton:p=!0,showOptionIcons:u=!0,showOptionImages:x=!0,showOptionCounts:R=!0,skipDisabled:_=!1,activeSelected:F=!1,isLoading:H=!1,skeletonExiting:ie=!1,isInputEmpty:E=!1,language:M,products:T,onProductSelect:G,onProductAddToCart:oe,onProductFocusChange:ce,productsLayout:te="row",productImageFallback:ae="image",formatType:P="options",dateView:j=null,selectedDateIso:Re=null,selectedDateRange:ke=null,dateRangeStart:ve=null,onPreviousMonth:c,onNextMonth:A,timeView:We=null,multiSelectView:b=null,onMultiSelectCommit:at,onTimeChange:Ve,onTimeCommit:Ue,locationView:w=null,isReediting:S=!1,onLocationQuery:I,onLocationMove:z,onLocationCommit:D,onLocationFocusChange:ne,isFocused:Oe=!1,optionsPosition:ge="below",mode:Le}){let Ye=ei(Le),st=Ye!==void 0,$=(0,Y.useRef)(null),Qe=(0,Y.useRef)(null);ti($,Qe),(0,Y.useEffect)(()=>{if($.current)return(0,O.containScroll)($.current)},[]);let pt=e[0]?.options??[],it=!!(m&&m.length>0&&v),Ge=!!(T&&T.length>0),ht=P==="time"&&We!=null,je=P==="location"&&w!=null,pe=s&&(pt.length>0||C&&it||H||Ge||ht||je);ai($,pe),Va(()=>{let k=$.current;k&&((0,O.fitMultiSelectDone)(k,(0,O.findMultiSelectDone)(k)),(0,O.syncPanelHug)(k))});let Ce={suggestions:e,activeIndex:a,pills:m,showPills:C,showSkipButton:p,showOptionIcons:u,showOptionImages:x,showOptionCounts:R,skipDisabled:_,activeSelected:F,isLoading:H,skeletonExiting:ie,isInputEmpty:E,products:T,formatType:P,dateView:j,selectedDateIso:Re,selectedDateRange:ke,dateRangeStart:ve,timeView:We,multiSelectView:b,locationView:w,isReediting:S},y=(0,Y.useRef)(Ce);pe&&(y.current=Ce);let n=pe?Ce:y.current,se=(0,O.uiStringsFor)(M),ze=n.suggestions[0],g=ze?.options??[],$e=n.activeIndex>=0&&!!g[n.activeIndex]?.is_tappable,Ke=(0,O.labelTraditionalAutocomplete)(n.pills??[],se.keepTyping),De=!!(Ke.length>0&&v),ot=n.showPills&&De,ut=n.showPills&&!De&&n.isLoading,qe=ot||ut,lt=De&&(0,O.hasSkippablePill)(Ke)&&n.showSkipButton&&!n.isInputEmpty&&!!f,Se=Ke[0]?.text,Me=(0,O.isCalendarFormat)(n.formatType)&&n.dateView!=null,Ze=g.length>0&&!Me,nt=g.length>0&&Me&&!n.isLoading,dt=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,Xe=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,ct=n.isLoading&&!Ze&&!nt&&!dt&&!Xe,h=n.products??[],q=(0,O.panelMorphKey)(ot?Ke:[]);return(0,Y.useLayoutEffect)(()=>{$.current&&(0,O.settlePanelMorph)($.current,q,{visible:pe,anchorBottom:ge==="above"})},[q,pe,ge,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,te,M]),(0,Y.useEffect)(()=>{let k=$.current;return()=>{k&&(0,O.destroyPanelMorph)(k)}},[]),(0,U.jsxs)("div",{ref:$,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":ge,"data-mode":Ye,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":h.length>0?"":void 0,className:`${st?"magicx-aia ":""}${Ne.dropdown} ${pe?Ne.visible:""} ${d??""}`,onMouseDown:k=>k.preventDefault(),children:[(0,U.jsxs)(la,{space:"8px",children:[(qe||lt)&&(0,U.jsxs)(ft,{noWrap:!0,className:Ne.pillBar,"data-aia-pillbar":"",children:[qe&&(0,U.jsx)("span",{className:Ne.pillScroll,"data-aia-pill-scroll":"",children:(0,U.jsx)(Ct,{pills:Ke,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:n.isLoading})}),lt&&(0,U.jsx)("button",{type:"button",tabIndex:-1,className:Ne.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":Se?`${se.skipLabel} ${Se}`:se.skipLabel,onClick:f,children:se.skip})]}),Ze&&(0,U.jsx)(ra,{options:g,activeIndex:n.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n.isLoading,groupKey:ze?`${ze.parameter} ${ze.text}`:"",optionsPosition:ge,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.isLoading?void 0:n.multiSelectView?.picked}),n.multiSelectView&&!n.isLoading&&(0,U.jsx)("div",{"data-aia-multi-actions":"",onClick:k=>{k.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&at?.()},children:(0,U.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Ne.multiDone,ref:k=>{k&&(k.disabled=!0,k.offsetHeight,k.disabled=n.skipDisabled)},children:se.done})}),nt&&n.dateView&&(0,U.jsx)(Ut,{options:g,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,O.dateFloorFor)(n.formatType,n.dateRangeStart)},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:c??ca,onNextMonth:A??ca}),dt&&n.timeView&&(0,U.jsx)(sa,{view:n.timeView,label:se.timeLabel,doneLabel:se.done,interactive:!n.skipDisabled,onTimeChange:Ve??Qa,onTimeCommit:Ue??ja}),Xe&&n.locationView&&(0,U.jsx)(Zt,{view:n.locationView,searchLabel:se.locationSearch,noResultsLabel:se.locationNoResults,useTypedLabel:se.locationUseTyped,widgetFocused:Oe&&pe,reediting:n.isReediting,visible:pe,interactive:!n.skipDisabled,onQuery:I??$a,onMove:z??Za,onCommit:D??Xa,onFocusChange:ne??Ja}),ct&&(0,U.jsx)("div",{className:Ne.skeletonBars,"data-aia-skeleton-bars":"",children:Ua.map(k=>(0,U.jsx)("span",{className:Ne.skeletonBar,style:{width:k}},`bar-${k}`))}),(0,U.jsx)(ta,{products:h,listboxId:r,onSelect:G??Ya,onAddToCart:oe,onFocusChange:ce,focusable:pe,layout:te,imageFallback:ae,strings:se}),(0,U.jsx)(Yt,{isOptionHighlighted:$e,isInputEmpty:n.isInputEmpty,strings:se})]}),(0,U.jsx)("button",{ref:Qe,type:"button",tabIndex:-1,className:Ne.scrollArrow,"data-aia-scroll-arrow":"","aria-label":se.scrollArrow,"aria-hidden":"true",children:(0,U.jsx)("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,U.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Be=require("@magicx-eng/ai-autocomplete-vanilla");var ha=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
3562
3484
  flex-shrink: 0;
3563
3485
  width: 32px;
3564
3486
  height: 32px;
@@ -3629,5 +3551,5 @@
3629
3551
  transition: none;
3630
3552
  }
3631
3553
  }
3632
- `,document.head.appendChild(e)}var pa={submitButton:"aia-submitButton-otz7H"};var Pt=require("react/jsx-runtime");function ua({disabled:e,ready:a,onClick:t,label:i=(0,ha.uiStringsFor)().submit}){return(0,Pt.jsx)("button",{type:"button","data-aia-submit":"",className:pa.submitButton,disabled:e,"data-aia-ready":a?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":i,children:(0,Pt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Pt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var tt=require("@magicx-eng/ai-autocomplete-vanilla"),R=require("react");var Nt=require("react");function ma(e){let a=(0,Nt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Nt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(d,m,v)=>{let k=a.current?.[s];return k?k(d,m,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var Ft=require("react");function ga(e){let a=(0,Ft.useRef)(e);a.current=e;let t=(0,Ft.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=a.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var fa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateFloor:null,timeView:null,multiSelectView:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function It({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:k,columns:f=2,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showOptionIcons:N,showOptionImages:ae,showOptionCounts:O,showSkipButton:F,showProducts:T,productImageFallback:Y="image",onFocus:ie,onBlur:ce,value:ee,completedParams:te,onChange:P,onParamsChange:Q,products:Ae,mapProducts:ke,onProductSelect:ve,onProductAddToCart:c,source:E,setCursor:Ge}){let b=(0,R.useRef)(null),[at,Ve]=(0,R.useState)(null),Ue=(0,R.useRef)(e);Ue.current=e;let w=(0,R.useRef)(a);w.current=a;let S=(0,R.useRef)(t);S.current=t;let I=(0,R.useRef)(P);I.current=P;let L=(0,R.useRef)(Q);L.current=Q;let z=(0,R.useRef)(ie);z.current=ie;let oe=(0,R.useRef)(ce);oe.current=ce;let Re=(0,R.useRef)(Ge);Re.current=Ge;let ge=(0,R.useRef)(ve);ge.current=ve;let Oe=(0,R.useRef)(c);Oe.current=c;let Ye=(0,R.useRef)(k);Ye.current=k;let st=(0,R.useRef)(()=>{let h=Ye.current;return typeof h=="function"?h():h}).current,j=ga(Ae),Qe=(0,R.useRef)(ke);Qe.current=ke;let pt=(0,R.useRef)((h,K)=>{let C=Qe.current;return C?C(h,K):h}).current,it=ke?pt:void 0,We=ma(i);(0,R.useEffect)(()=>{if(typeof document>"u")return;let h=new tt.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:st,optionOverrides:We.overrides,maskCompletedText:o,columns:f,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showProducts:T,source:E,value:ee,completedParams:te,onSubmit:(...C)=>Ue.current?.(...C),onResult:(...C)=>w.current?.(...C),onError:(...C)=>S.current?.(...C),onChange:(...C)=>I.current?.(...C),onParamsChange:(...C)=>L.current?.(...C),onFocus:()=>z.current?.(),onBlur:()=>oe.current?.(),onProductSelect:C=>ge.current?.(C),onProductAddToCart:C=>Oe.current?.(C),setCursor:C=>Re.current?.(C),products:j.config,mapProducts:it});b.current=h,Ve(h.getState());let K=h.subscribe(C=>Ve(C));return()=>{K(),h.destroy(),b.current===h&&(b.current=null)}},[]),(0,R.useEffect)(()=>{ee!==void 0&&b.current?.setValue(ee)},[ee]),(0,R.useEffect)(()=>{te!==void 0&&b.current?.setCompletedParams(te)},[te]);let ht=JSON.stringify(s??null),je;try{je=JSON.stringify(r??null)}catch{je="[unstringifiable]"}(0,R.useEffect)(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,optionOverrides:We.overrides,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showProducts:T})},[ht,je,d,m?.code,m?.rate,m?.country,v,We.key,p,u,x,A,q,H,T]);let pe=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(!pe.current){pe.current=!0;return}b.current?.update({products:j.config})},[j.enabled]),(0,R.useEffect)(()=>{b.current?.update({mapProducts:it})},[it]);let Ce=(0,R.useRef)(null);Ce.current===null&&(Ce.current={handleTextChange:h=>b.current?.handleTextChange(h),handleKeyDown:h=>{let K="nativeEvent"in h?h.nativeEvent:h;b.current?.handleKeyDown(K)},setFocused:h=>b.current?.setFocused(h),startEditingParam:h=>b.current?.startEditingParam(h),exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:h=>b.current?.handleCaretAfterInput(h),handleCaretMove:h=>b.current?.handleCaretMove(h),replaceEditingRange:h=>b.current?.replaceEditingRange(h)??!1,setActivePill:h=>b.current?.setActivePill(h),skipActivePill:()=>b.current?.skipActivePill(),removeLastParam:()=>b.current?.removeLastParam(),clearNewParamId:()=>b.current?.clearNewParamId(),reset:()=>b.current?.reset(),refreshProducts:()=>b.current?.refreshProducts(),prepareSubmit:()=>b.current?.prepareSubmit(),getState:()=>b.current?.getState()??fa,recordSubmit:h=>b.current?.recordSubmit(h),selectOption:(h,K)=>b.current?.selectOption(h,K),selectProduct:h=>b.current?.selectProduct(h),addProductToCart:h=>{let K=b.current;return!K||!Oe.current?Promise.resolve():K.addProductToCart(h)},setActiveDropdownIndex:h=>b.current?.setActiveDropdownIndex(h),clearHighlight:h=>b.current?.clearHighlight(h),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:h=>b.current?.setTime(h),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:h=>b.current?.toggleMultiSelectOption(h),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:h=>b.current?.setLocationQuery(h),moveLocationHighlight:h=>b.current?.moveLocationHighlight(h),commitLocation:h=>b.current?.commitLocation(h),setLocationFieldFocused:h=>b.current?.setLocationFieldFocused(h),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let y=Ce.current,n=(0,R.useCallback)(h=>{let K=h.target.value,vt=K.length>0&&!h.nativeEvent?.isComposing&&K[0]!==K[0].toUpperCase()?K[0].toUpperCase()+K.slice(1):K;b.current?.handleTextChange(vt)},[]),re=(0,R.useCallback)(h=>{b.current?.handleKeyDown(h.nativeEvent)},[]),Le=b.current,g=at??fa,$e=ee!==void 0?ee:g.text,Ke=te!==void 0?te:g.completedParams,ze=g.actionableSuggestions,ot=ze[0],ut=(0,tt.withoutTraditionalAutocomplete)(ze),qe=Le?.listboxId??"",lt=g.activeDropdownIndex>=0&&Le?`${qe}-option-${g.activeDropdownIndex}`:void 0,Se=g.editingParam,De=g.editingIdentified,Ze=Se?{parameter:Se.suggestionParameter,text:Se.suggestionPlaceholder,required:!0,options:Se.options}:De?{parameter:De.parameter,text:(0,tt.identifiedParamLabel)(De.parameter),required:!0,options:[]}:null,nt=g.dropdownSuggestion??Ze??ot,dt=Ze?[Ze]:ze,Xe=(0,tt.dateSelectionFor)(g),ct=!Le||g.dropdownLoading;return{completedParams:Ke,multiSelectView:g.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:g.skippedParams,identifiedParams:g.identifiedParams,suggestionPills:ut,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:g.segments,newParamId:g.newParamId,clearNewParamId:y.clearNewParamId,suggestions:g.suggestions,activeIndex:g.activeDropdownIndex,isReady:g.isReady,isLoading:ct,isFocused:g.isFocused,isDropdownOpen:g.isDropdownOpen,isActivePillSelected:g.isActivePillSelected,placeholderText:g.placeholderText,listboxId:qe,error:g.error,products:g.products,customFields:g.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Se,editingIdentified:De,editingAnchor:g.editingAnchor,caretOffset:g.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:$e,placeholder:g.placeholderText||void 0,onChange:n,onKeyDown:re,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":g.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":qe},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:nt?[{...nt,options:g.dropdownOptions}]:[],activeIndex:g.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:g.isDropdownOpen,id:qe,pills:dt,activeSelected:g.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(F??!0)&&!Se&&!De,showOptionIcons:N??!0,showOptionImages:ae??!0,showOptionCounts:O??!0,skipDisabled:g.inSelectionAnimation,isLoading:ct,skeletonExiting:g.skeletonExiting,isInputEmpty:$e.trim().length===0,language:d,products:g.products,productImageFallback:Y,onProductSelect:y.selectProduct,onProductAddToCart:c?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:g.activeFormatType,dateView:g.dateView,selectedDateIso:Xe.selectedIso,selectedDateRange:Xe.selectedRange,dateRangeStart:Xe.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:g.timeView,multiSelectView:g.multiSelectView,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:g.locationView,isReediting:g.editingParam!=null,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:g.isFocused||g.locationFieldFocused,optionsPosition:u??"below"}}}var de=require("@magicx-eng/ai-autocomplete-vanilla"),M=require("react"),Et;function ii(){if(Et!==void 0)return Et;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Et=e.contentEditable==="plaintext-only",Et}function ba(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:s,editingIdentified:r,editingAnchor:d,caretOffset:m,placeholderText:v,isFocused:k,isDropdownOpen:f,listboxId:p,activeDescendantId:u,autoFocus:x,handleTextChange:A,handleKeyDown:q,handleCaretAfterInput:H,handleCaretMove:N,startEditingParam:ae,replaceEditingRange:O,setFocused:F}=e,T=(0,M.useRef)(null),Y=(0,M.useRef)(!1),ie=(0,M.useRef)(""),ce=(0,M.useRef)(""),ee=(0,M.useRef)(null),te=(0,M.useRef)(0);ee.current=m,(0,M.useEffect)(()=>{if(!x)return;let w=T.current;if(!w)return;document.activeElement===w?F(!0):w.focus();let S=w.ownerDocument??document,I=S.getSelection(),L=I&&I.rangeCount>0&&w.contains(I.anchorNode);if(I&&!L){let z=S.createRange();z.selectNodeContents(w),z.collapse(!0),I.removeAllRanges(),I.addRange(z)}},[x,F]),(0,M.useEffect)(()=>{let w=T.current;if(!w)return;let S=w.ownerDocument??document,I=()=>{let L=S.getSelection();if(!L||L.rangeCount===0||!L.anchorNode||!w.contains(L.anchorNode))return;let z=L.anchorNode,oe=z.nodeType===Node.ELEMENT_NODE?z:z.parentElement,ge=(L.isCollapsed?oe?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Oe=s?.id??r?.id??null;if(ge&&ge!==Oe){ae(ge);return}performance.now()-te.current<50||N((0,de.getCursorOffset)(w))};return S.addEventListener("selectionchange",I),()=>S.removeEventListener("selectionchange",I)},[s,r,ae,N]),(0,M.useEffect)(()=>{let w=T.current;if(!w)return;let S=I=>{let L=(0,de.chipIdFromTap)(w,I.target);L&&(ae(L),(0,de.keepCaretOnChip)(w,L))};return w.addEventListener("click",S),()=>w.removeEventListener("click",S)},[ae]),(0,M.useLayoutEffect)(()=>{let w=T.current;w&&(0,de.renderEditableContent)({input:w,segments:a,newParamId:o,editingParamId:s?.id??null,placeholderText:v??"",isFocused:k,showChipIcons:t,showChipImages:i})},[a,o,s,v,k,t,i]),(0,M.useLayoutEffect)(()=>{let w=ie.current,S=o??"";if(ie.current=S,!S||S===w)return;let I=T.current;if(!I)return;I.focus();let L=ee.current??(0,de.plainTextLength)(I);(0,de.setCursorOffset)(I,L)},[o]),(0,M.useLayoutEffect)(()=>{let w=ce.current,S=s?.id??"";if(ce.current=S,!S||S===w||d==null)return;let I=T.current;I&&(0,de.setCursorOffset)(I,d)},[s,d]);let P=(0,M.useCallback)(()=>{if(Y.current)return;let w=T.current;if(!w)return;let S=(0,de.extractPlainText)(w),L=S.length>0&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;A(L)},[A]),Q=(0,M.useCallback)(()=>{te.current=performance.now(),P();let w=T.current;w&&H((0,de.getCursorOffset)(w))},[P,H]);(0,M.useEffect)(()=>{let w=T.current;if(!w)return;let S=I=>{let L=I,z=L.inputType;if(z==="insertParagraph"||z==="insertLineBreak"||z==="insertFromDrop"){I.preventDefault();return}if(z.startsWith("insert")||z.startsWith("delete")){let oe=z.startsWith("delete")?"":L.data??"";O(oe)&&I.preventDefault()}};return w.addEventListener("beforeinput",S),()=>w.removeEventListener("beforeinput",S)},[O]);let Ae=(0,M.useCallback)(()=>{Y.current=!0,T.current?.setAttribute("data-aia-composing","true")},[]),ke=(0,M.useCallback)(()=>{Y.current=!1,T.current?.removeAttribute("data-aia-composing"),P()},[P]),ve=(0,M.useCallback)(w=>{w.preventDefault();let S=T.current;if(!S)return;let I=(w.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let L=S.ownerDocument??document,z=L.getSelection();if(!z||z.rangeCount===0)return;let oe=z.getRangeAt(0);if(!S.contains(oe.startContainer))return;oe.deleteContents();let Re=L.createTextNode(I);oe.insertNode(Re),oe.setStartAfter(Re),oe.collapse(!0),z.removeAllRanges(),z.addRange(oe),P()},[P]),c=(0,M.useCallback)(w=>q(w),[q]),E=(0,M.useCallback)(()=>F(!0),[F]),Ge=(0,M.useCallback)(()=>F(!1),[F]),b=(0,M.useCallback)(()=>T.current?.focus(),[]),at=(0,M.useCallback)(()=>T.current?.blur(),[]),Ve=(0,M.useCallback)(()=>{let w=T.current;return w?(0,de.extractPlainText)(w):""},[]),Ue=ii()?"plaintext-only":"true";return{inputRef:T,editorProps:{ref:T,contentEditable:Ue,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":p,"aria-expanded":f,"aria-activedescendant":u,spellCheck:!0,enterKeyHint:"send",onInput:Q,onKeyDown:c,onCompositionStart:Ae,onCompositionEnd:ke,onPaste:ve,onFocus:E,onBlur:Ge},getPlainText:Ve,focus:b,blur:at}}var Ee=require("react/jsx-runtime");function oi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var wa=(0,U.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:d,additionalContext:m,language:v,currency:k,productId:f,visitorId:p,columns:u,pillPlacement:x="dropdown",mode:A="auto",optionsPosition:q="below",animations:H=!0,optionsStyle:N="floating",dropdownTrigger:ae,closeDropdownOnBlur:O,prependPlaceholder:F,showNonTappableOptions:T,locationSearch:Y,showOptionIcons:ie=!0,showChipIcons:ce=!0,showChipImages:ee=!0,showOptionImages:te=!0,showOptionCounts:P=!0,showSkipButton:Q,showProducts:Ae,productsLayout:ke,productImageFallback:ve,autoFocus:c=!0,onFocus:E,onBlur:Ge,value:b,completedParams:at,onChange:Ve,onParamsChange:Ue,products:w,mapProducts:S,onProductSelect:I,onProductAddToCart:L,submitButton:z,resetOnSubmit:oe=!0},Re){let ge=(0,U.useRef)(null),Oe=(0,U.useRef)(null),Ye=(0,U.useRef)(null),st=(0,U.useRef)(()=>{}),j=(0,U.useRef)(null),Qe=(0,U.useRef)(null);(0,U.useEffect)(()=>{let B=ge.current;if(B)return j.current?j.current.setMode(A):j.current=new Be.ModeController(B,A),()=>{j.current?.destroy(),j.current=null}},[A]);let pt=(0,U.useCallback)(B=>{let fe=Qe.current?.current;fe&&(fe.focus(),(0,Be.setCursorOffset)(fe,B))},[]),{completedParams:it,suggestionPills:We,setActivePill:ht,skipActivePill:je,segments:pe,newParamId:Ce,clearNewParamId:y,placeholderText:n,isFocused:re,isDropdownOpen:Le,isActivePillSelected:g,isLoading:$e,isReady:Ke,activeIndex:ze,listboxId:ot,handleTextChange:ut,handleKeyDown:qe,setFocused:lt,editingParam:Se,editingIdentified:De,editingAnchor:Ze,caretOffset:nt,startEditingParam:dt,handleCaretAfterInput:Xe,handleCaretMove:ct,replaceEditingRange:h,dropdownProps:K,reset:C,refreshProducts:vt,prepareSubmit:Ht,getState:Bt,recordSubmit:Gt}=It({onSubmit:B=>st.current(B),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:d,additionalContext:m,language:v,currency:k,productId:f,visitorId:p,columns:u,dropdownTrigger:ae,optionsPosition:q,closeDropdownOnBlur:O,prependPlaceholder:F,showNonTappableOptions:T,locationSearch:Y,showOptionIcons:ie,showOptionImages:te,showOptionCounts:P,showSkipButton:Q,showProducts:Ae,onFocus:E,onBlur:Ge,value:b,completedParams:at,onChange:Ve,onParamsChange:Ue,products:w,mapProducts:S,onProductSelect:I,onProductAddToCart:L,source:"full-sdk",setCursor:pt});(0,U.useEffect)(()=>{if(!Ce)return;let B=window.setTimeout(()=>y(),650);return()=>window.clearTimeout(B)},[Ce,y]);let va=ze>=0?`${ot}-option-${ze}`:void 0,{inputRef:At,editorProps:xa,focus:xt,blur:Wt,getPlainText:Kt}=ba({segments:pe,newParamId:Ce,editingParam:Se,editingIdentified:De,editingAnchor:Ze,caretOffset:nt,placeholderText:n,isFocused:re,showChipIcons:ce,showChipImages:ee,isDropdownOpen:Le,listboxId:ot,activeDescendantId:va,autoFocus:c,handleTextChange:ut,handleKeyDown:qe,handleCaretAfterInput:Xe,handleCaretMove:ct,startEditingParam:dt,replaceEditingRange:h,setFocused:lt});Qe.current=At,(0,U.useLayoutEffect)(()=>{let B=Oe.current,fe=At.current;if(!B||!fe)return;let gt=()=>{let _t=B.firstElementChild;if(!_t)return;let Sa=_t.getBoundingClientRect(),Ta=fe.getBoundingClientRect();Sa.top>=Ta.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};gt();let qt=new ResizeObserver(gt);return qt.observe(fe),()=>qt.disconnect()},[pe,We.length,$e,At]),(0,U.useEffect)(()=>{let B=Ye.current;if(B)return(0,Be.watchEditorHeight)(B)},[]),(0,U.useImperativeHandle)(Re,()=>({focus:xt,blur:Wt,reset:C,refreshProducts:vt,setMode:B=>j.current?.setMode(B),skipActivePill:je}),[xt,Wt,C,vt,je]);let mt=!!pe.length||it.length>0,Rt=(0,U.useCallback)(B=>{if(!mt)return;B&&Ht();let fe=Bt(),gt=(0,Be.buildSubmitResult)(Kt(),fe.completedParams,fe.skippedParams,{identifiedParams:fe.identifiedParams,isReady:fe.isReady,customFields:fe.customFields});B&&Gt(gt),a(gt),oe&&C()},[Gt,oe,mt,Ht,Bt,a,C,Kt]);st.current=()=>Rt(!1);let ya=(0,U.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||xt()},[xt]),ka=x==="inline",Ca=x==="dropdown";return(0,Ee.jsxs)("div",{ref:ge,className:`magicx-aia ${rt.container} ${r??""}`,"data-pill-placement":x,"data-options-position":q,"data-animations":H?"on":"off","data-aia-options-style":N,"data-mode":oi(A),children:[(0,Ee.jsx)(Tt,{...K,showPills:Ca,productsLayout:ke,productImageFallback:ve}),(0,Ee.jsxs)("div",{className:rt.inputWrapper,"data-aia-input-wrapper":"",onClick:ya,children:[(0,Ee.jsxs)("div",{ref:Ye,className:rt.editorArea,"data-aia-editor":"",children:[(0,Ee.jsx)("div",{...xa,className:rt.input,"data-aia-input":""}),ka&&($e||We.length>0)&&(0,Ee.jsx)("span",{ref:Oe,className:rt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ee.jsx)(Ct,{pills:We,activePillIndex:0,activeSelected:g,onSelectPill:ht,loading:$e})})]}),z===null?null:z===void 0?(0,Ee.jsx)(ua,{disabled:!mt,ready:mt&&Ke,onClick:()=>Rt(!0),label:(0,Be.uiStringsFor)(v).submit}):(0,Ee.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:rt.submitSlot,onClick:B=>{mt&&(B.stopPropagation(),Rt(!0))},children:z})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
3554
+ `,document.head.appendChild(e)}var pa={submitButton:"aia-submitButton-otz7H"};var Pt=require("react/jsx-runtime");function ua({disabled:e,ready:a,onClick:t,label:i=(0,ha.uiStringsFor)().submit}){return(0,Pt.jsx)("button",{type:"button","data-aia-submit":"",className:pa.submitButton,disabled:e,"data-aia-ready":a?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":i,children:(0,Pt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Pt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var tt=require("@magicx-eng/ai-autocomplete-vanilla"),L=require("react");var Nt=require("react");function ma(e){let a=(0,Nt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Nt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(d,m,v)=>{let C=a.current?.[s];return C?C(d,m,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var Ht=require("react");function ga(e){let a=(0,Ht.useRef)(e);a.current=e;let t=(0,Ht.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=a.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var fa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateFloor:null,timeView:null,multiSelectView:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function It({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:C,columns:f=2,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:R,showNonTappableOptions:_,locationSearch:F,showOptionIcons:H,showOptionImages:ie,showOptionCounts:E,showSkipButton:M,showProducts:T,productImageFallback:G="image",onFocus:oe,onBlur:ce,value:te,completedParams:ae,onChange:P,onParamsChange:j,products:Re,mapProducts:ke,onProductSelect:ve,onProductAddToCart:c,source:A,setCursor:We}){let b=(0,L.useRef)(null),[at,Ve]=(0,L.useState)(null),Ue=(0,L.useRef)(e);Ue.current=e;let w=(0,L.useRef)(a);w.current=a;let S=(0,L.useRef)(t);S.current=t;let I=(0,L.useRef)(P);I.current=P;let z=(0,L.useRef)(j);z.current=j;let D=(0,L.useRef)(oe);D.current=oe;let ne=(0,L.useRef)(ce);ne.current=ce;let Oe=(0,L.useRef)(We);Oe.current=We;let ge=(0,L.useRef)(ve);ge.current=ve;let Le=(0,L.useRef)(c);Le.current=c;let Ye=(0,L.useRef)(C);Ye.current=C;let st=(0,L.useRef)(()=>{let h=Ye.current;return typeof h=="function"?h():h}).current,$=ga(Re),Qe=(0,L.useRef)(ke);Qe.current=ke;let pt=(0,L.useRef)((h,q)=>{let k=Qe.current;return k?k(h,q):h}).current,it=ke?pt:void 0,Ge=ma(i);(0,L.useEffect)(()=>{if(typeof document>"u")return;let h=new tt.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:st,optionOverrides:Ge.overrides,maskCompletedText:o,columns:f,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:R,showNonTappableOptions:_,locationSearch:F,showProducts:T,source:A,value:te,completedParams:ae,onSubmit:(...k)=>Ue.current?.(...k),onResult:(...k)=>w.current?.(...k),onError:(...k)=>S.current?.(...k),onChange:(...k)=>I.current?.(...k),onParamsChange:(...k)=>z.current?.(...k),onFocus:()=>D.current?.(),onBlur:()=>ne.current?.(),onProductSelect:k=>ge.current?.(k),onProductAddToCart:k=>Le.current?.(k),setCursor:k=>Oe.current?.(k),products:$.config,mapProducts:it});b.current=h,Ve(h.getState());let q=h.subscribe(k=>Ve(k));return()=>{q(),h.destroy(),b.current===h&&(b.current=null)}},[]),(0,L.useEffect)(()=>{te!==void 0&&b.current?.setValue(te)},[te]),(0,L.useEffect)(()=>{ae!==void 0&&b.current?.setCompletedParams(ae)},[ae]);let ht=JSON.stringify(s??null),je;try{je=JSON.stringify(r??null)}catch{je="[unstringifiable]"}(0,L.useEffect)(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,optionOverrides:Ge.overrides,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:R,showNonTappableOptions:_,locationSearch:F,showProducts:T})},[ht,je,d,m?.code,m?.rate,m?.country,v,Ge.key,p,u,x,R,_,F,T]);let pe=(0,L.useRef)(!1);(0,L.useEffect)(()=>{if(!pe.current){pe.current=!0;return}b.current?.update({products:$.config})},[$.enabled]),(0,L.useEffect)(()=>{b.current?.update({mapProducts:it})},[it]);let Ce=(0,L.useRef)(null);Ce.current===null&&(Ce.current={handleTextChange:h=>b.current?.handleTextChange(h),handleKeyDown:h=>{let q="nativeEvent"in h?h.nativeEvent:h;b.current?.handleKeyDown(q)},setFocused:h=>b.current?.setFocused(h),startEditingParam:h=>b.current?.startEditingParam(h),exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:h=>b.current?.handleCaretAfterInput(h),handleCaretMove:h=>b.current?.handleCaretMove(h),replaceEditingRange:h=>b.current?.replaceEditingRange(h)??!1,setActivePill:h=>b.current?.setActivePill(h),skipActivePill:()=>b.current?.skipActivePill(),removeLastParam:()=>b.current?.removeLastParam(),clearNewParamId:()=>b.current?.clearNewParamId(),reset:()=>b.current?.reset(),refreshProducts:()=>b.current?.refreshProducts(),prepareSubmit:()=>b.current?.prepareSubmit(),getState:()=>b.current?.getState()??fa,recordSubmit:h=>b.current?.recordSubmit(h),selectOption:(h,q)=>b.current?.selectOption(h,q),selectProduct:h=>b.current?.selectProduct(h),addProductToCart:h=>{let q=b.current;return!q||!Le.current?Promise.resolve():q.addProductToCart(h)},setActiveDropdownIndex:h=>b.current?.setActiveDropdownIndex(h),clearHighlight:h=>b.current?.clearHighlight(h),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:h=>b.current?.setTime(h),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:h=>b.current?.toggleMultiSelectOption(h),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:h=>b.current?.setLocationQuery(h),moveLocationHighlight:h=>b.current?.moveLocationHighlight(h),commitLocation:h=>b.current?.commitLocation(h),setLocationFieldFocused:h=>b.current?.setLocationFieldFocused(h),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let y=Ce.current,n=(0,L.useCallback)(h=>{let q=h.target.value,vt=q.length>0&&!h.nativeEvent?.isComposing&&q[0]!==q[0].toUpperCase()?q[0].toUpperCase()+q.slice(1):q;b.current?.handleTextChange(vt)},[]),se=(0,L.useCallback)(h=>{b.current?.handleKeyDown(h.nativeEvent)},[]),ze=b.current,g=at??fa,$e=te!==void 0?te:g.text,Ke=ae!==void 0?ae:g.completedParams,De=g.actionableSuggestions,ot=De[0],ut=(0,tt.withoutTraditionalAutocomplete)(De),qe=ze?.listboxId??"",lt=g.activeDropdownIndex>=0&&ze?`${qe}-option-${g.activeDropdownIndex}`:void 0,Se=g.editingParam,Me=g.editingIdentified,Ze=Se?{parameter:Se.suggestionParameter,text:Se.suggestionPlaceholder,required:!0,options:Se.options}:Me?{parameter:Me.parameter,text:(0,tt.identifiedParamLabel)(Me.parameter),required:!0,options:[]}:null,nt=g.dropdownSuggestion??Ze??ot,dt=Ze?[Ze]:De,Xe=(0,tt.dateSelectionFor)(g),ct=!ze||g.dropdownLoading;return{completedParams:Ke,multiSelectView:g.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:g.skippedParams,identifiedParams:g.identifiedParams,suggestionPills:ut,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:g.segments,newParamId:g.newParamId,clearNewParamId:y.clearNewParamId,suggestions:g.suggestions,activeIndex:g.activeDropdownIndex,isReady:g.isReady,isLoading:ct,isFocused:g.isFocused,isDropdownOpen:g.isDropdownOpen,isActivePillSelected:g.isActivePillSelected,placeholderText:g.placeholderText,listboxId:qe,error:g.error,products:g.products,customFields:g.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Se,editingIdentified:Me,editingAnchor:g.editingAnchor,caretOffset:g.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:$e,placeholder:g.placeholderText||void 0,onChange:n,onKeyDown:se,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":g.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":qe},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:nt?[{...nt,options:g.dropdownOptions}]:[],activeIndex:g.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:g.isDropdownOpen,id:qe,pills:dt,activeSelected:g.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(M??!0)&&!Se&&!Me,showOptionIcons:H??!0,showOptionImages:ie??!0,showOptionCounts:E??!0,skipDisabled:g.inSelectionAnimation,isLoading:ct,skeletonExiting:g.skeletonExiting,isInputEmpty:$e.trim().length===0,language:d,products:g.products,productImageFallback:G,onProductSelect:y.selectProduct,onProductAddToCart:c?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:g.activeFormatType,dateView:g.dateView,selectedDateIso:Xe.selectedIso,selectedDateRange:Xe.selectedRange,dateRangeStart:Xe.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:g.timeView,multiSelectView:g.multiSelectView,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:g.locationView,isReediting:g.editingParam!=null,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:g.isFocused||g.locationFieldFocused,optionsPosition:u??"below"}}}var de=require("@magicx-eng/ai-autocomplete-vanilla"),N=require("react"),Et;function ii(){if(Et!==void 0)return Et;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Et=e.contentEditable==="plaintext-only",Et}function ba(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:s,editingIdentified:r,editingAnchor:d,caretOffset:m,placeholderText:v,isFocused:C,isDropdownOpen:f,listboxId:p,activeDescendantId:u,autoFocus:x,handleTextChange:R,handleKeyDown:_,handleCaretAfterInput:F,handleCaretMove:H,startEditingParam:ie,replaceEditingRange:E,setFocused:M}=e,T=(0,N.useRef)(null),G=(0,N.useRef)(!1),oe=(0,N.useRef)(""),ce=(0,N.useRef)(""),te=(0,N.useRef)(null),ae=(0,N.useRef)(0);te.current=m,(0,N.useEffect)(()=>{if(!x)return;let w=T.current;if(!w)return;document.activeElement===w?M(!0):w.focus();let S=w.ownerDocument??document,I=S.getSelection(),z=I&&I.rangeCount>0&&w.contains(I.anchorNode);if(I&&!z){let D=S.createRange();D.selectNodeContents(w),D.collapse(!0),I.removeAllRanges(),I.addRange(D)}},[x,M]),(0,N.useEffect)(()=>{let w=T.current;if(!w)return;let S=w.ownerDocument??document,I=()=>{let z=S.getSelection();if(!z||z.rangeCount===0||!z.anchorNode||!w.contains(z.anchorNode))return;let D=z.anchorNode,ne=D.nodeType===Node.ELEMENT_NODE?D:D.parentElement,ge=(z.isCollapsed?ne?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Le=s?.id??r?.id??null;if(ge&&ge!==Le){ie(ge);return}performance.now()-ae.current<50||H((0,de.getCursorOffset)(w))};return S.addEventListener("selectionchange",I),()=>S.removeEventListener("selectionchange",I)},[s,r,ie,H]),(0,N.useEffect)(()=>{let w=T.current;if(!w)return;let S=I=>{let z=(0,de.chipIdFromTap)(w,I.target);z&&(ie(z),(0,de.keepCaretOnChip)(w,z))};return w.addEventListener("click",S),()=>w.removeEventListener("click",S)},[ie]),(0,N.useLayoutEffect)(()=>{let w=T.current;w&&(0,de.renderEditableContent)({input:w,segments:a,newParamId:o,editingParamId:s?.id??null,placeholderText:v??"",isFocused:C,showChipIcons:t,showChipImages:i})},[a,o,s,v,C,t,i]),(0,N.useLayoutEffect)(()=>{let w=oe.current,S=o??"";if(oe.current=S,!S||S===w)return;let I=T.current;if(!I)return;I.focus();let z=te.current??(0,de.plainTextLength)(I);(0,de.setCursorOffset)(I,z)},[o]),(0,N.useLayoutEffect)(()=>{let w=ce.current,S=s?.id??"";if(ce.current=S,!S||S===w||d==null)return;let I=T.current;I&&(0,de.setCursorOffset)(I,d)},[s,d]);let P=(0,N.useCallback)(()=>{if(G.current)return;let w=T.current;if(!w)return;let S=(0,de.extractPlainText)(w),z=S.length>0&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;R(z)},[R]),j=(0,N.useCallback)(()=>{ae.current=performance.now(),P();let w=T.current;w&&F((0,de.getCursorOffset)(w))},[P,F]);(0,N.useEffect)(()=>{let w=T.current;if(!w)return;let S=I=>{let z=I,D=z.inputType;if(D==="insertParagraph"||D==="insertLineBreak"||D==="insertFromDrop"){I.preventDefault();return}if(D.startsWith("insert")||D.startsWith("delete")){let ne=D.startsWith("delete")?"":z.data??"";E(ne)&&I.preventDefault()}};return w.addEventListener("beforeinput",S),()=>w.removeEventListener("beforeinput",S)},[E]);let Re=(0,N.useCallback)(()=>{G.current=!0,T.current?.setAttribute("data-aia-composing","true")},[]),ke=(0,N.useCallback)(()=>{G.current=!1,T.current?.removeAttribute("data-aia-composing"),P()},[P]),ve=(0,N.useCallback)(w=>{w.preventDefault();let S=T.current;if(!S)return;let I=(w.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let z=S.ownerDocument??document,D=z.getSelection();if(!D||D.rangeCount===0)return;let ne=D.getRangeAt(0);if(!S.contains(ne.startContainer))return;ne.deleteContents();let Oe=z.createTextNode(I);ne.insertNode(Oe),ne.setStartAfter(Oe),ne.collapse(!0),D.removeAllRanges(),D.addRange(ne),P()},[P]),c=(0,N.useCallback)(w=>_(w),[_]),A=(0,N.useCallback)(()=>M(!0),[M]),We=(0,N.useCallback)(()=>M(!1),[M]),b=(0,N.useCallback)(()=>T.current?.focus(),[]),at=(0,N.useCallback)(()=>T.current?.blur(),[]),Ve=(0,N.useCallback)(()=>{let w=T.current;return w?(0,de.extractPlainText)(w):""},[]),Ue=ii()?"plaintext-only":"true";return{inputRef:T,editorProps:{ref:T,contentEditable:Ue,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":p,"aria-expanded":f,"aria-activedescendant":u,spellCheck:!0,enterKeyHint:"send",onInput:j,onKeyDown:c,onCompositionStart:Re,onCompositionEnd:ke,onPaste:ve,onFocus:A,onBlur:We},getPlainText:Ve,focus:b,blur:at}}var Ae=require("react/jsx-runtime");function oi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var wa=(0,Q.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:d,additionalContext:m,language:v,currency:C,productId:f,visitorId:p,columns:u,pillPlacement:x="dropdown",mode:R="auto",optionsPosition:_="below",animations:F=!0,optionsStyle:H="floating",dropdownTrigger:ie,closeDropdownOnBlur:E,prependPlaceholder:M,showNonTappableOptions:T,locationSearch:G,showOptionIcons:oe=!0,showChipIcons:ce=!0,showChipImages:te=!0,showOptionImages:ae=!0,showOptionCounts:P=!0,showSkipButton:j,showProducts:Re,productsLayout:ke,productImageFallback:ve,autoFocus:c=!0,onFocus:A,onBlur:We,value:b,completedParams:at,onChange:Ve,onParamsChange:Ue,products:w,mapProducts:S,onProductSelect:I,onProductAddToCart:z,submitButton:D,resetOnSubmit:ne=!0},Oe){let ge=(0,Q.useRef)(null),Le=(0,Q.useRef)(null),Ye=(0,Q.useRef)(null),st=(0,Q.useRef)(()=>{}),$=(0,Q.useRef)(null),Qe=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let B=ge.current;if(B)return $.current?$.current.setMode(R):$.current=new Be.ModeController(B,R),()=>{$.current?.destroy(),$.current=null}},[R]);let pt=(0,Q.useCallback)(B=>{let fe=Qe.current?.current;fe&&(fe.focus(),(0,Be.setCursorOffset)(fe,B))},[]),{completedParams:it,suggestionPills:Ge,setActivePill:ht,skipActivePill:je,segments:pe,newParamId:Ce,clearNewParamId:y,placeholderText:n,isFocused:se,isDropdownOpen:ze,isActivePillSelected:g,isLoading:$e,isReady:Ke,activeIndex:De,listboxId:ot,handleTextChange:ut,handleKeyDown:qe,setFocused:lt,editingParam:Se,editingIdentified:Me,editingAnchor:Ze,caretOffset:nt,startEditingParam:dt,handleCaretAfterInput:Xe,handleCaretMove:ct,replaceEditingRange:h,dropdownProps:q,reset:k,refreshProducts:vt,prepareSubmit:Ft,getState:Bt,recordSubmit:Wt}=It({onSubmit:B=>st.current(B),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:d,additionalContext:m,language:v,currency:C,productId:f,visitorId:p,columns:u,dropdownTrigger:ie,optionsPosition:_,closeDropdownOnBlur:E,prependPlaceholder:M,showNonTappableOptions:T,locationSearch:G,showOptionIcons:oe,showOptionImages:ae,showOptionCounts:P,showSkipButton:j,showProducts:Re,onFocus:A,onBlur:We,value:b,completedParams:at,onChange:Ve,onParamsChange:Ue,products:w,mapProducts:S,onProductSelect:I,onProductAddToCart:z,source:"full-sdk",setCursor:pt});(0,Q.useEffect)(()=>{if(!Ce)return;let B=window.setTimeout(()=>y(),650);return()=>window.clearTimeout(B)},[Ce,y]);let va=De>=0?`${ot}-option-${De}`:void 0,{inputRef:At,editorProps:xa,focus:xt,blur:Gt,getPlainText:Kt}=ba({segments:pe,newParamId:Ce,editingParam:Se,editingIdentified:Me,editingAnchor:Ze,caretOffset:nt,placeholderText:n,isFocused:se,showChipIcons:ce,showChipImages:te,isDropdownOpen:ze,listboxId:ot,activeDescendantId:va,autoFocus:c,handleTextChange:ut,handleKeyDown:qe,handleCaretAfterInput:Xe,handleCaretMove:ct,startEditingParam:dt,replaceEditingRange:h,setFocused:lt});Qe.current=At,(0,Q.useLayoutEffect)(()=>{let B=Le.current,fe=At.current;if(!B||!fe)return;let gt=()=>{let _t=B.firstElementChild;if(!_t)return;let Sa=_t.getBoundingClientRect(),Ta=fe.getBoundingClientRect();Sa.top>=Ta.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};gt();let qt=new ResizeObserver(gt);return qt.observe(fe),()=>qt.disconnect()},[pe,Ge.length,$e,At]),(0,Q.useEffect)(()=>{let B=Ye.current;if(B)return(0,Be.watchEditorHeight)(B)},[]),(0,Q.useImperativeHandle)(Oe,()=>({focus:xt,blur:Gt,reset:k,refreshProducts:vt,setMode:B=>$.current?.setMode(B),skipActivePill:je}),[xt,Gt,k,vt,je]);let mt=!!pe.length||it.length>0,Rt=(0,Q.useCallback)(B=>{if(!mt)return;B&&Ft();let fe=Bt(),gt=(0,Be.buildSubmitResult)(Kt(),fe.completedParams,fe.skippedParams,{identifiedParams:fe.identifiedParams,isReady:fe.isReady,customFields:fe.customFields});B&&Wt(gt),a(gt),ne&&k()},[Wt,ne,mt,Ft,Bt,a,k,Kt]);st.current=()=>Rt(!1);let ya=(0,Q.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||xt()},[xt]),ka=x==="inline",Ca=x==="dropdown";return(0,Ae.jsxs)("div",{ref:ge,className:`magicx-aia ${rt.container} ${r??""}`,"data-pill-placement":x,"data-options-position":_,"data-animations":F?"on":"off","data-aia-options-style":H,"data-mode":oi(R),children:[(0,Ae.jsx)(Tt,{...q,showPills:Ca,productsLayout:ke,productImageFallback:ve}),(0,Ae.jsxs)("div",{className:rt.inputWrapper,"data-aia-input-wrapper":"",onClick:ya,children:[(0,Ae.jsxs)("div",{ref:Ye,className:rt.editorArea,"data-aia-editor":"",children:[(0,Ae.jsx)("div",{...xa,className:rt.input,"data-aia-input":""}),ka&&($e||Ge.length>0)&&(0,Ae.jsx)("span",{ref:Le,className:rt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ae.jsx)(Ct,{pills:Ge,activePillIndex:0,activeSelected:g,onSelectPill:ht,loading:$e})})]}),D===null?null:D===void 0?(0,Ae.jsx)(ua,{disabled:!mt,ready:mt&&Ke,onClick:()=>Rt(!0),label:(0,Be.uiStringsFor)(v).submit}):(0,Ae.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:rt.submitSlot,onClick:B=>{mt&&(B.stopPropagation(),Rt(!0))},children:D})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
3633
3555
  //# sourceMappingURL=index.js.map