@magicx-eng/ai-autocomplete-react 0.5.3 → 0.5.4

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 Re=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var mt=(e,t)=>{for(var o in t)Re(e,o,{get:t[o],enumerable:!0})},gt=(e,t,o,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of pt(t))!ut.call(e,a)&&a!==o&&Re(e,a,{get:()=>t[a],enumerable:!(l=ct(t,a))||l.enumerable});return e};var ft=e=>gt(Re({},"__esModule",{value:!0}),e);var _t={};mt(_t,{AIAutocomplete:()=>tt,AIAutocompleteDropdown:()=>Ie,useAIAutocomplete:()=>Ae});module.exports=ft(_t);var S=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.AIAutocomplete-module_container_KKjFU {
1
+ "use strict";var Re=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var mt=(e,t)=>{for(var a in t)Re(e,a,{get:t[a],enumerable:!0})},gt=(e,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ct(t))!ut.call(e,o)&&o!==a&&Re(e,o,{get:()=>t[o],enumerable:!(l=pt(t,o))||l.enumerable});return e};var ft=e=>gt(Re({},"__esModule",{value:!0}),e);var _t={};mt(_t,{AIAutocomplete:()=>tt,AIAutocompleteDropdown:()=>Ie,useAIAutocomplete:()=>Ae});module.exports=ft(_t);var S=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.AIAutocomplete-module_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
@@ -167,75 +167,99 @@
167
167
  box-sizing: border-box;
168
168
  }
169
169
 
170
- /* Light mode defaults (base) */
170
+ /*
171
+ * Primitive color ramp \u2014 single source of truth, mirroring the Figma
172
+ * "Primitives" collection. INTERNAL: theme via the public --aia-* vars below,
173
+ * not these. Mode-independent (raw values; the same in light and dark).
174
+ */
175
+ :where(.magicx-aia) {
176
+ --aia-primitive-neutral-0: #000000;
177
+ --aia-primitive-neutral-250: #323232;
178
+ --aia-primitive-neutral-300: #333539;
179
+ --aia-primitive-neutral-400: #4a4a4a;
180
+ --aia-primitive-neutral-500: #505050;
181
+ --aia-primitive-neutral-700: #b0b0b0;
182
+ --aia-primitive-neutral-750: #bdbdbd;
183
+ --aia-primitive-neutral-900: #e7e7e7;
184
+ --aia-primitive-neutral-1000: #ffffff;
185
+ --aia-primitive-blue-50: #eef2ff;
186
+ --aia-primitive-neutral-750-a50: rgba(189, 189, 189, 0.51);
187
+ --aia-primitive-neutral-700-a40: rgba(176, 176, 176, 0.4);
188
+ }
189
+
190
+ /* Light mode defaults (base) \u2014 public --aia-* vars resolve to primitives */
171
191
  :where(.magicx-aia),
172
192
  :where(.magicx-aia[data-mode="light"]) {
173
- --aia-surface: #ffffff;
174
- --aia-border: #b0b0b0;
175
- --aia-dropdown-border: #e5e7eb;
193
+ --aia-surface: var(--aia-primitive-neutral-1000);
194
+ --aia-border: var(--aia-primitive-neutral-700);
195
+ --aia-dropdown-border: var(
196
+ --aia-primitive-neutral-900
197
+ ); /* was #e5e7eb \u2014 snapped to palette (\u03942) */
176
198
  --aia-dropdown-shadow: 0 8px 12px rgba(0, 0, 0, 0.1);
177
- --aia-pill-bg: #bdbdbd;
178
- --aia-pill-color: #333539;
199
+ --aia-pill-bg: var(--aia-primitive-neutral-750); /* solid; per-pill opacity via getPillOpacity */
200
+ --aia-pill-color: var(--aia-primitive-neutral-300);
179
201
  --aia-pill-font-size: 14px;
180
202
 
181
- --aia-option-bg: #eef2ff;
182
- --aia-option-color: #505050;
183
- --aia-option-color-selected: #000000;
203
+ --aia-option-bg: var(--aia-primitive-blue-50);
204
+ --aia-option-color: var(--aia-primitive-neutral-500);
205
+ --aia-option-color-selected: var(--aia-primitive-neutral-0);
184
206
  --aia-option-font-size: 14px;
185
207
 
186
- --aia-written-text-color: #000000;
208
+ --aia-written-text-color: var(--aia-primitive-neutral-0);
187
209
  --aia-written-text-font-size: 14px;
188
210
  --aia-caret-color: var(--aia-written-text-color, #000000);
189
211
 
190
- --aia-submit-bg: #000000;
191
- --aia-submit-color: #ffffff;
212
+ --aia-submit-bg: var(--aia-primitive-neutral-0);
213
+ --aia-submit-color: var(--aia-primitive-neutral-1000);
192
214
 
193
- --aia-color-text-muted: #6b7280;
215
+ --aia-color-text-muted: #6b7280; /* off shared palette (slate) */
194
216
 
195
- --aia-skeleton-bg: rgba(189, 189, 189, 0.51);
217
+ --aia-skeleton-bg: var(--aia-primitive-neutral-750-a50);
196
218
 
197
- --aia-streak-rgb: 99, 102, 241;
219
+ --aia-streak-rgb: 99, 102, 241; /* off shared palette (indigo effect) */
198
220
  --aia-streak-glass-bg: rgba(99, 102, 241, 0.1);
199
221
 
200
- --aia-footer-divider: rgba(176, 176, 176, 0.4);
201
- --aia-footer-hint-color: #505050;
202
- --aia-footer-brand-color: #b0b0b0;
203
- --aia-footer-badge-border: rgba(189, 189, 189, 0.51);
222
+ --aia-footer-divider: var(--aia-primitive-neutral-700-a40);
223
+ --aia-footer-hint-color: var(--aia-primitive-neutral-500);
224
+ --aia-footer-brand-color: var(--aia-primitive-neutral-700);
225
+ --aia-footer-badge-border: var(--aia-primitive-neutral-750-a50);
204
226
  }
205
227
 
206
228
  /* Dark mode defaults */
207
229
  :where(.magicx-aia[data-mode="dark"]) {
208
- --aia-surface: #000000;
209
- --aia-border: #505050;
210
- --aia-dropdown-border: #484848;
230
+ --aia-surface: var(--aia-primitive-neutral-0);
231
+ --aia-border: var(--aia-primitive-neutral-500);
232
+ --aia-dropdown-border: var(
233
+ --aia-primitive-neutral-400
234
+ ); /* was #484848 \u2014 snapped to palette (\u03942) */
211
235
  --aia-dropdown-shadow: 0 8px 12px rgba(0, 0, 0, 0.1);
212
- --aia-pill-bg: #bdbdbd;
213
- --aia-pill-color: #b0b0b0;
236
+ --aia-pill-bg: var(--aia-primitive-neutral-750);
237
+ --aia-pill-color: var(--aia-primitive-neutral-700);
214
238
  --aia-pill-font-size: 14px;
215
239
 
216
- --aia-option-bg: #323232;
217
- --aia-option-color: #b0b0b0;
218
- --aia-option-color-selected: #ffffff;
240
+ --aia-option-bg: var(--aia-primitive-neutral-250);
241
+ --aia-option-color: var(--aia-primitive-neutral-700);
242
+ --aia-option-color-selected: var(--aia-primitive-neutral-1000);
219
243
  --aia-option-font-size: 14px;
220
244
 
221
- --aia-written-text-color: #ffffff;
245
+ --aia-written-text-color: var(--aia-primitive-neutral-1000);
222
246
  --aia-written-text-font-size: 14px;
223
247
  --aia-caret-color: var(--aia-written-text-color, #ffffff);
224
248
 
225
- --aia-submit-bg: #ffffff;
226
- --aia-submit-color: #000000;
249
+ --aia-submit-bg: var(--aia-primitive-neutral-1000);
250
+ --aia-submit-color: var(--aia-primitive-neutral-0);
227
251
 
228
- --aia-color-text-muted: #c1c4cb;
252
+ --aia-color-text-muted: #c1c4cb; /* off shared palette (slate) */
229
253
 
230
- --aia-skeleton-bg: #333539;
254
+ --aia-skeleton-bg: var(--aia-primitive-neutral-300);
231
255
 
232
256
  --aia-streak-rgb: 255, 255, 255;
233
257
  --aia-streak-glass-bg: rgba(255, 255, 255, 0.1);
234
258
 
235
- --aia-footer-divider: rgba(255, 255, 255, 0.15);
236
- --aia-footer-hint-color: #b0b0b0;
237
- --aia-footer-brand-color: #505050;
238
- --aia-footer-badge-border: #505050;
259
+ --aia-footer-divider: rgba(255, 255, 255, 0.15); /* off shared palette (no .15 step) */
260
+ --aia-footer-hint-color: var(--aia-primitive-neutral-700);
261
+ --aia-footer-brand-color: var(--aia-primitive-neutral-500);
262
+ --aia-footer-badge-border: var(--aia-primitive-neutral-500);
239
263
  }
240
264
 
241
265
  /* optionsPosition: dropdown above the input. The sections live inside the
@@ -372,7 +396,7 @@
372
396
  opacity: 0.25;
373
397
  }
374
398
  }
375
- `,document.head.appendChild(e)}var ce={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};var Ke=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`@layer layout {
399
+ `,document.head.appendChild(e)}var pe={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};var Ke=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`@layer layout {
376
400
  .aia-cluster {
377
401
  display: flex;
378
402
  flex-wrap: wrap;
@@ -414,7 +438,7 @@
414
438
  justify-content: space-around;
415
439
  }
416
440
  }
417
- `,document.head.appendChild(e)}var Le=require("react/jsx-runtime");function fe({gap:e,align:t="center",justify:o="start",noWrap:l=!1,inline:a=!1,className:n,children:d,...c}){let h=e?{"--aia-cluster-gap":e}:void 0,v={className:n?`aia-cluster ${n}`:"aia-cluster","data-align":t,"data-justify":o,"data-nowrap":l||void 0,"data-inline":a||void 0,style:h,...c};return a?(0,Le.jsx)("span",{...v,children:d}):(0,Le.jsx)("div",{...v,children:d})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset (no vertical padding \u2014 the 8px
441
+ `,document.head.appendChild(e)}var Le=require("react/jsx-runtime");function fe({gap:e,align:t="center",justify:a="start",noWrap:l=!1,inline:o=!1,className:n,children:d,...p}){let h=e?{"--aia-cluster-gap":e}:void 0,v={className:n?`aia-cluster ${n}`:"aia-cluster","data-align":t,"data-justify":a,"data-nowrap":l||void 0,"data-inline":o||void 0,style:h,...p};return o?(0,Le.jsx)("span",{...v,children:d}):(0,Le.jsx)("div",{...v,children:d})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset (no vertical padding \u2014 the 8px
418
442
  section gap above and its own 8px gap provide the vertical rhythm), so the
419
443
  divider spans the full footer width yet still stays clear of the dropdown's
420
444
  rounded edges. */
@@ -487,7 +511,20 @@
487
511
  line-height: 18px;
488
512
  color: var(--aia-footer-brand-color, #b0b0b0);
489
513
  }
490
- `,document.head.appendChild(e)}var Y={footer:"DropdownFooter-module_footer_qQQ7x",divider:"DropdownFooter-module_divider_FlX4C",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg"};var G=require("react/jsx-runtime");function We({isOptionHighlighted:e=!1,isInputEmpty:t=!1}){let{key:o,hint:l}=(0,Ke.getFooterHint)(e,t);return(0,G.jsxs)("footer",{className:Y.footer,"data-aia-footer":"",children:[(0,G.jsx)("div",{className:Y.divider}),(0,G.jsxs)(fe,{justify:"between",noWrap:!0,children:[(0,G.jsxs)(fe,{gap:"5px",className:Y.hintGroup,children:[(0,G.jsx)("kbd",{className:Y.key,children:o}),(0,G.jsx)("span",{className:Y.hint,children:l})]}),(0,G.jsxs)("a",{className:Y.brandLink,href:"https://ai-autocomplete.com",target:"_blank",rel:"noopener noreferrer",children:[(0,G.jsx)("span",{className:Y.brand,children:"AI"}),(0,G.jsx)("span",{className:Y.badge,children:"Autocomplete"})]})]})]})}if(typeof document<"u"&&!document.getElementById("ac-style-04fef8d6")){let e=document.createElement("style");e.id="ac-style-04fef8d6",e.textContent=`.Pill-module_pill_3Rkw- {
514
+
515
+ /* Mobile footer variant (Figma "Mobile"): on phone-width viewports drop the
516
+ keyboard hint ("tab to select" is meaningless on touch) and its divider,
517
+ leaving only the AI-Autocomplete brand pinned to the right. */
518
+ @media (max-width: 768px) {
519
+ .DropdownFooter-module_divider_FlX4C,
520
+ .DropdownFooter-module_hintGroup_ZzbPf {
521
+ display: none;
522
+ }
523
+ .DropdownFooter-module_row_BgZ6Q {
524
+ justify-content: flex-end;
525
+ }
526
+ }
527
+ `,document.head.appendChild(e)}var Q={footer:"DropdownFooter-module_footer_qQQ7x",divider:"DropdownFooter-module_divider_FlX4C",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg",row:"DropdownFooter-module_row_BgZ6Q"};var G=require("react/jsx-runtime");function We({isOptionHighlighted:e=!1,isInputEmpty:t=!1}){let{key:a,hint:l}=(0,Ke.getFooterHint)(e,t);return(0,G.jsxs)("footer",{className:Q.footer,"data-aia-footer":"",children:[(0,G.jsx)("div",{className:Q.divider}),(0,G.jsxs)(fe,{justify:"between",noWrap:!0,className:Q.row,children:[(0,G.jsxs)(fe,{gap:"5px",className:Q.hintGroup,children:[(0,G.jsx)("kbd",{className:Q.key,children:a}),(0,G.jsx)("span",{className:Q.hint,children:l})]}),(0,G.jsxs)("a",{className:Q.brandLink,href:"https://ai-autocomplete.com",target:"_blank",rel:"noopener noreferrer",children:[(0,G.jsx)("span",{className:Q.brand,children:"AI"}),(0,G.jsx)("span",{className:Q.badge,children:"Autocomplete"})]})]})]})}if(typeof document<"u"&&!document.getElementById("ac-style-04fef8d6")){let e=document.createElement("style");e.id="ac-style-04fef8d6",e.textContent=`.Pill-module_pill_3Rkw- {
491
528
  display: inline-flex;
492
529
  align-items: center;
493
530
  justify-content: center;
@@ -539,7 +576,7 @@
539
576
  opacity: 0;
540
577
  }
541
578
  }
542
- `,document.head.appendChild(e)}var ee={pill:"Pill-module_pill_3Rkw-",fadeIn:"Pill-module_fadeIn_Bbqtz",rounded:"Pill-module_rounded_6WMps",skeleton:"Pill-module_skeleton_-u9-j",skeletonPulse:"Pill-module_skeletonPulse_xHh-7"};var je=require("react/jsx-runtime"),Te={selected:1,first:.7,next:.4,last:.2};function Ge({label:e,state:t,selected:o,rounded:l,loading:a,onClick:n}){let d=[ee.pill,l?ee.rounded:"",o&&!a?ee.active:"",a?ee.skeleton:""].filter(Boolean).join(" ");return(0,je.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":a?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:d,style:{opacity:Te[t]},onMouseDown:c=>c.preventDefault(),onClick:a?void 0:n,disabled:a,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.PillList-module_list_qvLqO {
579
+ `,document.head.appendChild(e)}var ee={pill:"Pill-module_pill_3Rkw-",fadeIn:"Pill-module_fadeIn_Bbqtz",rounded:"Pill-module_rounded_6WMps",skeleton:"Pill-module_skeleton_-u9-j",skeletonPulse:"Pill-module_skeletonPulse_xHh-7"};var je=require("react/jsx-runtime"),Te={selected:1,first:.7,next:.4,last:.2};function Ge({label:e,state:t,selected:a,rounded:l,loading:o,onClick:n}){let d=[ee.pill,l?ee.rounded:"",a&&!o?ee.active:"",o?ee.skeleton:""].filter(Boolean).join(" ");return(0,je.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":o?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:d,style:{opacity:Te[t]},onMouseDown:p=>p.preventDefault(),onClick:o?void 0:n,disabled:o,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.PillList-module_list_qvLqO {
543
580
  position: relative;
544
581
  z-index: 1;
545
582
  pointer-events: auto;
@@ -549,7 +586,7 @@
549
586
  align-items: center;
550
587
  vertical-align: middle;
551
588
  }
552
- `,document.head.appendChild(e)}var Be={list:"PillList-module_list_qvLqO"};var he=require("react/jsx-runtime"),ht=[125,69];function Ve(e){return e===0?"first":e===1?"next":"last"}function ke({pills:e,activePillIndex:t,onSelectPill:o,activeSelected:l,rounded:a,loading:n}){return n&&e.length===0?(0,he.jsx)("span",{className:Be.list,"data-aia-pill-list-loading":"",children:ht.map((d,c)=>(0,he.jsx)("span",{"data-aia-pill-skeleton":"",className:`${ee.pill} ${a?ee.rounded:""} ${ee.skeleton}`,style:{width:d,opacity:Te[Ve(c)]}},`skel-${d}`))}):(0,he.jsx)("span",{className:Be.list,"data-aia-pill-list-loading":n?"":void 0,children:e.map((d,c)=>{let h=!!l&&c===t;return(0,he.jsx)(Ge,{label:d.text,state:h?"selected":Ve(c),selected:h,rounded:a,loading:n,onClick:()=>o(c)},`${d.type}-${d.text}`)})})}var ne=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`@layer layout {
589
+ `,document.head.appendChild(e)}var Be={list:"PillList-module_list_qvLqO"};var he=require("react/jsx-runtime"),ht=[125,69];function Ve(e){return e===0?"first":e===1?"next":"last"}function ke({pills:e,activePillIndex:t,onSelectPill:a,activeSelected:l,rounded:o,loading:n}){return n&&e.length===0?(0,he.jsx)("span",{className:Be.list,"data-aia-pill-list-loading":"",children:ht.map((d,p)=>(0,he.jsx)("span",{"data-aia-pill-skeleton":"",className:`${ee.pill} ${o?ee.rounded:""} ${ee.skeleton}`,style:{width:d,opacity:Te[Ve(p)]}},`skel-${d}`))}):(0,he.jsx)("span",{className:Be.list,"data-aia-pill-list-loading":n?"":void 0,children:e.map((d,p)=>{let h=!!l&&p===t;return(0,he.jsx)(Ge,{label:d.text,state:h?"selected":Ve(p),selected:h,rounded:o,loading:n,onClick:()=>a(p)},`${d.type}-${d.text}`)})})}var ne=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`@layer layout {
553
590
  .aia-grid {
554
591
  display: grid;
555
592
  grid-template-columns: repeat(
@@ -582,7 +619,8 @@
582
619
  border-radius: 3px;
583
620
  }
584
621
 
585
- /* Fade wrapper \u2014 bottom blur overlay shown while the grid overflows below. */
622
+ /* Fade wrapper \u2014 bottom gradient overlay shown while the grid overflows
623
+ below: overflowing options fade into the dropdown surface color. */
586
624
  .aia-grid-fade {
587
625
  position: relative;
588
626
  }
@@ -596,14 +634,18 @@
596
634
  pointer-events: none;
597
635
  opacity: 0;
598
636
  transition: opacity 150ms ease-out;
599
- backdrop-filter: blur(12px);
600
- mask-image: linear-gradient(to bottom, transparent, white);
637
+ background: linear-gradient(to bottom, transparent, var(--aia-surface, #ffffff));
601
638
  }
602
639
  .aia-grid-fade[data-fade]::after {
603
640
  opacity: 1;
604
641
  }
642
+
643
+ /* Glass surface has no solid color to fade into, so skip the fade entirely. */
644
+ [data-aia-surface="glass"] .aia-grid-fade::after {
645
+ display: none;
646
+ }
605
647
  }
606
- `,document.head.appendChild(e)}var ze=require("react/jsx-runtime");function qe({min:e="16rem",max:t,gap:o,scroll:l=!1,maxHeight:a,fade:n=!1,className:d,children:c,...h}){let v=(0,ne.useRef)(null),[B,P]=(0,ne.useState)(!1);(0,ne.useEffect)(()=>{if(!n)return;let w=v.current;if(!w)return;let R=()=>{P(w.scrollHeight-w.scrollTop-w.clientHeight>1)};w.addEventListener("scroll",R,{passive:!0});let H=new ResizeObserver(R);return H.observe(w),()=>{w.removeEventListener("scroll",R),H.disconnect()}},[n]),(0,ne.useLayoutEffect)(()=>{let w=v.current;!n||!w||P(w.scrollHeight-w.scrollTop-w.clientHeight>1)},[n,c]);let A={"--aia-grid-min":e};t&&(A["--aia-grid-max"]=t),o&&(A["--aia-grid-gap"]=o),a&&(A["--aia-grid-max-height"]=a);let C=(0,ze.jsx)("div",{ref:v,className:!n&&d?`aia-grid ${d}`:"aia-grid","data-scroll":l||void 0,style:A,...n?{}:h,children:c});return n?(0,ze.jsx)("div",{className:d?`aia-grid-fade ${d}`:"aia-grid-fade","data-fade":B?"":void 0,...h,children:C}):C}var pe=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.SuggestionItem-module_item_d4vpD {
648
+ `,document.head.appendChild(e)}var ze=require("react/jsx-runtime");function qe({min:e="16rem",max:t,gap:a,scroll:l=!1,maxHeight:o,fade:n=!1,className:d,children:p,...h}){let v=(0,ne.useRef)(null),[B,P]=(0,ne.useState)(!1);(0,ne.useEffect)(()=>{if(!n)return;let w=v.current;if(!w)return;let R=()=>{P(w.scrollHeight-w.scrollTop-w.clientHeight>1)};w.addEventListener("scroll",R,{passive:!0});let H=new ResizeObserver(R);return H.observe(w),()=>{w.removeEventListener("scroll",R),H.disconnect()}},[n]),(0,ne.useLayoutEffect)(()=>{let w=v.current;!n||!w||P(w.scrollHeight-w.scrollTop-w.clientHeight>1)},[n,p]);let A={"--aia-grid-min":e};t&&(A["--aia-grid-max"]=t),a&&(A["--aia-grid-gap"]=a),o&&(A["--aia-grid-max-height"]=o);let C=(0,ze.jsx)("div",{ref:v,className:!n&&d?`aia-grid ${d}`:"aia-grid","data-scroll":l||void 0,style:A,...n?{}:h,children:p});return n?(0,ze.jsx)("div",{className:d?`aia-grid-fade ${d}`:"aia-grid-fade","data-fade":B?"":void 0,...h,children:C}):C}var ce=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.SuggestionItem-module_item_d4vpD {
607
649
  position: relative;
608
650
  overflow: visible;
609
651
  display: flex;
@@ -953,7 +995,7 @@
953
995
  filter: brightness(0.55);
954
996
  }
955
997
  }
956
- `,document.head.appendChild(e)}var j={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",glassFade:"SuggestionItem-module_glassFade_oyiSj",tapDown:"SuggestionItem-module_tapDown_G3WGz",streaks:"SuggestionItem-module_streaks_d9PEB",streaksVert:"SuggestionItem-module_streaksVert_ERlV1",streakHorizRight:"SuggestionItem-module_streakHorizRight_aboGz",streakHorizLeft:"SuggestionItem-module_streakHorizLeft_BreWJ",streakVertUp:"SuggestionItem-module_streakVertUp_to1GD",streakVertDown:"SuggestionItem-module_streakVertDown_OrcLh",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9"};var ie=require("react/jsx-runtime");function $e({option:e,isHighlighted:t,onSelect:o,onHighlight:l,id:a,loading:n}){let[d,c]=(0,pe.useState)(!1),h=(0,pe.useRef)(void 0);(0,pe.useEffect)(()=>()=>clearTimeout(h.current),[]);let v=()=>{n||!e.is_tappable||d||(c(!0),o(e),clearTimeout(h.current),h.current=setTimeout(()=>c(!1),500))},B=[j.item,t&&!n?j.highlighted:"",e.is_tappable?j.tappable:j.nonTappable,d?j.pressed:""].filter(Boolean).join(" ");return(0,ie.jsxs)("div",{id:a,role:"option","data-aia-option":"","data-aia-loading":n?"":void 0,"aria-selected":t,className:B,tabIndex:n||!e.is_tappable?-1:0,onClick:v,onKeyDown:P=>{!n&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),v())},onMouseEnter:!n&&e.is_tappable?l:void 0,children:[(0,ie.jsx)("div",{className:j.streaks}),(0,ie.jsx)("div",{className:j.streaksVert}),(0,ie.jsxs)("span",{className:j.content,children:[(0,ie.jsx)("span",{className:j.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&(0,ie.jsx)("span",{className:j.tag,children:e.tag})]})]})}var Fe=require("react/jsx-runtime");function Ue({options:e,activeIndex:t,onSelect:o,onHighlight:l,listboxId:a,loading:n}){return(0,Fe.jsx)(qe,{min:"250px",max:"250px",gap:"0",scroll:!0,fade:!0,children:e.map((d,c)=>(0,Fe.jsx)($e,{option:d,isHighlighted:c===t,onSelect:o,onHighlight:()=>l(c),id:`${a}-option-${c}`,loading:n},d.text))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
998
+ `,document.head.appendChild(e)}var j={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",glassFade:"SuggestionItem-module_glassFade_oyiSj",tapDown:"SuggestionItem-module_tapDown_G3WGz",streaks:"SuggestionItem-module_streaks_d9PEB",streaksVert:"SuggestionItem-module_streaksVert_ERlV1",streakHorizRight:"SuggestionItem-module_streakHorizRight_aboGz",streakHorizLeft:"SuggestionItem-module_streakHorizLeft_BreWJ",streakVertUp:"SuggestionItem-module_streakVertUp_to1GD",streakVertDown:"SuggestionItem-module_streakVertDown_OrcLh",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9"};var ie=require("react/jsx-runtime");function $e({option:e,isHighlighted:t,onSelect:a,onHighlight:l,id:o,loading:n}){let[d,p]=(0,ce.useState)(!1),h=(0,ce.useRef)(void 0);(0,ce.useEffect)(()=>()=>clearTimeout(h.current),[]);let v=()=>{n||!e.is_tappable||d||(p(!0),a(e),clearTimeout(h.current),h.current=setTimeout(()=>p(!1),500))},B=[j.item,t&&!n?j.highlighted:"",e.is_tappable?j.tappable:j.nonTappable,d?j.pressed:""].filter(Boolean).join(" ");return(0,ie.jsxs)("div",{id:o,role:"option","data-aia-option":"","data-aia-loading":n?"":void 0,"aria-selected":t,className:B,tabIndex:n||!e.is_tappable?-1:0,onClick:v,onKeyDown:P=>{!n&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),v())},onMouseEnter:!n&&e.is_tappable?l:void 0,children:[(0,ie.jsx)("div",{className:j.streaks}),(0,ie.jsx)("div",{className:j.streaksVert}),(0,ie.jsxs)("span",{className:j.content,children:[(0,ie.jsx)("span",{className:j.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&(0,ie.jsx)("span",{className:j.tag,children:e.tag})]})]})}var Fe=require("react/jsx-runtime");function Ue({options:e,activeIndex:t,onSelect:a,onHighlight:l,listboxId:o,loading:n}){return(0,Fe.jsx)(qe,{min:"250px",max:"250px",gap:"0",scroll:!0,fade:!0,children:e.map((d,p)=>(0,Fe.jsx)($e,{option:d,isHighlighted:p===t,onSelect:a,onHighlight:()=>l(p),id:`${o}-option-${p}`,loading:n},d.text))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
957
999
  .aia-stack {
958
1000
  display: flex;
959
1001
  flex-direction: column;
@@ -970,7 +1012,7 @@
970
1012
  }
971
1013
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
972
1014
  }
973
- `,document.head.appendChild(e)}var Xe=require("react/jsx-runtime");function Qe({space:e,align:t="stretch",className:o,children:l,...a}){let n=e?{"--aia-stack-space":e}:void 0;return(0,Xe.jsx)("div",{className:o?`aia-stack ${o}`:"aia-stack","data-align":t,style:n,...a,children:l})}var Q=require("react/jsx-runtime"),bt=[159,119,164];function xt(e){let t=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[o,l]=(0,ue.useState)(t);if((0,ue.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let a=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>l(a.matches);return a.addEventListener("change",n),()=>a.removeEventListener("change",n)},[e]),e!==void 0)return e==="auto"?o?"dark":"light":e}function Ie({suggestions:e,activeIndex:t,onSelect:o,onHighlight:l,isOpen:a,id:n,className:d,pills:c,onPillClick:h,showPills:v=!0,activeSelected:B=!1,isLoading:P=!1,isInputEmpty:A=!1,optionsPosition:C="below",mode:w}){let R=xt(w),H=R!==void 0,X=e[0]?.options??[],s=!!(c&&c.length>0&&h),y=a&&(X.length>0||v&&s||P),O={suggestions:e,activeIndex:t,pills:c,showPills:v,activeSelected:B,isLoading:P,isInputEmpty:A},q=(0,ue.useRef)(O);y&&(q.current=O);let g=y?O:q.current,M=g.suggestions[0]?.options??[],L=g.activeIndex>=0&&!!M[g.activeIndex]?.is_tappable,$=!!(g.pills&&g.pills.length>0&&h),z=g.showPills&&$,oe=g.showPills&&!$&&g.isLoading,J=z||oe,N=M.length>0,K=g.isLoading&&!N;return(0,Q.jsx)("div",{id:n,role:"listbox","data-aia-dropdown":"","data-options-position":C,"data-mode":R,"data-aia-loading":g.isLoading?"":void 0,className:`${H?"magicx-aia ":""}${ce.dropdown} ${y?ce.visible:""} ${d??""}`,onMouseDown:f=>f.preventDefault(),children:(0,Q.jsxs)(Qe,{space:"8px",children:[J&&(0,Q.jsx)(fe,{noWrap:!0,className:ce.pillBar,"data-aia-pillbar":"",children:(0,Q.jsx)(ke,{pills:g.pills??[],activePillIndex:0,activeSelected:g.activeSelected,onSelectPill:h??(()=>{}),rounded:!0,loading:g.isLoading})}),N&&(0,Q.jsx)(Ue,{options:M,activeIndex:g.activeIndex,onSelect:o,onHighlight:l,listboxId:n,loading:g.isLoading}),K&&(0,Q.jsx)("div",{className:ce.skeletonBars,"data-aia-skeleton-bars":"",children:bt.map(f=>(0,Q.jsx)("span",{className:ce.skeletonBar,style:{width:f}},`bar-${f}`))}),(0,Q.jsx)(We,{isOptionHighlighted:L,isInputEmpty:g.isInputEmpty})]})})}var me=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=`.SubmitButton-module_submitButton_otz7H {
1015
+ `,document.head.appendChild(e)}var Xe=require("react/jsx-runtime");function Qe({space:e,align:t="stretch",className:a,children:l,...o}){let n=e?{"--aia-stack-space":e}:void 0;return(0,Xe.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":t,style:n,...o,children:l})}var X=require("react/jsx-runtime"),bt=[159,119,164];function xt(e){let t=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,l]=(0,ue.useState)(t);if((0,ue.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>l(o.matches);return o.addEventListener("change",n),()=>o.removeEventListener("change",n)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Ie({suggestions:e,activeIndex:t,onSelect:a,onHighlight:l,isOpen:o,id:n,className:d,pills:p,onPillClick:h,showPills:v=!0,activeSelected:B=!1,isLoading:P=!1,isInputEmpty:A=!1,optionsPosition:C="below",mode:w}){let R=xt(w),H=R!==void 0,Z=e[0]?.options??[],s=!!(p&&p.length>0&&h),y=o&&(Z.length>0||v&&s||P),O={suggestions:e,activeIndex:t,pills:p,showPills:v,activeSelected:B,isLoading:P,isInputEmpty:A},q=(0,ue.useRef)(O);y&&(q.current=O);let g=y?O:q.current,M=g.suggestions[0]?.options??[],L=g.activeIndex>=0&&!!M[g.activeIndex]?.is_tappable,$=!!(g.pills&&g.pills.length>0&&h),z=g.showPills&&$,ae=g.showPills&&!$&&g.isLoading,J=z||ae,N=M.length>0,K=g.isLoading&&!N;return(0,X.jsx)("div",{id:n,role:"listbox","data-aia-dropdown":"","data-options-position":C,"data-mode":R,"data-aia-loading":g.isLoading?"":void 0,className:`${H?"magicx-aia ":""}${pe.dropdown} ${y?pe.visible:""} ${d??""}`,onMouseDown:f=>f.preventDefault(),children:(0,X.jsxs)(Qe,{space:"8px",children:[J&&(0,X.jsx)(fe,{noWrap:!0,className:pe.pillBar,"data-aia-pillbar":"",children:(0,X.jsx)(ke,{pills:g.pills??[],activePillIndex:0,activeSelected:g.activeSelected,onSelectPill:h??(()=>{}),rounded:!0,loading:g.isLoading})}),N&&(0,X.jsx)(Ue,{options:M,activeIndex:g.activeIndex,onSelect:a,onHighlight:l,listboxId:n,loading:g.isLoading}),K&&(0,X.jsx)("div",{className:pe.skeletonBars,"data-aia-skeleton-bars":"",children:bt.map(f=>(0,X.jsx)("span",{className:pe.skeletonBar,style:{width:f}},`bar-${f}`))}),(0,X.jsx)(We,{isOptionHighlighted:L,isInputEmpty:g.isInputEmpty})]})})}var me=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=`.SubmitButton-module_submitButton_otz7H {
974
1016
  flex-shrink: 0;
975
1017
  width: 32px;
976
1018
  height: 32px;
@@ -994,5 +1036,5 @@
994
1036
  opacity: 0.4;
995
1037
  cursor: default;
996
1038
  }
997
- `,document.head.appendChild(e)}var Je={submitButton:"SubmitButton-module_submitButton_otz7H"};var Se=require("react/jsx-runtime");function Ze({disabled:e,onClick:t}){return(0,Se.jsx)("button",{type:"button","data-aia-submit":"",className:Je.submitButton,disabled:e,onClick:o=>{o.stopPropagation(),t()},"aria-label":"Submit",children:(0,Se.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Se.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ye=require("@magicx-eng/ai-autocomplete-vanilla"),k=require("react"),vt={text:"",completedParams:[],suggestions:[],activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],placeholderText:"",isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1};function Ae({onSubmit:e,onError:t,optionOverrides:o,maskCompletedText:l,apiConfig:a,columns:n=2,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:h,showNonTappableOptions:v,onFocus:B,onBlur:P,value:A,completedParams:C,onChange:w,onParamsChange:R,source:H,setCursor:X}){let s=(0,k.useRef)(null),[y,O]=(0,k.useState)(null),q=(0,k.useRef)(e);q.current=e;let g=(0,k.useRef)(t);g.current=t;let te=(0,k.useRef)(w);te.current=w;let M=(0,k.useRef)(R);M.current=R;let L=(0,k.useRef)(B);L.current=B;let $=(0,k.useRef)(P);$.current=P;let z=(0,k.useRef)(X);z.current=X,(0,k.useEffect)(()=>{if(typeof document>"u")return;let r=new Ye.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:a,optionOverrides:o,maskCompletedText:l,columns:n,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:h,showNonTappableOptions:v,source:H,value:A,completedParams:C,onSubmit:(...E)=>q.current?.(...E),onError:(...E)=>g.current?.(...E),onChange:(...E)=>te.current?.(...E),onParamsChange:(...E)=>M.current?.(...E),onFocus:()=>L.current?.(),onBlur:()=>$.current?.(),setCursor:E=>z.current?.(E)});s.current=r,O(r.getState());let D=r.subscribe(E=>O(E));return()=>{D(),r.destroy(),s.current===r&&(s.current=null)}},[]),(0,k.useEffect)(()=>{A!==void 0&&s.current?.setValue(A)},[A]),(0,k.useEffect)(()=>{C!==void 0&&s.current?.setCompletedParams(C)},[C]);let oe=JSON.stringify(a??null),J=(0,k.useRef)(o),N=(0,k.useRef)(0);if(o!==J.current){let r=J.current,D=o,E=Object.keys(r??{}),de=Object.keys(D??{});(E.length!==de.length||de.some(ge=>!r?.[ge]||D[ge]!==r[ge]))&&N.current++,J.current=o}(0,k.useEffect)(()=>{s.current?.update({apiConfig:a,optionOverrides:o,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:h,showNonTappableOptions:v})},[oe,N.current,d,c,h,v]);let K=(0,k.useRef)(null);K.current===null&&(K.current={handleTextChange:r=>s.current?.handleTextChange(r),handleKeyDown:r=>{let D="nativeEvent"in r?r.nativeEvent:r;s.current?.handleKeyDown(D)},setFocused:r=>s.current?.setFocused(r),startEditingParam:r=>s.current?.startEditingParam(r),exitEditMode:()=>s.current?.exitEditMode(),handleCaretAfterInput:r=>s.current?.handleCaretAfterInput(r),handleCaretMove:r=>s.current?.handleCaretMove(r),replaceEditingRange:r=>s.current?.replaceEditingRange(r)??!1,setActivePill:r=>s.current?.setActivePill(r),removeLastParam:()=>s.current?.removeLastParam(),clearNewParamId:()=>s.current?.clearNewParamId(),reset:()=>s.current?.reset(),selectOption:r=>s.current?.selectOption(r),setActiveDropdownIndex:r=>s.current?.setActiveDropdownIndex(r),handleFocus:()=>s.current?.setFocused(!0),handleBlur:()=>s.current?.setFocused(!1)});let f=K.current,re=(0,k.useCallback)(r=>{let D=r.target.value,de=D.length>0&&!r.nativeEvent?.isComposing&&D[0]!==D[0].toUpperCase()?D[0].toUpperCase()+D.slice(1):D;s.current?.handleTextChange(de)},[]),se=(0,k.useCallback)(r=>{s.current?.handleKeyDown(r.nativeEvent)},[]),ae=s.current,p=y??vt,i=A!==void 0?A:p.text,u=C!==void 0?C:p.completedParams,b=p.actionableSuggestions,I=b[0],x=ae?.listboxId??"",T=p.activeDropdownIndex>=0&&ae?`${x}-option-${p.activeDropdownIndex}`:void 0,W=p.editingParam,Z=W?{type:W.suggestionType,text:W.suggestionPlaceholder,required:!0,options:W.options}:null,be=Z??I,Ce=Z?[Z]:b,xe=!ae||p.isLoading&&!p.editingParam&&!p.inSelectionAnimation;return{completedParams:u,suggestionPills:b,setActivePill:f.setActivePill,removeLastParam:f.removeLastParam,segments:p.segments,newParamId:p.newParamId,clearNewParamId:f.clearNewParamId,suggestions:p.suggestions,activeIndex:p.activeDropdownIndex,isReady:p.isReady,isLoading:xe,isFocused:p.isFocused,isDropdownOpen:p.isDropdownOpen,isActivePillSelected:p.isActivePillSelected,placeholderText:p.placeholderText,listboxId:x,error:p.error,handleTextChange:f.handleTextChange,handleKeyDown:f.handleKeyDown,setFocused:f.setFocused,editingParam:W,editingAnchor:p.editingAnchor,caretOffset:p.caretOffset,startEditingParam:f.startEditingParam,exitEditMode:f.exitEditMode,handleCaretAfterInput:f.handleCaretAfterInput,handleCaretMove:f.handleCaretMove,replaceEditingRange:f.replaceEditingRange,inputProps:{value:i,placeholder:p.placeholderText||void 0,onChange:re,onKeyDown:se,onFocus:f.handleFocus,onBlur:f.handleBlur,role:"combobox","aria-expanded":p.isDropdownOpen,"aria-activedescendant":T,"aria-autocomplete":"list","aria-controls":x},reset:f.reset,dropdownProps:{suggestions:be?[{...be,options:p.filteredOptions}]:[],activeIndex:p.activeDropdownIndex,onSelect:f.selectOption,onHighlight:f.setActiveDropdownIndex,isOpen:p.isDropdownOpen,id:x,pills:Ce,activeSelected:p.isActivePillSelected,onPillClick:f.setActivePill,isLoading:xe,isInputEmpty:i.trim().length===0,optionsPosition:c??"below"}}}var F=require("@magicx-eng/ai-autocomplete-vanilla"),m=require("react"),Pe;function wt(){if(Pe!==void 0)return Pe;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Pe=e.contentEditable==="plaintext-only",Pe}function et(e){let{segments:t,newParamId:o,editingParam:l,editingAnchor:a,caretOffset:n,placeholderText:d,isFocused:c,isDropdownOpen:h,listboxId:v,activeDescendantId:B,autoFocus:P,handleTextChange:A,handleKeyDown:C,handleCaretAfterInput:w,handleCaretMove:R,startEditingParam:H,replaceEditingRange:X,setFocused:s}=e,y=(0,m.useRef)(null),O=(0,m.useRef)(!1),q=(0,m.useRef)(""),g=(0,m.useRef)(""),te=(0,m.useRef)(null),M=(0,m.useRef)(0);te.current=n,(0,m.useEffect)(()=>{if(!P)return;let i=y.current;i&&(document.activeElement===i?s(!0):i.focus())},[P,s]),(0,m.useEffect)(()=>{let i=y.current;if(!i)return;let u=i.ownerDocument??document,b=()=>{let I=u.getSelection();if(!I||I.rangeCount===0||!I.anchorNode||!i.contains(I.anchorNode))return;let x=I.anchorNode,Z=(x.nodeType===Node.ELEMENT_NODE?x:x.parentElement)?.closest('strong[data-seg="completed"][data-param-id]')?.dataset.paramId??null;if(Z&&Z!==l?.id){H(Z);return}performance.now()-M.current<50||R((0,F.getCursorOffset)(i))};return u.addEventListener("selectionchange",b),()=>u.removeEventListener("selectionchange",b)},[l,H,R]),(0,m.useLayoutEffect)(()=>{let i=y.current;i&&(0,F.renderEditableContent)({input:i,segments:t,newParamId:o,editingParamId:l?.id??null,placeholderText:d??"",isFocused:c})},[t,o,l,d,c]),(0,m.useLayoutEffect)(()=>{let i=q.current,u=o??"";if(q.current=u,!u||u===i)return;let b=y.current;if(!b)return;b.focus();let I=te.current??(0,F.plainTextLength)(b);(0,F.setCursorOffset)(b,I)},[o]),(0,m.useLayoutEffect)(()=>{let i=g.current,u=l?.id??"";if(g.current=u,!u||u===i||a==null)return;let b=y.current;b&&(0,F.setCursorOffset)(b,a)},[l,a]);let L=(0,m.useCallback)(()=>{if(O.current)return;let i=y.current;if(!i)return;let u=(0,F.extractPlainText)(i),I=u.length>0&&u[0]!==u[0].toUpperCase()?u[0].toUpperCase()+u.slice(1):u;A(I)},[A]),$=(0,m.useCallback)(()=>{M.current=performance.now(),L();let i=y.current;i&&w((0,F.getCursorOffset)(i))},[L,w]);(0,m.useEffect)(()=>{let i=y.current;if(!i)return;let u=b=>{let I=b,x=I.inputType;if(x==="insertParagraph"||x==="insertLineBreak"||x==="insertFromDrop"){b.preventDefault();return}if(x.startsWith("insert")||x.startsWith("delete")){let T=x.startsWith("delete")?"":I.data??"";X(T)&&b.preventDefault()}};return i.addEventListener("beforeinput",u),()=>i.removeEventListener("beforeinput",u)},[X]);let z=(0,m.useCallback)(()=>{O.current=!0},[]),oe=(0,m.useCallback)(()=>{O.current=!1,L()},[L]),J=(0,m.useCallback)(i=>{i.preventDefault();let u=y.current;if(!u)return;let b=(i.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!b)return;let I=u.ownerDocument??document,x=I.getSelection();if(!x||x.rangeCount===0)return;let T=x.getRangeAt(0);if(!u.contains(T.startContainer))return;T.deleteContents();let W=I.createTextNode(b);T.insertNode(W),T.setStartAfter(W),T.collapse(!0),x.removeAllRanges(),x.addRange(T),L()},[L]),N=(0,m.useCallback)(i=>C(i),[C]),K=(0,m.useCallback)(()=>s(!0),[s]),f=(0,m.useCallback)(()=>s(!1),[s]),re=(0,m.useCallback)(()=>y.current?.focus(),[]),se=(0,m.useCallback)(()=>y.current?.blur(),[]),ae=(0,m.useCallback)(()=>{let i=y.current;return i?(0,F.extractPlainText)(i):""},[]),p=wt()?"plaintext-only":"true";return{inputRef:y,editorProps:{ref:y,contentEditable:p,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":v,"aria-expanded":h,"aria-activedescendant":B,spellCheck:!0,enterKeyHint:"send",onInput:$,onKeyDown:N,onCompositionStart:z,onCompositionEnd:oe,onPaste:J,onFocus:K,onBlur:f},getPlainText:ae,focus:re,blur:se}}var V=require("react/jsx-runtime");function yt(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var tt=(0,S.forwardRef)(function({onSubmit:t,onError:o,optionOverrides:l,maskCompletedText:a,className:n,apiConfig:d,columns:c,pillPlacement:h="dropdown",mode:v="auto",optionsPosition:B="below",animations:P=!0,dropdownTrigger:A,closeDropdownOnBlur:C,showNonTappableOptions:w,autoFocus:R=!0,onFocus:H,onBlur:X,value:s,completedParams:y,onChange:O,onParamsChange:q,submitButton:g},te){let M=(0,S.useRef)(null),L=(0,S.useRef)(null),$=(0,S.useRef)(()=>{}),z=(0,S.useRef)(null),oe=(0,S.useRef)(null);(0,S.useEffect)(()=>{let _=M.current;if(_)return z.current?z.current.setMode(v):z.current=new me.ModeController(_,v),()=>{z.current?.destroy(),z.current=null}},[v]);let J=(0,S.useCallback)(_=>{let U=oe.current?.current;U&&(U.focus(),(0,me.setCursorOffset)(U,_))},[]),{completedParams:N,suggestionPills:K,setActivePill:f,segments:re,newParamId:se,clearNewParamId:ae,placeholderText:p,isFocused:i,isDropdownOpen:u,isActivePillSelected:b,isLoading:I,activeIndex:x,listboxId:T,handleTextChange:W,handleKeyDown:Z,setFocused:be,editingParam:Ce,editingAnchor:xe,caretOffset:r,startEditingParam:D,handleCaretAfterInput:E,handleCaretMove:de,replaceEditingRange:ge,dropdownProps:ot,reset:ve}=Ae({onSubmit:_=>$.current(_),onError:o,optionOverrides:l,maskCompletedText:a,apiConfig:d,columns:c,dropdownTrigger:A,optionsPosition:B,closeDropdownOnBlur:C,showNonTappableOptions:w,onFocus:H,onBlur:X,value:s,completedParams:y,onChange:O,onParamsChange:q,source:"full-sdk",setCursor:J});(0,S.useEffect)(()=>{if(!se)return;let _=window.setTimeout(()=>ae(),650);return()=>window.clearTimeout(_)},[se,ae]);let at=x>=0?`${T}-option-${x}`:void 0,{inputRef:Ee,editorProps:nt,focus:we,blur:Oe,getPlainText:Me}=et({segments:re,newParamId:se,editingParam:Ce,editingAnchor:xe,caretOffset:r,placeholderText:p,isFocused:i,isDropdownOpen:u,listboxId:T,activeDescendantId:at,autoFocus:R,handleTextChange:W,handleKeyDown:Z,handleCaretAfterInput:E,handleCaretMove:de,startEditingParam:D,replaceEditingRange:ge,setFocused:be});oe.current=Ee,(0,S.useLayoutEffect)(()=>{let _=L.current,U=Ee.current;if(!_||!U)return;let _e=()=>{let Ne=_.firstElementChild;if(!Ne)return;let lt=Ne.getBoundingClientRect(),dt=U.getBoundingClientRect();lt.top>=dt.bottom-2?_.setAttribute("data-aia-pill-wrapped",""):_.removeAttribute("data-aia-pill-wrapped")};_e();let He=new ResizeObserver(_e);return He.observe(U),()=>He.disconnect()},[re,K.length,I,Ee]),(0,S.useImperativeHandle)(te,()=>({focus:we,blur:Oe,reset:ve,setMode:_=>z.current?.setMode(_)}),[we,Oe,ve]);let ye=!!re.length||N.length>0,De=(0,S.useCallback)(()=>{if(!ye)return;let _=Me(),{rawQuery:U,completedParams:_e}=(0,me.buildQuery)(_,N);t({query:_.trim(),raw_query:U,completed_params:_e}),ve()},[ye,N,t,ve,Me]);$.current=De;let it=(0,S.useCallback)(_=>{_.target?.closest("[data-aia-pill]")||we()},[we]),rt=h==="inline",st=h==="dropdown";return(0,V.jsxs)("div",{ref:M,className:`magicx-aia ${le.container} ${n??""}`,"data-pill-placement":h,"data-options-position":B,"data-animations":P?"on":"off","data-mode":yt(v),children:[(0,V.jsx)(Ie,{...ot,showPills:st}),(0,V.jsxs)("div",{className:le.inputWrapper,onClick:it,children:[(0,V.jsxs)("div",{className:le.editorArea,"data-aia-editor":"",children:[(0,V.jsx)("div",{...nt,className:le.input,"data-aia-input":""}),rt&&(I||K.length>0)&&(0,V.jsx)("span",{ref:L,className:le.pillListContainer,"data-aia-pill-list-container":"",children:(0,V.jsx)(ke,{pills:K,activePillIndex:0,activeSelected:b,onSelectPill:f,loading:I})})]}),g===null?null:g===void 0?(0,V.jsx)(Ze,{disabled:!ye,onClick:De}):(0,V.jsx)("span",{"data-aia-submit":"",className:le.submitSlot,onClick:_=>{ye&&(_.stopPropagation(),De())},children:g})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,useAIAutocomplete});
1039
+ `,document.head.appendChild(e)}var Ze={submitButton:"SubmitButton-module_submitButton_otz7H"};var Se=require("react/jsx-runtime");function Je({disabled:e,onClick:t}){return(0,Se.jsx)("button",{type:"button","data-aia-submit":"",className:Ze.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),t()},"aria-label":"Submit",children:(0,Se.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Se.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ye=require("@magicx-eng/ai-autocomplete-vanilla"),k=require("react"),vt={text:"",completedParams:[],suggestions:[],activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],placeholderText:"",isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1};function Ae({onSubmit:e,onError:t,optionOverrides:a,maskCompletedText:l,apiConfig:o,columns:n=2,dropdownTrigger:d,optionsPosition:p,closeDropdownOnBlur:h,showNonTappableOptions:v,onFocus:B,onBlur:P,value:A,completedParams:C,onChange:w,onParamsChange:R,source:H,setCursor:Z}){let s=(0,k.useRef)(null),[y,O]=(0,k.useState)(null),q=(0,k.useRef)(e);q.current=e;let g=(0,k.useRef)(t);g.current=t;let te=(0,k.useRef)(w);te.current=w;let M=(0,k.useRef)(R);M.current=R;let L=(0,k.useRef)(B);L.current=B;let $=(0,k.useRef)(P);$.current=P;let z=(0,k.useRef)(Z);z.current=Z,(0,k.useEffect)(()=>{if(typeof document>"u")return;let r=new Ye.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:o,optionOverrides:a,maskCompletedText:l,columns:n,dropdownTrigger:d,optionsPosition:p,closeDropdownOnBlur:h,showNonTappableOptions:v,source:H,value:A,completedParams:C,onSubmit:(...E)=>q.current?.(...E),onError:(...E)=>g.current?.(...E),onChange:(...E)=>te.current?.(...E),onParamsChange:(...E)=>M.current?.(...E),onFocus:()=>L.current?.(),onBlur:()=>$.current?.(),setCursor:E=>z.current?.(E)});s.current=r,O(r.getState());let D=r.subscribe(E=>O(E));return()=>{D(),r.destroy(),s.current===r&&(s.current=null)}},[]),(0,k.useEffect)(()=>{A!==void 0&&s.current?.setValue(A)},[A]),(0,k.useEffect)(()=>{C!==void 0&&s.current?.setCompletedParams(C)},[C]);let ae=JSON.stringify(o??null),J=(0,k.useRef)(a),N=(0,k.useRef)(0);if(a!==J.current){let r=J.current,D=a,E=Object.keys(r??{}),de=Object.keys(D??{});(E.length!==de.length||de.some(ge=>!r?.[ge]||D[ge]!==r[ge]))&&N.current++,J.current=a}(0,k.useEffect)(()=>{s.current?.update({apiConfig:o,optionOverrides:a,dropdownTrigger:d,optionsPosition:p,closeDropdownOnBlur:h,showNonTappableOptions:v})},[ae,N.current,d,p,h,v]);let K=(0,k.useRef)(null);K.current===null&&(K.current={handleTextChange:r=>s.current?.handleTextChange(r),handleKeyDown:r=>{let D="nativeEvent"in r?r.nativeEvent:r;s.current?.handleKeyDown(D)},setFocused:r=>s.current?.setFocused(r),startEditingParam:r=>s.current?.startEditingParam(r),exitEditMode:()=>s.current?.exitEditMode(),handleCaretAfterInput:r=>s.current?.handleCaretAfterInput(r),handleCaretMove:r=>s.current?.handleCaretMove(r),replaceEditingRange:r=>s.current?.replaceEditingRange(r)??!1,setActivePill:r=>s.current?.setActivePill(r),removeLastParam:()=>s.current?.removeLastParam(),clearNewParamId:()=>s.current?.clearNewParamId(),reset:()=>s.current?.reset(),selectOption:r=>s.current?.selectOption(r),setActiveDropdownIndex:r=>s.current?.setActiveDropdownIndex(r),handleFocus:()=>s.current?.setFocused(!0),handleBlur:()=>s.current?.setFocused(!1)});let f=K.current,re=(0,k.useCallback)(r=>{let D=r.target.value,de=D.length>0&&!r.nativeEvent?.isComposing&&D[0]!==D[0].toUpperCase()?D[0].toUpperCase()+D.slice(1):D;s.current?.handleTextChange(de)},[]),se=(0,k.useCallback)(r=>{s.current?.handleKeyDown(r.nativeEvent)},[]),oe=s.current,c=y??vt,i=A!==void 0?A:c.text,u=C!==void 0?C:c.completedParams,b=c.actionableSuggestions,I=b[0],x=oe?.listboxId??"",T=c.activeDropdownIndex>=0&&oe?`${x}-option-${c.activeDropdownIndex}`:void 0,W=c.editingParam,Y=W?{type:W.suggestionType,text:W.suggestionPlaceholder,required:!0,options:W.options}:null,be=Y??I,Ce=Y?[Y]:b,xe=!oe||c.isLoading&&!c.editingParam&&!c.inSelectionAnimation;return{completedParams:u,suggestionPills:b,setActivePill:f.setActivePill,removeLastParam:f.removeLastParam,segments:c.segments,newParamId:c.newParamId,clearNewParamId:f.clearNewParamId,suggestions:c.suggestions,activeIndex:c.activeDropdownIndex,isReady:c.isReady,isLoading:xe,isFocused:c.isFocused,isDropdownOpen:c.isDropdownOpen,isActivePillSelected:c.isActivePillSelected,placeholderText:c.placeholderText,listboxId:x,error:c.error,handleTextChange:f.handleTextChange,handleKeyDown:f.handleKeyDown,setFocused:f.setFocused,editingParam:W,editingAnchor:c.editingAnchor,caretOffset:c.caretOffset,startEditingParam:f.startEditingParam,exitEditMode:f.exitEditMode,handleCaretAfterInput:f.handleCaretAfterInput,handleCaretMove:f.handleCaretMove,replaceEditingRange:f.replaceEditingRange,inputProps:{value:i,placeholder:c.placeholderText||void 0,onChange:re,onKeyDown:se,onFocus:f.handleFocus,onBlur:f.handleBlur,role:"combobox","aria-expanded":c.isDropdownOpen,"aria-activedescendant":T,"aria-autocomplete":"list","aria-controls":x},reset:f.reset,dropdownProps:{suggestions:be?[{...be,options:c.filteredOptions}]:[],activeIndex:c.activeDropdownIndex,onSelect:f.selectOption,onHighlight:f.setActiveDropdownIndex,isOpen:c.isDropdownOpen,id:x,pills:Ce,activeSelected:c.isActivePillSelected,onPillClick:f.setActivePill,isLoading:xe,isInputEmpty:i.trim().length===0,optionsPosition:p??"below"}}}var F=require("@magicx-eng/ai-autocomplete-vanilla"),m=require("react"),Pe;function wt(){if(Pe!==void 0)return Pe;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Pe=e.contentEditable==="plaintext-only",Pe}function et(e){let{segments:t,newParamId:a,editingParam:l,editingAnchor:o,caretOffset:n,placeholderText:d,isFocused:p,isDropdownOpen:h,listboxId:v,activeDescendantId:B,autoFocus:P,handleTextChange:A,handleKeyDown:C,handleCaretAfterInput:w,handleCaretMove:R,startEditingParam:H,replaceEditingRange:Z,setFocused:s}=e,y=(0,m.useRef)(null),O=(0,m.useRef)(!1),q=(0,m.useRef)(""),g=(0,m.useRef)(""),te=(0,m.useRef)(null),M=(0,m.useRef)(0);te.current=n,(0,m.useEffect)(()=>{if(!P)return;let i=y.current;i&&(document.activeElement===i?s(!0):i.focus())},[P,s]),(0,m.useEffect)(()=>{let i=y.current;if(!i)return;let u=i.ownerDocument??document,b=()=>{let I=u.getSelection();if(!I||I.rangeCount===0||!I.anchorNode||!i.contains(I.anchorNode))return;let x=I.anchorNode,Y=(x.nodeType===Node.ELEMENT_NODE?x:x.parentElement)?.closest('strong[data-seg="completed"][data-param-id]')?.dataset.paramId??null;if(Y&&Y!==l?.id){H(Y);return}performance.now()-M.current<50||R((0,F.getCursorOffset)(i))};return u.addEventListener("selectionchange",b),()=>u.removeEventListener("selectionchange",b)},[l,H,R]),(0,m.useLayoutEffect)(()=>{let i=y.current;i&&(0,F.renderEditableContent)({input:i,segments:t,newParamId:a,editingParamId:l?.id??null,placeholderText:d??"",isFocused:p})},[t,a,l,d,p]),(0,m.useLayoutEffect)(()=>{let i=q.current,u=a??"";if(q.current=u,!u||u===i)return;let b=y.current;if(!b)return;b.focus();let I=te.current??(0,F.plainTextLength)(b);(0,F.setCursorOffset)(b,I)},[a]),(0,m.useLayoutEffect)(()=>{let i=g.current,u=l?.id??"";if(g.current=u,!u||u===i||o==null)return;let b=y.current;b&&(0,F.setCursorOffset)(b,o)},[l,o]);let L=(0,m.useCallback)(()=>{if(O.current)return;let i=y.current;if(!i)return;let u=(0,F.extractPlainText)(i),I=u.length>0&&u[0]!==u[0].toUpperCase()?u[0].toUpperCase()+u.slice(1):u;A(I)},[A]),$=(0,m.useCallback)(()=>{M.current=performance.now(),L();let i=y.current;i&&w((0,F.getCursorOffset)(i))},[L,w]);(0,m.useEffect)(()=>{let i=y.current;if(!i)return;let u=b=>{let I=b,x=I.inputType;if(x==="insertParagraph"||x==="insertLineBreak"||x==="insertFromDrop"){b.preventDefault();return}if(x.startsWith("insert")||x.startsWith("delete")){let T=x.startsWith("delete")?"":I.data??"";Z(T)&&b.preventDefault()}};return i.addEventListener("beforeinput",u),()=>i.removeEventListener("beforeinput",u)},[Z]);let z=(0,m.useCallback)(()=>{O.current=!0},[]),ae=(0,m.useCallback)(()=>{O.current=!1,L()},[L]),J=(0,m.useCallback)(i=>{i.preventDefault();let u=y.current;if(!u)return;let b=(i.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!b)return;let I=u.ownerDocument??document,x=I.getSelection();if(!x||x.rangeCount===0)return;let T=x.getRangeAt(0);if(!u.contains(T.startContainer))return;T.deleteContents();let W=I.createTextNode(b);T.insertNode(W),T.setStartAfter(W),T.collapse(!0),x.removeAllRanges(),x.addRange(T),L()},[L]),N=(0,m.useCallback)(i=>C(i),[C]),K=(0,m.useCallback)(()=>s(!0),[s]),f=(0,m.useCallback)(()=>s(!1),[s]),re=(0,m.useCallback)(()=>y.current?.focus(),[]),se=(0,m.useCallback)(()=>y.current?.blur(),[]),oe=(0,m.useCallback)(()=>{let i=y.current;return i?(0,F.extractPlainText)(i):""},[]),c=wt()?"plaintext-only":"true";return{inputRef:y,editorProps:{ref:y,contentEditable:c,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":v,"aria-expanded":h,"aria-activedescendant":B,spellCheck:!0,enterKeyHint:"send",onInput:$,onKeyDown:N,onCompositionStart:z,onCompositionEnd:ae,onPaste:J,onFocus:K,onBlur:f},getPlainText:oe,focus:re,blur:se}}var V=require("react/jsx-runtime");function yt(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var tt=(0,S.forwardRef)(function({onSubmit:t,onError:a,optionOverrides:l,maskCompletedText:o,className:n,apiConfig:d,columns:p,pillPlacement:h="dropdown",mode:v="auto",optionsPosition:B="below",animations:P=!0,dropdownTrigger:A,closeDropdownOnBlur:C,showNonTappableOptions:w,autoFocus:R=!0,onFocus:H,onBlur:Z,value:s,completedParams:y,onChange:O,onParamsChange:q,submitButton:g},te){let M=(0,S.useRef)(null),L=(0,S.useRef)(null),$=(0,S.useRef)(()=>{}),z=(0,S.useRef)(null),ae=(0,S.useRef)(null);(0,S.useEffect)(()=>{let _=M.current;if(_)return z.current?z.current.setMode(v):z.current=new me.ModeController(_,v),()=>{z.current?.destroy(),z.current=null}},[v]);let J=(0,S.useCallback)(_=>{let U=ae.current?.current;U&&(U.focus(),(0,me.setCursorOffset)(U,_))},[]),{completedParams:N,suggestionPills:K,setActivePill:f,segments:re,newParamId:se,clearNewParamId:oe,placeholderText:c,isFocused:i,isDropdownOpen:u,isActivePillSelected:b,isLoading:I,activeIndex:x,listboxId:T,handleTextChange:W,handleKeyDown:Y,setFocused:be,editingParam:Ce,editingAnchor:xe,caretOffset:r,startEditingParam:D,handleCaretAfterInput:E,handleCaretMove:de,replaceEditingRange:ge,dropdownProps:at,reset:ve}=Ae({onSubmit:_=>$.current(_),onError:a,optionOverrides:l,maskCompletedText:o,apiConfig:d,columns:p,dropdownTrigger:A,optionsPosition:B,closeDropdownOnBlur:C,showNonTappableOptions:w,onFocus:H,onBlur:Z,value:s,completedParams:y,onChange:O,onParamsChange:q,source:"full-sdk",setCursor:J});(0,S.useEffect)(()=>{if(!se)return;let _=window.setTimeout(()=>oe(),650);return()=>window.clearTimeout(_)},[se,oe]);let ot=x>=0?`${T}-option-${x}`:void 0,{inputRef:Ee,editorProps:nt,focus:we,blur:Oe,getPlainText:Me}=et({segments:re,newParamId:se,editingParam:Ce,editingAnchor:xe,caretOffset:r,placeholderText:c,isFocused:i,isDropdownOpen:u,listboxId:T,activeDescendantId:ot,autoFocus:R,handleTextChange:W,handleKeyDown:Y,handleCaretAfterInput:E,handleCaretMove:de,startEditingParam:D,replaceEditingRange:ge,setFocused:be});ae.current=Ee,(0,S.useLayoutEffect)(()=>{let _=L.current,U=Ee.current;if(!_||!U)return;let _e=()=>{let Ne=_.firstElementChild;if(!Ne)return;let lt=Ne.getBoundingClientRect(),dt=U.getBoundingClientRect();lt.top>=dt.bottom-2?_.setAttribute("data-aia-pill-wrapped",""):_.removeAttribute("data-aia-pill-wrapped")};_e();let He=new ResizeObserver(_e);return He.observe(U),()=>He.disconnect()},[re,K.length,I,Ee]),(0,S.useImperativeHandle)(te,()=>({focus:we,blur:Oe,reset:ve,setMode:_=>z.current?.setMode(_)}),[we,Oe,ve]);let ye=!!re.length||N.length>0,De=(0,S.useCallback)(()=>{if(!ye)return;let _=Me(),{rawQuery:U,completedParams:_e}=(0,me.buildQuery)(_,N);t({query:_.trim(),raw_query:U,completed_params:_e}),ve()},[ye,N,t,ve,Me]);$.current=De;let it=(0,S.useCallback)(_=>{_.target?.closest("[data-aia-pill]")||we()},[we]),rt=h==="inline",st=h==="dropdown";return(0,V.jsxs)("div",{ref:M,className:`magicx-aia ${le.container} ${n??""}`,"data-pill-placement":h,"data-options-position":B,"data-animations":P?"on":"off","data-mode":yt(v),children:[(0,V.jsx)(Ie,{...at,showPills:st}),(0,V.jsxs)("div",{className:le.inputWrapper,onClick:it,children:[(0,V.jsxs)("div",{className:le.editorArea,"data-aia-editor":"",children:[(0,V.jsx)("div",{...nt,className:le.input,"data-aia-input":""}),rt&&(I||K.length>0)&&(0,V.jsx)("span",{ref:L,className:le.pillListContainer,"data-aia-pill-list-container":"",children:(0,V.jsx)(ke,{pills:K,activePillIndex:0,activeSelected:b,onSelectPill:f,loading:I})})]}),g===null?null:g===void 0?(0,V.jsx)(Je,{disabled:!ye,onClick:De}):(0,V.jsx)("span",{"data-aia-submit":"",className:le.submitSlot,onClick:_=>{ye&&(_.stopPropagation(),De())},children:g})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,useAIAutocomplete});
998
1040
  //# sourceMappingURL=index.js.map