PluginProbe
Gutenberg / 24.0.0
Gutenberg v24.0.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
gutenberg / build / modules / workflow / index.js

index.js in Gutenberg 24.0.0, at build/modules/workflow/index.js

18,555 lines 755.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var __create = Object.create;
2 var __defProp = Object.defineProperty;
3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4 var __getOwnPropNames = Object.getOwnPropertyNames;
5 var __getProtoOf = Object.getPrototypeOf;
6 var __hasOwnProp = Object.prototype.hasOwnProperty;
7 var __commonJS = (cb, mod) => function __require() {
8 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9 };
10 var __export = (target, all) => {
11 for (var name in all)
12 __defProp(target, name, { get: all[name], enumerable: true });
13 };
14 var __copyProps = (to, from, except, desc) => {
15 if (from && typeof from === "object" || typeof from === "function") {
16 for (let key of __getOwnPropNames(from))
17 if (!__hasOwnProp.call(to, key) && key !== except)
18 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19 }
20 return to;
21 };
22 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23 // If the importer is in node compatibility mode or this is not an ESM
24 // file that has been converted to a CommonJS file using a Babel-
25 // compatible transform (i.e. "__esModule" has not been set), then set
26 // "default" to the CommonJS "module.exports" for node compatibility.
27 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28 mod
29 ));
30
31 // package-external:@wordpress/element
32 var require_element = __commonJS({
33 "package-external:@wordpress/element"(exports, module) {
34 module.exports = window.wp.element;
35 }
36 });
37
38 // vendor-external:react
39 var require_react = __commonJS({
40 "vendor-external:react"(exports, module) {
41 module.exports = window.React;
42 }
43 });
44
45 // vendor-external:react/jsx-runtime
46 var require_jsx_runtime = __commonJS({
47 "vendor-external:react/jsx-runtime"(exports, module) {
48 module.exports = window.ReactJSXRuntime;
49 }
50 });
51
52 // vendor-external:react-dom
53 var require_react_dom = __commonJS({
54 "vendor-external:react-dom"(exports, module) {
55 module.exports = window.ReactDOM;
56 }
57 });
58
59 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
60 var require_use_sync_external_store_shim_development = __commonJS({
61 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
62 "use strict";
63 (function() {
64 function is(x, y) {
65 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
66 }
67 function useSyncExternalStore$2(subscribe, getSnapshot) {
68 didWarnOld18Alpha || void 0 === React117.startTransition || (didWarnOld18Alpha = true, console.error(
69 "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
70 ));
71 var value = getSnapshot();
72 if (!didWarnUncachedGetSnapshot) {
73 var cachedValue = getSnapshot();
74 objectIs(value, cachedValue) || (console.error(
75 "The result of getSnapshot should be cached to avoid an infinite loop"
76 ), didWarnUncachedGetSnapshot = true);
77 }
78 cachedValue = useState25({
79 inst: { value, getSnapshot }
80 });
81 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
82 useLayoutEffect3(
83 function() {
84 inst.value = value;
85 inst.getSnapshot = getSnapshot;
86 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
87 },
88 [subscribe, value, getSnapshot]
89 );
90 useEffect21(
91 function() {
92 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
93 return subscribe(function() {
94 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
95 });
96 },
97 [subscribe]
98 );
99 useDebugValue2(value);
100 return value;
101 }
102 function checkIfSnapshotChanged(inst) {
103 var latestGetSnapshot = inst.getSnapshot;
104 inst = inst.value;
105 try {
106 var nextValue = latestGetSnapshot();
107 return !objectIs(inst, nextValue);
108 } catch (error2) {
109 return true;
110 }
111 }
112 function useSyncExternalStore$1(subscribe, getSnapshot) {
113 return getSnapshot();
114 }
115 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
116 var React117 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState25 = React117.useState, useEffect21 = React117.useEffect, useLayoutEffect3 = React117.useLayoutEffect, useDebugValue2 = React117.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
117 exports.useSyncExternalStore = void 0 !== React117.useSyncExternalStore ? React117.useSyncExternalStore : shim;
118 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
119 })();
120 }
121 });
122
123 // node_modules/use-sync-external-store/shim/index.js
124 var require_shim = __commonJS({
125 "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
126 "use strict";
127 if (false) {
128 module.exports = null;
129 } else {
130 module.exports = require_use_sync_external_store_shim_development();
131 }
132 }
133 });
134
135 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
136 var require_with_selector_development = __commonJS({
137 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
138 "use strict";
139 (function() {
140 function is(x, y) {
141 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
142 }
143 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
144 var React117 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef42 = React117.useRef, useEffect21 = React117.useEffect, useMemo35 = React117.useMemo, useDebugValue2 = React117.useDebugValue;
145 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
146 var instRef = useRef42(null);
147 if (null === instRef.current) {
148 var inst = { hasValue: false, value: null };
149 instRef.current = inst;
150 } else inst = instRef.current;
151 instRef = useMemo35(
152 function() {
153 function memoizedSelector(nextSnapshot) {
154 if (!hasMemo) {
155 hasMemo = true;
156 memoizedSnapshot = nextSnapshot;
157 nextSnapshot = selector(nextSnapshot);
158 if (void 0 !== isEqual && inst.hasValue) {
159 var currentSelection = inst.value;
160 if (isEqual(currentSelection, nextSnapshot))
161 return memoizedSelection = currentSelection;
162 }
163 return memoizedSelection = nextSnapshot;
164 }
165 currentSelection = memoizedSelection;
166 if (objectIs(memoizedSnapshot, nextSnapshot))
167 return currentSelection;
168 var nextSelection = selector(nextSnapshot);
169 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
170 return memoizedSnapshot = nextSnapshot, currentSelection;
171 memoizedSnapshot = nextSnapshot;
172 return memoizedSelection = nextSelection;
173 }
174 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
175 return [
176 function() {
177 return memoizedSelector(getSnapshot());
178 },
179 null === maybeGetServerSnapshot ? void 0 : function() {
180 return memoizedSelector(maybeGetServerSnapshot());
181 }
182 ];
183 },
184 [getSnapshot, getServerSnapshot, selector, isEqual]
185 );
186 var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
187 useEffect21(
188 function() {
189 inst.hasValue = true;
190 inst.value = value;
191 },
192 [value]
193 );
194 useDebugValue2(value);
195 return value;
196 };
197 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
198 })();
199 }
200 });
201
202 // node_modules/use-sync-external-store/shim/with-selector.js
203 var require_with_selector = __commonJS({
204 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
205 "use strict";
206 if (false) {
207 module.exports = null;
208 } else {
209 module.exports = require_with_selector_development();
210 }
211 }
212 });
213
214 // package-external:@wordpress/theme
215 var require_theme = __commonJS({
216 "package-external:@wordpress/theme"(exports, module) {
217 module.exports = window.wp.theme;
218 }
219 });
220
221 // package-external:@wordpress/private-apis
222 var require_private_apis = __commonJS({
223 "package-external:@wordpress/private-apis"(exports, module) {
224 module.exports = window.wp.privateApis;
225 }
226 });
227
228 // package-external:@wordpress/i18n
229 var require_i18n = __commonJS({
230 "package-external:@wordpress/i18n"(exports, module) {
231 module.exports = window.wp.i18n;
232 }
233 });
234
235 // package-external:@wordpress/primitives
236 var require_primitives = __commonJS({
237 "package-external:@wordpress/primitives"(exports, module) {
238 module.exports = window.wp.primitives;
239 }
240 });
241
242 // package-external:@wordpress/data
243 var require_data = __commonJS({
244 "package-external:@wordpress/data"(exports, module) {
245 module.exports = window.wp.data;
246 }
247 });
248
249 // package-external:@wordpress/components
250 var require_components = __commonJS({
251 "package-external:@wordpress/components"(exports, module) {
252 module.exports = window.wp.components;
253 }
254 });
255
256 // package-external:@wordpress/keyboard-shortcuts
257 var require_keyboard_shortcuts = __commonJS({
258 "package-external:@wordpress/keyboard-shortcuts"(exports, module) {
259 module.exports = window.wp.keyboardShortcuts;
260 }
261 });
262
263 // package-external:@wordpress/keycodes
264 var require_keycodes = __commonJS({
265 "package-external:@wordpress/keycodes"(exports, module) {
266 module.exports = window.wp.keycodes;
267 }
268 });
269
270 // packages/workflow/build-module/index.mjs
271 var import_element47 = __toESM(require_element(), 1);
272
273 // node_modules/clsx/dist/clsx.mjs
274 function r(e) {
275 var t, f, n = "";
276 if ("string" == typeof e || "number" == typeof e) n += e;
277 else if ("object" == typeof e) if (Array.isArray(e)) {
278 var o = e.length;
279 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
280 } else for (f in e) e[f] && (n && (n += " "), n += f);
281 return n;
282 }
283 function clsx() {
284 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
285 return n;
286 }
287 var clsx_default = clsx;
288
289 // node_modules/@base-ui/utils/useControlled.mjs
290 var React = __toESM(require_react(), 1);
291
292 // node_modules/@base-ui/utils/error.mjs
293 var set;
294 if (true) {
295 set = /* @__PURE__ */ new Set();
296 }
297 function error(...messages) {
298 if (true) {
299 const messageKey = messages.join(" ");
300 if (!set.has(messageKey)) {
301 set.add(messageKey);
302 console.error(`Base UI: ${messageKey}`);
303 }
304 }
305 }
306
307 // node_modules/@base-ui/utils/useControlled.mjs
308 function useControlled({
309 controlled,
310 default: defaultProp,
311 name,
312 state = "value"
313 }) {
314 const {
315 current: isControlled
316 } = React.useRef(controlled !== void 0);
317 const [valueState, setValue] = React.useState(defaultProp);
318 const value = isControlled ? controlled : valueState;
319 if (true) {
320 React.useEffect(() => {
321 if (isControlled !== (controlled !== void 0)) {
322 error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n"));
323 }
324 }, [state, name, controlled]);
325 const {
326 current: defaultValue
327 } = React.useRef(defaultProp);
328 React.useEffect(() => {
329 if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {
330 error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. To suppress this warning opt to use a controlled ${name}.`].join("\n"));
331 }
332 }, [defaultProp]);
333 }
334 const setValueIfUncontrolled = React.useCallback((newValue) => {
335 if (!isControlled) {
336 setValue(newValue);
337 }
338 }, []);
339 return [value, setValueIfUncontrolled];
340 }
341 function serializeToDevModeString(input) {
342 let nextId = 0;
343 const seen = /* @__PURE__ */ new WeakMap();
344 try {
345 const result = JSON.stringify(input, function replacer(key, value) {
346 if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) {
347 return void 0;
348 }
349 if (typeof value === "bigint") {
350 return `__bigint__:${value}`;
351 }
352 if (value !== null && typeof value === "object") {
353 const id = seen.get(value);
354 if (id !== void 0) {
355 return `__object__:${id}`;
356 }
357 seen.set(value, nextId);
358 nextId += 1;
359 }
360 return value;
361 });
362 return result ?? `__top__:${typeof input}`;
363 } catch {
364 return "__unserializable__";
365 }
366 }
367
368 // node_modules/@base-ui/utils/safeReact.mjs
369 var React2 = __toESM(require_react(), 1);
370 var SafeReact = {
371 ...React2
372 };
373
374 // node_modules/@base-ui/utils/useRefWithInit.mjs
375 var React3 = __toESM(require_react(), 1);
376 var UNINITIALIZED = {};
377 function useRefWithInit(init, initArg) {
378 const ref = React3.useRef(UNINITIALIZED);
379 if (ref.current === UNINITIALIZED) {
380 ref.current = init(initArg);
381 }
382 return ref;
383 }
384
385 // node_modules/@base-ui/utils/useStableCallback.mjs
386 var useInsertionEffect = SafeReact.useInsertionEffect;
387 var useSafeInsertionEffect = (
388 // React 17 doesn't have useInsertionEffect.
389 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
390 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn()
391 );
392 function useStableCallback(callback) {
393 const stable = useRefWithInit(createStableCallback).current;
394 stable.next = callback;
395 useSafeInsertionEffect(stable.effect);
396 return stable.trampoline;
397 }
398 function createStableCallback() {
399 const stable = {
400 next: void 0,
401 callback: assertNotCalled,
402 trampoline: (...args) => stable.callback?.(...args),
403 effect: () => {
404 stable.callback = stable.next;
405 }
406 };
407 return stable;
408 }
409 function assertNotCalled() {
410 if (true) {
411 throw (
412 /* minify-error-disabled */
413 new Error("Base UI: Cannot call an event handler while rendering.")
414 );
415 }
416 }
417
418 // node_modules/@base-ui/utils/warn.mjs
419 var set2;
420 if (true) {
421 set2 = /* @__PURE__ */ new Set();
422 }
423 function warn(...messages) {
424 if (true) {
425 const messageKey = messages.join(" ");
426 if (!set2.has(messageKey)) {
427 set2.add(messageKey);
428 console.warn(`Base UI: ${messageKey}`);
429 }
430 }
431 }
432
433 // node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs
434 var React6 = __toESM(require_react(), 1);
435
436 // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs
437 var React4 = __toESM(require_react(), 1);
438 var noop = () => {
439 };
440 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop;
441
442 // node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs
443 var React5 = __toESM(require_react(), 1);
444 var CompositeListContext = /* @__PURE__ */ React5.createContext({
445 register: () => {
446 },
447 unregister: () => {
448 },
449 subscribeMapChange: () => () => {
450 },
451 nextIndexRef: {
452 current: 0
453 }
454 });
455 if (true) CompositeListContext.displayName = "CompositeListContext";
456 function useCompositeListContext() {
457 return React5.useContext(CompositeListContext);
458 }
459
460 // node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs
461 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
462 function CompositeList(props) {
463 const {
464 children,
465 elementsRef,
466 labelsRef,
467 onMapChange: onMapChangeProp
468 } = props;
469 const onMapChange = useStableCallback(onMapChangeProp);
470 const [, setMapTick] = React6.useState(false);
471 const listeners = useRefWithInit(createListeners).current;
472 const map = useRefWithInit(createMap).current;
473 const nextIndexRef = React6.useRef(0);
474 const isDirtyRef = React6.useRef(true);
475 const itemsRef = React6.useRef([]);
476 const mutationObserverRef = React6.useRef(null);
477 const scheduleMapUpdate = useStableCallback(() => {
478 if (isDirtyRef.current) {
479 return;
480 }
481 isDirtyRef.current = true;
482 setMapTick((tick) => !tick);
483 });
484 const register2 = useStableCallback((node, registration) => {
485 map.set(node, registration);
486 scheduleMapUpdate();
487 });
488 const unregister = useStableCallback((node) => {
489 map.delete(node);
490 scheduleMapUpdate();
491 });
492 const syncRefs = useStableCallback((items) => {
493 const nextMap = /* @__PURE__ */ new Map();
494 elementsRef.current.length = 0;
495 if (labelsRef) {
496 labelsRef.current.length = 0;
497 }
498 items.forEach((item) => {
499 nextMap.set(item.element, {
500 ...item.registration.metadata ?? {},
501 index: item.index
502 });
503 elementsRef.current[item.index] = item.element;
504 if (labelsRef) {
505 labelsRef.current[item.index] = item.registration.label !== void 0 ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent;
506 }
507 });
508 nextIndexRef.current = elementsRef.current.length;
509 return nextMap;
510 });
511 function observe(sortedNodes) {
512 mutationObserverRef.current?.disconnect();
513 mutationObserverRef.current = null;
514 if (typeof MutationObserver !== "function" || sortedNodes.length < 2) {
515 return;
516 }
517 const mutationObserver = new MutationObserver((entries) => {
518 if (!hasMovedNode(entries)) {
519 return;
520 }
521 let previousConnectedNode = null;
522 for (const node of sortedNodes) {
523 if (!node.isConnected) {
524 continue;
525 }
526 if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) {
527 mutationObserver.disconnect();
528 scheduleMapUpdate();
529 return;
530 }
531 previousConnectedNode = node;
532 }
533 });
534 mutationObserverRef.current = mutationObserver;
535 const roots = /* @__PURE__ */ new Set();
536 for (let i = 1; i < sortedNodes.length; i += 1) {
537 const root2 = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]);
538 if (root2) {
539 roots.add(root2);
540 }
541 }
542 roots.forEach((root2) => mutationObserver.observe(root2, {
543 childList: true
544 }));
545 }
546 const flush = useStableCallback(() => {
547 const [items, automaticNodes] = getCompositeListSnapshot(map);
548 const nextMap = syncRefs(items);
549 observe(automaticNodes);
550 itemsRef.current = items;
551 isDirtyRef.current = false;
552 listeners.forEach((listener) => listener(nextMap));
553 onMapChange(nextMap);
554 });
555 useIsoLayoutEffect(() => {
556 if (!isDirtyRef.current) {
557 syncRefs(itemsRef.current);
558 }
559 return () => {
560 elementsRef.current = [];
561 if (labelsRef) {
562 labelsRef.current = [];
563 }
564 };
565 }, [elementsRef, labelsRef, syncRefs]);
566 useIsoLayoutEffect(() => {
567 if (isDirtyRef.current) {
568 flush();
569 }
570 });
571 useIsoLayoutEffect(() => {
572 return () => {
573 mutationObserverRef.current?.disconnect();
574 isDirtyRef.current = true;
575 };
576 }, []);
577 const subscribeMapChange = useStableCallback((fn) => {
578 listeners.add(fn);
579 return () => {
580 listeners.delete(fn);
581 };
582 });
583 const contextValue = React6.useMemo(() => ({
584 register: register2,
585 unregister,
586 subscribeMapChange,
587 nextIndexRef
588 }), [register2, unregister, subscribeMapChange, nextIndexRef]);
589 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompositeListContext.Provider, {
590 value: contextValue,
591 children
592 });
593 }
594 function createMap() {
595 return /* @__PURE__ */ new Map();
596 }
597 function createListeners() {
598 return /* @__PURE__ */ new Set();
599 }
600 function getCompositeListSnapshot(map) {
601 const reservedIndices = /* @__PURE__ */ new Set();
602 const items = [];
603 const automaticItems = [];
604 map.forEach((registration, node) => {
605 if (!node.isConnected) {
606 return;
607 }
608 const index2 = registration.index;
609 const item = {
610 index: index2 ?? -1,
611 element: node,
612 registration
613 };
614 if (index2 === null) {
615 automaticItems.push(item);
616 } else if (index2 >= 0) {
617 reservedIndices.add(index2);
618 items.push(item);
619 }
620 });
621 let nextAutomaticIndex = 0;
622 automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element));
623 automaticItems.forEach((item) => {
624 while (reservedIndices.has(nextAutomaticIndex)) {
625 nextAutomaticIndex += 1;
626 }
627 item.index = nextAutomaticIndex;
628 items.push(item);
629 nextAutomaticIndex += 1;
630 });
631 if (reservedIndices.size > 0) {
632 items.sort((a, b) => a.index - b.index);
633 }
634 return [items, automaticItems.map((item) => item.element)];
635 }
636 function getCommonAncestor(firstNode, lastNode) {
637 let ancestor = firstNode.parentElement;
638 while (ancestor && !ancestor.contains(lastNode)) {
639 ancestor = ancestor.parentElement;
640 }
641 return ancestor;
642 }
643 function hasMovedNode(entries) {
644 for (const entry of entries) {
645 for (let i = 0; i < entry.removedNodes.length; i += 1) {
646 if (entry.removedNodes[i].isConnected) {
647 return true;
648 }
649 }
650 }
651 return false;
652 }
653 function sortByDocumentPosition(a, b) {
654 return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
655 }
656
657 // node_modules/@base-ui/react/internals/useRenderElement.mjs
658 var React9 = __toESM(require_react(), 1);
659
660 // node_modules/@base-ui/utils/useMergedRefs.mjs
661 function useMergedRefs(a, b, c, d) {
662 const forkRef = useRefWithInit(createForkRef).current;
663 if (didChange(forkRef, a, b, c, d)) {
664 update(forkRef, [a, b, c, d]);
665 }
666 return forkRef.callback;
667 }
668 function useMergedRefsN(refs) {
669 const forkRef = useRefWithInit(createForkRef).current;
670 if (didChangeN(forkRef, refs)) {
671 update(forkRef, refs);
672 }
673 return forkRef.callback;
674 }
675 function createForkRef() {
676 return {
677 callback: null,
678 cleanup: null,
679 refs: []
680 };
681 }
682 function didChange(forkRef, a, b, c, d) {
683 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
684 }
685 function didChangeN(forkRef, newRefs) {
686 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]);
687 }
688 function update(forkRef, refs) {
689 forkRef.refs = refs;
690 if (refs.every((ref) => ref == null)) {
691 forkRef.callback = null;
692 return;
693 }
694 forkRef.callback = (instance) => {
695 if (forkRef.cleanup) {
696 forkRef.cleanup();
697 forkRef.cleanup = null;
698 }
699 if (instance != null) {
700 const cleanupCallbacks = Array(refs.length).fill(null);
701 for (let i = 0; i < refs.length; i += 1) {
702 const ref = refs[i];
703 if (ref == null) {
704 continue;
705 }
706 switch (typeof ref) {
707 case "function": {
708 const refCleanup = ref(instance);
709 if (typeof refCleanup === "function") {
710 cleanupCallbacks[i] = refCleanup;
711 }
712 break;
713 }
714 case "object": {
715 ref.current = instance;
716 break;
717 }
718 default:
719 }
720 }
721 forkRef.cleanup = () => {
722 for (let i = 0; i < refs.length; i += 1) {
723 const ref = refs[i];
724 if (ref == null) {
725 continue;
726 }
727 switch (typeof ref) {
728 case "function": {
729 const cleanupCallback = cleanupCallbacks[i];
730 if (typeof cleanupCallback === "function") {
731 cleanupCallback();
732 } else {
733 void ref(null);
734 }
735 break;
736 }
737 case "object": {
738 ref.current = null;
739 break;
740 }
741 default:
742 }
743 }
744 };
745 }
746 };
747 }
748
749 // node_modules/@base-ui/utils/getReactElementRef.mjs
750 var React8 = __toESM(require_react(), 1);
751
752 // node_modules/@base-ui/utils/reactVersion.mjs
753 var React7 = __toESM(require_react(), 1);
754 var majorVersion = parseInt(React7.version, 10);
755 function isReactVersionAtLeast(reactVersionToCheck) {
756 return majorVersion >= reactVersionToCheck;
757 }
758
759 // node_modules/@base-ui/utils/getReactElementRef.mjs
760 function getReactElementRef(element) {
761 if (!/* @__PURE__ */ React8.isValidElement(element)) {
762 return null;
763 }
764 const reactElement = element;
765 const propsWithRef = reactElement.props;
766 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
767 }
768
769 // node_modules/@base-ui/utils/mergeObjects.mjs
770 function mergeObjects(a, b) {
771 if (a && !b) {
772 return a;
773 }
774 if (!a && b) {
775 return b;
776 }
777 if (a || b) {
778 return {
779 ...a,
780 ...b
781 };
782 }
783 return void 0;
784 }
785
786 // node_modules/@base-ui/utils/empty.mjs
787 function NOOP() {
788 }
789 var EMPTY_ARRAY = Object.freeze([]);
790 var EMPTY_OBJECT = Object.freeze({});
791
792 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
793 function getStateAttributesProps(state, customMapping) {
794 const props = {};
795 for (const key in state) {
796 const value = state[key];
797 if (customMapping?.hasOwnProperty(key)) {
798 const customProps = customMapping[key](value);
799 if (customProps != null) {
800 Object.assign(props, customProps);
801 }
802 continue;
803 }
804 if (value === true) {
805 props[`data-${key.toLowerCase()}`] = "";
806 } else if (value) {
807 props[`data-${key.toLowerCase()}`] = value.toString();
808 }
809 }
810 return props;
811 }
812
813 // node_modules/@base-ui/react/utils/resolveClassName.mjs
814 function resolveClassName(className, state) {
815 return typeof className === "function" ? className(state) : className;
816 }
817
818 // node_modules/@base-ui/react/utils/resolveStyle.mjs
819 function resolveStyle(style, state) {
820 return typeof style === "function" ? style(state) : style;
821 }
822
823 // node_modules/@base-ui/react/merge-props/mergeProps.mjs
824 var EMPTY_PROPS = {};
825 function mergeProps(a, b, c, d, e) {
826 if (!c && !d && !e && !a) {
827 return createInitialMergedProps(b);
828 }
829 let merged = createInitialMergedProps(a);
830 if (b) {
831 merged = mergeInto(merged, b);
832 }
833 if (c) {
834 merged = mergeInto(merged, c);
835 }
836 if (d) {
837 merged = mergeInto(merged, d);
838 }
839 if (e) {
840 merged = mergeInto(merged, e);
841 }
842 return merged;
843 }
844 function mergePropsN(props) {
845 if (props.length === 0) {
846 return EMPTY_PROPS;
847 }
848 if (props.length === 1) {
849 return createInitialMergedProps(props[0]);
850 }
851 let merged = createInitialMergedProps(props[0]);
852 for (let i = 1; i < props.length; i += 1) {
853 merged = mergeInto(merged, props[i]);
854 }
855 return merged;
856 }
857 function createInitialMergedProps(inputProps) {
858 if (isPropsGetter(inputProps)) {
859 return {
860 ...resolvePropsGetter(inputProps, EMPTY_PROPS)
861 };
862 }
863 return copyInitialProps(inputProps);
864 }
865 function mergeInto(merged, inputProps) {
866 if (isPropsGetter(inputProps)) {
867 return resolvePropsGetter(inputProps, merged);
868 }
869 return mutablyMergeInto(merged, inputProps);
870 }
871 function copyInitialProps(inputProps) {
872 const copiedProps = {
873 ...inputProps
874 };
875 for (const propName in copiedProps) {
876 const propValue = copiedProps[propName];
877 if (isEventHandler(propName, propValue)) {
878 copiedProps[propName] = wrapEventHandler(propValue);
879 }
880 }
881 return copiedProps;
882 }
883 function mutablyMergeInto(mergedProps, externalProps) {
884 if (!externalProps) {
885 return mergedProps;
886 }
887 for (const propName in externalProps) {
888 const externalPropValue = externalProps[propName];
889 switch (propName) {
890 case "style": {
891 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
892 break;
893 }
894 case "className": {
895 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
896 break;
897 }
898 default: {
899 if (isEventHandler(propName, externalPropValue)) {
900 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
901 } else {
902 mergedProps[propName] = externalPropValue;
903 }
904 }
905 }
906 }
907 return mergedProps;
908 }
909 function isEventHandler(key, value) {
910 const code0 = key.charCodeAt(0);
911 const code1 = key.charCodeAt(1);
912 const code2 = key.charCodeAt(2);
913 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
914 }
915 function isPropsGetter(inputProps) {
916 return typeof inputProps === "function";
917 }
918 function resolvePropsGetter(inputProps, previousProps) {
919 if (isPropsGetter(inputProps)) {
920 return inputProps(previousProps);
921 }
922 return inputProps ?? EMPTY_PROPS;
923 }
924 function mergeEventHandlers(ourHandler, theirHandler) {
925 if (!theirHandler) {
926 return ourHandler;
927 }
928 if (!ourHandler) {
929 return wrapEventHandler(theirHandler);
930 }
931 return (...args) => {
932 const event = args[0];
933 if (isSyntheticEvent(event)) {
934 const baseUIEvent = event;
935 makeEventPreventable(baseUIEvent);
936 const result2 = theirHandler(...args);
937 if (!baseUIEvent.baseUIHandlerPrevented) {
938 ourHandler?.(...args);
939 }
940 return result2;
941 }
942 const result = theirHandler(...args);
943 ourHandler?.(...args);
944 return result;
945 };
946 }
947 function wrapEventHandler(handler) {
948 if (!handler) {
949 return handler;
950 }
951 return (...args) => {
952 const event = args[0];
953 if (isSyntheticEvent(event)) {
954 makeEventPreventable(event);
955 }
956 return handler(...args);
957 };
958 }
959 function makeEventPreventable(event) {
960 event.preventBaseUIHandler = () => {
961 event.baseUIHandlerPrevented = true;
962 };
963 return event;
964 }
965 function mergeClassNames(ourClassName, theirClassName) {
966 if (theirClassName) {
967 if (ourClassName) {
968 return theirClassName + " " + ourClassName;
969 }
970 return theirClassName;
971 }
972 return ourClassName;
973 }
974 function isSyntheticEvent(event) {
975 return event != null && typeof event === "object" && "nativeEvent" in event;
976 }
977
978 // node_modules/@base-ui/react/internals/useRenderElement.mjs
979 var import_react = __toESM(require_react(), 1);
980 function useRenderElement(element, componentProps, params = {}) {
981 const renderProp = componentProps.render;
982 const outProps = useRenderElementProps(componentProps, params);
983 if (params.enabled === false) {
984 return null;
985 }
986 const state = params.state ?? EMPTY_OBJECT;
987 return evaluateRenderProp(element, renderProp, outProps, state);
988 }
989 function useRenderElementProps(componentProps, params = {}) {
990 const {
991 className: classNameProp,
992 style: styleProp,
993 render: renderProp
994 } = componentProps;
995 const {
996 state = EMPTY_OBJECT,
997 ref,
998 props,
999 stateAttributesMapping: stateAttributesMapping5,
1000 enabled = true
1001 } = params;
1002 const className = enabled ? resolveClassName(classNameProp, state) : void 0;
1003 const style = enabled ? resolveStyle(styleProp, state) : void 0;
1004 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping5) : EMPTY_OBJECT;
1005 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
1006 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
1007 if (typeof document !== "undefined") {
1008 if (!enabled) {
1009 void useMergedRefs(null, null);
1010 } else if (Array.isArray(ref)) {
1011 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
1012 } else {
1013 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
1014 }
1015 }
1016 if (!enabled) {
1017 return EMPTY_OBJECT;
1018 }
1019 if (className !== void 0) {
1020 outProps.className = mergeClassNames(outProps.className, className);
1021 }
1022 if (style !== void 0) {
1023 outProps.style = mergeObjects(outProps.style, style);
1024 }
1025 return outProps;
1026 }
1027 function resolveRenderFunctionProps(props) {
1028 if (Array.isArray(props)) {
1029 return mergePropsN(props);
1030 }
1031 return mergeProps(void 0, props);
1032 }
1033 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
1034 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
1035 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
1036 function evaluateRenderProp(element, render, props, state) {
1037 if (render) {
1038 if (typeof render === "function") {
1039 if (true) {
1040 warnIfRenderPropLooksLikeComponent(render);
1041 }
1042 return render(props, state);
1043 }
1044 const mergedProps = mergeProps(props, render.props);
1045 mergedProps.ref = props.ref;
1046 let newElement = render;
1047 if (newElement?.$$typeof === REACT_LAZY_TYPE) {
1048 const children = React9.Children.toArray(render);
1049 newElement = children[0];
1050 }
1051 if (true) {
1052 if (!/* @__PURE__ */ React9.isValidElement(newElement)) {
1053 throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n"));
1054 }
1055 }
1056 return /* @__PURE__ */ React9.cloneElement(newElement, mergedProps);
1057 }
1058 if (element) {
1059 if (typeof element === "string") {
1060 return renderTag(element, props);
1061 }
1062 }
1063 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
1064 }
1065 function warnIfRenderPropLooksLikeComponent(renderFn) {
1066 const functionName = renderFn.name;
1067 if (functionName.length === 0) {
1068 return;
1069 }
1070 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
1071 return;
1072 }
1073 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
1074 return;
1075 }
1076 warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
1077 }
1078 function renderTag(Tag, props) {
1079 if (Tag === "button") {
1080 return /* @__PURE__ */ (0, import_react.createElement)("button", {
1081 type: "button",
1082 ...props,
1083 key: props.key
1084 });
1085 }
1086 if (Tag === "img") {
1087 return /* @__PURE__ */ (0, import_react.createElement)("img", {
1088 alt: "",
1089 ...props,
1090 key: props.key
1091 });
1092 }
1093 return /* @__PURE__ */ React9.createElement(Tag, props);
1094 }
1095
1096 // node_modules/@base-ui/utils/useId.mjs
1097 var React10 = __toESM(require_react(), 1);
1098 var globalId = 0;
1099 function useGlobalId(idOverride, prefix = "mui") {
1100 const [defaultId, setDefaultId] = React10.useState(idOverride);
1101 const id = idOverride || defaultId;
1102 React10.useEffect(() => {
1103 if (defaultId == null) {
1104 globalId += 1;
1105 setDefaultId(`${prefix}-${globalId}`);
1106 }
1107 }, [defaultId, prefix]);
1108 return id;
1109 }
1110 var maybeReactUseId = SafeReact.useId;
1111 function useId(idOverride, prefix) {
1112 if (maybeReactUseId !== void 0) {
1113 const reactId = maybeReactUseId();
1114 return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
1115 }
1116 return useGlobalId(idOverride, prefix);
1117 }
1118
1119 // node_modules/@base-ui/react/internals/useBaseUiId.mjs
1120 function useBaseUiId(idOverride) {
1121 return useId(idOverride, "base-ui");
1122 }
1123
1124 // node_modules/@base-ui/react/internals/reason-parts.mjs
1125 var reason_parts_exports = {};
1126 __export(reason_parts_exports, {
1127 cancelOpen: () => cancelOpen,
1128 chipRemovePress: () => chipRemovePress,
1129 clearPress: () => clearPress,
1130 closePress: () => closePress,
1131 closeWatcher: () => closeWatcher,
1132 decrementPress: () => decrementPress,
1133 disabled: () => disabled,
1134 drag: () => drag,
1135 escapeKey: () => escapeKey,
1136 focusOut: () => focusOut,
1137 imperativeAction: () => imperativeAction,
1138 incrementPress: () => incrementPress,
1139 initial: () => initial,
1140 inputBlur: () => inputBlur,
1141 inputChange: () => inputChange,
1142 inputClear: () => inputClear,
1143 inputPaste: () => inputPaste,
1144 inputPress: () => inputPress,
1145 itemPress: () => itemPress,
1146 keyboard: () => keyboard,
1147 linkPress: () => linkPress,
1148 listNavigation: () => listNavigation,
1149 missing: () => missing,
1150 none: () => none,
1151 outsidePress: () => outsidePress,
1152 pointer: () => pointer,
1153 scrub: () => scrub,
1154 siblingOpen: () => siblingOpen,
1155 swipe: () => swipe,
1156 trackPress: () => trackPress,
1157 triggerFocus: () => triggerFocus,
1158 triggerHover: () => triggerHover,
1159 triggerPress: () => triggerPress,
1160 wheel: () => wheel,
1161 windowResize: () => windowResize
1162 });
1163 var none = "none";
1164 var triggerPress = "trigger-press";
1165 var triggerHover = "trigger-hover";
1166 var triggerFocus = "trigger-focus";
1167 var outsidePress = "outside-press";
1168 var itemPress = "item-press";
1169 var closePress = "close-press";
1170 var linkPress = "link-press";
1171 var clearPress = "clear-press";
1172 var chipRemovePress = "chip-remove-press";
1173 var trackPress = "track-press";
1174 var incrementPress = "increment-press";
1175 var decrementPress = "decrement-press";
1176 var inputChange = "input-change";
1177 var inputClear = "input-clear";
1178 var inputBlur = "input-blur";
1179 var inputPaste = "input-paste";
1180 var inputPress = "input-press";
1181 var focusOut = "focus-out";
1182 var escapeKey = "escape-key";
1183 var closeWatcher = "close-watcher";
1184 var listNavigation = "list-navigation";
1185 var keyboard = "keyboard";
1186 var pointer = "pointer";
1187 var drag = "drag";
1188 var wheel = "wheel";
1189 var scrub = "scrub";
1190 var cancelOpen = "cancel-open";
1191 var siblingOpen = "sibling-open";
1192 var disabled = "disabled";
1193 var missing = "missing";
1194 var initial = "initial";
1195 var imperativeAction = "imperative-action";
1196 var swipe = "swipe";
1197 var windowResize = "window-resize";
1198
1199 // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs
1200 function createChangeEventDetails(reason, event, trigger, customProperties) {
1201 let canceled = false;
1202 let allowPropagation = false;
1203 const custom = customProperties ?? EMPTY_OBJECT;
1204 const details = {
1205 reason,
1206 event: event ?? new Event("base-ui"),
1207 cancel() {
1208 canceled = true;
1209 },
1210 allowPropagation() {
1211 allowPropagation = true;
1212 },
1213 get isCanceled() {
1214 return canceled;
1215 },
1216 get isPropagationAllowed() {
1217 return allowPropagation;
1218 },
1219 trigger,
1220 ...custom
1221 };
1222 return details;
1223 }
1224 function createGenericEventDetails(reason, event, customProperties) {
1225 const custom = customProperties ?? EMPTY_OBJECT;
1226 const details = {
1227 reason,
1228 event: event ?? new Event("base-ui"),
1229 ...custom
1230 };
1231 return details;
1232 }
1233
1234 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
1235 var React12 = __toESM(require_react(), 1);
1236
1237 // node_modules/@base-ui/utils/useOnMount.mjs
1238 var React11 = __toESM(require_react(), 1);
1239 function useOnMount(fn) {
1240 React11.useEffect(fn, EMPTY_ARRAY);
1241 }
1242
1243 // node_modules/@base-ui/utils/useAnimationFrame.mjs
1244 var EMPTY = null;
1245 var LAST_RAF = globalThis.requestAnimationFrame;
1246 var Scheduler = class {
1247 /* This implementation uses an array as a backing data-structure for frame callbacks.
1248 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
1249 * never calls the native `cancelAnimationFrame` if there are no frames left. This can
1250 * be much more efficient if there is a call pattern that alterns as
1251 * "request-cancel-request-cancel-…".
1252 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
1253 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
1254 callbacks = [];
1255 callbacksCount = 0;
1256 nextId = 1;
1257 startId = 1;
1258 isScheduled = false;
1259 tick = (timestamp) => {
1260 this.isScheduled = false;
1261 const currentCallbacks = this.callbacks;
1262 const currentCallbacksCount = this.callbacksCount;
1263 this.callbacks = [];
1264 this.callbacksCount = 0;
1265 this.startId = this.nextId;
1266 if (currentCallbacksCount > 0) {
1267 for (let i = 0; i < currentCallbacks.length; i += 1) {
1268 currentCallbacks[i]?.(timestamp);
1269 }
1270 }
1271 };
1272 request(fn) {
1273 const id = this.nextId;
1274 this.nextId += 1;
1275 this.callbacks.push(fn);
1276 this.callbacksCount += 1;
1277 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
1278 if (!this.isScheduled || didRAFChange) {
1279 requestAnimationFrame(this.tick);
1280 this.isScheduled = true;
1281 }
1282 return id;
1283 }
1284 cancel(id) {
1285 const index2 = id - this.startId;
1286 if (index2 < 0 || index2 >= this.callbacks.length) {
1287 return;
1288 }
1289 this.callbacks[index2] = null;
1290 this.callbacksCount -= 1;
1291 }
1292 };
1293 var scheduler = new Scheduler();
1294 var AnimationFrame = class _AnimationFrame {
1295 static create() {
1296 return new _AnimationFrame();
1297 }
1298 static request(fn) {
1299 return scheduler.request(fn);
1300 }
1301 static cancel(id) {
1302 return scheduler.cancel(id);
1303 }
1304 currentId = EMPTY;
1305 /**
1306 * Executes `fn` after `delay`, clearing any previously scheduled call.
1307 */
1308 request(fn) {
1309 this.cancel();
1310 this.currentId = scheduler.request(() => {
1311 this.currentId = EMPTY;
1312 fn();
1313 });
1314 }
1315 cancel = () => {
1316 if (this.currentId !== EMPTY) {
1317 scheduler.cancel(this.currentId);
1318 this.currentId = EMPTY;
1319 }
1320 };
1321 disposeEffect = () => {
1322 return this.cancel;
1323 };
1324 };
1325 function useAnimationFrame() {
1326 const timeout = useRefWithInit(AnimationFrame.create).current;
1327 useOnMount(timeout.disposeEffect);
1328 return timeout;
1329 }
1330
1331 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
1332 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {
1333 const [transitionStatus, setTransitionStatus] = React12.useState(open && enableIdleState ? "idle" : void 0);
1334 const [mounted, setMounted] = React12.useState(open);
1335 if (open && !mounted) {
1336 setMounted(true);
1337 setTransitionStatus("starting");
1338 }
1339 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) {
1340 setTransitionStatus("ending");
1341 }
1342 if (!open && !mounted && transitionStatus === "ending") {
1343 setTransitionStatus(void 0);
1344 }
1345 useIsoLayoutEffect(() => {
1346 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) {
1347 const frame = AnimationFrame.request(() => {
1348 setTransitionStatus("ending");
1349 });
1350 return () => {
1351 AnimationFrame.cancel(frame);
1352 };
1353 }
1354 return void 0;
1355 }, [open, mounted, transitionStatus, deferEndingState]);
1356 useIsoLayoutEffect(() => {
1357 if (!open || enableIdleState) {
1358 return void 0;
1359 }
1360 const frame = AnimationFrame.request(() => {
1361 setTransitionStatus(void 0);
1362 });
1363 return () => {
1364 AnimationFrame.cancel(frame);
1365 };
1366 }, [enableIdleState, open]);
1367 useIsoLayoutEffect(() => {
1368 if (!open || !enableIdleState) {
1369 return void 0;
1370 }
1371 if (open && mounted && transitionStatus !== "idle") {
1372 setTransitionStatus("starting");
1373 }
1374 const frame = AnimationFrame.request(() => {
1375 setTransitionStatus("idle");
1376 });
1377 return () => {
1378 AnimationFrame.cancel(frame);
1379 };
1380 }, [enableIdleState, open, mounted, transitionStatus]);
1381 return {
1382 mounted,
1383 setMounted,
1384 transitionStatus
1385 };
1386 }
1387
1388 // node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs
1389 var React13 = __toESM(require_react(), 1);
1390 function useCompositeListItem(params = {}) {
1391 const {
1392 guess,
1393 label,
1394 metadata,
1395 textRef,
1396 index: externalIndex
1397 } = params;
1398 const {
1399 register: register2,
1400 unregister,
1401 subscribeMapChange,
1402 nextIndexRef
1403 } = useCompositeListContext();
1404 const indexRef = React13.useRef(-1);
1405 const [internalIndex, setInternalIndex] = React13.useState(externalIndex == null && guess ? () => {
1406 if (indexRef.current === -1) {
1407 const newIndex = nextIndexRef.current;
1408 nextIndexRef.current += 1;
1409 indexRef.current = newIndex;
1410 }
1411 return indexRef.current;
1412 } : -1);
1413 const index2 = externalIndex ?? internalIndex;
1414 const componentRef = React13.useRef(null);
1415 const ref = React13.useCallback((node) => {
1416 const previousNode = componentRef.current;
1417 if (previousNode) {
1418 unregister(previousNode);
1419 }
1420 componentRef.current = node;
1421 if (node) {
1422 register2(node, {
1423 metadata: metadata ?? null,
1424 index: externalIndex ?? null,
1425 label,
1426 textRef
1427 });
1428 }
1429 }, [externalIndex, register2, unregister, metadata, label, textRef]);
1430 useIsoLayoutEffect(() => {
1431 if (externalIndex != null) {
1432 return void 0;
1433 }
1434 return subscribeMapChange((map) => {
1435 const i = componentRef.current ? map.get(componentRef.current)?.index : null;
1436 if (i != null) {
1437 setInternalIndex(i);
1438 }
1439 });
1440 }, [externalIndex, subscribeMapChange]);
1441 return {
1442 ref,
1443 index: index2
1444 };
1445 }
1446
1447 // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs
1448 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) {
1449 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style";
1450 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style";
1451 return TransitionStatusDataAttributes2;
1452 })({});
1453 var STARTING_HOOK = {
1454 "data-starting-style": ""
1455 };
1456 var ENDING_HOOK = {
1457 "data-ending-style": ""
1458 };
1459 var transitionStatusMapping = {
1460 transitionStatus(value) {
1461 if (value === "starting") {
1462 return STARTING_HOOK;
1463 }
1464 if (value === "ending") {
1465 return ENDING_HOOK;
1466 }
1467 return null;
1468 }
1469 };
1470
1471 // node_modules/@base-ui/react/internals/use-button/useButton.mjs
1472 var React16 = __toESM(require_react(), 1);
1473
1474 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
1475 function hasWindow() {
1476 return typeof window !== "undefined";
1477 }
1478 function getNodeName(node) {
1479 if (isNode(node)) {
1480 return (node.nodeName || "").toLowerCase();
1481 }
1482 return "#document";
1483 }
1484 function getWindow(node) {
1485 var _node$ownerDocument;
1486 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1487 }
1488 function getDocumentElement(node) {
1489 var _ref;
1490 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1491 }
1492 function isNode(value) {
1493 if (!hasWindow()) {
1494 return false;
1495 }
1496 return value instanceof Node || value instanceof getWindow(value).Node;
1497 }
1498 function isElement(value) {
1499 if (!hasWindow()) {
1500 return false;
1501 }
1502 return value instanceof Element || value instanceof getWindow(value).Element;
1503 }
1504 function isHTMLElement(value) {
1505 if (!hasWindow()) {
1506 return false;
1507 }
1508 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1509 }
1510 function isShadowRoot(value) {
1511 if (!hasWindow() || typeof ShadowRoot === "undefined") {
1512 return false;
1513 }
1514 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1515 }
1516 function isOverflowElement(element) {
1517 const {
1518 overflow,
1519 overflowX,
1520 overflowY,
1521 display
1522 } = getComputedStyle2(element);
1523 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
1524 }
1525 function isTableElement(element) {
1526 return /^(table|td|th)$/.test(getNodeName(element));
1527 }
1528 function isTopLayer(element) {
1529 try {
1530 if (element.matches(":popover-open")) {
1531 return true;
1532 }
1533 } catch (_e) {
1534 }
1535 try {
1536 return element.matches(":modal");
1537 } catch (_e) {
1538 return false;
1539 }
1540 }
1541 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
1542 var containRe = /paint|layout|strict|content/;
1543 var isNotNone = (value) => !!value && value !== "none";
1544 var isWebKitValue;
1545 function isContainingBlock(elementOrCss) {
1546 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
1547 return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
1548 }
1549 function getContainingBlock(element) {
1550 let currentNode = getParentNode(element);
1551 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1552 if (isContainingBlock(currentNode)) {
1553 return currentNode;
1554 } else if (isTopLayer(currentNode)) {
1555 return null;
1556 }
1557 currentNode = getParentNode(currentNode);
1558 }
1559 return null;
1560 }
1561 function isWebKit() {
1562 if (isWebKitValue == null) {
1563 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
1564 }
1565 return isWebKitValue;
1566 }
1567 function isLastTraversableNode(node) {
1568 return /^(html|body|#document)$/.test(getNodeName(node));
1569 }
1570 function getComputedStyle2(element) {
1571 return getWindow(element).getComputedStyle(element);
1572 }
1573 function getNodeScroll(element) {
1574 if (isElement(element)) {
1575 return {
1576 scrollLeft: element.scrollLeft,
1577 scrollTop: element.scrollTop
1578 };
1579 }
1580 return {
1581 scrollLeft: element.scrollX,
1582 scrollTop: element.scrollY
1583 };
1584 }
1585 function getParentNode(node) {
1586 if (getNodeName(node) === "html") {
1587 return node;
1588 }
1589 const result = (
1590 // Step into the shadow DOM of the parent of a slotted node.
1591 node.assignedSlot || // DOM Element detected.
1592 node.parentNode || // ShadowRoot detected.
1593 isShadowRoot(node) && node.host || // Fallback.
1594 getDocumentElement(node)
1595 );
1596 return isShadowRoot(result) ? result.host : result;
1597 }
1598 function getNearestOverflowAncestor(node) {
1599 const parentNode = getParentNode(node);
1600 if (isLastTraversableNode(parentNode)) {
1601 return (node.ownerDocument || node).body;
1602 }
1603 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1604 return parentNode;
1605 }
1606 return getNearestOverflowAncestor(parentNode);
1607 }
1608 function getOverflowAncestors(node, list, traverseIframes) {
1609 var _node$ownerDocument2;
1610 if (list === void 0) {
1611 list = [];
1612 }
1613 if (traverseIframes === void 0) {
1614 traverseIframes = true;
1615 }
1616 const scrollableAncestor = getNearestOverflowAncestor(node);
1617 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1618 const win = getWindow(scrollableAncestor);
1619 if (isBody) {
1620 const frameElement = getFrameElement(win);
1621 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1622 } else {
1623 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1624 }
1625 }
1626 function getFrameElement(win) {
1627 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1628 }
1629
1630 // node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs
1631 var React14 = __toESM(require_react(), 1);
1632 var CompositeRootContext = /* @__PURE__ */ React14.createContext(void 0);
1633 if (true) CompositeRootContext.displayName = "CompositeRootContext";
1634 function useCompositeRootContext(optional = false) {
1635 const context = React14.useContext(CompositeRootContext);
1636 if (context === void 0 && !optional) {
1637 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16));
1638 }
1639 return context;
1640 }
1641
1642 // node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs
1643 var React15 = __toESM(require_react(), 1);
1644 function useFocusableWhenDisabled(parameters) {
1645 const {
1646 focusableWhenDisabled,
1647 disabled: disabled2,
1648 composite = false,
1649 tabIndex: tabIndexProp = 0,
1650 isNativeButton
1651 } = parameters;
1652 const isFocusableComposite = composite && focusableWhenDisabled !== false;
1653 const isNonFocusableComposite = composite && focusableWhenDisabled === false;
1654 const props = React15.useMemo(() => {
1655 const additionalProps = {
1656 // allow Tabbing away from focusableWhenDisabled elements
1657 onKeyDown(event) {
1658 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") {
1659 event.preventDefault();
1660 }
1661 }
1662 };
1663 if (!composite) {
1664 additionalProps.tabIndex = tabIndexProp;
1665 if (!isNativeButton && disabled2) {
1666 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
1667 }
1668 }
1669 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) {
1670 additionalProps["aria-disabled"] = disabled2;
1671 }
1672 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
1673 additionalProps.disabled = disabled2;
1674 }
1675 return additionalProps;
1676 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
1677 return {
1678 props
1679 };
1680 }
1681
1682 // node_modules/@base-ui/utils/owner.mjs
1683 function ownerDocument(node) {
1684 return node?.ownerDocument || document;
1685 }
1686
1687 // node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs
1688 function dispatchClickWithModifiers(target, sourceEvent, {
1689 detail = 0
1690 } = {}) {
1691 target.dispatchEvent(new (getWindow(target)).PointerEvent("click", {
1692 bubbles: true,
1693 cancelable: true,
1694 composed: true,
1695 detail,
1696 shiftKey: sourceEvent.shiftKey,
1697 ctrlKey: sourceEvent.ctrlKey,
1698 altKey: sourceEvent.altKey,
1699 metaKey: sourceEvent.metaKey
1700 }));
1701 }
1702
1703 // node_modules/@base-ui/react/internals/use-button/useButton.mjs
1704 function useButton(parameters = {}) {
1705 const {
1706 disabled: disabled2 = false,
1707 focusableWhenDisabled,
1708 tabIndex = 0,
1709 native: isNativeButton = true,
1710 composite: compositeProp
1711 } = parameters;
1712 const elementRef = React16.useRef(null);
1713 const compositeRootContext = useCompositeRootContext(true);
1714 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
1715 const {
1716 props: focusableWhenDisabledProps
1717 } = useFocusableWhenDisabled({
1718 focusableWhenDisabled,
1719 disabled: disabled2,
1720 composite: isCompositeItem,
1721 tabIndex,
1722 isNativeButton
1723 });
1724 if (true) {
1725 React16.useEffect(() => {
1726 if (!elementRef.current) {
1727 return;
1728 }
1729 const isButtonTag = isButtonElement(elementRef.current);
1730 if (isNativeButton) {
1731 if (!isButtonTag) {
1732 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
1733 const message = "A component that acts as a button expected a native <button> because the `nativeButton` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the `render` prop, or set `nativeButton` to `false`.";
1734 error(`${message}${ownerStackMessage}`);
1735 }
1736 } else if (isButtonTag) {
1737 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
1738 const message = "A component that acts as a button expected a non-<button> because the `nativeButton` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set `nativeButton` to `true`.";
1739 error(`${message}${ownerStackMessage}`);
1740 }
1741 }, [isNativeButton]);
1742 }
1743 const updateDisabled = React16.useCallback(() => {
1744 const element = elementRef.current;
1745 if (!isButtonElement(element)) {
1746 return;
1747 }
1748 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) {
1749 element.disabled = false;
1750 }
1751 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]);
1752 useIsoLayoutEffect(updateDisabled, [updateDisabled]);
1753 const getButtonProps = React16.useCallback((externalProps = {}) => {
1754 const {
1755 onClick: externalOnClick,
1756 onMouseDown: externalOnMouseDown,
1757 onKeyUp: externalOnKeyUp,
1758 onKeyDown: externalOnKeyDown,
1759 onPointerDown: externalOnPointerDown,
1760 ...otherExternalProps
1761 } = externalProps;
1762 return mergeProps({
1763 onClick(event) {
1764 if (disabled2) {
1765 event.preventDefault();
1766 return;
1767 }
1768 externalOnClick?.(event);
1769 },
1770 onMouseDown(event) {
1771 if (!disabled2) {
1772 externalOnMouseDown?.(event);
1773 }
1774 },
1775 onKeyDown(event) {
1776 if (disabled2) {
1777 return;
1778 }
1779 makeEventPreventable(event);
1780 externalOnKeyDown?.(event);
1781 if (event.baseUIHandlerPrevented) {
1782 return;
1783 }
1784 const isCurrentTarget = event.target === event.currentTarget;
1785 const currentTarget = event.currentTarget;
1786 const isButton = isButtonElement(currentTarget);
1787 const isLink = !isNativeButton && isValidLinkElement(currentTarget);
1788 const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);
1789 const isEnterKey = event.key === "Enter";
1790 const isSpaceKey = event.key === " ";
1791 const role = currentTarget.getAttribute("role");
1792 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell";
1793 if (isCurrentTarget && isCompositeItem && isSpaceKey) {
1794 if (event.defaultPrevented && isTextNavigationRole) {
1795 return;
1796 }
1797 event.preventDefault();
1798 if (!isNativeButton || isButton) {
1799 event.preventBaseUIHandler();
1800 dispatchClickWithModifiers(currentTarget, event);
1801 }
1802 return;
1803 }
1804 if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) {
1805 if (isCurrentTarget && isLink && isSpaceKey) {
1806 event.preventDefault();
1807 }
1808 return;
1809 }
1810 if (event.defaultPrevented) {
1811 return;
1812 }
1813 event.preventDefault();
1814 if (isEnterKey) {
1815 event.preventBaseUIHandler();
1816 dispatchClickWithModifiers(currentTarget, event);
1817 }
1818 },
1819 onKeyUp(event) {
1820 if (disabled2) {
1821 return;
1822 }
1823 makeEventPreventable(event);
1824 externalOnKeyUp?.(event);
1825 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") {
1826 event.preventDefault();
1827 return;
1828 }
1829 if (event.baseUIHandlerPrevented) {
1830 return;
1831 }
1832 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") {
1833 event.preventBaseUIHandler();
1834 dispatchClickWithModifiers(event.currentTarget, event);
1835 }
1836 },
1837 onPointerDown(event) {
1838 if (disabled2) {
1839 event.preventDefault();
1840 return;
1841 }
1842 externalOnPointerDown?.(event);
1843 }
1844 }, isNativeButton ? {
1845 type: "button"
1846 } : {
1847 role: "button"
1848 }, focusableWhenDisabledProps, otherExternalProps);
1849 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);
1850 const buttonRef = useStableCallback((element) => {
1851 elementRef.current = element;
1852 updateDisabled();
1853 });
1854 return {
1855 getButtonProps,
1856 buttonRef
1857 };
1858 }
1859 function isButtonElement(elem) {
1860 return isHTMLElement(elem) && elem.tagName === "BUTTON";
1861 }
1862 function isValidLinkElement(elem) {
1863 return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href);
1864 }
1865
1866 // node_modules/@base-ui/utils/addEventListener.mjs
1867 function addEventListener(target, type, listener, options) {
1868 target.addEventListener(type, listener, options);
1869 return () => {
1870 target.removeEventListener(type, listener, options);
1871 };
1872 }
1873
1874 // node_modules/@base-ui/utils/useValueAsRef.mjs
1875 function useValueAsRef(value) {
1876 const latest = useRefWithInit(createLatestRef, value).current;
1877 latest.next = value;
1878 useIsoLayoutEffect(latest.effect);
1879 return latest;
1880 }
1881 function createLatestRef(value) {
1882 const latest = {
1883 current: value,
1884 next: value,
1885 effect: () => {
1886 latest.current = latest.next;
1887 }
1888 };
1889 return latest;
1890 }
1891
1892 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
1893 var React17 = __toESM(require_react(), 1);
1894
1895 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
1896 var ReactDOM = __toESM(require_react_dom(), 1);
1897
1898 // node_modules/@base-ui/react/utils/resolveRef.mjs
1899 function resolveRef(maybeRef) {
1900 if (maybeRef == null) {
1901 return maybeRef;
1902 }
1903 return "current" in maybeRef ? maybeRef.current : maybeRef;
1904 }
1905
1906 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
1907 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false) {
1908 const frame = useAnimationFrame();
1909 return useStableCallback((fnToExecute, signal = null) => {
1910 frame.cancel();
1911 const element = resolveRef(elementOrRef);
1912 if (element == null) {
1913 return;
1914 }
1915 const resolvedElement = element;
1916 const done = () => {
1917 ReactDOM.flushSync(fnToExecute);
1918 };
1919 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
1920 fnToExecute();
1921 return;
1922 }
1923 function exec() {
1924 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => {
1925 if (!signal?.aborted) {
1926 done();
1927 }
1928 }, () => {
1929 if (signal?.aborted) {
1930 return;
1931 }
1932 const currentAnimations = resolvedElement.getAnimations();
1933 if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) {
1934 exec();
1935 return;
1936 }
1937 done();
1938 });
1939 }
1940 if (waitForStartingStyleRemoved) {
1941 const startingStyleAttribute = "data-starting-style";
1942 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1943 frame.request(exec);
1944 return;
1945 }
1946 const attributeObserver = new MutationObserver(() => {
1947 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1948 attributeObserver.disconnect();
1949 exec();
1950 }
1951 });
1952 attributeObserver.observe(resolvedElement, {
1953 attributes: true,
1954 attributeFilter: [startingStyleAttribute]
1955 });
1956 signal?.addEventListener("abort", () => attributeObserver.disconnect(), {
1957 once: true
1958 });
1959 return;
1960 }
1961 frame.request(exec);
1962 });
1963 }
1964
1965 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
1966 function useOpenChangeComplete(parameters) {
1967 const {
1968 enabled = true,
1969 open,
1970 ref,
1971 onComplete: onCompleteParam
1972 } = parameters;
1973 const onComplete = useStableCallback(onCompleteParam);
1974 const runOnceAnimationsFinish = useAnimationsFinished(ref, open);
1975 React17.useEffect(() => {
1976 if (!enabled) {
1977 return void 0;
1978 }
1979 const abortController = new AbortController();
1980 runOnceAnimationsFinish(onComplete, abortController.signal);
1981 return () => {
1982 abortController.abort();
1983 };
1984 }, [enabled, open, onComplete, runOnceAnimationsFinish]);
1985 }
1986
1987 // node_modules/@base-ui/utils/platform/parts.mjs
1988 var parts_exports = {};
1989 __export(parts_exports, {
1990 engine: () => engine_exports,
1991 env: () => env_exports,
1992 os: () => os_exports,
1993 screenReader: () => screen_reader_exports
1994 });
1995
1996 // node_modules/@base-ui/utils/platform/os.mjs
1997 var os_exports = {};
1998 __export(os_exports, {
1999 android: () => android,
2000 apple: () => apple,
2001 ios: () => ios,
2002 linux: () => linux,
2003 mac: () => mac,
2004 windows: () => windows
2005 });
2006
2007 // node_modules/@base-ui/utils/platform/shared.mjs
2008 function readRawData() {
2009 if (typeof navigator === "undefined") {
2010 return {
2011 userAgent: "",
2012 platform: "",
2013 maxTouchPoints: 0
2014 };
2015 }
2016 if (true) {
2017 const uaData = navigator.userAgentData;
2018 if (uaData && Array.isArray(uaData.brands)) {
2019 return {
2020 userAgent: uaData.brands.map(({
2021 brand,
2022 version: version2
2023 }) => `${brand}/${version2}`).join(" "),
2024 platform: uaData.platform ?? navigator.platform ?? "",
2025 maxTouchPoints: navigator.maxTouchPoints ?? 0
2026 };
2027 }
2028 }
2029 return {
2030 userAgent: navigator.userAgent,
2031 platform: navigator.platform ?? "",
2032 maxTouchPoints: navigator.maxTouchPoints ?? 0
2033 };
2034 }
2035 var {
2036 userAgent,
2037 platform,
2038 maxTouchPoints
2039 } = readRawData();
2040 var lowerUserAgent = userAgent.toLowerCase();
2041 var lowerPlatform = platform.toLowerCase();
2042
2043 // node_modules/@base-ui/utils/platform/os.mjs
2044 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1;
2045 var ANDROID_STRING = "android";
2046 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);
2047 var mac = !ios && lowerPlatform.startsWith("mac");
2048 var windows = lowerPlatform.startsWith("win");
2049 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform);
2050 var apple = mac || ios;
2051
2052 // node_modules/@base-ui/utils/platform/engine.mjs
2053 var engine_exports = {};
2054 __export(engine_exports, {
2055 blink: () => blink,
2056 gecko: () => gecko,
2057 webkit: () => webkit
2058 });
2059 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none");
2060 var gecko = !webkit && lowerUserAgent.includes("firefox");
2061 var blink = !webkit && lowerUserAgent.includes("chrom");
2062
2063 // node_modules/@base-ui/utils/platform/screen-reader.mjs
2064 var screen_reader_exports = {};
2065 __export(screen_reader_exports, {
2066 voiceOver: () => voiceOver
2067 });
2068 var voiceOver = apple;
2069
2070 // node_modules/@base-ui/utils/platform/env.mjs
2071 var env_exports = {};
2072 __export(env_exports, {
2073 jsdom: () => jsdom
2074 });
2075 var jsdom = /jsdom|happydom/.test(lowerUserAgent);
2076
2077 // node_modules/@base-ui/utils/useTimeout.mjs
2078 var EMPTY2 = 0;
2079 var Timeout = class _Timeout {
2080 static create() {
2081 return new _Timeout();
2082 }
2083 currentId = EMPTY2;
2084 /**
2085 * Executes `fn` after `delay`, clearing any previously scheduled call.
2086 */
2087 start(delay, fn) {
2088 this.clear();
2089 this.currentId = setTimeout(() => {
2090 this.currentId = EMPTY2;
2091 fn();
2092 }, delay);
2093 }
2094 isStarted() {
2095 return this.currentId !== EMPTY2;
2096 }
2097 clear = () => {
2098 if (this.currentId !== EMPTY2) {
2099 clearTimeout(this.currentId);
2100 this.currentId = EMPTY2;
2101 }
2102 };
2103 disposeEffect = () => {
2104 return this.clear;
2105 };
2106 };
2107 function useTimeout() {
2108 const timeout = useRefWithInit(Timeout.create).current;
2109 useOnMount(timeout.disposeEffect);
2110 return timeout;
2111 }
2112
2113 // node_modules/@base-ui/utils/useScrollLock.mjs
2114 var originalHtmlStyles = {};
2115 var originalBodyStyles = {};
2116 var originalHtmlScrollBehavior = "";
2117 function getViewportScroller(html, body) {
2118 return isOverflowElement(html) ? html : body;
2119 }
2120 function isPageScrollLocked(win, html, body) {
2121 return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);
2122 }
2123 function hasInsetScrollbars(referenceElement) {
2124 if (typeof document === "undefined") {
2125 return false;
2126 }
2127 const doc = ownerDocument(referenceElement);
2128 const win = getWindow(doc);
2129 return win.innerWidth - doc.documentElement.clientWidth > 0;
2130 }
2131 function supportsStableScrollbarGutter(referenceElement) {
2132 const supported = typeof CSS !== "undefined" && CSS.supports && CSS.supports("scrollbar-gutter", "stable");
2133 if (!supported || typeof document === "undefined") {
2134 return false;
2135 }
2136 const doc = ownerDocument(referenceElement);
2137 const html = doc.documentElement;
2138 const body = doc.body;
2139 const scrollContainer = getViewportScroller(html, body);
2140 const originalScrollContainerOverflowY = scrollContainer.style.overflowY;
2141 const originalHtmlStyleGutter = html.style.scrollbarGutter;
2142 html.style.scrollbarGutter = "stable";
2143 scrollContainer.style.overflowY = "scroll";
2144 const before = scrollContainer.offsetWidth;
2145 scrollContainer.style.overflowY = "hidden";
2146 const after = scrollContainer.offsetWidth;
2147 scrollContainer.style.overflowY = originalScrollContainerOverflowY;
2148 html.style.scrollbarGutter = originalHtmlStyleGutter;
2149 return before === after;
2150 }
2151 function preventScrollOverlayScrollbars(referenceElement) {
2152 const doc = ownerDocument(referenceElement);
2153 const html = doc.documentElement;
2154 const body = doc.body;
2155 const elementToLock = getViewportScroller(html, body);
2156 const originalElementToLockStyles = {
2157 overflowY: elementToLock.style.overflowY,
2158 overflowX: elementToLock.style.overflowX
2159 };
2160 Object.assign(elementToLock.style, {
2161 overflowY: "hidden",
2162 overflowX: "hidden"
2163 });
2164 return () => {
2165 Object.assign(elementToLock.style, originalElementToLockStyles);
2166 };
2167 }
2168 function preventScrollInsetScrollbars(referenceElement) {
2169 const doc = ownerDocument(referenceElement);
2170 const html = doc.documentElement;
2171 const body = doc.body;
2172 const win = getWindow(html);
2173 let scrollTop = 0;
2174 let scrollLeft = 0;
2175 let updateGutterOnly = false;
2176 const resizeFrame = AnimationFrame.create();
2177 if (parts_exports.engine.webkit && (win.visualViewport?.scale ?? 1) !== 1) {
2178 return () => {
2179 };
2180 }
2181 function lockScroll() {
2182 const htmlStyles = win.getComputedStyle(html);
2183 const bodyStyles = win.getComputedStyle(body);
2184 const htmlScrollbarGutterValue = htmlStyles.scrollbarGutter || "";
2185 const hasBothEdges = htmlScrollbarGutterValue.includes("both-edges");
2186 const scrollbarGutterValue = hasBothEdges ? "stable both-edges" : "stable";
2187 scrollTop = html.scrollTop;
2188 scrollLeft = html.scrollLeft;
2189 originalHtmlStyles = {
2190 scrollbarGutter: html.style.scrollbarGutter,
2191 overflowY: html.style.overflowY,
2192 overflowX: html.style.overflowX
2193 };
2194 originalHtmlScrollBehavior = html.style.scrollBehavior;
2195 originalBodyStyles = {
2196 position: body.style.position,
2197 height: body.style.height,
2198 width: body.style.width,
2199 boxSizing: body.style.boxSizing,
2200 overflowY: body.style.overflowY,
2201 overflowX: body.style.overflowX,
2202 scrollBehavior: body.style.scrollBehavior
2203 };
2204 const isScrollableY2 = html.scrollHeight > html.clientHeight;
2205 const isScrollableX = html.scrollWidth > html.clientWidth;
2206 const hasConstantOverflowY = htmlStyles.overflowY === "scroll" || bodyStyles.overflowY === "scroll";
2207 const hasConstantOverflowX = htmlStyles.overflowX === "scroll" || bodyStyles.overflowX === "scroll";
2208 const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth);
2209 const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);
2210 const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);
2211 const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);
2212 const elementToLock = getViewportScroller(html, body);
2213 updateGutterOnly = supportsStableScrollbarGutter(referenceElement);
2214 if (updateGutterOnly) {
2215 html.style.scrollbarGutter = scrollbarGutterValue;
2216 elementToLock.style.overflowY = "hidden";
2217 elementToLock.style.overflowX = "hidden";
2218 return;
2219 }
2220 Object.assign(html.style, {
2221 scrollbarGutter: scrollbarGutterValue,
2222 overflowY: "hidden",
2223 overflowX: "hidden"
2224 });
2225 if (isScrollableY2 || hasConstantOverflowY) {
2226 html.style.overflowY = "scroll";
2227 }
2228 if (isScrollableX || hasConstantOverflowX) {
2229 html.style.overflowX = "scroll";
2230 }
2231 Object.assign(body.style, {
2232 position: "relative",
2233 height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : "100dvh",
2234 width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : "100vw",
2235 boxSizing: "border-box",
2236 // Assign the longhands that `cleanup` restores, so nothing is left behind.
2237 overflowY: "hidden",
2238 overflowX: "hidden",
2239 scrollBehavior: "unset"
2240 });
2241 body.scrollTop = scrollTop;
2242 body.scrollLeft = scrollLeft;
2243 html.setAttribute("data-base-ui-scroll-locked", "");
2244 html.style.scrollBehavior = "unset";
2245 }
2246 function cleanup() {
2247 Object.assign(html.style, originalHtmlStyles);
2248 Object.assign(body.style, originalBodyStyles);
2249 if (!updateGutterOnly) {
2250 html.scrollTop = scrollTop;
2251 html.scrollLeft = scrollLeft;
2252 html.removeAttribute("data-base-ui-scroll-locked");
2253 html.style.scrollBehavior = originalHtmlScrollBehavior;
2254 }
2255 }
2256 function handleResize() {
2257 cleanup();
2258 resizeFrame.request(lockScroll);
2259 }
2260 lockScroll();
2261 const unsubscribeResize = addEventListener(win, "resize", handleResize);
2262 return () => {
2263 resizeFrame.cancel();
2264 cleanup();
2265 if (typeof win.removeEventListener === "function") {
2266 unsubscribeResize();
2267 }
2268 };
2269 }
2270 var ScrollLocker = class {
2271 lockCount = 0;
2272 restore = null;
2273 timeoutLock = Timeout.create();
2274 timeoutUnlock = Timeout.create();
2275 acquire(referenceElement) {
2276 this.lockCount += 1;
2277 if (this.lockCount === 1 && this.restore === null) {
2278 this.timeoutLock.start(0, () => this.lock(referenceElement));
2279 }
2280 return this.release;
2281 }
2282 release = () => {
2283 this.lockCount -= 1;
2284 if (this.lockCount === 0 && this.restore) {
2285 this.timeoutUnlock.start(0, this.unlock);
2286 }
2287 };
2288 unlock = () => {
2289 if (this.lockCount === 0 && this.restore) {
2290 this.restore?.();
2291 this.restore = null;
2292 }
2293 };
2294 lock(referenceElement) {
2295 if (this.lockCount === 0 || this.restore !== null) {
2296 return;
2297 }
2298 const doc = ownerDocument(referenceElement);
2299 const html = doc.documentElement;
2300 const body = doc.body;
2301 const win = getWindow(html);
2302 if (isPageScrollLocked(win, html, body)) {
2303 const observer = new win.MutationObserver(() => {
2304 if (isPageScrollLocked(win, html, body)) {
2305 return;
2306 }
2307 observer.disconnect();
2308 this.restore = null;
2309 this.lock(referenceElement);
2310 });
2311 const options = {
2312 attributes: true
2313 };
2314 observer.observe(html, options);
2315 observer.observe(body, options);
2316 this.restore = () => observer.disconnect();
2317 return;
2318 }
2319 const hasOverlayScrollbars = parts_exports.os.ios || !hasInsetScrollbars(referenceElement);
2320 this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);
2321 }
2322 };
2323 var SCROLL_LOCKER = new ScrollLocker();
2324 function useScrollLock(enabled = true, referenceElement = null) {
2325 useIsoLayoutEffect(() => {
2326 if (!enabled) {
2327 return void 0;
2328 }
2329 return SCROLL_LOCKER.acquire(referenceElement);
2330 }, [enabled, referenceElement]);
2331 }
2332
2333 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
2334 var React18 = __toESM(require_react(), 1);
2335
2336 // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs
2337 function stopEvent(event) {
2338 event.preventDefault();
2339 event.stopPropagation();
2340 }
2341 function isReactEvent(event) {
2342 return "nativeEvent" in event;
2343 }
2344 function isVirtualClick(event) {
2345 if (event.pointerType === "" && event.isTrusted) {
2346 return true;
2347 }
2348 if (parts_exports.os.android && event.pointerType) {
2349 return event.type === "click" && event.buttons === 1;
2350 }
2351 return event.detail === 0 && !event.pointerType;
2352 }
2353 function isVirtualPointerEvent(event) {
2354 if (parts_exports.env.jsdom) {
2355 return false;
2356 }
2357 return !parts_exports.os.android && event.width === 0 && event.height === 0 || parts_exports.os.android && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
2358 event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "touch";
2359 }
2360 function isMouseLikePointerType(pointerType, strict) {
2361 const values = ["mouse", "pen"];
2362 if (!strict) {
2363 values.push("", void 0);
2364 }
2365 return values.includes(pointerType);
2366 }
2367 function isClickLikeEvent(event) {
2368 const type = event.type;
2369 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
2370 }
2371
2372 // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs
2373 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable";
2374 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
2375 var ARROW_LEFT = "ArrowLeft";
2376 var ARROW_RIGHT = "ArrowRight";
2377 var ARROW_UP = "ArrowUp";
2378 var ARROW_DOWN = "ArrowDown";
2379
2380 // node_modules/@base-ui/react/internals/shadowDom.mjs
2381 function activeElement(doc) {
2382 let element = doc.activeElement;
2383 while (element?.shadowRoot?.activeElement != null) {
2384 element = element.shadowRoot.activeElement;
2385 }
2386 return element;
2387 }
2388 function contains(parent, child) {
2389 if (!parent || !child) {
2390 return false;
2391 }
2392 const rootNode = child.getRootNode?.();
2393 if (parent.contains(child)) {
2394 return true;
2395 }
2396 if (rootNode && isShadowRoot(rootNode)) {
2397 let next = child;
2398 while (next) {
2399 if (parent === next) {
2400 return true;
2401 }
2402 next = next.parentNode || next.host;
2403 }
2404 }
2405 return false;
2406 }
2407 function getTarget(event) {
2408 if ("composedPath" in event) {
2409 return event.composedPath()[0];
2410 }
2411 return event.target;
2412 }
2413
2414 // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs
2415 function isTargetInsideEnabledTrigger(target, triggerElements) {
2416 if (!isElement(target)) {
2417 return false;
2418 }
2419 const targetElement = target;
2420 if (triggerElements.hasElement(targetElement)) {
2421 return !targetElement.hasAttribute("data-trigger-disabled");
2422 }
2423 for (const [, trigger] of triggerElements.entries()) {
2424 if (contains(trigger, targetElement)) {
2425 return !trigger.hasAttribute("data-trigger-disabled");
2426 }
2427 }
2428 return false;
2429 }
2430 function isEventTargetWithin(event, node) {
2431 if (node == null) {
2432 return false;
2433 }
2434 if ("composedPath" in event) {
2435 return event.composedPath().includes(node);
2436 }
2437 const eventAgain = event;
2438 return eventAgain.target != null && node.contains(eventAgain.target);
2439 }
2440 function isRootElement(element) {
2441 return element.matches("html,body");
2442 }
2443 function isTypeableElement(element) {
2444 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
2445 }
2446 function isInteractiveElement(element) {
2447 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null;
2448 }
2449 function isTypeableCombobox(element) {
2450 if (!element) {
2451 return false;
2452 }
2453 return element.getAttribute("role") === "combobox" && isTypeableElement(element);
2454 }
2455 function matchesFocusVisible(element) {
2456 if (!element || parts_exports.env.jsdom) {
2457 return true;
2458 }
2459 try {
2460 return element.matches(":focus-visible");
2461 } catch (_e) {
2462 return true;
2463 }
2464 }
2465 function getFloatingFocusElement(floatingElement) {
2466 if (!floatingElement) {
2467 return null;
2468 }
2469 return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement;
2470 }
2471
2472 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs
2473 function resolveValue(value, pointerType) {
2474 if (pointerType != null && !isMouseLikePointerType(pointerType)) {
2475 return 0;
2476 }
2477 if (typeof value === "function") {
2478 return value();
2479 }
2480 return value;
2481 }
2482 function getDelay(value, prop, pointerType) {
2483 const result = resolveValue(value, pointerType);
2484 if (typeof result === "number") {
2485 return result;
2486 }
2487 return result?.[prop];
2488 }
2489 function getRestMs(value) {
2490 if (typeof value === "function") {
2491 return value();
2492 }
2493 return value;
2494 }
2495 function isClickLikeOpenEvent(openEventType, interactedInside) {
2496 return interactedInside || openEventType === "click" || openEventType === "mousedown";
2497 }
2498 function isHoverOpenEvent(openEventType) {
2499 return openEventType?.includes("mouse") && openEventType !== "mousedown";
2500 }
2501
2502 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
2503 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
2504 var FloatingDelayGroupContext = /* @__PURE__ */ React18.createContext({
2505 hasProvider: false,
2506 timeoutMs: 0,
2507 delayRef: {
2508 current: 0
2509 },
2510 initialDelayRef: {
2511 current: 0
2512 },
2513 timeout: new Timeout(),
2514 currentIdRef: {
2515 current: null
2516 },
2517 currentContextRef: {
2518 current: null
2519 }
2520 });
2521 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext";
2522 function resetDelayRef(delayRef, initialDelayRef) {
2523 delayRef.current = initialDelayRef.current;
2524 }
2525 function FloatingDelayGroup(props) {
2526 const {
2527 children,
2528 delay,
2529 timeoutMs = 0
2530 } = props;
2531 const delayRef = React18.useRef(delay);
2532 const initialDelayRef = React18.useRef(delay);
2533 const currentIdRef = React18.useRef(null);
2534 const currentContextRef = React18.useRef(null);
2535 const timeout = useTimeout();
2536 useIsoLayoutEffect(() => {
2537 initialDelayRef.current = delay;
2538 if (!currentIdRef.current) {
2539 delayRef.current = delay;
2540 return;
2541 }
2542 delayRef.current = {
2543 open: getDelay(delayRef.current, "open"),
2544 close: getDelay(delay, "close")
2545 };
2546 }, [delay, currentIdRef, delayRef, initialDelayRef]);
2547 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FloatingDelayGroupContext.Provider, {
2548 value: React18.useMemo(() => ({
2549 hasProvider: true,
2550 delayRef,
2551 initialDelayRef,
2552 currentIdRef,
2553 timeoutMs,
2554 currentContextRef,
2555 timeout
2556 }), [timeoutMs, timeout]),
2557 children
2558 });
2559 }
2560 function useDelayGroup(context, options = {
2561 open: false
2562 }) {
2563 const {
2564 open
2565 } = options;
2566 const store = "rootStore" in context ? context.rootStore : context;
2567 const floatingId = store.useState("floatingId");
2568 const groupContext = React18.useContext(FloatingDelayGroupContext);
2569 const {
2570 currentIdRef,
2571 delayRef,
2572 timeoutMs,
2573 initialDelayRef,
2574 currentContextRef,
2575 hasProvider,
2576 timeout
2577 } = groupContext;
2578 const [isInstantPhase, setIsInstantPhase] = React18.useState(false);
2579 const openRef = React18.useRef(open);
2580 useIsoLayoutEffect(() => {
2581 openRef.current = open;
2582 }, [open]);
2583 useIsoLayoutEffect(() => {
2584 function unset() {
2585 currentContextRef.current?.setIsInstantPhase(false);
2586 currentIdRef.current = null;
2587 currentContextRef.current = null;
2588 delayRef.current = initialDelayRef.current;
2589 timeout.clear();
2590 }
2591 if (!currentIdRef.current) {
2592 return void 0;
2593 }
2594 if (!open && currentIdRef.current === floatingId) {
2595 setIsInstantPhase(false);
2596 if (timeoutMs) {
2597 const closingId = floatingId;
2598 timeout.start(timeoutMs, () => {
2599 if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) {
2600 return;
2601 }
2602 unset();
2603 });
2604 return () => {
2605 if (openRef.current || currentIdRef.current !== closingId) {
2606 timeout.clear();
2607 }
2608 };
2609 }
2610 unset();
2611 }
2612 return void 0;
2613 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]);
2614 useIsoLayoutEffect(() => {
2615 if (!open) {
2616 return;
2617 }
2618 const prevContext = currentContextRef.current;
2619 const prevId = currentIdRef.current;
2620 timeout.clear();
2621 currentContextRef.current = {
2622 onOpenChange: store.setOpen,
2623 setIsInstantPhase
2624 };
2625 currentIdRef.current = floatingId;
2626 delayRef.current = {
2627 open: 0,
2628 close: getDelay(initialDelayRef.current, "close")
2629 };
2630 if (prevId !== null && prevId !== floatingId) {
2631 setIsInstantPhase(true);
2632 prevContext?.setIsInstantPhase(true);
2633 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none));
2634 } else {
2635 setIsInstantPhase(false);
2636 prevContext?.setIsInstantPhase(false);
2637 }
2638 }, [open, floatingId, store, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]);
2639 useIsoLayoutEffect(() => {
2640 return () => {
2641 if (currentIdRef.current === floatingId) {
2642 currentContextRef.current = null;
2643 if (!openRef.current) {
2644 return;
2645 }
2646 currentIdRef.current = null;
2647 resetDelayRef(delayRef, initialDelayRef);
2648 timeout.clear();
2649 }
2650 };
2651 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]);
2652 return React18.useMemo(() => ({
2653 hasProvider,
2654 delayRef,
2655 isInstantPhase
2656 }), [hasProvider, delayRef, isInstantPhase]);
2657 }
2658
2659 // node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs
2660 var React22 = __toESM(require_react(), 1);
2661
2662 // node_modules/@base-ui/utils/mergeCleanups.mjs
2663 function mergeCleanups(...cleanups) {
2664 return () => {
2665 for (let i = 0; i < cleanups.length; i += 1) {
2666 const cleanup = cleanups[i];
2667 if (cleanup) {
2668 cleanup();
2669 }
2670 }
2671 };
2672 }
2673
2674 // node_modules/@base-ui/react/utils/FocusGuard.mjs
2675 var React19 = __toESM(require_react(), 1);
2676
2677 // node_modules/@base-ui/utils/visuallyHidden.mjs
2678 var visuallyHiddenBase = {
2679 clipPath: "inset(50%)",
2680 overflow: "hidden",
2681 whiteSpace: "nowrap",
2682 border: 0,
2683 padding: 0,
2684 width: 1,
2685 height: 1,
2686 margin: -1
2687 };
2688 var visuallyHidden = {
2689 ...visuallyHiddenBase,
2690 position: "fixed",
2691 top: 0,
2692 left: 0
2693 };
2694 var visuallyHiddenInput = {
2695 ...visuallyHiddenBase,
2696 position: "absolute"
2697 };
2698
2699 // node_modules/@base-ui/react/utils/FocusGuard.mjs
2700 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
2701 var FocusGuard = /* @__PURE__ */ React19.forwardRef(function FocusGuard2(props, ref) {
2702 const [role, setRole] = React19.useState();
2703 useIsoLayoutEffect(() => {
2704 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) {
2705 setRole("button");
2706 }
2707 }, []);
2708 const restProps = {
2709 tabIndex: 0,
2710 // Role is only for VoiceOver
2711 role
2712 };
2713 return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", {
2714 ...props,
2715 ref,
2716 style: visuallyHidden,
2717 "aria-hidden": role ? void 0 : true,
2718 ...restProps,
2719 "data-base-ui-focus-guard": ""
2720 });
2721 });
2722 if (true) FocusGuard.displayName = "FocusGuard";
2723
2724 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
2725 var min = Math.min;
2726 var max = Math.max;
2727 var round = Math.round;
2728 var floor = Math.floor;
2729 var createCoords = (v) => ({
2730 x: v,
2731 y: v
2732 });
2733 var oppositeSideMap = {
2734 left: "right",
2735 right: "left",
2736 bottom: "top",
2737 top: "bottom"
2738 };
2739 function clamp(start, value, end) {
2740 return max(start, min(value, end));
2741 }
2742 function evaluate(value, param) {
2743 return typeof value === "function" ? value(param) : value;
2744 }
2745 function getSide(placement) {
2746 return placement.split("-")[0];
2747 }
2748 function getAlignment(placement) {
2749 return placement.split("-")[1];
2750 }
2751 function getOppositeAxis(axis) {
2752 return axis === "x" ? "y" : "x";
2753 }
2754 function getAxisLength(axis) {
2755 return axis === "y" ? "height" : "width";
2756 }
2757 function getSideAxis(placement) {
2758 const firstChar = placement[0];
2759 return firstChar === "t" || firstChar === "b" ? "y" : "x";
2760 }
2761 function getAlignmentAxis(placement) {
2762 return getOppositeAxis(getSideAxis(placement));
2763 }
2764 function getAlignmentSides(placement, rects, rtl) {
2765 if (rtl === void 0) {
2766 rtl = false;
2767 }
2768 const alignment = getAlignment(placement);
2769 const alignmentAxis = getAlignmentAxis(placement);
2770 const length = getAxisLength(alignmentAxis);
2771 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
2772 if (rects.reference[length] > rects.floating[length]) {
2773 mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
2774 }
2775 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
2776 }
2777 function getExpandedPlacements(placement) {
2778 const oppositePlacement = getOppositePlacement(placement);
2779 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
2780 }
2781 function getOppositeAlignmentPlacement(placement) {
2782 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
2783 }
2784 var lrPlacement = ["left", "right"];
2785 var rlPlacement = ["right", "left"];
2786 var tbPlacement = ["top", "bottom"];
2787 var btPlacement = ["bottom", "top"];
2788 function getSideList(side, isStart, rtl) {
2789 switch (side) {
2790 case "top":
2791 case "bottom":
2792 if (rtl) return isStart ? rlPlacement : lrPlacement;
2793 return isStart ? lrPlacement : rlPlacement;
2794 case "left":
2795 case "right":
2796 return isStart ? tbPlacement : btPlacement;
2797 default:
2798 return [];
2799 }
2800 }
2801 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
2802 const alignment = getAlignment(placement);
2803 let list = getSideList(getSide(placement), direction === "start", rtl);
2804 if (alignment) {
2805 list = list.map((side) => side + "-" + alignment);
2806 if (flipAlignment) {
2807 list = list.concat(list.map(getOppositeAlignmentPlacement));
2808 }
2809 }
2810 return list;
2811 }
2812 function getOppositePlacement(placement) {
2813 const side = getSide(placement);
2814 return oppositeSideMap[side] + placement.slice(side.length);
2815 }
2816 function expandPaddingObject(padding) {
2817 var _padding$top, _padding$right, _padding$bottom, _padding$left;
2818 return {
2819 top: (_padding$top = padding.top) != null ? _padding$top : 0,
2820 right: (_padding$right = padding.right) != null ? _padding$right : 0,
2821 bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
2822 left: (_padding$left = padding.left) != null ? _padding$left : 0
2823 };
2824 }
2825 function getPaddingObject(padding) {
2826 return typeof padding !== "number" ? expandPaddingObject(padding) : {
2827 top: padding,
2828 right: padding,
2829 bottom: padding,
2830 left: padding
2831 };
2832 }
2833 function rectToClientRect(rect) {
2834 const {
2835 x,
2836 y,
2837 width,
2838 height
2839 } = rect;
2840 return {
2841 width,
2842 height,
2843 top: y,
2844 left: x,
2845 right: x + width,
2846 bottom: y + height,
2847 x,
2848 y
2849 };
2850 }
2851
2852 // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs
2853 function isDifferentGridRow(index2, cols, prevRow) {
2854 return Math.floor(index2 / cols) !== prevRow;
2855 }
2856 function isIndexOutOfListBounds(list, index2) {
2857 return index2 < 0 || index2 >= list.length;
2858 }
2859 function getMinListIndex(listRef, disabledIndices) {
2860 return findNonDisabledListIndex(listRef.current, {
2861 disabledIndices
2862 });
2863 }
2864 function getMaxListIndex(listRef, disabledIndices) {
2865 return findNonDisabledListIndex(listRef.current, {
2866 decrement: true,
2867 startingIndex: listRef.current.length,
2868 disabledIndices
2869 });
2870 }
2871 function findNonDisabledListIndex(list, {
2872 startingIndex = -1,
2873 decrement = false,
2874 disabledIndices,
2875 amount = 1
2876 } = {}) {
2877 let index2 = startingIndex;
2878 do {
2879 index2 += decrement ? -amount : amount;
2880 } while (index2 >= 0 && index2 <= list.length - 1 && isListIndexDisabled(list, index2, disabledIndices));
2881 return index2;
2882 }
2883 function getGridNavigatedIndex(list, {
2884 event,
2885 orientation,
2886 loopFocus,
2887 onLoop,
2888 rtl,
2889 cols,
2890 disabledIndices,
2891 minIndex,
2892 maxIndex,
2893 prevIndex,
2894 stopEvent: stop = false
2895 }) {
2896 let nextIndex = prevIndex;
2897 let verticalDirection;
2898 if (event.key === ARROW_UP) {
2899 verticalDirection = "up";
2900 } else if (event.key === ARROW_DOWN) {
2901 verticalDirection = "down";
2902 }
2903 if (verticalDirection) {
2904 const rows = [];
2905 const rowIndexMap = [];
2906 let hasRoleRow = false;
2907 let visibleItemCount = 0;
2908 {
2909 let currentRowEl = null;
2910 let currentRowIndex = -1;
2911 list.forEach((el, idx) => {
2912 if (el == null) {
2913 return;
2914 }
2915 visibleItemCount += 1;
2916 const rowEl = el.closest('[role="row"]');
2917 if (rowEl) {
2918 hasRoleRow = true;
2919 }
2920 if (rowEl !== currentRowEl || currentRowIndex === -1) {
2921 currentRowEl = rowEl;
2922 currentRowIndex += 1;
2923 rows[currentRowIndex] = [];
2924 }
2925 rows[currentRowIndex].push(idx);
2926 rowIndexMap[idx] = currentRowIndex;
2927 });
2928 }
2929 let hasDomRows = false;
2930 let inferredDomCols = 0;
2931 if (hasRoleRow) {
2932 for (const row of rows) {
2933 const rowLength = row.length;
2934 if (rowLength > inferredDomCols) {
2935 inferredDomCols = rowLength;
2936 }
2937 if (rowLength !== cols) {
2938 hasDomRows = true;
2939 }
2940 }
2941 }
2942 const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;
2943 const verticalCols = inferredDomCols || cols;
2944 const navigateVertically = (direction) => {
2945 if (!hasDomRows || prevIndex === -1) {
2946 return void 0;
2947 }
2948 const currentRow = rowIndexMap[prevIndex];
2949 if (currentRow == null) {
2950 return void 0;
2951 }
2952 const colInRow = rows[currentRow].indexOf(prevIndex);
2953 const step = direction === "up" ? -1 : 1;
2954 for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) {
2955 if (nextRow < 0 || nextRow >= rows.length) {
2956 if (!loopFocus || hasVirtualizedGaps) {
2957 return void 0;
2958 }
2959 nextRow = nextRow < 0 ? rows.length - 1 : 0;
2960 if (onLoop) {
2961 const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);
2962 const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];
2963 const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);
2964 nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;
2965 }
2966 }
2967 const targetRow = rows[nextRow];
2968 for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) {
2969 const candidate = targetRow[col];
2970 if (!isListIndexDisabled(list, candidate, disabledIndices)) {
2971 return candidate;
2972 }
2973 }
2974 }
2975 return void 0;
2976 };
2977 const navigateVerticallyWithInferredRows = (direction) => {
2978 if (!hasVirtualizedGaps || prevIndex === -1) {
2979 return void 0;
2980 }
2981 const colInRow = prevIndex % verticalCols;
2982 const rowStep = direction === "up" ? -verticalCols : verticalCols;
2983 const lastRowStart = maxIndex - maxIndex % verticalCols;
2984 const rowCount = floor(maxIndex / verticalCols) + 1;
2985 for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) {
2986 if (rowStart < 0 || rowStart > maxIndex) {
2987 if (!loopFocus) {
2988 return void 0;
2989 }
2990 rowStart = rowStart < 0 ? lastRowStart : 0;
2991 }
2992 const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);
2993 for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) {
2994 if (!isListIndexDisabled(list, candidate, disabledIndices)) {
2995 return candidate;
2996 }
2997 }
2998 }
2999 return void 0;
3000 };
3001 if (stop) {
3002 stopEvent(event);
3003 }
3004 const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection);
3005 if (verticalCandidate !== void 0) {
3006 nextIndex = verticalCandidate;
3007 } else if (prevIndex === -1) {
3008 nextIndex = verticalDirection === "up" ? maxIndex : minIndex;
3009 } else {
3010 nextIndex = findNonDisabledListIndex(list, {
3011 startingIndex: prevIndex,
3012 amount: verticalCols,
3013 decrement: verticalDirection === "up",
3014 disabledIndices
3015 });
3016 if (loopFocus) {
3017 if (verticalDirection === "up" && (prevIndex - verticalCols < minIndex || nextIndex < 0)) {
3018 const col = prevIndex % verticalCols;
3019 const maxCol = maxIndex % verticalCols;
3020 const offset4 = maxIndex - (maxCol - col);
3021 if (maxCol === col) {
3022 nextIndex = maxIndex;
3023 } else {
3024 nextIndex = maxCol > col ? offset4 : offset4 - verticalCols;
3025 }
3026 if (onLoop) {
3027 nextIndex = onLoop(event, prevIndex, nextIndex);
3028 }
3029 }
3030 if (verticalDirection === "down" && prevIndex + verticalCols > maxIndex) {
3031 nextIndex = findNonDisabledListIndex(list, {
3032 startingIndex: prevIndex % verticalCols - verticalCols,
3033 amount: verticalCols,
3034 disabledIndices
3035 });
3036 if (onLoop) {
3037 nextIndex = onLoop(event, prevIndex, nextIndex);
3038 }
3039 }
3040 }
3041 }
3042 if (isIndexOutOfListBounds(list, nextIndex)) {
3043 nextIndex = prevIndex;
3044 }
3045 }
3046 if (orientation === "both") {
3047 const prevRow = floor(prevIndex / cols);
3048 if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {
3049 if (stop) {
3050 stopEvent(event);
3051 }
3052 if (prevIndex % cols !== cols - 1) {
3053 nextIndex = findNonDisabledListIndex(list, {
3054 startingIndex: prevIndex,
3055 disabledIndices
3056 });
3057 if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {
3058 nextIndex = findNonDisabledListIndex(list, {
3059 startingIndex: prevIndex - prevIndex % cols - 1,
3060 disabledIndices
3061 });
3062 if (onLoop) {
3063 nextIndex = onLoop(event, prevIndex, nextIndex);
3064 }
3065 }
3066 } else if (loopFocus) {
3067 nextIndex = findNonDisabledListIndex(list, {
3068 startingIndex: prevIndex - prevIndex % cols - 1,
3069 disabledIndices
3070 });
3071 if (onLoop) {
3072 nextIndex = onLoop(event, prevIndex, nextIndex);
3073 }
3074 }
3075 if (isDifferentGridRow(nextIndex, cols, prevRow)) {
3076 nextIndex = prevIndex;
3077 }
3078 }
3079 if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {
3080 if (stop) {
3081 stopEvent(event);
3082 }
3083 if (prevIndex % cols !== 0) {
3084 nextIndex = findNonDisabledListIndex(list, {
3085 startingIndex: prevIndex,
3086 decrement: true,
3087 disabledIndices
3088 });
3089 if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {
3090 nextIndex = findNonDisabledListIndex(list, {
3091 startingIndex: prevIndex + (cols - prevIndex % cols),
3092 decrement: true,
3093 disabledIndices
3094 });
3095 if (onLoop) {
3096 nextIndex = onLoop(event, prevIndex, nextIndex);
3097 }
3098 }
3099 } else if (loopFocus) {
3100 nextIndex = findNonDisabledListIndex(list, {
3101 startingIndex: prevIndex + (cols - prevIndex % cols),
3102 decrement: true,
3103 disabledIndices
3104 });
3105 if (onLoop) {
3106 nextIndex = onLoop(event, prevIndex, nextIndex);
3107 }
3108 }
3109 if (isDifferentGridRow(nextIndex, cols, prevRow)) {
3110 nextIndex = prevIndex;
3111 }
3112 }
3113 const lastRow = floor(maxIndex / cols) === prevRow;
3114 if (isIndexOutOfListBounds(list, nextIndex)) {
3115 if (loopFocus && lastRow) {
3116 nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {
3117 startingIndex: prevIndex - prevIndex % cols - 1,
3118 disabledIndices
3119 });
3120 if (onLoop) {
3121 nextIndex = onLoop(event, prevIndex, nextIndex);
3122 }
3123 } else {
3124 nextIndex = prevIndex;
3125 }
3126 }
3127 }
3128 return nextIndex;
3129 }
3130 function isListIndexDisabled(list, index2, disabledIndices) {
3131 const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index2) : disabledIndices?.includes(index2) ?? false;
3132 if (isExplicitlyDisabled) {
3133 return true;
3134 }
3135 const element = list[index2];
3136 if (!element) {
3137 return false;
3138 }
3139 if (!isElementVisible(element)) {
3140 return true;
3141 }
3142 if (element.matches(":disabled")) {
3143 return true;
3144 }
3145 return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true");
3146 }
3147 function isHiddenByStyles(styles) {
3148 return styles.visibility === "hidden" || styles.visibility === "collapse";
3149 }
3150 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) {
3151 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
3152 return false;
3153 }
3154 if (typeof element.checkVisibility === "function") {
3155 return element.checkVisibility();
3156 }
3157 return styles.display !== "none" && styles.display !== "contents";
3158 }
3159
3160 // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs
3161 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';
3162 function getParentElement(element) {
3163 const assignedSlot = element.assignedSlot;
3164 if (assignedSlot) {
3165 return assignedSlot;
3166 }
3167 if (element.parentElement) {
3168 return element.parentElement;
3169 }
3170 const rootNode = element.getRootNode();
3171 return isShadowRoot(rootNode) ? rootNode.host : null;
3172 }
3173 function getDetailsSummary(details) {
3174 for (const child of Array.from(details.children)) {
3175 if (getNodeName(child) === "summary") {
3176 return child;
3177 }
3178 }
3179 return null;
3180 }
3181 function isWithinOpenDetailsSummary(element, details) {
3182 const summary = getDetailsSummary(details);
3183 return !!summary && (element === summary || contains(summary, element));
3184 }
3185 function isFocusableCandidate(element) {
3186 const nodeName = element ? getNodeName(element) : "";
3187 return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== "summary" || element.parentElement != null && getNodeName(element.parentElement) === "details" && getDetailsSummary(element.parentElement) === element) && (nodeName !== "details" || getDetailsSummary(element) == null) && (nodeName !== "input" || element.type !== "hidden");
3188 }
3189 function isFocusableElement(element) {
3190 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) {
3191 return false;
3192 }
3193 for (let current = element; current; current = getParentElement(current)) {
3194 const isAncestor = current !== element;
3195 const isSlot = getNodeName(current) === "slot";
3196 if (current.hasAttribute("inert")) {
3197 return false;
3198 }
3199 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {
3200 return false;
3201 }
3202 }
3203 return true;
3204 }
3205 function isVisibleInTabbableTree(element, isAncestor) {
3206 const styles = getComputedStyle2(element);
3207 if (!isAncestor) {
3208 return isElementVisible(element, styles);
3209 }
3210 return styles.display !== "none";
3211 }
3212 function getTabIndex(element) {
3213 const tabIndex = element.tabIndex;
3214 if (tabIndex < 0) {
3215 const nodeName = getNodeName(element);
3216 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) {
3217 return 0;
3218 }
3219 }
3220 return tabIndex;
3221 }
3222 function getNamedRadioInput(element) {
3223 if (getNodeName(element) !== "input") {
3224 return null;
3225 }
3226 const input = element;
3227 return input.type === "radio" && input.name !== "" ? input : null;
3228 }
3229 function isTabbableRadio(element, candidates) {
3230 const input = getNamedRadioInput(element);
3231 if (!input) {
3232 return true;
3233 }
3234 const checkedRadio = candidates.find((candidate) => {
3235 const radio = getNamedRadioInput(candidate);
3236 return radio?.name === input.name && radio.form === input.form && radio.checked;
3237 });
3238 if (checkedRadio) {
3239 return checkedRadio === input;
3240 }
3241 return candidates.find((candidate) => {
3242 const radio = getNamedRadioInput(candidate);
3243 return radio?.name === input.name && radio.form === input.form;
3244 }) === input;
3245 }
3246 function getComposedChildren(container) {
3247 if (isHTMLElement(container) && getNodeName(container) === "slot") {
3248 const assignedElements = container.assignedElements({
3249 flatten: true
3250 });
3251 if (assignedElements.length > 0) {
3252 return assignedElements;
3253 }
3254 }
3255 if (isHTMLElement(container) && container.shadowRoot) {
3256 return Array.from(container.shadowRoot.children);
3257 }
3258 return Array.from(container.children);
3259 }
3260 function appendCandidates(container, list) {
3261 getComposedChildren(container).forEach((child) => {
3262 if (isFocusableCandidate(child)) {
3263 list.push(child);
3264 }
3265 appendCandidates(child, list);
3266 });
3267 }
3268 function appendMatchingElements(container, selector, list) {
3269 getComposedChildren(container).forEach((child) => {
3270 if (isHTMLElement(child) && child.matches(selector)) {
3271 list.push(child);
3272 }
3273 appendMatchingElements(child, selector, list);
3274 });
3275 }
3276 function isTabbable(element) {
3277 return isFocusableElement(element) && getTabIndex(element) >= 0;
3278 }
3279 function focusable(container) {
3280 const candidates = [];
3281 appendCandidates(container, candidates);
3282 return candidates.filter(isFocusableElement);
3283 }
3284 function tabbable(container) {
3285 const candidates = focusable(container);
3286 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));
3287 }
3288 function getTabbableIn(container, dir) {
3289 const list = tabbable(container);
3290 const len = list.length;
3291 if (len === 0) {
3292 return void 0;
3293 }
3294 const active = activeElement(ownerDocument(container));
3295 const index2 = list.indexOf(active);
3296 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir;
3297 return list[nextIndex];
3298 }
3299 function getNextTabbable(referenceElement) {
3300 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;
3301 }
3302 function getPreviousTabbable(referenceElement) {
3303 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
3304 }
3305 function isOutsideEvent(event, container) {
3306 const containerElement = container || event.currentTarget;
3307 const relatedTarget = event.relatedTarget;
3308 return !relatedTarget || !contains(containerElement, relatedTarget);
3309 }
3310 function disableFocusInside(container) {
3311 const tabbableElements = tabbable(container);
3312 tabbableElements.forEach((element) => {
3313 element.dataset.tabindex = element.getAttribute("tabindex") || "";
3314 element.setAttribute("tabindex", "-1");
3315 });
3316 }
3317 function enableFocusInside(container) {
3318 const elements = [];
3319 appendMatchingElements(container, "[data-tabindex]", elements);
3320 elements.forEach((element) => {
3321 const tabindex = element.dataset.tabindex;
3322 delete element.dataset.tabindex;
3323 if (tabindex) {
3324 element.setAttribute("tabindex", tabindex);
3325 } else {
3326 element.removeAttribute("tabindex");
3327 }
3328 });
3329 }
3330
3331 // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs
3332 function getNodeChildren(nodes, id, onlyOpenChildren = true) {
3333 const directChildren = nodes.filter((node) => node.parentId === id);
3334 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
3335 }
3336 function getNodeAncestors(nodes, id) {
3337 let allAncestors = [];
3338 let currentParentId = nodes.find((node) => node.id === id)?.parentId;
3339 while (currentParentId) {
3340 const currentNode = nodes.find((node) => node.id === currentParentId);
3341 currentParentId = currentNode?.parentId;
3342 if (currentNode) {
3343 allAncestors = allAncestors.concat(currentNode);
3344 }
3345 }
3346 return allAncestors;
3347 }
3348
3349 // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs
3350 function createAttribute(name) {
3351 return `data-base-ui-${name}`;
3352 }
3353
3354 // node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs
3355 var rafId = 0;
3356 function enqueueFocus(el, options = {}) {
3357 const {
3358 preventScroll = false,
3359 sync = false,
3360 shouldFocus
3361 } = options;
3362 cancelAnimationFrame(rafId);
3363 function exec() {
3364 if (shouldFocus && !shouldFocus()) {
3365 return;
3366 }
3367 el?.focus({
3368 preventScroll
3369 });
3370 }
3371 if (sync) {
3372 exec();
3373 return NOOP;
3374 }
3375 const currentRafId = requestAnimationFrame(exec);
3376 rafId = currentRafId;
3377 return () => {
3378 if (rafId === currentRafId) {
3379 cancelAnimationFrame(currentRafId);
3380 rafId = 0;
3381 }
3382 };
3383 }
3384
3385 // node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs
3386 var counters = {
3387 inert: /* @__PURE__ */ new WeakMap(),
3388 "aria-hidden": /* @__PURE__ */ new WeakMap()
3389 };
3390 var markerName = "data-base-ui-inert";
3391 var uncontrolledElementsSets = {
3392 inert: /* @__PURE__ */ new WeakSet(),
3393 "aria-hidden": /* @__PURE__ */ new WeakSet()
3394 };
3395 var markerCounterMap = /* @__PURE__ */ new WeakMap();
3396 var lockCount = 0;
3397 function getUncontrolledElementsSet(controlAttribute) {
3398 return uncontrolledElementsSets[controlAttribute];
3399 }
3400 function unwrapHost(node) {
3401 if (!node) {
3402 return null;
3403 }
3404 return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode);
3405 }
3406 var correctElements = (parent, targets) => targets.map((target) => {
3407 if (parent.contains(target)) {
3408 return target;
3409 }
3410 const correctedTarget = unwrapHost(target);
3411 if (parent.contains(correctedTarget)) {
3412 return correctedTarget;
3413 }
3414 return null;
3415 }).filter((x) => x != null);
3416 var buildKeepSet = (targets) => {
3417 const keep = /* @__PURE__ */ new Set();
3418 targets.forEach((target) => {
3419 let node = target;
3420 while (node && !keep.has(node)) {
3421 keep.add(node);
3422 node = node.parentNode;
3423 }
3424 });
3425 return keep;
3426 };
3427 var collectOutsideElements = (root2, keepElements, stopElements) => {
3428 const outside = [];
3429 const walk = (parent) => {
3430 if (!parent || stopElements.has(parent)) {
3431 return;
3432 }
3433 Array.from(parent.children).forEach((node) => {
3434 if (getNodeName(node) === "script") {
3435 return;
3436 }
3437 if (keepElements.has(node)) {
3438 walk(node);
3439 } else {
3440 outside.push(node);
3441 }
3442 });
3443 };
3444 walk(root2);
3445 return outside;
3446 };
3447 function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, {
3448 mark = true
3449 }) {
3450 let controlAttribute = null;
3451 if (inert) {
3452 controlAttribute = "inert";
3453 } else if (ariaHidden) {
3454 controlAttribute = "aria-hidden";
3455 }
3456 let counterMap = null;
3457 let uncontrolledElementsSet = null;
3458 const avoidElements = correctElements(body, uncorrectedAvoidElements);
3459 const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];
3460 const hiddenElements = [];
3461 const markedElements = [];
3462 if (controlAttribute) {
3463 const map = counters[controlAttribute];
3464 const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute);
3465 uncontrolledElementsSet = currentUncontrolledElementsSet;
3466 counterMap = map;
3467 const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll("[aria-live]")));
3468 const controlElements = avoidElements.concat(ariaLiveElements);
3469 const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements));
3470 controlTargets.forEach((node) => {
3471 const attr2 = node.getAttribute(controlAttribute);
3472 const alreadyHidden = attr2 !== null && attr2 !== "false";
3473 const counterValue = (map.get(node) || 0) + 1;
3474 map.set(node, counterValue);
3475 hiddenElements.push(node);
3476 if (counterValue === 1 && alreadyHidden) {
3477 currentUncontrolledElementsSet.add(node);
3478 }
3479 if (!alreadyHidden) {
3480 node.setAttribute(controlAttribute, controlAttribute === "inert" ? "" : "true");
3481 }
3482 });
3483 }
3484 if (mark) {
3485 markerTargets.forEach((node) => {
3486 const markerValue = (markerCounterMap.get(node) || 0) + 1;
3487 markerCounterMap.set(node, markerValue);
3488 markedElements.push(node);
3489 if (markerValue === 1) {
3490 node.setAttribute(markerName, "");
3491 }
3492 });
3493 }
3494 lockCount += 1;
3495 return () => {
3496 if (counterMap) {
3497 hiddenElements.forEach((element) => {
3498 const currentCounterValue = counterMap.get(element) || 0;
3499 const counterValue = currentCounterValue - 1;
3500 counterMap.set(element, counterValue);
3501 if (!counterValue) {
3502 if (!uncontrolledElementsSet?.has(element) && controlAttribute) {
3503 element.removeAttribute(controlAttribute);
3504 }
3505 uncontrolledElementsSet?.delete(element);
3506 }
3507 });
3508 }
3509 if (mark) {
3510 markedElements.forEach((element) => {
3511 const markerValue = (markerCounterMap.get(element) || 0) - 1;
3512 markerCounterMap.set(element, markerValue);
3513 if (!markerValue) {
3514 element.removeAttribute(markerName);
3515 }
3516 });
3517 }
3518 lockCount -= 1;
3519 if (!lockCount) {
3520 counters.inert = /* @__PURE__ */ new WeakMap();
3521 counters["aria-hidden"] = /* @__PURE__ */ new WeakMap();
3522 uncontrolledElementsSets.inert = /* @__PURE__ */ new WeakSet();
3523 uncontrolledElementsSets["aria-hidden"] = /* @__PURE__ */ new WeakSet();
3524 markerCounterMap = /* @__PURE__ */ new WeakMap();
3525 }
3526 };
3527 }
3528 function markOthers(avoidElements, options = {}) {
3529 const {
3530 ariaHidden = false,
3531 inert = false,
3532 mark = true
3533 } = options;
3534 const body = ownerDocument(avoidElements[0]).body;
3535 return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, {
3536 mark
3537 });
3538 }
3539
3540 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
3541 var React20 = __toESM(require_react(), 1);
3542 var ReactDOM2 = __toESM(require_react_dom(), 1);
3543
3544 // node_modules/@base-ui/react/internals/constants.mjs
3545 var DISABLED_TRANSITIONS_STYLE = {
3546 style: {
3547 transition: "none"
3548 }
3549 };
3550 var CLICK_TRIGGER_IDENTIFIER = "data-base-ui-click-trigger";
3551 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
3552 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
3553 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
3554 var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
3555 var DROPDOWN_COLLISION_AVOIDANCE = {
3556 fallbackAxisSide: "none"
3557 };
3558 var POPUP_COLLISION_AVOIDANCE = {
3559 fallbackAxisSide: "end"
3560 };
3561 var ownerVisuallyHidden = {
3562 clipPath: "inset(50%)",
3563 position: "fixed",
3564 top: 0,
3565 left: 0
3566 };
3567
3568 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
3569 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
3570 var PortalContext = /* @__PURE__ */ React20.createContext(null);
3571 if (true) PortalContext.displayName = "PortalContext";
3572 var usePortalContext = () => React20.useContext(PortalContext);
3573 var attr = createAttribute("portal");
3574 function useFloatingPortalNode(props = {}) {
3575 const {
3576 ref,
3577 container: containerProp,
3578 componentProps = EMPTY_OBJECT,
3579 elementProps
3580 } = props;
3581 const uniqueId = useId();
3582 const portalContext = usePortalContext();
3583 const parentPortalNode = portalContext?.portalNode;
3584 const [containerElement, setContainerElement] = React20.useState(null);
3585 const [portalNode, setPortalNode] = React20.useState(null);
3586 const setPortalNodeRef = useStableCallback((node) => {
3587 if (node !== null) {
3588 setPortalNode(node);
3589 }
3590 });
3591 const containerRef = React20.useRef(null);
3592 useIsoLayoutEffect(() => {
3593 if (containerProp === null) {
3594 if (containerRef.current) {
3595 containerRef.current = null;
3596 setPortalNode(null);
3597 setContainerElement(null);
3598 }
3599 return;
3600 }
3601 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
3602 if (resolvedContainer == null) {
3603 if (containerRef.current) {
3604 containerRef.current = null;
3605 setPortalNode(null);
3606 setContainerElement(null);
3607 }
3608 return;
3609 }
3610 if (containerRef.current !== resolvedContainer) {
3611 containerRef.current = resolvedContainer;
3612 setPortalNode(null);
3613 setContainerElement(resolvedContainer);
3614 }
3615 }, [containerProp, parentPortalNode]);
3616 const portalElement = useRenderElement("div", componentProps, {
3617 ref: [ref, setPortalNodeRef],
3618 props: [{
3619 id: uniqueId,
3620 [attr]: ""
3621 }, elementProps]
3622 });
3623 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null;
3624 return {
3625 node: portalNode,
3626 // `id` and `render` props can override or remove the generated ID. Use the exact
3627 // rendered value so `aria-owns` never points at an ID absent from the DOM.
3628 nodeId: /* @__PURE__ */ React20.isValidElement(portalElement) ? portalElement.props.id : void 0,
3629 subtree: portalSubtree
3630 };
3631 }
3632 var FloatingPortal = /* @__PURE__ */ React20.forwardRef(function FloatingPortal2(componentProps, forwardedRef) {
3633 const {
3634 render,
3635 className,
3636 style,
3637 children,
3638 container,
3639 ...elementProps
3640 } = componentProps;
3641 const {
3642 node: portalNode,
3643 nodeId: portalNodeId,
3644 subtree: portalSubtree
3645 } = useFloatingPortalNode({
3646 container,
3647 ref: forwardedRef,
3648 componentProps,
3649 elementProps
3650 });
3651 const beforeOutsideRef = React20.useRef(null);
3652 const afterOutsideRef = React20.useRef(null);
3653 const beforeInsideRef = React20.useRef(null);
3654 const afterInsideRef = React20.useRef(null);
3655 const [focusManagerState, setFocusManagerState] = React20.useState(null);
3656 const focusInsideDisabledRef = React20.useRef(false);
3657 const modal = focusManagerState?.modal;
3658 const open = focusManagerState?.open;
3659 const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
3660 React20.useEffect(() => {
3661 if (!portalNode || modal) {
3662 return void 0;
3663 }
3664 function onFocus(event) {
3665 if (portalNode && event.relatedTarget && isOutsideEvent(event)) {
3666 if (event.type === "focusin") {
3667 if (focusInsideDisabledRef.current) {
3668 enableFocusInside(portalNode);
3669 focusInsideDisabledRef.current = false;
3670 }
3671 } else {
3672 disableFocusInside(portalNode);
3673 focusInsideDisabledRef.current = true;
3674 }
3675 }
3676 }
3677 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true));
3678 }, [portalNode, modal]);
3679 useIsoLayoutEffect(() => {
3680 if (!portalNode || open !== true || !focusInsideDisabledRef.current) {
3681 return;
3682 }
3683 enableFocusInside(portalNode);
3684 focusInsideDisabledRef.current = false;
3685 }, [open, portalNode]);
3686 const portalContextValue = React20.useMemo(() => ({
3687 beforeOutsideRef,
3688 afterOutsideRef,
3689 beforeInsideRef,
3690 afterInsideRef,
3691 portalNode,
3692 setFocusManagerState
3693 }), [portalNode]);
3694 return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(React20.Fragment, {
3695 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(PortalContext.Provider, {
3696 value: portalContextValue,
3697 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FocusGuard, {
3698 "data-type": "outside",
3699 ref: beforeOutsideRef,
3700 onFocus: (event) => {
3701 if (isOutsideEvent(event, portalNode)) {
3702 beforeInsideRef.current?.focus();
3703 } else {
3704 const domReference = focusManagerState ? focusManagerState.domReference : null;
3705 const prevTabbable = getPreviousTabbable(domReference);
3706 prevTabbable?.focus();
3707 }
3708 }
3709 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", {
3710 "aria-owns": portalNodeId,
3711 style: ownerVisuallyHidden
3712 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FocusGuard, {
3713 "data-type": "outside",
3714 ref: afterOutsideRef,
3715 onFocus: (event) => {
3716 if (isOutsideEvent(event, portalNode)) {
3717 afterInsideRef.current?.focus();
3718 } else {
3719 const domReference = focusManagerState ? focusManagerState.domReference : null;
3720 const nextTabbable = getNextTabbable(domReference);
3721 nextTabbable?.focus();
3722 if (focusManagerState?.closeOnFocusOut) {
3723 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent));
3724 }
3725 }
3726 }
3727 })]
3728 })]
3729 });
3730 });
3731 if (true) FloatingPortal.displayName = "FloatingPortal";
3732
3733 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3734 var React21 = __toESM(require_react(), 1);
3735
3736 // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs
3737 function createEventEmitter() {
3738 const map = /* @__PURE__ */ new Map();
3739 return {
3740 emit(event, data) {
3741 map.get(event)?.forEach((listener) => listener(data));
3742 },
3743 on(event, listener) {
3744 if (!map.has(event)) {
3745 map.set(event, /* @__PURE__ */ new Set());
3746 }
3747 map.get(event).add(listener);
3748 },
3749 off(event, listener) {
3750 map.get(event)?.delete(listener);
3751 }
3752 };
3753 }
3754
3755 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3756 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
3757 var FloatingNodeContext = /* @__PURE__ */ React21.createContext(null);
3758 if (true) FloatingNodeContext.displayName = "FloatingNodeContext";
3759 var FloatingTreeContext = /* @__PURE__ */ React21.createContext(null);
3760 if (true) FloatingTreeContext.displayName = "FloatingTreeContext";
3761 var useFloatingParentNodeId = () => React21.useContext(FloatingNodeContext)?.id || null;
3762 var useFloatingTree = (externalTree) => {
3763 const contextTree = React21.useContext(FloatingTreeContext);
3764 return externalTree ?? contextTree;
3765 };
3766
3767 // node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs
3768 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
3769 function getEventType(event, lastInteractionType) {
3770 const win = getWindow(getTarget(event));
3771 if (event instanceof win.KeyboardEvent) {
3772 return "keyboard";
3773 }
3774 if (event instanceof win.FocusEvent) {
3775 return lastInteractionType || "keyboard";
3776 }
3777 if ("pointerType" in event) {
3778 return event.pointerType || "keyboard";
3779 }
3780 if ("touches" in event) {
3781 return "touch";
3782 }
3783 if (event instanceof win.MouseEvent) {
3784 return lastInteractionType || (event.detail === 0 ? "keyboard" : "mouse");
3785 }
3786 return "";
3787 }
3788 var LIST_LIMIT = 20;
3789 var previouslyFocusedElements = [];
3790 function clearDisconnectedPreviouslyFocusedElements() {
3791 previouslyFocusedElements = previouslyFocusedElements.filter((entry) => {
3792 return entry.deref()?.isConnected;
3793 });
3794 }
3795 function addPreviouslyFocusedElement(element) {
3796 clearDisconnectedPreviouslyFocusedElements();
3797 if (element && getNodeName(element) !== "body") {
3798 previouslyFocusedElements.push(new WeakRef(element));
3799 if (previouslyFocusedElements.length > LIST_LIMIT) {
3800 previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT);
3801 }
3802 }
3803 }
3804 function getPreviouslyFocusedElement() {
3805 clearDisconnectedPreviouslyFocusedElements();
3806 return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref();
3807 }
3808 function getFirstTabbableElement(container) {
3809 if (!container) {
3810 return null;
3811 }
3812 if (isTabbable(container)) {
3813 return container;
3814 }
3815 return tabbable(container)[0] || container;
3816 }
3817 function handleTabIndex(floatingFocusElement) {
3818 if (floatingFocusElement.hasAttribute("tabindex") && !floatingFocusElement.hasAttribute("data-tabindex")) {
3819 return;
3820 }
3821 if (!floatingFocusElement.getAttribute("role")?.includes("dialog")) {
3822 return;
3823 }
3824 const focusableElements = focusable(floatingFocusElement);
3825 const tabbableContent = focusableElements.filter((element) => {
3826 const dataTabIndex = element.getAttribute("data-tabindex") || "";
3827 return isTabbable(element) || element.hasAttribute("data-tabindex") && !dataTabIndex.startsWith("-");
3828 });
3829 const tabIndex = floatingFocusElement.getAttribute("tabindex");
3830 if (tabbableContent.length === 0) {
3831 if (tabIndex !== "0") {
3832 floatingFocusElement.setAttribute("tabindex", "0");
3833 floatingFocusElement.setAttribute("data-tabindex", "0");
3834 }
3835 } else if (tabIndex !== "-1" || floatingFocusElement.hasAttribute("data-tabindex") && floatingFocusElement.getAttribute("data-tabindex") !== "-1") {
3836 floatingFocusElement.setAttribute("tabindex", "-1");
3837 floatingFocusElement.setAttribute("data-tabindex", "-1");
3838 }
3839 }
3840 function FloatingFocusManager(props) {
3841 const {
3842 context,
3843 children,
3844 disabled: disabled2 = false,
3845 initialFocus = true,
3846 returnFocus = true,
3847 restoreFocus = false,
3848 modal = true,
3849 closeOnFocusOut = true,
3850 openInteractionType = "",
3851 nextFocusableElement,
3852 previousFocusableElement,
3853 beforeContentFocusGuardRef,
3854 externalTree,
3855 getInsideElements
3856 } = props;
3857 const store = "rootStore" in context ? context.rootStore : context;
3858 const open = store.useState("open");
3859 const domReference = store.useState("domReferenceElement");
3860 const floating = store.useState("floatingElement");
3861 const {
3862 events,
3863 dataRef
3864 } = store.context;
3865 const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId);
3866 const ignoreInitialFocus = initialFocus === false;
3867 const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;
3868 const initialFocusRef = useValueAsRef(initialFocus);
3869 const returnFocusRef = useValueAsRef(returnFocus);
3870 const openInteractionTypeRef = useValueAsRef(openInteractionType);
3871 const openRef = useValueAsRef(open);
3872 const tree = useFloatingTree(externalTree);
3873 const portalContext = usePortalContext();
3874 const preventReturnFocusRef = React22.useRef(false);
3875 const isPointerDownRef = React22.useRef(false);
3876 const pointerDownOutsideRef = React22.useRef(false);
3877 const lastFocusedTabbableRef = React22.useRef(null);
3878 const closeTypeRef = React22.useRef("");
3879 const lastInteractionTypeRef = React22.useRef("");
3880 const beforeGuardRef = React22.useRef(null);
3881 const afterGuardRef = React22.useRef(null);
3882 const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef);
3883 const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef);
3884 const blurTimeout = useTimeout();
3885 const pointerDownTimeout = useTimeout();
3886 const restoreFocusFrame = useAnimationFrame();
3887 const isInsidePortal = portalContext != null;
3888 const floatingFocusElement = getFloatingFocusElement(floating);
3889 const getTabbableContent = useStableCallback((container = floatingFocusElement) => {
3890 return container ? tabbable(container) : [];
3891 });
3892 const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter((element) => element != null) ?? []);
3893 React22.useEffect(() => {
3894 if (disabled2 || !modal) {
3895 return void 0;
3896 }
3897 function onKeyDown(event) {
3898 if (event.key === "Tab") {
3899 if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) {
3900 stopEvent(event);
3901 }
3902 }
3903 }
3904 const doc = ownerDocument(floatingFocusElement);
3905 return addEventListener(doc, "keydown", onKeyDown);
3906 }, [disabled2, floatingFocusElement, modal, isUntrappedTypeableCombobox, getTabbableContent]);
3907 React22.useEffect(() => {
3908 if (disabled2 || !open) {
3909 return void 0;
3910 }
3911 const doc = ownerDocument(floatingFocusElement);
3912 function clearPointerDownOutside() {
3913 pointerDownOutsideRef.current = false;
3914 }
3915 function onPointerDown(event) {
3916 const target = getTarget(event);
3917 const insideElements = getResolvedInsideElements();
3918 const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some((element) => element === target || contains(element, target));
3919 pointerDownOutsideRef.current = !pointerTargetInside;
3920 lastInteractionTypeRef.current = event.pointerType || "keyboard";
3921 if (target?.closest(`[${CLICK_TRIGGER_IDENTIFIER}]`)) {
3922 isPointerDownRef.current = true;
3923 pointerDownTimeout.start(0, () => {
3924 isPointerDownRef.current = false;
3925 });
3926 }
3927 }
3928 function onKeyDown() {
3929 lastInteractionTypeRef.current = "keyboard";
3930 }
3931 return mergeCleanups(
3932 addEventListener(doc, "pointerdown", onPointerDown, true),
3933 addEventListener(doc, "pointerup", clearPointerDownOutside, true),
3934 addEventListener(doc, "pointercancel", clearPointerDownOutside, true),
3935 addEventListener(doc, "keydown", onKeyDown, true),
3936 // Avoid a stale `true` leaking into the next open (e.g. keep-mounted popups)
3937 // if the popup dismissed between pointerdown and pointerup.
3938 clearPointerDownOutside
3939 );
3940 }, [disabled2, floating, domReference, floatingFocusElement, open, portalContext, pointerDownTimeout, getResolvedInsideElements]);
3941 React22.useEffect(() => {
3942 if (disabled2 || !closeOnFocusOut) {
3943 return void 0;
3944 }
3945 const doc = ownerDocument(floatingFocusElement);
3946 function handlePointerDown() {
3947 isPointerDownRef.current = true;
3948 pointerDownTimeout.start(0, () => {
3949 isPointerDownRef.current = false;
3950 });
3951 }
3952 function handleFocusIn(event) {
3953 const target = getTarget(event);
3954 if (isTabbable(target)) {
3955 lastFocusedTabbableRef.current = target;
3956 }
3957 }
3958 function handleFocusOutside(event) {
3959 const relatedTarget = event.relatedTarget;
3960 const currentTarget = event.currentTarget;
3961 const target = getTarget(event);
3962 if (modal && relatedTarget == null && target != null && contains(floating, target)) {
3963 addPreviouslyFocusedElement(target);
3964 }
3965 queueMicrotask(() => {
3966 const nodeId = getNodeId();
3967 const triggers = store.context.triggerElements;
3968 const insideElements = getResolvedInsideElements();
3969 const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute("focus-guard")) && [beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeInsideRef.current, portalContext?.afterInsideRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement)].includes(relatedTarget);
3970 const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some((element) => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement((trigger) => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find((node) => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find((node) => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));
3971 if (currentTarget === domReference && floatingFocusElement) {
3972 handleTabIndex(floatingFocusElement);
3973 }
3974 if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) {
3975 if (isHTMLElement(floatingFocusElement)) {
3976 floatingFocusElement.focus();
3977 if (restoreFocus === "popup") {
3978 restoreFocusFrame.request(() => {
3979 floatingFocusElement.focus();
3980 });
3981 return;
3982 }
3983 }
3984 const tabbableContent = getTabbableContent();
3985 const prevTabbable = lastFocusedTabbableRef.current;
3986 const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;
3987 if (isHTMLElement(nodeToFocus)) {
3988 nodeToFocus.focus();
3989 }
3990 }
3991 if (dataRef.current.insideReactTree) {
3992 dataRef.current.insideReactTree = false;
3993 return;
3994 }
3995 if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
3996 // For an "untrapped" typeable combobox (input role=combobox with
3997 // initialFocus=false), re-opening the popup and tabbing out should still close it even
3998 // when the previously focused element (e.g. the next tabbable outside the popup) is
3999 // focused again. Otherwise, the popup remains open on the second Tab sequence:
4000 // click input -> Tab (closes) -> click input -> Tab.
4001 // Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element.
4002 (isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) {
4003 preventReturnFocusRef.current = true;
4004 store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event));
4005 }
4006 });
4007 }
4008 function markInsideReactTree() {
4009 if (pointerDownOutsideRef.current) {
4010 return;
4011 }
4012 dataRef.current.insideReactTree = true;
4013 blurTimeout.start(0, () => {
4014 dataRef.current.insideReactTree = false;
4015 });
4016 }
4017 const domReferenceElement = isHTMLElement(domReference) ? domReference : null;
4018 if (!floating && !domReferenceElement) {
4019 return void 0;
4020 }
4021 return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, "focusout", handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, "pointerdown", handlePointerDown), floating && addEventListener(floating, "focusin", handleFocusIn), floating && addEventListener(floating, "focusout", handleFocusOutside), floating && portalContext && addEventListener(floating, "focusout", markInsideReactTree, true));
4022 }, [disabled2, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);
4023 React22.useEffect(() => {
4024 if (disabled2 || !floating || !open) {
4025 return void 0;
4026 }
4027 const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute("portal")}]`) || []);
4028 const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : [];
4029 const rootAncestorComboboxDomReference = ancestors.find((node) => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference;
4030 const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()];
4031 const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter((x) => x != null);
4032 const ariaHiddenCleanup = markOthers(insideElements, {
4033 ariaHidden: modal || isUntrappedTypeableCombobox,
4034 mark: false
4035 });
4036 const markerInsideElements = [floating, ...portalNodes].filter((x) => x != null);
4037 const markerCleanup = markOthers(markerInsideElements);
4038 return () => {
4039 markerCleanup();
4040 ariaHiddenCleanup();
4041 };
4042 }, [open, disabled2, domReference, floating, modal, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);
4043 useIsoLayoutEffect(() => {
4044 if (!open || disabled2 || !isHTMLElement(floatingFocusElement)) {
4045 return;
4046 }
4047 closeTypeRef.current = "";
4048 lastInteractionTypeRef.current = "";
4049 const doc = ownerDocument(floatingFocusElement);
4050 const previouslyFocusedElement = activeElement(doc);
4051 queueMicrotask(() => {
4052 const initialFocusValueOrFn = initialFocusRef.current;
4053 const resolvedInitialFocus = typeof initialFocusValueOrFn === "function" ? initialFocusValueOrFn(openInteractionTypeRef.current || "") : initialFocusValueOrFn;
4054 if (resolvedInitialFocus === void 0 || resolvedInitialFocus === false) {
4055 return;
4056 }
4057 const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement);
4058 if (focusAlreadyInsideFloatingEl) {
4059 return;
4060 }
4061 let focusableElements = null;
4062 const getDefaultFocusElement = () => {
4063 if (focusableElements == null) {
4064 focusableElements = getTabbableContent(floatingFocusElement);
4065 }
4066 return focusableElements[0] || floatingFocusElement;
4067 };
4068 let elToFocus;
4069 if (resolvedInitialFocus === true || resolvedInitialFocus === null) {
4070 elToFocus = getDefaultFocusElement();
4071 } else {
4072 elToFocus = resolveRef(resolvedInitialFocus);
4073 }
4074 elToFocus = elToFocus || getDefaultFocusElement();
4075 const hadFocusInside = contains(floatingFocusElement, activeElement(doc));
4076 void enqueueFocus(elToFocus, {
4077 preventScroll: elToFocus === floatingFocusElement,
4078 shouldFocus() {
4079 if (!openRef.current) {
4080 return false;
4081 }
4082 if (hadFocusInside) {
4083 return true;
4084 }
4085 const currentActiveElement = activeElement(doc);
4086 const focusMovedInside = currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement);
4087 return !focusMovedInside;
4088 }
4089 });
4090 });
4091 }, [disabled2, open, floatingFocusElement, getTabbableContent, initialFocusRef, openInteractionTypeRef, openRef]);
4092 useIsoLayoutEffect(() => {
4093 if (disabled2 || !floatingFocusElement) {
4094 return void 0;
4095 }
4096 const doc = ownerDocument(floatingFocusElement);
4097 const elementFocusedBeforeOpen = activeElement(doc);
4098 const preferPreviousFocus = openInteractionTypeRef.current == null;
4099 addPreviouslyFocusedElement(elementFocusedBeforeOpen);
4100 function onOpenChangeLocal(details) {
4101 if (!details.open) {
4102 closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current);
4103 }
4104 if (details.reason === reason_parts_exports.triggerHover && details.nativeEvent.type === "mouseleave") {
4105 preventReturnFocusRef.current = true;
4106 }
4107 if (details.reason !== reason_parts_exports.outsidePress) {
4108 return;
4109 }
4110 if (details.nested) {
4111 preventReturnFocusRef.current = false;
4112 } else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) {
4113 preventReturnFocusRef.current = false;
4114 } else {
4115 let isPreventScrollSupported = false;
4116 ownerDocument(floatingFocusElement).createElement("div").focus({
4117 get preventScroll() {
4118 isPreventScrollSupported = true;
4119 return false;
4120 }
4121 });
4122 if (isPreventScrollSupported) {
4123 preventReturnFocusRef.current = false;
4124 } else {
4125 preventReturnFocusRef.current = true;
4126 }
4127 }
4128 }
4129 events.on("openchange", onOpenChangeLocal);
4130 function getReturnElement(closeType) {
4131 const returnFocusValueOrFn = returnFocusRef.current;
4132 let resolvedReturnFocusValue = typeof returnFocusValueOrFn === "function" ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn;
4133 if (resolvedReturnFocusValue === void 0 || resolvedReturnFocusValue === false) {
4134 return null;
4135 }
4136 if (resolvedReturnFocusValue === null) {
4137 resolvedReturnFocusValue = true;
4138 }
4139 const referenceReturnElement = domReference?.isConnected ? domReference : null;
4140 const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== "body" ? elementFocusedBeforeOpen : null;
4141 let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement;
4142 if (!defaultReturnElement) {
4143 defaultReturnElement = getPreviouslyFocusedElement() || null;
4144 }
4145 if (typeof resolvedReturnFocusValue === "boolean") {
4146 return defaultReturnElement;
4147 }
4148 return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null;
4149 }
4150 return () => {
4151 events.off("openchange", onOpenChangeLocal);
4152 const activeEl = activeElement(doc);
4153 const insideElements = getResolvedInsideElements();
4154 const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some((element) => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some((node) => contains(node.context?.elements.floating, activeEl));
4155 const returnFocusValueOrFn = returnFocusRef.current;
4156 const closeType = closeTypeRef.current;
4157 const returnElement = getReturnElement(closeType);
4158 queueMicrotask(() => {
4159 const tabbableReturnElement = getFirstTabbableElement(returnElement);
4160 const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== "boolean";
4161 if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && // If the focus moved somewhere else after mount, avoid returning focus
4162 // since it likely entered a different element which should be
4163 // respected: https://github.com/floating-ui/floating-ui/issues/2607
4164 (!hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {
4165 const focusOptions = {
4166 preventScroll: true
4167 };
4168 if (closeType === "keyboard") {
4169 focusOptions.focusVisible = true;
4170 }
4171 tabbableReturnElement.focus(focusOptions);
4172 }
4173 preventReturnFocusRef.current = false;
4174 });
4175 };
4176 }, [disabled2, floating, floatingFocusElement, returnFocusRef, openInteractionTypeRef, events, tree, domReference, getNodeId, getResolvedInsideElements]);
4177 useIsoLayoutEffect(() => {
4178 if (!parts_exports.engine.webkit || open || !floating) {
4179 return;
4180 }
4181 const activeEl = activeElement(ownerDocument(floating));
4182 if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) {
4183 return;
4184 }
4185 if (contains(floating, activeEl)) {
4186 activeEl.blur();
4187 }
4188 }, [open, floating]);
4189 useIsoLayoutEffect(() => {
4190 if (disabled2 || !portalContext) {
4191 return void 0;
4192 }
4193 portalContext.setFocusManagerState({
4194 modal,
4195 closeOnFocusOut,
4196 open,
4197 onOpenChange: store.setOpen,
4198 domReference
4199 });
4200 return () => {
4201 portalContext.setFocusManagerState(null);
4202 };
4203 }, [disabled2, portalContext, modal, open, store, closeOnFocusOut, domReference]);
4204 useIsoLayoutEffect(() => {
4205 if (disabled2 || !floatingFocusElement) {
4206 return void 0;
4207 }
4208 handleTabIndex(floatingFocusElement);
4209 return () => {
4210 queueMicrotask(clearDisconnectedPreviouslyFocusedElements);
4211 };
4212 }, [disabled2, floatingFocusElement]);
4213 const shouldRenderGuards = !disabled2 && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);
4214 return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React22.Fragment, {
4215 children: [shouldRenderGuards && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FocusGuard, {
4216 "data-type": "inside",
4217 ref: mergedBeforeGuardRef,
4218 onFocus: (event) => {
4219 if (modal) {
4220 const els = getTabbableContent();
4221 void enqueueFocus(els[els.length - 1]);
4222 } else if (portalContext?.portalNode) {
4223 preventReturnFocusRef.current = false;
4224 if (isOutsideEvent(event, portalContext.portalNode)) {
4225 const nextTabbable = getNextTabbable(domReference);
4226 nextTabbable?.focus();
4227 } else {
4228 resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus();
4229 }
4230 }
4231 }
4232 }), children, shouldRenderGuards && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FocusGuard, {
4233 "data-type": "inside",
4234 ref: mergedAfterGuardRef,
4235 onFocus: (event) => {
4236 if (modal) {
4237 void enqueueFocus(getTabbableContent()[0]);
4238 } else if (portalContext?.portalNode) {
4239 if (closeOnFocusOut) {
4240 preventReturnFocusRef.current = true;
4241 }
4242 if (isOutsideEvent(event, portalContext.portalNode)) {
4243 const prevTabbable = getPreviousTabbable(domReference);
4244 prevTabbable?.focus();
4245 } else {
4246 resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus();
4247 }
4248 }
4249 }
4250 })]
4251 });
4252 }
4253
4254 // node_modules/@base-ui/react/floating-ui-react/hooks/useClick.mjs
4255 var React23 = __toESM(require_react(), 1);
4256 function useClick(context, props = {}) {
4257 const {
4258 enabled = true,
4259 event: eventOption = "click",
4260 toggle = true,
4261 ignoreMouse = false,
4262 stickIfOpen = true,
4263 touchOpenDelay = 0,
4264 reason = reason_parts_exports.triggerPress
4265 } = props;
4266 const store = "rootStore" in context ? context.rootStore : context;
4267 const dataRef = store.context.dataRef;
4268 const pointerTypeRef = React23.useRef(void 0);
4269 const frame = useAnimationFrame();
4270 const touchOpenTimeout = useTimeout();
4271 const reference = React23.useMemo(() => {
4272 function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) {
4273 const details = createChangeEventDetails(reason, nativeEvent, target);
4274 if (nextOpen && pointerType === "touch" && touchOpenDelay > 0) {
4275 touchOpenTimeout.start(touchOpenDelay, () => {
4276 store.setOpen(true, details);
4277 });
4278 } else {
4279 store.setOpen(nextOpen, details);
4280 }
4281 }
4282 function getNextOpen(open, currentTarget, isClickLikeOpenEvent2) {
4283 const openEvent = dataRef.current.openEvent;
4284 const hasClickedOnInactiveTrigger = store.select("domReferenceElement") !== currentTarget;
4285 if (open && hasClickedOnInactiveTrigger) {
4286 return true;
4287 }
4288 if (!open) {
4289 return true;
4290 }
4291 if (!toggle) {
4292 return true;
4293 }
4294 if (openEvent && stickIfOpen) {
4295 return !isClickLikeOpenEvent2(openEvent.type);
4296 }
4297 return false;
4298 }
4299 return {
4300 onPointerDown(event) {
4301 pointerTypeRef.current = isMouseLikePointerType(event.pointerType, true) && isVirtualPointerEvent(event.nativeEvent) ? "virtual" : event.pointerType;
4302 },
4303 onMouseDown(event) {
4304 const pointerType = pointerTypeRef.current;
4305 const nativeEvent = event.nativeEvent;
4306 const open = store.select("open");
4307 if (event.button !== 0 || eventOption === "click" || isMouseLikePointerType(pointerType, true) && ignoreMouse) {
4308 return;
4309 }
4310 const nextOpen = getNextOpen(open, event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown");
4311 const target = getTarget(nativeEvent);
4312 if (isTypeableElement(target)) {
4313 setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType);
4314 return;
4315 }
4316 const eventCurrentTarget = event.currentTarget;
4317 frame.request(() => {
4318 setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType);
4319 });
4320 },
4321 onClick(event) {
4322 if (eventOption === "mousedown-only") {
4323 return;
4324 }
4325 const pointerType = pointerTypeRef.current;
4326 if (eventOption === "mousedown" && pointerType) {
4327 pointerTypeRef.current = void 0;
4328 return;
4329 }
4330 if (isMouseLikePointerType(pointerType, true) && ignoreMouse) {
4331 return;
4332 }
4333 const open = store.select("open");
4334 const nextOpen = getNextOpen(open, event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown" || openEventType === "keydown" || openEventType === "keyup");
4335 setOpenWithTouchDelay(nextOpen, event.nativeEvent, event.currentTarget, pointerType);
4336 },
4337 onKeyDown() {
4338 pointerTypeRef.current = void 0;
4339 }
4340 };
4341 }, [dataRef, eventOption, ignoreMouse, reason, store, stickIfOpen, toggle, frame, touchOpenTimeout, touchOpenDelay]);
4342 return React23.useMemo(() => enabled ? {
4343 reference
4344 } : EMPTY_OBJECT, [enabled, reference]);
4345 }
4346
4347 // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs
4348 var React24 = __toESM(require_react(), 1);
4349 function createVirtualElement(domElement, data) {
4350 let offsetX = null;
4351 let offsetY = null;
4352 let isAutoUpdateEvent = false;
4353 return {
4354 contextElement: domElement || void 0,
4355 getBoundingClientRect() {
4356 const domRect = domElement?.getBoundingClientRect() || {
4357 width: 0,
4358 height: 0,
4359 x: 0,
4360 y: 0
4361 };
4362 const isXAxis = data.axis === "x" || data.axis === "both";
4363 const isYAxis = data.axis === "y" || data.axis === "both";
4364 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch";
4365 let width = domRect.width;
4366 let height = domRect.height;
4367 let x = domRect.x;
4368 let y = domRect.y;
4369 if (offsetX == null && data.x && isXAxis) {
4370 offsetX = domRect.x - data.x;
4371 }
4372 if (offsetY == null && data.y && isYAxis) {
4373 offsetY = domRect.y - data.y;
4374 }
4375 x -= offsetX || 0;
4376 y -= offsetY || 0;
4377 width = 0;
4378 height = 0;
4379 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
4380 width = data.axis === "y" ? domRect.width : 0;
4381 height = data.axis === "x" ? domRect.height : 0;
4382 x = isXAxis && data.x != null ? data.x : x;
4383 y = isYAxis && data.y != null ? data.y : y;
4384 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
4385 height = data.axis === "x" ? domRect.height : height;
4386 width = data.axis === "y" ? domRect.width : width;
4387 }
4388 isAutoUpdateEvent = true;
4389 return {
4390 width,
4391 height,
4392 x,
4393 y,
4394 top: y,
4395 right: x + width,
4396 bottom: y + height,
4397 left: x
4398 };
4399 }
4400 };
4401 }
4402 function isMouseBasedEvent(event) {
4403 return event != null && event.clientX != null;
4404 }
4405 function useClientPoint(context, props = {}) {
4406 const {
4407 enabled = true,
4408 axis = "both"
4409 } = props;
4410 const store = "rootStore" in context ? context.rootStore : context;
4411 const open = store.useState("open");
4412 const floating = store.useState("floatingElement");
4413 const domReference = store.useState("domReferenceElement");
4414 const dataRef = store.context.dataRef;
4415 const initialRef = React24.useRef(false);
4416 const cleanupListenerRef = React24.useRef(null);
4417 const [pointerType, setPointerType] = React24.useState();
4418 const [reactive, setReactive] = React24.useState([]);
4419 const resetReference = useStableCallback((reference2) => {
4420 store.set("positionReference", reference2);
4421 });
4422 const setReference = useStableCallback((newX, newY, referenceElement) => {
4423 if (initialRef.current) {
4424 return;
4425 }
4426 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {
4427 return;
4428 }
4429 store.set("positionReference", createVirtualElement(referenceElement ?? domReference, {
4430 x: newX,
4431 y: newY,
4432 axis,
4433 dataRef,
4434 pointerType
4435 }));
4436 });
4437 const handleReferenceEnterOrMove = useStableCallback((event) => {
4438 if (!open) {
4439 setReference(event.clientX, event.clientY, event.currentTarget);
4440 } else if (!cleanupListenerRef.current) {
4441 setReference(event.clientX, event.clientY, event.currentTarget);
4442 setReactive([]);
4443 }
4444 });
4445 const openCheck = isMouseLikePointerType(pointerType) ? floating : open;
4446 React24.useEffect(() => {
4447 if (!enabled) {
4448 resetReference(domReference);
4449 return void 0;
4450 }
4451 if (!openCheck) {
4452 return void 0;
4453 }
4454 function cleanupListener() {
4455 cleanupListenerRef.current?.();
4456 cleanupListenerRef.current = null;
4457 }
4458 const win = getWindow(floating);
4459 function handleMouseMove(event) {
4460 const target = getTarget(event);
4461 if (!contains(floating, target)) {
4462 setReference(event.clientX, event.clientY);
4463 } else {
4464 cleanupListener();
4465 }
4466 }
4467 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {
4468 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove);
4469 } else {
4470 resetReference(domReference);
4471 }
4472 return cleanupListener;
4473 }, [openCheck, enabled, floating, dataRef, domReference, store, setReference, resetReference, reactive]);
4474 React24.useEffect(() => () => {
4475 store.set("positionReference", null);
4476 }, [store]);
4477 React24.useEffect(() => {
4478 if (enabled && !floating) {
4479 initialRef.current = false;
4480 }
4481 }, [enabled, floating]);
4482 React24.useEffect(() => {
4483 if (!enabled && open) {
4484 initialRef.current = true;
4485 }
4486 }, [enabled, open]);
4487 const reference = React24.useMemo(() => {
4488 function setPointerTypeRef(event) {
4489 setPointerType(event.pointerType);
4490 }
4491 return {
4492 onPointerDown: setPointerTypeRef,
4493 onPointerEnter: setPointerTypeRef,
4494 onMouseMove: handleReferenceEnterOrMove,
4495 onMouseEnter: handleReferenceEnterOrMove
4496 };
4497 }, [handleReferenceEnterOrMove]);
4498 return React24.useMemo(() => enabled ? {
4499 reference,
4500 trigger: reference
4501 } : {}, [enabled, reference]);
4502 }
4503
4504 // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs
4505 var React25 = __toESM(require_react(), 1);
4506 function alwaysFalse() {
4507 return false;
4508 }
4509 function normalizeProp(normalizable) {
4510 return {
4511 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false,
4512 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true
4513 };
4514 }
4515 function useDismiss(context, props = {}) {
4516 const {
4517 enabled = true,
4518 escapeKey: escapeKey2 = true,
4519 outsidePress: outsidePressProp = true,
4520 outsidePressEvent = "sloppy",
4521 referencePress = alwaysFalse,
4522 bubbles,
4523 externalTree
4524 } = props;
4525 const store = "rootStore" in context ? context.rootStore : context;
4526 const open = store.useState("open");
4527 const floatingElement = store.useState("floatingElement");
4528 const {
4529 dataRef
4530 } = store.context;
4531 const tree = useFloatingTree(externalTree);
4532 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false);
4533 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp;
4534 const outsidePressEnabled = outsidePress2 !== false;
4535 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);
4536 const {
4537 escapeKey: escapeKeyBubbles,
4538 outsidePress: outsidePressBubbles
4539 } = normalizeProp(bubbles);
4540 const pressStartedInsideRef = React25.useRef(false);
4541 const pressStartPreventedRef = React25.useRef(false);
4542 const suppressNextOutsideClickRef = React25.useRef(false);
4543 const isComposingRef = React25.useRef(false);
4544 const currentPointerTypeRef = React25.useRef("");
4545 const touchStateRef = React25.useRef(null);
4546 const cancelDismissOnEndTimeout = useTimeout();
4547 const clearInsideReactTreeTimeout = useTimeout();
4548 const clearInsideReactTree = useStableCallback(() => {
4549 clearInsideReactTreeTimeout.clear();
4550 dataRef.current.insideReactTree = false;
4551 });
4552 const hasBlockingChild = useStableCallback((bubbleKey) => {
4553 const nodeId = dataRef.current.floatingContext?.nodeId;
4554 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
4555 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]);
4556 });
4557 const isEventWithinOwnElements = useStableCallback((event) => {
4558 return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"));
4559 });
4560 const closeOnReferencePress = useStableCallback((event) => {
4561 if (!referencePress()) {
4562 return;
4563 }
4564 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
4565 });
4566 const closeOnEscapeKeyDown = useStableCallback((event) => {
4567 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") {
4568 return;
4569 }
4570 if (isComposingRef.current) {
4571 return;
4572 }
4573 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) {
4574 return;
4575 }
4576 const native = isReactEvent(event) ? event.nativeEvent : event;
4577 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native);
4578 store.setOpen(false, eventDetails);
4579 if (!eventDetails.isCanceled) {
4580 event.preventDefault();
4581 }
4582 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {
4583 event.stopPropagation();
4584 }
4585 });
4586 const markInsideReactTree = useStableCallback(() => {
4587 dataRef.current.insideReactTree = true;
4588 clearInsideReactTreeTimeout.start(0, clearInsideReactTree);
4589 });
4590 const markPressStartedInsideReactTree = useStableCallback((event) => {
4591 if (!open || !enabled || event.button !== 0) {
4592 return;
4593 }
4594 const target = getTarget(event.nativeEvent);
4595 if (!contains(store.select("floatingElement"), target)) {
4596 return;
4597 }
4598 if (!pressStartedInsideRef.current) {
4599 pressStartedInsideRef.current = true;
4600 pressStartPreventedRef.current = false;
4601 }
4602 });
4603 const markInsidePressStartPrevented = useStableCallback((event) => {
4604 if (!open || !enabled) {
4605 return;
4606 }
4607 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {
4608 return;
4609 }
4610 if (pressStartedInsideRef.current) {
4611 pressStartPreventedRef.current = true;
4612 }
4613 });
4614 React25.useEffect(() => {
4615 if (!open || !enabled) {
4616 return clearInsideReactTree;
4617 }
4618 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
4619 dataRef.current.__outsidePressBubbles = outsidePressBubbles;
4620 const compositionTimeout = new Timeout();
4621 const preventedPressSuppressionTimeout = new Timeout();
4622 function handleCompositionStart() {
4623 compositionTimeout.clear();
4624 isComposingRef.current = true;
4625 }
4626 function handleCompositionEnd() {
4627 compositionTimeout.start(
4628 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
4629 // Only apply to WebKit for the test to remain 0ms.
4630 parts_exports.engine.webkit ? 5 : 0,
4631 () => {
4632 isComposingRef.current = false;
4633 }
4634 );
4635 }
4636 function suppressImmediateOutsideClickAfterPreventedStart() {
4637 suppressNextOutsideClickRef.current = true;
4638 preventedPressSuppressionTimeout.start(0, () => {
4639 suppressNextOutsideClickRef.current = false;
4640 });
4641 }
4642 function resetPressStartState() {
4643 pressStartedInsideRef.current = false;
4644 pressStartPreventedRef.current = false;
4645 }
4646 function getOutsidePressEvent() {
4647 const type = currentPointerTypeRef.current;
4648 const computedType = type === "pen" || !type ? "mouse" : type;
4649 const outsidePressEventValue = getOutsidePressEventProp();
4650 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue;
4651 if (typeof resolved === "string") {
4652 return resolved;
4653 }
4654 return resolved[computedType];
4655 }
4656 function shouldIgnoreEvent(event) {
4657 const computedOutsidePressEvent = getOutsidePressEvent();
4658 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click";
4659 }
4660 function isEventWithinFloatingTree(event) {
4661 const nodeId = dataRef.current.floatingContext?.nodeId;
4662 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating));
4663 return isEventWithinOwnElements(event) || targetIsInsideChildren;
4664 }
4665 function closeOnPressOutside(event) {
4666 if (shouldIgnoreEvent(event)) {
4667 if (event.type !== "click" && !isEventWithinOwnElements(event)) {
4668 preventedPressSuppressionTimeout.clear();
4669 suppressNextOutsideClickRef.current = false;
4670 }
4671 clearInsideReactTree();
4672 return;
4673 }
4674 if (dataRef.current.insideReactTree) {
4675 clearInsideReactTree();
4676 return;
4677 }
4678 const target = getTarget(event);
4679 const inertSelector = `[${createAttribute("inert")}]`;
4680 const targetRoot = isElement(target) ? target.getRootNode() : null;
4681 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector));
4682 const triggers = store.context.triggerElements;
4683 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) {
4684 return;
4685 }
4686 let targetRootAncestor = isElement(target) ? target : null;
4687 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
4688 const nextParent = getParentNode(targetRootAncestor);
4689 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
4690 break;
4691 }
4692 targetRootAncestor = nextParent;
4693 }
4694 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
4695 !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the
4696 // element was injected after the floating element rendered.
4697 markers.every((marker) => !contains(targetRootAncestor, marker))) {
4698 return;
4699 }
4700 if (isHTMLElement(target) && !("touches" in event)) {
4701 const lastTraversableNode = isLastTraversableNode(target);
4702 const style = getComputedStyle2(target);
4703 const scrollRe = /auto|scroll/;
4704 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
4705 const isScrollableY2 = lastTraversableNode || scrollRe.test(style.overflowY);
4706 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
4707 const canScrollY = isScrollableY2 && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
4708 const isRTL4 = style.direction === "rtl";
4709 const pressedVerticalScrollbar = canScrollY && (isRTL4 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
4710 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
4711 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
4712 return;
4713 }
4714 }
4715 if (isEventWithinFloatingTree(event)) {
4716 return;
4717 }
4718 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) {
4719 preventedPressSuppressionTimeout.clear();
4720 suppressNextOutsideClickRef.current = false;
4721 return;
4722 }
4723 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
4724 return;
4725 }
4726 if (hasBlockingChild("__outsidePressBubbles")) {
4727 return;
4728 }
4729 store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event));
4730 clearInsideReactTree();
4731 }
4732 function handlePointerDown(event) {
4733 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) {
4734 return;
4735 }
4736 closeOnPressOutside(event);
4737 }
4738 function handleTouchStart(event) {
4739 if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) {
4740 return;
4741 }
4742 const touch = event.touches[0];
4743 if (touch) {
4744 touchStateRef.current = {
4745 startTime: Date.now(),
4746 startX: touch.clientX,
4747 startY: touch.clientY,
4748 dismissOnTouchEnd: false,
4749 dismissOnMouseDown: true
4750 };
4751 cancelDismissOnEndTimeout.start(1e3, () => {
4752 if (touchStateRef.current) {
4753 touchStateRef.current.dismissOnTouchEnd = false;
4754 touchStateRef.current.dismissOnMouseDown = false;
4755 }
4756 });
4757 }
4758 }
4759 function addTargetEventListenerOnce(event, listener) {
4760 const target = getTarget(event);
4761 if (!target) {
4762 return;
4763 }
4764 const unsubscribe2 = addEventListener(target, event.type, () => {
4765 listener(event);
4766 unsubscribe2();
4767 });
4768 }
4769 function handleTouchStartCapture(event) {
4770 currentPointerTypeRef.current = "touch";
4771 addTargetEventListenerOnce(event, handleTouchStart);
4772 }
4773 function closeOnPressOutsideCapture(event) {
4774 cancelDismissOnEndTimeout.clear();
4775 if (event.type === "pointerdown") {
4776 currentPointerTypeRef.current = event.pointerType;
4777 }
4778 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {
4779 return;
4780 }
4781 addTargetEventListenerOnce(event, (targetEvent) => {
4782 if (targetEvent.type === "pointerdown") {
4783 handlePointerDown(targetEvent);
4784 } else {
4785 closeOnPressOutside(targetEvent);
4786 }
4787 });
4788 }
4789 function handlePressEndCapture(event) {
4790 if (!pressStartedInsideRef.current) {
4791 return;
4792 }
4793 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;
4794 resetPressStartState();
4795 if (getOutsidePressEvent() !== "intentional") {
4796 return;
4797 }
4798 if (event.type === "pointercancel") {
4799 if (pressStartedInsideDefaultPrevented) {
4800 suppressImmediateOutsideClickAfterPreventedStart();
4801 }
4802 return;
4803 }
4804 if (isEventWithinFloatingTree(event)) {
4805 return;
4806 }
4807 if (pressStartedInsideDefaultPrevented) {
4808 suppressImmediateOutsideClickAfterPreventedStart();
4809 return;
4810 }
4811 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
4812 return;
4813 }
4814 preventedPressSuppressionTimeout.clear();
4815 suppressNextOutsideClickRef.current = true;
4816 clearInsideReactTree();
4817 }
4818 function handleTouchMove(event) {
4819 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
4820 return;
4821 }
4822 const touch = event.touches[0];
4823 if (!touch) {
4824 return;
4825 }
4826 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);
4827 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);
4828 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
4829 if (distance > 5) {
4830 touchStateRef.current.dismissOnTouchEnd = true;
4831 }
4832 if (distance > 10) {
4833 closeOnPressOutside(event);
4834 cancelDismissOnEndTimeout.clear();
4835 touchStateRef.current = null;
4836 }
4837 }
4838 function handleTouchMoveCapture(event) {
4839 addTargetEventListenerOnce(event, handleTouchMove);
4840 }
4841 function handleTouchEnd(event) {
4842 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
4843 return;
4844 }
4845 if (touchStateRef.current.dismissOnTouchEnd) {
4846 closeOnPressOutside(event);
4847 }
4848 cancelDismissOnEndTimeout.clear();
4849 touchStateRef.current = null;
4850 }
4851 function handleTouchEndCapture(event) {
4852 addTargetEventListenerOnce(event, handleTouchEnd);
4853 }
4854 const doc = ownerDocument(floatingElement);
4855 const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, true), addEventListener(doc, "touchmove", handleTouchMoveCapture, true), addEventListener(doc, "touchend", handleTouchEndCapture, true)));
4856 return () => {
4857 unsubscribe();
4858 compositionTimeout.clear();
4859 preventedPressSuppressionTimeout.clear();
4860 resetPressStartState();
4861 suppressNextOutsideClickRef.current = false;
4862 clearInsideReactTree();
4863 };
4864 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]);
4865 const reference = React25.useMemo(() => ({
4866 onKeyDown: closeOnEscapeKeyDown,
4867 onPointerDown: closeOnReferencePress,
4868 onClick: closeOnReferencePress
4869 }), [closeOnEscapeKeyDown, closeOnReferencePress]);
4870 const floating = React25.useMemo(() => ({
4871 onKeyDown: closeOnEscapeKeyDown,
4872 // `onMouseDown` may be blocked if `event.preventDefault()` is called in
4873 // `onPointerDown`, such as with <NumberField.ScrubArea>.
4874 // See https://github.com/mui/base-ui/pull/3379
4875 onPointerDown: markInsidePressStartPrevented,
4876 onMouseDown: markInsidePressStartPrevented,
4877 onClickCapture: markInsideReactTree,
4878 onMouseDownCapture(event) {
4879 markInsideReactTree();
4880 markPressStartedInsideReactTree(event);
4881 },
4882 onPointerDownCapture(event) {
4883 markInsideReactTree();
4884 markPressStartedInsideReactTree(event);
4885 },
4886 onMouseUpCapture: markInsideReactTree,
4887 onTouchEndCapture: markInsideReactTree,
4888 onTouchMoveCapture: markInsideReactTree
4889 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);
4890 return React25.useMemo(() => enabled ? {
4891 reference,
4892 floating,
4893 trigger: reference
4894 } : {}, [enabled, reference, floating]);
4895 }
4896
4897 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
4898 var React33 = __toESM(require_react(), 1);
4899
4900 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
4901 function computeCoordsFromPlacement(_ref, placement, rtl) {
4902 let {
4903 reference,
4904 floating
4905 } = _ref;
4906 const sideAxis = getSideAxis(placement);
4907 const alignmentAxis = getAlignmentAxis(placement);
4908 const alignLength = getAxisLength(alignmentAxis);
4909 const side = getSide(placement);
4910 const isVertical = sideAxis === "y";
4911 const commonX = reference.x + reference.width / 2 - floating.width / 2;
4912 const commonY = reference.y + reference.height / 2 - floating.height / 2;
4913 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
4914 let coords;
4915 switch (side) {
4916 case "top":
4917 coords = {
4918 x: commonX,
4919 y: reference.y - floating.height
4920 };
4921 break;
4922 case "bottom":
4923 coords = {
4924 x: commonX,
4925 y: reference.y + reference.height
4926 };
4927 break;
4928 case "right":
4929 coords = {
4930 x: reference.x + reference.width,
4931 y: commonY
4932 };
4933 break;
4934 case "left":
4935 coords = {
4936 x: reference.x - floating.width,
4937 y: commonY
4938 };
4939 break;
4940 default:
4941 coords = {
4942 x: reference.x,
4943 y: reference.y
4944 };
4945 }
4946 const alignment = getAlignment(placement);
4947 if (alignment) {
4948 coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
4949 }
4950 return coords;
4951 }
4952 async function detectOverflow(state, options) {
4953 var _await$platform$isEle;
4954 if (options === void 0) {
4955 options = {};
4956 }
4957 const {
4958 x,
4959 y,
4960 platform: platform3,
4961 rects,
4962 elements,
4963 strategy
4964 } = state;
4965 const {
4966 boundary = "clippingAncestors",
4967 rootBoundary = "viewport",
4968 elementContext = "floating",
4969 altBoundary = false,
4970 padding = 0
4971 } = evaluate(options, state);
4972 const paddingObject = getPaddingObject(padding);
4973 const altContext = elementContext === "floating" ? "reference" : "floating";
4974 const element = elements[altBoundary ? altContext : elementContext];
4975 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({
4976 element: ((_await$platform$isEle = await (platform3.isElement == null ? void 0 : platform3.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform3.getDocumentElement == null ? void 0 : platform3.getDocumentElement(elements.floating)),
4977 boundary,
4978 rootBoundary,
4979 strategy
4980 }));
4981 const rect = elementContext === "floating" ? {
4982 x,
4983 y,
4984 width: rects.floating.width,
4985 height: rects.floating.height
4986 } : rects.reference;
4987 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating));
4988 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || {
4989 x: 1,
4990 y: 1
4991 };
4992 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({
4993 elements,
4994 rect,
4995 offsetParent,
4996 strategy
4997 }) : rect);
4998 return {
4999 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
5000 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
5001 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
5002 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
5003 };
5004 }
5005 var MAX_RESET_COUNT = 50;
5006 var computePosition = async (reference, floating, config) => {
5007 const {
5008 placement = "bottom",
5009 strategy = "absolute",
5010 middleware = [],
5011 platform: platform3
5012 } = config;
5013 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : {
5014 ...platform3,
5015 detectOverflow
5016 };
5017 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating));
5018 let rects = await platform3.getElementRects({
5019 reference,
5020 floating,
5021 strategy
5022 });
5023 let {
5024 x,
5025 y
5026 } = computeCoordsFromPlacement(rects, placement, rtl);
5027 let statefulPlacement = placement;
5028 let resetCount = 0;
5029 const middlewareData = {};
5030 for (let i = 0; i < middleware.length; i++) {
5031 const currentMiddleware = middleware[i];
5032 if (!currentMiddleware) {
5033 continue;
5034 }
5035 const {
5036 name,
5037 fn
5038 } = currentMiddleware;
5039 const {
5040 x: nextX,
5041 y: nextY,
5042 data,
5043 reset
5044 } = await fn({
5045 x,
5046 y,
5047 initialPlacement: placement,
5048 placement: statefulPlacement,
5049 strategy,
5050 middlewareData,
5051 rects,
5052 platform: platformWithDetectOverflow,
5053 elements: {
5054 reference,
5055 floating
5056 }
5057 });
5058 x = nextX != null ? nextX : x;
5059 y = nextY != null ? nextY : y;
5060 middlewareData[name] = {
5061 ...middlewareData[name],
5062 ...data
5063 };
5064 if (reset && resetCount < MAX_RESET_COUNT) {
5065 resetCount++;
5066 if (typeof reset === "object") {
5067 if (reset.placement) {
5068 statefulPlacement = reset.placement;
5069 }
5070 if (reset.rects) {
5071 rects = reset.rects === true ? await platform3.getElementRects({
5072 reference,
5073 floating,
5074 strategy
5075 }) : reset.rects;
5076 }
5077 ({
5078 x,
5079 y
5080 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
5081 }
5082 i = -1;
5083 }
5084 }
5085 return {
5086 x,
5087 y,
5088 placement: statefulPlacement,
5089 strategy,
5090 middlewareData
5091 };
5092 };
5093 var flip = function(options) {
5094 if (options === void 0) {
5095 options = {};
5096 }
5097 return {
5098 name: "flip",
5099 options,
5100 async fn(state) {
5101 var _middlewareData$arrow, _middlewareData$flip;
5102 const {
5103 placement,
5104 middlewareData,
5105 rects,
5106 initialPlacement,
5107 platform: platform3,
5108 elements
5109 } = state;
5110 const {
5111 mainAxis: checkMainAxis = true,
5112 crossAxis: checkCrossAxis = true,
5113 fallbackPlacements: specifiedFallbackPlacements,
5114 fallbackStrategy = "bestFit",
5115 fallbackAxisSideDirection = "none",
5116 flipAlignment = true,
5117 ...detectOverflowOptions
5118 } = evaluate(options, state);
5119 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
5120 return {};
5121 }
5122 const side = getSide(placement);
5123 const initialSideAxis = getSideAxis(initialPlacement);
5124 const isBasePlacement = getSide(initialPlacement) === initialPlacement;
5125 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
5126 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
5127 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
5128 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
5129 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
5130 }
5131 const placements2 = [initialPlacement, ...fallbackPlacements];
5132 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
5133 const overflows = [];
5134 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
5135 if (checkMainAxis) {
5136 overflows.push(overflow[side]);
5137 }
5138 if (checkCrossAxis) {
5139 const sides2 = getAlignmentSides(placement, rects, rtl);
5140 overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
5141 }
5142 overflowsData = [...overflowsData, {
5143 placement,
5144 overflows
5145 }];
5146 if (!overflows.every((side2) => side2 <= 0)) {
5147 var _middlewareData$flip2, _overflowsData$filter;
5148 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
5149 const nextPlacement = placements2[nextIndex];
5150 if (nextPlacement) {
5151 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
5152 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
5153 // overflows the main axis.
5154 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
5155 return {
5156 data: {
5157 index: nextIndex,
5158 overflows: overflowsData
5159 },
5160 reset: {
5161 placement: nextPlacement
5162 }
5163 };
5164 }
5165 }
5166 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
5167 if (!resetPlacement) {
5168 switch (fallbackStrategy) {
5169 case "bestFit": {
5170 var _overflowsData$filter2;
5171 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
5172 if (hasFallbackAxisSideDirection) {
5173 const currentSideAxis = getSideAxis(d.placement);
5174 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
5175 // reading directions favoring greater width.
5176 currentSideAxis === "y";
5177 }
5178 return true;
5179 }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
5180 if (placement2) {
5181 resetPlacement = placement2;
5182 }
5183 break;
5184 }
5185 case "initialPlacement":
5186 resetPlacement = initialPlacement;
5187 break;
5188 }
5189 }
5190 if (placement !== resetPlacement) {
5191 return {
5192 reset: {
5193 placement: resetPlacement
5194 }
5195 };
5196 }
5197 }
5198 return {};
5199 }
5200 };
5201 };
5202 var originSides = /* @__PURE__ */ new Set(["left", "top"]);
5203 async function convertValueToCoords(state, options) {
5204 const {
5205 placement,
5206 platform: platform3,
5207 elements
5208 } = state;
5209 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
5210 const side = getSide(placement);
5211 const alignment = getAlignment(placement);
5212 const isVertical = getSideAxis(placement) === "y";
5213 const mainAxisMulti = originSides.has(side) ? -1 : 1;
5214 const crossAxisMulti = rtl && isVertical ? -1 : 1;
5215 const rawValue = evaluate(options, state);
5216 let {
5217 mainAxis,
5218 crossAxis,
5219 alignmentAxis
5220 } = typeof rawValue === "number" ? {
5221 mainAxis: rawValue,
5222 crossAxis: 0,
5223 alignmentAxis: null
5224 } : {
5225 mainAxis: rawValue.mainAxis || 0,
5226 crossAxis: rawValue.crossAxis || 0,
5227 alignmentAxis: rawValue.alignmentAxis
5228 };
5229 if (alignment && typeof alignmentAxis === "number") {
5230 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
5231 }
5232 return isVertical ? {
5233 x: crossAxis * crossAxisMulti,
5234 y: mainAxis * mainAxisMulti
5235 } : {
5236 x: mainAxis * mainAxisMulti,
5237 y: crossAxis * crossAxisMulti
5238 };
5239 }
5240 var offset = function(options) {
5241 if (options === void 0) {
5242 options = 0;
5243 }
5244 return {
5245 name: "offset",
5246 options,
5247 async fn(state) {
5248 var _middlewareData$offse, _middlewareData$arrow;
5249 const {
5250 x,
5251 y,
5252 placement,
5253 middlewareData
5254 } = state;
5255 const diffCoords = await convertValueToCoords(state, options);
5256 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
5257 return {};
5258 }
5259 return {
5260 x: x + diffCoords.x,
5261 y: y + diffCoords.y,
5262 data: {
5263 ...diffCoords,
5264 placement
5265 }
5266 };
5267 }
5268 };
5269 };
5270 var shift = function(options) {
5271 if (options === void 0) {
5272 options = {};
5273 }
5274 return {
5275 name: "shift",
5276 options,
5277 async fn(state) {
5278 const {
5279 x,
5280 y,
5281 placement,
5282 platform: platform3
5283 } = state;
5284 const {
5285 mainAxis: checkMainAxis = true,
5286 crossAxis: checkCrossAxis = false,
5287 limiter = {
5288 fn: (_ref) => {
5289 let {
5290 x: x2,
5291 y: y2
5292 } = _ref;
5293 return {
5294 x: x2,
5295 y: y2
5296 };
5297 }
5298 },
5299 ...detectOverflowOptions
5300 } = evaluate(options, state);
5301 const coords = {
5302 x,
5303 y
5304 };
5305 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
5306 const crossAxis = getSideAxis(placement);
5307 const mainAxis = getOppositeAxis(crossAxis);
5308 let mainAxisCoord = coords[mainAxis];
5309 let crossAxisCoord = coords[crossAxis];
5310 const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
5311 if (checkMainAxis) {
5312 mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
5313 }
5314 if (checkCrossAxis) {
5315 crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
5316 }
5317 const limitedCoords = limiter.fn({
5318 ...state,
5319 [mainAxis]: mainAxisCoord,
5320 [crossAxis]: crossAxisCoord
5321 });
5322 return {
5323 ...limitedCoords,
5324 data: {
5325 x: limitedCoords.x - x,
5326 y: limitedCoords.y - y,
5327 enabled: {
5328 [mainAxis]: checkMainAxis,
5329 [crossAxis]: checkCrossAxis
5330 }
5331 }
5332 };
5333 }
5334 };
5335 };
5336 var limitShift = function(options) {
5337 if (options === void 0) {
5338 options = {};
5339 }
5340 return {
5341 options,
5342 fn(state) {
5343 var _rawOffset$mainAxis, _rawOffset$crossAxis;
5344 const {
5345 x,
5346 y,
5347 placement,
5348 rects,
5349 middlewareData
5350 } = state;
5351 const {
5352 offset: offset4 = 0,
5353 mainAxis: checkMainAxis = true,
5354 crossAxis: checkCrossAxis = true
5355 } = evaluate(options, state);
5356 const coords = {
5357 x,
5358 y
5359 };
5360 const crossAxis = getSideAxis(placement);
5361 const mainAxis = getOppositeAxis(crossAxis);
5362 let mainAxisCoord = coords[mainAxis];
5363 let crossAxisCoord = coords[crossAxis];
5364 const rawOffset = evaluate(offset4, state);
5365 const computedOffset = typeof rawOffset === "number" ? {
5366 mainAxis: rawOffset,
5367 crossAxis: 0
5368 } : {
5369 mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,
5370 crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0
5371 };
5372 if (checkMainAxis) {
5373 const len = mainAxis === "y" ? "height" : "width";
5374 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
5375 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
5376 if (mainAxisCoord < limitMin) {
5377 mainAxisCoord = limitMin;
5378 } else if (mainAxisCoord > limitMax) {
5379 mainAxisCoord = limitMax;
5380 }
5381 }
5382 if (checkCrossAxis) {
5383 var _middlewareData$offse, _middlewareData$offse2;
5384 const len = mainAxis === "y" ? "width" : "height";
5385 const isOriginSide = originSides.has(getSide(placement));
5386 const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
5387 const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
5388 if (crossAxisCoord < limitMin) {
5389 crossAxisCoord = limitMin;
5390 } else if (crossAxisCoord > limitMax) {
5391 crossAxisCoord = limitMax;
5392 }
5393 }
5394 return {
5395 [mainAxis]: mainAxisCoord,
5396 [crossAxis]: crossAxisCoord
5397 };
5398 }
5399 };
5400 };
5401 var size = function(options) {
5402 if (options === void 0) {
5403 options = {};
5404 }
5405 return {
5406 name: "size",
5407 options,
5408 async fn(state) {
5409 const {
5410 placement,
5411 rects,
5412 platform: platform3,
5413 elements
5414 } = state;
5415 const {
5416 apply = () => {
5417 },
5418 ...detectOverflowOptions
5419 } = evaluate(options, state);
5420 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
5421 const side = getSide(placement);
5422 const alignment = getAlignment(placement);
5423 const isYAxis = getSideAxis(placement) === "y";
5424 const {
5425 width,
5426 height
5427 } = rects.floating;
5428 let heightSide;
5429 let widthSide;
5430 if (side === "top" || side === "bottom") {
5431 heightSide = side;
5432 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
5433 } else {
5434 widthSide = side;
5435 heightSide = alignment === "end" ? "top" : "bottom";
5436 }
5437 const maximumClippingHeight = height - overflow.top - overflow.bottom;
5438 const maximumClippingWidth = width - overflow.left - overflow.right;
5439 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
5440 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
5441 const shiftData = state.middlewareData.shift;
5442 const noShift = !shiftData;
5443 let availableHeight = overflowAvailableHeight;
5444 let availableWidth = overflowAvailableWidth;
5445 if (shiftData != null && shiftData.enabled.x) {
5446 availableWidth = maximumClippingWidth;
5447 }
5448 if (shiftData != null && shiftData.enabled.y) {
5449 availableHeight = maximumClippingHeight;
5450 }
5451 if (noShift && !alignment) {
5452 if (isYAxis) {
5453 availableWidth = width - 2 * max(overflow.left, overflow.right);
5454 } else {
5455 availableHeight = height - 2 * max(overflow.top, overflow.bottom);
5456 }
5457 }
5458 await apply({
5459 ...state,
5460 availableWidth,
5461 availableHeight
5462 });
5463 const nextDimensions = await platform3.getDimensions(elements.floating);
5464 if (width !== nextDimensions.width || height !== nextDimensions.height) {
5465 return {
5466 reset: {
5467 rects: true
5468 }
5469 };
5470 }
5471 return {};
5472 }
5473 };
5474 };
5475
5476 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
5477 function getCssDimensions(element) {
5478 const css = getComputedStyle2(element);
5479 let width = parseFloat(css.width) || 0;
5480 let height = parseFloat(css.height) || 0;
5481 const hasOffset = isHTMLElement(element);
5482 const offsetWidth = hasOffset ? element.offsetWidth : width;
5483 const offsetHeight = hasOffset ? element.offsetHeight : height;
5484 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
5485 if (shouldFallback) {
5486 width = offsetWidth;
5487 height = offsetHeight;
5488 }
5489 return {
5490 width,
5491 height,
5492 $: shouldFallback
5493 };
5494 }
5495 function unwrapElement(element) {
5496 return !isElement(element) ? element.contextElement : element;
5497 }
5498 function getScale(element) {
5499 const domElement = unwrapElement(element);
5500 if (!isHTMLElement(domElement)) {
5501 return createCoords(1);
5502 }
5503 const rect = domElement.getBoundingClientRect();
5504 const {
5505 width,
5506 height,
5507 $
5508 } = getCssDimensions(domElement);
5509 let x = ($ ? round(rect.width) : rect.width) / width;
5510 let y = ($ ? round(rect.height) : rect.height) / height;
5511 if (!x || !Number.isFinite(x)) {
5512 x = 1;
5513 }
5514 if (!y || !Number.isFinite(y)) {
5515 y = 1;
5516 }
5517 return {
5518 x,
5519 y
5520 };
5521 }
5522 var noOffsets = /* @__PURE__ */ createCoords(0);
5523 function getVisualOffsets(element) {
5524 const win = getWindow(element);
5525 if (!isWebKit() || !win.visualViewport) {
5526 return noOffsets;
5527 }
5528 return {
5529 x: win.visualViewport.offsetLeft,
5530 y: win.visualViewport.offsetTop
5531 };
5532 }
5533 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
5534 if (isFixed === void 0) {
5535 isFixed = false;
5536 }
5537 return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
5538 }
5539 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
5540 if (includeScale === void 0) {
5541 includeScale = false;
5542 }
5543 if (isFixedStrategy === void 0) {
5544 isFixedStrategy = false;
5545 }
5546 const clientRect = element.getBoundingClientRect();
5547 const domElement = unwrapElement(element);
5548 let scale = createCoords(1);
5549 if (includeScale) {
5550 if (offsetParent) {
5551 if (isElement(offsetParent)) {
5552 scale = getScale(offsetParent);
5553 }
5554 } else {
5555 scale = getScale(element);
5556 }
5557 }
5558 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
5559 let x = (clientRect.left + visualOffsets.x) / scale.x;
5560 let y = (clientRect.top + visualOffsets.y) / scale.y;
5561 let width = clientRect.width / scale.x;
5562 let height = clientRect.height / scale.y;
5563 if (domElement && offsetParent) {
5564 const win = getWindow(domElement);
5565 const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
5566 let currentWin = win;
5567 let currentIFrame = getFrameElement(currentWin);
5568 while (currentIFrame && offsetWin !== currentWin) {
5569 const iframeScale = getScale(currentIFrame);
5570 const iframeRect = currentIFrame.getBoundingClientRect();
5571 const css = getComputedStyle2(currentIFrame);
5572 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
5573 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
5574 x *= iframeScale.x;
5575 y *= iframeScale.y;
5576 width *= iframeScale.x;
5577 height *= iframeScale.y;
5578 x += left;
5579 y += top;
5580 currentWin = getWindow(currentIFrame);
5581 currentIFrame = getFrameElement(currentWin);
5582 }
5583 }
5584 return rectToClientRect({
5585 width,
5586 height,
5587 x,
5588 y
5589 });
5590 }
5591 function getWindowScrollBarX(element, rect) {
5592 const leftScroll = getNodeScroll(element).scrollLeft;
5593 if (!rect) {
5594 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
5595 }
5596 return rect.left + leftScroll;
5597 }
5598 function getHTMLOffset(documentElement, scroll) {
5599 const htmlRect = documentElement.getBoundingClientRect();
5600 const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
5601 const y = htmlRect.top + scroll.scrollTop;
5602 return {
5603 x,
5604 y
5605 };
5606 }
5607 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
5608 let {
5609 elements,
5610 rect,
5611 offsetParent,
5612 strategy
5613 } = _ref;
5614 const isFixed = strategy === "fixed";
5615 const documentElement = getDocumentElement(offsetParent);
5616 const topLayer = elements ? isTopLayer(elements.floating) : false;
5617 if (offsetParent === documentElement || topLayer && isFixed) {
5618 return rect;
5619 }
5620 let scroll = {
5621 scrollLeft: 0,
5622 scrollTop: 0
5623 };
5624 let scale = createCoords(1);
5625 const offsets = createCoords(0);
5626 const isOffsetParentAnElement = isHTMLElement(offsetParent);
5627 if (isOffsetParentAnElement || !isFixed) {
5628 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
5629 scroll = getNodeScroll(offsetParent);
5630 }
5631 if (isOffsetParentAnElement) {
5632 const offsetRect = getBoundingClientRect(offsetParent);
5633 scale = getScale(offsetParent);
5634 offsets.x = offsetRect.x + offsetParent.clientLeft;
5635 offsets.y = offsetRect.y + offsetParent.clientTop;
5636 }
5637 }
5638 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
5639 return {
5640 width: rect.width * scale.x,
5641 height: rect.height * scale.y,
5642 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
5643 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
5644 };
5645 }
5646 function getClientRects(element) {
5647 return element.getClientRects ? Array.from(element.getClientRects()) : [];
5648 }
5649 function getDocumentRect(html) {
5650 const scroll = getNodeScroll(html);
5651 const body = html.ownerDocument.body;
5652 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
5653 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
5654 let x = -scroll.scrollLeft + getWindowScrollBarX(html);
5655 const y = -scroll.scrollTop;
5656 if (getComputedStyle2(body).direction === "rtl") {
5657 x += max(html.clientWidth, body.clientWidth) - width;
5658 }
5659 return {
5660 width,
5661 height,
5662 x,
5663 y
5664 };
5665 }
5666 var SCROLLBAR_MAX = 25;
5667 function getViewportRect(element, strategy, rootBoundary) {
5668 if (rootBoundary === void 0) {
5669 rootBoundary = "viewport";
5670 }
5671 const isLayoutViewport = rootBoundary === "layoutViewport";
5672 const win = getWindow(element);
5673 const html = getDocumentElement(element);
5674 const visualViewport = win.visualViewport;
5675 let width = html.clientWidth;
5676 let height = html.clientHeight;
5677 let x = 0;
5678 let y = 0;
5679 if (visualViewport) {
5680 const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
5681 if (isLayoutViewport) {
5682 if (!layoutRelativeClientCoords) {
5683 x = -visualViewport.offsetLeft;
5684 y = -visualViewport.offsetTop;
5685 }
5686 } else {
5687 width = visualViewport.width;
5688 height = visualViewport.height;
5689 if (layoutRelativeClientCoords) {
5690 x = visualViewport.offsetLeft;
5691 y = visualViewport.offsetTop;
5692 }
5693 }
5694 }
5695 const windowScrollbarX = getWindowScrollBarX(html);
5696 if (windowScrollbarX <= 0) {
5697 const doc = html.ownerDocument;
5698 const body = doc.body;
5699 const bodyStyles = getComputedStyle(body);
5700 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
5701 const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
5702 const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
5703 if (gutter <= SCROLLBAR_MAX) {
5704 width -= gutter;
5705 }
5706 }
5707 return {
5708 width,
5709 height,
5710 x,
5711 y
5712 };
5713 }
5714 function getInnerBoundingClientRect(element, strategy) {
5715 const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
5716 const top = clientRect.top + element.clientTop;
5717 const left = clientRect.left + element.clientLeft;
5718 const scale = getScale(element);
5719 const width = element.clientWidth * scale.x;
5720 const height = element.clientHeight * scale.y;
5721 const x = left * scale.x;
5722 const y = top * scale.y;
5723 return {
5724 width,
5725 height,
5726 x,
5727 y
5728 };
5729 }
5730 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
5731 let rect;
5732 if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") {
5733 rect = getViewportRect(element, strategy, clippingAncestor);
5734 } else if (clippingAncestor === "document") {
5735 rect = getDocumentRect(getDocumentElement(element));
5736 } else if (isElement(clippingAncestor)) {
5737 rect = getInnerBoundingClientRect(clippingAncestor, strategy);
5738 } else {
5739 const visualOffsets = getVisualOffsets(element);
5740 rect = {
5741 x: clippingAncestor.x - visualOffsets.x,
5742 y: clippingAncestor.y - visualOffsets.y,
5743 width: clippingAncestor.width,
5744 height: clippingAncestor.height
5745 };
5746 }
5747 return rectToClientRect(rect);
5748 }
5749 function getClippingElementAncestors(element, cache) {
5750 const cachedResult = cache.get(element);
5751 if (cachedResult) {
5752 return cachedResult;
5753 }
5754 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
5755 let lastKeptComputedStyle = null;
5756 const elementIsFixed = getComputedStyle2(element).position === "fixed";
5757 let currentNode = elementIsFixed ? getParentNode(element) : element;
5758 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
5759 const computedStyle = getComputedStyle2(currentNode);
5760 const currentNodeIsContaining = isContainingBlock(currentNode);
5761 const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
5762 const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static");
5763 if (shouldDropCurrentNode) {
5764 result = result.filter((ancestor) => ancestor !== currentNode);
5765 } else {
5766 lastKeptComputedStyle = computedStyle;
5767 }
5768 currentNode = getParentNode(currentNode);
5769 }
5770 cache.set(element, result);
5771 return result;
5772 }
5773 function getClippingRect(_ref) {
5774 let {
5775 element,
5776 boundary,
5777 rootBoundary,
5778 strategy
5779 } = _ref;
5780 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
5781 const clippingAncestors = [...elementClippingAncestors, rootBoundary];
5782 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
5783 let top = firstRect.top;
5784 let right = firstRect.right;
5785 let bottom = firstRect.bottom;
5786 let left = firstRect.left;
5787 for (let i = 1; i < clippingAncestors.length; i++) {
5788 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
5789 top = max(rect.top, top);
5790 right = min(rect.right, right);
5791 bottom = min(rect.bottom, bottom);
5792 left = max(rect.left, left);
5793 }
5794 return {
5795 width: right - left,
5796 height: bottom - top,
5797 x: left,
5798 y: top
5799 };
5800 }
5801 function getDimensions(element) {
5802 const {
5803 width,
5804 height
5805 } = getCssDimensions(element);
5806 return {
5807 width,
5808 height
5809 };
5810 }
5811 function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
5812 const isOffsetParentAnElement = isHTMLElement(offsetParent);
5813 const documentElement = getDocumentElement(offsetParent);
5814 const isFixed = strategy === "fixed";
5815 const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
5816 let scroll = {
5817 scrollLeft: 0,
5818 scrollTop: 0
5819 };
5820 const offsets = createCoords(0);
5821 if (isOffsetParentAnElement || !isFixed) {
5822 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
5823 scroll = getNodeScroll(offsetParent);
5824 }
5825 if (isOffsetParentAnElement) {
5826 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
5827 offsets.x = offsetRect.x + offsetParent.clientLeft;
5828 offsets.y = offsetRect.y + offsetParent.clientTop;
5829 }
5830 }
5831 if (!isOffsetParentAnElement && documentElement) {
5832 offsets.x = getWindowScrollBarX(documentElement);
5833 }
5834 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
5835 const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
5836 const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
5837 return {
5838 x,
5839 y,
5840 width: rect.width,
5841 height: rect.height
5842 };
5843 }
5844 function isStaticPositioned(element) {
5845 return getComputedStyle2(element).position === "static";
5846 }
5847 function getTrueOffsetParent(element, polyfill) {
5848 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
5849 return null;
5850 }
5851 if (polyfill) {
5852 return polyfill(element);
5853 }
5854 let rawOffsetParent = element.offsetParent;
5855 if (getDocumentElement(element) === rawOffsetParent) {
5856 rawOffsetParent = rawOffsetParent.ownerDocument.body;
5857 }
5858 return rawOffsetParent;
5859 }
5860 function getOffsetParent(element, polyfill) {
5861 const win = getWindow(element);
5862 if (isTopLayer(element)) {
5863 return win;
5864 }
5865 if (!isHTMLElement(element)) {
5866 let svgOffsetParent = getParentNode(element);
5867 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
5868 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
5869 return svgOffsetParent;
5870 }
5871 svgOffsetParent = getParentNode(svgOffsetParent);
5872 }
5873 return win;
5874 }
5875 let offsetParent = getTrueOffsetParent(element, polyfill);
5876 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
5877 offsetParent = getTrueOffsetParent(offsetParent, polyfill);
5878 }
5879 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
5880 return win;
5881 }
5882 return offsetParent || getContainingBlock(element) || win;
5883 }
5884 var getElementRects = async function(data) {
5885 const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
5886 const getDimensionsFn = this.getDimensions;
5887 const floatingDimensions = await getDimensionsFn(data.floating);
5888 return {
5889 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
5890 floating: {
5891 x: 0,
5892 y: 0,
5893 width: floatingDimensions.width,
5894 height: floatingDimensions.height
5895 }
5896 };
5897 };
5898 function isRTL(element) {
5899 return getComputedStyle2(element).direction === "rtl";
5900 }
5901 var platform2 = {
5902 convertOffsetParentRelativeRectToViewportRelativeRect,
5903 getDocumentElement,
5904 getClippingRect,
5905 getOffsetParent,
5906 getElementRects,
5907 getClientRects,
5908 getDimensions,
5909 getScale,
5910 isElement,
5911 isRTL
5912 };
5913 function rectsAreEqual(a, b) {
5914 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
5915 }
5916 function observeMove(element, onMove, ancestorResize) {
5917 let io = null;
5918 let timeoutId;
5919 const root2 = getDocumentElement(element);
5920 function cleanup() {
5921 var _io;
5922 clearTimeout(timeoutId);
5923 (_io = io) == null || _io.disconnect();
5924 io = null;
5925 }
5926 function refresh(skip, threshold) {
5927 if (skip === void 0) {
5928 skip = false;
5929 }
5930 if (threshold === void 0) {
5931 threshold = 1;
5932 }
5933 cleanup();
5934 const elementRectForRootMargin = element.getBoundingClientRect();
5935 const {
5936 left,
5937 top,
5938 width,
5939 height
5940 } = elementRectForRootMargin;
5941 if (!skip) {
5942 onMove();
5943 }
5944 if (!width || !height) {
5945 return;
5946 }
5947 const insetTop = floor(top);
5948 const insetRight = floor(root2.clientWidth - (left + width));
5949 const insetBottom = floor(root2.clientHeight - (top + height));
5950 const insetLeft = floor(left);
5951 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
5952 const options = {
5953 rootMargin,
5954 threshold: max(0, min(1, threshold)) || 1
5955 };
5956 let isFirstUpdate = true;
5957 function handleObserve(entries) {
5958 const ratio = entries[0].intersectionRatio;
5959 if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
5960 return refresh();
5961 }
5962 if (ratio !== threshold) {
5963 if (!isFirstUpdate) {
5964 return refresh();
5965 }
5966 if (!ratio) {
5967 timeoutId = setTimeout(() => {
5968 refresh(false, 1e-7);
5969 }, 1e3);
5970 } else {
5971 refresh(false, ratio);
5972 }
5973 }
5974 isFirstUpdate = false;
5975 }
5976 try {
5977 io = new IntersectionObserver(handleObserve, {
5978 ...options,
5979 // Handle <iframe>s
5980 root: root2.ownerDocument
5981 });
5982 } catch (_e) {
5983 io = new IntersectionObserver(handleObserve, options);
5984 }
5985 io.observe(element);
5986 }
5987 const win = getWindow(element);
5988 const handleResize = () => refresh(ancestorResize);
5989 win.addEventListener("resize", handleResize);
5990 refresh(true);
5991 return () => {
5992 win.removeEventListener("resize", handleResize);
5993 cleanup();
5994 };
5995 }
5996 function autoUpdate(reference, floating, update2, options) {
5997 if (options === void 0) {
5998 options = {};
5999 }
6000 const {
6001 ancestorScroll = true,
6002 ancestorResize = true,
6003 elementResize = typeof ResizeObserver === "function",
6004 layoutShift = typeof IntersectionObserver === "function",
6005 animationFrame = false
6006 } = options;
6007 const referenceEl = unwrapElement(reference);
6008 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
6009 ancestors.forEach((ancestor) => {
6010 ancestorScroll && ancestor.addEventListener("scroll", update2);
6011 ancestorResize && ancestor.addEventListener("resize", update2);
6012 });
6013 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null;
6014 let reobserveFrame = -1;
6015 let resizeObserver = null;
6016 if (elementResize) {
6017 resizeObserver = new ResizeObserver((_ref) => {
6018 let [firstEntry] = _ref;
6019 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
6020 resizeObserver.unobserve(floating);
6021 cancelAnimationFrame(reobserveFrame);
6022 reobserveFrame = requestAnimationFrame(() => {
6023 var _resizeObserver;
6024 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
6025 });
6026 }
6027 update2();
6028 });
6029 if (referenceEl && !animationFrame) {
6030 resizeObserver.observe(referenceEl);
6031 }
6032 if (floating) {
6033 resizeObserver.observe(floating);
6034 }
6035 }
6036 let frameId;
6037 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
6038 if (animationFrame) {
6039 frameLoop();
6040 }
6041 function frameLoop() {
6042 const nextRefRect = getBoundingClientRect(reference);
6043 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
6044 update2();
6045 }
6046 prevRefRect = nextRefRect;
6047 frameId = requestAnimationFrame(frameLoop);
6048 }
6049 update2();
6050 return () => {
6051 var _resizeObserver2;
6052 ancestors.forEach((ancestor) => {
6053 ancestorScroll && ancestor.removeEventListener("scroll", update2);
6054 ancestorResize && ancestor.removeEventListener("resize", update2);
6055 });
6056 cleanupIo == null || cleanupIo();
6057 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
6058 resizeObserver = null;
6059 if (animationFrame) {
6060 cancelAnimationFrame(frameId);
6061 }
6062 };
6063 }
6064 var offset2 = offset;
6065 var shift2 = shift;
6066 var flip2 = flip;
6067 var size2 = size;
6068 var limitShift2 = limitShift;
6069 var computePosition2 = (reference, floating, options) => {
6070 const cache = /* @__PURE__ */ new Map();
6071 const mergedOptions = options != null ? options : {};
6072 const platformWithCache = {
6073 ...platform2,
6074 ...mergedOptions.platform,
6075 _c: cache
6076 };
6077 return computePosition(reference, floating, {
6078 ...mergedOptions,
6079 platform: platformWithCache
6080 });
6081 };
6082
6083 // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
6084 var React26 = __toESM(require_react(), 1);
6085 var import_react2 = __toESM(require_react(), 1);
6086 var ReactDOM3 = __toESM(require_react_dom(), 1);
6087 var isClient = typeof document !== "undefined";
6088 var noop2 = function noop3() {
6089 };
6090 var index = isClient ? import_react2.useLayoutEffect : noop2;
6091 function deepEqual(a, b) {
6092 if (a === b) {
6093 return true;
6094 }
6095 if (typeof a !== typeof b) {
6096 return false;
6097 }
6098 if (typeof a === "function" && a.toString() === b.toString()) {
6099 return true;
6100 }
6101 let length;
6102 let i;
6103 let keys;
6104 if (a && b && typeof a === "object") {
6105 if (Array.isArray(a)) {
6106 length = a.length;
6107 if (length !== b.length) return false;
6108 for (i = length; i-- !== 0; ) {
6109 if (!deepEqual(a[i], b[i])) {
6110 return false;
6111 }
6112 }
6113 return true;
6114 }
6115 keys = Object.keys(a);
6116 length = keys.length;
6117 if (length !== Object.keys(b).length) {
6118 return false;
6119 }
6120 for (i = length; i-- !== 0; ) {
6121 if (!{}.hasOwnProperty.call(b, keys[i])) {
6122 return false;
6123 }
6124 }
6125 for (i = length; i-- !== 0; ) {
6126 const key = keys[i];
6127 if (key === "_owner" && a.$$typeof) {
6128 continue;
6129 }
6130 if (!deepEqual(a[key], b[key])) {
6131 return false;
6132 }
6133 }
6134 return true;
6135 }
6136 return a !== a && b !== b;
6137 }
6138 function getDPR(element) {
6139 if (typeof window === "undefined") {
6140 return 1;
6141 }
6142 const win = element.ownerDocument.defaultView || window;
6143 return win.devicePixelRatio || 1;
6144 }
6145 function roundByDPR(element, value) {
6146 const dpr = getDPR(element);
6147 return Math.round(value * dpr) / dpr;
6148 }
6149 function useLatestRef(value) {
6150 const ref = React26.useRef(value);
6151 index(() => {
6152 ref.current = value;
6153 });
6154 return ref;
6155 }
6156 function useFloating(options) {
6157 if (options === void 0) {
6158 options = {};
6159 }
6160 const {
6161 placement = "bottom",
6162 strategy = "absolute",
6163 middleware = [],
6164 platform: platform3,
6165 elements: {
6166 reference: externalReference,
6167 floating: externalFloating
6168 } = {},
6169 transform = true,
6170 whileElementsMounted,
6171 open
6172 } = options;
6173 const [data, setData] = React26.useState({
6174 x: 0,
6175 y: 0,
6176 strategy,
6177 placement,
6178 middlewareData: {},
6179 isPositioned: false
6180 });
6181 const [latestMiddleware, setLatestMiddleware] = React26.useState(middleware);
6182 if (!deepEqual(latestMiddleware, middleware)) {
6183 setLatestMiddleware(middleware);
6184 }
6185 const [_reference, _setReference] = React26.useState(null);
6186 const [_floating, _setFloating] = React26.useState(null);
6187 const setReference = React26.useCallback((node) => {
6188 if (node !== referenceRef.current) {
6189 referenceRef.current = node;
6190 _setReference(node);
6191 }
6192 }, []);
6193 const setFloating = React26.useCallback((node) => {
6194 if (node !== floatingRef.current) {
6195 floatingRef.current = node;
6196 _setFloating(node);
6197 }
6198 }, []);
6199 const referenceEl = externalReference || _reference;
6200 const floatingEl = externalFloating || _floating;
6201 const referenceRef = React26.useRef(null);
6202 const floatingRef = React26.useRef(null);
6203 const dataRef = React26.useRef(data);
6204 const hasWhileElementsMounted = whileElementsMounted != null;
6205 const whileElementsMountedRef = useLatestRef(whileElementsMounted);
6206 const platformRef = useLatestRef(platform3);
6207 const openRef = useLatestRef(open);
6208 const update2 = React26.useCallback(() => {
6209 if (!referenceRef.current || !floatingRef.current) {
6210 return;
6211 }
6212 const config = {
6213 placement,
6214 strategy,
6215 middleware: latestMiddleware
6216 };
6217 if (platformRef.current) {
6218 config.platform = platformRef.current;
6219 }
6220 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
6221 const fullData = {
6222 ...data2,
6223 // The floating element's position may be recomputed while it's closed
6224 // but still mounted (such as when transitioning out). To ensure
6225 // `isPositioned` will be `false` initially on the next open, avoid
6226 // setting it to `true` when `open === false` (must be specified).
6227 isPositioned: openRef.current !== false
6228 };
6229 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
6230 dataRef.current = fullData;
6231 ReactDOM3.flushSync(() => {
6232 setData(fullData);
6233 });
6234 }
6235 });
6236 }, [latestMiddleware, placement, strategy, platformRef, openRef]);
6237 index(() => {
6238 if (open === false && dataRef.current.isPositioned) {
6239 dataRef.current.isPositioned = false;
6240 setData((data2) => ({
6241 ...data2,
6242 isPositioned: false
6243 }));
6244 }
6245 }, [open]);
6246 const isMountedRef = React26.useRef(false);
6247 index(() => {
6248 isMountedRef.current = true;
6249 return () => {
6250 isMountedRef.current = false;
6251 };
6252 }, []);
6253 index(() => {
6254 if (referenceEl) referenceRef.current = referenceEl;
6255 if (floatingEl) floatingRef.current = floatingEl;
6256 if (referenceEl && floatingEl) {
6257 if (whileElementsMountedRef.current) {
6258 return whileElementsMountedRef.current(referenceEl, floatingEl, update2);
6259 }
6260 update2();
6261 }
6262 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]);
6263 const refs = React26.useMemo(() => ({
6264 reference: referenceRef,
6265 floating: floatingRef,
6266 setReference,
6267 setFloating
6268 }), [setReference, setFloating]);
6269 const elements = React26.useMemo(() => ({
6270 reference: referenceEl,
6271 floating: floatingEl
6272 }), [referenceEl, floatingEl]);
6273 const floatingStyles = React26.useMemo(() => {
6274 const initialStyles = {
6275 position: strategy,
6276 left: 0,
6277 top: 0
6278 };
6279 if (!elements.floating) {
6280 return initialStyles;
6281 }
6282 const x = roundByDPR(elements.floating, data.x);
6283 const y = roundByDPR(elements.floating, data.y);
6284 if (transform) {
6285 return {
6286 ...initialStyles,
6287 transform: "translate(" + x + "px, " + y + "px)",
6288 ...getDPR(elements.floating) >= 1.5 && {
6289 willChange: "transform"
6290 }
6291 };
6292 }
6293 return {
6294 position: strategy,
6295 left: x,
6296 top: y
6297 };
6298 }, [strategy, transform, elements.floating, data.x, data.y]);
6299 return React26.useMemo(() => ({
6300 ...data,
6301 update: update2,
6302 refs,
6303 elements,
6304 floatingStyles
6305 }), [data, update2, refs, elements, floatingStyles]);
6306 }
6307 var offset3 = (options, deps) => {
6308 const result = offset2(options);
6309 return {
6310 name: result.name,
6311 fn: result.fn,
6312 options: [options, deps]
6313 };
6314 };
6315 var shift3 = (options, deps) => {
6316 const result = shift2(options);
6317 return {
6318 name: result.name,
6319 fn: result.fn,
6320 options: [options, deps]
6321 };
6322 };
6323 var limitShift3 = (options, deps) => {
6324 const result = limitShift2(options);
6325 return {
6326 fn: result.fn,
6327 options: [options, deps]
6328 };
6329 };
6330 var flip3 = (options, deps) => {
6331 const result = flip2(options);
6332 return {
6333 name: result.name,
6334 fn: result.fn,
6335 options: [options, deps]
6336 };
6337 };
6338 var size3 = (options, deps) => {
6339 const result = size2(options);
6340 return {
6341 name: result.name,
6342 fn: result.fn,
6343 options: [options, deps]
6344 };
6345 };
6346
6347 // node_modules/@base-ui/react/utils/popups/popupHandle.mjs
6348 var BasePopupHandle = class {
6349 /**
6350 * Stores of every root currently using this handle, in attach order. A handle is meant to be used
6351 * by a single mounted root, but roots can transiently overlap (e.g. during an animated route
6352 * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of
6353 * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first.
6354 */
6355 attachedStores = [];
6356 /**
6357 * Store of the root that currently controls the handle: the most recently attached one still
6358 * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`.
6359 */
6360 attachedStoreValue = null;
6361 /**
6362 * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer.
6363 */
6364 storeListeners = /* @__PURE__ */ new Set();
6365 /**
6366 * Creates a handle backed by the store used while no root is attached.
6367 *
6368 * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached,
6369 * so they can render and register without a mounted root. Triggers register into whichever store
6370 * `store` currently resolves to, so while detached they live in this store's trigger map and
6371 * migrate themselves to the root's store (and back) as it attaches/detaches.
6372 * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces
6373 * `MenuHandle.open()` in warning text.
6374 * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is
6375 * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to,
6376 * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning.
6377 */
6378 constructor(fallbackStore, componentName, throwOnMissingTrigger = true) {
6379 this.fallbackStore = fallbackStore;
6380 this.componentName = componentName;
6381 this.throwOnMissingTrigger = throwOnMissingTrigger;
6382 }
6383 get attachedStore() {
6384 return this.attachedStoreValue;
6385 }
6386 /**
6387 * Store that detached triggers read from: the attached root's store, or an inert fallback store
6388 * used while no root is attached.
6389 * @internal
6390 */
6391 get store() {
6392 return this.attachedStoreValue ?? this.fallbackStore;
6393 }
6394 /**
6395 * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on
6396 * the handle during render because a handle can be shared by concurrent server-rendered requests.
6397 * @internal
6398 */
6399 get serverStore() {
6400 return this.fallbackStore;
6401 }
6402 /**
6403 * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind
6404 * when a root attaches or detaches. Returns a function that removes the listener.
6405 * @internal
6406 */
6407 subscribeStore(listener) {
6408 this.storeListeners.add(listener);
6409 return () => {
6410 this.storeListeners.delete(listener);
6411 };
6412 }
6413 /**
6414 * Points the handle at a root's store and notifies subscribers so detached triggers re-render and
6415 * re-register into it (their registration ref re-fires on the store-pointer change). Returns a
6416 * cleanup function that detaches the store again.
6417 * @internal
6418 */
6419 attachStore(newStore) {
6420 this.attachedStores.push(newStore);
6421 this.setActiveStore(newStore);
6422 if (true) {
6423 if (this.attachedStores.length > 1) {
6424 const dev = this;
6425 (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => {
6426 if (this.attachedStores.length > 1) {
6427 console.warn("Base UI: A handle is attached to more than one mounted root at the same time. The most recently mounted root takes over and the previous one stops being controlled by the handle. A handle should be used by a single root that stays mounted for the lifetime of the handle.");
6428 }
6429 });
6430 }
6431 }
6432 return () => {
6433 const index2 = this.attachedStores.lastIndexOf(newStore);
6434 if (index2 !== -1) {
6435 this.attachedStores.splice(index2, 1);
6436 }
6437 this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null);
6438 };
6439 }
6440 /**
6441 * Sets the store that currently controls the handle and notifies subscribers when it changes, so
6442 * detached triggers re-render and migrate their registration to the new store.
6443 */
6444 setActiveStore(store) {
6445 if (this.attachedStoreValue !== store) {
6446 this.attachedStoreValue = store;
6447 this.storeListeners.forEach((listener) => {
6448 listener();
6449 });
6450 }
6451 }
6452 /**
6453 * Opens the attached root's store and associates it with the trigger with the given id, or a
6454 * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public
6455 * `open()` method, which only narrows the parameter type.
6456 *
6457 * When a trigger id is given but no matching trigger is registered, anchored popups throw (see
6458 * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead.
6459 *
6460 * This method should only be called in an event handler or an effect (not during rendering).
6461 *
6462 * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open
6463 * without associating any trigger.
6464 */
6465 openByTrigger(triggerId) {
6466 const attachedStore = this.attachedStore;
6467 if (attachedStore === null) {
6468 if (true) {
6469 console.warn(`Base UI: ${this.componentName}Handle.open() was called while no root using this handle is mounted. The call was ignored; mount a root with this handle before opening it imperatively.`);
6470 }
6471 return;
6472 }
6473 let triggerElement;
6474 if (triggerId) {
6475 for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) {
6476 triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId);
6477 }
6478 triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId);
6479 }
6480 if (triggerId && !triggerElement) {
6481 if (this.throwOnMissingTrigger) {
6482 throw new Error(true ? `Base UI: ${this.componentName}Handle.open() was called with the trigger id "${triggerId}", but no matching trigger is registered with this handle. An anchored popup cannot open without a trigger to anchor to. Pass the id of a mounted ${this.componentName}.Trigger that has this handle set on its "handle" prop.` : formatErrorMessage_default(99, this.componentName, triggerId, this.componentName));
6483 }
6484 if (true) {
6485 console.warn(`Base UI: ${this.componentName}Handle.open: No trigger found with id "${triggerId}". The popup will open, but the trigger will not be associated with it.`);
6486 }
6487 }
6488 attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement));
6489 }
6490 /**
6491 * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning)
6492 * while no root is attached. Shared by every concrete handle's public `close()` method.
6493 *
6494 * This method should only be called in an event handler or an effect (not during rendering).
6495 */
6496 closePopup() {
6497 const attachedStore = this.attachedStore;
6498 if (attachedStore === null) {
6499 if (true) {
6500 console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`);
6501 }
6502 return;
6503 }
6504 attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction));
6505 }
6506 };
6507
6508 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
6509 var React31 = __toESM(require_react(), 1);
6510 var ReactDOM4 = __toESM(require_react_dom(), 1);
6511
6512 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
6513 var React30 = __toESM(require_react(), 1);
6514
6515 // node_modules/@base-ui/utils/store/useStore.mjs
6516 var React28 = __toESM(require_react(), 1);
6517 var import_shim = __toESM(require_shim(), 1);
6518 var import_with_selector = __toESM(require_with_selector(), 1);
6519
6520 // node_modules/@base-ui/utils/fastHooks.mjs
6521 var React27 = __toESM(require_react(), 1);
6522 var hooks = [];
6523 var currentInstance = void 0;
6524 function getInstance() {
6525 return currentInstance;
6526 }
6527 function register(hook) {
6528 hooks.push(hook);
6529 }
6530 function fastComponent(fn) {
6531 const FastComponent = (props, forwardedRef) => {
6532 const instance = useRefWithInit(createInstance).current;
6533 let result;
6534 try {
6535 currentInstance = instance;
6536 for (const hook of hooks) {
6537 hook.before(instance);
6538 }
6539 result = fn(props, forwardedRef);
6540 for (const hook of hooks) {
6541 hook.after(instance);
6542 }
6543 instance.didInitialize = true;
6544 } finally {
6545 currentInstance = void 0;
6546 }
6547 return result;
6548 };
6549 FastComponent.displayName = fn.displayName || fn.name;
6550 return FastComponent;
6551 }
6552 function fastComponentRef(fn) {
6553 return /* @__PURE__ */ React27.forwardRef(fastComponent(fn));
6554 }
6555 function createInstance() {
6556 return {
6557 didInitialize: false
6558 };
6559 }
6560
6561 // node_modules/@base-ui/utils/store/useStore.mjs
6562 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);
6563 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;
6564 function useStore(store, selector, a1, a2, a3) {
6565 return useStoreImplementation(store, selector, a1, a2, a3);
6566 }
6567 function useStoreR19(store, selector, a1, a2, a3) {
6568 const getSelection = React28.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]);
6569 return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection);
6570 }
6571 register({
6572 before(instance) {
6573 instance.syncIndex = 0;
6574 if (!instance.didInitialize) {
6575 instance.syncTick = 1;
6576 instance.syncHooks = [];
6577 instance.didChangeStore = true;
6578 instance.getSnapshot = () => {
6579 let didChange2 = false;
6580 for (let i = 0; i < instance.syncHooks.length; i += 1) {
6581 const hook = instance.syncHooks[i];
6582 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);
6583 if (!Object.is(hook.value, value)) {
6584 didChange2 = true;
6585 hook.value = value;
6586 }
6587 }
6588 if (didChange2) {
6589 instance.syncTick += 1;
6590 }
6591 return instance.syncTick;
6592 };
6593 }
6594 },
6595 after(instance) {
6596 if (instance.syncHooks.length > 0) {
6597 if (instance.didChangeStore) {
6598 instance.didChangeStore = false;
6599 instance.subscribe = (onStoreChange) => {
6600 const stores = /* @__PURE__ */ new Set();
6601 for (const hook of instance.syncHooks) {
6602 stores.add(hook.store);
6603 }
6604 const unsubscribes = [];
6605 for (const store of stores) {
6606 unsubscribes.push(store.subscribe(onStoreChange));
6607 }
6608 return () => {
6609 for (const unsubscribe of unsubscribes) {
6610 unsubscribe();
6611 }
6612 };
6613 };
6614 }
6615 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot);
6616 }
6617 }
6618 });
6619 function useStoreFast(store, selector, a1, a2, a3) {
6620 const instance = getInstance();
6621 if (!instance) {
6622 return useStoreR19(store, selector, a1, a2, a3);
6623 }
6624 const index2 = instance.syncIndex;
6625 instance.syncIndex += 1;
6626 let hook;
6627 if (!instance.didInitialize) {
6628 hook = {
6629 store,
6630 selector,
6631 a1,
6632 a2,
6633 a3,
6634 value: selector(store.getSnapshot(), a1, a2, a3)
6635 };
6636 instance.syncHooks.push(hook);
6637 } else {
6638 hook = instance.syncHooks[index2];
6639 if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {
6640 if (hook.store !== store) {
6641 instance.didChangeStore = true;
6642 }
6643 hook.store = store;
6644 hook.selector = selector;
6645 hook.a1 = a1;
6646 hook.a2 = a2;
6647 hook.a3 = a3;
6648 hook.value = selector(store.getSnapshot(), a1, a2, a3);
6649 }
6650 }
6651 return hook.value;
6652 }
6653 function useStoreLegacy(store, selector, a1, a2, a3) {
6654 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector(state, a1, a2, a3));
6655 }
6656
6657 // node_modules/@base-ui/utils/store/Store.mjs
6658 var Store = class {
6659 /**
6660 * The current state of the store.
6661 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
6662 * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
6663 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
6664 *
6665 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
6666 */
6667 // Internal state to handle recursive `setState()` calls
6668 constructor(state) {
6669 this.state = state;
6670 this.listeners = /* @__PURE__ */ new Set();
6671 this.updateTick = 0;
6672 }
6673 /**
6674 * Registers a listener that will be called whenever the store's state changes.
6675 *
6676 * @param fn The listener function to be called on state changes.
6677 * @returns A function to unsubscribe the listener.
6678 */
6679 subscribe = (fn) => {
6680 this.listeners.add(fn);
6681 return () => {
6682 this.listeners.delete(fn);
6683 };
6684 };
6685 /**
6686 * Returns the current state of the store.
6687 */
6688 getSnapshot = () => {
6689 return this.state;
6690 };
6691 /**
6692 * Updates the entire store's state and notifies all registered listeners.
6693 *
6694 * @param newState The new state to set for the store.
6695 */
6696 setState(newState) {
6697 if (this.state === newState) {
6698 return;
6699 }
6700 this.state = newState;
6701 this.updateTick += 1;
6702 const currentTick = this.updateTick;
6703 for (const listener of this.listeners) {
6704 if (currentTick !== this.updateTick) {
6705 return;
6706 }
6707 listener(newState);
6708 }
6709 }
6710 /**
6711 * Merges the provided changes into the current state and notifies listeners if there are changes.
6712 *
6713 * @param changes An object containing the changes to apply to the current state.
6714 */
6715 update(changes) {
6716 for (const key in changes) {
6717 if (!Object.is(this.state[key], changes[key])) {
6718 this.setState({
6719 ...this.state,
6720 ...changes
6721 });
6722 return;
6723 }
6724 }
6725 }
6726 /**
6727 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
6728 *
6729 * @param key The key in the store's state to update.
6730 * @param value The new value to set for the specified key.
6731 */
6732 set(key, value) {
6733 if (!Object.is(this.state[key], value)) {
6734 this.setState({
6735 ...this.state,
6736 [key]: value
6737 });
6738 }
6739 }
6740 /**
6741 * Gives the state a new reference and updates all registered listeners.
6742 */
6743 notifyAll() {
6744 const newState = {
6745 ...this.state
6746 };
6747 this.setState(newState);
6748 }
6749 use(selector, a1, a2, a3) {
6750 return useStore(this, selector, a1, a2, a3);
6751 }
6752 };
6753
6754 // node_modules/@base-ui/utils/store/ReactStore.mjs
6755 var React29 = __toESM(require_react(), 1);
6756 var ReactStore = class extends Store {
6757 /**
6758 * Creates a new ReactStore instance.
6759 *
6760 * @param state Initial state of the store.
6761 * @param context Non-reactive context values.
6762 * @param selectors Optional selectors for use with `useState`.
6763 */
6764 constructor(state, context = {}, selectors4) {
6765 super(state);
6766 this.context = context;
6767 this.selectors = selectors4;
6768 }
6769 /**
6770 * Non-reactive values such as refs, callbacks, etc.
6771 */
6772 /**
6773 * Synchronizes a single external value into the store.
6774 *
6775 * Note that the while the value in `state` is updated immediately, the value returned
6776 * by `useState` is updated before the next render (similarly to React's `useState`).
6777 */
6778 useSyncedValue(key, value) {
6779 React29.useDebugValue(key);
6780 const store = this;
6781 useIsoLayoutEffect(() => {
6782 if (store.state[key] !== value) {
6783 store.set(key, value);
6784 }
6785 }, [store, key, value]);
6786 }
6787 /**
6788 * Synchronizes a single external value into the store and
6789 * cleans it up (sets to `undefined`) on unmount.
6790 *
6791 * Note that the while the value in `state` is updated immediately, the value returned
6792 * by `useState` is updated before the next render (similarly to React's `useState`).
6793 */
6794 useSyncedValueWithCleanup(key, value) {
6795 const store = this;
6796 useIsoLayoutEffect(() => {
6797 if (store.state[key] !== value) {
6798 store.set(key, value);
6799 }
6800 return () => {
6801 store.set(key, void 0);
6802 };
6803 }, [store, key, value]);
6804 }
6805 /**
6806 * Synchronizes multiple external values into the store.
6807 *
6808 * Note that the while the values in `state` are updated immediately, the values returned
6809 * by `useState` are updated before the next render (similarly to React's `useState`).
6810 */
6811 useSyncedValues(statePart) {
6812 const store = this;
6813 if (true) {
6814 React29.useDebugValue(statePart, (p) => Object.keys(p));
6815 const keys = React29.useRef(Object.keys(statePart)).current;
6816 const nextKeys = Object.keys(statePart);
6817 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) {
6818 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
6819 }
6820 }
6821 const dependencies = Object.values(statePart);
6822 useIsoLayoutEffect(() => {
6823 store.update(statePart);
6824 }, [store, ...dependencies]);
6825 }
6826 /**
6827 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
6828 * is non-undefined, the store's state at `key` is updated to match `controlled`.
6829 */
6830 useControlledProp(key, controlled) {
6831 React29.useDebugValue(key);
6832 const store = this;
6833 const isControlled = controlled !== void 0;
6834 useIsoLayoutEffect(() => {
6835 if (isControlled && !Object.is(store.state[key], controlled)) {
6836 store.setState({
6837 ...store.state,
6838 [key]: controlled
6839 });
6840 }
6841 }, [store, key, controlled, isControlled]);
6842 if (true) {
6843 const cache = this.controlledValues ??= /* @__PURE__ */ new Map();
6844 if (!cache.has(key)) {
6845 cache.set(key, isControlled);
6846 }
6847 const previouslyControlled = cache.get(key);
6848 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) {
6849 console.error(`A component is changing the ${isControlled ? "" : "un"}controlled state of ${key.toString()} to be ${isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
6850 }
6851 }
6852 }
6853 /** Gets the current value from the store using a selector with the provided key.
6854 *
6855 * @param key Key of the selector to use.
6856 */
6857 select(key, a1, a2, a3) {
6858 const selector = this.selectors[key];
6859 return selector(this.state, a1, a2, a3);
6860 }
6861 /**
6862 * Returns a value from the store's state using a selector function.
6863 * Used to subscribe to specific parts of the state.
6864 * This methods causes a rerender whenever the selected state changes.
6865 *
6866 * @param key Key of the selector to use.
6867 */
6868 useState(key, a1, a2, a3) {
6869 React29.useDebugValue(key);
6870 return useStore(this, this.selectors[key], a1, a2, a3);
6871 }
6872 /**
6873 * Wraps a function with `useStableCallback` to ensure it has a stable reference
6874 * and assigns it to the context.
6875 *
6876 * @param key Key of the event callback. Must be a function in the context.
6877 * @param fn Function to assign.
6878 */
6879 useContextCallback(key, fn) {
6880 React29.useDebugValue(key);
6881 const stableFunction = useStableCallback(fn ?? NOOP);
6882 this.context[key] = stableFunction;
6883 }
6884 /**
6885 * Returns a stable setter function for a specific key in the store's state.
6886 * It's commonly used to pass as a ref callback to React elements.
6887 *
6888 * @param key Key of the state to set.
6889 */
6890 useStateSetter(key) {
6891 const ref = React29.useRef(void 0);
6892 if (ref.current === void 0) {
6893 ref.current = (value) => {
6894 this.set(key, value);
6895 };
6896 }
6897 return ref.current;
6898 }
6899 /**
6900 * Observes changes derived from the store's selectors and calls the listener when the selected value changes.
6901 *
6902 * @param key Key of the selector to observe.
6903 * @param listener Listener function called when the selector result changes.
6904 */
6905 observe(selector, listener) {
6906 let selectFn;
6907 if (typeof selector === "function") {
6908 selectFn = selector;
6909 } else {
6910 selectFn = this.selectors[selector];
6911 }
6912 let prevValue = selectFn(this.state);
6913 listener(prevValue, prevValue, this);
6914 return this.subscribe((nextState) => {
6915 const nextValue = selectFn(nextState);
6916 if (!Object.is(prevValue, nextValue)) {
6917 const oldValue = prevValue;
6918 prevValue = nextValue;
6919 listener(nextValue, oldValue, this);
6920 }
6921 });
6922 }
6923 };
6924
6925 // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs
6926 var selectors = {
6927 open: (state) => state.open,
6928 transitionStatus: (state) => state.transitionStatus,
6929 domReferenceElement: (state) => state.domReferenceElement,
6930 referenceElement: (state) => state.positionReference ?? state.referenceElement,
6931 floatingElement: (state) => state.floatingElement,
6932 floatingId: (state) => state.floatingId
6933 };
6934 var FloatingRootStore = class extends ReactStore {
6935 constructor(options) {
6936 const {
6937 syncOnly,
6938 nested,
6939 onOpenChange,
6940 triggerElements,
6941 ...initialState
6942 } = options;
6943 super({
6944 ...initialState,
6945 positionReference: initialState.referenceElement,
6946 domReferenceElement: initialState.referenceElement
6947 }, {
6948 onOpenChange,
6949 dataRef: {
6950 current: {}
6951 },
6952 events: createEventEmitter(),
6953 nested,
6954 triggerElements
6955 }, selectors);
6956 this.syncOnly = syncOnly;
6957 }
6958 /**
6959 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.
6960 */
6961 syncOpenEvent = (newOpen, event) => {
6962 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
6963 // click events to upgrade a hover-open.
6964 event != null && isClickLikeEvent(event)) {
6965 this.context.dataRef.current.openEvent = newOpen ? event : void 0;
6966 }
6967 };
6968 /**
6969 * Runs the root-owned side effects for an open state change.
6970 */
6971 dispatchOpenChange = (newOpen, eventDetails) => {
6972 this.syncOpenEvent(newOpen, eventDetails.event);
6973 const details = {
6974 open: newOpen,
6975 reason: eventDetails.reason,
6976 nativeEvent: eventDetails.event,
6977 nested: this.context.nested,
6978 triggerElement: eventDetails.trigger
6979 };
6980 this.context.events.emit("openchange", details);
6981 };
6982 /**
6983 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
6984 *
6985 * @param newOpen The new open state.
6986 * @param eventDetails Details about the event that triggered the open state change.
6987 */
6988 setOpen = (newOpen, eventDetails) => {
6989 if (this.syncOnly) {
6990 this.context.onOpenChange?.(newOpen, eventDetails);
6991 return;
6992 }
6993 this.dispatchOpenChange(newOpen, eventDetails);
6994 this.context.onOpenChange?.(newOpen, eventDetails);
6995 };
6996 };
6997
6998 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
6999 function useSyncedFloatingRootContext(options) {
7000 const {
7001 popupStore,
7002 treatPopupAsFloatingElement = false,
7003 floatingRootContext: floatingRootContextProp,
7004 floatingId,
7005 nested,
7006 onOpenChange
7007 } = options;
7008 const open = popupStore.useState("open");
7009 const referenceElement = popupStore.useState("activeTriggerElement");
7010 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement");
7011 const triggerElements = popupStore.context.triggerElements;
7012 const handleOpenChange = onOpenChange;
7013 const internalStoreRef = React30.useRef(null);
7014 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) {
7015 internalStoreRef.current = new FloatingRootStore({
7016 open,
7017 transitionStatus: void 0,
7018 referenceElement,
7019 floatingElement,
7020 triggerElements,
7021 onOpenChange: handleOpenChange,
7022 floatingId,
7023 syncOnly: true,
7024 nested
7025 });
7026 }
7027 const store = floatingRootContextProp ?? internalStoreRef.current;
7028 popupStore.useSyncedValue("floatingId", floatingId);
7029 useIsoLayoutEffect(() => {
7030 const valuesToSync = {
7031 open,
7032 floatingId,
7033 referenceElement,
7034 floatingElement
7035 };
7036 if (isElement(referenceElement)) {
7037 valuesToSync.domReferenceElement = referenceElement;
7038 }
7039 if (store.state.positionReference === store.state.referenceElement) {
7040 valuesToSync.positionReference = referenceElement;
7041 }
7042 store.update(valuesToSync);
7043 }, [open, floatingId, referenceElement, floatingElement, store]);
7044 store.context.onOpenChange = handleOpenChange;
7045 store.context.nested = nested;
7046 return store;
7047 }
7048
7049 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
7050 var FOCUSABLE_POPUP_PROPS = {
7051 tabIndex: -1,
7052 [FOCUSABLE_ATTRIBUTE]: ""
7053 };
7054 function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) {
7055 const floatingId = useId();
7056 const nested = useFloatingParentNodeId() != null;
7057 const store = useRefWithInit(() => createStore(floatingId, nested)).current;
7058 useSyncedFloatingRootContext({
7059 popupStore: store,
7060 treatPopupAsFloatingElement,
7061 floatingRootContext: store.state.floatingRootContext,
7062 floatingId,
7063 nested,
7064 onOpenChange: store.setOpen
7065 });
7066 return store;
7067 }
7068 function PopupHandleAttachment({
7069 handle,
7070 store
7071 }) {
7072 useIsoLayoutEffect(() => {
7073 return handle.attachStore(store);
7074 }, [handle, store]);
7075 return null;
7076 }
7077 function useTriggerRegistration(id, store) {
7078 const registeredElementIdRef = React31.useRef(null);
7079 const registeredElementRef = React31.useRef(null);
7080 return React31.useCallback((element) => {
7081 if (id === void 0) {
7082 return;
7083 }
7084 let shouldSyncTriggerCount = false;
7085 if (registeredElementIdRef.current !== null) {
7086 const registeredId = registeredElementIdRef.current;
7087 const registeredElement = registeredElementRef.current;
7088 const currentElement = store.context.triggerElements.getById(registeredId);
7089 if (registeredElement && currentElement === registeredElement) {
7090 store.context.triggerElements.delete(registeredId);
7091 shouldSyncTriggerCount = true;
7092 }
7093 registeredElementIdRef.current = null;
7094 registeredElementRef.current = null;
7095 }
7096 if (element !== null) {
7097 registeredElementIdRef.current = id;
7098 registeredElementRef.current = element;
7099 store.context.triggerElements.add(id, element);
7100 shouldSyncTriggerCount = true;
7101 }
7102 if (shouldSyncTriggerCount) {
7103 const triggerCount = store.context.triggerElements.size;
7104 if (store.select("open") && store.state.triggerCount !== triggerCount) {
7105 store.set("triggerCount", triggerCount);
7106 }
7107 }
7108 }, [store, id]);
7109 }
7110 function setPopupOpenState(state, open, trigger, preventUnmountOnClose = false) {
7111 if (open) {
7112 state.preventUnmountingOnClose = false;
7113 } else if (preventUnmountOnClose) {
7114 state.preventUnmountingOnClose = true;
7115 }
7116 const triggerId = trigger?.id ?? null;
7117 if (triggerId || open) {
7118 state.activeTriggerId = triggerId;
7119 state.activeTriggerElement = trigger ?? null;
7120 }
7121 }
7122 function attachPreventUnmountOnClose(eventDetails) {
7123 let preventUnmountOnClose = false;
7124 eventDetails.preventUnmountOnClose = () => {
7125 preventUnmountOnClose = true;
7126 };
7127 return () => preventUnmountOnClose;
7128 }
7129 function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) {
7130 const reason = eventDetails.reason;
7131 const isHover = reason === reason_parts_exports.triggerHover;
7132 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus;
7133 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey);
7134 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
7135 store.context.onOpenChange?.(nextOpen, eventDetails);
7136 if (eventDetails.isCanceled) {
7137 return;
7138 }
7139 options.onBeforeDispatch?.();
7140 store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
7141 const changeState = () => {
7142 const updatedState = {
7143 ...options.extraState,
7144 open: nextOpen
7145 };
7146 if (isFocusOpen) {
7147 updatedState.instantType = "focus";
7148 } else if (isDismissClose) {
7149 updatedState.instantType = "dismiss";
7150 } else if (isHover) {
7151 updatedState.instantType = void 0;
7152 }
7153 setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
7154 store.update(updatedState);
7155 };
7156 if (isHover) {
7157 ReactDOM4.flushSync(changeState);
7158 } else {
7159 changeState();
7160 }
7161 }
7162 function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) {
7163 const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId);
7164 const baseRegisterTrigger = useTriggerRegistration(triggerId, store);
7165 const applyTriggerData = useStableCallback((element) => {
7166 const open = store.select("open");
7167 const activeTriggerId = store.select("activeTriggerId");
7168 if (activeTriggerId === triggerId) {
7169 store.update({
7170 activeTriggerElement: element,
7171 ...open ? stateUpdates : null
7172 });
7173 return;
7174 }
7175 if (activeTriggerId == null && open) {
7176 store.update({
7177 activeTriggerId: triggerId,
7178 activeTriggerElement: element,
7179 ...stateUpdates
7180 });
7181 }
7182 });
7183 const registerTrigger = React31.useCallback((element) => {
7184 baseRegisterTrigger(element);
7185 if (element) {
7186 applyTriggerData(element);
7187 }
7188 }, [baseRegisterTrigger, applyTriggerData]);
7189 useIsoLayoutEffect(() => {
7190 if (isMountedByThisTrigger) {
7191 store.update({
7192 activeTriggerElement: triggerElementRef.current,
7193 ...stateUpdates
7194 });
7195 }
7196 }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]);
7197 return {
7198 registerTrigger,
7199 isMountedByThisTrigger
7200 };
7201 }
7202 function useImplicitActiveTrigger(store, options = {}) {
7203 const {
7204 closeOnActiveTriggerUnmount = false
7205 } = options;
7206 const resolvedActiveTriggerIdRef = React31.useRef(null);
7207 const open = store.useState("open");
7208 const reactiveTriggerCount = store.useState("triggerCount");
7209 const activeTriggerId = store.useState("activeTriggerId");
7210 const reactiveActiveTriggerElement = store.useState("activeTriggerElement");
7211 useIsoLayoutEffect(() => {
7212 if (!open) {
7213 resolvedActiveTriggerIdRef.current = null;
7214 if (store.state.triggerCount !== 0) {
7215 store.set("triggerCount", 0);
7216 }
7217 return;
7218 }
7219 const triggerCount = store.context.triggerElements.size;
7220 const stateUpdates = {};
7221 if (store.state.triggerCount !== triggerCount) {
7222 stateUpdates.triggerCount = triggerCount;
7223 }
7224 const currentActiveTriggerId = store.select("activeTriggerId");
7225 let lostActiveTriggerId = null;
7226 if (currentActiveTriggerId) {
7227 const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId);
7228 if (!activeTriggerElement) {
7229 for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) {
7230 if (triggerElement === store.state.activeTriggerElement) {
7231 stateUpdates.activeTriggerId = triggerId;
7232 stateUpdates.activeTriggerElement = triggerElement;
7233 resolvedActiveTriggerIdRef.current = triggerId;
7234 break;
7235 }
7236 }
7237 if (stateUpdates.activeTriggerId === void 0) {
7238 if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) {
7239 lostActiveTriggerId = currentActiveTriggerId;
7240 } else {
7241 resolvedActiveTriggerIdRef.current = null;
7242 }
7243 }
7244 } else {
7245 resolvedActiveTriggerIdRef.current = currentActiveTriggerId;
7246 if (activeTriggerElement !== store.state.activeTriggerElement) {
7247 stateUpdates.activeTriggerElement = activeTriggerElement;
7248 }
7249 }
7250 } else {
7251 resolvedActiveTriggerIdRef.current = null;
7252 }
7253 if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) {
7254 const iteratorResult = store.context.triggerElements.entries().next();
7255 if (!iteratorResult.done) {
7256 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;
7257 stateUpdates.activeTriggerId = implicitTriggerId;
7258 stateUpdates.activeTriggerElement = implicitTriggerElement;
7259 resolvedActiveTriggerIdRef.current = implicitTriggerId;
7260 }
7261 }
7262 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) {
7263 store.update(stateUpdates);
7264 }
7265 if (lostActiveTriggerId) {
7266 if (closeOnActiveTriggerUnmount) {
7267 queueMicrotask(() => {
7268 if (store.select("open") && store.select("activeTriggerId") === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) {
7269 const eventDetails = createChangeEventDetails(reason_parts_exports.none);
7270 store.setOpen(false, eventDetails);
7271 if (!eventDetails.isCanceled) {
7272 store.update({
7273 activeTriggerId: null,
7274 activeTriggerElement: null
7275 });
7276 }
7277 }
7278 });
7279 }
7280 }
7281 }, [open, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]);
7282 }
7283 function useOpenStateTransitions(open, store, onUnmount) {
7284 const {
7285 mounted,
7286 setMounted,
7287 transitionStatus
7288 } = useTransitionStatus(open);
7289 const preventUnmountingOnClose = store.useState("preventUnmountingOnClose");
7290 const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose;
7291 store.useSyncedValues({
7292 mounted,
7293 transitionStatus,
7294 preventUnmountingOnClose: syncedPreventUnmountingOnClose
7295 });
7296 const forceUnmount = useStableCallback(() => {
7297 setMounted(false);
7298 store.update({
7299 activeTriggerId: null,
7300 activeTriggerElement: null,
7301 mounted: false,
7302 preventUnmountingOnClose: false
7303 });
7304 onUnmount?.();
7305 store.context.onOpenChangeComplete?.(false);
7306 });
7307 useOpenChangeComplete({
7308 enabled: mounted && !open && !syncedPreventUnmountingOnClose,
7309 open,
7310 ref: store.context.popupRef,
7311 onComplete() {
7312 if (!open) {
7313 forceUnmount();
7314 }
7315 }
7316 });
7317 return {
7318 forceUnmount,
7319 transitionStatus
7320 };
7321 }
7322 function usePopupInteractionProps(store, statePart) {
7323 store.useSyncedValues(statePart);
7324 useIsoLayoutEffect(() => () => {
7325 store.update({
7326 activeTriggerProps: EMPTY_OBJECT,
7327 inactiveTriggerProps: EMPTY_OBJECT,
7328 popupProps: EMPTY_OBJECT
7329 });
7330 }, [store]);
7331 }
7332
7333 // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs
7334 var devElementIdsByMap;
7335 function getDevElementIds(map) {
7336 devElementIdsByMap ??= /* @__PURE__ */ new WeakMap();
7337 let elementIds = devElementIdsByMap.get(map);
7338 if (!elementIds) {
7339 elementIds = /* @__PURE__ */ new WeakMap();
7340 devElementIdsByMap.set(map, elementIds);
7341 }
7342 return elementIds;
7343 }
7344 var PopupTriggerMap = class {
7345 constructor() {
7346 this.idMap = /* @__PURE__ */ new Map();
7347 }
7348 /**
7349 * Adds a trigger element with the given ID.
7350 *
7351 * Note: The provided element is assumed to not be registered under multiple IDs.
7352 */
7353 add(id, element) {
7354 if (true) {
7355 const elementIds = getDevElementIds(this);
7356 const existingId = elementIds.get(element);
7357 if (existingId !== void 0 && existingId !== id) {
7358 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");
7359 }
7360 const previousElement = this.idMap.get(id);
7361 if (previousElement !== void 0 && previousElement !== element) {
7362 elementIds.delete(previousElement);
7363 }
7364 elementIds.set(element, id);
7365 }
7366 this.idMap.set(id, element);
7367 }
7368 /**
7369 * Removes the trigger element with the given ID.
7370 */
7371 delete(id) {
7372 if (true) {
7373 const element = this.idMap.get(id);
7374 if (element !== void 0) {
7375 devElementIdsByMap?.get(this)?.delete(element);
7376 }
7377 }
7378 this.idMap.delete(id);
7379 }
7380 /**
7381 * Whether the given element is registered as a trigger.
7382 */
7383 hasElement(element) {
7384 for (const registered of this.idMap.values()) {
7385 if (registered === element) {
7386 return true;
7387 }
7388 }
7389 return false;
7390 }
7391 /**
7392 * Whether there is a registered trigger element matching the given predicate.
7393 */
7394 hasMatchingElement(predicate) {
7395 for (const element of this.idMap.values()) {
7396 if (predicate(element)) {
7397 return true;
7398 }
7399 }
7400 return false;
7401 }
7402 /**
7403 * Returns the trigger element associated with the given ID, or undefined if no such element exists.
7404 */
7405 getById(id) {
7406 return this.idMap.get(id);
7407 }
7408 /**
7409 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].
7410 */
7411 entries() {
7412 return this.idMap.entries();
7413 }
7414 /**
7415 * Returns an iterable of all registered trigger elements.
7416 */
7417 elements() {
7418 return this.idMap.values();
7419 }
7420 /**
7421 * Returns the number of registered trigger elements.
7422 */
7423 get size() {
7424 return this.idMap.size;
7425 }
7426 };
7427
7428 // node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs
7429 function getEmptyRootContext() {
7430 return new FloatingRootStore({
7431 open: false,
7432 transitionStatus: void 0,
7433 floatingElement: null,
7434 referenceElement: null,
7435 triggerElements: new PopupTriggerMap(),
7436 floatingId: void 0,
7437 syncOnly: false,
7438 nested: false,
7439 onOpenChange: void 0
7440 });
7441 }
7442
7443 // node_modules/@base-ui/react/utils/popups/store.mjs
7444 function createInitialPopupStoreState() {
7445 return {
7446 open: false,
7447 openProp: void 0,
7448 mounted: false,
7449 transitionStatus: void 0,
7450 floatingRootContext: getEmptyRootContext(),
7451 floatingId: void 0,
7452 triggerCount: 0,
7453 preventUnmountingOnClose: false,
7454 payload: void 0,
7455 activeTriggerId: null,
7456 activeTriggerElement: null,
7457 triggerIdProp: void 0,
7458 popupElement: null,
7459 positionerElement: null,
7460 activeTriggerProps: EMPTY_OBJECT,
7461 inactiveTriggerProps: EMPTY_OBJECT,
7462 popupProps: EMPTY_OBJECT
7463 };
7464 }
7465 function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) {
7466 return new FloatingRootStore({
7467 open: false,
7468 transitionStatus: void 0,
7469 floatingElement: null,
7470 referenceElement: null,
7471 triggerElements,
7472 floatingId,
7473 syncOnly: true,
7474 nested,
7475 onOpenChange: void 0
7476 });
7477 }
7478 var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId;
7479 var openSelector = (state) => state.openProp ?? state.open;
7480 var popupIdSelector = (state) => {
7481 const popupId = state.popupElement?.id ?? state.floatingId;
7482 return popupId || void 0;
7483 };
7484 function triggerOwnsOpenPopup(state, triggerId) {
7485 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId;
7486 }
7487 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {
7488 if (triggerOwnsOpenPopup(state, triggerId)) {
7489 return true;
7490 }
7491 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1;
7492 }
7493 var popupStoreSelectors = {
7494 open: openSelector,
7495 mounted: (state) => state.mounted,
7496 transitionStatus: (state) => state.transitionStatus,
7497 floatingRootContext: (state) => state.floatingRootContext,
7498 triggerCount: (state) => state.triggerCount,
7499 preventUnmountingOnClose: (state) => state.preventUnmountingOnClose,
7500 payload: (state) => state.payload,
7501 activeTriggerId: activeTriggerIdSelector,
7502 activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null,
7503 popupId: popupIdSelector,
7504 /**
7505 * Whether the trigger with the given ID was used to open the popup.
7506 */
7507 isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId,
7508 /**
7509 * Whether the popup is open and was activated by a trigger with the given ID.
7510 */
7511 isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId),
7512 /**
7513 * Whether the popup is mounted and was activated by a trigger with the given ID.
7514 */
7515 isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted,
7516 triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps,
7517 /**
7518 * Popup id for the trigger that currently owns the open popup.
7519 */
7520 triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0,
7521 popupProps: (state) => state.popupProps,
7522 popupElement: (state) => state.popupElement,
7523 positionerElement: (state) => state.positionerElement
7524 };
7525
7526 // node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs
7527 var React32 = __toESM(require_react(), 1);
7528 var import_shim2 = __toESM(require_shim(), 1);
7529 function usePopupHandleStore(handle) {
7530 const subscribe = React32.useCallback((listener) => {
7531 if (handle === void 0) {
7532 return NOOP;
7533 }
7534 return handle.subscribeStore(listener);
7535 }, [handle]);
7536 const getSnapshot = React32.useCallback(() => {
7537 return handle === void 0 ? void 0 : handle.store;
7538 }, [handle]);
7539 return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore);
7540 }
7541
7542 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs
7543 function useFloatingRootContext(options) {
7544 const {
7545 open = false,
7546 onOpenChange,
7547 elements = {}
7548 } = options;
7549 const floatingId = useId();
7550 const nested = useFloatingParentNodeId() != null;
7551 if (true) {
7552 const optionDomReference = elements.reference;
7553 if (optionDomReference && !isElement(optionDomReference)) {
7554 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead.");
7555 }
7556 }
7557 const store = useRefWithInit(() => new FloatingRootStore({
7558 open,
7559 transitionStatus: void 0,
7560 onOpenChange,
7561 referenceElement: elements.reference ?? null,
7562 floatingElement: elements.floating ?? null,
7563 triggerElements: new PopupTriggerMap(),
7564 floatingId,
7565 syncOnly: false,
7566 nested
7567 })).current;
7568 useIsoLayoutEffect(() => {
7569 const valuesToSync = {
7570 open,
7571 floatingId
7572 };
7573 if (elements.reference !== void 0) {
7574 valuesToSync.referenceElement = elements.reference;
7575 valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;
7576 }
7577 if (elements.floating !== void 0) {
7578 valuesToSync.floatingElement = elements.floating;
7579 }
7580 store.update(valuesToSync);
7581 }, [open, floatingId, elements.reference, elements.floating, store]);
7582 store.context.onOpenChange = onOpenChange;
7583 store.context.nested = nested;
7584 return store;
7585 }
7586
7587 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
7588 function useBaseUIFloating(options) {
7589 return useFloatingWithStore(options, options.rootContext);
7590 }
7591 function useFloatingWithStore(options, store) {
7592 const {
7593 nodeId,
7594 externalTree
7595 } = options;
7596 const referenceElement = store.useState("referenceElement");
7597 const floatingElement = store.useState("floatingElement");
7598 const domReferenceElement = store.useState("domReferenceElement");
7599 const open = store.useState("open");
7600 const floatingId = store.useState("floatingId");
7601 const [positionReference, setPositionReferenceRaw] = React33.useState(null);
7602 const [localDomReference, setLocalDomReference] = React33.useState(void 0);
7603 const [localFloatingElement, setLocalFloatingElement] = React33.useState(void 0);
7604 const domReferenceRef = React33.useRef(null);
7605 const tree = useFloatingTree(externalTree);
7606 const storeElements = React33.useMemo(() => ({
7607 reference: referenceElement,
7608 floating: floatingElement,
7609 domReference: domReferenceElement
7610 }), [referenceElement, floatingElement, domReferenceElement]);
7611 const position = useFloating({
7612 ...options,
7613 elements: {
7614 ...storeElements,
7615 ...positionReference && {
7616 reference: positionReference
7617 }
7618 }
7619 });
7620 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;
7621 const syncedFloatingElement = localFloatingElement === void 0 ? store.state.floatingElement : localFloatingElement;
7622 store.useSyncedValue("referenceElement", localDomReference ?? null);
7623 store.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement);
7624 store.useSyncedValue("floatingElement", syncedFloatingElement);
7625 const setPositionReference = React33.useCallback((node) => {
7626 const computedPositionReference = isElement(node) ? {
7627 getBoundingClientRect: () => node.getBoundingClientRect(),
7628 getClientRects: () => node.getClientRects(),
7629 contextElement: node
7630 } : node;
7631 setPositionReferenceRaw(computedPositionReference);
7632 position.refs.setReference(computedPositionReference);
7633 }, [position.refs]);
7634 const setReference = React33.useCallback((node) => {
7635 if (isElement(node) || node === null) {
7636 domReferenceRef.current = node;
7637 setLocalDomReference(node);
7638 }
7639 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
7640 // `null` to support `positionReference` + an unstable `reference`
7641 // callback ref.
7642 node !== null && !isElement(node)) {
7643 position.refs.setReference(node);
7644 }
7645 }, [position.refs, setLocalDomReference]);
7646 const setFloating = React33.useCallback((node) => {
7647 setLocalFloatingElement(node);
7648 position.refs.setFloating(node);
7649 }, [position.refs]);
7650 const refs = React33.useMemo(() => ({
7651 ...position.refs,
7652 setReference,
7653 setFloating,
7654 setPositionReference,
7655 domReference: domReferenceRef
7656 }), [position.refs, setReference, setFloating, setPositionReference]);
7657 const elements = React33.useMemo(() => ({
7658 ...position.elements,
7659 domReference: domReferenceElement
7660 }), [position.elements, domReferenceElement]);
7661 const context = React33.useMemo(() => ({
7662 ...position,
7663 dataRef: store.context.dataRef,
7664 open,
7665 onOpenChange: store.setOpen,
7666 events: store.context.events,
7667 floatingId,
7668 refs,
7669 elements,
7670 nodeId,
7671 rootStore: store
7672 }), [position, refs, elements, nodeId, store, open, floatingId]);
7673 useIsoLayoutEffect(() => {
7674 if (domReferenceElement) {
7675 domReferenceRef.current = domReferenceElement;
7676 }
7677 }, [domReferenceElement]);
7678 useIsoLayoutEffect(() => {
7679 store.context.dataRef.current.floatingContext = context;
7680 const node = tree?.nodesRef.current.find((n) => n.id === nodeId);
7681 if (node) {
7682 node.context = context;
7683 }
7684 });
7685 return React33.useMemo(() => ({
7686 ...position,
7687 context,
7688 refs,
7689 elements,
7690 rootStore: store
7691 }), [position, refs, elements, context, store]);
7692 }
7693
7694 // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs
7695 var React34 = __toESM(require_react(), 1);
7696 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit;
7697 function useFocus(context, props = {}) {
7698 const {
7699 enabled = true,
7700 delay
7701 } = props;
7702 const store = "rootStore" in context ? context.rootStore : context;
7703 const {
7704 events,
7705 dataRef
7706 } = store.context;
7707 const blockFocusRef = React34.useRef(false);
7708 const blockedReferenceRef = React34.useRef(null);
7709 const keyboardModalityRef = React34.useRef(true);
7710 const timeout = useTimeout();
7711 React34.useEffect(() => {
7712 const domReference = store.select("domReferenceElement");
7713 if (!enabled) {
7714 return void 0;
7715 }
7716 const win = getWindow(domReference);
7717 function onBlur() {
7718 const currentDomReference = store.select("domReferenceElement");
7719 if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) {
7720 blockFocusRef.current = true;
7721 }
7722 }
7723 function onKeyDown() {
7724 keyboardModalityRef.current = true;
7725 }
7726 function onPointerDown() {
7727 keyboardModalityRef.current = false;
7728 }
7729 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true));
7730 }, [store, enabled]);
7731 React34.useEffect(() => {
7732 if (!enabled) {
7733 return void 0;
7734 }
7735 function onOpenChangeLocal(details) {
7736 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) {
7737 const referenceElement = store.select("domReferenceElement");
7738 if (isElement(referenceElement)) {
7739 blockedReferenceRef.current = referenceElement;
7740 blockFocusRef.current = true;
7741 }
7742 }
7743 }
7744 events.on("openchange", onOpenChangeLocal);
7745 return () => {
7746 events.off("openchange", onOpenChangeLocal);
7747 };
7748 }, [events, enabled, store]);
7749 const reference = React34.useMemo(() => {
7750 function resetBlockedFocus() {
7751 blockFocusRef.current = false;
7752 blockedReferenceRef.current = null;
7753 }
7754 return {
7755 onMouseLeave() {
7756 resetBlockedFocus();
7757 },
7758 onFocus(event) {
7759 const focusTarget = event.currentTarget;
7760 if (blockFocusRef.current) {
7761 if (blockedReferenceRef.current === focusTarget) {
7762 return;
7763 }
7764 resetBlockedFocus();
7765 }
7766 const target = getTarget(event.nativeEvent);
7767 if (isElement(target)) {
7768 if (isMacSafari && !event.relatedTarget) {
7769 if (!keyboardModalityRef.current && !isTypeableElement(target)) {
7770 return;
7771 }
7772 } else if (!matchesFocusVisible(target)) {
7773 return;
7774 }
7775 }
7776 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements);
7777 const {
7778 nativeEvent,
7779 currentTarget
7780 } = event;
7781 const delayValue = typeof delay === "function" ? delay() : delay;
7782 if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) {
7783 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
7784 return;
7785 }
7786 timeout.start(delayValue, () => {
7787 if (blockFocusRef.current) {
7788 return;
7789 }
7790 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
7791 });
7792 },
7793 onBlur(event) {
7794 resetBlockedFocus();
7795 const relatedTarget = event.relatedTarget;
7796 const nativeEvent = event.nativeEvent;
7797 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
7798 timeout.start(0, () => {
7799 const domReference = store.select("domReferenceElement");
7800 const activeEl = activeElement(ownerDocument(domReference));
7801 if (!relatedTarget && activeEl === domReference) {
7802 return;
7803 }
7804 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) {
7805 return;
7806 }
7807 const nextFocusedElement = relatedTarget ?? activeEl;
7808 if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) {
7809 return;
7810 }
7811 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent));
7812 });
7813 }
7814 };
7815 }, [dataRef, delay, store, timeout]);
7816 return React34.useMemo(() => enabled ? {
7817 reference,
7818 trigger: reference
7819 } : {}, [enabled, reference]);
7820 }
7821
7822 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
7823 var React35 = __toESM(require_react(), 1);
7824
7825 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs
7826 var HoverInteraction = class _HoverInteraction {
7827 constructor() {
7828 this.pointerType = void 0;
7829 this.interactedInside = false;
7830 this.handler = void 0;
7831 this.blockMouseMove = true;
7832 this.performedPointerEventsMutation = false;
7833 this.pointerEventsScopeElement = null;
7834 this.pointerEventsReferenceElement = null;
7835 this.pointerEventsFloatingElement = null;
7836 this.restTimeoutPending = false;
7837 this.openChangeTimeout = new Timeout();
7838 this.restTimeout = new Timeout();
7839 this.handleCloseOptions = void 0;
7840 }
7841 static create() {
7842 return new _HoverInteraction();
7843 }
7844 dispose = () => {
7845 this.openChangeTimeout.clear();
7846 this.restTimeout.clear();
7847 };
7848 disposeEffect = () => {
7849 return this.dispose;
7850 };
7851 };
7852 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap();
7853 function clearSafePolygonPointerEventsMutation(instance) {
7854 if (!instance.performedPointerEventsMutation) {
7855 return;
7856 }
7857 const scopeElement = instance.pointerEventsScopeElement;
7858 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {
7859 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events");
7860 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events");
7861 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events");
7862 pointerEventsMutationOwnerByScopeElement.delete(scopeElement);
7863 }
7864 instance.performedPointerEventsMutation = false;
7865 instance.pointerEventsScopeElement = null;
7866 instance.pointerEventsReferenceElement = null;
7867 instance.pointerEventsFloatingElement = null;
7868 }
7869 function applySafePolygonPointerEventsMutation(instance, options) {
7870 const {
7871 scopeElement,
7872 referenceElement,
7873 floatingElement
7874 } = options;
7875 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);
7876 if (existingOwner && existingOwner !== instance) {
7877 clearSafePolygonPointerEventsMutation(existingOwner);
7878 }
7879 clearSafePolygonPointerEventsMutation(instance);
7880 instance.performedPointerEventsMutation = true;
7881 instance.pointerEventsScopeElement = scopeElement;
7882 instance.pointerEventsReferenceElement = referenceElement;
7883 instance.pointerEventsFloatingElement = floatingElement;
7884 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);
7885 scopeElement.style.pointerEvents = "none";
7886 referenceElement.style.pointerEvents = "auto";
7887 floatingElement.style.pointerEvents = "auto";
7888 }
7889 function useHoverInteractionSharedState(store) {
7890 const data = store.context.dataRef.current;
7891 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current;
7892 if (!data.hoverInteractionState) {
7893 data.hoverInteractionState = instance;
7894 }
7895 useOnMount(data.hoverInteractionState.disposeEffect);
7896 return data.hoverInteractionState;
7897 }
7898
7899 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
7900 function useHoverFloatingInteraction(context, parameters = {}) {
7901 const {
7902 enabled = true,
7903 closeDelay: closeDelayProp = 0,
7904 nodeId: nodeIdProp
7905 } = parameters;
7906 const store = "rootStore" in context ? context.rootStore : context;
7907 const open = store.useState("open");
7908 const floatingElement = store.useState("floatingElement");
7909 const domReferenceElement = store.useState("domReferenceElement");
7910 const {
7911 dataRef
7912 } = store.context;
7913 const tree = useFloatingTree();
7914 const parentId = useFloatingParentNodeId();
7915 const instance = useHoverInteractionSharedState(store);
7916 const childClosedTimeout = useTimeout();
7917 const isClickLikeOpenEvent2 = useStableCallback(() => {
7918 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
7919 });
7920 const isHoverOpen = useStableCallback(() => {
7921 return isHoverOpenEvent(dataRef.current.openEvent?.type);
7922 });
7923 const clearPointerEvents = useStableCallback(() => {
7924 clearSafePolygonPointerEventsMutation(instance);
7925 });
7926 useIsoLayoutEffect(() => {
7927 if (!open) {
7928 instance.pointerType = void 0;
7929 instance.restTimeoutPending = false;
7930 instance.interactedInside = false;
7931 clearPointerEvents();
7932 }
7933 }, [open, instance, clearPointerEvents]);
7934 React35.useEffect(() => {
7935 return clearPointerEvents;
7936 }, [clearPointerEvents]);
7937 useIsoLayoutEffect(() => {
7938 if (!enabled) {
7939 return void 0;
7940 }
7941 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {
7942 const ref = domReferenceElement;
7943 const floatingEl = floatingElement;
7944 const doc = ownerDocument(floatingElement);
7945 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating;
7946 if (parentFloating) {
7947 parentFloating.style.pointerEvents = "";
7948 }
7949 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;
7950 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;
7951 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body;
7952 applySafePolygonPointerEventsMutation(instance, {
7953 scopeElement,
7954 referenceElement: ref,
7955 floatingElement: floatingEl
7956 });
7957 return () => {
7958 clearPointerEvents();
7959 };
7960 }
7961 return void 0;
7962 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);
7963 React35.useEffect(() => {
7964 if (!enabled) {
7965 return void 0;
7966 }
7967 function hasParentChildren() {
7968 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0);
7969 }
7970 function closeWithDelay(event) {
7971 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType);
7972 const close = () => {
7973 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7974 tree?.events.emit("floating.closed", event);
7975 };
7976 if (closeDelay) {
7977 instance.openChangeTimeout.start(closeDelay, close);
7978 } else {
7979 instance.openChangeTimeout.clear();
7980 close();
7981 }
7982 }
7983 function handleInteractInside(event) {
7984 const target = getTarget(event);
7985 if (!isInteractiveElement(target)) {
7986 instance.interactedInside = false;
7987 return;
7988 }
7989 instance.interactedInside = target?.closest("[aria-haspopup]") != null;
7990 }
7991 function onFloatingMouseEnter() {
7992 instance.openChangeTimeout.clear();
7993 childClosedTimeout.clear();
7994 tree?.events.off("floating.closed", onNodeClosed);
7995 clearPointerEvents();
7996 }
7997 function onFloatingMouseLeave(event) {
7998 if (hasParentChildren() && tree) {
7999 tree.events.on("floating.closed", onNodeClosed);
8000 return;
8001 }
8002 if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {
8003 return;
8004 }
8005 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;
8006 const relatedTarget = event.relatedTarget;
8007 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget));
8008 if (isMovingIntoDescendantFloating) {
8009 return;
8010 }
8011 if (instance.handler) {
8012 instance.handler(event);
8013 return;
8014 }
8015 clearPointerEvents();
8016 if (isHoverOpen() && !isClickLikeOpenEvent2()) {
8017 closeWithDelay(event);
8018 }
8019 }
8020 function onNodeClosed(event) {
8021 if (!tree || !parentId || hasParentChildren()) {
8022 return;
8023 }
8024 childClosedTimeout.start(0, () => {
8025 tree.events.off("floating.closed", onNodeClosed);
8026 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
8027 tree.events.emit("floating.closed", event);
8028 });
8029 }
8030 const floating = floatingElement;
8031 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => {
8032 tree?.events.off("floating.closed", onNodeClosed);
8033 });
8034 }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]);
8035 }
8036
8037 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs
8038 var React36 = __toESM(require_react(), 1);
8039 var ReactDOM5 = __toESM(require_react_dom(), 1);
8040 var EMPTY_REF = {
8041 current: null
8042 };
8043 function useHoverReferenceInteraction(context, props = {}) {
8044 const {
8045 enabled = true,
8046 delay = 0,
8047 handleClose = null,
8048 mouseOnly = false,
8049 restMs = 0,
8050 move = true,
8051 triggerElementRef = EMPTY_REF,
8052 externalTree,
8053 isActiveTrigger = true,
8054 getHandleCloseContext,
8055 isClosing,
8056 shouldOpen: shouldOpenProp,
8057 guardStaleOpen = false
8058 } = props;
8059 const store = "rootStore" in context ? context.rootStore : context;
8060 const {
8061 dataRef,
8062 events
8063 } = store.context;
8064 const tree = useFloatingTree(externalTree);
8065 const instance = useHoverInteractionSharedState(store);
8066 const isHoverCloseActiveRef = React36.useRef(false);
8067 const handleCloseRef = useValueAsRef(handleClose);
8068 const delayRef = useValueAsRef(delay);
8069 const restMsRef = useValueAsRef(restMs);
8070 const enabledRef = useValueAsRef(enabled);
8071 const shouldOpenRef = useValueAsRef(shouldOpenProp);
8072 const isClosingRef = useValueAsRef(isClosing);
8073 const isClickLikeOpenEvent2 = useStableCallback(() => {
8074 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
8075 });
8076 const checkShouldOpen = useStableCallback(() => {
8077 return shouldOpenRef.current?.() !== false;
8078 });
8079 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {
8080 const allTriggers = store.context.triggerElements;
8081 if (allTriggers.hasElement(currentTarget)) {
8082 return !currentDomReference || !contains(currentDomReference, currentTarget);
8083 }
8084 if (!isElement(target)) {
8085 return false;
8086 }
8087 const targetElement = target;
8088 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));
8089 });
8090 const cleanupMouseMoveHandler = useStableCallback(() => {
8091 if (!instance.handler) {
8092 return;
8093 }
8094 const doc = ownerDocument(store.select("domReferenceElement"));
8095 doc.removeEventListener("mousemove", instance.handler);
8096 instance.handler = void 0;
8097 });
8098 const clearPointerEvents = useStableCallback(() => {
8099 clearSafePolygonPointerEventsMutation(instance);
8100 });
8101 if (isActiveTrigger) {
8102 instance.handleCloseOptions = handleCloseRef.current?.__options;
8103 }
8104 React36.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);
8105 React36.useEffect(() => {
8106 if (!enabled) {
8107 return void 0;
8108 }
8109 function onOpenChangeLocal(details) {
8110 if (!details.open) {
8111 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover;
8112 cleanupMouseMoveHandler();
8113 instance.openChangeTimeout.clear();
8114 instance.restTimeout.clear();
8115 instance.blockMouseMove = true;
8116 instance.restTimeoutPending = false;
8117 } else {
8118 isHoverCloseActiveRef.current = false;
8119 }
8120 }
8121 events.on("openchange", onOpenChangeLocal);
8122 return () => {
8123 events.off("openchange", onOpenChangeLocal);
8124 };
8125 }, [enabled, events, instance, cleanupMouseMoveHandler]);
8126 React36.useEffect(() => {
8127 if (!enabled) {
8128 return void 0;
8129 }
8130 function closeWithDelay(event, runElseBranch = true) {
8131 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType);
8132 if (closeDelay) {
8133 instance.openChangeTimeout.start(closeDelay, () => {
8134 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
8135 tree?.events.emit("floating.closed", event);
8136 });
8137 } else if (runElseBranch) {
8138 instance.openChangeTimeout.clear();
8139 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
8140 tree?.events.emit("floating.closed", event);
8141 }
8142 }
8143 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null);
8144 if (!isElement(trigger)) {
8145 return void 0;
8146 }
8147 function onMouseEnter(event) {
8148 instance.openChangeTimeout.clear();
8149 instance.blockMouseMove = false;
8150 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
8151 return;
8152 }
8153 const restMsValue = getRestMs(restMsRef.current);
8154 const openDelay = getDelay(delayRef.current, "open", instance.pointerType);
8155 const eventTarget = getTarget(event);
8156 const currentTarget = event.currentTarget ?? null;
8157 const currentDomReference = store.select("domReferenceElement");
8158 let triggerNode = currentTarget;
8159 if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) {
8160 for (const triggerElement of store.context.triggerElements.elements()) {
8161 if (contains(triggerElement, eventTarget)) {
8162 triggerNode = triggerElement;
8163 break;
8164 }
8165 }
8166 }
8167 if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {
8168 triggerNode = currentDomReference;
8169 }
8170 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);
8171 const isOpen = store.select("open");
8172 const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending";
8173 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;
8174 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;
8175 const isRestOnlyDelay = restMsValue > 0 && !openDelay;
8176 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;
8177 const shouldOpen = !isOpen || isOverInactive;
8178 if (shouldOpenImmediately) {
8179 if (checkShouldOpen()) {
8180 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
8181 }
8182 return;
8183 }
8184 if (isRestOnlyDelay) {
8185 return;
8186 }
8187 if (openDelay) {
8188 instance.openChangeTimeout.start(openDelay, () => {
8189 if (shouldOpen && checkShouldOpen()) {
8190 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
8191 }
8192 });
8193 } else if (shouldOpen) {
8194 if (checkShouldOpen()) {
8195 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
8196 }
8197 }
8198 }
8199 function onMouseLeave(event) {
8200 if (isClickLikeOpenEvent2()) {
8201 clearPointerEvents();
8202 return;
8203 }
8204 cleanupMouseMoveHandler();
8205 const domReferenceElement = store.select("domReferenceElement");
8206 const doc = ownerDocument(domReferenceElement);
8207 instance.restTimeout.clear();
8208 instance.restTimeoutPending = false;
8209 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();
8210 if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {
8211 return;
8212 }
8213 if (handleCloseRef.current && handleCloseContextBase) {
8214 if (!store.select("open")) {
8215 instance.openChangeTimeout.clear();
8216 }
8217 const currentTrigger = triggerElementRef.current;
8218 instance.handler = handleCloseRef.current({
8219 ...handleCloseContextBase,
8220 tree,
8221 x: event.clientX,
8222 y: event.clientY,
8223 onClose() {
8224 clearPointerEvents();
8225 cleanupMouseMoveHandler();
8226 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) {
8227 closeWithDelay(event, true);
8228 }
8229 }
8230 });
8231 doc.addEventListener("mousemove", instance.handler);
8232 instance.handler(event);
8233 return;
8234 }
8235 const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true;
8236 if (shouldClose) {
8237 closeWithDelay(event);
8238 }
8239 }
8240 function onMouseOut(event) {
8241 if (contains(trigger, event.relatedTarget)) {
8242 return;
8243 }
8244 instance.openChangeTimeout.clear();
8245 instance.restTimeout.clear();
8246 instance.restTimeoutPending = false;
8247 }
8248 const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0;
8249 if (move) {
8250 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, {
8251 once: true
8252 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard);
8253 }
8254 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard);
8255 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]);
8256 return React36.useMemo(() => {
8257 if (!enabled) {
8258 return void 0;
8259 }
8260 function setPointerRef(event) {
8261 instance.pointerType = event.pointerType;
8262 }
8263 return {
8264 onPointerDown: setPointerRef,
8265 onPointerEnter: setPointerRef,
8266 onMouseMove(event) {
8267 const {
8268 nativeEvent
8269 } = event;
8270 const trigger = event.currentTarget;
8271 const currentDomReference = store.select("domReferenceElement");
8272 const currentOpen = store.select("open");
8273 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
8274 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
8275 return;
8276 }
8277 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
8278 const floatingElement = store.select("floatingElement");
8279 if (floatingElement) {
8280 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
8281 applySafePolygonPointerEventsMutation(instance, {
8282 scopeElement,
8283 referenceElement: trigger,
8284 floatingElement
8285 });
8286 }
8287 }
8288 const restMsValue = getRestMs(restMsRef.current);
8289 if (currentOpen && !isOverInactive || restMsValue === 0) {
8290 return;
8291 }
8292 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {
8293 return;
8294 }
8295 instance.restTimeout.clear();
8296 function handleMouseMove() {
8297 instance.restTimeoutPending = false;
8298 if (isClickLikeOpenEvent2()) {
8299 return;
8300 }
8301 const latestOpen = store.select("open");
8302 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) {
8303 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger));
8304 }
8305 }
8306 if (instance.pointerType === "touch") {
8307 ReactDOM5.flushSync(() => {
8308 handleMouseMove();
8309 });
8310 } else if (isOverInactive && currentOpen) {
8311 handleMouseMove();
8312 } else {
8313 instance.restTimeoutPending = true;
8314 instance.restTimeout.start(restMsValue, handleMouseMove);
8315 }
8316 }
8317 };
8318 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]);
8319 }
8320
8321 // node_modules/@base-ui/react/floating-ui-react/hooks/useListNavigation.mjs
8322 var React37 = __toESM(require_react(), 1);
8323 var ESCAPE = "Escape";
8324 function isStationaryWebKitPointer(event) {
8325 return parts_exports.engine.webkit && event.movementX === 0 && event.movementY === 0;
8326 }
8327 function doSwitch(orientation, vertical, horizontal) {
8328 switch (orientation) {
8329 case "vertical":
8330 return vertical;
8331 case "horizontal":
8332 return horizontal;
8333 default:
8334 return vertical || horizontal;
8335 }
8336 }
8337 function isMainOrientationKey(key, orientation) {
8338 const vertical = key === ARROW_UP || key === ARROW_DOWN;
8339 const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT;
8340 return doSwitch(orientation, vertical, horizontal);
8341 }
8342 function isMainOrientationToEndKey(key, orientation, rtl) {
8343 const vertical = key === ARROW_DOWN;
8344 const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;
8345 return doSwitch(orientation, vertical, horizontal) || key === "Enter" || key === " " || key === "";
8346 }
8347 function isCrossOrientationOpenKey(key, orientation, rtl) {
8348 const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;
8349 const horizontal = key === ARROW_DOWN;
8350 return doSwitch(orientation, vertical, horizontal);
8351 }
8352 function isCrossOrientationCloseKey(key, orientation, rtl, grid) {
8353 const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;
8354 const horizontal = key === ARROW_UP;
8355 if (orientation === "both" || orientation === "horizontal" && grid) {
8356 return key === ESCAPE;
8357 }
8358 return doSwitch(orientation, vertical, horizontal);
8359 }
8360 function useListNavigation(context, props) {
8361 const {
8362 listRef,
8363 activeIndex,
8364 onNavigate: onNavigateProp = () => {
8365 },
8366 enabled = true,
8367 selectedIndex = null,
8368 allowEscape = false,
8369 loopFocus = false,
8370 nested = false,
8371 rtl = false,
8372 virtual = false,
8373 focusItemOnOpen = "auto",
8374 focusItemOnHover = true,
8375 openOnArrowKeyDown = true,
8376 disabledIndices = void 0,
8377 orientation = "vertical",
8378 parentOrientation,
8379 id,
8380 resetOnPointerLeave = true,
8381 externalTree,
8382 grid: navigateGrid
8383 } = props;
8384 const isGrid = navigateGrid != null;
8385 if (true) {
8386 if (allowEscape) {
8387 if (!loopFocus) {
8388 console.warn("`useListNavigation` looping must be enabled to allow escaping.");
8389 }
8390 if (!virtual) {
8391 console.warn("`useListNavigation` must be virtual to allow escaping.");
8392 }
8393 }
8394 if (orientation === "vertical" && isGrid) {
8395 console.warn("In grid list navigation mode, the `orientation` should", 'be either "horizontal" or "both".');
8396 }
8397 }
8398 const store = "rootStore" in context ? context.rootStore : context;
8399 const open = store.useState("open");
8400 const floatingElement = store.useState("floatingElement");
8401 const domReferenceElement = store.useState("domReferenceElement");
8402 const dataRef = store.context.dataRef;
8403 const floatingFocusElement = getFloatingFocusElement(floatingElement);
8404 const typeableComboboxReference = isTypeableCombobox(domReferenceElement);
8405 const floatingFocusElementRef = useValueAsRef(floatingFocusElement);
8406 const parentId = useFloatingParentNodeId();
8407 const tree = useFloatingTree(externalTree);
8408 const focusItemOnOpenRef = React37.useRef(focusItemOnOpen);
8409 const indexRef = React37.useRef(selectedIndex ?? -1);
8410 const keyRef = React37.useRef(null);
8411 const isPointerModalityRef = React37.useRef(true);
8412 const onNavigate = useStableCallback((event) => {
8413 onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event);
8414 });
8415 const previousMountedRef = React37.useRef(!!floatingElement);
8416 const previousOpenRef = React37.useRef(open);
8417 const forceSyncFocusRef = React37.useRef(false);
8418 const forceScrollIntoViewRef = React37.useRef(false);
8419 const cancelQueuedFocusRef = React37.useRef(null);
8420 const disabledIndicesRef = useValueAsRef(disabledIndices);
8421 const latestOpenRef = useValueAsRef(open);
8422 const selectedIndexRef = useValueAsRef(selectedIndex);
8423 const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave);
8424 const focusFrame = useAnimationFrame();
8425 const waitForListPopulatedFrame = useAnimationFrame();
8426 const focusItem = useStableCallback(() => {
8427 function runFocus(item2) {
8428 if (virtual) {
8429 tree?.events.emit("virtualfocus", item2);
8430 } else {
8431 cancelQueuedFocusRef.current = enqueueFocus(item2, {
8432 sync: forceSyncFocusRef.current,
8433 preventScroll: true
8434 });
8435 }
8436 }
8437 const initialItem = listRef.current[indexRef.current];
8438 const forceScrollIntoView = forceScrollIntoViewRef.current;
8439 if (initialItem) {
8440 runFocus(initialItem);
8441 }
8442 const scheduler2 = forceSyncFocusRef.current ? (callback) => callback() : (callback) => focusFrame.request(callback);
8443 scheduler2(() => {
8444 const waitedItem = listRef.current[indexRef.current] || initialItem;
8445 if (!waitedItem) {
8446 return;
8447 }
8448 if (!initialItem) {
8449 runFocus(waitedItem);
8450 }
8451 const shouldScrollIntoView = (
8452 // eslint-disable-next-line @typescript-eslint/no-use-before-define
8453 item && (forceScrollIntoView || !isPointerModalityRef.current)
8454 );
8455 if (shouldScrollIntoView) {
8456 waitedItem.scrollIntoView?.({
8457 block: "nearest",
8458 inline: "nearest"
8459 });
8460 }
8461 });
8462 });
8463 useIsoLayoutEffect(() => {
8464 dataRef.current.orientation = orientation;
8465 }, [dataRef, orientation]);
8466 useIsoLayoutEffect(() => {
8467 if (!enabled) {
8468 return;
8469 }
8470 if (open && floatingElement) {
8471 indexRef.current = selectedIndex ?? -1;
8472 if (focusItemOnOpenRef.current && selectedIndex != null) {
8473 forceScrollIntoViewRef.current = true;
8474 onNavigate();
8475 }
8476 } else if (previousMountedRef.current) {
8477 indexRef.current = -1;
8478 onNavigate();
8479 }
8480 }, [enabled, open, floatingElement, selectedIndex, onNavigate]);
8481 useIsoLayoutEffect(() => {
8482 if (!enabled) {
8483 return;
8484 }
8485 if (!open) {
8486 forceSyncFocusRef.current = false;
8487 return;
8488 }
8489 if (!floatingElement) {
8490 return;
8491 }
8492 if (activeIndex == null) {
8493 forceSyncFocusRef.current = false;
8494 if (selectedIndexRef.current != null) {
8495 return;
8496 }
8497 if (previousMountedRef.current) {
8498 indexRef.current = -1;
8499 focusItem();
8500 }
8501 if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {
8502 let runs = 0;
8503 const waitForListPopulated = () => {
8504 if (listRef.current[0] == null) {
8505 if (runs < 2) {
8506 const scheduler2 = runs ? (callback) => waitForListPopulatedFrame.request(callback) : queueMicrotask;
8507 scheduler2(waitForListPopulated);
8508 }
8509 runs += 1;
8510 } else {
8511 indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef);
8512 keyRef.current = null;
8513 onNavigate();
8514 }
8515 };
8516 waitForListPopulated();
8517 }
8518 } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) {
8519 indexRef.current = activeIndex;
8520 focusItem();
8521 forceScrollIntoViewRef.current = false;
8522 }
8523 }, [enabled, open, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, waitForListPopulatedFrame]);
8524 useIsoLayoutEffect(() => {
8525 if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) {
8526 return;
8527 }
8528 const nodes = tree.nodesRef.current;
8529 const parent = nodes.find((node) => node.id === parentId)?.context?.elements.floating;
8530 const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null));
8531 const treeContainsActiveEl = nodes.some((node) => node.context && contains(node.context.elements.floating, activeEl));
8532 if (parent && !treeContainsActiveEl && isPointerModalityRef.current) {
8533 parent.focus({
8534 preventScroll: true
8535 });
8536 }
8537 }, [enabled, floatingElement, domReferenceElement, tree, parentId, virtual]);
8538 useIsoLayoutEffect(() => {
8539 previousOpenRef.current = open;
8540 previousMountedRef.current = !!floatingElement;
8541 });
8542 useIsoLayoutEffect(() => {
8543 if (!open) {
8544 keyRef.current = null;
8545 focusItemOnOpenRef.current = focusItemOnOpen;
8546 }
8547 }, [open, focusItemOnOpen]);
8548 const hasActiveIndex = activeIndex != null;
8549 const syncCurrentTarget = useStableCallback((event) => {
8550 if (!latestOpenRef.current) {
8551 return;
8552 }
8553 const index2 = listRef.current.indexOf(event.currentTarget);
8554 if (index2 !== -1 && (indexRef.current !== index2 || activeIndex !== index2)) {
8555 indexRef.current = index2;
8556 onNavigate(event);
8557 }
8558 });
8559 const getParentOrientation = useStableCallback(() => {
8560 return parentOrientation ?? tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.dataRef?.current.orientation;
8561 });
8562 const getMinEnabledIndex = useStableCallback(() => {
8563 return getMinListIndex(listRef, disabledIndicesRef.current);
8564 });
8565 const commonOnKeyDown = useStableCallback((event) => {
8566 isPointerModalityRef.current = false;
8567 forceSyncFocusRef.current = true;
8568 if (event.which === 229) {
8569 return;
8570 }
8571 if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) {
8572 return;
8573 }
8574 if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid)) {
8575 if (!isMainOrientationKey(event.key, getParentOrientation())) {
8576 stopEvent(event);
8577 }
8578 store.setOpen(false, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent));
8579 if (isHTMLElement(domReferenceElement)) {
8580 if (virtual) {
8581 tree?.events.emit("virtualfocus", domReferenceElement);
8582 } else {
8583 domReferenceElement.focus();
8584 }
8585 }
8586 return;
8587 }
8588 const currentIndex = indexRef.current;
8589 const minIndex = getMinListIndex(listRef, disabledIndices);
8590 const maxIndex = getMaxListIndex(listRef, disabledIndices);
8591 if (!typeableComboboxReference) {
8592 if (event.key === "Home") {
8593 stopEvent(event);
8594 indexRef.current = minIndex;
8595 onNavigate(event);
8596 }
8597 if (event.key === "End") {
8598 stopEvent(event);
8599 indexRef.current = maxIndex;
8600 onNavigate(event);
8601 }
8602 }
8603 if (navigateGrid != null) {
8604 const index2 = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex);
8605 if (index2 != null) {
8606 indexRef.current = index2;
8607 onNavigate(event);
8608 }
8609 if (orientation === "both") {
8610 return;
8611 }
8612 }
8613 if (isMainOrientationKey(event.key, orientation)) {
8614 stopEvent(event);
8615 if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {
8616 indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;
8617 onNavigate(event);
8618 return;
8619 }
8620 if (isMainOrientationToEndKey(event.key, orientation, rtl)) {
8621 if (loopFocus) {
8622 if (currentIndex >= maxIndex) {
8623 if (allowEscape && currentIndex !== listRef.current.length) {
8624 indexRef.current = -1;
8625 } else {
8626 forceSyncFocusRef.current = false;
8627 indexRef.current = minIndex;
8628 }
8629 } else {
8630 indexRef.current = findNonDisabledListIndex(listRef.current, {
8631 startingIndex: currentIndex,
8632 disabledIndices
8633 });
8634 }
8635 } else {
8636 indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, {
8637 startingIndex: currentIndex,
8638 disabledIndices
8639 }));
8640 }
8641 } else if (loopFocus) {
8642 if (currentIndex <= minIndex) {
8643 if (allowEscape && currentIndex !== -1) {
8644 indexRef.current = listRef.current.length;
8645 } else {
8646 forceSyncFocusRef.current = false;
8647 indexRef.current = maxIndex;
8648 }
8649 } else {
8650 indexRef.current = findNonDisabledListIndex(listRef.current, {
8651 startingIndex: currentIndex,
8652 decrement: true,
8653 disabledIndices
8654 });
8655 }
8656 } else {
8657 indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef.current, {
8658 startingIndex: currentIndex,
8659 decrement: true,
8660 disabledIndices
8661 }));
8662 }
8663 if (isIndexOutOfListBounds(listRef.current, indexRef.current)) {
8664 indexRef.current = -1;
8665 }
8666 onNavigate(event);
8667 }
8668 });
8669 const item = React37.useMemo(() => {
8670 const itemProps = {
8671 onFocus(event) {
8672 forceSyncFocusRef.current = true;
8673 syncCurrentTarget(event);
8674 },
8675 onClick: ({
8676 currentTarget
8677 }) => currentTarget.focus({
8678 preventScroll: true
8679 }),
8680 // Safari
8681 onMouseMove(event) {
8682 if (isStationaryWebKitPointer(event)) {
8683 return;
8684 }
8685 forceSyncFocusRef.current = true;
8686 forceScrollIntoViewRef.current = false;
8687 if (focusItemOnHover) {
8688 syncCurrentTarget(event);
8689 }
8690 },
8691 onPointerLeave(event) {
8692 if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === "touch") {
8693 return;
8694 }
8695 forceSyncFocusRef.current = true;
8696 const relatedTarget = event.relatedTarget;
8697 if (!focusItemOnHover || listRef.current.includes(relatedTarget)) {
8698 return;
8699 }
8700 if (!resetOnPointerLeaveRef.current) {
8701 return;
8702 }
8703 cancelQueuedFocusRef.current?.();
8704 cancelQueuedFocusRef.current = null;
8705 indexRef.current = -1;
8706 onNavigate(event);
8707 if (!virtual) {
8708 const floatingFocusEl = floatingFocusElementRef.current;
8709 const activeEl = activeElement(ownerDocument(floatingFocusEl));
8710 if (floatingFocusEl && contains(floatingFocusEl, activeEl)) {
8711 floatingFocusEl.focus({
8712 preventScroll: true
8713 });
8714 }
8715 }
8716 }
8717 };
8718 return itemProps;
8719 }, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]);
8720 const ariaActiveDescendantProp = React37.useMemo(() => {
8721 return virtual && open && hasActiveIndex && {
8722 "aria-activedescendant": `${id}-${activeIndex}`
8723 };
8724 }, [virtual, open, hasActiveIndex, id, activeIndex]);
8725 const floating = React37.useMemo(() => {
8726 return {
8727 "aria-orientation": orientation === "both" ? void 0 : orientation,
8728 ...!typeableComboboxReference ? ariaActiveDescendantProp : {},
8729 onKeyDown(event) {
8730 if (event.key === "Tab" && event.shiftKey && open && !virtual) {
8731 const target = getTarget(event.nativeEvent);
8732 if (target && !contains(floatingFocusElementRef.current, target)) {
8733 return;
8734 }
8735 stopEvent(event);
8736 store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent));
8737 if (isHTMLElement(domReferenceElement)) {
8738 domReferenceElement.focus();
8739 }
8740 return;
8741 }
8742 commonOnKeyDown(event);
8743 },
8744 onPointerMove(event) {
8745 if (isStationaryWebKitPointer(event)) {
8746 return;
8747 }
8748 isPointerModalityRef.current = true;
8749 }
8750 };
8751 }, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, orientation, typeableComboboxReference, store, open, virtual, domReferenceElement]);
8752 const trigger = React37.useMemo(() => {
8753 function openOnNavigationKeyDown(event) {
8754 store.setOpen(true, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent, event.currentTarget));
8755 }
8756 function checkVirtualMouse(event) {
8757 if (focusItemOnOpen === "auto" && isVirtualClick(event.nativeEvent)) {
8758 focusItemOnOpenRef.current = !virtual;
8759 }
8760 }
8761 function checkVirtualPointer(event) {
8762 focusItemOnOpenRef.current = focusItemOnOpen;
8763 if (focusItemOnOpen === "auto" && isVirtualPointerEvent(event.nativeEvent)) {
8764 focusItemOnOpenRef.current = true;
8765 }
8766 }
8767 return {
8768 onKeyDown(event) {
8769 const currentOpen = store.select("open");
8770 isPointerModalityRef.current = false;
8771 const isArrowKey = event.key.startsWith("Arrow");
8772 const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);
8773 const isMainKey = isMainOrientationKey(event.key, orientation);
8774 const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === "Enter" || event.key.trim() === "";
8775 if (virtual && currentOpen) {
8776 return commonOnKeyDown(event);
8777 }
8778 if (!currentOpen && !openOnArrowKeyDown && isArrowKey) {
8779 return void 0;
8780 }
8781 if (isNavigationKey) {
8782 const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());
8783 keyRef.current = nested && isParentMainKey ? null : event.key;
8784 }
8785 if (nested) {
8786 if (isParentCrossOpenKey) {
8787 stopEvent(event);
8788 if (currentOpen) {
8789 indexRef.current = getMinEnabledIndex();
8790 onNavigate(event);
8791 } else {
8792 openOnNavigationKeyDown(event);
8793 }
8794 }
8795 return void 0;
8796 }
8797 if (isMainKey) {
8798 if (selectedIndexRef.current != null) {
8799 indexRef.current = selectedIndexRef.current;
8800 }
8801 stopEvent(event);
8802 if (!currentOpen && openOnArrowKeyDown) {
8803 openOnNavigationKeyDown(event);
8804 } else {
8805 commonOnKeyDown(event);
8806 }
8807 if (currentOpen) {
8808 onNavigate(event);
8809 }
8810 }
8811 return void 0;
8812 },
8813 onFocus(event) {
8814 if (store.select("open") && !virtual) {
8815 indexRef.current = -1;
8816 onNavigate(event);
8817 }
8818 },
8819 onPointerDown: checkVirtualPointer,
8820 onPointerEnter: checkVirtualPointer,
8821 onMouseDown: checkVirtualMouse,
8822 onClick: checkVirtualMouse
8823 };
8824 }, [commonOnKeyDown, focusItemOnOpen, getMinEnabledIndex, nested, onNavigate, store, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndexRef, virtual]);
8825 const reference = React37.useMemo(() => {
8826 return {
8827 ...ariaActiveDescendantProp,
8828 ...trigger
8829 };
8830 }, [ariaActiveDescendantProp, trigger]);
8831 return React37.useMemo(() => enabled ? {
8832 reference,
8833 floating,
8834 item,
8835 trigger
8836 } : {}, [enabled, reference, floating, trigger, item]);
8837 }
8838
8839 // node_modules/@base-ui/react/floating-ui-react/hooks/useTypeahead.mjs
8840 var React38 = __toESM(require_react(), 1);
8841 function useTypeahead(context, props) {
8842 const {
8843 listRef,
8844 elementsRef,
8845 activeIndex,
8846 onMatch: onMatchProp,
8847 disabledIndices,
8848 onTyping,
8849 enabled = true,
8850 resetMs = 750,
8851 selectedIndex = null
8852 } = props;
8853 const store = "rootStore" in context ? context.rootStore : context;
8854 const open = store.useState("open");
8855 const timeout = useTimeout();
8856 const stringRef = React38.useRef("");
8857 const prevIndexRef = React38.useRef(selectedIndex ?? activeIndex ?? -1);
8858 const matchIndexRef = React38.useRef(null);
8859 const onKeyDown = useStableCallback((event) => {
8860 function getElement(index3) {
8861 return elementsRef?.current[index3];
8862 }
8863 function isItemAvailable(index3) {
8864 const element = getElement(index3);
8865 if (element && !isElementVisible(element) || element?.matches(":disabled")) {
8866 return false;
8867 }
8868 return disabledIndices == null || !isListIndexDisabled(EMPTY_ARRAY, index3, disabledIndices);
8869 }
8870 function getMatchingIndex(list, string, startIndex2 = 0) {
8871 if (list.length === 0) {
8872 return -1;
8873 }
8874 const normalizedStartIndex = (startIndex2 % list.length + list.length) % list.length;
8875 const lowerString = string.toLowerCase();
8876 for (let offset4 = 0; offset4 < list.length; offset4 += 1) {
8877 const index3 = (normalizedStartIndex + offset4) % list.length;
8878 const text = list[index3];
8879 if (!text?.toLowerCase().startsWith(lowerString) || !isItemAvailable(index3)) {
8880 continue;
8881 }
8882 return index3;
8883 }
8884 return -1;
8885 }
8886 const listContent = listRef.current;
8887 if (stringRef.current.length > 0 && event.key === " ") {
8888 stopEvent(event);
8889 onTyping?.(true);
8890 }
8891 if (stringRef.current.length > 0 && stringRef.current[0] !== " ") {
8892 if (getMatchingIndex(listContent, stringRef.current) === -1 && event.key !== " ") {
8893 onTyping?.(false);
8894 }
8895 }
8896 if (listContent == null || // Character key.
8897 event.key.length !== 1 || // Modifier key.
8898 event.ctrlKey || event.metaKey || event.altKey) {
8899 return;
8900 }
8901 if (open && event.key !== " ") {
8902 stopEvent(event);
8903 onTyping?.(true);
8904 }
8905 const isNewSession = stringRef.current === "";
8906 if (isNewSession) {
8907 prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;
8908 }
8909 const allowRapidSuccessionOfFirstLetter = listContent.every((text, index3) => text && isItemAvailable(index3) ? text[0]?.toLowerCase() !== text[1]?.toLowerCase() : true);
8910 if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) {
8911 stringRef.current = "";
8912 prevIndexRef.current = matchIndexRef.current;
8913 }
8914 stringRef.current += event.key;
8915 timeout.start(resetMs, () => {
8916 stringRef.current = "";
8917 prevIndexRef.current = matchIndexRef.current;
8918 onTyping?.(false);
8919 });
8920 const prevIndex = isNewSession ? selectedIndex ?? activeIndex ?? -1 : prevIndexRef.current;
8921 const startIndex = (prevIndex ?? 0) + 1;
8922 const index2 = getMatchingIndex(listContent, stringRef.current, startIndex);
8923 if (index2 !== -1) {
8924 onMatchProp?.(index2);
8925 matchIndexRef.current = index2;
8926 } else if (event.key !== " ") {
8927 stringRef.current = "";
8928 onTyping?.(false);
8929 }
8930 });
8931 const onBlur = useStableCallback((event) => {
8932 const next = event.relatedTarget;
8933 const currentDomReferenceElement = store.select("domReferenceElement");
8934 const currentFloatingElement = store.select("floatingElement");
8935 const withinComposite = contains(currentDomReferenceElement, next) || contains(currentFloatingElement, next);
8936 if (withinComposite) {
8937 return;
8938 }
8939 timeout.clear();
8940 stringRef.current = "";
8941 prevIndexRef.current = matchIndexRef.current;
8942 onTyping?.(false);
8943 });
8944 useIsoLayoutEffect(() => {
8945 if (!open && selectedIndex !== null) {
8946 return;
8947 }
8948 timeout.clear();
8949 matchIndexRef.current = null;
8950 if (stringRef.current !== "") {
8951 stringRef.current = "";
8952 }
8953 }, [open, selectedIndex, timeout]);
8954 const sharedProps = React38.useMemo(() => ({
8955 onKeyDown,
8956 onBlur
8957 }), [onKeyDown, onBlur]);
8958 return React38.useMemo(() => enabled ? {
8959 reference: sharedProps,
8960 floating: sharedProps
8961 } : {}, [enabled, sharedProps]);
8962 }
8963
8964 // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs
8965 var CURSOR_SPEED_THRESHOLD = 0.1;
8966 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;
8967 var POLYGON_BUFFER = 0.5;
8968 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {
8969 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;
8970 }
8971 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {
8972 let isInsideValue = false;
8973 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {
8974 isInsideValue = !isInsideValue;
8975 }
8976 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {
8977 isInsideValue = !isInsideValue;
8978 }
8979 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {
8980 isInsideValue = !isInsideValue;
8981 }
8982 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {
8983 isInsideValue = !isInsideValue;
8984 }
8985 return isInsideValue;
8986 }
8987 function isInsideRect(pointX, pointY, rect) {
8988 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;
8989 }
8990 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {
8991 const minX = Math.min(x1, x2);
8992 const maxX = Math.max(x1, x2);
8993 const minY = Math.min(y1, y2);
8994 const maxY = Math.max(y1, y2);
8995 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;
8996 }
8997 function safePolygon(options = {}) {
8998 const {
8999 blockPointerEvents = false
9000 } = options;
9001 const timeout = new Timeout();
9002 const fn = ({
9003 x,
9004 y,
9005 placement,
9006 elements,
9007 onClose,
9008 nodeId,
9009 tree
9010 }) => {
9011 const side = placement?.split("-")[0];
9012 let hasLanded = false;
9013 let lastX = null;
9014 let lastY = null;
9015 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
9016 function isCursorMovingSlowly(nextX, nextY) {
9017 const currentTime = performance.now();
9018 const elapsedTime = currentTime - lastCursorTime;
9019 if (lastX === null || lastY === null || elapsedTime === 0) {
9020 lastX = nextX;
9021 lastY = nextY;
9022 lastCursorTime = currentTime;
9023 return false;
9024 }
9025 const deltaX = nextX - lastX;
9026 const deltaY = nextY - lastY;
9027 const distanceSquared = deltaX * deltaX + deltaY * deltaY;
9028 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;
9029 lastX = nextX;
9030 lastY = nextY;
9031 lastCursorTime = currentTime;
9032 return distanceSquared < thresholdSquared;
9033 }
9034 function close() {
9035 timeout.clear();
9036 onClose();
9037 }
9038 return function onMouseMove(event) {
9039 timeout.clear();
9040 const domReference = elements.domReference;
9041 const floating = elements.floating;
9042 if (!domReference || !floating || side == null || x == null || y == null) {
9043 return void 0;
9044 }
9045 const {
9046 clientX,
9047 clientY
9048 } = event;
9049 const target = getTarget(event);
9050 const isLeave = event.type === "mouseleave";
9051 const isOverFloatingEl = contains(floating, target);
9052 const isOverReferenceEl = contains(domReference, target);
9053 if (isOverFloatingEl) {
9054 hasLanded = true;
9055 if (!isLeave) {
9056 return void 0;
9057 }
9058 }
9059 if (isOverReferenceEl) {
9060 hasLanded = false;
9061 if (!isLeave) {
9062 hasLanded = true;
9063 return void 0;
9064 }
9065 }
9066 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {
9067 return void 0;
9068 }
9069 function hasOpenChildNode() {
9070 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);
9071 }
9072 function closeIfNoOpenChild() {
9073 if (!hasOpenChildNode()) {
9074 close();
9075 }
9076 }
9077 if (hasOpenChildNode()) {
9078 return void 0;
9079 }
9080 const refRect = domReference.getBoundingClientRect();
9081 const rect = floating.getBoundingClientRect();
9082 const cursorLeaveFromRight = x > rect.right - rect.width / 2;
9083 const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;
9084 const isFloatingWider = rect.width > refRect.width;
9085 const isFloatingTaller = rect.height > refRect.height;
9086 const left = (isFloatingWider ? refRect : rect).left;
9087 const right = (isFloatingWider ? refRect : rect).right;
9088 const top = (isFloatingTaller ? refRect : rect).top;
9089 const bottom = (isFloatingTaller ? refRect : rect).bottom;
9090 if (side === "top" && y >= refRect.bottom - 1 || side === "bottom" && y <= refRect.top + 1 || side === "left" && x >= refRect.right - 1 || side === "right" && x <= refRect.left + 1) {
9091 closeIfNoOpenChild();
9092 return void 0;
9093 }
9094 let isInsideTroughRect = false;
9095 switch (side) {
9096 case "top":
9097 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);
9098 break;
9099 case "bottom":
9100 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);
9101 break;
9102 case "left":
9103 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);
9104 break;
9105 case "right":
9106 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);
9107 break;
9108 default:
9109 }
9110 if (isInsideTroughRect) {
9111 return void 0;
9112 }
9113 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {
9114 closeIfNoOpenChild();
9115 return void 0;
9116 }
9117 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {
9118 closeIfNoOpenChild();
9119 return void 0;
9120 }
9121 let isInsidePolygon = false;
9122 switch (side) {
9123 case "top": {
9124 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
9125 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
9126 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
9127 const cursorPointY = y + POLYGON_BUFFER + 1;
9128 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;
9129 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;
9130 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
9131 break;
9132 }
9133 case "bottom": {
9134 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
9135 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
9136 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
9137 const cursorPointY = y - POLYGON_BUFFER;
9138 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;
9139 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;
9140 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
9141 break;
9142 }
9143 case "left": {
9144 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
9145 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
9146 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
9147 const cursorPointX = x + POLYGON_BUFFER + 1;
9148 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;
9149 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;
9150 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);
9151 break;
9152 }
9153 case "right": {
9154 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
9155 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
9156 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
9157 const cursorPointX = x - POLYGON_BUFFER;
9158 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;
9159 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;
9160 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);
9161 break;
9162 }
9163 default:
9164 }
9165 if (!isInsidePolygon) {
9166 closeIfNoOpenChild();
9167 } else if (!hasLanded) {
9168 timeout.start(40, closeIfNoOpenChild);
9169 }
9170 return void 0;
9171 };
9172 };
9173 fn.__options = {
9174 ...options,
9175 blockPointerEvents
9176 };
9177 return fn;
9178 }
9179
9180 // node_modules/@base-ui/react/utils/NullStore.mjs
9181 var NullStore = class extends ReactStore {
9182 // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding
9183 // `setState` alone would neutralize them today. They are overridden explicitly so the store stays
9184 // inert even if a future base-class change stops routing a mutator through `setState`.
9185 setState(_newState) {
9186 }
9187 update(_changes) {
9188 }
9189 set(_key, _value) {
9190 }
9191 notifyAll() {
9192 }
9193 };
9194
9195 // node_modules/@base-ui/react/utils/popupStateMapping.mjs
9196 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) {
9197 CommonPopupDataAttributes2["open"] = "data-open";
9198 CommonPopupDataAttributes2["closed"] = "data-closed";
9199 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle";
9200 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle";
9201 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden";
9202 CommonPopupDataAttributes2["side"] = "data-side";
9203 CommonPopupDataAttributes2["align"] = "data-align";
9204 return CommonPopupDataAttributes2;
9205 })({});
9206 var TRIGGER_HOOK = {
9207 "data-popup-open": ""
9208 };
9209 var PRESSABLE_TRIGGER_HOOK = {
9210 "data-popup-open": "",
9211 "data-pressed": ""
9212 };
9213 var POPUP_OPEN_HOOK = {
9214 "data-open": ""
9215 };
9216 var POPUP_CLOSED_HOOK = {
9217 "data-closed": ""
9218 };
9219 var ANCHOR_HIDDEN_HOOK = {
9220 "data-anchor-hidden": ""
9221 };
9222 var triggerOpenStateMapping = {
9223 open(value) {
9224 if (value) {
9225 return TRIGGER_HOOK;
9226 }
9227 return null;
9228 }
9229 };
9230 var pressableTriggerOpenStateMapping = {
9231 open(value) {
9232 if (value) {
9233 return PRESSABLE_TRIGGER_HOOK;
9234 }
9235 return null;
9236 }
9237 };
9238 var popupStateMapping = {
9239 open(value) {
9240 if (value) {
9241 return POPUP_OPEN_HOOK;
9242 }
9243 return POPUP_CLOSED_HOOK;
9244 },
9245 anchorHidden(value) {
9246 if (value) {
9247 return ANCHOR_HIDDEN_HOOK;
9248 }
9249 return null;
9250 }
9251 };
9252 var popupTransitionStateMapping = {
9253 ...popupStateMapping,
9254 ...transitionStatusMapping
9255 };
9256
9257 // node_modules/@base-ui/utils/inertValue.mjs
9258 function inertValue(value) {
9259 if (isReactVersionAtLeast(19)) {
9260 return value;
9261 }
9262 return value ? "true" : void 0;
9263 }
9264
9265 // node_modules/@base-ui/react/utils/InternalBackdrop.mjs
9266 var React39 = __toESM(require_react(), 1);
9267 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
9268 var InternalBackdrop = /* @__PURE__ */ React39.forwardRef(function InternalBackdrop2(props, ref) {
9269 const {
9270 cutout,
9271 ...otherProps
9272 } = props;
9273 let clipPath;
9274 if (cutout) {
9275 const rect = cutout.getBoundingClientRect();
9276 clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;
9277 }
9278 return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
9279 ref,
9280 role: "presentation",
9281 "data-base-ui-inert": "",
9282 ...otherProps,
9283 style: {
9284 position: "fixed",
9285 inset: 0,
9286 userSelect: "none",
9287 WebkitUserSelect: "none",
9288 clipPath
9289 }
9290 });
9291 });
9292 if (true) InternalBackdrop.displayName = "InternalBackdrop";
9293
9294 // node_modules/@base-ui/react/utils/useOpenInteractionType.mjs
9295 var React42 = __toESM(require_react(), 1);
9296
9297 // node_modules/@base-ui/utils/useEnhancedClickHandler.mjs
9298 var React40 = __toESM(require_react(), 1);
9299 function useEnhancedClickHandler(handler) {
9300 const lastClickInteractionTypeRef = React40.useRef("");
9301 const handlePointerDown = React40.useCallback((event) => {
9302 if (event.defaultPrevented) {
9303 return;
9304 }
9305 lastClickInteractionTypeRef.current = event.pointerType;
9306 handler(event, event.pointerType);
9307 }, [handler]);
9308 const handleClick = React40.useCallback((event) => {
9309 if (event.detail === 0) {
9310 handler(event, "keyboard");
9311 return;
9312 }
9313 if ("pointerType" in event) {
9314 handler(event, event.pointerType);
9315 } else {
9316 handler(event, lastClickInteractionTypeRef.current);
9317 }
9318 lastClickInteractionTypeRef.current = "";
9319 }, [handler]);
9320 return {
9321 onClick: handleClick,
9322 onPointerDown: handlePointerDown
9323 };
9324 }
9325
9326 // node_modules/@base-ui/react/internals/useValueChanged.mjs
9327 var React41 = __toESM(require_react(), 1);
9328 function useValueChanged(value, onChange) {
9329 const valueRef = React41.useRef(value);
9330 const onChangeCallback = useStableCallback(onChange);
9331 useIsoLayoutEffect(() => {
9332 if (valueRef.current !== value) {
9333 onChangeCallback(valueRef.current);
9334 }
9335 valueRef.current = value;
9336 }, [value, onChangeCallback]);
9337 }
9338
9339 // node_modules/@base-ui/react/utils/useOpenInteractionType.mjs
9340 function useOpenMethodTriggerProps(open, setOpenMethod) {
9341 const handleTriggerClick = useStableCallback((_, interactionType) => {
9342 const isOpen = typeof open === "function" ? open() : open;
9343 if (!isOpen) {
9344 setOpenMethod(interactionType || // On iOS Safari, the hitslop around touch targets means tapping outside an element's
9345 // bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType`
9346 // will be "" in that case.
9347 (parts_exports.os.ios ? "touch" : ""));
9348 }
9349 });
9350 const {
9351 onClick,
9352 onPointerDown
9353 } = useEnhancedClickHandler(handleTriggerClick);
9354 return React42.useMemo(() => ({
9355 onClick,
9356 onPointerDown
9357 }), [onClick, onPointerDown]);
9358 }
9359 function useOpenInteractionType(open) {
9360 const [openMethod, setOpenMethod] = React42.useState(null);
9361 const triggerProps = useOpenMethodTriggerProps(open, setOpenMethod);
9362 useValueChanged(open, (previousOpen) => {
9363 if (previousOpen && !open) {
9364 setOpenMethod(null);
9365 }
9366 });
9367 return React42.useMemo(() => ({
9368 openMethod,
9369 triggerProps
9370 }), [openMethod, triggerProps]);
9371 }
9372
9373 // node_modules/@base-ui/react/autocomplete/index.parts.mjs
9374 var index_parts_exports = {};
9375 __export(index_parts_exports, {
9376 Arrow: () => ComboboxArrow,
9377 Backdrop: () => ComboboxBackdrop,
9378 Clear: () => ComboboxClear,
9379 Collection: () => ComboboxCollection,
9380 Empty: () => ComboboxEmpty,
9381 Group: () => ComboboxGroup,
9382 GroupLabel: () => ComboboxGroupLabel,
9383 Icon: () => ComboboxIcon,
9384 Input: () => ComboboxInput,
9385 InputGroup: () => AutocompleteInputGroup,
9386 Item: () => AutocompleteItem,
9387 List: () => ComboboxList,
9388 Popup: () => ComboboxPopup,
9389 Portal: () => ComboboxPortal,
9390 Positioner: () => ComboboxPositioner,
9391 Root: () => AutocompleteRoot,
9392 Row: () => ComboboxRow,
9393 Separator: () => AutocompleteSeparator,
9394 Status: () => ComboboxStatus,
9395 Trigger: () => AutocompleteTrigger,
9396 Value: () => AutocompleteValue,
9397 useFilter: () => useCoreFilter,
9398 useFilteredItems: () => useFilteredItems
9399 });
9400
9401 // node_modules/@base-ui/react/autocomplete/root/AutocompleteRoot.mjs
9402 var React53 = __toESM(require_react(), 1);
9403
9404 // node_modules/@base-ui/react/combobox/root/AriaCombobox.mjs
9405 var React52 = __toESM(require_react(), 1);
9406
9407 // node_modules/@base-ui/utils/useOnFirstRender.mjs
9408 var React43 = __toESM(require_react(), 1);
9409 function useOnFirstRender(fn) {
9410 const ref = React43.useRef(true);
9411 if (ref.current) {
9412 ref.current = false;
9413 fn();
9414 }
9415 }
9416
9417 // node_modules/@base-ui/react/floating-ui-react/hooks/gridNavigation.mjs
9418 function gridNavigation(event, prevIndex, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex, cols = 2) {
9419 const nextIndex = getGridNavigatedIndex(listRef.current, {
9420 event,
9421 orientation,
9422 loopFocus,
9423 rtl,
9424 cols,
9425 disabledIndices,
9426 minIndex,
9427 maxIndex,
9428 // An out-of-range previous index falls back to the first enabled item.
9429 prevIndex: prevIndex > maxIndex ? minIndex : prevIndex,
9430 stopEvent: true
9431 });
9432 return isIndexOutOfListBounds(listRef.current, nextIndex) ? void 0 : nextIndex;
9433 }
9434
9435 // node_modules/@base-ui/react/combobox/root/ComboboxRootContext.mjs
9436 var React44 = __toESM(require_react(), 1);
9437 var ComboboxRootContext = /* @__PURE__ */ React44.createContext(void 0);
9438 if (true) ComboboxRootContext.displayName = "ComboboxRootContext";
9439 var ComboboxFloatingContext = /* @__PURE__ */ React44.createContext(void 0);
9440 if (true) ComboboxFloatingContext.displayName = "ComboboxFloatingContext";
9441 var ComboboxDerivedItemsContext = /* @__PURE__ */ React44.createContext(void 0);
9442 if (true) ComboboxDerivedItemsContext.displayName = "ComboboxDerivedItemsContext";
9443 var ComboboxHasItemsContext = /* @__PURE__ */ React44.createContext(false);
9444 if (true) ComboboxHasItemsContext.displayName = "ComboboxHasItemsContext";
9445 var ComboboxInputValueContext = /* @__PURE__ */ React44.createContext("");
9446 if (true) ComboboxInputValueContext.displayName = "ComboboxInputValueContext";
9447 function useComboboxRootContext() {
9448 const context = React44.useContext(ComboboxRootContext);
9449 if (!context) {
9450 throw new Error(true ? "Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage_default(22));
9451 }
9452 return context;
9453 }
9454 function useComboboxFloatingContext() {
9455 const context = React44.useContext(ComboboxFloatingContext);
9456 if (!context) {
9457 throw new Error(true ? "Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage_default(23));
9458 }
9459 return context;
9460 }
9461 function useComboboxDerivedItemsContext() {
9462 const context = React44.useContext(ComboboxDerivedItemsContext);
9463 if (!context) {
9464 throw new Error(true ? "Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage_default(24));
9465 }
9466 return context;
9467 }
9468 function useComboboxInputValueContext() {
9469 return React44.useContext(ComboboxInputValueContext);
9470 }
9471 function useComboboxHasItemsContext() {
9472 return React44.useContext(ComboboxHasItemsContext);
9473 }
9474
9475 // node_modules/@base-ui/react/internals/itemEquality.mjs
9476 var defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
9477 function compareItemEquality(itemValue, selectedValue, comparer) {
9478 if (itemValue == null || selectedValue == null) {
9479 return Object.is(itemValue, selectedValue);
9480 }
9481 return comparer(itemValue, selectedValue);
9482 }
9483 function selectedValueIncludes(selectedValues, itemValue, comparer) {
9484 if (!selectedValues || selectedValues.length === 0) {
9485 return false;
9486 }
9487 return selectedValues.some((selectedValue) => {
9488 if (selectedValue === void 0) {
9489 return false;
9490 }
9491 return compareItemEquality(itemValue, selectedValue, comparer);
9492 });
9493 }
9494 function findItemIndex(itemValues, selectedValue, comparer) {
9495 if (!itemValues || itemValues.length === 0) {
9496 return -1;
9497 }
9498 return itemValues.findIndex((itemValue) => {
9499 if (itemValue === void 0) {
9500 return false;
9501 }
9502 return compareItemEquality(itemValue, selectedValue, comparer);
9503 });
9504 }
9505 function findSelectionIndex(itemValues, selectedValue, comparer, multiple) {
9506 const lastValue = multiple && Array.isArray(selectedValue) ? selectedValue[selectedValue.length - 1] : selectedValue;
9507 const index2 = findItemIndex(itemValues, lastValue, comparer);
9508 return index2 === -1 ? null : index2;
9509 }
9510 function removeItem(selectedValues, itemValue, comparer) {
9511 return selectedValues.filter((selectedValue) => !compareItemEquality(itemValue, selectedValue, comparer));
9512 }
9513
9514 // node_modules/@base-ui/react/internals/resolveValueLabel.mjs
9515 var React45 = __toESM(require_react(), 1);
9516
9517 // node_modules/@base-ui/react/internals/serializeValue.mjs
9518 function serializeValue(value) {
9519 if (value == null) {
9520 return "";
9521 }
9522 if (typeof value === "string") {
9523 return value;
9524 }
9525 try {
9526 return JSON.stringify(value);
9527 } catch {
9528 return String(value);
9529 }
9530 }
9531
9532 // node_modules/@base-ui/react/internals/resolveValueLabel.mjs
9533 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
9534 function isGroupedItems(items) {
9535 return items != null && items.length > 0 && typeof items[0] === "object" && items[0] != null && "items" in items[0];
9536 }
9537 function hasNullItemLabel(items) {
9538 if (!Array.isArray(items)) {
9539 return items != null && "null" in items;
9540 }
9541 const arrayItems = items;
9542 if (isGroupedItems(arrayItems)) {
9543 for (const group of arrayItems) {
9544 for (const item of group.items) {
9545 if (item && item.value == null && item.label != null) {
9546 return true;
9547 }
9548 }
9549 }
9550 return false;
9551 }
9552 for (const item of arrayItems) {
9553 if (item && item.value == null && item.label != null) {
9554 return true;
9555 }
9556 }
9557 return false;
9558 }
9559 function stringifyAsLabel(item, itemToStringLabel) {
9560 if (itemToStringLabel && item != null) {
9561 return itemToStringLabel(item) ?? "";
9562 }
9563 if (item && typeof item === "object") {
9564 if ("label" in item && item.label != null) {
9565 return String(item.label);
9566 }
9567 if ("value" in item) {
9568 return String(item.value);
9569 }
9570 }
9571 return serializeValue(item);
9572 }
9573 function stringifyAsValue(item, itemToStringValue) {
9574 if (itemToStringValue && item != null) {
9575 return itemToStringValue(item) ?? "";
9576 }
9577 if (item && typeof item === "object" && "value" in item && "label" in item) {
9578 return serializeValue(item.value);
9579 }
9580 return serializeValue(item);
9581 }
9582
9583 // node_modules/@base-ui/react/combobox/store.mjs
9584 var selectors2 = {
9585 id: (state) => state.id,
9586 labelId: (state) => state.labelId,
9587 items: (state) => state.items,
9588 selectedValue: (state) => state.selectedValue,
9589 hasSelectionChips: (state) => {
9590 const selectedValue = state.selectedValue;
9591 return Array.isArray(selectedValue) && selectedValue.length > 0;
9592 },
9593 hasSelectedValue: (state) => {
9594 const {
9595 selectedValue,
9596 selectionMode
9597 } = state;
9598 if (selectedValue == null) {
9599 return false;
9600 }
9601 if (selectionMode === "multiple" && Array.isArray(selectedValue)) {
9602 return selectedValue.length > 0;
9603 }
9604 return true;
9605 },
9606 hasNullItemLabel: (state, enabled) => {
9607 return enabled ? hasNullItemLabel(state.items) : false;
9608 },
9609 open: (state) => state.open,
9610 mounted: (state) => state.mounted,
9611 forceMounted: (state) => state.forceMounted,
9612 inline: (state) => state.inline,
9613 activeIndex: (state) => state.activeIndex,
9614 selectedIndex: (state) => state.selectedIndex,
9615 isActive: (state, index2) => state.activeIndex === index2,
9616 isSelected: (state, itemValue) => {
9617 const comparer = state.isItemEqualToValue;
9618 const selectedValue = state.selectedValue;
9619 if (Array.isArray(selectedValue)) {
9620 return selectedValue.some((selectedItem) => compareItemEquality(itemValue, selectedItem, comparer));
9621 }
9622 return compareItemEquality(itemValue, selectedValue, comparer);
9623 },
9624 transitionStatus: (state) => state.transitionStatus,
9625 popupProps: (state) => state.popupProps,
9626 listProps: (state) => state.listProps,
9627 inputProps: (state) => state.inputProps,
9628 triggerProps: (state) => state.triggerProps,
9629 itemProps: (state) => state.itemProps,
9630 positionerElement: (state) => state.positionerElement,
9631 listElement: (state) => state.listElement,
9632 popupId: (state) => state.popupId,
9633 triggerElement: (state) => state.triggerElement,
9634 inputElement: (state) => state.inputElement,
9635 inputGroupElement: (state) => state.inputGroupElement,
9636 popupSide: (state) => state.popupSide,
9637 openMethod: (state) => state.openMethod,
9638 inputInsidePopup: (state) => state.inputInsidePopup,
9639 inputOwnsFormValue: (state) => state.inputOwnsFormValue,
9640 selectionMode: (state) => state.selectionMode,
9641 name: (state) => state.name,
9642 form: (state) => state.form,
9643 disabled: (state) => state.disabled,
9644 readOnly: (state) => state.readOnly,
9645 required: (state) => state.required,
9646 grid: (state) => state.grid,
9647 virtualized: (state) => state.virtualized,
9648 itemToStringLabel: (state) => state.itemToStringLabel,
9649 isItemEqualToValue: (state) => state.isItemEqualToValue,
9650 modal: (state) => state.modal,
9651 autoHighlight: (state) => state.autoHighlight
9652 };
9653
9654 // node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
9655 var React46 = __toESM(require_react(), 1);
9656
9657 // node_modules/@base-ui/react/internals/field-constants/constants.mjs
9658 var DEFAULT_VALIDITY_STATE = {
9659 badInput: false,
9660 customError: false,
9661 patternMismatch: false,
9662 rangeOverflow: false,
9663 rangeUnderflow: false,
9664 stepMismatch: false,
9665 tooLong: false,
9666 tooShort: false,
9667 typeMismatch: false,
9668 valid: null,
9669 valueMissing: false
9670 };
9671 var DEFAULT_FIELD_STATE_ATTRIBUTES = {
9672 valid: null,
9673 touched: false,
9674 dirty: false,
9675 filled: false,
9676 focused: false
9677 };
9678 var DEFAULT_FIELD_ROOT_STATE = {
9679 disabled: false,
9680 ...DEFAULT_FIELD_STATE_ATTRIBUTES
9681 };
9682 var fieldValidityMapping = {
9683 valid(value) {
9684 if (value === null) {
9685 return null;
9686 }
9687 if (value) {
9688 return {
9689 "data-valid": ""
9690 };
9691 }
9692 return {
9693 "data-invalid": ""
9694 };
9695 }
9696 };
9697
9698 // node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
9699 var DEFAULT_FIELD_ROOT_CONTEXT = {
9700 invalid: void 0,
9701 name: void 0,
9702 validityData: {
9703 state: DEFAULT_VALIDITY_STATE,
9704 errors: [],
9705 error: "",
9706 value: "",
9707 initialValue: null
9708 },
9709 setValidityData: NOOP,
9710 disabled: void 0,
9711 setTouched: NOOP,
9712 setDirty: NOOP,
9713 setFilled: NOOP,
9714 setFocused: NOOP,
9715 validationMode: "onSubmit",
9716 shouldValidateOnChange: () => false,
9717 state: DEFAULT_FIELD_ROOT_STATE,
9718 registerFieldControl: NOOP,
9719 validation: {
9720 getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,
9721 inputRef: {
9722 current: null
9723 },
9724 registeredInputs: /* @__PURE__ */ new Map(),
9725 registerInput: NOOP,
9726 getInputControl: () => null,
9727 commit: async () => {
9728 },
9729 change: NOOP
9730 }
9731 };
9732 var FieldRootContext = /* @__PURE__ */ React46.createContext(DEFAULT_FIELD_ROOT_CONTEXT);
9733 if (true) FieldRootContext.displayName = "FieldRootContext";
9734 function useFieldRootContext(optional = true) {
9735 const context = React46.useContext(FieldRootContext);
9736 if (context.setValidityData === NOOP && !optional) {
9737 throw new Error(true ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : formatErrorMessage_default(28));
9738 }
9739 return context;
9740 }
9741
9742 // node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs
9743 function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {
9744 const {
9745 registerFieldControl
9746 } = useFieldRootContext();
9747 const sourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol());
9748 useIsoLayoutEffect(() => {
9749 const source = sourceRef.current;
9750 if (!enabled) {
9751 registerFieldControl(source, void 0);
9752 return;
9753 }
9754 const registration = {
9755 controlRef,
9756 getValue: getFormValueOverride,
9757 id,
9758 name,
9759 value
9760 };
9761 registerFieldControl(source, registration);
9762 }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, sourceRef, value]);
9763 useIsoLayoutEffect(() => {
9764 const source = sourceRef.current;
9765 return () => {
9766 registerFieldControl(source, void 0);
9767 };
9768 }, [registerFieldControl, sourceRef]);
9769 }
9770
9771 // node_modules/@base-ui/react/internals/form-context/FormContext.mjs
9772 var React47 = __toESM(require_react(), 1);
9773 var FormContext = /* @__PURE__ */ React47.createContext({
9774 elementRef: {
9775 current: null
9776 },
9777 formRef: {
9778 current: {
9779 fields: /* @__PURE__ */ new Map()
9780 }
9781 },
9782 errors: {},
9783 clearErrors: NOOP,
9784 validationMode: "onSubmit",
9785 submitAttemptedRef: {
9786 current: false
9787 }
9788 });
9789 if (true) FormContext.displayName = "FormContext";
9790 function useFormContext() {
9791 return React47.useContext(FormContext);
9792 }
9793
9794 // node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
9795 var React49 = __toESM(require_react(), 1);
9796
9797 // node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs
9798 var React48 = __toESM(require_react(), 1);
9799 var LabelableContext = /* @__PURE__ */ React48.createContext({
9800 controlId: void 0,
9801 registerControlId: NOOP,
9802 labelId: void 0,
9803 setLabelId: NOOP,
9804 messageIds: [],
9805 setMessageIds: NOOP,
9806 getDescriptionProps: (externalProps) => externalProps
9807 });
9808 if (true) LabelableContext.displayName = "LabelableContext";
9809 function useLabelableContext() {
9810 return React48.useContext(LabelableContext);
9811 }
9812
9813 // node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
9814 function useLabelableId(params = {}) {
9815 const {
9816 id,
9817 implicit = false,
9818 controlRef
9819 } = params;
9820 const {
9821 controlId,
9822 registerControlId
9823 } = useLabelableContext();
9824 const defaultId = useBaseUiId(id);
9825 const controlIdForEffect = implicit ? controlId : void 0;
9826 const controlSourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol());
9827 const hasRegisteredRef = React49.useRef(false);
9828 const hadExplicitIdRef = React49.useRef(id != null);
9829 const unregisterControlId = useStableCallback(() => {
9830 if (!hasRegisteredRef.current || registerControlId === NOOP) {
9831 return;
9832 }
9833 hasRegisteredRef.current = false;
9834 registerControlId(controlSourceRef.current, void 0);
9835 });
9836 useIsoLayoutEffect(() => {
9837 if (registerControlId === NOOP) {
9838 return void 0;
9839 }
9840 let nextId;
9841 if (implicit) {
9842 const elem = controlRef?.current;
9843 if (isElement(elem) && elem.closest("label") != null) {
9844 nextId = id ?? null;
9845 } else {
9846 nextId = controlIdForEffect ?? defaultId;
9847 }
9848 } else if (id != null) {
9849 hadExplicitIdRef.current = true;
9850 nextId = id;
9851 } else if (hadExplicitIdRef.current) {
9852 nextId = defaultId;
9853 } else {
9854 unregisterControlId();
9855 return void 0;
9856 }
9857 if (nextId === void 0) {
9858 unregisterControlId();
9859 return void 0;
9860 }
9861 hasRegisteredRef.current = true;
9862 registerControlId(controlSourceRef.current, nextId);
9863 return void 0;
9864 }, [id, controlRef, controlIdForEffect, registerControlId, implicit, defaultId, controlSourceRef, unregisterControlId]);
9865 React49.useEffect(() => {
9866 return unregisterControlId;
9867 }, [unregisterControlId]);
9868 return controlId ?? defaultId;
9869 }
9870
9871 // node_modules/@base-ui/react/combobox/root/utils/index.mjs
9872 function getComboboxPopupId(rootId) {
9873 return rootId == null ? void 0 : `${rootId}-popup`;
9874 }
9875 function createCollatorItemFilter(collatorFilter, itemToStringLabel) {
9876 return (item, query) => {
9877 if (item == null) {
9878 return false;
9879 }
9880 return collatorFilter.contains(item, query, itemToStringLabel);
9881 };
9882 }
9883
9884 // node_modules/@base-ui/react/combobox/root/utils/useFilter.mjs
9885 var React50 = __toESM(require_react(), 1);
9886
9887 // node_modules/@base-ui/react/utils/stringifyLocale.mjs
9888 function stringifyLocale(locale) {
9889 if (Array.isArray(locale)) {
9890 return locale.map((value) => stringifyLocale(value)).join(",");
9891 }
9892 if (locale == null) {
9893 return "";
9894 }
9895 return String(locale);
9896 }
9897
9898 // node_modules/@base-ui/react/internals/filter.mjs
9899 var filterCache = /* @__PURE__ */ new Map();
9900 function getFilter(options = {}) {
9901 const mergedOptions = {
9902 usage: "search",
9903 sensitivity: "base",
9904 ignorePunctuation: true,
9905 ...options
9906 };
9907 const cacheKey = `${stringifyLocale(options.locale)}|${JSON.stringify(mergedOptions)}`;
9908 const cachedFilter = filterCache.get(cacheKey);
9909 if (cachedFilter) {
9910 return cachedFilter;
9911 }
9912 const collator = new Intl.Collator(options.locale, mergedOptions);
9913 const filter = {
9914 contains(item, query, itemToString) {
9915 if (!query) {
9916 return true;
9917 }
9918 const itemString = stringifyAsLabel(item, itemToString);
9919 for (let i = 0; i <= itemString.length - query.length; i += 1) {
9920 if (collator.compare(itemString.slice(i, i + query.length), query) === 0) {
9921 return true;
9922 }
9923 }
9924 return false;
9925 },
9926 startsWith(item, query, itemToString) {
9927 if (!query) {
9928 return true;
9929 }
9930 const itemString = stringifyAsLabel(item, itemToString);
9931 return collator.compare(itemString.slice(0, query.length), query) === 0;
9932 },
9933 endsWith(item, query, itemToString) {
9934 if (!query) {
9935 return true;
9936 }
9937 const itemString = stringifyAsLabel(item, itemToString);
9938 const queryLength = query.length;
9939 return itemString.length >= queryLength && collator.compare(itemString.slice(itemString.length - queryLength), query) === 0;
9940 }
9941 };
9942 filterCache.set(cacheKey, filter);
9943 return filter;
9944 }
9945
9946 // node_modules/@base-ui/react/combobox/root/utils/useFilter.mjs
9947 var useCoreFilter = getFilter;
9948
9949 // node_modules/@base-ui/react/utils/scrollable.mjs
9950 function isScrollableY(element, allowOverflowIntent = false) {
9951 const {
9952 overflowY
9953 } = getComputedStyle2(element);
9954 if (overflowY !== "auto" && overflowY !== "scroll") {
9955 return false;
9956 }
9957 return allowOverflowIntent ? element.clientHeight > 0 : element.scrollHeight > element.clientHeight;
9958 }
9959
9960 // node_modules/@base-ui/react/internals/areArraysEqual.mjs
9961 function areArraysEqual(array1, array2, itemComparer = (a, b) => a === b) {
9962 return array1.length === array2.length && array1.every((value, index2) => itemComparer(value, array2[index2]));
9963 }
9964
9965 // node_modules/@base-ui/react/combobox/root/utils/constants.mjs
9966 var NO_ACTIVE_VALUE = /* @__PURE__ */ Symbol("none");
9967 var INITIAL_LAST_HIGHLIGHT = {
9968 value: NO_ACTIVE_VALUE,
9969 index: -1
9970 };
9971
9972 // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs
9973 var React51 = __toESM(require_react(), 1);
9974 var DirectionContext = /* @__PURE__ */ React51.createContext(void 0);
9975 if (true) DirectionContext.displayName = "DirectionContext";
9976 function useDirection() {
9977 const context = React51.useContext(DirectionContext);
9978 return context?.direction ?? "ltr";
9979 }
9980
9981 // node_modules/@base-ui/react/combobox/root/AriaCombobox.mjs
9982 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
9983 function AriaCombobox(props) {
9984 const {
9985 id: idProp,
9986 onOpenChangeComplete: onOpenChangeCompleteProp,
9987 defaultSelectedValue = null,
9988 selectedValue: selectedValueProp,
9989 onSelectedValueChange,
9990 defaultInputValue: defaultInputValueProp,
9991 inputValue: inputValueProp,
9992 open: openProp,
9993 defaultOpen = false,
9994 selectionMode,
9995 onItemHighlighted: onItemHighlightedProp,
9996 name: nameProp,
9997 form,
9998 disabled: disabledProp = false,
9999 readOnly = false,
10000 required = false,
10001 inputRef: inputRefProp,
10002 grid = false,
10003 items,
10004 filteredItems: filteredItemsProp,
10005 filter: filterProp,
10006 openOnInputClick = true,
10007 autoHighlight = false,
10008 keepHighlight = false,
10009 highlightItemOnHover = true,
10010 loopFocus = true,
10011 itemToStringLabel,
10012 itemToStringValue,
10013 isItemEqualToValue = defaultItemEquality,
10014 virtualized = false,
10015 inline: inlineProp = false,
10016 fillInputOnItemPress = true,
10017 modal = false,
10018 limit = -1,
10019 autoComplete = "list",
10020 formAutoComplete,
10021 locale,
10022 submitOnItemClick = false
10023 } = props;
10024 const {
10025 clearErrors
10026 } = useFormContext();
10027 const {
10028 setDirty,
10029 validityData,
10030 setFilled,
10031 name: fieldName,
10032 disabled: fieldDisabled,
10033 setTouched,
10034 setFocused,
10035 validationMode,
10036 validation
10037 } = useFieldRootContext();
10038 const direction = useDirection();
10039 const id = useLabelableId({
10040 id: idProp
10041 });
10042 const collatorFilter = useCoreFilter({
10043 locale
10044 });
10045 const [queryChangedAfterOpen, setQueryChangedAfterOpen] = React52.useState(false);
10046 const [closeQuery, setCloseQuery] = React52.useState(null);
10047 const listRef = React52.useRef([]);
10048 const labelsRef = React52.useRef([]);
10049 const popupRef = React52.useRef(null);
10050 const inputRef = React52.useRef(null);
10051 const startDismissRef = React52.useRef(null);
10052 const endDismissRef = React52.useRef(null);
10053 const emptyRef = React52.useRef(null);
10054 const keyboardActiveRef = React52.useRef(true);
10055 const hadInputClearRef = React52.useRef(false);
10056 const chipsContainerRef = React52.useRef(null);
10057 const clearRef = React52.useRef(null);
10058 const selectionEventRef = React52.useRef(null);
10059 const lastHighlightRef = React52.useRef(INITIAL_LAST_HIGHLIGHT);
10060 const pendingQueryHighlightRef = React52.useRef(null);
10061 const valuesRef = React52.useRef([]);
10062 const pointerDownItemRef = React52.useRef(null);
10063 const disabled2 = fieldDisabled || disabledProp;
10064 const name = fieldName ?? nameProp;
10065 const multiple = selectionMode === "multiple";
10066 const single = selectionMode === "single";
10067 const hasInputValue = inputValueProp !== void 0 || defaultInputValueProp !== void 0;
10068 const hasItems = items !== void 0;
10069 const hasFilteredItemsProp = filteredItemsProp !== void 0;
10070 let autoHighlightMode;
10071 if (autoHighlight === "always") {
10072 autoHighlightMode = "always";
10073 } else {
10074 autoHighlightMode = autoHighlight ? "input-change" : false;
10075 }
10076 const [selectedValue, setSelectedValueUnwrapped] = useControlled({
10077 controlled: selectedValueProp,
10078 default: multiple ? defaultSelectedValue ?? EMPTY_ARRAY : defaultSelectedValue,
10079 name: "Combobox",
10080 state: "selectedValue"
10081 });
10082 const filter = React52.useMemo(() => {
10083 if (filterProp === null) {
10084 return () => true;
10085 }
10086 if (filterProp !== void 0) {
10087 return filterProp;
10088 }
10089 return createCollatorItemFilter(collatorFilter, itemToStringLabel);
10090 }, [filterProp, collatorFilter, itemToStringLabel]);
10091 const initialDefaultInputValue = useRefWithInit(() => {
10092 if (hasInputValue) {
10093 return defaultInputValueProp ?? "";
10094 }
10095 if (single) {
10096 return stringifyAsLabel(selectedValue, itemToStringLabel);
10097 }
10098 return "";
10099 }).current;
10100 const [inputValue, setInputValueUnwrapped] = useControlled({
10101 controlled: inputValueProp,
10102 default: initialDefaultInputValue,
10103 name: "Combobox",
10104 state: "inputValue"
10105 });
10106 const [open, setOpenUnwrapped] = useControlled({
10107 controlled: openProp,
10108 default: defaultOpen,
10109 name: "Combobox",
10110 state: "open"
10111 });
10112 const isGrouped = isGroupedItems(items);
10113 const query = closeQuery ?? String(inputValue).trim();
10114 const selectedLabelString = single ? stringifyAsLabel(selectedValue, itemToStringLabel) : "";
10115 const shouldBypassFiltering = single && !queryChangedAfterOpen && query !== "" && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query);
10116 const filterQuery = shouldBypassFiltering ? "" : query;
10117 const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering;
10118 const flatItems = React52.useMemo(() => {
10119 if (!items) {
10120 return EMPTY_ARRAY;
10121 }
10122 if (isGrouped) {
10123 return items.flatMap((group) => group.items);
10124 }
10125 return items;
10126 }, [items, isGrouped]);
10127 const filteredItems = React52.useMemo(() => {
10128 if (filteredItemsProp && !shouldIgnoreExternalFiltering) {
10129 return filteredItemsProp;
10130 }
10131 if (!items) {
10132 return EMPTY_ARRAY;
10133 }
10134 if (isGrouped) {
10135 const groupedItems = items;
10136 const resultingGroups = [];
10137 let currentCount = 0;
10138 for (const group of groupedItems) {
10139 if (limit > -1 && currentCount >= limit) {
10140 break;
10141 }
10142 const remainingLimit = limit > -1 ? limit - currentCount : Infinity;
10143 const itemsToTake = filterQuery === "" ? group.items.slice(0, remainingLimit) : [];
10144 if (filterQuery !== "") {
10145 for (const item of group.items) {
10146 if (itemsToTake.length >= remainingLimit) {
10147 break;
10148 }
10149 if (filter(item, filterQuery, itemToStringLabel)) {
10150 itemsToTake.push(item);
10151 }
10152 }
10153 }
10154 if (itemsToTake.length > 0) {
10155 const newGroup = {
10156 ...group,
10157 items: itemsToTake
10158 };
10159 resultingGroups.push(newGroup);
10160 currentCount += itemsToTake.length;
10161 }
10162 }
10163 return resultingGroups;
10164 }
10165 if (filterQuery === "") {
10166 return limit > -1 ? flatItems.slice(0, limit) : (
10167 // The cast here is done as `flatItems` is readonly.
10168 // valuesRef.current, a mutable ref, can be set to `flatFilteredItems`, which may
10169 // reference this exact readonly value, creating a mutation risk.
10170 // However, <Combobox.Item> can never mutate this value as the mutating effect
10171 // bails early when `items` is provided, and this is only ever returned
10172 // when `items` is provided due to the early return at the top of this hook.
10173 flatItems
10174 );
10175 }
10176 const limitedItems = [];
10177 for (const item of flatItems) {
10178 if (limit > -1 && limitedItems.length >= limit) {
10179 break;
10180 }
10181 if (filter(item, filterQuery, itemToStringLabel)) {
10182 limitedItems.push(item);
10183 }
10184 }
10185 return limitedItems;
10186 }, [filteredItemsProp, shouldIgnoreExternalFiltering, items, isGrouped, filterQuery, limit, filter, itemToStringLabel, flatItems]);
10187 const flatFilteredItems = React52.useMemo(() => {
10188 if (isGrouped) {
10189 const groups = filteredItems;
10190 return groups.flatMap((g) => g.items);
10191 }
10192 return filteredItems;
10193 }, [filteredItems, isGrouped]);
10194 const store = useRefWithInit(() => {
10195 let initialSelectedIndex = null;
10196 if (inlineProp && open && hasItems && selectionMode !== "none") {
10197 initialSelectedIndex = findSelectionIndex(flatFilteredItems, selectedValue, isItemEqualToValue, multiple);
10198 }
10199 return new Store({
10200 id,
10201 labelId: void 0,
10202 selectedValue,
10203 open,
10204 items,
10205 selectionMode,
10206 listRef,
10207 labelsRef,
10208 popupRef,
10209 emptyRef,
10210 inputRef,
10211 startDismissRef,
10212 endDismissRef,
10213 keyboardActiveRef,
10214 chipsContainerRef,
10215 clearRef,
10216 valuesRef,
10217 pointerDownItemRef,
10218 selectionEventRef,
10219 name,
10220 form,
10221 disabled: disabled2,
10222 readOnly,
10223 required,
10224 grid,
10225 virtualized,
10226 openOnInputClick,
10227 itemToStringLabel,
10228 isItemEqualToValue,
10229 modal,
10230 autoHighlight: autoHighlightMode,
10231 submitOnItemClick,
10232 hasInputValue,
10233 mounted: false,
10234 forceMounted: false,
10235 transitionStatus: "idle",
10236 inline: inlineProp,
10237 activeIndex: null,
10238 selectedIndex: initialSelectedIndex,
10239 popupProps: {},
10240 listProps: {},
10241 inputProps: {},
10242 triggerProps: {},
10243 itemProps: EMPTY_OBJECT,
10244 positionerElement: null,
10245 listElement: null,
10246 popupId: void 0,
10247 triggerElement: null,
10248 inputElement: null,
10249 inputGroupElement: null,
10250 popupSide: null,
10251 openMethod: null,
10252 inputInsidePopup: true,
10253 // Avoid duplicate names in the server HTML. Popup inputs aren't rendered
10254 // until after hydration, so the hidden input takes over then if needed.
10255 inputOwnsFormValue: selectionMode === "none",
10256 // Placeholder callbacks replaced on first render
10257 onOpenChangeComplete: NOOP,
10258 setOpen: NOOP,
10259 setInputValue: NOOP,
10260 setSelectedValue: NOOP,
10261 setIndices: NOOP,
10262 handleSelection: NOOP,
10263 forceMount: NOOP,
10264 requestSubmit: NOOP
10265 });
10266 }).current;
10267 const fieldRawValue = selectionMode === "none" ? inputValue : selectedValue;
10268 const fieldStringValue = React52.useMemo(() => {
10269 if (selectionMode === "none") {
10270 return fieldRawValue;
10271 }
10272 if (Array.isArray(selectedValue)) {
10273 return selectedValue.map((value) => stringifyAsValue(value, itemToStringValue));
10274 }
10275 return stringifyAsValue(selectedValue, itemToStringValue);
10276 }, [fieldRawValue, itemToStringValue, selectionMode, selectedValue]);
10277 const onItemHighlighted = useStableCallback(onItemHighlightedProp);
10278 const onOpenChangeComplete = useStableCallback(onOpenChangeCompleteProp);
10279 const activeIndex = useStore(store, selectors2.activeIndex);
10280 const selectedIndex = useStore(store, selectors2.selectedIndex);
10281 const positionerElement = useStore(store, selectors2.positionerElement);
10282 const listElement = useStore(store, selectors2.listElement);
10283 const triggerElement = useStore(store, selectors2.triggerElement);
10284 const inputElement = useStore(store, selectors2.inputElement);
10285 const inputGroupElement = useStore(store, selectors2.inputGroupElement);
10286 const inline4 = useStore(store, selectors2.inline);
10287 const inputInsidePopup = useStore(store, selectors2.inputInsidePopup);
10288 const inputOwnsFormValue = useStore(store, selectors2.inputOwnsFormValue);
10289 const triggerRef = useValueAsRef(triggerElement);
10290 const {
10291 mounted,
10292 setMounted,
10293 transitionStatus
10294 } = useTransitionStatus(open);
10295 const {
10296 openMethod,
10297 triggerProps
10298 } = useOpenInteractionType(open);
10299 const getStringifiedValueForForm = useStableCallback(() => fieldStringValue);
10300 useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, id, fieldRawValue, getStringifiedValueForForm, !disabled2, nameProp);
10301 const forceMount = useStableCallback(() => {
10302 if (items) {
10303 labelsRef.current = flatFilteredItems.map((item) => stringifyAsLabel(item, itemToStringLabel));
10304 } else {
10305 store.set("forceMounted", true);
10306 }
10307 });
10308 const emitHighlight = useStableCallback((value, index2, type) => {
10309 if (index2 === -1) {
10310 if (lastHighlightRef.current === INITIAL_LAST_HIGHLIGHT) {
10311 return;
10312 }
10313 lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
10314 } else {
10315 lastHighlightRef.current = {
10316 value,
10317 index: index2
10318 };
10319 }
10320 onItemHighlighted(value, createGenericEventDetails(type, void 0, {
10321 index: index2
10322 }));
10323 });
10324 const setIndices = useStableCallback((options) => {
10325 store.update(options);
10326 const activeIndexOption = options.activeIndex;
10327 if (activeIndexOption === void 0) {
10328 return;
10329 }
10330 const type = options.type || reason_parts_exports.none;
10331 if (activeIndexOption === null) {
10332 emitHighlight(void 0, -1, type);
10333 } else {
10334 emitHighlight(valuesRef.current[activeIndexOption], activeIndexOption, type);
10335 }
10336 });
10337 const setInputValue = useStableCallback((next, eventDetails) => {
10338 hadInputClearRef.current = eventDetails.reason === reason_parts_exports.inputClear;
10339 props.onInputValueChange?.(next, eventDetails);
10340 if (eventDetails.isCanceled) {
10341 return;
10342 }
10343 if (eventDetails.reason === reason_parts_exports.inputChange) {
10344 if (open && closeQuery !== null) {
10345 setCloseQuery(null);
10346 }
10347 const event = eventDetails.event;
10348 const inputType = event.inputType;
10349 const isTypedInput = event.type === "compositionend" || inputType != null && inputType !== "" && inputType !== "insertReplacementText";
10350 if (isTypedInput) {
10351 const hasQuery = next.trim() !== "";
10352 if (hasQuery) {
10353 setQueryChangedAfterOpen(true);
10354 }
10355 pendingQueryHighlightRef.current = {
10356 hasQuery
10357 };
10358 const list = store.state.listElement;
10359 if (!store.state.virtualized && list) {
10360 const popup = popupRef.current;
10361 for (const ancestor of getOverflowAncestors(list.firstElementChild ?? list)) {
10362 if (!isHTMLElement(ancestor) || (popup ? !contains(popup, ancestor) : ancestor.getAttribute("role") === "dialog")) {
10363 break;
10364 }
10365 if (isScrollableY(ancestor)) {
10366 ancestor.scrollTop = 0;
10367 break;
10368 }
10369 }
10370 }
10371 if (hasQuery && autoHighlightMode && store.state.activeIndex == null && (open || inline4)) {
10372 store.set("activeIndex", 0);
10373 }
10374 }
10375 } else if (eventDetails.reason === reason_parts_exports.inputClear && next === "" && store.state.inputInsidePopup) {
10376 pendingQueryHighlightRef.current = {
10377 hasQuery: false,
10378 selection: true
10379 };
10380 }
10381 setInputValueUnwrapped(next);
10382 });
10383 const setOpen = useStableCallback((nextOpen, eventDetails) => {
10384 if (open === nextOpen) {
10385 return;
10386 }
10387 if (eventDetails.reason === reason_parts_exports.escapeKey && hasItems && flatFilteredItems.length === 0 && !emptyRef.current) {
10388 eventDetails.allowPropagation();
10389 }
10390 props.onOpenChange?.(nextOpen, eventDetails);
10391 if (eventDetails.isCanceled) {
10392 return;
10393 }
10394 if (nextOpen && inputInsidePopup && !inline4 && closeQuery !== null) {
10395 setQueryChangedAfterOpen(false);
10396 setCloseQuery(null);
10397 if (inputValue !== "" && eventDetails.reason !== reason_parts_exports.inputChange) {
10398 setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear, eventDetails.event));
10399 }
10400 }
10401 if (!nextOpen && queryChangedAfterOpen) {
10402 if (single) {
10403 if (!inline4) {
10404 setCloseQuery(query);
10405 }
10406 if (query === "") {
10407 setQueryChangedAfterOpen(false);
10408 }
10409 } else if (multiple) {
10410 if (!inline4) {
10411 setCloseQuery(query);
10412 }
10413 if (inputInsidePopup) {
10414 setIndices({
10415 activeIndex: null
10416 });
10417 }
10418 if (!inputInsidePopup || inline4) {
10419 setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear, eventDetails.event));
10420 }
10421 }
10422 }
10423 setOpenUnwrapped(nextOpen);
10424 if (!nextOpen && inputInsidePopup && (eventDetails.reason === reason_parts_exports.focusOut || eventDetails.reason === reason_parts_exports.outsidePress)) {
10425 setTouched(true);
10426 setFocused(false);
10427 if (validationMode === "onBlur") {
10428 const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
10429 validation.commit(valueToValidate);
10430 }
10431 }
10432 });
10433 const setSelectedValue = useStableCallback((nextValue, eventDetails) => {
10434 onSelectedValueChange?.(nextValue, eventDetails);
10435 if (eventDetails.isCanceled) {
10436 return;
10437 }
10438 setSelectedValueUnwrapped(nextValue);
10439 const shouldFillInput = selectionMode === "none" && popupRef.current && fillInputOnItemPress || single && !store.state.inputInsidePopup;
10440 if (shouldFillInput) {
10441 setInputValue(stringifyAsLabel(nextValue, itemToStringLabel), createChangeEventDetails(eventDetails.reason, eventDetails.event));
10442 }
10443 });
10444 const handleSelection = useStableCallback((event, itemValue) => {
10445 const targetEl = getTarget(event);
10446 const overrideEvent = selectionEventRef.current ?? event;
10447 selectionEventRef.current = null;
10448 const eventDetails = createChangeEventDetails(reason_parts_exports.itemPress, overrideEvent);
10449 const href = targetEl?.closest("a")?.getAttribute("href");
10450 if (href) {
10451 if (href.startsWith("#")) {
10452 setOpen(false, eventDetails);
10453 }
10454 return;
10455 }
10456 if (multiple) {
10457 const currentSelectedValue = Array.isArray(selectedValue) ? selectedValue : [];
10458 const isCurrentlySelected = selectedValueIncludes(currentSelectedValue, itemValue, isItemEqualToValue);
10459 const nextValue = isCurrentlySelected ? removeItem(currentSelectedValue, itemValue, isItemEqualToValue) : [...currentSelectedValue, itemValue];
10460 setSelectedValue(nextValue, eventDetails);
10461 if (eventDetails.isCanceled) {
10462 return;
10463 }
10464 const wasFiltering = inputRef.current ? inputRef.current.value.trim() !== "" : false;
10465 if (!wasFiltering) {
10466 return;
10467 }
10468 if (store.state.inputInsidePopup) {
10469 setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear, eventDetails.event));
10470 } else {
10471 setOpen(false, eventDetails);
10472 }
10473 } else {
10474 setSelectedValue(itemValue, eventDetails);
10475 if (eventDetails.isCanceled) {
10476 return;
10477 }
10478 setOpen(false, eventDetails);
10479 }
10480 });
10481 const requestSubmit = useStableCallback(() => {
10482 const formElement = validation.inputRef.current?.form ?? store.state.inputElement?.form;
10483 if (formElement && typeof formElement.requestSubmit === "function") {
10484 formElement.requestSubmit();
10485 }
10486 });
10487 const handleUnmount = useStableCallback(() => {
10488 setMounted(false);
10489 onOpenChangeComplete?.(false);
10490 setQueryChangedAfterOpen(false);
10491 setCloseQuery(null);
10492 if (selectionMode === "none") {
10493 setIndices({
10494 activeIndex: null,
10495 selectedIndex: null
10496 });
10497 } else {
10498 setIndices({
10499 activeIndex: null
10500 });
10501 }
10502 if (multiple && inputRef.current && inputRef.current.value !== "" && !hadInputClearRef.current) {
10503 setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear));
10504 }
10505 if (single) {
10506 if (store.state.inputInsidePopup) {
10507 if (inputRef.current && inputRef.current.value !== "") {
10508 setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear));
10509 }
10510 } else {
10511 const stringVal = stringifyAsLabel(selectedValue, itemToStringLabel);
10512 if (inputRef.current && inputRef.current.value !== stringVal) {
10513 const reason = stringVal === "" ? reason_parts_exports.inputClear : reason_parts_exports.none;
10514 setInputValue(stringVal, createChangeEventDetails(reason));
10515 }
10516 }
10517 }
10518 });
10519 const resolvedPopupRef = React52.useMemo(() => {
10520 if (inline4 && positionerElement) {
10521 return {
10522 current: positionerElement.closest('[role="dialog"]')
10523 };
10524 }
10525 return popupRef;
10526 }, [inline4, positionerElement]);
10527 useOpenChangeComplete({
10528 enabled: !props.actionsRef,
10529 open,
10530 ref: resolvedPopupRef,
10531 onComplete() {
10532 if (!open) {
10533 handleUnmount();
10534 }
10535 }
10536 });
10537 React52.useImperativeHandle(props.actionsRef, () => ({
10538 unmount: handleUnmount
10539 }), [handleUnmount]);
10540 useIsoLayoutEffect(function syncClosedState() {
10541 if (open) {
10542 return;
10543 }
10544 pointerDownItemRef.current = null;
10545 if (selectionMode === "none") {
10546 return;
10547 }
10548 const registry = hasItems ? flatItems : valuesRef.current;
10549 setIndices({
10550 selectedIndex: findSelectionIndex(registry, selectedValue, isItemEqualToValue, multiple)
10551 });
10552 }, [open, selectedValue, selectionMode, multiple, hasItems, flatItems, isItemEqualToValue, setIndices]);
10553 useIsoLayoutEffect(() => {
10554 if (items) {
10555 valuesRef.current = flatFilteredItems;
10556 listRef.current.length = flatFilteredItems.length;
10557 }
10558 }, [items, flatFilteredItems]);
10559 useIsoLayoutEffect(() => {
10560 const pendingHighlight = pendingQueryHighlightRef.current;
10561 if (pendingHighlight) {
10562 const listIsNavigable = open || inline4 || store.state.positionerElement?.hidden === false;
10563 if (pendingHighlight.hasQuery) {
10564 if (autoHighlightMode && listIsNavigable) {
10565 store.set("activeIndex", 0);
10566 }
10567 pendingQueryHighlightRef.current = null;
10568 } else if (String(inputValue).trim() === "") {
10569 pendingQueryHighlightRef.current = null;
10570 if (listIsNavigable) {
10571 const clearedBySelection = pendingHighlight.selection;
10572 if (autoHighlightMode === "always" && !clearedBySelection && store.state.selectionMode === "none") {
10573 store.set("activeIndex", 0);
10574 }
10575 queueMicrotask(() => {
10576 if (!store.state.open && !store.state.inline || inputRef.current && inputRef.current.value.trim() !== "") {
10577 return;
10578 }
10579 const currentSelectedValue = store.state.selectedValue;
10580 const isMultiple = store.state.selectionMode === "multiple";
10581 const lastSelectedValue = isMultiple && Array.isArray(currentSelectedValue) ? currentSelectedValue[currentSelectedValue.length - 1] : currentSelectedValue;
10582 const hasSelection = store.state.selectionMode !== "none" && lastSelectedValue != null;
10583 if (hasSelection || clearedBySelection) {
10584 const registry = hasItems || hasFilteredItemsProp ? flatFilteredItems : valuesRef.current;
10585 store.set("activeIndex", hasSelection ? findSelectionIndex(registry, currentSelectedValue, store.state.isItemEqualToValue, isMultiple) : null);
10586 } else if (autoHighlightMode === "always") {
10587 store.set("activeIndex", 0);
10588 }
10589 });
10590 }
10591 }
10592 }
10593 if (!open && !inline4) {
10594 return;
10595 }
10596 const shouldUseFlatFilteredItems = hasItems || hasFilteredItemsProp;
10597 const candidateItems = shouldUseFlatFilteredItems ? flatFilteredItems : valuesRef.current;
10598 const storeActiveIndex = store.state.activeIndex;
10599 if (storeActiveIndex == null) {
10600 if (autoHighlightMode === "always" && candidateItems.length > 0) {
10601 store.set("activeIndex", 0);
10602 return;
10603 }
10604 emitHighlight(void 0, -1, reason_parts_exports.none);
10605 return;
10606 }
10607 if (storeActiveIndex >= candidateItems.length) {
10608 emitHighlight(void 0, -1, reason_parts_exports.none);
10609 store.set("activeIndex", null);
10610 return;
10611 }
10612 const itemValue = candidateItems[storeActiveIndex];
10613 const previouslyHighlightedItemValue = lastHighlightRef.current.value;
10614 const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue);
10615 if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) {
10616 emitHighlight(itemValue, storeActiveIndex, reason_parts_exports.none);
10617 }
10618 }, [
10619 activeIndex,
10620 autoHighlightMode,
10621 emitHighlight,
10622 hasFilteredItemsProp,
10623 hasItems,
10624 flatFilteredItems,
10625 inline4,
10626 open,
10627 store,
10628 // Reruns the effect when the query changes without affecting the deps above, such as
10629 // clearing the input when no items are filtered out (individually rendered items).
10630 inputValue
10631 ]);
10632 useIsoLayoutEffect(() => {
10633 if (selectionMode === "none") {
10634 setFilled(String(inputValue) !== "");
10635 return;
10636 }
10637 setFilled(multiple ? Array.isArray(selectedValue) && selectedValue.length > 0 : selectedValue != null);
10638 }, [setFilled, selectionMode, inputValue, selectedValue, multiple]);
10639 React52.useEffect(() => {
10640 if (hasItems && autoHighlightMode && flatFilteredItems.length === 0) {
10641 setIndices({
10642 activeIndex: null
10643 });
10644 }
10645 }, [hasItems, autoHighlightMode, flatFilteredItems.length, setIndices]);
10646 function isSelectedValueDirty(value) {
10647 const initialValue = validityData.initialValue;
10648 if (Array.isArray(value) && Array.isArray(initialValue)) {
10649 return !areArraysEqual(value, initialValue, (itemValue, initialItemValue) => compareItemEquality(itemValue, initialItemValue, isItemEqualToValue));
10650 }
10651 return value !== initialValue;
10652 }
10653 useValueChanged(query, () => {
10654 if (!open || query === "" || query === String(initialDefaultInputValue)) {
10655 return;
10656 }
10657 setQueryChangedAfterOpen(true);
10658 });
10659 function syncInputToSelectedLabel() {
10660 const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
10661 if (inputValue !== nextInputValue) {
10662 setInputValue(nextInputValue, createChangeEventDetails(reason_parts_exports.none));
10663 }
10664 }
10665 useValueChanged(selectedValue, () => {
10666 if (selectionMode === "none") {
10667 return;
10668 }
10669 clearErrors(name);
10670 setDirty(isSelectedValueDirty(selectedValue));
10671 validation.change(selectedValue);
10672 if (single && !hasInputValue && !inputInsidePopup) {
10673 syncInputToSelectedLabel();
10674 }
10675 });
10676 useValueChanged(inputValue, () => {
10677 if (selectionMode !== "none") {
10678 return;
10679 }
10680 clearErrors(name);
10681 setDirty(inputValue !== validityData.initialValue);
10682 validation.change(inputValue);
10683 });
10684 useValueChanged(items, () => {
10685 if (!single || hasInputValue || inputInsidePopup || queryChangedAfterOpen) {
10686 return;
10687 }
10688 syncInputToSelectedLabel();
10689 });
10690 const floatingRootContext = useFloatingRootContext({
10691 open: inline4 ? true : open,
10692 onOpenChange: setOpen,
10693 elements: {
10694 reference: inputInsidePopup ? triggerElement : inputElement,
10695 floating: positionerElement
10696 }
10697 });
10698 const ariaHasPopup = grid ? "grid" : "listbox";
10699 const expanded = open || inline4;
10700 const ariaExpanded = expanded ? "true" : "false";
10701 const role = React52.useMemo(() => {
10702 const isPlainInput = inputElement?.tagName === "INPUT";
10703 const shouldTreatAsInput = inputElement == null || isPlainInput;
10704 const shouldApplyAria = shouldTreatAsInput || expanded;
10705 const reference = shouldTreatAsInput ? {
10706 autoComplete: "off",
10707 spellCheck: "false",
10708 autoCorrect: "off",
10709 autoCapitalize: "none"
10710 } : {};
10711 if (shouldApplyAria) {
10712 reference.role = "combobox";
10713 reference["aria-expanded"] = ariaExpanded;
10714 reference["aria-haspopup"] = ariaHasPopup;
10715 reference["aria-controls"] = expanded ? listElement?.id : void 0;
10716 reference["aria-autocomplete"] = autoComplete;
10717 }
10718 return {
10719 reference,
10720 floating: {
10721 role: "presentation"
10722 }
10723 };
10724 }, [inputElement, expanded, ariaExpanded, ariaHasPopup, listElement?.id, autoComplete]);
10725 const click = useClick(floatingRootContext, {
10726 enabled: !readOnly && !disabled2 && openOnInputClick,
10727 event: "mousedown-only",
10728 toggle: false,
10729 // Apply a small delay for touch to let mobile viewport/keyboard positioning settle.
10730 // This avoids top-bottom flip flickers if the preferred position is "top" when first tapping.
10731 touchOpenDelay: inputInsidePopup ? 0 : 100,
10732 reason: reason_parts_exports.inputPress
10733 });
10734 const dismiss = useDismiss(floatingRootContext, {
10735 enabled: !readOnly && !disabled2 && !inline4,
10736 outsidePressEvent: {
10737 mouse: "sloppy",
10738 // The visual viewport (affected by the mobile software keyboard) can be
10739 // somewhat small. The user may want to scroll the screen to see more of
10740 // the popup.
10741 touch: "intentional"
10742 },
10743 // Without a popup, let the Escape key bubble the event up to other popups' handlers.
10744 bubbles: inline4 ? true : void 0,
10745 outsidePress(event) {
10746 const target = getTarget(event);
10747 return !contains(triggerElement, target) && !contains(clearRef.current, target) && !contains(chipsContainerRef.current, target) && !contains(inputGroupElement, target);
10748 }
10749 });
10750 const listNavigation2 = useListNavigation(floatingRootContext, {
10751 enabled: !readOnly && !disabled2,
10752 id,
10753 listRef,
10754 activeIndex,
10755 selectedIndex,
10756 virtual: true,
10757 loopFocus,
10758 allowEscape: loopFocus && !autoHighlightMode,
10759 focusItemOnOpen: queryChangedAfterOpen || selectionMode === "none" && !autoHighlightMode ? false : "auto",
10760 focusItemOnHover: highlightItemOnHover,
10761 resetOnPointerLeave: !keepHighlight,
10762 orientation: grid ? "horizontal" : void 0,
10763 rtl: direction === "rtl",
10764 disabledIndices: EMPTY_ARRAY,
10765 grid: grid ? gridNavigation : void 0,
10766 onNavigate(nextActiveIndex, event) {
10767 if (!event && !open || transitionStatus === "ending") {
10768 return;
10769 }
10770 if (!event) {
10771 setIndices({
10772 activeIndex: nextActiveIndex
10773 });
10774 } else {
10775 setIndices({
10776 activeIndex: nextActiveIndex,
10777 type: keyboardActiveRef.current ? reason_parts_exports.keyboard : reason_parts_exports.pointer
10778 });
10779 }
10780 }
10781 });
10782 const inputProps = React52.useMemo(() => mergeProps(listNavigation2.reference, {
10783 onKeyDown(event) {
10784 if (grid && store.state.activeIndex == null && (event.key === "ArrowLeft" || event.key === "ArrowRight")) {
10785 event.preventBaseUIHandler();
10786 }
10787 }
10788 }, dismiss.reference, click.reference, role.reference), [listNavigation2.reference, dismiss.reference, click.reference, role.reference, grid, store]);
10789 const popupProps = React52.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, dismiss.floating), [dismiss.floating]);
10790 const listProps = React52.useMemo(() => mergeProps(listNavigation2.floating, role.floating), [listNavigation2.floating, role.floating]);
10791 const itemProps = React52.useMemo(() => {
10792 const listNavigationItemProps = listNavigation2.item;
10793 if (!listNavigationItemProps) {
10794 return EMPTY_OBJECT;
10795 }
10796 return {
10797 ...listNavigationItemProps,
10798 onFocus: void 0
10799 };
10800 }, [listNavigation2.item]);
10801 useOnFirstRender(() => {
10802 store.update({
10803 inline: inlineProp,
10804 popupProps,
10805 listProps,
10806 inputProps,
10807 triggerProps,
10808 itemProps,
10809 setOpen,
10810 setInputValue,
10811 setSelectedValue,
10812 setIndices,
10813 handleSelection,
10814 forceMount,
10815 requestSubmit,
10816 onOpenChangeComplete
10817 });
10818 });
10819 useIsoLayoutEffect(() => {
10820 store.update({
10821 id,
10822 selectedValue,
10823 open,
10824 mounted,
10825 transitionStatus,
10826 items,
10827 inline: inlineProp,
10828 popupProps,
10829 listProps,
10830 inputProps,
10831 triggerProps,
10832 openMethod,
10833 itemProps,
10834 selectionMode,
10835 name,
10836 form,
10837 disabled: disabled2,
10838 readOnly,
10839 required,
10840 grid,
10841 virtualized,
10842 openOnInputClick,
10843 itemToStringLabel,
10844 modal,
10845 autoHighlight: autoHighlightMode,
10846 isItemEqualToValue,
10847 submitOnItemClick,
10848 hasInputValue,
10849 inputOwnsFormValue: selectionMode === "none" && (inlineProp || !store.state.inputInsidePopup)
10850 });
10851 }, [store, id, selectedValue, open, mounted, transitionStatus, items, popupProps, listProps, inputProps, itemProps, openMethod, triggerProps, selectionMode, name, disabled2, readOnly, required, grid, virtualized, openOnInputClick, itemToStringLabel, modal, isItemEqualToValue, submitOnItemClick, hasInputValue, inlineProp, autoHighlightMode, form]);
10852 const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef);
10853 const itemsContextValue = React52.useMemo(() => ({
10854 query,
10855 hasItems,
10856 filteredItems,
10857 flatFilteredItems
10858 }), [query, hasItems, filteredItems, flatFilteredItems]);
10859 const serializedValue = React52.useMemo(() => {
10860 if (Array.isArray(fieldRawValue)) {
10861 return "";
10862 }
10863 return stringifyAsValue(fieldRawValue, itemToStringValue);
10864 }, [fieldRawValue, itemToStringValue]);
10865 const hasMultipleSelection = multiple && Array.isArray(selectedValue) && selectedValue.length > 0;
10866 const hiddenInputName = multiple || selectionMode === "none" && inputOwnsFormValue ? void 0 : name;
10867 const hiddenInputs = React52.useMemo(() => {
10868 if (!multiple || !Array.isArray(selectedValue) || !name) {
10869 return null;
10870 }
10871 return selectedValue.map((value) => {
10872 const currentSerializedValue = stringifyAsValue(value, itemToStringValue);
10873 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", {
10874 type: "hidden",
10875 form,
10876 name,
10877 value: currentSerializedValue,
10878 disabled: disabled2
10879 }, currentSerializedValue);
10880 });
10881 }, [multiple, selectedValue, form, name, itemToStringValue, disabled2]);
10882 const children = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(React52.Fragment, {
10883 children: [props.children, /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", {
10884 ...validation.getValidationProps(disabled2, {
10885 // Move focus when the hidden input is focused.
10886 onFocus() {
10887 if (inputInsidePopup) {
10888 triggerElement?.focus();
10889 return;
10890 }
10891 (inputRef.current || triggerElement)?.focus();
10892 },
10893 // Handle browser autofill.
10894 onChange(event) {
10895 if (event.nativeEvent.defaultPrevented || disabled2 || readOnly) {
10896 return;
10897 }
10898 const nextValue = event.currentTarget.value;
10899 const nextValueLower = nextValue.toLowerCase();
10900 const details = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent);
10901 const findSerializedMatchIndex = () => valuesRef.current.findIndex((candidate) => stringifyAsValue(candidate, itemToStringValue).toLowerCase() === nextValueLower || stringifyAsLabel(candidate, itemToStringLabel).toLowerCase() === nextValueLower);
10902 function handleChange() {
10903 if (multiple) {
10904 return;
10905 }
10906 if (selectionMode === "none") {
10907 setInputValue(nextValue, details);
10908 return;
10909 }
10910 let matchingIndex = findSerializedMatchIndex();
10911 if (matchingIndex === -1) {
10912 matchingIndex = valuesRef.current.findIndex((_, index2) => {
10913 const renderedLabel = labelsRef.current[index2];
10914 return renderedLabel != null && renderedLabel.toLowerCase() === nextValueLower;
10915 });
10916 }
10917 const matchingValue = matchingIndex === -1 ? void 0 : valuesRef.current[matchingIndex];
10918 if (matchingValue != null) {
10919 setSelectedValue?.(matchingValue, details);
10920 }
10921 }
10922 if (single) {
10923 forceMount();
10924 if (items && findSerializedMatchIndex() === -1) {
10925 store.set("forceMounted", true);
10926 }
10927 }
10928 queueMicrotask(handleChange);
10929 }
10930 }),
10931 id: id && hiddenInputName == null ? `${id}-hidden-input` : void 0,
10932 form,
10933 name: hiddenInputName,
10934 autoComplete: formAutoComplete,
10935 disabled: disabled2,
10936 required: required && !hasMultipleSelection,
10937 readOnly,
10938 value: serializedValue,
10939 ref: hiddenInputRef,
10940 style: hiddenInputName ? visuallyHiddenInput : visuallyHidden,
10941 tabIndex: -1,
10942 "aria-hidden": true,
10943 suppressHydrationWarning: true
10944 }), hiddenInputs]
10945 });
10946 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ComboboxRootContext.Provider, {
10947 value: store,
10948 children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ComboboxFloatingContext.Provider, {
10949 value: floatingRootContext,
10950 children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ComboboxHasItemsContext.Provider, {
10951 value: hasItems,
10952 children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ComboboxDerivedItemsContext.Provider, {
10953 value: itemsContextValue,
10954 children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ComboboxInputValueContext.Provider, {
10955 value: inputValue,
10956 children
10957 })
10958 })
10959 })
10960 })
10961 });
10962 }
10963
10964 // node_modules/@base-ui/react/autocomplete/root/AutocompleteRoot.mjs
10965 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
10966 function AutocompleteRoot(props) {
10967 const {
10968 openOnInputClick = false,
10969 value,
10970 defaultValue,
10971 onValueChange,
10972 mode = "list",
10973 itemToStringValue,
10974 ...other
10975 } = props;
10976 const enableInline = mode === "inline" || mode === "both";
10977 const staticItems = mode === "inline" || mode === "none";
10978 const isControlled = value !== void 0;
10979 const [internalValue, setInternalValue] = React53.useState(defaultValue ?? "");
10980 const [inlineInputValue, setInlineInputValue] = React53.useState("");
10981 React53.useEffect(() => {
10982 if (isControlled) {
10983 setInlineInputValue("");
10984 }
10985 }, [value, isControlled]);
10986 let resolvedInputValue;
10987 if (enableInline && inlineInputValue !== "") {
10988 resolvedInputValue = inlineInputValue;
10989 } else if (isControlled) {
10990 resolvedInputValue = value ?? "";
10991 } else {
10992 resolvedInputValue = internalValue;
10993 }
10994 const collator = useCoreFilter({
10995 locale: other.locale
10996 });
10997 const baseFilter = React53.useMemo(() => {
10998 if (other.filter !== void 0) {
10999 return other.filter;
11000 }
11001 return collator.contains;
11002 }, [other.filter, collator]);
11003 const resolvedQuery = String(isControlled ? value : internalValue).trim();
11004 const resolvedFilter = React53.useMemo(() => {
11005 if (mode !== "both") {
11006 return staticItems ? null : baseFilter;
11007 }
11008 if (baseFilter === null) {
11009 return null;
11010 }
11011 return (item, _query, toString) => {
11012 return baseFilter(item, resolvedQuery, toString);
11013 };
11014 }, [baseFilter, mode, resolvedQuery, staticItems]);
11015 function handleValueChange(nextValue, eventDetails) {
11016 setInlineInputValue("");
11017 if (!isControlled) {
11018 setInternalValue(nextValue);
11019 }
11020 onValueChange?.(nextValue, eventDetails);
11021 }
11022 function handleItemHighlighted(highlightedValue, eventDetails) {
11023 props.onItemHighlighted?.(highlightedValue, eventDetails);
11024 if (eventDetails.reason === reason_parts_exports.pointer) {
11025 return;
11026 }
11027 setInlineInputValue(enableInline && highlightedValue != null ? stringifyAsLabel(highlightedValue, itemToStringValue) : "");
11028 }
11029 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AriaCombobox, {
11030 ...other,
11031 itemToStringLabel: itemToStringValue,
11032 openOnInputClick,
11033 selectionMode: "none",
11034 fillInputOnItemPress: true,
11035 filter: resolvedFilter,
11036 autoComplete: mode,
11037 inputValue: resolvedInputValue,
11038 defaultInputValue: defaultValue,
11039 onInputValueChange: handleValueChange,
11040 onItemHighlighted: handleItemHighlighted
11041 });
11042 }
11043
11044 // node_modules/@base-ui/react/autocomplete/value/AutocompleteValue.mjs
11045 var React54 = __toESM(require_react(), 1);
11046 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
11047 function AutocompleteValue(props) {
11048 const {
11049 children
11050 } = props;
11051 const inputValue = useComboboxInputValueContext();
11052 let returnValue = null;
11053 if (typeof children === "function") {
11054 returnValue = children(String(inputValue));
11055 } else if (children != null) {
11056 returnValue = children;
11057 } else {
11058 returnValue = inputValue;
11059 }
11060 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(React54.Fragment, {
11061 children: returnValue
11062 });
11063 }
11064
11065 // node_modules/@base-ui/react/combobox/trigger/ComboboxTrigger.mjs
11066 var React55 = __toESM(require_react(), 1);
11067
11068 // node_modules/@base-ui/react/combobox/utils/stateAttributesMapping.mjs
11069 var triggerStateAttributesMapping = {
11070 ...pressableTriggerOpenStateMapping,
11071 ...fieldValidityMapping,
11072 popupSide: (side) => side ? {
11073 "data-popup-side": side
11074 } : null,
11075 listEmpty: (empty) => empty ? {
11076 "data-list-empty": ""
11077 } : null
11078 };
11079
11080 // node_modules/@base-ui/react/utils/getPseudoElementBounds.mjs
11081 var BOUNDARY_OFFSET = 5;
11082 function isMouseWithinBounds(event, element) {
11083 const bounds = getPseudoElementBounds(element);
11084 return event.clientX >= bounds.left - BOUNDARY_OFFSET && event.clientX <= bounds.right + BOUNDARY_OFFSET && event.clientY >= bounds.top - BOUNDARY_OFFSET && event.clientY <= bounds.bottom + BOUNDARY_OFFSET;
11085 }
11086 function getPseudoElementBounds(element) {
11087 const elementRect = element.getBoundingClientRect();
11088 const win = getWindow(element);
11089 if (parts_exports.env.jsdom) {
11090 return elementRect;
11091 }
11092 const beforeStyles = win.getComputedStyle(element, "::before");
11093 const afterStyles = win.getComputedStyle(element, "::after");
11094 const hasPseudoElements = beforeStyles.content !== "none" || afterStyles.content !== "none";
11095 if (!hasPseudoElements) {
11096 return elementRect;
11097 }
11098 const beforeWidth = parseFloat(beforeStyles.width) || 0;
11099 const beforeHeight = parseFloat(beforeStyles.height) || 0;
11100 const afterWidth = parseFloat(afterStyles.width) || 0;
11101 const afterHeight = parseFloat(afterStyles.height) || 0;
11102 const totalWidth = Math.max(elementRect.width, beforeWidth, afterWidth);
11103 const totalHeight = Math.max(elementRect.height, beforeHeight, afterHeight);
11104 const widthDiff = totalWidth - elementRect.width;
11105 const heightDiff = totalHeight - elementRect.height;
11106 return {
11107 left: elementRect.left - widthDiff / 2,
11108 right: elementRect.right + widthDiff / 2,
11109 top: elementRect.top - heightDiff / 2,
11110 bottom: elementRect.bottom + heightDiff / 2
11111 };
11112 }
11113
11114 // node_modules/@base-ui/react/utils/resolveAriaLabelledBy.mjs
11115 function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
11116 return fieldLabelId ?? localLabelId;
11117 }
11118
11119 // node_modules/@base-ui/react/combobox/utils/parts.mjs
11120 function usePopupSide(store) {
11121 const mounted = useStore(store, selectors2.mounted);
11122 const popupSide = useStore(store, selectors2.popupSide);
11123 const positionerElement = useStore(store, selectors2.positionerElement);
11124 return mounted && positionerElement ? popupSide : null;
11125 }
11126 function useListEmpty() {
11127 return useComboboxDerivedItemsContext().filteredItems.length === 0;
11128 }
11129 function getChipNavigationKeys(direction) {
11130 return direction === "rtl" ? ["ArrowRight", "ArrowLeft"] : ["ArrowLeft", "ArrowRight"];
11131 }
11132 function getIndexAfterChipRemoval(index2, chipCount) {
11133 const nextIndex = index2 >= chipCount - 1 ? chipCount - 2 : index2;
11134 return nextIndex >= 0 ? nextIndex : void 0;
11135 }
11136 function clickHighlightedItem(store, activeIndex, nativeEvent) {
11137 const listItem = store.state.listRef.current[activeIndex];
11138 if (listItem) {
11139 store.state.selectionEventRef.current = nativeEvent;
11140 listItem.click();
11141 store.state.selectionEventRef.current = null;
11142 }
11143 }
11144
11145 // node_modules/@base-ui/react/combobox/trigger/ComboboxTrigger.mjs
11146 var ComboboxTrigger = /* @__PURE__ */ React55.forwardRef(function ComboboxTrigger2(componentProps, forwardedRef) {
11147 const {
11148 render,
11149 className,
11150 nativeButton = true,
11151 disabled: disabledProp = false,
11152 id: idProp,
11153 style,
11154 ...elementProps
11155 } = componentProps;
11156 const {
11157 state: fieldState,
11158 disabled: fieldDisabled,
11159 setTouched,
11160 setFocused,
11161 validationMode,
11162 validation
11163 } = useFieldRootContext();
11164 const {
11165 labelId: fieldLabelId
11166 } = useLabelableContext();
11167 const store = useComboboxRootContext();
11168 const selectionMode = useStore(store, selectors2.selectionMode);
11169 const comboboxDisabled = useStore(store, selectors2.disabled);
11170 const readOnly = useStore(store, selectors2.readOnly);
11171 const required = useStore(store, selectors2.required);
11172 const positionerElement = useStore(store, selectors2.positionerElement);
11173 const listElement = useStore(store, selectors2.listElement);
11174 const storedPopupId = useStore(store, selectors2.popupId);
11175 const triggerProps = useStore(store, selectors2.triggerProps);
11176 const inputInsidePopup = useStore(store, selectors2.inputInsidePopup);
11177 const rootId = useStore(store, selectors2.id);
11178 const comboboxLabelId = useStore(store, selectors2.labelId);
11179 const open = useStore(store, selectors2.open);
11180 const selectedValue = useStore(store, selectors2.selectedValue);
11181 const activeIndex = useStore(store, selectors2.activeIndex);
11182 const selectedIndex = useStore(store, selectors2.selectedIndex);
11183 const hasSelectedValue = useStore(store, selectors2.hasSelectedValue);
11184 const floatingRootContext = useComboboxFloatingContext();
11185 const inputValue = useComboboxInputValueContext();
11186 const focusTimeout = useTimeout();
11187 const disabled2 = fieldDisabled || comboboxDisabled || disabledProp;
11188 const listEmpty = useListEmpty();
11189 const popupSide = usePopupSide(store);
11190 useLabelableId({
11191 id: inputInsidePopup ? idProp : void 0
11192 });
11193 const id = inputInsidePopup ? idProp ?? rootId : idProp;
11194 const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId);
11195 let ariaControls;
11196 if (open && inputInsidePopup) {
11197 ariaControls = storedPopupId ?? getComboboxPopupId(rootId);
11198 } else if (open) {
11199 ariaControls = listElement?.id;
11200 }
11201 const currentPointerTypeRef = React55.useRef("");
11202 function trackPointerType(event) {
11203 currentPointerTypeRef.current = event.pointerType;
11204 }
11205 const {
11206 reference: triggerTypeaheadProps
11207 } = useTypeahead(floatingRootContext, {
11208 enabled: !open && !readOnly && !comboboxDisabled && selectionMode === "single",
11209 listRef: store.state.labelsRef,
11210 activeIndex,
11211 selectedIndex,
11212 onMatch(index2) {
11213 const nextSelectedValue = store.state.valuesRef.current[index2];
11214 if (nextSelectedValue !== void 0) {
11215 store.state.setSelectedValue(nextSelectedValue, createChangeEventDetails(reason_parts_exports.none));
11216 }
11217 }
11218 });
11219 const {
11220 reference: triggerClickProps
11221 } = useClick(floatingRootContext, {
11222 enabled: !readOnly && !comboboxDisabled,
11223 event: "mousedown"
11224 });
11225 const {
11226 buttonRef,
11227 getButtonProps
11228 } = useButton({
11229 native: nativeButton,
11230 disabled: disabled2
11231 });
11232 const state = {
11233 ...fieldState,
11234 open,
11235 disabled: disabled2,
11236 popupSide,
11237 listEmpty,
11238 placeholder: selectionMode === "none" ? false : !hasSelectedValue
11239 };
11240 const setTriggerElement = useStableCallback((element2) => {
11241 store.set("triggerElement", element2);
11242 });
11243 const element = useRenderElement("button", componentProps, {
11244 ref: [forwardedRef, buttonRef, setTriggerElement],
11245 state,
11246 props: [triggerProps, triggerClickProps, triggerTypeaheadProps, {
11247 id,
11248 tabIndex: inputInsidePopup ? 0 : -1,
11249 role: inputInsidePopup ? "combobox" : void 0,
11250 "aria-expanded": open,
11251 "aria-haspopup": inputInsidePopup ? "dialog" : "listbox",
11252 "aria-controls": ariaControls,
11253 "aria-required": inputInsidePopup ? required || void 0 : void 0,
11254 "aria-labelledby": ariaLabelledBy,
11255 onPointerDown: trackPointerType,
11256 onPointerEnter: trackPointerType,
11257 onFocus() {
11258 setFocused(true);
11259 if (disabled2 || readOnly) {
11260 return;
11261 }
11262 focusTimeout.start(0, store.state.forceMount);
11263 },
11264 onBlur(event) {
11265 if (contains(positionerElement, event.relatedTarget)) {
11266 return;
11267 }
11268 setTouched(true);
11269 setFocused(false);
11270 if (validationMode === "onBlur") {
11271 const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
11272 validation.commit(valueToValidate);
11273 }
11274 },
11275 onMouseDown(event) {
11276 if (disabled2 || readOnly) {
11277 return;
11278 }
11279 if (!inputInsidePopup) {
11280 floatingRootContext.set("domReferenceElement", event.currentTarget);
11281 }
11282 store.state.forceMount();
11283 if (currentPointerTypeRef.current !== "touch") {
11284 store.state.inputRef.current?.focus();
11285 if (!inputInsidePopup) {
11286 event.preventDefault();
11287 }
11288 }
11289 if (open) {
11290 return;
11291 }
11292 const doc = ownerDocument(event.currentTarget);
11293 function handleMouseUp(mouseEvent) {
11294 const currentTriggerElement = store.state.triggerElement;
11295 if (!currentTriggerElement) {
11296 return;
11297 }
11298 const mouseUpTarget = getTarget(mouseEvent);
11299 const positioner = store.state.positionerElement;
11300 const list = store.state.listElement;
11301 if (contains(currentTriggerElement, mouseUpTarget) || contains(positioner, mouseUpTarget) || contains(list, mouseUpTarget)) {
11302 return;
11303 }
11304 if (isMouseWithinBounds(mouseEvent, currentTriggerElement)) {
11305 return;
11306 }
11307 store.state.setOpen(false, createChangeEventDetails(reason_parts_exports.cancelOpen, mouseEvent));
11308 }
11309 if (inputInsidePopup) {
11310 doc.addEventListener("mouseup", handleMouseUp, {
11311 once: true
11312 });
11313 }
11314 },
11315 onKeyDown(event) {
11316 if (readOnly) {
11317 return;
11318 }
11319 if (event.key === "ArrowDown" || event.key === "ArrowUp") {
11320 stopEvent(event);
11321 store.state.setOpen(true, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent));
11322 store.state.inputRef.current?.focus();
11323 }
11324 }
11325 }, validation.getValidationProps(disabled2, elementProps), getButtonProps],
11326 stateAttributesMapping: triggerStateAttributesMapping
11327 });
11328 return element;
11329 });
11330 if (true) ComboboxTrigger.displayName = "ComboboxTrigger";
11331
11332 // node_modules/@base-ui/react/autocomplete/trigger/AutocompleteTrigger.mjs
11333 var AutocompleteTrigger = ComboboxTrigger;
11334
11335 // node_modules/@base-ui/react/combobox/input/ComboboxInput.mjs
11336 var React59 = __toESM(require_react(), 1);
11337
11338 // node_modules/@base-ui/react/combobox/chips/ComboboxChipsContext.mjs
11339 var React56 = __toESM(require_react(), 1);
11340 var ComboboxChipsContext = /* @__PURE__ */ React56.createContext(void 0);
11341 if (true) ComboboxChipsContext.displayName = "ComboboxChipsContext";
11342 function useComboboxChipsContext() {
11343 return React56.useContext(ComboboxChipsContext);
11344 }
11345
11346 // node_modules/@base-ui/react/combobox/positioner/ComboboxPositionerContext.mjs
11347 var React57 = __toESM(require_react(), 1);
11348 var ComboboxPositionerContext = /* @__PURE__ */ React57.createContext(void 0);
11349 if (true) ComboboxPositionerContext.displayName = "ComboboxPositionerContext";
11350 function useComboboxPositionerContext(optional) {
11351 const context = React57.useContext(ComboboxPositionerContext);
11352 if (context === void 0 && !optional) {
11353 throw new Error(true ? "Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component" : formatErrorMessage_default(21));
11354 }
11355 return context;
11356 }
11357
11358 // node_modules/@base-ui/react/combobox/utils/ComboboxInternalDismissButton.mjs
11359 var React58 = __toESM(require_react(), 1);
11360 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
11361 var ComboboxInternalDismissButton = /* @__PURE__ */ React58.forwardRef(function ComboboxInternalDismissButton2(_, forwardedRef) {
11362 const store = useComboboxRootContext();
11363 const {
11364 buttonRef,
11365 getButtonProps
11366 } = useButton({
11367 native: false
11368 });
11369 const mergedRef = useMergedRefs(forwardedRef, buttonRef);
11370 function handleDismiss(event) {
11371 store.state.setOpen(false, createChangeEventDetails(reason_parts_exports.closePress, event.nativeEvent, event.currentTarget));
11372 }
11373 const dismissProps = getButtonProps({
11374 onClick: handleDismiss
11375 });
11376 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", {
11377 ref: mergedRef,
11378 ...dismissProps,
11379 "aria-label": "Dismiss",
11380 tabIndex: void 0,
11381 style: visuallyHiddenInput
11382 });
11383 });
11384 if (true) ComboboxInternalDismissButton.displayName = "ComboboxInternalDismissButton";
11385
11386 // node_modules/@base-ui/react/combobox/input/ComboboxInput.mjs
11387 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
11388 var ComboboxInput = /* @__PURE__ */ React59.forwardRef(function ComboboxInput2(componentProps, forwardedRef) {
11389 const {
11390 render,
11391 className,
11392 disabled: disabledProp = false,
11393 id: idProp,
11394 style,
11395 ...elementProps
11396 } = componentProps;
11397 const {
11398 state: fieldState,
11399 disabled: fieldDisabled,
11400 setTouched,
11401 setFocused,
11402 validationMode,
11403 validation
11404 } = useFieldRootContext();
11405 const {
11406 labelId: fieldLabelId
11407 } = useLabelableContext();
11408 const comboboxChipsContext = useComboboxChipsContext();
11409 const positioning = useComboboxPositionerContext(true);
11410 const hasPositionerParent = Boolean(positioning);
11411 const store = useComboboxRootContext();
11412 const inputValue = useComboboxInputValueContext();
11413 const direction = useDirection();
11414 const required = useStore(store, selectors2.required);
11415 const comboboxDisabled = useStore(store, selectors2.disabled);
11416 const readOnly = useStore(store, selectors2.readOnly);
11417 const name = useStore(store, selectors2.name);
11418 const form = useStore(store, selectors2.form);
11419 const selectionMode = useStore(store, selectors2.selectionMode);
11420 const autoHighlightMode = useStore(store, selectors2.autoHighlight);
11421 const inputProps = useStore(store, selectors2.inputProps);
11422 const triggerProps = useStore(store, selectors2.triggerProps);
11423 const open = useStore(store, selectors2.open);
11424 const mounted = useStore(store, selectors2.mounted);
11425 const selectedValue = useStore(store, selectors2.selectedValue);
11426 const rootId = useStore(store, selectors2.id);
11427 const inline4 = useStore(store, selectors2.inline);
11428 const modal = useStore(store, selectors2.modal);
11429 const autoHighlightEnabled = Boolean(autoHighlightMode);
11430 const popupSide = usePopupSide(store);
11431 const disabled2 = fieldDisabled || comboboxDisabled || disabledProp;
11432 const listEmpty = useListEmpty();
11433 const isInsidePopup = hasPositionerParent || inline4;
11434 const focusManagerModal = !isInsidePopup || modal;
11435 const id = useBaseUiId(idProp ?? (!isInsidePopup ? rootId : void 0));
11436 const fieldStateForInput = hasPositionerParent ? DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState;
11437 const [composingValue, setComposingValue] = React59.useState(null);
11438 const isComposingRef = React59.useRef(false);
11439 const lastActiveIndexRef = React59.useRef(null);
11440 const shouldRestoreActiveIndexRef = React59.useRef(false);
11441 const inputOwnsFormValue = selectionMode === "none" && !hasPositionerParent;
11442 const setInputElement = useStableCallback((element2) => {
11443 const nextIsInsidePopup = hasPositionerParent || store.state.inline;
11444 if (nextIsInsidePopup && !store.state.hasInputValue) {
11445 store.state.setInputValue("", createChangeEventDetails(reason_parts_exports.none));
11446 }
11447 store.update({
11448 inputElement: element2,
11449 inputInsidePopup: nextIsInsidePopup,
11450 inputOwnsFormValue
11451 });
11452 });
11453 const validationProps = hasPositionerParent ? elementProps : validation.getValidationProps(disabled2, elementProps);
11454 function clearHighlight() {
11455 store.state.setIndices({
11456 activeIndex: null,
11457 selectedIndex: null,
11458 type: store.state.keyboardActiveRef.current ? reason_parts_exports.keyboard : reason_parts_exports.pointer
11459 });
11460 }
11461 function markPointerActive() {
11462 store.state.keyboardActiveRef.current = false;
11463 }
11464 const state = {
11465 ...fieldStateForInput,
11466 open,
11467 disabled: disabled2,
11468 readOnly,
11469 popupSide,
11470 listEmpty
11471 };
11472 function handleKeyDown(event) {
11473 if (!comboboxChipsContext) {
11474 return void 0;
11475 }
11476 let nextIndex;
11477 const {
11478 highlightedChipIndex
11479 } = comboboxChipsContext;
11480 const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
11481 const [previousChipKey, nextChipKey] = getChipNavigationKeys(direction);
11482 if (highlightedChipIndex !== void 0) {
11483 if (event.key === previousChipKey) {
11484 event.preventDefault();
11485 if (highlightedChipIndex > 0) {
11486 nextIndex = highlightedChipIndex - 1;
11487 } else {
11488 nextIndex = void 0;
11489 }
11490 } else if (event.key === nextChipKey) {
11491 event.preventDefault();
11492 if (highlightedChipIndex < renderedChipsCount - 1) {
11493 nextIndex = highlightedChipIndex + 1;
11494 } else {
11495 nextIndex = void 0;
11496 }
11497 } else if (event.key === "Backspace" || event.key === "Delete") {
11498 event.preventDefault();
11499 nextIndex = getIndexAfterChipRemoval(highlightedChipIndex, selectedValue.length);
11500 clearHighlight();
11501 }
11502 return nextIndex;
11503 }
11504 if (event.key === previousChipKey && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) {
11505 event.preventDefault();
11506 nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : void 0;
11507 }
11508 return nextIndex;
11509 }
11510 const element = useRenderElement("input", componentProps, {
11511 state,
11512 ref: [forwardedRef, store.state.inputRef, setInputElement],
11513 props: [inputProps, triggerProps, {
11514 value: composingValue ?? inputValue,
11515 "aria-readonly": readOnly || void 0,
11516 "aria-required": required || void 0,
11517 "aria-labelledby": fieldLabelId,
11518 disabled: disabled2,
11519 readOnly,
11520 required: selectionMode === "none" ? required : void 0,
11521 form,
11522 ...inputOwnsFormValue && name && {
11523 name
11524 },
11525 id,
11526 onFocus() {
11527 setFocused(true);
11528 if (!inline4 || !shouldRestoreActiveIndexRef.current) {
11529 return;
11530 }
11531 shouldRestoreActiveIndexRef.current = false;
11532 const nextActiveIndex = lastActiveIndexRef.current;
11533 if (nextActiveIndex == null || // `valuesRef` can be sparse, so guard against restoring a removed slot.
11534 !Object.hasOwn(store.state.valuesRef.current, nextActiveIndex)) {
11535 return;
11536 }
11537 store.state.setIndices({
11538 activeIndex: nextActiveIndex
11539 });
11540 },
11541 onBlur() {
11542 setTouched(true);
11543 setFocused(false);
11544 const activeIndex = store.state.activeIndex;
11545 if (inline4 && activeIndex !== null && autoHighlightMode !== "always") {
11546 lastActiveIndexRef.current = activeIndex;
11547 shouldRestoreActiveIndexRef.current = true;
11548 store.state.setIndices({
11549 activeIndex: null
11550 });
11551 }
11552 if (validationMode === "onBlur") {
11553 const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
11554 validation.commit(valueToValidate);
11555 }
11556 },
11557 onCompositionStart(event) {
11558 if (parts_exports.os.android) {
11559 return;
11560 }
11561 isComposingRef.current = true;
11562 setComposingValue(event.currentTarget.value);
11563 },
11564 onCompositionEnd(event) {
11565 isComposingRef.current = false;
11566 const next = event.currentTarget.value;
11567 setComposingValue(null);
11568 store.state.setInputValue(next, createChangeEventDetails(reason_parts_exports.inputChange, event.nativeEvent));
11569 },
11570 onChange(event) {
11571 const nativeEvent = event.nativeEvent;
11572 const inputType = nativeEvent.inputType;
11573 const autofillLikeInput = !inputType || inputType === "insertReplacementText";
11574 const shouldOpenOnInput = isComposingRef.current || !autofillLikeInput;
11575 function maybeOpenOnInput(trimmed) {
11576 if (readOnly || disabled2 || !trimmed || !shouldOpenOnInput) {
11577 return;
11578 }
11579 store.state.setOpen(true, createChangeEventDetails(reason_parts_exports.inputChange, nativeEvent));
11580 if (!autoHighlightEnabled) {
11581 clearHighlight();
11582 }
11583 }
11584 if (isComposingRef.current) {
11585 const nextVal = event.currentTarget.value;
11586 setComposingValue(nextVal);
11587 if (nextVal === "" && !store.state.openOnInputClick && !store.state.inputInsidePopup) {
11588 store.state.setOpen(false, createChangeEventDetails(reason_parts_exports.inputClear, nativeEvent));
11589 }
11590 const trimmed = nextVal.trim();
11591 const shouldMaintainHighlight = autoHighlightEnabled && trimmed !== "";
11592 maybeOpenOnInput(trimmed);
11593 if (open && store.state.activeIndex !== null && !shouldMaintainHighlight) {
11594 clearHighlight();
11595 }
11596 return;
11597 }
11598 const inputChangeDetails = createChangeEventDetails(reason_parts_exports.inputChange, nativeEvent);
11599 store.state.setInputValue(event.currentTarget.value, inputChangeDetails);
11600 if (inputChangeDetails.isCanceled) {
11601 return;
11602 }
11603 const empty = event.currentTarget.value === "";
11604 const clearDetails = createChangeEventDetails(reason_parts_exports.inputClear, nativeEvent);
11605 if (empty && !store.state.inputInsidePopup) {
11606 if (selectionMode === "single") {
11607 store.state.setSelectedValue(null, clearDetails);
11608 }
11609 if (!store.state.openOnInputClick) {
11610 store.state.setOpen(false, clearDetails);
11611 }
11612 }
11613 maybeOpenOnInput(event.currentTarget.value.trim());
11614 if (open && store.state.activeIndex !== null && !autoHighlightEnabled) {
11615 clearHighlight();
11616 }
11617 },
11618 onKeyDown(event) {
11619 if (disabled2 || readOnly) {
11620 return;
11621 }
11622 if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) {
11623 return;
11624 }
11625 store.state.keyboardActiveRef.current = true;
11626 const input = event.currentTarget;
11627 const scrollAmount = input.scrollWidth - input.clientWidth;
11628 const isRTL4 = direction === "rtl";
11629 if (event.key === "Home") {
11630 stopEvent(event);
11631 const cursor = parts_exports.engine.gecko && isRTL4 ? input.value.length : 0;
11632 input.setSelectionRange(cursor, cursor);
11633 input.scrollLeft = 0;
11634 return;
11635 }
11636 if (event.key === "End") {
11637 stopEvent(event);
11638 const cursor = parts_exports.engine.gecko && isRTL4 ? 0 : input.value.length;
11639 input.setSelectionRange(cursor, cursor);
11640 input.scrollLeft = isRTL4 ? -scrollAmount : scrollAmount;
11641 return;
11642 }
11643 if (!mounted && event.key === "Escape") {
11644 const isClear = selectionMode === "multiple" && Array.isArray(selectedValue) ? selectedValue.length === 0 : selectedValue === null;
11645 const details = createChangeEventDetails(reason_parts_exports.escapeKey, event.nativeEvent);
11646 const value = selectionMode === "multiple" ? [] : null;
11647 store.state.setInputValue("", details);
11648 store.state.setSelectedValue(value, details);
11649 if (!isClear && !store.state.inline && !details.isPropagationAllowed) {
11650 event.stopPropagation();
11651 }
11652 return;
11653 }
11654 if (comboboxChipsContext && event.key === "Backspace" && input.value === "" && comboboxChipsContext.highlightedChipIndex === void 0 && Array.isArray(selectedValue) && selectedValue.length > 0) {
11655 const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
11656 const removalIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : selectedValue.length - 1;
11657 const newValue = selectedValue.filter((_, index2) => index2 !== removalIndex);
11658 clearHighlight();
11659 store.state.setSelectedValue(newValue, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent));
11660 return;
11661 }
11662 const hadHighlightedChip = comboboxChipsContext?.highlightedChipIndex !== void 0;
11663 const nextIndex = handleKeyDown(event);
11664 comboboxChipsContext?.setHighlightedChipIndex(nextIndex);
11665 if (nextIndex !== void 0) {
11666 comboboxChipsContext?.chipsRef.current[nextIndex]?.focus();
11667 } else if (hadHighlightedChip) {
11668 store.state.inputRef.current?.focus();
11669 }
11670 if (event.which === 229) {
11671 return;
11672 }
11673 if (event.key === "Enter" && open) {
11674 const activeIndex = store.state.activeIndex;
11675 const nativeEvent = event.nativeEvent;
11676 if (activeIndex === null) {
11677 if (inline4) {
11678 return;
11679 }
11680 store.state.setOpen(false, createChangeEventDetails(reason_parts_exports.none, nativeEvent));
11681 return;
11682 }
11683 stopEvent(event);
11684 clickHighlightedItem(store, activeIndex, nativeEvent);
11685 }
11686 },
11687 onPointerMove: markPointerActive,
11688 onPointerDown: markPointerActive
11689 }, validationProps],
11690 stateAttributesMapping: triggerStateAttributesMapping
11691 });
11692 const renderedInput = hasPositionerParent ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FieldRootContext.Provider, {
11693 value: DEFAULT_FIELD_ROOT_CONTEXT,
11694 children: element
11695 }) : element;
11696 return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(React59.Fragment, {
11697 children: [open && focusManagerModal && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ComboboxInternalDismissButton, {
11698 ref: store.state.startDismissRef
11699 }), renderedInput]
11700 });
11701 });
11702 if (true) ComboboxInput.displayName = "ComboboxInput";
11703
11704 // node_modules/@base-ui/react/combobox/input-group/ComboboxInputGroup.mjs
11705 var React60 = __toESM(require_react(), 1);
11706
11707 // node_modules/@base-ui/react/combobox/utils/handleInputPress.mjs
11708 function handleInputPress(event, store, disabled2, readOnly, shouldIgnoreTarget) {
11709 if (event.baseUIHandlerPrevented || readOnly) {
11710 return;
11711 }
11712 const target = getTarget(event.nativeEvent);
11713 const targetElement = isElement(target) ? target : null;
11714 if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) {
11715 return;
11716 }
11717 event.preventDefault();
11718 if (disabled2) {
11719 return;
11720 }
11721 store.state.inputRef.current?.focus();
11722 if (store.state.openOnInputClick) {
11723 store.state.setOpen(true, createChangeEventDetails(reason_parts_exports.inputPress, event.nativeEvent));
11724 }
11725 }
11726
11727 // node_modules/@base-ui/react/combobox/input-group/ComboboxInputGroup.mjs
11728 var ComboboxInputGroup = /* @__PURE__ */ React60.forwardRef(function ComboboxInputGroup2(componentProps, forwardedRef) {
11729 const {
11730 render,
11731 className,
11732 style,
11733 ...elementProps
11734 } = componentProps;
11735 const {
11736 state: fieldState
11737 } = useFieldRootContext();
11738 const store = useComboboxRootContext();
11739 const open = useStore(store, selectors2.open);
11740 const comboboxDisabled = useStore(store, selectors2.disabled);
11741 const readOnly = useStore(store, selectors2.readOnly);
11742 const hasSelectedValue = useStore(store, selectors2.hasSelectedValue);
11743 const selectionMode = useStore(store, selectors2.selectionMode);
11744 const popupSide = usePopupSide(store);
11745 const disabled2 = comboboxDisabled;
11746 const listEmpty = useListEmpty();
11747 const placeholder = selectionMode === "none" ? false : !hasSelectedValue;
11748 const state = {
11749 ...fieldState,
11750 open,
11751 disabled: disabled2,
11752 readOnly,
11753 popupSide,
11754 listEmpty,
11755 placeholder
11756 };
11757 const setInputGroupElement = useStableCallback((element) => {
11758 store.set("inputGroupElement", element);
11759 });
11760 return useRenderElement("div", componentProps, {
11761 ref: [forwardedRef, setInputGroupElement],
11762 props: [{
11763 role: "group",
11764 onMouseDown(event) {
11765 handleInputPress(event, store, disabled2, readOnly, (target) => {
11766 return contains(store.state.chipsContainerRef.current, target);
11767 });
11768 }
11769 }, elementProps],
11770 state,
11771 stateAttributesMapping: triggerStateAttributesMapping
11772 });
11773 });
11774 if (true) ComboboxInputGroup.displayName = "ComboboxInputGroup";
11775
11776 // node_modules/@base-ui/react/autocomplete/input-group/AutocompleteInputGroup.mjs
11777 var AutocompleteInputGroup = ComboboxInputGroup;
11778
11779 // node_modules/@base-ui/react/combobox/icon/ComboboxIcon.mjs
11780 var React61 = __toESM(require_react(), 1);
11781 var ComboboxIcon = /* @__PURE__ */ React61.forwardRef(function ComboboxIcon2(componentProps, forwardedRef) {
11782 const {
11783 render,
11784 className,
11785 style,
11786 ...elementProps
11787 } = componentProps;
11788 const element = useRenderElement("span", componentProps, {
11789 ref: forwardedRef,
11790 props: [{
11791 "aria-hidden": true,
11792 children: "▼"
11793 }, elementProps]
11794 });
11795 return element;
11796 });
11797 if (true) ComboboxIcon.displayName = "ComboboxIcon";
11798
11799 // node_modules/@base-ui/react/combobox/clear/ComboboxClear.mjs
11800 var React62 = __toESM(require_react(), 1);
11801 var stateAttributesMapping = {
11802 ...transitionStatusMapping,
11803 ...triggerOpenStateMapping
11804 };
11805 var ComboboxClear = /* @__PURE__ */ React62.forwardRef(function ComboboxClear2(componentProps, forwardedRef) {
11806 const {
11807 render,
11808 className,
11809 disabled: disabledProp = false,
11810 nativeButton = true,
11811 keepMounted = false,
11812 style,
11813 ...elementProps
11814 } = componentProps;
11815 const {
11816 disabled: fieldDisabled
11817 } = useFieldRootContext();
11818 const store = useComboboxRootContext();
11819 const selectionMode = useStore(store, selectors2.selectionMode);
11820 const comboboxDisabled = useStore(store, selectors2.disabled);
11821 const readOnly = useStore(store, selectors2.readOnly);
11822 const open = useStore(store, selectors2.open);
11823 const selectedValue = useStore(store, selectors2.selectedValue);
11824 const hasSelectionChips = useStore(store, selectors2.hasSelectionChips);
11825 const inputValue = useComboboxInputValueContext();
11826 let visible = false;
11827 if (selectionMode === "none") {
11828 visible = inputValue !== "";
11829 } else if (selectionMode === "single") {
11830 visible = selectedValue != null;
11831 } else {
11832 visible = hasSelectionChips;
11833 }
11834 const disabled2 = fieldDisabled || comboboxDisabled || disabledProp;
11835 const {
11836 buttonRef,
11837 getButtonProps
11838 } = useButton({
11839 native: nativeButton,
11840 disabled: disabled2
11841 });
11842 const {
11843 mounted,
11844 transitionStatus,
11845 setMounted
11846 } = useTransitionStatus(visible);
11847 const state = {
11848 disabled: disabled2,
11849 visible,
11850 open,
11851 transitionStatus
11852 };
11853 useOpenChangeComplete({
11854 open: visible,
11855 ref: store.state.clearRef,
11856 onComplete() {
11857 if (!visible) {
11858 setMounted(false);
11859 }
11860 }
11861 });
11862 const element = useRenderElement("button", componentProps, {
11863 state,
11864 ref: [forwardedRef, buttonRef, store.state.clearRef],
11865 props: [{
11866 tabIndex: -1,
11867 children: "x",
11868 // Avoid stealing focus from the input.
11869 onMouseDown(event) {
11870 event.preventDefault();
11871 },
11872 onClick(event) {
11873 if (disabled2 || readOnly) {
11874 return;
11875 }
11876 const type = store.state.keyboardActiveRef.current ? reason_parts_exports.keyboard : reason_parts_exports.pointer;
11877 store.state.setInputValue("", createChangeEventDetails(reason_parts_exports.clearPress, event.nativeEvent));
11878 if (selectionMode !== "none") {
11879 store.state.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(reason_parts_exports.clearPress, event.nativeEvent));
11880 store.state.setIndices({
11881 activeIndex: null,
11882 selectedIndex: null,
11883 type
11884 });
11885 } else {
11886 store.state.setIndices({
11887 activeIndex: null,
11888 type
11889 });
11890 }
11891 store.state.inputRef.current?.focus();
11892 }
11893 }, elementProps, getButtonProps],
11894 stateAttributesMapping
11895 });
11896 const shouldRender = keepMounted || mounted;
11897 if (!shouldRender) {
11898 return null;
11899 }
11900 return element;
11901 });
11902 if (true) ComboboxClear.displayName = "ComboboxClear";
11903
11904 // node_modules/@base-ui/react/combobox/list/ComboboxList.mjs
11905 var React65 = __toESM(require_react(), 1);
11906
11907 // node_modules/@base-ui/react/combobox/collection/ComboboxCollection.mjs
11908 var React64 = __toESM(require_react(), 1);
11909
11910 // node_modules/@base-ui/react/combobox/collection/GroupCollectionContext.mjs
11911 var React63 = __toESM(require_react(), 1);
11912 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
11913 var GroupCollectionContext = /* @__PURE__ */ React63.createContext(null);
11914 if (true) GroupCollectionContext.displayName = "GroupCollectionContext";
11915 function useGroupCollectionContext() {
11916 return React63.useContext(GroupCollectionContext);
11917 }
11918 function GroupCollectionProvider(props) {
11919 const {
11920 children,
11921 items
11922 } = props;
11923 const contextValue = React63.useMemo(() => ({
11924 items
11925 }), [items]);
11926 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GroupCollectionContext.Provider, {
11927 value: contextValue,
11928 children
11929 });
11930 }
11931
11932 // node_modules/@base-ui/react/combobox/collection/ComboboxCollection.mjs
11933 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
11934 function ComboboxCollection(props) {
11935 const {
11936 children
11937 } = props;
11938 const {
11939 filteredItems
11940 } = useComboboxDerivedItemsContext();
11941 const groupContext = useGroupCollectionContext();
11942 const itemsToRender = groupContext ? groupContext.items : filteredItems;
11943 return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(React64.Fragment, {
11944 children: itemsToRender.map(children)
11945 });
11946 }
11947
11948 // node_modules/@base-ui/react/combobox/list/ComboboxList.mjs
11949 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
11950 var ComboboxList = /* @__PURE__ */ React65.forwardRef(function ComboboxList2(componentProps, forwardedRef) {
11951 var _ComboboxCollection;
11952 const {
11953 render,
11954 className,
11955 style,
11956 children,
11957 ...elementProps
11958 } = componentProps;
11959 const store = useComboboxRootContext();
11960 const floatingRootContext = useComboboxFloatingContext();
11961 const hasPositionerContext = Boolean(useComboboxPositionerContext(true));
11962 const {
11963 filteredItems,
11964 hasItems
11965 } = useComboboxDerivedItemsContext();
11966 const selectionMode = useStore(store, selectors2.selectionMode);
11967 const grid = useStore(store, selectors2.grid);
11968 const listProps = useStore(store, selectors2.listProps);
11969 const virtualized = useStore(store, selectors2.virtualized);
11970 const forceMounted = useStore(store, selectors2.forceMounted);
11971 const multiple = selectionMode === "multiple";
11972 const empty = filteredItems.length === 0;
11973 const setPositionerElement = useStableCallback((element2) => {
11974 store.set("positionerElement", element2);
11975 });
11976 const setListElement = useStableCallback((element2) => {
11977 store.set("listElement", element2);
11978 });
11979 const resolvedChildren = React65.useMemo(() => {
11980 if (typeof children === "function") {
11981 return _ComboboxCollection || (_ComboboxCollection = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ComboboxCollection, {
11982 children
11983 }));
11984 }
11985 return children;
11986 }, [children]);
11987 const state = {
11988 empty
11989 };
11990 const floatingId = floatingRootContext.useState("floatingId");
11991 const element = useRenderElement("div", componentProps, {
11992 state,
11993 ref: [forwardedRef, setListElement, hasPositionerContext ? null : setPositionerElement],
11994 props: [listProps, {
11995 children: resolvedChildren,
11996 tabIndex: -1,
11997 id: floatingId,
11998 role: grid ? "grid" : "listbox",
11999 "aria-multiselectable": multiple ? "true" : void 0,
12000 onKeyDown(event) {
12001 if (store.state.disabled || store.state.readOnly) {
12002 return;
12003 }
12004 if (event.key === "Enter") {
12005 const activeIndex = store.state.activeIndex;
12006 if (activeIndex == null) {
12007 return;
12008 }
12009 stopEvent(event);
12010 clickHighlightedItem(store, activeIndex, event.nativeEvent);
12011 }
12012 },
12013 onKeyDownCapture() {
12014 store.state.keyboardActiveRef.current = true;
12015 },
12016 onPointerMoveCapture() {
12017 store.state.keyboardActiveRef.current = false;
12018 }
12019 }, elementProps]
12020 });
12021 if (virtualized) {
12022 return element;
12023 }
12024 const labelsRef = hasItems && !forceMounted ? void 0 : store.state.labelsRef;
12025 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CompositeList, {
12026 elementsRef: store.state.listRef,
12027 labelsRef,
12028 children: element
12029 });
12030 });
12031 if (true) ComboboxList.displayName = "ComboboxList";
12032
12033 // node_modules/@base-ui/react/combobox/status/ComboboxStatus.mjs
12034 var React67 = __toESM(require_react(), 1);
12035
12036 // node_modules/@base-ui/react/combobox/utils/useInitialLiveRegionTextMutation.mjs
12037 var React66 = __toESM(require_react(), 1);
12038 var LIVE_REGION_MARKER = "⁠";
12039 var INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY = 200;
12040 function findLastTextNode(root2) {
12041 const walker = root2.ownerDocument.createTreeWalker(root2, NodeFilter.SHOW_TEXT);
12042 let lastTextNode = null;
12043 while (walker.nextNode()) {
12044 const textNode = walker.currentNode;
12045 if (textNode.nodeValue !== "") {
12046 lastTextNode = textNode;
12047 }
12048 }
12049 return lastTextNode;
12050 }
12051 function useInitialLiveRegionTextMutation() {
12052 const timeout = useTimeout();
12053 const rootRef = React66.useRef(null);
12054 React66.useEffect(() => {
12055 if (parts_exports.os.ios) {
12056 return void 0;
12057 }
12058 const root2 = rootRef.current;
12059 if (root2 == null) {
12060 return void 0;
12061 }
12062 const textNode = findLastTextNode(root2);
12063 if (textNode == null) {
12064 return void 0;
12065 }
12066 const originalValue = textNode.data;
12067 const markedValue = `${originalValue}${LIVE_REGION_MARKER}`;
12068 textNode.nodeValue = markedValue;
12069 timeout.start(INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY, () => {
12070 if (textNode.nodeValue === markedValue) {
12071 textNode.nodeValue = originalValue;
12072 }
12073 });
12074 return () => {
12075 timeout.clear();
12076 if (textNode.nodeValue === markedValue) {
12077 textNode.nodeValue = originalValue;
12078 }
12079 };
12080 }, [rootRef, timeout]);
12081 return rootRef;
12082 }
12083
12084 // node_modules/@base-ui/react/combobox/status/ComboboxStatus.mjs
12085 var ComboboxStatus = /* @__PURE__ */ React67.forwardRef(function ComboboxStatus2(componentProps, forwardedRef) {
12086 const {
12087 render,
12088 className,
12089 style,
12090 children: childrenProp,
12091 ...elementProps
12092 } = componentProps;
12093 const statusRef = useInitialLiveRegionTextMutation();
12094 return useRenderElement("div", componentProps, {
12095 ref: [forwardedRef, statusRef],
12096 props: [{
12097 children: childrenProp,
12098 role: "status",
12099 "aria-live": "polite",
12100 "aria-atomic": true
12101 }, elementProps]
12102 });
12103 });
12104 if (true) ComboboxStatus.displayName = "ComboboxStatus";
12105
12106 // node_modules/@base-ui/react/combobox/portal/ComboboxPortal.mjs
12107 var React69 = __toESM(require_react(), 1);
12108
12109 // node_modules/@base-ui/react/combobox/portal/ComboboxPortalContext.mjs
12110 var React68 = __toESM(require_react(), 1);
12111 var ComboboxPortalContext = /* @__PURE__ */ React68.createContext(void 0);
12112 if (true) ComboboxPortalContext.displayName = "ComboboxPortalContext";
12113 function useComboboxPortalContext() {
12114 const context = React68.useContext(ComboboxPortalContext);
12115 if (context === void 0) {
12116 throw new Error(true ? "Base UI: <Combobox.Portal> is missing." : formatErrorMessage_default(20));
12117 }
12118 return context;
12119 }
12120
12121 // node_modules/@base-ui/react/combobox/portal/ComboboxPortal.mjs
12122 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
12123 var ComboboxPortal = /* @__PURE__ */ React69.forwardRef(function ComboboxPortal2(props, forwardedRef) {
12124 const {
12125 keepMounted = false,
12126 ...portalProps
12127 } = props;
12128 const store = useComboboxRootContext();
12129 const mounted = useStore(store, selectors2.mounted);
12130 const forceMounted = useStore(store, selectors2.forceMounted);
12131 const shouldRender = mounted || keepMounted || forceMounted;
12132 if (!shouldRender) {
12133 return null;
12134 }
12135 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ComboboxPortalContext.Provider, {
12136 value: keepMounted,
12137 children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FloatingPortal, {
12138 ref: forwardedRef,
12139 ...portalProps
12140 })
12141 });
12142 });
12143 if (true) ComboboxPortal.displayName = "ComboboxPortal";
12144
12145 // node_modules/@base-ui/react/combobox/backdrop/ComboboxBackdrop.mjs
12146 var React70 = __toESM(require_react(), 1);
12147 var stateAttributesMapping2 = {
12148 ...popupStateMapping,
12149 ...transitionStatusMapping
12150 };
12151 var ComboboxBackdrop = /* @__PURE__ */ React70.forwardRef(function ComboboxBackdrop2(componentProps, forwardedRef) {
12152 const {
12153 render,
12154 className,
12155 style,
12156 ...elementProps
12157 } = componentProps;
12158 const store = useComboboxRootContext();
12159 const open = useStore(store, selectors2.open);
12160 const mounted = useStore(store, selectors2.mounted);
12161 const transitionStatus = useStore(store, selectors2.transitionStatus);
12162 const state = {
12163 open,
12164 transitionStatus
12165 };
12166 return useRenderElement("div", componentProps, {
12167 state,
12168 ref: forwardedRef,
12169 stateAttributesMapping: stateAttributesMapping2,
12170 props: [{
12171 role: "presentation",
12172 hidden: !mounted,
12173 style: {
12174 userSelect: "none",
12175 WebkitUserSelect: "none"
12176 }
12177 }, elementProps]
12178 });
12179 });
12180 if (true) ComboboxBackdrop.displayName = "ComboboxBackdrop";
12181
12182 // node_modules/@base-ui/react/combobox/positioner/ComboboxPositioner.mjs
12183 var React73 = __toESM(require_react(), 1);
12184
12185 // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs
12186 var React71 = __toESM(require_react(), 1);
12187
12188 // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs
12189 var baseArrow = (options) => ({
12190 name: "arrow",
12191 options,
12192 async fn(state) {
12193 const {
12194 x,
12195 y,
12196 placement,
12197 rects,
12198 platform: platform3,
12199 elements,
12200 middlewareData
12201 } = state;
12202 const {
12203 element,
12204 padding = 0,
12205 offsetParent = "real"
12206 } = evaluate(options, state) || {};
12207 if (element == null) {
12208 return {};
12209 }
12210 const paddingObject = getPaddingObject(padding);
12211 const coords = {
12212 x,
12213 y
12214 };
12215 const axis = getAlignmentAxis(placement);
12216 const length = getAxisLength(axis);
12217 const arrowDimensions = await platform3.getDimensions(element);
12218 const isYAxis = axis === "y";
12219 const minProp = isYAxis ? "top" : "left";
12220 const maxProp = isYAxis ? "bottom" : "right";
12221 const clientProp = isYAxis ? "clientHeight" : "clientWidth";
12222 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
12223 const startDiff = coords[axis] - rects.reference[axis];
12224 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating;
12225 let clientSize = elements.floating[clientProp] || rects.floating[length];
12226 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) {
12227 clientSize = elements.floating[clientProp] || rects.floating[length];
12228 }
12229 const centerToReference = endDiff / 2 - startDiff / 2;
12230 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
12231 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);
12232 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);
12233 const min2 = minPadding;
12234 const max2 = clientSize - arrowDimensions[length] - maxPadding;
12235 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
12236 const offset4 = clamp(min2, center, max2);
12237 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
12238 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0;
12239 return {
12240 [axis]: coords[axis] + alignmentOffset,
12241 data: {
12242 [axis]: offset4,
12243 centerOffset: center - offset4 - alignmentOffset,
12244 ...shouldAddOffset && {
12245 alignmentOffset
12246 }
12247 },
12248 reset: shouldAddOffset
12249 };
12250 }
12251 });
12252 var arrow4 = (options, deps) => ({
12253 ...baseArrow(options),
12254 options: [options, deps]
12255 });
12256
12257 // node_modules/@base-ui/react/utils/hideMiddleware.mjs
12258 var hide4 = {
12259 name: "hide",
12260 async fn(state) {
12261 const {
12262 width,
12263 height,
12264 x,
12265 y
12266 } = state.rects.reference;
12267 const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0;
12268 const overflow = await state.platform.detectOverflow(state, {
12269 elementContext: "reference"
12270 });
12271 const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;
12272 return {
12273 data: {
12274 referenceHidden: referenceHidden || anchorHidden
12275 }
12276 };
12277 }
12278 };
12279
12280 // node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs
12281 var DEFAULT_SIDES = {
12282 sideX: "left",
12283 sideY: "top"
12284 };
12285
12286 // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs
12287 var AVAILABLE_WIDTH_VAR = "--available-width";
12288 var AVAILABLE_HEIGHT_VAR = "--available-height";
12289 function getLogicalSide(sideParam, renderedSide, isRtl) {
12290 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end";
12291 const logicalRight = isRtl ? "inline-start" : "inline-end";
12292 const logicalLeft = isRtl ? "inline-end" : "inline-start";
12293 return {
12294 top: "top",
12295 right: isLogicalSideParam ? logicalRight : "right",
12296 bottom: "bottom",
12297 left: isLogicalSideParam ? logicalLeft : "left"
12298 }[renderedSide];
12299 }
12300 function getOffsetData(state, sideParam, isRtl) {
12301 const {
12302 rects,
12303 placement
12304 } = state;
12305 const data = {
12306 side: getLogicalSide(sideParam, getSide(placement), isRtl),
12307 align: getAlignment(placement) || "center",
12308 anchor: {
12309 width: rects.reference.width,
12310 height: rects.reference.height
12311 },
12312 positioner: {
12313 width: rects.floating.width,
12314 height: rects.floating.height
12315 }
12316 };
12317 return data;
12318 }
12319 function useAnchorPositioning(params) {
12320 return useAnchorPositioningWithHook(params, useBaseUIFloating);
12321 }
12322 function useAnchorPositioningWithHook(params, useFloatingHook) {
12323 const {
12324 // Public parameters
12325 anchor,
12326 positionMethod = "absolute",
12327 side: sideParam = "bottom",
12328 sideOffset = 0,
12329 align = "center",
12330 alignOffset = 0,
12331 collisionBoundary,
12332 collisionPadding: collisionPaddingParam = 5,
12333 sticky = false,
12334 arrowPadding = 5,
12335 disableAnchorTracking = false,
12336 inline: inlineMiddleware,
12337 // Private parameters
12338 keepMounted = false,
12339 floatingRootContext,
12340 mounted,
12341 collisionAvoidance,
12342 shift: shift4,
12343 nodeId,
12344 adaptiveOrigin: adaptiveOrigin2,
12345 lazyFlip = false,
12346 externalTree
12347 } = params;
12348 const [mountSide, setMountSide] = React71.useState(null);
12349 if (!mounted && mountSide !== null) {
12350 setMountSide(null);
12351 }
12352 const collisionAvoidanceSide = collisionAvoidance.side || "flip";
12353 const collisionAvoidanceAlign = collisionAvoidance.align || "flip";
12354 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end";
12355 const shiftCrossAxis = shift4?.crossAxis ?? false;
12356 const shiftRootBoundary = shift4?.rootBoundary;
12357 const anchorFn = typeof anchor === "function" ? anchor : void 0;
12358 const anchorFnCallback = useStableCallback(anchorFn);
12359 const anchorDep = anchorFn ? anchorFnCallback : anchor;
12360 const anchorValueRef = useValueAsRef(anchor);
12361 const mountedRef = useValueAsRef(mounted);
12362 const direction = useDirection();
12363 const isRtl = direction === "rtl";
12364 const side = mountSide || {
12365 top: "top",
12366 right: "right",
12367 bottom: "bottom",
12368 left: "left",
12369 "inline-end": isRtl ? "left" : "right",
12370 "inline-start": isRtl ? "right" : "left"
12371 }[sideParam];
12372 const placement = align === "center" ? side : `${side}-${align}`;
12373 let collisionPadding = collisionPaddingParam;
12374 if (typeof collisionPadding === "number") {
12375 collisionPadding = {
12376 top: collisionPadding,
12377 right: collisionPadding,
12378 bottom: collisionPadding,
12379 left: collisionPadding
12380 };
12381 } else if (collisionPadding) {
12382 collisionPadding = {
12383 top: collisionPadding.top || 0,
12384 right: collisionPadding.right || 0,
12385 bottom: collisionPadding.bottom || 0,
12386 left: collisionPadding.left || 0
12387 };
12388 }
12389 const bias = 1;
12390 const biasTop = sideParam === "bottom" ? bias : 0;
12391 const biasBottom = sideParam === "top" ? bias : 0;
12392 const biasLeft = sideParam === "right" ? bias : 0;
12393 const biasRight = sideParam === "left" ? bias : 0;
12394 const commonCollisionProps = {
12395 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary,
12396 padding: collisionPadding
12397 };
12398 const arrowRef = React71.useRef(null);
12399 const sideOffsetRef = useValueAsRef(sideOffset);
12400 const alignOffsetRef = useValueAsRef(alignOffset);
12401 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0;
12402 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0;
12403 const middleware = [];
12404 if (inlineMiddleware) {
12405 middleware.push(inlineMiddleware);
12406 }
12407 middleware.push(offset3((state) => {
12408 const data = getOffsetData(state, sideParam, isRtl);
12409 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current;
12410 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current;
12411 return {
12412 mainAxis: sideAxis,
12413 crossAxis: alignAxis,
12414 alignmentAxis: alignAxis
12415 };
12416 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));
12417 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift";
12418 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift");
12419 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({
12420 ...commonCollisionProps,
12421 // Ensure the popup flips if it's been limited by its --available-height and it resizes.
12422 // Since the size() padding is smaller than the flip() padding, flip() will take precedence.
12423 padding: {
12424 top: collisionPadding.top + bias + biasTop,
12425 right: collisionPadding.right + bias + biasRight,
12426 bottom: collisionPadding.bottom + bias + biasBottom,
12427 left: collisionPadding.left + bias + biasLeft
12428 },
12429 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip",
12430 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false,
12431 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
12432 });
12433 const shiftMiddleware = shiftDisabled ? null : shift3({
12434 ...commonCollisionProps,
12435 // Use the Layout Viewport to avoid shifting around when pinch-zooming.
12436 rootBoundary: shiftRootBoundary,
12437 mainAxis: collisionAvoidanceAlign !== "none",
12438 crossAxis: crossAxisShiftEnabled,
12439 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => {
12440 if (!arrowRef.current) {
12441 return {};
12442 }
12443 const {
12444 width,
12445 height
12446 } = arrowRef.current.getBoundingClientRect();
12447 const sideAxis = getSideAxis(getSide(limitData.placement));
12448 const arrowSize = sideAxis === "y" ? width : height;
12449 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
12450 return {
12451 offset: arrowSize / 2 + offsetAmount / 2
12452 };
12453 })
12454 }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]);
12455 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") {
12456 middleware.push(shiftMiddleware, flipMiddleware);
12457 } else {
12458 middleware.push(flipMiddleware, shiftMiddleware);
12459 }
12460 middleware.push(size3({
12461 ...commonCollisionProps,
12462 apply({
12463 elements: {
12464 floating
12465 },
12466 availableWidth,
12467 availableHeight,
12468 rects
12469 }) {
12470 if (!mountedRef.current) {
12471 return;
12472 }
12473 const floatingStyle = floating.style;
12474 floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth}px`);
12475 floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight}px`);
12476 const dpr = getWindow(floating).devicePixelRatio || 1;
12477 const {
12478 x: x2,
12479 y: y2,
12480 width,
12481 height
12482 } = rects.reference;
12483 const anchorWidth = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr;
12484 const anchorHeight = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr;
12485 floatingStyle.setProperty("--anchor-width", `${anchorWidth}px`);
12486 floatingStyle.setProperty("--anchor-height", `${anchorHeight}px`);
12487 }
12488 }), arrow4((state) => ({
12489 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,
12490 // we'll create a fake element.
12491 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"),
12492 padding: arrowPadding,
12493 offsetParent: "floating"
12494 }), [arrowPadding]), {
12495 name: "transformOrigin",
12496 fn(state) {
12497 const {
12498 elements: elements2,
12499 middlewareData: middlewareData2,
12500 placement: renderedPlacement2,
12501 rects,
12502 y: y2
12503 } = state;
12504 const currentRenderedSide = getSide(renderedPlacement2);
12505 const currentRenderedAxis = getSideAxis(currentRenderedSide);
12506 const arrowEl = arrowRef.current;
12507 const arrowX = middlewareData2.arrow?.x || 0;
12508 const arrowY = middlewareData2.arrow?.y || 0;
12509 const arrowWidth = arrowEl?.clientWidth || 0;
12510 const arrowHeight = arrowEl?.clientHeight || 0;
12511 const transformX = arrowX + arrowWidth / 2;
12512 const transformY = arrowY + arrowHeight / 2;
12513 const shiftY = Math.abs(middlewareData2.shift?.y || 0);
12514 const halfAnchorHeight = rects.reference.height / 2;
12515 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
12516 const isOverlappingAnchor = shiftY > sideOffsetValue;
12517 const adjacentTransformOrigin = {
12518 top: `${transformX}px calc(100% + ${sideOffsetValue}px)`,
12519 bottom: `${transformX}px ${-sideOffsetValue}px`,
12520 left: `calc(100% + ${sideOffsetValue}px) ${transformY}px`,
12521 right: `${-sideOffsetValue}px ${transformY}px`
12522 }[currentRenderedSide];
12523 const overlapTransformOrigin = `${transformX}px ${rects.reference.y + halfAnchorHeight - y2}px`;
12524 elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin);
12525 return {};
12526 }
12527 }, hide4, adaptiveOrigin2);
12528 useIsoLayoutEffect(() => {
12529 if (!mounted && floatingRootContext) {
12530 floatingRootContext.update({
12531 referenceElement: null,
12532 floatingElement: null,
12533 domReferenceElement: null,
12534 positionReference: null
12535 });
12536 }
12537 }, [mounted, floatingRootContext]);
12538 const autoUpdateOptions = React71.useMemo(() => ({
12539 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined",
12540 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined"
12541 }), [disableAnchorTracking]);
12542 const {
12543 refs,
12544 elements,
12545 x,
12546 y,
12547 middlewareData,
12548 update: update2,
12549 placement: renderedPlacement,
12550 context,
12551 isPositioned,
12552 floatingStyles: originalFloatingStyles
12553 } = useFloatingHook({
12554 rootContext: floatingRootContext,
12555 open: keepMounted ? mounted : void 0,
12556 placement,
12557 middleware,
12558 strategy: positionMethod,
12559 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions),
12560 nodeId,
12561 externalTree
12562 });
12563 const {
12564 sideX,
12565 sideY
12566 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;
12567 const resolvedPosition = isPositioned ? positionMethod : "fixed";
12568 const floatingStyles = React71.useMemo(() => {
12569 let base;
12570 if (!isPositioned) {
12571 base = {
12572 position: resolvedPosition,
12573 top: 0,
12574 left: 0
12575 };
12576 } else if (adaptiveOrigin2) {
12577 base = {
12578 position: resolvedPosition,
12579 [sideX]: x,
12580 [sideY]: y
12581 };
12582 } else {
12583 base = {
12584 ...originalFloatingStyles,
12585 position: resolvedPosition
12586 };
12587 }
12588 base[AVAILABLE_WIDTH_VAR] = "100vw";
12589 base[AVAILABLE_HEIGHT_VAR] = "100vh";
12590 if (!isPositioned) {
12591 base.opacity = 0;
12592 }
12593 return base;
12594 }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]);
12595 const registeredPositionReferenceRef = React71.useRef(null);
12596 useIsoLayoutEffect(() => {
12597 if (!mounted) {
12598 return;
12599 }
12600 const anchorValue = anchorValueRef.current;
12601 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue;
12602 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;
12603 const finalAnchor = unwrappedElement || null;
12604 if (finalAnchor !== registeredPositionReferenceRef.current) {
12605 refs.setPositionReference(finalAnchor);
12606 registeredPositionReferenceRef.current = finalAnchor;
12607 }
12608 }, [mounted, refs, anchorDep, anchorValueRef]);
12609 React71.useEffect(() => {
12610 if (!mounted) {
12611 return;
12612 }
12613 const anchorValue = anchorValueRef.current;
12614 if (typeof anchorValue === "function") {
12615 return;
12616 }
12617 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {
12618 refs.setPositionReference(anchorValue.current);
12619 registeredPositionReferenceRef.current = anchorValue.current;
12620 }
12621 }, [mounted, refs, anchorDep, anchorValueRef]);
12622 React71.useEffect(() => {
12623 if (keepMounted && mounted && elements.reference && elements.floating) {
12624 return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions);
12625 }
12626 return void 0;
12627 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]);
12628 const renderedSide = getSide(renderedPlacement);
12629 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);
12630 const renderedAlign = getAlignment(renderedPlacement) || "center";
12631 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);
12632 useIsoLayoutEffect(() => {
12633 if (lazyFlip && mounted && isPositioned && renderedSide !== side) {
12634 setMountSide(renderedSide);
12635 }
12636 }, [lazyFlip, mounted, isPositioned, renderedSide, side]);
12637 const arrowStyles = React71.useMemo(() => ({
12638 position: "absolute",
12639 top: middlewareData.arrow?.y,
12640 left: middlewareData.arrow?.x
12641 }), [middlewareData.arrow]);
12642 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;
12643 return React71.useMemo(() => ({
12644 positionerStyles: floatingStyles,
12645 arrowStyles,
12646 arrowRef,
12647 arrowUncentered,
12648 side: logicalRenderedSide,
12649 align: renderedAlign,
12650 physicalSide: renderedSide,
12651 anchorHidden,
12652 refs,
12653 context,
12654 isPositioned,
12655 update: update2
12656 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]);
12657 }
12658 function isRef(param) {
12659 return param != null && "current" in param;
12660 }
12661
12662 // node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs
12663 function getDisabledMountTransitionStyles(transitionStatus) {
12664 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;
12665 }
12666
12667 // node_modules/@base-ui/react/utils/usePositioner.mjs
12668 function usePositioner(componentProps, state, {
12669 styles,
12670 transitionStatus,
12671 props,
12672 refs,
12673 hidden,
12674 inert = false
12675 }) {
12676 const style = {
12677 ...styles
12678 };
12679 if (inert) {
12680 style.pointerEvents = "none";
12681 }
12682 return useRenderElement("div", componentProps, {
12683 state,
12684 ref: refs,
12685 props: [{
12686 role: "presentation",
12687 hidden,
12688 style
12689 }, getDisabledMountTransitionStyles(transitionStatus), props],
12690 stateAttributesMapping: popupStateMapping
12691 });
12692 }
12693
12694 // node_modules/@base-ui/react/utils/useAnchoredPopupScrollLock.mjs
12695 var React72 = __toESM(require_react(), 1);
12696 var VIEWPORT_WIDTH_TOLERANCE_PX = 20;
12697 function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {
12698 const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React72.useState(false);
12699 useIsoLayoutEffect(() => {
12700 if (!enabled || !touchOpen || positionerElement == null) {
12701 setTouchOpenShouldLockScroll(false);
12702 return;
12703 }
12704 const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;
12705 const popupWidth = positionerElement.offsetWidth;
12706 setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);
12707 }, [enabled, touchOpen, positionerElement]);
12708 useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);
12709 }
12710
12711 // node_modules/@base-ui/react/combobox/positioner/ComboboxPositioner.mjs
12712 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
12713 var ComboboxPositioner = /* @__PURE__ */ React73.forwardRef(function ComboboxPositioner2(componentProps, forwardedRef) {
12714 const {
12715 render,
12716 className,
12717 anchor,
12718 // `useAnchorPositioning` applies the same defaults to the undefined values; the names
12719 // remain destructured to exclude the props from `elementProps`.
12720 positionMethod,
12721 side,
12722 align,
12723 sideOffset,
12724 alignOffset,
12725 collisionBoundary = "clipping-ancestors",
12726 collisionPadding,
12727 arrowPadding,
12728 sticky,
12729 disableAnchorTracking = false,
12730 collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE,
12731 style: styleProp,
12732 ...elementProps
12733 } = componentProps;
12734 const store = useComboboxRootContext();
12735 const floatingRootContext = useComboboxFloatingContext();
12736 const keepMounted = useComboboxPortalContext();
12737 const modal = useStore(store, selectors2.modal);
12738 const open = useStore(store, selectors2.open);
12739 const mounted = useStore(store, selectors2.mounted);
12740 const openMethod = useStore(store, selectors2.openMethod);
12741 const positionerElement = useStore(store, selectors2.positionerElement);
12742 const triggerElement = useStore(store, selectors2.triggerElement);
12743 const inputElement = useStore(store, selectors2.inputElement);
12744 const inputGroupElement = useStore(store, selectors2.inputGroupElement);
12745 const inputInsidePopup = useStore(store, selectors2.inputInsidePopup);
12746 const transitionStatus = useStore(store, selectors2.transitionStatus);
12747 const empty = useListEmpty();
12748 const resolvedAnchor = anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement);
12749 const positioning = useAnchorPositioning({
12750 anchor: resolvedAnchor,
12751 floatingRootContext,
12752 positionMethod,
12753 mounted,
12754 side,
12755 sideOffset,
12756 align,
12757 alignOffset,
12758 arrowPadding,
12759 collisionBoundary,
12760 collisionPadding,
12761 sticky,
12762 disableAnchorTracking,
12763 keepMounted,
12764 collisionAvoidance,
12765 lazyFlip: true
12766 });
12767 useAnchoredPopupScrollLock(open && modal, openMethod === "touch", positionerElement, triggerElement);
12768 const state = {
12769 open,
12770 side: positioning.side,
12771 align: positioning.align,
12772 anchorHidden: positioning.anchorHidden,
12773 empty
12774 };
12775 useIsoLayoutEffect(() => {
12776 store.set("popupSide", positioning.side);
12777 }, [store, positioning.side]);
12778 const setPositionerElement = useStableCallback((element2) => {
12779 store.set("positionerElement", element2);
12780 });
12781 const element = usePositioner(componentProps, state, {
12782 styles: positioning.positionerStyles,
12783 transitionStatus,
12784 props: elementProps,
12785 refs: [forwardedRef, setPositionerElement],
12786 hidden: !mounted,
12787 inert: !open
12788 });
12789 return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ComboboxPositionerContext.Provider, {
12790 value: positioning,
12791 children: [mounted && modal && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(InternalBackdrop, {
12792 inert: inertValue(!open),
12793 cutout: inputGroupElement ?? inputElement ?? triggerElement
12794 }), element]
12795 });
12796 });
12797 if (true) ComboboxPositioner.displayName = "ComboboxPositioner";
12798
12799 // node_modules/@base-ui/react/combobox/popup/ComboboxPopup.mjs
12800 var React74 = __toESM(require_react(), 1);
12801 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
12802 var stateAttributesMapping3 = {
12803 ...popupStateMapping,
12804 ...transitionStatusMapping
12805 };
12806 var ComboboxPopup = /* @__PURE__ */ React74.forwardRef(function ComboboxPopup2(componentProps, forwardedRef) {
12807 const {
12808 render,
12809 className,
12810 style,
12811 initialFocus,
12812 finalFocus,
12813 ...elementProps
12814 } = componentProps;
12815 const store = useComboboxRootContext();
12816 const positioning = useComboboxPositionerContext();
12817 const floatingRootContext = useComboboxFloatingContext();
12818 const mounted = useStore(store, selectors2.mounted);
12819 const open = useStore(store, selectors2.open);
12820 const openMethod = useStore(store, selectors2.openMethod);
12821 const popupProps = useStore(store, selectors2.popupProps);
12822 const transitionStatus = useStore(store, selectors2.transitionStatus);
12823 const inputInsidePopup = useStore(store, selectors2.inputInsidePopup);
12824 const inputElement = useStore(store, selectors2.inputElement);
12825 const modal = useStore(store, selectors2.modal);
12826 const rootId = useStore(store, selectors2.id);
12827 const empty = useListEmpty();
12828 const popupId = elementProps.id ?? (inputInsidePopup ? getComboboxPopupId(rootId) : void 0);
12829 useIsoLayoutEffect(() => {
12830 store.set("popupId", store.state.popupRef.current?.id || popupId);
12831 return () => {
12832 store.set("popupId", void 0);
12833 };
12834 }, [store, popupId]);
12835 useOpenChangeComplete({
12836 open,
12837 ref: store.state.popupRef,
12838 onComplete() {
12839 if (open) {
12840 store.state.onOpenChangeComplete(true);
12841 }
12842 }
12843 });
12844 const state = {
12845 open,
12846 side: positioning.side,
12847 align: positioning.align,
12848 anchorHidden: positioning.anchorHidden,
12849 transitionStatus,
12850 empty
12851 };
12852 const element = useRenderElement("div", componentProps, {
12853 state,
12854 ref: [forwardedRef, store.state.popupRef],
12855 props: [popupProps, {
12856 id: popupId,
12857 role: inputInsidePopup ? "dialog" : "presentation",
12858 onFocus(event) {
12859 const target = getTarget(event.nativeEvent);
12860 if (openMethod !== "touch" && (contains(store.state.listElement, target) || target === event.currentTarget)) {
12861 store.state.inputRef.current?.focus();
12862 }
12863 }
12864 }, getDisabledMountTransitionStyles(transitionStatus), elementProps],
12865 stateAttributesMapping: stateAttributesMapping3
12866 });
12867 const computedDefaultInitialFocus = inputInsidePopup ? (interactionType) => interactionType === "touch" ? store.state.popupRef.current : inputElement : false;
12868 const resolvedInitialFocus = initialFocus === void 0 ? computedDefaultInitialFocus : initialFocus;
12869 let resolvedFinalFocus;
12870 if (finalFocus != null) {
12871 resolvedFinalFocus = finalFocus;
12872 } else {
12873 resolvedFinalFocus = inputInsidePopup ? void 0 : false;
12874 }
12875 const focusManagerModal = !inputInsidePopup || modal;
12876 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FloatingFocusManager, {
12877 context: floatingRootContext,
12878 disabled: !mounted,
12879 modal: focusManagerModal,
12880 openInteractionType: openMethod,
12881 initialFocus: resolvedInitialFocus,
12882 returnFocus: resolvedFinalFocus,
12883 getInsideElements: () => [store.state.startDismissRef.current, store.state.endDismissRef.current],
12884 children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(React74.Fragment, {
12885 children: [element, focusManagerModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ComboboxInternalDismissButton, {
12886 ref: store.state.endDismissRef
12887 })]
12888 })
12889 });
12890 });
12891 if (true) ComboboxPopup.displayName = "ComboboxPopup";
12892
12893 // node_modules/@base-ui/react/combobox/arrow/ComboboxArrow.mjs
12894 var React75 = __toESM(require_react(), 1);
12895 var ComboboxArrow = /* @__PURE__ */ React75.forwardRef(function ComboboxArrow2(componentProps, forwardedRef) {
12896 const {
12897 render,
12898 className,
12899 style,
12900 ...elementProps
12901 } = componentProps;
12902 const store = useComboboxRootContext();
12903 const {
12904 arrowRef,
12905 side,
12906 align,
12907 arrowUncentered,
12908 arrowStyles
12909 } = useComboboxPositionerContext();
12910 const open = useStore(store, selectors2.open);
12911 const state = {
12912 open,
12913 side,
12914 align,
12915 uncentered: arrowUncentered
12916 };
12917 return useRenderElement("div", componentProps, {
12918 ref: [arrowRef, forwardedRef],
12919 stateAttributesMapping: popupStateMapping,
12920 state,
12921 props: {
12922 style: arrowStyles,
12923 "aria-hidden": true,
12924 ...elementProps
12925 }
12926 });
12927 });
12928 if (true) ComboboxArrow.displayName = "ComboboxArrow";
12929
12930 // node_modules/@base-ui/react/combobox/group/ComboboxGroup.mjs
12931 var React77 = __toESM(require_react(), 1);
12932
12933 // node_modules/@base-ui/react/combobox/group/ComboboxGroupContext.mjs
12934 var React76 = __toESM(require_react(), 1);
12935 var ComboboxGroupContext = /* @__PURE__ */ React76.createContext(void 0);
12936 if (true) ComboboxGroupContext.displayName = "ComboboxGroupContext";
12937 function useComboboxGroupContext() {
12938 const context = React76.useContext(ComboboxGroupContext);
12939 if (context === void 0) {
12940 throw new Error(true ? "Base UI: ComboboxGroupContext is missing. ComboboxGroup parts must be placed within <Combobox.Group>." : formatErrorMessage_default(18));
12941 }
12942 return context;
12943 }
12944
12945 // node_modules/@base-ui/react/combobox/group/ComboboxGroup.mjs
12946 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
12947 var ComboboxGroup = /* @__PURE__ */ React77.forwardRef(function ComboboxGroup2(componentProps, forwardedRef) {
12948 const {
12949 render,
12950 className,
12951 style,
12952 items,
12953 ...elementProps
12954 } = componentProps;
12955 const [labelId, setLabelId] = React77.useState();
12956 const contextValue = React77.useMemo(() => ({
12957 labelId,
12958 setLabelId,
12959 items
12960 }), [labelId, setLabelId, items]);
12961 const element = useRenderElement("div", componentProps, {
12962 ref: forwardedRef,
12963 props: [{
12964 role: "group",
12965 "aria-labelledby": labelId
12966 }, elementProps]
12967 });
12968 const wrappedElement = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ComboboxGroupContext.Provider, {
12969 value: contextValue,
12970 children: element
12971 });
12972 if (items) {
12973 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(GroupCollectionProvider, {
12974 items,
12975 children: wrappedElement
12976 });
12977 }
12978 return wrappedElement;
12979 });
12980 if (true) ComboboxGroup.displayName = "ComboboxGroup";
12981
12982 // node_modules/@base-ui/react/combobox/group-label/ComboboxGroupLabel.mjs
12983 var React78 = __toESM(require_react(), 1);
12984 var ComboboxGroupLabel = /* @__PURE__ */ React78.forwardRef(function ComboboxGroupLabel2(componentProps, forwardedRef) {
12985 const {
12986 render,
12987 className,
12988 style,
12989 id: idProp,
12990 ...elementProps
12991 } = componentProps;
12992 const {
12993 setLabelId
12994 } = useComboboxGroupContext();
12995 const id = useBaseUiId(idProp);
12996 useIsoLayoutEffect(() => {
12997 setLabelId(id);
12998 return () => {
12999 setLabelId((currentId) => currentId === id ? void 0 : currentId);
13000 };
13001 }, [id, setLabelId]);
13002 const element = useRenderElement("div", componentProps, {
13003 ref: forwardedRef,
13004 props: [{
13005 id
13006 }, elementProps]
13007 });
13008 return element;
13009 });
13010 if (true) ComboboxGroupLabel.displayName = "ComboboxGroupLabel";
13011
13012 // node_modules/@base-ui/react/combobox/item/ComboboxItem.mjs
13013 var React81 = __toESM(require_react(), 1);
13014 var ReactDOM6 = __toESM(require_react_dom(), 1);
13015
13016 // node_modules/@base-ui/react/combobox/item/ComboboxItemContext.mjs
13017 var React79 = __toESM(require_react(), 1);
13018 var ComboboxItemContext = /* @__PURE__ */ React79.createContext(void 0);
13019 if (true) ComboboxItemContext.displayName = "ComboboxItemContext";
13020
13021 // node_modules/@base-ui/react/combobox/row/ComboboxRowContext.mjs
13022 var React80 = __toESM(require_react(), 1);
13023 var ComboboxRowContext = /* @__PURE__ */ React80.createContext(false);
13024 if (true) ComboboxRowContext.displayName = "ComboboxRowContext";
13025 function useComboboxRowContext() {
13026 return React80.useContext(ComboboxRowContext);
13027 }
13028
13029 // node_modules/@base-ui/react/combobox/item/ComboboxItem.mjs
13030 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
13031 function ComboboxItemInner(props) {
13032 const {
13033 componentProps,
13034 forwardedRef,
13035 virtualized,
13036 indexFromFilter
13037 } = props;
13038 const {
13039 render,
13040 className,
13041 style,
13042 value: itemValue = null,
13043 index: indexProp,
13044 disabled: disabledProp = false,
13045 nativeButton = false,
13046 ...elementProps
13047 } = componentProps;
13048 const textRef = React81.useRef(null);
13049 const listItem = useCompositeListItem({
13050 guess: true,
13051 index: indexProp,
13052 textRef
13053 });
13054 const store = useComboboxRootContext();
13055 const isRow = useComboboxRowContext();
13056 const hasItems = useComboboxHasItemsContext();
13057 const selectionMode = useStore(store, selectors2.selectionMode);
13058 const rootDisabled = useStore(store, selectors2.disabled);
13059 const readOnly = useStore(store, selectors2.readOnly);
13060 const isItemEqualToValue = useStore(store, selectors2.isItemEqualToValue);
13061 const disabled2 = rootDisabled || disabledProp;
13062 const selectable = selectionMode !== "none";
13063 const index2 = indexProp ?? indexFromFilter ?? listItem.index;
13064 const hasRegistered = index2 !== -1;
13065 const rootId = useStore(store, selectors2.id);
13066 const highlighted = useStore(store, selectors2.isActive, index2);
13067 const matchesSelectedValue = useStore(store, selectors2.isSelected, itemValue);
13068 const itemProps = useStore(store, selectors2.itemProps);
13069 const itemRef = React81.useRef(null);
13070 const id = rootId != null && hasRegistered ? `${rootId}-${index2}` : void 0;
13071 const selected = matchesSelectedValue && selectable;
13072 useIsoLayoutEffect(() => {
13073 const shouldRun = hasRegistered && (virtualized || indexProp != null);
13074 if (!shouldRun) {
13075 return void 0;
13076 }
13077 const list = store.state.listRef.current;
13078 list[index2] = itemRef.current;
13079 return () => {
13080 delete list[index2];
13081 };
13082 }, [hasRegistered, virtualized, index2, indexProp, store]);
13083 useIsoLayoutEffect(() => {
13084 if (!hasRegistered || hasItems) {
13085 return void 0;
13086 }
13087 const visibleMap = store.state.valuesRef.current;
13088 visibleMap[index2] = itemValue;
13089 return () => {
13090 delete visibleMap[index2];
13091 };
13092 }, [hasRegistered, hasItems, index2, itemValue, store]);
13093 useIsoLayoutEffect(() => {
13094 if (!hasRegistered || hasItems) {
13095 return;
13096 }
13097 const selectedValue = store.state.selectedValue;
13098 const lastSelectedValue = Array.isArray(selectedValue) ? selectedValue[selectedValue.length - 1] : selectedValue;
13099 if (compareItemEquality(itemValue, lastSelectedValue, isItemEqualToValue)) {
13100 store.set("selectedIndex", index2);
13101 }
13102 }, [hasRegistered, hasItems, store, index2, itemValue, isItemEqualToValue]);
13103 const {
13104 getButtonProps,
13105 buttonRef
13106 } = useButton({
13107 disabled: disabled2,
13108 focusableWhenDisabled: true,
13109 native: nativeButton,
13110 composite: true
13111 });
13112 const state = {
13113 disabled: disabled2,
13114 selected,
13115 highlighted
13116 };
13117 function commitSelection(nativeEvent) {
13118 function selectItem() {
13119 store.state.handleSelection(nativeEvent, itemValue);
13120 }
13121 if (store.state.submitOnItemClick) {
13122 ReactDOM6.flushSync(selectItem);
13123 store.state.requestSubmit();
13124 } else {
13125 selectItem();
13126 }
13127 }
13128 const defaultProps = {
13129 id,
13130 role: isRow ? "gridcell" : "option",
13131 "aria-selected": selectable ? selected : void 0,
13132 // Focusable items steal focus from the input upon mouseup.
13133 // Warn if the user renders a natively focusable element like `<button>`,
13134 // as it should be a `<div>` instead.
13135 tabIndex: void 0,
13136 onPointerDownCapture(event) {
13137 if (event.isPrimary) {
13138 store.state.pointerDownItemRef.current = event.currentTarget;
13139 }
13140 event.preventDefault();
13141 },
13142 onMouseDown(event) {
13143 event.preventDefault();
13144 },
13145 onClick(event) {
13146 if (disabled2 || readOnly) {
13147 return;
13148 }
13149 commitSelection(event.nativeEvent);
13150 },
13151 onMouseUp(event) {
13152 const pointerStartedOnItem = store.state.pointerDownItemRef.current === event.currentTarget;
13153 store.state.pointerDownItemRef.current = null;
13154 if (disabled2 || readOnly || event.button !== 0 || pointerStartedOnItem || !highlighted) {
13155 return;
13156 }
13157 commitSelection(event.nativeEvent);
13158 }
13159 };
13160 const element = useRenderElement("div", componentProps, {
13161 ref: [buttonRef, forwardedRef, listItem.ref, itemRef],
13162 state,
13163 props: [itemProps, defaultProps, elementProps, getButtonProps]
13164 });
13165 const contextValue = React81.useMemo(() => ({
13166 selected,
13167 textRef
13168 }), [selected, textRef]);
13169 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComboboxItemContext.Provider, {
13170 value: contextValue,
13171 children: element
13172 });
13173 }
13174 function ComboboxItemVirtualizedIndex(props) {
13175 const {
13176 componentProps,
13177 forwardedRef
13178 } = props;
13179 const store = useComboboxRootContext();
13180 const isItemEqualToValue = useStore(store, selectors2.isItemEqualToValue);
13181 const {
13182 flatFilteredItems
13183 } = useComboboxDerivedItemsContext();
13184 const indexFromFilter = findItemIndex(flatFilteredItems, componentProps.value ?? null, isItemEqualToValue);
13185 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComboboxItemInner, {
13186 componentProps,
13187 forwardedRef,
13188 virtualized: true,
13189 indexFromFilter
13190 });
13191 }
13192 var ComboboxItem = /* @__PURE__ */ React81.memo(/* @__PURE__ */ React81.forwardRef(function ComboboxItem2(componentProps, forwardedRef) {
13193 const store = useComboboxRootContext();
13194 const virtualized = useStore(store, selectors2.virtualized);
13195 if (virtualized && componentProps.index == null) {
13196 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComboboxItemVirtualizedIndex, {
13197 componentProps,
13198 forwardedRef
13199 });
13200 }
13201 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComboboxItemInner, {
13202 componentProps,
13203 forwardedRef,
13204 virtualized,
13205 indexFromFilter: void 0
13206 });
13207 }));
13208 if (true) ComboboxItem.displayName = "ComboboxItem";
13209
13210 // node_modules/@base-ui/react/autocomplete/item/AutocompleteItem.mjs
13211 var AutocompleteItem = ComboboxItem;
13212
13213 // node_modules/@base-ui/react/combobox/row/ComboboxRow.mjs
13214 var React82 = __toESM(require_react(), 1);
13215 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
13216 var ComboboxRow = /* @__PURE__ */ React82.forwardRef(function ComboboxRow2(componentProps, forwardedRef) {
13217 const {
13218 render,
13219 className,
13220 style,
13221 ...elementProps
13222 } = componentProps;
13223 const element = useRenderElement("div", componentProps, {
13224 ref: forwardedRef,
13225 props: [{
13226 role: "row"
13227 }, elementProps]
13228 });
13229 return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComboboxRowContext.Provider, {
13230 value: true,
13231 children: element
13232 });
13233 });
13234 if (true) ComboboxRow.displayName = "ComboboxRow";
13235
13236 // node_modules/@base-ui/react/combobox/empty/ComboboxEmpty.mjs
13237 var React83 = __toESM(require_react(), 1);
13238 var ComboboxEmpty = /* @__PURE__ */ React83.forwardRef(function ComboboxEmpty2(componentProps, forwardedRef) {
13239 const {
13240 render,
13241 className,
13242 style,
13243 children: childrenProp,
13244 ...elementProps
13245 } = componentProps;
13246 const {
13247 filteredItems
13248 } = useComboboxDerivedItemsContext();
13249 const store = useComboboxRootContext();
13250 const emptyRef = useInitialLiveRegionTextMutation();
13251 const children = filteredItems.length === 0 ? childrenProp : null;
13252 return useRenderElement("div", componentProps, {
13253 ref: [forwardedRef, store.state.emptyRef, emptyRef],
13254 props: [{
13255 children,
13256 role: "status",
13257 "aria-live": "polite",
13258 "aria-atomic": true
13259 }, elementProps]
13260 });
13261 });
13262 if (true) ComboboxEmpty.displayName = "ComboboxEmpty";
13263
13264 // node_modules/@base-ui/react/utils/listbox-separator/ListboxSeparator.mjs
13265 var React84 = __toESM(require_react(), 1);
13266 var ListboxSeparator = /* @__PURE__ */ React84.forwardRef(function ListboxSeparator2(componentProps, forwardedRef) {
13267 const {
13268 className,
13269 render,
13270 orientation = "horizontal",
13271 style,
13272 ...elementProps
13273 } = componentProps;
13274 const state = {
13275 orientation
13276 };
13277 return useRenderElement("div", componentProps, {
13278 state,
13279 ref: forwardedRef,
13280 props: [{
13281 role: "presentation"
13282 }, elementProps]
13283 });
13284 });
13285 if (true) ListboxSeparator.displayName = "ListboxSeparator";
13286
13287 // node_modules/@base-ui/react/autocomplete/separator/AutocompleteSeparator.mjs
13288 var AutocompleteSeparator = ListboxSeparator;
13289
13290 // node_modules/@base-ui/react/combobox/root/utils/useFilteredItems.mjs
13291 function useFilteredItems() {
13292 const items = useComboboxDerivedItemsContext();
13293 return items.filteredItems;
13294 }
13295
13296 // node_modules/@base-ui/react/button/Button.mjs
13297 var React85 = __toESM(require_react(), 1);
13298 var Button = /* @__PURE__ */ React85.forwardRef(function Button2(componentProps, forwardedRef) {
13299 const {
13300 render,
13301 className,
13302 disabled: disabled2 = false,
13303 focusableWhenDisabled = false,
13304 nativeButton = true,
13305 style,
13306 ...elementProps
13307 } = componentProps;
13308 const {
13309 getButtonProps,
13310 buttonRef
13311 } = useButton({
13312 disabled: disabled2,
13313 focusableWhenDisabled,
13314 native: nativeButton
13315 });
13316 const state = {
13317 disabled: disabled2
13318 };
13319 return useRenderElement("button", componentProps, {
13320 state,
13321 ref: [forwardedRef, buttonRef],
13322 props: [elementProps, getButtonProps]
13323 });
13324 });
13325 if (true) Button.displayName = "Button";
13326
13327 // node_modules/@base-ui/react/field/item/FieldItemContext.mjs
13328 var React86 = __toESM(require_react(), 1);
13329 var FieldItemContext = /* @__PURE__ */ React86.createContext({
13330 disabled: false
13331 });
13332 if (true) FieldItemContext.displayName = "FieldItemContext";
13333 function useFieldItemContext() {
13334 const context = React86.useContext(FieldItemContext);
13335 return context;
13336 }
13337
13338 // node_modules/@base-ui/react/field/root/useFieldValidation.mjs
13339 var React87 = __toESM(require_react(), 1);
13340
13341 // node_modules/@base-ui/react/field/utils/getCombinedFieldValidityData.mjs
13342 function getCombinedFieldValidityData(validityData, invalid) {
13343 return {
13344 ...validityData,
13345 state: {
13346 ...validityData.state,
13347 valid: !invalid && validityData.state.valid
13348 }
13349 };
13350 }
13351
13352 // node_modules/@base-ui/react/field/root/useFieldValidation.mjs
13353 var validityKeys = Object.keys(DEFAULT_VALIDITY_STATE);
13354 function isEligibleInput(input, formElement) {
13355 if (input.matches(":disabled")) {
13356 return false;
13357 }
13358 if (!formElement || input.form === formElement) {
13359 return true;
13360 }
13361 return input.form === null && !input.hasAttribute("form");
13362 }
13363 function findRepresentativeInput(inputs, formElement) {
13364 let fallback = null;
13365 for (const input of inputs.keys()) {
13366 if (!isEligibleInput(input, formElement)) {
13367 continue;
13368 }
13369 if (!input.validity.valid) {
13370 return input;
13371 }
13372 fallback ??= input;
13373 }
13374 return fallback;
13375 }
13376 function clearCustomValidity(element, inputs) {
13377 for (const input of inputs.keys()) {
13378 input.setCustomValidity("");
13379 }
13380 element?.setCustomValidity("");
13381 }
13382 function useFieldValidation(params) {
13383 const {
13384 elementRef,
13385 formRef
13386 } = useFormContext();
13387 const {
13388 setValidityData,
13389 validate,
13390 validityData,
13391 validationDebounceTime,
13392 invalid,
13393 markedDirtyRef,
13394 state,
13395 shouldValidateOnChange,
13396 registeredFieldIdRef
13397 } = params;
13398 const {
13399 controlId,
13400 getDescriptionProps
13401 } = useLabelableContext();
13402 const timeout = useTimeout();
13403 const inputRef = React87.useRef(null);
13404 const registeredInputs = useRefWithInit(() => /* @__PURE__ */ new Map()).current;
13405 const validationCommitIdRef = React87.useRef(0);
13406 const registerInput = React87.useCallback((element, registration) => {
13407 registeredInputs.set(element, registration);
13408 return () => {
13409 registeredInputs.delete(element);
13410 };
13411 }, [registeredInputs]);
13412 const getInputControl = useStableCallback(() => {
13413 const element = findRepresentativeInput(registeredInputs, elementRef.current);
13414 return element && registeredInputs.get(element)?.controlRef.current || null;
13415 });
13416 const commit = useStableCallback(async (value, revalidate = false) => {
13417 validationCommitIdRef.current += 1;
13418 const validationCommitId = validationCommitIdRef.current;
13419 function updateRegisteredFieldValidity(nextValidityData2, externalInvalid = invalid) {
13420 const fieldId = registeredFieldIdRef.current ?? controlId;
13421 if (fieldId == null) {
13422 return;
13423 }
13424 const currentFieldData = formRef.current.fields.get(fieldId);
13425 if (!currentFieldData) {
13426 return;
13427 }
13428 const validityDataWithFormErrors = getCombinedFieldValidityData(nextValidityData2, externalInvalid);
13429 formRef.current.fields.set(fieldId, {
13430 ...currentFieldData,
13431 validityData: validityDataWithFormErrors
13432 });
13433 }
13434 function publishAllValid(input, externalInvalid) {
13435 const nextValidityData2 = {
13436 value,
13437 state: {
13438 ...DEFAULT_VALIDITY_STATE,
13439 valid: true
13440 },
13441 error: "",
13442 errors: [],
13443 initialValue: validityData.initialValue
13444 };
13445 clearCustomValidity(input, registeredInputs);
13446 updateRegisteredFieldValidity(nextValidityData2, externalInvalid);
13447 setValidityData(nextValidityData2);
13448 }
13449 const element = registeredInputs.size > 0 ? findRepresentativeInput(registeredInputs, elementRef.current) : inputRef.current;
13450 if (revalidate) {
13451 if (state.valid !== false || !element) {
13452 return;
13453 }
13454 const currentNativeValidity = element.validity;
13455 if (!currentNativeValidity.valueMissing) {
13456 publishAllValid(element, false);
13457 return;
13458 }
13459 for (const key of validityKeys) {
13460 if (key !== "valid" && key !== "valueMissing" && key !== "customError" && currentNativeValidity[key]) {
13461 return;
13462 }
13463 }
13464 }
13465 function getState(el) {
13466 const computedState = validityKeys.reduce((acc, key) => {
13467 acc[key] = el.validity[key];
13468 return acc;
13469 }, {});
13470 let hasOnlyValueMissingError = false;
13471 for (const key of validityKeys) {
13472 if (key === "valid") {
13473 continue;
13474 }
13475 if (key === "valueMissing" && computedState[key]) {
13476 hasOnlyValueMissingError = true;
13477 } else if (computedState[key]) {
13478 return computedState;
13479 }
13480 }
13481 if (hasOnlyValueMissingError && !markedDirtyRef.current) {
13482 computedState.valid = true;
13483 computedState.valueMissing = false;
13484 }
13485 return computedState;
13486 }
13487 timeout.clear();
13488 let result = null;
13489 let validationErrors = [];
13490 const nextState = element ? getState(element) : {
13491 ...DEFAULT_VALIDITY_STATE,
13492 valid: true
13493 };
13494 let defaultValidationMessage;
13495 const isValidatingOnChange = shouldValidateOnChange();
13496 if (element && element.validationMessage && !isValidatingOnChange) {
13497 defaultValidationMessage = element.validationMessage;
13498 validationErrors = [element.validationMessage];
13499 } else {
13500 const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field) => {
13501 if (field.name) {
13502 acc[field.name] = field.getValue();
13503 }
13504 return acc;
13505 }, {});
13506 const resultOrPromise = validate(value, formValues);
13507 if (typeof resultOrPromise === "object" && resultOrPromise !== null && "then" in resultOrPromise) {
13508 result = await resultOrPromise;
13509 if (validationCommitId !== validationCommitIdRef.current) {
13510 return;
13511 }
13512 } else {
13513 result = resultOrPromise;
13514 }
13515 if (result !== null) {
13516 nextState.valid = false;
13517 nextState.customError = true;
13518 if (Array.isArray(result)) {
13519 validationErrors = result;
13520 element?.setCustomValidity(result.join("\n"));
13521 } else if (result) {
13522 validationErrors = [result];
13523 element?.setCustomValidity(result);
13524 }
13525 } else if (isValidatingOnChange) {
13526 clearCustomValidity(element, registeredInputs);
13527 nextState.customError = false;
13528 if (element && element.validationMessage) {
13529 defaultValidationMessage = element.validationMessage;
13530 validationErrors = [element.validationMessage];
13531 } else if ((!element || element.validity.valid) && !nextState.valid) {
13532 nextState.valid = true;
13533 }
13534 }
13535 }
13536 const nextValidityData = {
13537 value,
13538 state: nextState,
13539 error: defaultValidationMessage ?? (Array.isArray(result) ? result[0] : result ?? ""),
13540 errors: validationErrors,
13541 initialValue: validityData.initialValue
13542 };
13543 updateRegisteredFieldValidity(nextValidityData);
13544 setValidityData(nextValidityData);
13545 });
13546 const change = useStableCallback((value) => {
13547 timeout.clear();
13548 const validateOnChange = shouldValidateOnChange();
13549 if (validateOnChange && value !== "" && validationDebounceTime) {
13550 validationCommitIdRef.current += 1;
13551 timeout.start(validationDebounceTime, () => {
13552 commit(value);
13553 });
13554 } else {
13555 commit(value, !validateOnChange);
13556 }
13557 });
13558 const getValidationProps = React87.useCallback((disabled2, externalProps = {}) => mergeProps(getDescriptionProps(externalProps), state.valid === false && !state.disabled && !disabled2 ? {
13559 "aria-invalid": true
13560 } : EMPTY_OBJECT), [getDescriptionProps, state.disabled, state.valid]);
13561 return React87.useMemo(() => ({
13562 getValidationProps,
13563 inputRef,
13564 registeredInputs,
13565 registerInput,
13566 getInputControl,
13567 commit,
13568 change
13569 }), [getValidationProps, registeredInputs, registerInput, getInputControl, commit, change]);
13570 }
13571
13572 // node_modules/@base-ui/react/utils/useRegisteredLabelId.mjs
13573 function useRegisteredLabelId(idProp, setLabelId) {
13574 const id = useBaseUiId(idProp);
13575 useIsoLayoutEffect(() => {
13576 setLabelId(id);
13577 return () => {
13578 setLabelId((currentId) => currentId === id ? void 0 : currentId);
13579 };
13580 }, [id, setLabelId]);
13581 return id;
13582 }
13583
13584 // node_modules/@base-ui/react/internals/labelable-provider/useLabel.mjs
13585 function useLabel(params = {}) {
13586 const {
13587 id: idProp,
13588 fallbackControlId,
13589 native = false,
13590 setLabelId: setLabelIdProp,
13591 focusControl: focusControlProp
13592 } = params;
13593 const {
13594 controlId: contextControlId,
13595 setLabelId: setContextLabelId
13596 } = useLabelableContext();
13597 const syncLabelId = useStableCallback((nextLabelId) => {
13598 setContextLabelId(nextLabelId);
13599 setLabelIdProp?.(nextLabelId);
13600 });
13601 const id = useRegisteredLabelId(idProp, syncLabelId);
13602 const resolvedControlId = contextControlId ?? fallbackControlId;
13603 function focusControl(event) {
13604 if (focusControlProp) {
13605 focusControlProp(event, resolvedControlId);
13606 return;
13607 }
13608 if (!resolvedControlId) {
13609 return;
13610 }
13611 const controlElement = ownerDocument(event.currentTarget).getElementById(resolvedControlId);
13612 if (isHTMLElement(controlElement)) {
13613 focusElementWithVisible(controlElement);
13614 }
13615 }
13616 function handleInteraction(event) {
13617 const target = getTarget(event.nativeEvent);
13618 if (target?.closest("button,input,select,textarea")) {
13619 return;
13620 }
13621 if (!event.defaultPrevented && event.detail > 1) {
13622 event.preventDefault();
13623 }
13624 if (native) {
13625 return;
13626 }
13627 focusControl(event);
13628 }
13629 return native ? {
13630 id,
13631 htmlFor: resolvedControlId ?? void 0,
13632 onMouseDown: handleInteraction
13633 } : {
13634 id,
13635 onClick: handleInteraction,
13636 onPointerDown(event) {
13637 event.preventDefault();
13638 }
13639 };
13640 }
13641 function focusElementWithVisible(element) {
13642 element.focus({
13643 // Available from Chrome 144+ (January 2026).
13644 // Safari and Firefox already support it.
13645 focusVisible: true
13646 });
13647 }
13648
13649 // node_modules/@base-ui/react/utils/usePopupViewport.mjs
13650 var React91 = __toESM(require_react(), 1);
13651 var ReactDOM7 = __toESM(require_react_dom(), 1);
13652
13653 // node_modules/@base-ui/utils/usePreviousValue.mjs
13654 var React88 = __toESM(require_react(), 1);
13655 function usePreviousValue(value) {
13656 const [state, setState] = React88.useState({
13657 current: value,
13658 previous: null
13659 });
13660 if (!Object.is(value, state.current)) {
13661 setState({
13662 current: value,
13663 previous: state.current
13664 });
13665 }
13666 return state.previous;
13667 }
13668
13669 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
13670 var React89 = __toESM(require_react(), 1);
13671
13672 // node_modules/@base-ui/react/utils/getCssDimensions.mjs
13673 function getCssDimensions2(element) {
13674 const css = getComputedStyle2(element);
13675 let width = parseFloat(css.width) || 0;
13676 let height = parseFloat(css.height) || 0;
13677 const hasOffset = isHTMLElement(element);
13678 const offsetWidth = hasOffset ? element.offsetWidth : width;
13679 const offsetHeight = hasOffset ? element.offsetHeight : height;
13680 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
13681 if (shouldFallback) {
13682 width = offsetWidth;
13683 height = offsetHeight;
13684 }
13685 return {
13686 width,
13687 height
13688 };
13689 }
13690
13691 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
13692 function usePopupAutoResize(parameters) {
13693 const {
13694 popupElement,
13695 positionerElement,
13696 content,
13697 mounted,
13698 onMeasureLayout: onMeasureLayoutParam,
13699 onMeasureLayoutComplete: onMeasureLayoutCompleteParam,
13700 side,
13701 direction
13702 } = parameters;
13703 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true);
13704 const animationFrame = useAnimationFrame();
13705 const committedDimensionsRef = React89.useRef(null);
13706 const isInitialRenderRef = React89.useRef(true);
13707 const restoreAnchoringStylesRef = React89.useRef(NOOP);
13708 const onMeasureLayout = useStableCallback(onMeasureLayoutParam);
13709 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam);
13710 const anchoringStyles = React89.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]);
13711 useIsoLayoutEffect(() => {
13712 if (!mounted) {
13713 restoreAnchoringStylesRef.current = NOOP;
13714 isInitialRenderRef.current = true;
13715 committedDimensionsRef.current = null;
13716 return void 0;
13717 }
13718 if (!popupElement || !positionerElement) {
13719 return void 0;
13720 }
13721 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles);
13722 setPopupCssSize(popupElement, "auto");
13723 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static");
13724 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none");
13725 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1");
13726 const restorePositionerAvailableSize = applyElementStyles(positionerElement, {
13727 "--available-width": "max-content",
13728 "--available-height": "max-content"
13729 });
13730 function restoreMeasurementOverrides() {
13731 restorePopupPosition();
13732 restorePopupTransform();
13733 restorePositionerAvailableSize();
13734 }
13735 function restoreMeasurementOverridesIncludingScale() {
13736 restoreMeasurementOverrides();
13737 restorePopupScale();
13738 }
13739 onMeasureLayout?.();
13740 if (isInitialRenderRef.current || committedDimensionsRef.current === null) {
13741 setPositionerCssSize(positionerElement, "max-content");
13742 const dimensions = getCssDimensions2(popupElement);
13743 committedDimensionsRef.current = dimensions;
13744 setPositionerCssSize(positionerElement, dimensions);
13745 restoreMeasurementOverridesIncludingScale();
13746 onMeasureLayoutComplete?.(null, dimensions);
13747 isInitialRenderRef.current = false;
13748 return () => {
13749 restoreAnchoringStylesRef.current();
13750 restoreAnchoringStylesRef.current = NOOP;
13751 };
13752 }
13753 setPositionerCssSize(positionerElement, "max-content");
13754 const previousDimensions = committedDimensionsRef.current;
13755 const newDimensions = getCssDimensions2(popupElement);
13756 committedDimensionsRef.current = newDimensions;
13757 setPopupCssSize(popupElement, previousDimensions);
13758 restoreMeasurementOverridesIncludingScale();
13759 onMeasureLayoutComplete?.(previousDimensions, newDimensions);
13760 setPositionerCssSize(positionerElement, newDimensions);
13761 const abortController = new AbortController();
13762 animationFrame.request(() => {
13763 setPopupCssSize(popupElement, newDimensions);
13764 runOnceAnimationsFinish(() => {
13765 popupElement.style.setProperty("--popup-width", "auto");
13766 popupElement.style.setProperty("--popup-height", "auto");
13767 }, abortController.signal);
13768 });
13769 return () => {
13770 abortController.abort();
13771 animationFrame.cancel();
13772 restoreAnchoringStylesRef.current();
13773 restoreAnchoringStylesRef.current = NOOP;
13774 };
13775 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]);
13776 }
13777 function getPopupAnchoringStyles(side, direction) {
13778 const isPhysicalTop = side === "top";
13779 const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start");
13780 if (!isPhysicalTop && !isPhysicalLeft) {
13781 return EMPTY_OBJECT;
13782 }
13783 return {
13784 position: "absolute",
13785 [isPhysicalTop ? "bottom" : "top"]: "0",
13786 [isPhysicalLeft ? "right" : "left"]: "0"
13787 };
13788 }
13789 function overrideElementStyle(element, property, value) {
13790 const originalValue = element.style.getPropertyValue(property);
13791 element.style.setProperty(property, value);
13792 return () => {
13793 element.style.setProperty(property, originalValue);
13794 };
13795 }
13796 function applyElementStyles(element, styles) {
13797 const restorers = [];
13798 for (const [key, value] of Object.entries(styles)) {
13799 restorers.push(overrideElementStyle(element, key, value));
13800 }
13801 return restorers.length ? () => {
13802 restorers.forEach((restore) => restore());
13803 } : NOOP;
13804 }
13805 function setPopupCssSize(popupElement, size4) {
13806 const width = size4 === "auto" ? "auto" : `${size4.width}px`;
13807 const height = size4 === "auto" ? "auto" : `${size4.height}px`;
13808 popupElement.style.setProperty("--popup-width", width);
13809 popupElement.style.setProperty("--popup-height", height);
13810 }
13811 function setPositionerCssSize(positionerElement, size4) {
13812 const width = size4 === "max-content" ? "max-content" : `${size4.width}px`;
13813 const height = size4 === "max-content" ? "max-content" : `${size4.height}px`;
13814 positionerElement.style.setProperty("--positioner-width", width);
13815 positionerElement.style.setProperty("--positioner-height", height);
13816 }
13817
13818 // node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs
13819 var React90 = __toESM(require_react(), 1);
13820 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
13821 var DirectionProvider = function DirectionProvider2(props) {
13822 const {
13823 direction = "ltr"
13824 } = props;
13825 const contextValue = React90.useMemo(() => ({
13826 direction
13827 }), [direction]);
13828 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DirectionContext.Provider, {
13829 value: contextValue,
13830 children: props.children
13831 });
13832 };
13833 if (true) DirectionProvider.displayName = "DirectionProvider";
13834
13835 // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs
13836 var adaptiveOrigin = {
13837 name: "adaptiveOrigin",
13838 async fn(state) {
13839 const {
13840 x: rawX,
13841 y: rawY,
13842 rects: {
13843 floating: floatRect
13844 },
13845 elements: {
13846 floating
13847 },
13848 platform: platform3,
13849 strategy,
13850 placement
13851 } = state;
13852 const win = getWindow(floating);
13853 const styles = win.getComputedStyle(floating);
13854 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== "";
13855 if (!hasTransition) {
13856 return {
13857 x: rawX,
13858 y: rawY,
13859 data: DEFAULT_SIDES
13860 };
13861 }
13862 const offsetParent = await platform3.getOffsetParent?.(floating);
13863 let offsetDimensions = {
13864 width: 0,
13865 height: 0
13866 };
13867 if (strategy === "fixed" && win?.visualViewport) {
13868 offsetDimensions = {
13869 width: win.visualViewport.width,
13870 height: win.visualViewport.height
13871 };
13872 } else if (offsetParent === win) {
13873 const doc = ownerDocument(floating);
13874 offsetDimensions = {
13875 width: doc.documentElement.clientWidth,
13876 height: doc.documentElement.clientHeight
13877 };
13878 } else if (await platform3.isElement?.(offsetParent)) {
13879 offsetDimensions = await platform3.getDimensions(offsetParent);
13880 }
13881 const currentSide = getSide(placement);
13882 let x = rawX;
13883 let y = rawY;
13884 if (currentSide === "left") {
13885 x = offsetDimensions.width - (rawX + floatRect.width);
13886 }
13887 if (currentSide === "top") {
13888 y = offsetDimensions.height - (rawY + floatRect.height);
13889 }
13890 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX;
13891 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY;
13892 return {
13893 x,
13894 y,
13895 data: {
13896 sideX,
13897 sideY
13898 }
13899 };
13900 }
13901 };
13902
13903 // node_modules/@base-ui/react/utils/usePopupViewport.mjs
13904 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
13905 var popupViewportStateMapping = {
13906 activationDirection: (value) => value ? {
13907 "data-activation-direction": value
13908 } : null
13909 };
13910 function usePopupViewport(parameters) {
13911 const {
13912 store,
13913 side,
13914 children
13915 } = parameters;
13916 const direction = useDirection();
13917 const activeTrigger = store.useState("activeTriggerElement");
13918 const activeTriggerId = store.useState("activeTriggerId");
13919 const open = store.useState("open");
13920 const payload = store.useState("payload");
13921 const mounted = store.useState("mounted");
13922 const popupElement = store.useState("popupElement");
13923 const positionerElement = store.useState("positionerElement");
13924 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null);
13925 const currentContentKey = usePopupContentKey(activeTriggerId, payload);
13926 const capturedNodeRef = React91.useRef(null);
13927 const [previousContentNode, setPreviousContentNode] = React91.useState(null);
13928 const [newTriggerOffset, setNewTriggerOffset] = React91.useState(null);
13929 const currentContainerRef = React91.useRef(null);
13930 const previousContainerRef = React91.useRef(null);
13931 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true);
13932 const cleanupFrame = useAnimationFrame();
13933 const cleanupControllerRef = React91.useRef(null);
13934 const [previousContentDimensions, setPreviousContentDimensions] = React91.useState(null);
13935 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React91.useState(false);
13936 useIsoLayoutEffect(() => {
13937 store.set("adaptiveOrigin", adaptiveOrigin);
13938 return () => {
13939 store.set("adaptiveOrigin", void 0);
13940 };
13941 }, [store]);
13942 const handleMeasureLayout = useStableCallback(() => {
13943 currentContainerRef.current?.style.setProperty("animation", "none");
13944 currentContainerRef.current?.style.setProperty("transition", "none");
13945 previousContainerRef.current?.style.setProperty("display", "none");
13946 });
13947 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => {
13948 currentContainerRef.current?.style.removeProperty("animation");
13949 currentContainerRef.current?.style.removeProperty("transition");
13950 previousContainerRef.current?.style.removeProperty("display");
13951 if (previousDimensions) {
13952 setPreviousContentDimensions(previousDimensions);
13953 }
13954 });
13955 const armViewportCleanup = useStableCallback(() => {
13956 cleanupControllerRef.current?.abort();
13957 const controller = new AbortController();
13958 cleanupControllerRef.current = controller;
13959 onAnimationsFinished(() => {
13960 setPreviousContentNode(null);
13961 setPreviousContentDimensions(null);
13962 capturedNodeRef.current = null;
13963 }, controller.signal);
13964 });
13965 const lastHandledTriggerRef = React91.useRef(null);
13966 useIsoLayoutEffect(() => {
13967 if (!open || !mounted) {
13968 lastHandledTriggerRef.current = null;
13969 }
13970 }, [open, mounted]);
13971 useIsoLayoutEffect(() => {
13972 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
13973 setPreviousContentNode(capturedNodeRef.current);
13974 setShowStartingStyleAttribute(true);
13975 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
13976 setNewTriggerOffset(offset4);
13977 lastHandledTriggerRef.current = activeTrigger;
13978 }
13979 }, [activeTrigger, previousActiveTrigger]);
13980 useIsoLayoutEffect(() => {
13981 if (previousContentNode == null) {
13982 return;
13983 }
13984 cleanupControllerRef.current?.abort();
13985 setShowStartingStyleAttribute(true);
13986 cleanupFrame.request(() => {
13987 ReactDOM7.flushSync(() => {
13988 setShowStartingStyleAttribute(false);
13989 });
13990 armViewportCleanup();
13991 });
13992 }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]);
13993 useIsoLayoutEffect(() => {
13994 const source = currentContainerRef.current;
13995 if (!source) {
13996 return;
13997 }
13998 const wrapper = ownerDocument(source).createElement("div");
13999 for (const child of Array.from(source.childNodes)) {
14000 wrapper.appendChild(child.cloneNode(true));
14001 }
14002 capturedNodeRef.current = wrapper;
14003 });
14004 const isTransitioning = previousContentNode != null;
14005 let childrenToRender;
14006 if (!isTransitioning) {
14007 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", {
14008 "data-current": true,
14009 ref: currentContainerRef,
14010 children
14011 }, currentContentKey);
14012 } else {
14013 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(React91.Fragment, {
14014 children: [/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", {
14015 "data-previous": true,
14016 inert: inertValue(true),
14017 ref: previousContainerRef,
14018 style: {
14019 ...previousContentDimensions ? {
14020 "--popup-width": `${previousContentDimensions.width}px`,
14021 "--popup-height": `${previousContentDimensions.height}px`
14022 } : null,
14023 position: "absolute"
14024 },
14025 "data-ending-style": showStartingStyleAttribute ? void 0 : ""
14026 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", {
14027 "data-current": true,
14028 ref: currentContainerRef,
14029 "data-starting-style": showStartingStyleAttribute ? "" : void 0,
14030 children
14031 }, currentContentKey)]
14032 });
14033 }
14034 useIsoLayoutEffect(() => {
14035 const container = previousContainerRef.current;
14036 if (!container || !previousContentNode) {
14037 return;
14038 }
14039 container.replaceChildren(...Array.from(previousContentNode.childNodes));
14040 }, [previousContentNode]);
14041 usePopupAutoResize({
14042 popupElement,
14043 positionerElement,
14044 mounted,
14045 content: payload,
14046 onMeasureLayout: handleMeasureLayout,
14047 onMeasureLayoutComplete: handleMeasureLayoutComplete,
14048 side,
14049 direction
14050 });
14051 const state = {
14052 activationDirection: getActivationDirection(newTriggerOffset),
14053 transitioning: isTransitioning
14054 };
14055 return {
14056 children: childrenToRender,
14057 state
14058 };
14059 }
14060 function getActivationDirection(offset4) {
14061 if (!offset4) {
14062 return void 0;
14063 }
14064 return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`;
14065 }
14066 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
14067 if (value > tolerance) {
14068 return positiveLabel;
14069 }
14070 if (value < -tolerance) {
14071 return negativeLabel;
14072 }
14073 return "";
14074 }
14075 function calculateRelativePosition(from, to) {
14076 const fromRect = from.getBoundingClientRect();
14077 const toRect = to.getBoundingClientRect();
14078 const fromCenter = {
14079 x: fromRect.left + fromRect.width / 2,
14080 y: fromRect.top + fromRect.height / 2
14081 };
14082 const toCenter = {
14083 x: toRect.left + toRect.width / 2,
14084 y: toRect.top + toRect.height / 2
14085 };
14086 return {
14087 horizontal: toCenter.x - fromCenter.x,
14088 vertical: toCenter.y - fromCenter.y
14089 };
14090 }
14091 function usePopupContentKey(activeTriggerId, payload) {
14092 const [contentKey, setContentKey] = React91.useState(0);
14093 const previousActiveTriggerIdRef = React91.useRef(activeTriggerId);
14094 const previousPayloadRef = React91.useRef(payload);
14095 const pendingPayloadUpdateRef = React91.useRef(false);
14096 useIsoLayoutEffect(() => {
14097 const previousActiveTriggerId = previousActiveTriggerIdRef.current;
14098 const previousPayload = previousPayloadRef.current;
14099 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId;
14100 const payloadChanged = payload !== previousPayload;
14101 if (triggerIdChanged) {
14102 setContentKey((value) => value + 1);
14103 pendingPayloadUpdateRef.current = !payloadChanged;
14104 } else if (pendingPayloadUpdateRef.current && payloadChanged) {
14105 setContentKey((value) => value + 1);
14106 pendingPayloadUpdateRef.current = false;
14107 }
14108 previousActiveTriggerIdRef.current = activeTriggerId;
14109 previousPayloadRef.current = payload;
14110 }, [activeTriggerId, payload]);
14111 return `${activeTriggerId ?? "current"}-${contentKey}`;
14112 }
14113
14114 // node_modules/@base-ui/react/field/index.parts.mjs
14115 var index_parts_exports2 = {};
14116 __export(index_parts_exports2, {
14117 Control: () => FieldControl,
14118 Description: () => FieldDescription,
14119 Error: () => FieldError,
14120 Item: () => FieldItem,
14121 Label: () => FieldLabel,
14122 Root: () => FieldRoot,
14123 Validity: () => FieldValidity
14124 });
14125
14126 // node_modules/@base-ui/react/field/root/FieldRoot.mjs
14127 var React95 = __toESM(require_react(), 1);
14128
14129 // node_modules/@base-ui/react/fieldset/root/FieldsetRootContext.mjs
14130 var React92 = __toESM(require_react(), 1);
14131 var FieldsetRootContext = /* @__PURE__ */ React92.createContext(void 0);
14132 if (true) FieldsetRootContext.displayName = "FieldsetRootContext";
14133 function useFieldsetRootContext(optional = false) {
14134 const context = React92.useContext(FieldsetRootContext);
14135 if (!context && !optional) {
14136 throw new Error(true ? "Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>." : formatErrorMessage_default(86));
14137 }
14138 return context;
14139 }
14140
14141 // node_modules/@base-ui/react/internals/labelable-provider/LabelableProvider.mjs
14142 var React93 = __toESM(require_react(), 1);
14143 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
14144 var LabelableProvider = function LabelableProvider2(props) {
14145 const defaultId = useBaseUiId();
14146 const initialControlId = props.controlId === void 0 ? defaultId : props.controlId;
14147 const [controlId, setControlIdState] = React93.useState(initialControlId);
14148 const [labelId, setLabelId] = React93.useState(props.labelId);
14149 const [messageIds, setMessageIds] = React93.useState([]);
14150 const registrationsRef = useRefWithInit(() => /* @__PURE__ */ new Map());
14151 const {
14152 messageIds: parentMessageIds
14153 } = useLabelableContext();
14154 const registerControlId = useStableCallback((source, nextId) => {
14155 const registrations = registrationsRef.current;
14156 if (nextId === void 0) {
14157 registrations.delete(source);
14158 return;
14159 }
14160 registrations.set(source, nextId);
14161 setControlIdState((prev) => {
14162 if (registrations.size === 0) {
14163 return void 0;
14164 }
14165 let nextControlId;
14166 for (const id of registrations.values()) {
14167 if (prev !== void 0 && id === prev) {
14168 return prev;
14169 }
14170 if (nextControlId === void 0) {
14171 nextControlId = id;
14172 }
14173 }
14174 return nextControlId;
14175 });
14176 });
14177 const getDescriptionProps = React93.useCallback((externalProps) => {
14178 const ids = externalProps["aria-describedby"] ? externalProps["aria-describedby"].split(" ") : [];
14179 ids.push(...parentMessageIds, ...messageIds);
14180 return {
14181 ...externalProps,
14182 "aria-describedby": Array.from(new Set(ids)).join(" ") || void 0
14183 };
14184 }, [parentMessageIds, messageIds]);
14185 const contextValue = React93.useMemo(() => ({
14186 controlId,
14187 registerControlId,
14188 labelId,
14189 setLabelId,
14190 messageIds,
14191 setMessageIds,
14192 getDescriptionProps
14193 }), [controlId, registerControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]);
14194 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LabelableContext.Provider, {
14195 value: contextValue,
14196 children: props.children
14197 });
14198 };
14199 if (true) LabelableProvider.displayName = "LabelableProvider";
14200
14201 // node_modules/@base-ui/react/internals/field-register-control/useFieldControlRegistration.mjs
14202 var React94 = __toESM(require_react(), 1);
14203 function useFieldControlRegistration(params) {
14204 const {
14205 commit,
14206 invalid,
14207 markedDirtyRef,
14208 name,
14209 setRegisteredFieldName,
14210 registeredFieldIdRef,
14211 setValidityData,
14212 validityData
14213 } = params;
14214 const {
14215 formRef
14216 } = useFormContext();
14217 const activeFieldControlSourceRef = React94.useRef(null);
14218 const registrationRef = React94.useRef(null);
14219 const initialValueCapturedRef = React94.useRef(false);
14220 const getValueForForm = useStableCallback(() => {
14221 const registration = registrationRef.current;
14222 if (!registration) {
14223 return void 0;
14224 }
14225 if (registration.getValue) {
14226 return registration.getValue();
14227 }
14228 return registration.value;
14229 });
14230 function getRegistrationValue(registration) {
14231 return registration.value === void 0 ? getValueForForm() : registration.value;
14232 }
14233 const validate = useStableCallback(() => {
14234 const registration = registrationRef.current;
14235 markedDirtyRef.current = true;
14236 if (!registration) {
14237 commit(validityData.value);
14238 return;
14239 }
14240 commit(getRegistrationValue(registration));
14241 });
14242 function refreshRegistration() {
14243 const registration = registrationRef.current;
14244 if (!registration || !registration.id) {
14245 return;
14246 }
14247 formRef.current.fields.set(registration.id, {
14248 getValue: getValueForForm,
14249 name: name ?? registration.name,
14250 controlRef: registration.controlRef,
14251 validityData: getCombinedFieldValidityData(validityData, invalid),
14252 validate
14253 });
14254 }
14255 function deleteRegistration(id = registrationRef.current?.id) {
14256 if (id) {
14257 formRef.current.fields.delete(id);
14258 }
14259 }
14260 function captureInitialValue(registration) {
14261 if (initialValueCapturedRef.current) {
14262 return;
14263 }
14264 initialValueCapturedRef.current = true;
14265 const initialValue = getRegistrationValue(registration);
14266 setValidityData((prev) => prev.initialValue === initialValue ? prev : {
14267 ...prev,
14268 initialValue
14269 });
14270 }
14271 useIsoLayoutEffect(() => {
14272 const registration = registrationRef.current;
14273 if (!registration || !registration.id) {
14274 return;
14275 }
14276 setRegisteredFieldName(name ? void 0 : registration.name);
14277 formRef.current.fields.set(registration.id, {
14278 getValue: getValueForForm,
14279 name: name ?? registration.name,
14280 controlRef: registration.controlRef,
14281 validityData: getCombinedFieldValidityData(validityData, invalid),
14282 validate
14283 });
14284 }, [formRef, getValueForForm, invalid, name, setRegisteredFieldName, validate, validityData]);
14285 useIsoLayoutEffect(() => {
14286 const fields = formRef.current.fields;
14287 return () => {
14288 const id = registrationRef.current?.id;
14289 if (id) {
14290 fields.delete(id);
14291 }
14292 };
14293 }, [formRef]);
14294 const register2 = useStableCallback((source, registration) => {
14295 if (!registration) {
14296 if (activeFieldControlSourceRef.current === source) {
14297 activeFieldControlSourceRef.current = null;
14298 deleteRegistration();
14299 registrationRef.current = null;
14300 setRegisteredFieldName(void 0);
14301 registeredFieldIdRef.current = void 0;
14302 }
14303 return;
14304 }
14305 const previousId = registrationRef.current?.id;
14306 activeFieldControlSourceRef.current = source;
14307 registrationRef.current = registration;
14308 if (!name) {
14309 setRegisteredFieldName(registration.name);
14310 }
14311 registeredFieldIdRef.current = registration.id;
14312 if (previousId && previousId !== registration.id) {
14313 deleteRegistration(previousId);
14314 }
14315 captureInitialValue(registration);
14316 refreshRegistration();
14317 });
14318 return [validate, register2];
14319 }
14320
14321 // node_modules/@base-ui/react/field/root/FieldRoot.mjs
14322 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
14323 var FieldRootInner = /* @__PURE__ */ React95.forwardRef(function FieldRootInner2(componentProps, forwardedRef) {
14324 const {
14325 errors,
14326 validationMode: formValidationMode,
14327 submitAttemptedRef
14328 } = useFormContext();
14329 const {
14330 render,
14331 className,
14332 validate: validateProp,
14333 validationDebounceTime = 0,
14334 validationMode = formValidationMode,
14335 name,
14336 disabled: disabledProp = false,
14337 invalid: invalidProp,
14338 dirty: dirtyProp,
14339 touched: touchedProp,
14340 actionsRef,
14341 style,
14342 ...elementProps
14343 } = componentProps;
14344 const disabledFieldset = useFieldsetRootContext(true)?.disabled;
14345 const validate = useStableCallback(validateProp || (() => null));
14346 const disabled2 = disabledFieldset || disabledProp;
14347 const [touchedState, setTouchedUnwrapped] = React95.useState(false);
14348 const [dirtyState, setDirtyUnwrapped] = React95.useState(false);
14349 const [filled, setFilled] = React95.useState(false);
14350 const [focused, setFocused] = React95.useState(false);
14351 const dirty = dirtyProp ?? dirtyState;
14352 const touched = touchedProp ?? touchedState;
14353 const markedDirtyRef = React95.useRef(dirty);
14354 const registeredFieldIdRef = React95.useRef(void 0);
14355 const [registeredFieldName, setRegisteredFieldName] = React95.useState();
14356 const effectiveName = name ?? registeredFieldName;
14357 useIsoLayoutEffect(() => {
14358 if (dirtyProp !== void 0) {
14359 markedDirtyRef.current = dirtyProp;
14360 }
14361 }, [dirtyProp]);
14362 const setDirty = useStableCallback((value) => {
14363 if (dirtyProp !== void 0) {
14364 return;
14365 }
14366 if (value) {
14367 markedDirtyRef.current = true;
14368 }
14369 setDirtyUnwrapped(value);
14370 });
14371 const setTouched = useStableCallback((value) => {
14372 if (touchedProp !== void 0) {
14373 return;
14374 }
14375 setTouchedUnwrapped(value);
14376 });
14377 const shouldValidateOnChange = useStableCallback(() => validationMode === "onChange" || validationMode === "onSubmit" && submitAttemptedRef.current);
14378 const formError = effectiveName && Object.hasOwn(errors, effectiveName) ? errors[effectiveName] : null;
14379 const hasFormError = !!(Array.isArray(formError) ? formError.length : formError);
14380 const invalid = invalidProp === true || hasFormError;
14381 const [validityData, setValidityData] = React95.useState({
14382 state: DEFAULT_VALIDITY_STATE,
14383 error: "",
14384 errors: [],
14385 value: null,
14386 initialValue: null
14387 });
14388 const valid = !invalid && (disabled2 ? null : validityData.state.valid);
14389 const state = React95.useMemo(() => ({
14390 disabled: disabled2,
14391 touched,
14392 dirty,
14393 valid,
14394 filled,
14395 focused
14396 }), [disabled2, touched, dirty, valid, filled, focused]);
14397 const validation = useFieldValidation({
14398 setValidityData,
14399 validate,
14400 validityData,
14401 validationDebounceTime,
14402 invalid,
14403 markedDirtyRef,
14404 state,
14405 shouldValidateOnChange,
14406 registeredFieldIdRef
14407 });
14408 const [validateFieldControl, registerFieldControl] = useFieldControlRegistration({
14409 commit: validation.commit,
14410 invalid,
14411 markedDirtyRef,
14412 name,
14413 setRegisteredFieldName,
14414 registeredFieldIdRef,
14415 setValidityData,
14416 validityData
14417 });
14418 React95.useImperativeHandle(actionsRef, () => ({
14419 validate: validateFieldControl
14420 }), [validateFieldControl]);
14421 const contextValue = React95.useMemo(() => ({
14422 invalid,
14423 name: effectiveName,
14424 validityData,
14425 setValidityData,
14426 disabled: disabled2,
14427 setTouched,
14428 setDirty,
14429 setFilled,
14430 setFocused,
14431 validationMode,
14432 shouldValidateOnChange,
14433 state,
14434 registerFieldControl,
14435 validation
14436 }), [invalid, effectiveName, validityData, disabled2, setTouched, setDirty, setFilled, setFocused, validationMode, shouldValidateOnChange, state, registerFieldControl, validation]);
14437 const element = useRenderElement("div", componentProps, {
14438 ref: forwardedRef,
14439 state,
14440 props: elementProps,
14441 stateAttributesMapping: fieldValidityMapping
14442 });
14443 return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FieldRootContext.Provider, {
14444 value: contextValue,
14445 children: element
14446 });
14447 });
14448 if (true) FieldRootInner.displayName = "FieldRootInner";
14449 var FieldRoot = /* @__PURE__ */ React95.forwardRef(function FieldRoot2(componentProps, forwardedRef) {
14450 return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LabelableProvider, {
14451 children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FieldRootInner, {
14452 ...componentProps,
14453 ref: forwardedRef
14454 })
14455 });
14456 });
14457 if (true) FieldRoot.displayName = "FieldRoot";
14458
14459 // node_modules/@base-ui/react/field/label/FieldLabel.mjs
14460 var React96 = __toESM(require_react(), 1);
14461 var FieldLabel = /* @__PURE__ */ React96.forwardRef(function FieldLabel2(componentProps, forwardedRef) {
14462 const {
14463 render,
14464 className,
14465 style,
14466 id: idProp,
14467 nativeLabel = true,
14468 ...elementProps
14469 } = componentProps;
14470 const fieldRootContext = useFieldRootContext(false);
14471 const fieldItemContext = useFieldItemContext();
14472 const {
14473 labelId
14474 } = useLabelableContext();
14475 const state = {
14476 ...fieldRootContext.state,
14477 disabled: fieldRootContext.disabled || fieldItemContext.disabled
14478 };
14479 const labelRef = React96.useRef(null);
14480 const labelProps = useLabel({
14481 id: labelId ?? idProp,
14482 native: nativeLabel
14483 });
14484 if (true) {
14485 React96.useEffect(() => {
14486 if (!labelRef.current) {
14487 return;
14488 }
14489 const isLabelTag = labelRef.current.tagName === "LABEL";
14490 if (nativeLabel) {
14491 if (!isLabelTag) {
14492 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
14493 const message = "<Field.Label> expected a <label> element because the `nativeLabel` prop is true. Rendering a non-<label> disables native label association, so `htmlFor` will not work. Use a real <label> in the `render` prop, or set `nativeLabel` to `false`.";
14494 error(`${message}${ownerStackMessage}`);
14495 }
14496 } else if (isLabelTag) {
14497 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
14498 const message = "<Field.Label> expected a non-<label> element because the `nativeLabel` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the `render` prop, or set `nativeLabel` to `true`.";
14499 error(`${message}${ownerStackMessage}`);
14500 }
14501 }, [nativeLabel]);
14502 }
14503 const element = useRenderElement("label", componentProps, {
14504 ref: [forwardedRef, labelRef],
14505 state,
14506 props: [labelProps, elementProps],
14507 stateAttributesMapping: fieldValidityMapping
14508 });
14509 return element;
14510 });
14511 if (true) FieldLabel.displayName = "FieldLabel";
14512
14513 // node_modules/@base-ui/react/field/error/FieldError.mjs
14514 var React97 = __toESM(require_react(), 1);
14515 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
14516 var stateAttributesMapping4 = {
14517 ...fieldValidityMapping,
14518 ...transitionStatusMapping
14519 };
14520 var FieldError = /* @__PURE__ */ React97.forwardRef(function FieldError2(componentProps, forwardedRef) {
14521 const {
14522 render,
14523 id: idProp,
14524 className,
14525 match,
14526 style,
14527 ...elementProps
14528 } = componentProps;
14529 const id = useBaseUiId(idProp);
14530 const {
14531 validityData,
14532 state: fieldState,
14533 name
14534 } = useFieldRootContext(false);
14535 const {
14536 setMessageIds
14537 } = useLabelableContext();
14538 const {
14539 errors
14540 } = useFormContext();
14541 const formError = name && Object.hasOwn(errors, name) ? errors[name] : null;
14542 const hasFormError = !!(Array.isArray(formError) ? formError.length : formError);
14543 const hasSpecificMatch = typeof match === "string";
14544 let rendered = false;
14545 if (match === true) {
14546 rendered = true;
14547 } else if (fieldState.disabled) {
14548 rendered = false;
14549 } else if (hasSpecificMatch) {
14550 rendered = Boolean(validityData.state[match]);
14551 } else {
14552 rendered = hasFormError || validityData.state.valid === false;
14553 }
14554 const {
14555 mounted,
14556 transitionStatus,
14557 setMounted
14558 } = useTransitionStatus(rendered);
14559 useIsoLayoutEffect(() => {
14560 if (!rendered || !id) {
14561 return void 0;
14562 }
14563 setMessageIds((v) => v.concat(id));
14564 return () => {
14565 setMessageIds((v) => v.filter((item) => item !== id));
14566 };
14567 }, [rendered, id, setMessageIds]);
14568 const errorRef = React97.useRef(null);
14569 const [lastRenderedMessage, setLastRenderedMessage] = React97.useState(null);
14570 const [lastRenderedMessageKey, setLastRenderedMessageKey] = React97.useState(null);
14571 let error2 = validityData.error;
14572 if (!hasSpecificMatch && hasFormError) {
14573 error2 = formError;
14574 } else if (validityData.errors.length > 1) {
14575 error2 = validityData.errors;
14576 }
14577 let errorMessage = error2;
14578 if (Array.isArray(error2)) {
14579 errorMessage = error2.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ul", {
14580 children: error2.map((message) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", {
14581 children: message
14582 }, message))
14583 }) : error2[0];
14584 }
14585 const errorKey = Array.isArray(error2) ? JSON.stringify(error2) : error2;
14586 if (rendered && errorKey !== lastRenderedMessageKey) {
14587 setLastRenderedMessageKey(errorKey);
14588 setLastRenderedMessage(errorMessage);
14589 }
14590 useOpenChangeComplete({
14591 open: rendered,
14592 ref: errorRef,
14593 onComplete() {
14594 if (!rendered) {
14595 setMounted(false);
14596 }
14597 }
14598 });
14599 const state = {
14600 ...fieldState,
14601 transitionStatus
14602 };
14603 const element = useRenderElement("div", componentProps, {
14604 ref: [forwardedRef, errorRef],
14605 state,
14606 props: [{
14607 id,
14608 children: rendered ? errorMessage : lastRenderedMessage
14609 }, elementProps],
14610 stateAttributesMapping: stateAttributesMapping4,
14611 enabled: mounted
14612 });
14613 if (!mounted) {
14614 return null;
14615 }
14616 return element;
14617 });
14618 if (true) FieldError.displayName = "FieldError";
14619
14620 // node_modules/@base-ui/react/field/description/FieldDescription.mjs
14621 var React98 = __toESM(require_react(), 1);
14622 var FieldDescription = /* @__PURE__ */ React98.forwardRef(function FieldDescription2(componentProps, forwardedRef) {
14623 const {
14624 render,
14625 id: idProp,
14626 className,
14627 style,
14628 ...elementProps
14629 } = componentProps;
14630 const id = useBaseUiId(idProp);
14631 const fieldRootContext = useFieldRootContext(false);
14632 const fieldItemContext = useFieldItemContext();
14633 const {
14634 setMessageIds
14635 } = useLabelableContext();
14636 const state = {
14637 ...fieldRootContext.state,
14638 disabled: fieldRootContext.disabled || fieldItemContext.disabled
14639 };
14640 useIsoLayoutEffect(() => {
14641 if (!id) {
14642 return void 0;
14643 }
14644 setMessageIds((v) => v.concat(id));
14645 return () => {
14646 setMessageIds((v) => v.filter((item) => item !== id));
14647 };
14648 }, [id, setMessageIds]);
14649 const element = useRenderElement("p", componentProps, {
14650 ref: forwardedRef,
14651 state,
14652 props: [{
14653 id
14654 }, elementProps],
14655 stateAttributesMapping: fieldValidityMapping
14656 });
14657 return element;
14658 });
14659 if (true) FieldDescription.displayName = "FieldDescription";
14660
14661 // node_modules/@base-ui/react/field/control/FieldControl.mjs
14662 var React99 = __toESM(require_react(), 1);
14663 var FieldControl = /* @__PURE__ */ React99.forwardRef(function FieldControl2(componentProps, forwardedRef) {
14664 const {
14665 render,
14666 className,
14667 id: idProp,
14668 name: nameProp,
14669 value: valueProp,
14670 disabled: disabledProp = false,
14671 onValueChange,
14672 defaultValue,
14673 autoFocus = false,
14674 style,
14675 ...elementProps
14676 } = componentProps;
14677 const {
14678 state: fieldState,
14679 name: fieldName,
14680 disabled: fieldDisabled,
14681 setTouched,
14682 setDirty,
14683 validityData,
14684 setFocused,
14685 setFilled,
14686 validationMode,
14687 validation
14688 } = useFieldRootContext();
14689 const {
14690 clearErrors
14691 } = useFormContext();
14692 const disabled2 = fieldDisabled || disabledProp;
14693 const name = fieldName ?? nameProp;
14694 const state = {
14695 ...fieldState,
14696 disabled: disabled2
14697 };
14698 const {
14699 labelId
14700 } = useLabelableContext();
14701 const id = useLabelableId({
14702 id: idProp
14703 });
14704 useIsoLayoutEffect(() => {
14705 const hasExternalValue = valueProp != null;
14706 if (validation.inputRef.current?.value || hasExternalValue && valueProp !== "") {
14707 setFilled(true);
14708 } else if (hasExternalValue && valueProp === "") {
14709 setFilled(false);
14710 }
14711 }, [validation.inputRef, setFilled, valueProp]);
14712 const inputRef = React99.useRef(null);
14713 useIsoLayoutEffect(() => {
14714 if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) {
14715 setFocused(true);
14716 }
14717 }, [autoFocus, setFocused]);
14718 const [valueUnwrapped] = useControlled({
14719 controlled: valueProp,
14720 default: defaultValue,
14721 name: "FieldControl",
14722 state: "value"
14723 });
14724 const isControlled = valueProp !== void 0;
14725 const value = isControlled ? valueUnwrapped : void 0;
14726 const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value);
14727 useRegisterFieldControl(validation.inputRef, id, value, getValueFromInput, !disabled2, nameProp);
14728 const element = useRenderElement("input", componentProps, {
14729 ref: [forwardedRef, inputRef],
14730 state,
14731 props: [{
14732 id,
14733 disabled: disabled2,
14734 name,
14735 ref: validation.inputRef,
14736 "aria-labelledby": labelId,
14737 autoFocus,
14738 ...isControlled ? {
14739 value
14740 } : {
14741 defaultValue
14742 },
14743 onChange(event) {
14744 const inputValue = event.currentTarget.value;
14745 onValueChange?.(inputValue, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent));
14746 setDirty(inputValue !== (validityData.initialValue ?? ""));
14747 setFilled(inputValue !== "");
14748 if (!event.nativeEvent.defaultPrevented) {
14749 clearErrors(name);
14750 validation.change(inputValue);
14751 }
14752 },
14753 onFocus() {
14754 setFocused(true);
14755 },
14756 onBlur(event) {
14757 setTouched(true);
14758 setFocused(false);
14759 if (validationMode === "onBlur") {
14760 validation.commit(event.currentTarget.value);
14761 }
14762 },
14763 onKeyDown(event) {
14764 if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") {
14765 setTouched(true);
14766 validation.commit(event.currentTarget.value);
14767 }
14768 }
14769 }, elementProps, (props) => validation.getValidationProps(disabled2, props)],
14770 stateAttributesMapping: fieldValidityMapping
14771 });
14772 return element;
14773 });
14774 if (true) FieldControl.displayName = "FieldControl";
14775
14776 // node_modules/@base-ui/react/field/validity/FieldValidity.mjs
14777 var React100 = __toESM(require_react(), 1);
14778 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
14779 var FieldValidity = function FieldValidity2(props) {
14780 const {
14781 children
14782 } = props;
14783 const {
14784 validityData,
14785 invalid
14786 } = useFieldRootContext(false);
14787 const combinedFieldValidityData = React100.useMemo(() => getCombinedFieldValidityData(validityData, invalid), [validityData, invalid]);
14788 const isInvalid = combinedFieldValidityData.state.valid === false;
14789 const {
14790 transitionStatus
14791 } = useTransitionStatus(isInvalid);
14792 const fieldValidityState = React100.useMemo(() => {
14793 return {
14794 ...combinedFieldValidityData,
14795 validity: combinedFieldValidityData.state,
14796 transitionStatus
14797 };
14798 }, [combinedFieldValidityData, transitionStatus]);
14799 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(React100.Fragment, {
14800 children: children(fieldValidityState)
14801 });
14802 };
14803 if (true) FieldValidity.displayName = "FieldValidity";
14804
14805 // node_modules/@base-ui/react/field/item/FieldItem.mjs
14806 var React101 = __toESM(require_react(), 1);
14807 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
14808 var FieldItem = /* @__PURE__ */ React101.forwardRef(function FieldItem2(componentProps, forwardedRef) {
14809 const {
14810 render,
14811 className,
14812 style,
14813 disabled: disabledProp = false,
14814 ...elementProps
14815 } = componentProps;
14816 const {
14817 state: fieldState,
14818 disabled: rootDisabled
14819 } = useFieldRootContext(false);
14820 const disabled2 = rootDisabled || disabledProp;
14821 const state = {
14822 ...fieldState,
14823 disabled: disabled2
14824 };
14825 const fieldItemContext = React101.useMemo(() => ({
14826 disabled: disabled2
14827 }), [disabled2]);
14828 const element = useRenderElement("div", componentProps, {
14829 ref: forwardedRef,
14830 state,
14831 props: elementProps,
14832 stateAttributesMapping: fieldValidityMapping
14833 });
14834 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LabelableProvider, {
14835 children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FieldItemContext.Provider, {
14836 value: fieldItemContext,
14837 children: element
14838 })
14839 });
14840 });
14841 if (true) FieldItem.displayName = "FieldItem";
14842
14843 // node_modules/@base-ui/react/input/Input.mjs
14844 var React102 = __toESM(require_react(), 1);
14845 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
14846 var Input = /* @__PURE__ */ React102.forwardRef(function Input2(props, forwardedRef) {
14847 return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(index_parts_exports2.Control, {
14848 ref: forwardedRef,
14849 ...props
14850 });
14851 });
14852 if (true) Input.displayName = "Input";
14853
14854 // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs
14855 var React103 = __toESM(require_react(), 1);
14856 var ReactDOM8 = __toESM(require_react_dom(), 1);
14857 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
14858 var FloatingPortalLite = /* @__PURE__ */ React103.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) {
14859 const {
14860 children,
14861 container,
14862 className,
14863 render,
14864 style,
14865 ...elementProps
14866 } = componentProps;
14867 const {
14868 node: portalNode,
14869 subtree: portalSubtree
14870 } = useFloatingPortalNode({
14871 container,
14872 ref: forwardedRef,
14873 componentProps,
14874 elementProps
14875 });
14876 if (!portalSubtree && !portalNode) {
14877 return null;
14878 }
14879 return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(React103.Fragment, {
14880 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM8.createPortal(children, portalNode)]
14881 });
14882 });
14883 if (true) FloatingPortalLite.displayName = "FloatingPortalLite";
14884
14885 // node_modules/@base-ui/react/tooltip/index.parts.mjs
14886 var index_parts_exports3 = {};
14887 __export(index_parts_exports3, {
14888 Arrow: () => TooltipArrow,
14889 Handle: () => TooltipHandle,
14890 Popup: () => TooltipPopup,
14891 Portal: () => TooltipPortal,
14892 Positioner: () => TooltipPositioner,
14893 Provider: () => TooltipProvider,
14894 Root: () => TooltipRoot,
14895 Trigger: () => TooltipTrigger,
14896 Viewport: () => TooltipViewport,
14897 createHandle: () => createTooltipHandle
14898 });
14899
14900 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
14901 var React106 = __toESM(require_react(), 1);
14902
14903 // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs
14904 var React104 = __toESM(require_react(), 1);
14905 var TooltipRootContext = /* @__PURE__ */ React104.createContext(void 0);
14906 if (true) TooltipRootContext.displayName = "TooltipRootContext";
14907 function useTooltipRootContext(optional) {
14908 const context = React104.useContext(TooltipRootContext);
14909 if (context === void 0 && !optional) {
14910 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72));
14911 }
14912 return context;
14913 }
14914
14915 // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs
14916 var React105 = __toESM(require_react(), 1);
14917 var selectors3 = {
14918 ...popupStoreSelectors,
14919 disabled: (state) => state.disabled,
14920 instantType: (state) => state.instantType,
14921 isInstantPhase: (state) => state.isInstantPhase,
14922 trackCursorAxis: (state) => state.trackCursorAxis,
14923 disableHoverablePopup: (state) => state.disableHoverablePopup,
14924 lastOpenChangeReason: (state) => state.openChangeReason,
14925 closeOnClick: (state) => state.closeOnClick,
14926 closeDelay: (state) => state.closeDelay,
14927 adaptiveOrigin: (state) => state.adaptiveOrigin
14928 };
14929 var TooltipStore = class extends ReactStore {
14930 constructor(initialState, floatingId, nested) {
14931 const triggerElements = new PopupTriggerMap();
14932 super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors3);
14933 }
14934 setOpen = (nextOpen, eventDetails) => {
14935 applyPopupOpenChange(this, nextOpen, eventDetails, {
14936 extraState: {
14937 openChangeReason: eventDetails.reason
14938 }
14939 });
14940 };
14941 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change.
14942 cancelPendingOpen(event) {
14943 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event));
14944 }
14945 };
14946 function createNullTooltipStore() {
14947 const triggerElements = new PopupTriggerMap();
14948 const store = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors3);
14949 return Object.assign(store, {
14950 setOpen: NOOP,
14951 cancelPendingOpen: NOOP
14952 });
14953 }
14954 function createInitialState(initialState, triggerElements, floatingId, nested = false) {
14955 const state = {
14956 ...createInitialPopupStoreState(),
14957 disabled: false,
14958 instantType: void 0,
14959 isInstantPhase: false,
14960 trackCursorAxis: "none",
14961 disableHoverablePopup: false,
14962 openChangeReason: null,
14963 closeOnClick: true,
14964 closeDelay: 0,
14965 adaptiveOrigin: void 0,
14966 ...initialState
14967 };
14968 state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
14969 return state;
14970 }
14971 function createInitialContext(triggerElements) {
14972 return {
14973 popupRef: /* @__PURE__ */ React105.createRef(),
14974 onOpenChange: void 0,
14975 onOpenChangeComplete: void 0,
14976 triggerElements
14977 };
14978 }
14979
14980 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
14981 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
14982 var TooltipRoot = fastComponent(function TooltipRoot2(props) {
14983 const {
14984 disabled: disabled2 = false,
14985 defaultOpen = false,
14986 open: openProp,
14987 disableHoverablePopup = false,
14988 trackCursorAxis = "none",
14989 actionsRef,
14990 onOpenChange,
14991 onOpenChangeComplete,
14992 handle,
14993 triggerId: triggerIdProp,
14994 defaultTriggerId: defaultTriggerIdProp = null,
14995 children
14996 } = props;
14997 const store = usePopupRootStore((floatingId, nested) => new TooltipStore({
14998 open: defaultOpen,
14999 openProp,
15000 activeTriggerId: defaultTriggerIdProp,
15001 triggerIdProp
15002 }, floatingId, nested));
15003 store.useControlledProp("openProp", openProp);
15004 store.useControlledProp("triggerIdProp", triggerIdProp);
15005 store.useContextCallback("onOpenChange", onOpenChange);
15006 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
15007 const openState = store.useState("open");
15008 const open = !disabled2 && openState;
15009 const activeTriggerId = store.useState("activeTriggerId");
15010 const mounted = store.useState("mounted");
15011 const payload = store.useState("payload");
15012 store.useSyncedValues({
15013 trackCursorAxis,
15014 disableHoverablePopup,
15015 disabled: disabled2
15016 });
15017 useImplicitActiveTrigger(store, {
15018 closeOnActiveTriggerUnmount: true
15019 });
15020 const {
15021 forceUnmount,
15022 transitionStatus
15023 } = useOpenStateTransitions(open, store);
15024 const isInstantPhase = store.useState("isInstantPhase");
15025 const instantType = store.useState("instantType");
15026 const lastOpenChangeReason = store.useState("lastOpenChangeReason");
15027 const previousInstantTypeRef = React106.useRef(null);
15028 useIsoLayoutEffect(() => {
15029 if (openState && disabled2) {
15030 store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled));
15031 }
15032 }, [openState, disabled2, store]);
15033 useIsoLayoutEffect(() => {
15034 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) {
15035 if (instantType !== "delay") {
15036 previousInstantTypeRef.current = instantType;
15037 }
15038 store.set("instantType", "delay");
15039 } else if (previousInstantTypeRef.current !== null) {
15040 store.set("instantType", previousInstantTypeRef.current);
15041 previousInstantTypeRef.current = null;
15042 }
15043 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]);
15044 useIsoLayoutEffect(() => {
15045 if (open) {
15046 if (activeTriggerId == null) {
15047 store.set("payload", void 0);
15048 }
15049 }
15050 }, [store, activeTriggerId, open]);
15051 React106.useImperativeHandle(actionsRef, () => ({
15052 unmount: forceUnmount,
15053 close: () => store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction))
15054 }), [forceUnmount, store]);
15055 const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none";
15056 return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TooltipRootContext.Provider, {
15057 value: store,
15058 children: [handle && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PopupHandleAttachment, {
15059 handle,
15060 store
15061 }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipInteractions, {
15062 store,
15063 disabled: disabled2,
15064 trackCursorAxis
15065 }), typeof children === "function" ? children({
15066 payload
15067 }) : children]
15068 });
15069 });
15070 if (true) TooltipRoot.displayName = "TooltipRoot";
15071 function TooltipInteractions({
15072 store,
15073 disabled: disabled2,
15074 trackCursorAxis
15075 }) {
15076 const floatingRootContext = store.useState("floatingRootContext");
15077 const dismiss = useDismiss(floatingRootContext, {
15078 enabled: !disabled2,
15079 referencePress: () => store.select("closeOnClick")
15080 });
15081 const clientPoint = useClientPoint(floatingRootContext, {
15082 enabled: !disabled2 && trackCursorAxis !== "none",
15083 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis
15084 });
15085 const triggerProps = React106.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]);
15086 usePopupInteractionProps(store, {
15087 activeTriggerProps: triggerProps,
15088 inactiveTriggerProps: triggerProps,
15089 popupProps: dismiss.floating ?? EMPTY_OBJECT
15090 });
15091 return null;
15092 }
15093
15094 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
15095 var React108 = __toESM(require_react(), 1);
15096
15097 // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs
15098 var React107 = __toESM(require_react(), 1);
15099 var TooltipProviderContext = /* @__PURE__ */ React107.createContext(void 0);
15100 if (true) TooltipProviderContext.displayName = "TooltipProviderContext";
15101 function useTooltipProviderContext() {
15102 return React107.useContext(TooltipProviderContext);
15103 }
15104
15105 // node_modules/@base-ui/react/tooltip/utils/constants.mjs
15106 var OPEN_DELAY = 600;
15107
15108 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
15109 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger";
15110 function getTargetElement(event) {
15111 if ("composedPath" in event) {
15112 const path = event.composedPath();
15113 for (let i = 0; i < path.length; i += 1) {
15114 const element = path[i];
15115 if (isElement(element)) {
15116 return element;
15117 }
15118 }
15119 }
15120 const target = event.target;
15121 if (isElement(target)) {
15122 return target;
15123 }
15124 return null;
15125 }
15126 function closestEnabledTooltipTrigger(element) {
15127 let current = element;
15128 while (current) {
15129 const trigger = current.closest(`[${TOOLTIP_TRIGGER_IDENTIFIER}]`);
15130 if (trigger) {
15131 return trigger;
15132 }
15133 const root2 = current.getRootNode();
15134 current = "host" in root2 && isElement(root2.host) ? root2.host : null;
15135 }
15136 return null;
15137 }
15138 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) {
15139 const {
15140 render,
15141 className,
15142 style,
15143 handle,
15144 payload,
15145 disabled: disabledProp,
15146 delay,
15147 closeOnClick = true,
15148 closeDelay,
15149 id: idProp,
15150 ...elementProps
15151 } = componentProps;
15152 const rootContext = useTooltipRootContext(true);
15153 const handleStore = usePopupHandleStore(handle);
15154 const store = handleStore ?? rootContext;
15155 if (!store) {
15156 throw new Error(true ? "Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle." : formatErrorMessage_default(82));
15157 }
15158 const thisTriggerId = useBaseUiId(idProp);
15159 const isTriggerActive = store.useState("isTriggerActive", thisTriggerId);
15160 const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
15161 const floatingRootContext = store.useState("floatingRootContext");
15162 const triggerElementRef = React108.useRef(null);
15163 const delayWithDefault = delay ?? OPEN_DELAY;
15164 const closeDelayWithDefault = closeDelay ?? 0;
15165 const {
15166 registerTrigger,
15167 isMountedByThisTrigger
15168 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
15169 payload,
15170 closeOnClick,
15171 closeDelay: closeDelayWithDefault
15172 });
15173 const providerDelay = useTooltipProviderContext();
15174 const {
15175 delayRef,
15176 isInstantPhase,
15177 hasProvider
15178 } = useDelayGroup(floatingRootContext, {
15179 open: isOpenedByThisTrigger
15180 });
15181 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext);
15182 store.useSyncedValue("isInstantPhase", isInstantPhase);
15183 const rootDisabled = store.useState("disabled");
15184 const disabled2 = disabledProp ?? rootDisabled;
15185 const disabledRef = useValueAsRef(disabled2);
15186 const trackCursorAxis = store.useState("trackCursorAxis");
15187 const disableHoverablePopup = store.useState("disableHoverablePopup");
15188 const isNestedTriggerHoveredRef = React108.useRef(false);
15189 const nestedTriggerOpenTimeout = useTimeout();
15190 const pointerTypeRef = React108.useRef(void 0);
15191 function getOpenDelay() {
15192 if (!hasProvider) {
15193 return delayWithDefault;
15194 }
15195 return getDelay(delayRef.current, "open") === 0 ? 0 : delay ?? providerDelay ?? OPEN_DELAY;
15196 }
15197 function isEnabledNestedTriggerTarget(target) {
15198 const triggerEl = triggerElementRef.current;
15199 if (!triggerEl || !target) {
15200 return false;
15201 }
15202 const nearestTrigger = closestEnabledTooltipTrigger(target);
15203 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger);
15204 }
15205 function detectNestedTriggerHover(target) {
15206 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target);
15207 isNestedTriggerHoveredRef.current = nestedTriggerHovered;
15208 if (nestedTriggerHovered) {
15209 hoverInteraction.openChangeTimeout.clear();
15210 hoverInteraction.restTimeout.clear();
15211 hoverInteraction.restTimeoutPending = false;
15212 nestedTriggerOpenTimeout.clear();
15213 }
15214 return nestedTriggerHovered;
15215 }
15216 const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
15217 enabled: !disabled2,
15218 mouseOnly: true,
15219 move: false,
15220 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null,
15221 restMs: getOpenDelay,
15222 delay() {
15223 if (closeDelay == null && hasProvider) {
15224 return {
15225 close: getDelay(delayRef.current, "close")
15226 };
15227 }
15228 return {
15229 close: closeDelayWithDefault
15230 };
15231 },
15232 triggerElementRef,
15233 isActiveTrigger: isTriggerActive,
15234 isClosing: () => store.select("transitionStatus") === "ending",
15235 shouldOpen() {
15236 return !isNestedTriggerHoveredRef.current;
15237 }
15238 });
15239 const focusProps = useFocus(floatingRootContext, {
15240 enabled: !disabled2
15241 }).reference;
15242 const handleNestedTriggerHover = (event) => {
15243 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current;
15244 const target = getTargetElement(event);
15245 const nestedTriggerHovered = detectNestedTriggerHover(target);
15246 const triggerEl = triggerElementRef.current;
15247 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target);
15248 if (nestedTriggerHovered && store.select("open") && store.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) {
15249 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
15250 return;
15251 }
15252 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences.
15253 isMouseLikePointerType(pointerTypeRef.current)) {
15254 const open = () => {
15255 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store.select("open")) {
15256 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl));
15257 }
15258 };
15259 const openDelay = getOpenDelay();
15260 if (openDelay === 0) {
15261 nestedTriggerOpenTimeout.clear();
15262 open();
15263 } else {
15264 nestedTriggerOpenTimeout.start(openDelay, open);
15265 }
15266 }
15267 };
15268 const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
15269 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none";
15270 const state = {
15271 open: isOpenedByThisTrigger
15272 };
15273 const element = useRenderElement("button", componentProps, {
15274 state,
15275 ref: [forwardedRef, registerTrigger, triggerElementRef],
15276 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, {
15277 onMouseOver(event) {
15278 handleNestedTriggerHover(event.nativeEvent);
15279 },
15280 onFocus(event) {
15281 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) {
15282 event.preventBaseUIHandler();
15283 }
15284 },
15285 onMouseLeave() {
15286 isNestedTriggerHoveredRef.current = false;
15287 nestedTriggerOpenTimeout.clear();
15288 pointerTypeRef.current = void 0;
15289 },
15290 onPointerEnter(event) {
15291 pointerTypeRef.current = event.pointerType;
15292 },
15293 onPointerDown(event) {
15294 pointerTypeRef.current = event.pointerType;
15295 store.set("closeOnClick", closeOnClick);
15296 if (closeOnClick && !store.select("open")) {
15297 store.cancelPendingOpen(event.nativeEvent);
15298 }
15299 },
15300 onClick(event) {
15301 if (closeOnClick && !store.select("open")) {
15302 store.cancelPendingOpen(event.nativeEvent);
15303 }
15304 },
15305 id: thisTriggerId,
15306 "data-trigger-disabled": disabled2 ? "" : void 0,
15307 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : ""
15308 }, elementProps],
15309 stateAttributesMapping: triggerOpenStateMapping
15310 });
15311 return element;
15312 });
15313 if (true) TooltipTrigger.displayName = "TooltipTrigger";
15314
15315 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
15316 var React110 = __toESM(require_react(), 1);
15317
15318 // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs
15319 var React109 = __toESM(require_react(), 1);
15320 var TooltipPortalContext = /* @__PURE__ */ React109.createContext(void 0);
15321 if (true) TooltipPortalContext.displayName = "TooltipPortalContext";
15322 function useTooltipPortalContext() {
15323 const value = React109.useContext(TooltipPortalContext);
15324 if (value === void 0) {
15325 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70));
15326 }
15327 return value;
15328 }
15329
15330 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
15331 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
15332 var TooltipPortal = /* @__PURE__ */ React110.forwardRef(function TooltipPortal2(props, forwardedRef) {
15333 const {
15334 keepMounted = false,
15335 ...portalProps
15336 } = props;
15337 const store = useTooltipRootContext();
15338 const mounted = store.useState("mounted");
15339 const shouldRender = mounted || keepMounted;
15340 if (!shouldRender) {
15341 return null;
15342 }
15343 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipPortalContext.Provider, {
15344 value: keepMounted,
15345 children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FloatingPortalLite, {
15346 ref: forwardedRef,
15347 ...portalProps
15348 })
15349 });
15350 });
15351 if (true) TooltipPortal.displayName = "TooltipPortal";
15352
15353 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
15354 var React112 = __toESM(require_react(), 1);
15355
15356 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs
15357 var React111 = __toESM(require_react(), 1);
15358 var TooltipPositionerContext = /* @__PURE__ */ React111.createContext(void 0);
15359 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext";
15360 function useTooltipPositionerContext() {
15361 const context = React111.useContext(TooltipPositionerContext);
15362 if (context === void 0) {
15363 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71));
15364 }
15365 return context;
15366 }
15367
15368 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
15369 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
15370 var TooltipPositioner = /* @__PURE__ */ React112.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) {
15371 const {
15372 render,
15373 className,
15374 anchor,
15375 positionMethod = "absolute",
15376 side = "top",
15377 align = "center",
15378 sideOffset = 0,
15379 alignOffset = 0,
15380 collisionBoundary = "clipping-ancestors",
15381 collisionPadding = 5,
15382 arrowPadding = 5,
15383 sticky = false,
15384 disableAnchorTracking = false,
15385 collisionAvoidance = POPUP_COLLISION_AVOIDANCE,
15386 style,
15387 ...elementProps
15388 } = componentProps;
15389 const store = useTooltipRootContext();
15390 const keepMounted = useTooltipPortalContext();
15391 const open = store.useState("open");
15392 const mounted = store.useState("mounted");
15393 const trackCursorAxis = store.useState("trackCursorAxis");
15394 const disableHoverablePopup = store.useState("disableHoverablePopup");
15395 const floatingRootContext = store.useState("floatingRootContext");
15396 const instantType = store.useState("instantType");
15397 const transitionStatus = store.useState("transitionStatus");
15398 const adaptiveOrigin2 = store.useState("adaptiveOrigin");
15399 const positioning = useAnchorPositioning({
15400 anchor,
15401 positionMethod,
15402 floatingRootContext,
15403 mounted,
15404 side,
15405 sideOffset,
15406 align,
15407 alignOffset,
15408 collisionBoundary,
15409 collisionPadding,
15410 sticky,
15411 arrowPadding,
15412 disableAnchorTracking,
15413 keepMounted,
15414 collisionAvoidance,
15415 adaptiveOrigin: adaptiveOrigin2
15416 });
15417 const state = React112.useMemo(() => ({
15418 open,
15419 side: positioning.side,
15420 align: positioning.align,
15421 anchorHidden: positioning.anchorHidden,
15422 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType
15423 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]);
15424 const element = usePositioner(componentProps, state, {
15425 styles: positioning.positionerStyles,
15426 transitionStatus,
15427 props: elementProps,
15428 refs: [forwardedRef, store.useStateSetter("positionerElement")],
15429 hidden: !mounted,
15430 inert: !open || trackCursorAxis === "both" || disableHoverablePopup
15431 });
15432 return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TooltipPositionerContext.Provider, {
15433 value: positioning,
15434 children: element
15435 });
15436 });
15437 if (true) TooltipPositioner.displayName = "TooltipPositioner";
15438
15439 // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs
15440 var React113 = __toESM(require_react(), 1);
15441 var TooltipPopup = /* @__PURE__ */ React113.forwardRef(function TooltipPopup2(componentProps, forwardedRef) {
15442 const {
15443 render,
15444 className,
15445 style,
15446 ...elementProps
15447 } = componentProps;
15448 const store = useTooltipRootContext();
15449 const {
15450 side,
15451 align
15452 } = useTooltipPositionerContext();
15453 const open = store.useState("open");
15454 const instantType = store.useState("instantType");
15455 const transitionStatus = store.useState("transitionStatus");
15456 const popupProps = store.useState("popupProps");
15457 const floatingContext = store.useState("floatingRootContext");
15458 const disabled2 = store.useState("disabled");
15459 const closeDelay = store.useState("closeDelay");
15460 useOpenChangeComplete({
15461 open,
15462 ref: store.context.popupRef,
15463 onComplete() {
15464 if (open) {
15465 store.context.onOpenChangeComplete?.(true);
15466 }
15467 }
15468 });
15469 useHoverFloatingInteraction(floatingContext, {
15470 enabled: !disabled2,
15471 closeDelay
15472 });
15473 const setPopupElement = store.useStateSetter("popupElement");
15474 const state = {
15475 open,
15476 side,
15477 align,
15478 instant: instantType,
15479 transitionStatus
15480 };
15481 const element = useRenderElement("div", componentProps, {
15482 state,
15483 ref: [forwardedRef, store.context.popupRef, setPopupElement],
15484 props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps],
15485 stateAttributesMapping: popupTransitionStateMapping
15486 });
15487 return element;
15488 });
15489 if (true) TooltipPopup.displayName = "TooltipPopup";
15490
15491 // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs
15492 var React114 = __toESM(require_react(), 1);
15493 var TooltipArrow = /* @__PURE__ */ React114.forwardRef(function TooltipArrow2(componentProps, forwardedRef) {
15494 const {
15495 render,
15496 className,
15497 style,
15498 ...elementProps
15499 } = componentProps;
15500 const store = useTooltipRootContext();
15501 const {
15502 arrowRef,
15503 side,
15504 align,
15505 arrowUncentered,
15506 arrowStyles
15507 } = useTooltipPositionerContext();
15508 const open = store.useState("open");
15509 const instantType = store.useState("instantType");
15510 const state = {
15511 open,
15512 side,
15513 align,
15514 uncentered: arrowUncentered,
15515 instant: instantType
15516 };
15517 const element = useRenderElement("div", componentProps, {
15518 state,
15519 ref: [forwardedRef, arrowRef],
15520 props: [{
15521 style: arrowStyles,
15522 "aria-hidden": true
15523 }, elementProps],
15524 stateAttributesMapping: popupStateMapping
15525 });
15526 return element;
15527 });
15528 if (true) TooltipArrow.displayName = "TooltipArrow";
15529
15530 // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs
15531 var React115 = __toESM(require_react(), 1);
15532 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
15533 var TooltipProvider = function TooltipProvider2(props) {
15534 const {
15535 delay,
15536 closeDelay,
15537 timeout = 400
15538 } = props;
15539 const delayValue = React115.useMemo(() => ({
15540 open: delay,
15541 close: closeDelay
15542 }), [delay, closeDelay]);
15543 return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipProviderContext.Provider, {
15544 value: delay,
15545 children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FloatingDelayGroup, {
15546 delay: delayValue,
15547 timeoutMs: timeout,
15548 children: props.children
15549 })
15550 });
15551 };
15552 if (true) TooltipProvider.displayName = "TooltipProvider";
15553
15554 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs
15555 var React116 = __toESM(require_react(), 1);
15556 var TooltipViewport = /* @__PURE__ */ React116.forwardRef(function TooltipViewport2(componentProps, forwardedRef) {
15557 const {
15558 render,
15559 className,
15560 style,
15561 children,
15562 ...elementProps
15563 } = componentProps;
15564 const store = useTooltipRootContext();
15565 const positioner = useTooltipPositionerContext();
15566 const instantType = store.useState("instantType");
15567 const {
15568 children: childrenToRender,
15569 state: viewportState
15570 } = usePopupViewport({
15571 store,
15572 side: positioner.side,
15573 children
15574 });
15575 const state = {
15576 activationDirection: viewportState.activationDirection,
15577 transitioning: viewportState.transitioning,
15578 instant: instantType
15579 };
15580 return useRenderElement("div", componentProps, {
15581 state,
15582 ref: forwardedRef,
15583 props: [elementProps, {
15584 children: childrenToRender
15585 }],
15586 stateAttributesMapping: popupViewportStateMapping
15587 });
15588 });
15589 if (true) TooltipViewport.displayName = "TooltipViewport";
15590
15591 // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs
15592 var TooltipHandle = class extends BasePopupHandle {
15593 constructor() {
15594 super(createNullTooltipStore(), "Tooltip");
15595 }
15596 /**
15597 * Opens the tooltip and associates it with the trigger with the given id.
15598 *
15599 * This method should only be called in an event handler or an effect (not during rendering).
15600 *
15601 * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching
15602 * `Tooltip.Trigger` with this handle passed as a prop.
15603 */
15604 open(triggerId) {
15605 this.openByTrigger(triggerId);
15606 }
15607 /**
15608 * Closes the tooltip.
15609 *
15610 * This method should only be called in an event handler or an effect (not during rendering).
15611 */
15612 close() {
15613 this.closePopup();
15614 }
15615 /**
15616 * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle.
15617 */
15618 get isOpen() {
15619 return this.attachedStore?.select("open") ?? false;
15620 }
15621 };
15622 function createTooltipHandle() {
15623 return new TooltipHandle();
15624 }
15625
15626 // node_modules/@base-ui/react/use-render/useRender.mjs
15627 function useRender(params) {
15628 return useRenderElement(params.defaultTagName ?? "div", params, params);
15629 }
15630
15631 // packages/ui/build-module/text/text.mjs
15632 var import_element16 = __toESM(require_element(), 1);
15633 var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
15634 function getRuntime() {
15635 const globalScope = globalThis;
15636 if (globalScope.__wpStyleRuntime) {
15637 return globalScope.__wpStyleRuntime;
15638 }
15639 globalScope.__wpStyleRuntime = {
15640 documents: /* @__PURE__ */ new Map(),
15641 styles: /* @__PURE__ */ new Map(),
15642 injectedStyles: /* @__PURE__ */ new WeakMap()
15643 };
15644 if (typeof document !== "undefined") {
15645 registerDocument(document);
15646 }
15647 return globalScope.__wpStyleRuntime;
15648 }
15649 function documentContainsStyleHash(targetDocument, hash) {
15650 if (!targetDocument.head) {
15651 return false;
15652 }
15653 for (const style of targetDocument.head.querySelectorAll(
15654 `style[${STYLE_HASH_ATTRIBUTE}]`
15655 )) {
15656 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
15657 return true;
15658 }
15659 }
15660 return false;
15661 }
15662 function injectStyle(targetDocument, hash, css) {
15663 if (!targetDocument.head) {
15664 return;
15665 }
15666 const runtime = getRuntime();
15667 let injectedStyles = runtime.injectedStyles.get(targetDocument);
15668 if (!injectedStyles) {
15669 injectedStyles = /* @__PURE__ */ new Set();
15670 runtime.injectedStyles.set(targetDocument, injectedStyles);
15671 }
15672 if (injectedStyles.has(hash)) {
15673 return;
15674 }
15675 if (documentContainsStyleHash(targetDocument, hash)) {
15676 injectedStyles.add(hash);
15677 return;
15678 }
15679 const style = targetDocument.createElement("style");
15680 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
15681 style.appendChild(targetDocument.createTextNode(css));
15682 targetDocument.head.appendChild(style);
15683 injectedStyles.add(hash);
15684 }
15685 function registerDocument(targetDocument) {
15686 const runtime = getRuntime();
15687 runtime.documents.set(
15688 targetDocument,
15689 (runtime.documents.get(targetDocument) ?? 0) + 1
15690 );
15691 for (const [hash, css] of runtime.styles) {
15692 injectStyle(targetDocument, hash, css);
15693 }
15694 return () => {
15695 const count = runtime.documents.get(targetDocument);
15696 if (count === void 0) {
15697 return;
15698 }
15699 if (count <= 1) {
15700 runtime.documents.delete(targetDocument);
15701 return;
15702 }
15703 runtime.documents.set(targetDocument, count - 1);
15704 };
15705 }
15706 function registerStyle(hash, css) {
15707 const runtime = getRuntime();
15708 runtime.styles.set(hash, css);
15709 for (const targetDocument of runtime.documents.keys()) {
15710 injectStyle(targetDocument, hash, css);
15711 }
15712 }
15713 if (typeof process === "undefined" || true) {
15714 registerStyle("3167e7d116", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{text-wrap:pretty;margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
15715 }
15716 var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" };
15717 if (typeof process === "undefined" || true) {
15718 registerStyle("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
15719 }
15720 var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
15721 var Text = (0, import_element16.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) {
15722 const element = useRender({
15723 render,
15724 defaultTagName: "span",
15725 ref,
15726 props: mergeProps(props, {
15727 className: clsx_default(
15728 style_default.text,
15729 global_css_defense_default.heading,
15730 global_css_defense_default.p,
15731 style_default[variant],
15732 className
15733 )
15734 })
15735 });
15736 return element;
15737 });
15738
15739 // packages/ui/build-module/tooltip/popup.mjs
15740 var import_element20 = __toESM(require_element(), 1);
15741
15742 // packages/ui/build-module/tooltip/portal.mjs
15743 var import_element17 = __toESM(require_element(), 1);
15744
15745 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs
15746 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
15747 function getRuntime2() {
15748 const globalScope = globalThis;
15749 if (globalScope.__wpStyleRuntime) {
15750 return globalScope.__wpStyleRuntime;
15751 }
15752 globalScope.__wpStyleRuntime = {
15753 documents: /* @__PURE__ */ new Map(),
15754 styles: /* @__PURE__ */ new Map(),
15755 injectedStyles: /* @__PURE__ */ new WeakMap()
15756 };
15757 if (typeof document !== "undefined") {
15758 registerDocument2(document);
15759 }
15760 return globalScope.__wpStyleRuntime;
15761 }
15762 function documentContainsStyleHash2(targetDocument, hash) {
15763 if (!targetDocument.head) {
15764 return false;
15765 }
15766 for (const style of targetDocument.head.querySelectorAll(
15767 `style[${STYLE_HASH_ATTRIBUTE2}]`
15768 )) {
15769 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
15770 return true;
15771 }
15772 }
15773 return false;
15774 }
15775 function injectStyle2(targetDocument, hash, css) {
15776 if (!targetDocument.head) {
15777 return;
15778 }
15779 const runtime = getRuntime2();
15780 let injectedStyles = runtime.injectedStyles.get(targetDocument);
15781 if (!injectedStyles) {
15782 injectedStyles = /* @__PURE__ */ new Set();
15783 runtime.injectedStyles.set(targetDocument, injectedStyles);
15784 }
15785 if (injectedStyles.has(hash)) {
15786 return;
15787 }
15788 if (documentContainsStyleHash2(targetDocument, hash)) {
15789 injectedStyles.add(hash);
15790 return;
15791 }
15792 const style = targetDocument.createElement("style");
15793 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
15794 style.appendChild(targetDocument.createTextNode(css));
15795 targetDocument.head.appendChild(style);
15796 injectedStyles.add(hash);
15797 }
15798 function registerDocument2(targetDocument) {
15799 const runtime = getRuntime2();
15800 runtime.documents.set(
15801 targetDocument,
15802 (runtime.documents.get(targetDocument) ?? 0) + 1
15803 );
15804 for (const [hash, css] of runtime.styles) {
15805 injectStyle2(targetDocument, hash, css);
15806 }
15807 return () => {
15808 const count = runtime.documents.get(targetDocument);
15809 if (count === void 0) {
15810 return;
15811 }
15812 if (count <= 1) {
15813 runtime.documents.delete(targetDocument);
15814 return;
15815 }
15816 runtime.documents.set(targetDocument, count - 1);
15817 };
15818 }
15819 function registerStyle2(hash, css) {
15820 const runtime = getRuntime2();
15821 runtime.styles.set(hash, css);
15822 for (const targetDocument of runtime.documents.keys()) {
15823 injectStyle2(targetDocument, hash, css);
15824 }
15825 }
15826 if (typeof process === "undefined" || true) {
15827 registerStyle2("be37f31c1e", "._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}}");
15828 }
15829 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" };
15830 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot";
15831 function resolveOwnerDocument() {
15832 return typeof document === "undefined" ? null : document;
15833 }
15834 function isInWordPressEnvironment() {
15835 let topWp;
15836 try {
15837 topWp = window.top?.wp;
15838 } catch {
15839 }
15840 const wp = topWp ?? window.wp;
15841 return typeof wp?.components === "object" && wp.components !== null;
15842 }
15843 var cachedSlot = null;
15844 function ensureSlotIsAccessible(element) {
15845 element.setAttribute("aria-hidden", "false");
15846 return element;
15847 }
15848 function createSlot(ownerDocument2) {
15849 const element = ownerDocument2.createElement("div");
15850 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, "");
15851 if (wp_compat_overlay_slot_default.slot) {
15852 element.classList.add(wp_compat_overlay_slot_default.slot);
15853 }
15854 ownerDocument2.body.appendChild(element);
15855 return element;
15856 }
15857 function getWpCompatOverlaySlot() {
15858 if (typeof window === "undefined") {
15859 return void 0;
15860 }
15861 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) {
15862 return void 0;
15863 }
15864 const ownerDocument2 = resolveOwnerDocument();
15865 if (!ownerDocument2 || !ownerDocument2.body) {
15866 return void 0;
15867 }
15868 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) {
15869 return ensureSlotIsAccessible(cachedSlot);
15870 }
15871 const existing = ownerDocument2.querySelector(
15872 `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]`
15873 );
15874 if (existing instanceof HTMLDivElement) {
15875 cachedSlot = ensureSlotIsAccessible(existing);
15876 return cachedSlot;
15877 }
15878 if (cachedSlot?.isConnected) {
15879 cachedSlot.remove();
15880 }
15881 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2));
15882 return cachedSlot;
15883 }
15884
15885 // packages/ui/build-module/tooltip/portal.mjs
15886 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
15887 var Portal = (0, import_element17.forwardRef)(
15888 function TooltipPortal3({ container, ...restProps }, ref) {
15889 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
15890 index_parts_exports3.Portal,
15891 {
15892 container: container ?? getWpCompatOverlaySlot(),
15893 ...restProps,
15894 ref
15895 }
15896 );
15897 }
15898 );
15899
15900 // packages/ui/build-module/tooltip/positioner.mjs
15901 var import_element18 = __toESM(require_element(), 1);
15902 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
15903 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
15904 function getRuntime3() {
15905 const globalScope = globalThis;
15906 if (globalScope.__wpStyleRuntime) {
15907 return globalScope.__wpStyleRuntime;
15908 }
15909 globalScope.__wpStyleRuntime = {
15910 documents: /* @__PURE__ */ new Map(),
15911 styles: /* @__PURE__ */ new Map(),
15912 injectedStyles: /* @__PURE__ */ new WeakMap()
15913 };
15914 if (typeof document !== "undefined") {
15915 registerDocument3(document);
15916 }
15917 return globalScope.__wpStyleRuntime;
15918 }
15919 function documentContainsStyleHash3(targetDocument, hash) {
15920 if (!targetDocument.head) {
15921 return false;
15922 }
15923 for (const style of targetDocument.head.querySelectorAll(
15924 `style[${STYLE_HASH_ATTRIBUTE3}]`
15925 )) {
15926 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
15927 return true;
15928 }
15929 }
15930 return false;
15931 }
15932 function injectStyle3(targetDocument, hash, css) {
15933 if (!targetDocument.head) {
15934 return;
15935 }
15936 const runtime = getRuntime3();
15937 let injectedStyles = runtime.injectedStyles.get(targetDocument);
15938 if (!injectedStyles) {
15939 injectedStyles = /* @__PURE__ */ new Set();
15940 runtime.injectedStyles.set(targetDocument, injectedStyles);
15941 }
15942 if (injectedStyles.has(hash)) {
15943 return;
15944 }
15945 if (documentContainsStyleHash3(targetDocument, hash)) {
15946 injectedStyles.add(hash);
15947 return;
15948 }
15949 const style = targetDocument.createElement("style");
15950 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
15951 style.appendChild(targetDocument.createTextNode(css));
15952 targetDocument.head.appendChild(style);
15953 injectedStyles.add(hash);
15954 }
15955 function registerDocument3(targetDocument) {
15956 const runtime = getRuntime3();
15957 runtime.documents.set(
15958 targetDocument,
15959 (runtime.documents.get(targetDocument) ?? 0) + 1
15960 );
15961 for (const [hash, css] of runtime.styles) {
15962 injectStyle3(targetDocument, hash, css);
15963 }
15964 return () => {
15965 const count = runtime.documents.get(targetDocument);
15966 if (count === void 0) {
15967 return;
15968 }
15969 if (count <= 1) {
15970 runtime.documents.delete(targetDocument);
15971 return;
15972 }
15973 runtime.documents.set(targetDocument, count - 1);
15974 };
15975 }
15976 function registerStyle3(hash, css) {
15977 const runtime = getRuntime3();
15978 runtime.styles.set(hash, css);
15979 for (const targetDocument of runtime.documents.keys()) {
15980 injectStyle3(targetDocument, hash, css);
15981 }
15982 }
15983 if (typeof process === "undefined" || true) {
15984 registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
15985 }
15986 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
15987 if (typeof process === "undefined" || true) {
15988 registerStyle3("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}');
15989 }
15990 var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
15991 var Positioner = (0, import_element18.forwardRef)(
15992 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) {
15993 return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
15994 index_parts_exports3.Positioner,
15995 {
15996 ref,
15997 align,
15998 side,
15999 sideOffset,
16000 ...props,
16001 className: clsx_default(
16002 resets_default["box-sizing"],
16003 style_default2.positioner,
16004 className
16005 )
16006 }
16007 );
16008 }
16009 );
16010
16011 // packages/ui/build-module/utils/render-slot-with-children.mjs
16012 var import_element19 = __toESM(require_element(), 1);
16013 function renderSlotWithChildren(slot, defaultSlot, children) {
16014 return (0, import_element19.cloneElement)(slot ?? defaultSlot, { children });
16015 }
16016
16017 // packages/ui/build-module/utils/theme-provider.mjs
16018 var theme = __toESM(require_theme(), 1);
16019
16020 // packages/ui/build-module/lock-unlock.mjs
16021 var import_private_apis = __toESM(require_private_apis(), 1);
16022 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
16023 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
16024 "@wordpress/ui"
16025 );
16026
16027 // packages/ui/build-module/utils/theme-provider.mjs
16028 function getThemeProvider() {
16029 const themePackage = theme;
16030 if (themePackage.ThemeProvider) {
16031 return themePackage.ThemeProvider;
16032 }
16033 if (!themePackage.privateApis) {
16034 throw new Error(
16035 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`."
16036 );
16037 }
16038 return unlock(
16039 themePackage.privateApis
16040 ).ThemeProvider;
16041 }
16042 var ThemeProvider = getThemeProvider();
16043
16044 // packages/ui/build-module/tooltip/popup.mjs
16045 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
16046 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
16047 function getRuntime4() {
16048 const globalScope = globalThis;
16049 if (globalScope.__wpStyleRuntime) {
16050 return globalScope.__wpStyleRuntime;
16051 }
16052 globalScope.__wpStyleRuntime = {
16053 documents: /* @__PURE__ */ new Map(),
16054 styles: /* @__PURE__ */ new Map(),
16055 injectedStyles: /* @__PURE__ */ new WeakMap()
16056 };
16057 if (typeof document !== "undefined") {
16058 registerDocument4(document);
16059 }
16060 return globalScope.__wpStyleRuntime;
16061 }
16062 function documentContainsStyleHash4(targetDocument, hash) {
16063 if (!targetDocument.head) {
16064 return false;
16065 }
16066 for (const style of targetDocument.head.querySelectorAll(
16067 `style[${STYLE_HASH_ATTRIBUTE4}]`
16068 )) {
16069 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
16070 return true;
16071 }
16072 }
16073 return false;
16074 }
16075 function injectStyle4(targetDocument, hash, css) {
16076 if (!targetDocument.head) {
16077 return;
16078 }
16079 const runtime = getRuntime4();
16080 let injectedStyles = runtime.injectedStyles.get(targetDocument);
16081 if (!injectedStyles) {
16082 injectedStyles = /* @__PURE__ */ new Set();
16083 runtime.injectedStyles.set(targetDocument, injectedStyles);
16084 }
16085 if (injectedStyles.has(hash)) {
16086 return;
16087 }
16088 if (documentContainsStyleHash4(targetDocument, hash)) {
16089 injectedStyles.add(hash);
16090 return;
16091 }
16092 const style = targetDocument.createElement("style");
16093 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
16094 style.appendChild(targetDocument.createTextNode(css));
16095 targetDocument.head.appendChild(style);
16096 injectedStyles.add(hash);
16097 }
16098 function registerDocument4(targetDocument) {
16099 const runtime = getRuntime4();
16100 runtime.documents.set(
16101 targetDocument,
16102 (runtime.documents.get(targetDocument) ?? 0) + 1
16103 );
16104 for (const [hash, css] of runtime.styles) {
16105 injectStyle4(targetDocument, hash, css);
16106 }
16107 return () => {
16108 const count = runtime.documents.get(targetDocument);
16109 if (count === void 0) {
16110 return;
16111 }
16112 if (count <= 1) {
16113 runtime.documents.delete(targetDocument);
16114 return;
16115 }
16116 runtime.documents.set(targetDocument, count - 1);
16117 };
16118 }
16119 function registerStyle4(hash, css) {
16120 const runtime = getRuntime4();
16121 runtime.styles.set(hash, css);
16122 for (const targetDocument of runtime.documents.keys()) {
16123 injectStyle4(targetDocument, hash, css);
16124 }
16125 }
16126 if (typeof process === "undefined" || true) {
16127 registerStyle4("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}');
16128 }
16129 var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
16130 var POPUP_COLOR = { background: "#1e1e1e" };
16131 var Popup = (0, import_element20.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) {
16132 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
16133 index_parts_exports3.Popup,
16134 {
16135 ref,
16136 className: clsx_default(style_default3.popup, className),
16137 ...props,
16138 children
16139 }
16140 ) });
16141 const positionedPopup = renderSlotWithChildren(
16142 positioner,
16143 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Positioner, {}),
16144 popupContent
16145 );
16146 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Portal, {}), positionedPopup);
16147 });
16148
16149 // packages/ui/build-module/tooltip/trigger.mjs
16150 var import_element21 = __toESM(require_element(), 1);
16151 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
16152 var Trigger = (0, import_element21.forwardRef)(
16153 function TooltipTrigger3(props, ref) {
16154 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(index_parts_exports3.Trigger, { ref, ...props });
16155 }
16156 );
16157
16158 // packages/ui/build-module/utils/direction-provider.mjs
16159 var import_i18n = __toESM(require_i18n(), 1);
16160 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
16161 function DirectionProvider3({ children }) {
16162 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(DirectionProvider, { direction: (0, import_i18n.isRTL)() ? "rtl" : "ltr", children });
16163 }
16164
16165 // packages/ui/build-module/tooltip/root.mjs
16166 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
16167 function Root(props) {
16168 return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(index_parts_exports3.Root, { ...props }) });
16169 }
16170
16171 // packages/icons/build-module/library/close-small.mjs
16172 var import_primitives = __toESM(require_primitives(), 1);
16173 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
16174 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives.Path, { d: "M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75", vectorEffect: "non-scaling-stroke" }) });
16175
16176 // packages/icons/build-module/library/search.mjs
16177 var import_primitives2 = __toESM(require_primitives(), 1);
16178 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
16179 var search_default = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives2.Path, { d: "M5 19L9.28769 14.7123M18.25 11C18.25 13.8995 15.8995 16.25 13 16.25C10.1005 16.25 7.75 13.8995 7.75 11C7.75 8.10051 10.1005 5.75 13 5.75C15.8995 5.75 18.25 8.10051 18.25 11Z", vectorEffect: "non-scaling-stroke" }) });
16180
16181 // packages/ui/build-module/icon/icon.mjs
16182 var import_element22 = __toESM(require_element(), 1);
16183 var import_primitives3 = __toESM(require_primitives(), 1);
16184 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
16185 var Icon = (0, import_element22.forwardRef)(function Icon2({ icon, size: size4 = 24, style, ...restProps }, ref) {
16186 const mergedStyle = icon.props.style || style ? { ...icon.props.style, ...style } : void 0;
16187 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
16188 import_primitives3.SVG,
16189 {
16190 ref,
16191 ...icon.props,
16192 ...restProps,
16193 ...mergedStyle ? { style: mergedStyle } : {},
16194 width: size4,
16195 height: size4
16196 }
16197 );
16198 });
16199
16200 // packages/ui/build-module/utils/keyboard-shortcut.mjs
16201 var import_element24 = __toESM(require_element(), 1);
16202 var import_i18n2 = __toESM(require_i18n(), 1);
16203
16204 // packages/ui/build-module/visually-hidden/visually-hidden.mjs
16205 var import_element23 = __toESM(require_element(), 1);
16206 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash";
16207 function getRuntime5() {
16208 const globalScope = globalThis;
16209 if (globalScope.__wpStyleRuntime) {
16210 return globalScope.__wpStyleRuntime;
16211 }
16212 globalScope.__wpStyleRuntime = {
16213 documents: /* @__PURE__ */ new Map(),
16214 styles: /* @__PURE__ */ new Map(),
16215 injectedStyles: /* @__PURE__ */ new WeakMap()
16216 };
16217 if (typeof document !== "undefined") {
16218 registerDocument5(document);
16219 }
16220 return globalScope.__wpStyleRuntime;
16221 }
16222 function documentContainsStyleHash5(targetDocument, hash) {
16223 if (!targetDocument.head) {
16224 return false;
16225 }
16226 for (const style of targetDocument.head.querySelectorAll(
16227 `style[${STYLE_HASH_ATTRIBUTE5}]`
16228 )) {
16229 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) {
16230 return true;
16231 }
16232 }
16233 return false;
16234 }
16235 function injectStyle5(targetDocument, hash, css) {
16236 if (!targetDocument.head) {
16237 return;
16238 }
16239 const runtime = getRuntime5();
16240 let injectedStyles = runtime.injectedStyles.get(targetDocument);
16241 if (!injectedStyles) {
16242 injectedStyles = /* @__PURE__ */ new Set();
16243 runtime.injectedStyles.set(targetDocument, injectedStyles);
16244 }
16245 if (injectedStyles.has(hash)) {
16246 return;
16247 }
16248 if (documentContainsStyleHash5(targetDocument, hash)) {
16249 injectedStyles.add(hash);
16250 return;
16251 }
16252 const style = targetDocument.createElement("style");
16253 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash);
16254 style.appendChild(targetDocument.createTextNode(css));
16255 targetDocument.head.appendChild(style);
16256 injectedStyles.add(hash);
16257 }
16258 function registerDocument5(targetDocument) {
16259 const runtime = getRuntime5();
16260 runtime.documents.set(
16261 targetDocument,
16262 (runtime.documents.get(targetDocument) ?? 0) + 1
16263 );
16264 for (const [hash, css] of runtime.styles) {
16265 injectStyle5(targetDocument, hash, css);
16266 }
16267 return () => {
16268 const count = runtime.documents.get(targetDocument);
16269 if (count === void 0) {
16270 return;
16271 }
16272 if (count <= 1) {
16273 runtime.documents.delete(targetDocument);
16274 return;
16275 }
16276 runtime.documents.set(targetDocument, count - 1);
16277 };
16278 }
16279 function registerStyle5(hash, css) {
16280 const runtime = getRuntime5();
16281 runtime.styles.set(hash, css);
16282 for (const targetDocument of runtime.documents.keys()) {
16283 injectStyle5(targetDocument, hash, css);
16284 }
16285 }
16286 if (typeof process === "undefined" || true) {
16287 registerStyle5("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}");
16288 }
16289 var style_default4 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
16290 var VisuallyHidden = (0, import_element23.forwardRef)(
16291 function VisuallyHidden2({ render, ...restProps }, ref) {
16292 const element = useRender({
16293 render,
16294 ref,
16295 props: mergeProps(
16296 { className: style_default4["visually-hidden"] },
16297 restProps,
16298 {
16299 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
16300 "data-visually-hidden": ""
16301 }
16302 )
16303 });
16304 return element;
16305 }
16306 );
16307
16308 // packages/ui/build-module/utils/keyboard-shortcut.mjs
16309 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
16310 function useKeyboardShortcutProps({
16311 "aria-describedby": ariaDescribedBy,
16312 "aria-keyshortcuts": ariaKeyShortcuts,
16313 shortcut
16314 }) {
16315 const generatedDescriptionId = (0, import_element24.useId)();
16316 const descriptionId = shortcut ? generatedDescriptionId : void 0;
16317 const describedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" ");
16318 return {
16319 descriptionId,
16320 targetProps: {
16321 "aria-describedby": describedBy || void 0,
16322 "aria-keyshortcuts": shortcut?.ariaKeyShortcut ?? ariaKeyShortcuts
16323 }
16324 };
16325 }
16326 var KeyboardShortcutDescription = (0, import_element24.forwardRef)(function KeyboardShortcutDescription2({ descriptionId, shortcut }, ref) {
16327 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
16328 VisuallyHidden,
16329 {
16330 id: descriptionId,
16331 "aria-hidden": "true",
16332 render: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { ref }),
16333 children: (0, import_i18n2.sprintf)(
16334 /* translators: %s: keyboard shortcut. */
16335 (0, import_i18n2.__)("Keyboard shortcut: %s"),
16336 shortcut.label ?? shortcut.ariaKeyShortcut
16337 )
16338 }
16339 );
16340 });
16341 var KeyboardShortcutDisplay = (0, import_element24.forwardRef)(function KeyboardShortcutDisplay2({ className, shortcut }, ref) {
16342 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { ref, "aria-hidden": "true", className, dir: "ltr", children: shortcut.displayShortcut });
16343 });
16344
16345 // packages/ui/build-module/form/primitives/constants.mjs
16346 var ITEM_POPUP_POSITIONER_PROPS = {
16347 align: "start",
16348 sideOffset: 8,
16349 collisionPadding: 12
16350 };
16351
16352 // packages/ui/build-module/button/button.mjs
16353 var import_element25 = __toESM(require_element(), 1);
16354 var import_i18n3 = __toESM(require_i18n(), 1);
16355 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
16356 import { speak } from "@wordpress/a11y";
16357 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash";
16358 function getRuntime6() {
16359 const globalScope = globalThis;
16360 if (globalScope.__wpStyleRuntime) {
16361 return globalScope.__wpStyleRuntime;
16362 }
16363 globalScope.__wpStyleRuntime = {
16364 documents: /* @__PURE__ */ new Map(),
16365 styles: /* @__PURE__ */ new Map(),
16366 injectedStyles: /* @__PURE__ */ new WeakMap()
16367 };
16368 if (typeof document !== "undefined") {
16369 registerDocument6(document);
16370 }
16371 return globalScope.__wpStyleRuntime;
16372 }
16373 function documentContainsStyleHash6(targetDocument, hash) {
16374 if (!targetDocument.head) {
16375 return false;
16376 }
16377 for (const style of targetDocument.head.querySelectorAll(
16378 `style[${STYLE_HASH_ATTRIBUTE6}]`
16379 )) {
16380 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) {
16381 return true;
16382 }
16383 }
16384 return false;
16385 }
16386 function injectStyle6(targetDocument, hash, css) {
16387 if (!targetDocument.head) {
16388 return;
16389 }
16390 const runtime = getRuntime6();
16391 let injectedStyles = runtime.injectedStyles.get(targetDocument);
16392 if (!injectedStyles) {
16393 injectedStyles = /* @__PURE__ */ new Set();
16394 runtime.injectedStyles.set(targetDocument, injectedStyles);
16395 }
16396 if (injectedStyles.has(hash)) {
16397 return;
16398 }
16399 if (documentContainsStyleHash6(targetDocument, hash)) {
16400 injectedStyles.add(hash);
16401 return;
16402 }
16403 const style = targetDocument.createElement("style");
16404 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash);
16405 style.appendChild(targetDocument.createTextNode(css));
16406 targetDocument.head.appendChild(style);
16407 injectedStyles.add(hash);
16408 }
16409 function registerDocument6(targetDocument) {
16410 const runtime = getRuntime6();
16411 runtime.documents.set(
16412 targetDocument,
16413 (runtime.documents.get(targetDocument) ?? 0) + 1
16414 );
16415 for (const [hash, css] of runtime.styles) {
16416 injectStyle6(targetDocument, hash, css);
16417 }
16418 return () => {
16419 const count = runtime.documents.get(targetDocument);
16420 if (count === void 0) {
16421 return;
16422 }
16423 if (count <= 1) {
16424 runtime.documents.delete(targetDocument);
16425 return;
16426 }
16427 runtime.documents.set(targetDocument, count - 1);
16428 };
16429 }
16430 function registerStyle6(hash, css) {
16431 const runtime = getRuntime6();
16432 runtime.styles.set(hash, css);
16433 for (const targetDocument of runtime.documents.keys()) {
16434 injectStyle6(targetDocument, hash, css);
16435 }
16436 }
16437 if (typeof process === "undefined" || true) {
16438 registerStyle6("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}');
16439 }
16440 var style_default5 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" };
16441 if (typeof process === "undefined" || true) {
16442 registerStyle6("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
16443 }
16444 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
16445 if (typeof process === "undefined" || true) {
16446 registerStyle6("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
16447 }
16448 var focus_module_default = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
16449 if (typeof process === "undefined" || true) {
16450 registerStyle6("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
16451 }
16452 var global_css_defense_default2 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
16453 var Button3 = (0, import_element25.forwardRef)(
16454 function Button22({
16455 tone = "brand",
16456 variant = "solid",
16457 size: size4 = "default",
16458 className,
16459 focusableWhenDisabled = true,
16460 disabled: disabled2,
16461 loading,
16462 loadingAnnouncement = (0, import_i18n3.__)("Loading"),
16463 children,
16464 ...props
16465 }, ref) {
16466 const mergedClassName = clsx_default(
16467 global_css_defense_default2.button,
16468 resets_default2["box-sizing"],
16469 focus_module_default["outset-ring--focus-except-active"],
16470 variant !== "unstyled" && style_default5.button,
16471 style_default5[`is-${tone}`],
16472 style_default5[`is-${variant}`],
16473 style_default5[`is-${size4}`],
16474 loading && style_default5["is-loading"],
16475 className
16476 );
16477 (0, import_element25.useEffect)(() => {
16478 if (loading && loadingAnnouncement) {
16479 speak(loadingAnnouncement);
16480 }
16481 }, [loading, loadingAnnouncement]);
16482 return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
16483 Button,
16484 {
16485 ref,
16486 className: mergedClassName,
16487 focusableWhenDisabled,
16488 disabled: disabled2 ?? loading,
16489 ...props,
16490 children
16491 }
16492 );
16493 }
16494 );
16495
16496 // packages/ui/build-module/button/icon.mjs
16497 var import_element26 = __toESM(require_element(), 1);
16498 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
16499 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash";
16500 function getRuntime7() {
16501 const globalScope = globalThis;
16502 if (globalScope.__wpStyleRuntime) {
16503 return globalScope.__wpStyleRuntime;
16504 }
16505 globalScope.__wpStyleRuntime = {
16506 documents: /* @__PURE__ */ new Map(),
16507 styles: /* @__PURE__ */ new Map(),
16508 injectedStyles: /* @__PURE__ */ new WeakMap()
16509 };
16510 if (typeof document !== "undefined") {
16511 registerDocument7(document);
16512 }
16513 return globalScope.__wpStyleRuntime;
16514 }
16515 function documentContainsStyleHash7(targetDocument, hash) {
16516 if (!targetDocument.head) {
16517 return false;
16518 }
16519 for (const style of targetDocument.head.querySelectorAll(
16520 `style[${STYLE_HASH_ATTRIBUTE7}]`
16521 )) {
16522 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) {
16523 return true;
16524 }
16525 }
16526 return false;
16527 }
16528 function injectStyle7(targetDocument, hash, css) {
16529 if (!targetDocument.head) {
16530 return;
16531 }
16532 const runtime = getRuntime7();
16533 let injectedStyles = runtime.injectedStyles.get(targetDocument);
16534 if (!injectedStyles) {
16535 injectedStyles = /* @__PURE__ */ new Set();
16536 runtime.injectedStyles.set(targetDocument, injectedStyles);
16537 }
16538 if (injectedStyles.has(hash)) {
16539 return;
16540 }
16541 if (documentContainsStyleHash7(targetDocument, hash)) {
16542 injectedStyles.add(hash);
16543 return;
16544 }
16545 const style = targetDocument.createElement("style");
16546 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash);
16547 style.appendChild(targetDocument.createTextNode(css));
16548 targetDocument.head.appendChild(style);
16549 injectedStyles.add(hash);
16550 }
16551 function registerDocument7(targetDocument) {
16552 const runtime = getRuntime7();
16553 runtime.documents.set(
16554 targetDocument,
16555 (runtime.documents.get(targetDocument) ?? 0) + 1
16556 );
16557 for (const [hash, css] of runtime.styles) {
16558 injectStyle7(targetDocument, hash, css);
16559 }
16560 return () => {
16561 const count = runtime.documents.get(targetDocument);
16562 if (count === void 0) {
16563 return;
16564 }
16565 if (count <= 1) {
16566 runtime.documents.delete(targetDocument);
16567 return;
16568 }
16569 runtime.documents.set(targetDocument, count - 1);
16570 };
16571 }
16572 function registerStyle7(hash, css) {
16573 const runtime = getRuntime7();
16574 runtime.styles.set(hash, css);
16575 for (const targetDocument of runtime.documents.keys()) {
16576 injectStyle7(targetDocument, hash, css);
16577 }
16578 }
16579 if (typeof process === "undefined" || true) {
16580 registerStyle7("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}');
16581 }
16582 var style_default6 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" };
16583 var ButtonIcon = (0, import_element26.forwardRef)(
16584 function ButtonIcon2({ className, icon, ...props }, ref) {
16585 return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
16586 Icon,
16587 {
16588 ref,
16589 icon,
16590 className: clsx_default(style_default6.icon, className),
16591 size: 24,
16592 ...props
16593 }
16594 );
16595 }
16596 );
16597
16598 // packages/ui/build-module/button/index.mjs
16599 ButtonIcon.displayName = "Button.Icon";
16600 var Button4 = Object.assign(Button3, {
16601 /**
16602 * An icon component specifically designed to work well when rendered inside
16603 * a `Button` component.
16604 */
16605 Icon: ButtonIcon
16606 });
16607
16608 // packages/ui/build-module/icon-button/icon-button.mjs
16609 var import_element27 = __toESM(require_element(), 1);
16610 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
16611 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash";
16612 function getRuntime8() {
16613 const globalScope = globalThis;
16614 if (globalScope.__wpStyleRuntime) {
16615 return globalScope.__wpStyleRuntime;
16616 }
16617 globalScope.__wpStyleRuntime = {
16618 documents: /* @__PURE__ */ new Map(),
16619 styles: /* @__PURE__ */ new Map(),
16620 injectedStyles: /* @__PURE__ */ new WeakMap()
16621 };
16622 if (typeof document !== "undefined") {
16623 registerDocument8(document);
16624 }
16625 return globalScope.__wpStyleRuntime;
16626 }
16627 function documentContainsStyleHash8(targetDocument, hash) {
16628 if (!targetDocument.head) {
16629 return false;
16630 }
16631 for (const style of targetDocument.head.querySelectorAll(
16632 `style[${STYLE_HASH_ATTRIBUTE8}]`
16633 )) {
16634 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) {
16635 return true;
16636 }
16637 }
16638 return false;
16639 }
16640 function injectStyle8(targetDocument, hash, css) {
16641 if (!targetDocument.head) {
16642 return;
16643 }
16644 const runtime = getRuntime8();
16645 let injectedStyles = runtime.injectedStyles.get(targetDocument);
16646 if (!injectedStyles) {
16647 injectedStyles = /* @__PURE__ */ new Set();
16648 runtime.injectedStyles.set(targetDocument, injectedStyles);
16649 }
16650 if (injectedStyles.has(hash)) {
16651 return;
16652 }
16653 if (documentContainsStyleHash8(targetDocument, hash)) {
16654 injectedStyles.add(hash);
16655 return;
16656 }
16657 const style = targetDocument.createElement("style");
16658 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash);
16659 style.appendChild(targetDocument.createTextNode(css));
16660 targetDocument.head.appendChild(style);
16661 injectedStyles.add(hash);
16662 }
16663 function registerDocument8(targetDocument) {
16664 const runtime = getRuntime8();
16665 runtime.documents.set(
16666 targetDocument,
16667 (runtime.documents.get(targetDocument) ?? 0) + 1
16668 );
16669 for (const [hash, css] of runtime.styles) {
16670 injectStyle8(targetDocument, hash, css);
16671 }
16672 return () => {
16673 const count = runtime.documents.get(targetDocument);
16674 if (count === void 0) {
16675 return;
16676 }
16677 if (count <= 1) {
16678 runtime.documents.delete(targetDocument);
16679 return;
16680 }
16681 runtime.documents.set(targetDocument, count - 1);
16682 };
16683 }
16684 function registerStyle8(hash, css) {
16685 const runtime = getRuntime8();
16686 runtime.styles.set(hash, css);
16687 for (const targetDocument of runtime.documents.keys()) {
16688 injectStyle8(targetDocument, hash, css);
16689 }
16690 }
16691 if (typeof process === "undefined" || true) {
16692 registerStyle8("c5cdafb1bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0px;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}}");
16693 }
16694 var style_default7 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" };
16695 var IconButton = (0, import_element27.forwardRef)(
16696 function IconButton2({
16697 label,
16698 className,
16699 // Prevent accidental forwarding of `children`
16700 children: _children,
16701 disabled: disabled2,
16702 focusableWhenDisabled = true,
16703 icon,
16704 size: size4,
16705 shortcut,
16706 positioner,
16707 "aria-describedby": ariaDescribedBy,
16708 "aria-keyshortcuts": ariaKeyShortcuts,
16709 ...restProps
16710 }, ref) {
16711 const classes = clsx_default(style_default7["icon-button"], className);
16712 const { descriptionId, targetProps } = useKeyboardShortcutProps({
16713 "aria-describedby": ariaDescribedBy,
16714 "aria-keyshortcuts": ariaKeyShortcuts,
16715 shortcut
16716 });
16717 return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Root, { children: [
16718 /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
16719 Trigger,
16720 {
16721 ref,
16722 ...targetProps,
16723 disabled: disabled2 && !focusableWhenDisabled,
16724 render: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
16725 Button4,
16726 {
16727 ...restProps,
16728 size: size4,
16729 "aria-label": label,
16730 disabled: disabled2,
16731 focusableWhenDisabled
16732 }
16733 ),
16734 className: classes,
16735 children: [
16736 /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { icon, size: 24, className: style_default7.icon }),
16737 shortcut && descriptionId && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
16738 KeyboardShortcutDescription,
16739 {
16740 descriptionId,
16741 shortcut
16742 }
16743 )
16744 ]
16745 }
16746 ),
16747 /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Popup, { positioner, children: [
16748 label,
16749 shortcut && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
16750 " ",
16751 /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(KeyboardShortcutDisplay, { shortcut })
16752 ] })
16753 ] })
16754 ] });
16755 }
16756 );
16757
16758 // packages/ui/build-module/form/primitives/autocomplete/index.mjs
16759 var autocomplete_exports = {};
16760 __export(autocomplete_exports, {
16761 Clear: () => Clear,
16762 Collection: () => Collection,
16763 Empty: () => Empty,
16764 Group: () => Group,
16765 GroupLabel: () => GroupLabel,
16766 Input: () => Input4,
16767 InputGroup: () => InputGroup,
16768 Item: () => Item,
16769 List: () => List,
16770 ListBody: () => ListBody,
16771 Popup: () => Popup2,
16772 Portal: () => Portal2,
16773 Positioner: () => Positioner2,
16774 Root: () => Root2,
16775 Row: () => Row,
16776 Status: () => Status,
16777 Value: () => Value
16778 });
16779
16780 // packages/ui/build-module/form/primitives/autocomplete/clear.mjs
16781 var import_element28 = __toESM(require_element(), 1);
16782 var import_i18n4 = __toESM(require_i18n(), 1);
16783 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
16784 var DEFAULT_RENDER = ({
16785 "aria-label": ariaLabel = (0, import_i18n4.__)("Clear"),
16786 ...props
16787 }, { disabled: disabled2 }) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
16788 IconButton,
16789 {
16790 icon: close_small_default,
16791 focusableWhenDisabled: false,
16792 disabled: disabled2,
16793 "aria-hidden": disabled2 || void 0,
16794 size: "small",
16795 variant: "minimal",
16796 tone: "neutral",
16797 label: ariaLabel,
16798 ...props
16799 }
16800 );
16801 var Clear = (0, import_element28.forwardRef)(
16802 function Clear2({ render = DEFAULT_RENDER, ...restProps }, ref) {
16803 return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
16804 index_parts_exports.Clear,
16805 {
16806 ref,
16807 render,
16808 ...restProps
16809 }
16810 );
16811 }
16812 );
16813
16814 // packages/ui/build-module/form/primitives/autocomplete/collection.mjs
16815 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
16816 function Collection({
16817 children,
16818 ...restProps
16819 }) {
16820 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(index_parts_exports.Collection, { ...restProps, children });
16821 }
16822
16823 // packages/ui/build-module/form/primitives/autocomplete/empty.mjs
16824 var import_element29 = __toESM(require_element(), 1);
16825 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
16826 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash";
16827 function getRuntime9() {
16828 const globalScope = globalThis;
16829 if (globalScope.__wpStyleRuntime) {
16830 return globalScope.__wpStyleRuntime;
16831 }
16832 globalScope.__wpStyleRuntime = {
16833 documents: /* @__PURE__ */ new Map(),
16834 styles: /* @__PURE__ */ new Map(),
16835 injectedStyles: /* @__PURE__ */ new WeakMap()
16836 };
16837 if (typeof document !== "undefined") {
16838 registerDocument9(document);
16839 }
16840 return globalScope.__wpStyleRuntime;
16841 }
16842 function documentContainsStyleHash9(targetDocument, hash) {
16843 if (!targetDocument.head) {
16844 return false;
16845 }
16846 for (const style of targetDocument.head.querySelectorAll(
16847 `style[${STYLE_HASH_ATTRIBUTE9}]`
16848 )) {
16849 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) {
16850 return true;
16851 }
16852 }
16853 return false;
16854 }
16855 function injectStyle9(targetDocument, hash, css) {
16856 if (!targetDocument.head) {
16857 return;
16858 }
16859 const runtime = getRuntime9();
16860 let injectedStyles = runtime.injectedStyles.get(targetDocument);
16861 if (!injectedStyles) {
16862 injectedStyles = /* @__PURE__ */ new Set();
16863 runtime.injectedStyles.set(targetDocument, injectedStyles);
16864 }
16865 if (injectedStyles.has(hash)) {
16866 return;
16867 }
16868 if (documentContainsStyleHash9(targetDocument, hash)) {
16869 injectedStyles.add(hash);
16870 return;
16871 }
16872 const style = targetDocument.createElement("style");
16873 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash);
16874 style.appendChild(targetDocument.createTextNode(css));
16875 targetDocument.head.appendChild(style);
16876 injectedStyles.add(hash);
16877 }
16878 function registerDocument9(targetDocument) {
16879 const runtime = getRuntime9();
16880 runtime.documents.set(
16881 targetDocument,
16882 (runtime.documents.get(targetDocument) ?? 0) + 1
16883 );
16884 for (const [hash, css] of runtime.styles) {
16885 injectStyle9(targetDocument, hash, css);
16886 }
16887 return () => {
16888 const count = runtime.documents.get(targetDocument);
16889 if (count === void 0) {
16890 return;
16891 }
16892 if (count <= 1) {
16893 runtime.documents.delete(targetDocument);
16894 return;
16895 }
16896 runtime.documents.set(targetDocument, count - 1);
16897 };
16898 }
16899 function registerStyle9(hash, css) {
16900 const runtime = getRuntime9();
16901 runtime.styles.set(hash, css);
16902 for (const targetDocument of runtime.documents.keys()) {
16903 injectStyle9(targetDocument, hash, css);
16904 }
16905 }
16906 if (typeof process === "undefined" || true) {
16907 registerStyle9("02571d1b6c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}');
16908 }
16909 var item_popup_default = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" };
16910 var Empty = (0, import_element29.forwardRef)(
16911 function Empty2({ className, ...restProps }, ref) {
16912 return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
16913 index_parts_exports.Empty,
16914 {
16915 className: clsx_default(item_popup_default.empty, className),
16916 ref,
16917 ...restProps
16918 }
16919 );
16920 }
16921 );
16922
16923 // packages/ui/build-module/form/primitives/autocomplete/group.mjs
16924 var import_element30 = __toESM(require_element(), 1);
16925 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
16926 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash";
16927 function getRuntime10() {
16928 const globalScope = globalThis;
16929 if (globalScope.__wpStyleRuntime) {
16930 return globalScope.__wpStyleRuntime;
16931 }
16932 globalScope.__wpStyleRuntime = {
16933 documents: /* @__PURE__ */ new Map(),
16934 styles: /* @__PURE__ */ new Map(),
16935 injectedStyles: /* @__PURE__ */ new WeakMap()
16936 };
16937 if (typeof document !== "undefined") {
16938 registerDocument10(document);
16939 }
16940 return globalScope.__wpStyleRuntime;
16941 }
16942 function documentContainsStyleHash10(targetDocument, hash) {
16943 if (!targetDocument.head) {
16944 return false;
16945 }
16946 for (const style of targetDocument.head.querySelectorAll(
16947 `style[${STYLE_HASH_ATTRIBUTE10}]`
16948 )) {
16949 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) {
16950 return true;
16951 }
16952 }
16953 return false;
16954 }
16955 function injectStyle10(targetDocument, hash, css) {
16956 if (!targetDocument.head) {
16957 return;
16958 }
16959 const runtime = getRuntime10();
16960 let injectedStyles = runtime.injectedStyles.get(targetDocument);
16961 if (!injectedStyles) {
16962 injectedStyles = /* @__PURE__ */ new Set();
16963 runtime.injectedStyles.set(targetDocument, injectedStyles);
16964 }
16965 if (injectedStyles.has(hash)) {
16966 return;
16967 }
16968 if (documentContainsStyleHash10(targetDocument, hash)) {
16969 injectedStyles.add(hash);
16970 return;
16971 }
16972 const style = targetDocument.createElement("style");
16973 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash);
16974 style.appendChild(targetDocument.createTextNode(css));
16975 targetDocument.head.appendChild(style);
16976 injectedStyles.add(hash);
16977 }
16978 function registerDocument10(targetDocument) {
16979 const runtime = getRuntime10();
16980 runtime.documents.set(
16981 targetDocument,
16982 (runtime.documents.get(targetDocument) ?? 0) + 1
16983 );
16984 for (const [hash, css] of runtime.styles) {
16985 injectStyle10(targetDocument, hash, css);
16986 }
16987 return () => {
16988 const count = runtime.documents.get(targetDocument);
16989 if (count === void 0) {
16990 return;
16991 }
16992 if (count <= 1) {
16993 runtime.documents.delete(targetDocument);
16994 return;
16995 }
16996 runtime.documents.set(targetDocument, count - 1);
16997 };
16998 }
16999 function registerStyle10(hash, css) {
17000 const runtime = getRuntime10();
17001 runtime.styles.set(hash, css);
17002 for (const targetDocument of runtime.documents.keys()) {
17003 injectStyle10(targetDocument, hash, css);
17004 }
17005 }
17006 if (typeof process === "undefined" || true) {
17007 registerStyle10("02571d1b6c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}');
17008 }
17009 var item_popup_default2 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" };
17010 var Group = (0, import_element30.forwardRef)(
17011 function Group2({ className, children, ...restProps }, ref) {
17012 return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
17013 index_parts_exports.Group,
17014 {
17015 className: clsx_default(item_popup_default2.group, className),
17016 ref,
17017 ...restProps,
17018 children
17019 }
17020 );
17021 }
17022 );
17023
17024 // packages/ui/build-module/form/primitives/autocomplete/group-label.mjs
17025 var import_element31 = __toESM(require_element(), 1);
17026 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
17027 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash";
17028 function getRuntime11() {
17029 const globalScope = globalThis;
17030 if (globalScope.__wpStyleRuntime) {
17031 return globalScope.__wpStyleRuntime;
17032 }
17033 globalScope.__wpStyleRuntime = {
17034 documents: /* @__PURE__ */ new Map(),
17035 styles: /* @__PURE__ */ new Map(),
17036 injectedStyles: /* @__PURE__ */ new WeakMap()
17037 };
17038 if (typeof document !== "undefined") {
17039 registerDocument11(document);
17040 }
17041 return globalScope.__wpStyleRuntime;
17042 }
17043 function documentContainsStyleHash11(targetDocument, hash) {
17044 if (!targetDocument.head) {
17045 return false;
17046 }
17047 for (const style of targetDocument.head.querySelectorAll(
17048 `style[${STYLE_HASH_ATTRIBUTE11}]`
17049 )) {
17050 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) {
17051 return true;
17052 }
17053 }
17054 return false;
17055 }
17056 function injectStyle11(targetDocument, hash, css) {
17057 if (!targetDocument.head) {
17058 return;
17059 }
17060 const runtime = getRuntime11();
17061 let injectedStyles = runtime.injectedStyles.get(targetDocument);
17062 if (!injectedStyles) {
17063 injectedStyles = /* @__PURE__ */ new Set();
17064 runtime.injectedStyles.set(targetDocument, injectedStyles);
17065 }
17066 if (injectedStyles.has(hash)) {
17067 return;
17068 }
17069 if (documentContainsStyleHash11(targetDocument, hash)) {
17070 injectedStyles.add(hash);
17071 return;
17072 }
17073 const style = targetDocument.createElement("style");
17074 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash);
17075 style.appendChild(targetDocument.createTextNode(css));
17076 targetDocument.head.appendChild(style);
17077 injectedStyles.add(hash);
17078 }
17079 function registerDocument11(targetDocument) {
17080 const runtime = getRuntime11();
17081 runtime.documents.set(
17082 targetDocument,
17083 (runtime.documents.get(targetDocument) ?? 0) + 1
17084 );
17085 for (const [hash, css] of runtime.styles) {
17086 injectStyle11(targetDocument, hash, css);
17087 }
17088 return () => {
17089 const count = runtime.documents.get(targetDocument);
17090 if (count === void 0) {
17091 return;
17092 }
17093 if (count <= 1) {
17094 runtime.documents.delete(targetDocument);
17095 return;
17096 }
17097 runtime.documents.set(targetDocument, count - 1);
17098 };
17099 }
17100 function registerStyle11(hash, css) {
17101 const runtime = getRuntime11();
17102 runtime.styles.set(hash, css);
17103 for (const targetDocument of runtime.documents.keys()) {
17104 injectStyle11(targetDocument, hash, css);
17105 }
17106 }
17107 if (typeof process === "undefined" || true) {
17108 registerStyle11("02571d1b6c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}');
17109 }
17110 var item_popup_default3 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" };
17111 var GroupLabel = (0, import_element31.forwardRef)(function GroupLabel2({ className, children, ...restProps }, ref) {
17112 return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
17113 Text,
17114 {
17115 variant: "heading-sm",
17116 className: clsx_default(item_popup_default3["group-label"], className),
17117 render: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(index_parts_exports.GroupLabel, { ref, ...restProps }),
17118 children
17119 }
17120 );
17121 });
17122
17123 // packages/ui/build-module/form/primitives/autocomplete/input-group.mjs
17124 var import_element32 = __toESM(require_element(), 1);
17125 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
17126 var InputGroup = (0, import_element32.forwardRef)(function InputGroup2(props, ref) {
17127 return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(index_parts_exports.InputGroup, { ref, ...props });
17128 });
17129
17130 // packages/ui/build-module/form/primitives/autocomplete/input.mjs
17131 var import_element36 = __toESM(require_element(), 1);
17132
17133 // packages/ui/build-module/form/primitives/input/input.mjs
17134 var import_element35 = __toESM(require_element(), 1);
17135
17136 // packages/ui/build-module/form/primitives/input-layout/input-layout.mjs
17137 var import_element33 = __toESM(require_element(), 1);
17138 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
17139 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash";
17140 function getRuntime12() {
17141 const globalScope = globalThis;
17142 if (globalScope.__wpStyleRuntime) {
17143 return globalScope.__wpStyleRuntime;
17144 }
17145 globalScope.__wpStyleRuntime = {
17146 documents: /* @__PURE__ */ new Map(),
17147 styles: /* @__PURE__ */ new Map(),
17148 injectedStyles: /* @__PURE__ */ new WeakMap()
17149 };
17150 if (typeof document !== "undefined") {
17151 registerDocument12(document);
17152 }
17153 return globalScope.__wpStyleRuntime;
17154 }
17155 function documentContainsStyleHash12(targetDocument, hash) {
17156 if (!targetDocument.head) {
17157 return false;
17158 }
17159 for (const style of targetDocument.head.querySelectorAll(
17160 `style[${STYLE_HASH_ATTRIBUTE12}]`
17161 )) {
17162 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) {
17163 return true;
17164 }
17165 }
17166 return false;
17167 }
17168 function injectStyle12(targetDocument, hash, css) {
17169 if (!targetDocument.head) {
17170 return;
17171 }
17172 const runtime = getRuntime12();
17173 let injectedStyles = runtime.injectedStyles.get(targetDocument);
17174 if (!injectedStyles) {
17175 injectedStyles = /* @__PURE__ */ new Set();
17176 runtime.injectedStyles.set(targetDocument, injectedStyles);
17177 }
17178 if (injectedStyles.has(hash)) {
17179 return;
17180 }
17181 if (documentContainsStyleHash12(targetDocument, hash)) {
17182 injectedStyles.add(hash);
17183 return;
17184 }
17185 const style = targetDocument.createElement("style");
17186 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash);
17187 style.appendChild(targetDocument.createTextNode(css));
17188 targetDocument.head.appendChild(style);
17189 injectedStyles.add(hash);
17190 }
17191 function registerDocument12(targetDocument) {
17192 const runtime = getRuntime12();
17193 runtime.documents.set(
17194 targetDocument,
17195 (runtime.documents.get(targetDocument) ?? 0) + 1
17196 );
17197 for (const [hash, css] of runtime.styles) {
17198 injectStyle12(targetDocument, hash, css);
17199 }
17200 return () => {
17201 const count = runtime.documents.get(targetDocument);
17202 if (count === void 0) {
17203 return;
17204 }
17205 if (count <= 1) {
17206 runtime.documents.delete(targetDocument);
17207 return;
17208 }
17209 runtime.documents.set(targetDocument, count - 1);
17210 };
17211 }
17212 function registerStyle12(hash, css) {
17213 const runtime = getRuntime12();
17214 runtime.styles.set(hash, css);
17215 for (const targetDocument of runtime.documents.keys()) {
17216 injectStyle12(targetDocument, hash, css);
17217 }
17218 }
17219 if (typeof process === "undefined" || true) {
17220 registerStyle12("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
17221 }
17222 var global_css_defense_default3 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
17223 if (typeof process === "undefined" || true) {
17224 registerStyle12("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
17225 }
17226 var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
17227 if (typeof process === "undefined" || true) {
17228 registerStyle12("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}');
17229 }
17230 var style_default8 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" };
17231 var InputLayout = (0, import_element33.forwardRef)(
17232 function InputLayout2({
17233 className,
17234 children,
17235 visuallyDisabled,
17236 size: size4 = "default",
17237 isBorderless,
17238 prefix,
17239 suffix,
17240 ...restProps
17241 }, ref) {
17242 return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
17243 "div",
17244 {
17245 ref,
17246 className: clsx_default(
17247 global_css_defense_default3.div,
17248 resets_default3["box-sizing"],
17249 style_default8["input-layout"],
17250 style_default8[`is-size-${size4}`],
17251 visuallyDisabled && style_default8["is-disabled"],
17252 isBorderless && style_default8["is-borderless"],
17253 className
17254 ),
17255 ...restProps,
17256 children: [
17257 import_element33.Children.count(prefix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
17258 "div",
17259 {
17260 className: style_default8["slot-wrapper"],
17261 "data-slot-type": "prefix",
17262 children: prefix
17263 }
17264 ),
17265 children,
17266 import_element33.Children.count(suffix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
17267 "div",
17268 {
17269 className: style_default8["slot-wrapper"],
17270 "data-slot-type": "suffix",
17271 children: suffix
17272 }
17273 )
17274 ]
17275 }
17276 );
17277 }
17278 );
17279
17280 // packages/ui/build-module/form/primitives/input-layout/slot.mjs
17281 var import_element34 = __toESM(require_element(), 1);
17282 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
17283 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash";
17284 function getRuntime13() {
17285 const globalScope = globalThis;
17286 if (globalScope.__wpStyleRuntime) {
17287 return globalScope.__wpStyleRuntime;
17288 }
17289 globalScope.__wpStyleRuntime = {
17290 documents: /* @__PURE__ */ new Map(),
17291 styles: /* @__PURE__ */ new Map(),
17292 injectedStyles: /* @__PURE__ */ new WeakMap()
17293 };
17294 if (typeof document !== "undefined") {
17295 registerDocument13(document);
17296 }
17297 return globalScope.__wpStyleRuntime;
17298 }
17299 function documentContainsStyleHash13(targetDocument, hash) {
17300 if (!targetDocument.head) {
17301 return false;
17302 }
17303 for (const style of targetDocument.head.querySelectorAll(
17304 `style[${STYLE_HASH_ATTRIBUTE13}]`
17305 )) {
17306 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) {
17307 return true;
17308 }
17309 }
17310 return false;
17311 }
17312 function injectStyle13(targetDocument, hash, css) {
17313 if (!targetDocument.head) {
17314 return;
17315 }
17316 const runtime = getRuntime13();
17317 let injectedStyles = runtime.injectedStyles.get(targetDocument);
17318 if (!injectedStyles) {
17319 injectedStyles = /* @__PURE__ */ new Set();
17320 runtime.injectedStyles.set(targetDocument, injectedStyles);
17321 }
17322 if (injectedStyles.has(hash)) {
17323 return;
17324 }
17325 if (documentContainsStyleHash13(targetDocument, hash)) {
17326 injectedStyles.add(hash);
17327 return;
17328 }
17329 const style = targetDocument.createElement("style");
17330 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash);
17331 style.appendChild(targetDocument.createTextNode(css));
17332 targetDocument.head.appendChild(style);
17333 injectedStyles.add(hash);
17334 }
17335 function registerDocument13(targetDocument) {
17336 const runtime = getRuntime13();
17337 runtime.documents.set(
17338 targetDocument,
17339 (runtime.documents.get(targetDocument) ?? 0) + 1
17340 );
17341 for (const [hash, css] of runtime.styles) {
17342 injectStyle13(targetDocument, hash, css);
17343 }
17344 return () => {
17345 const count = runtime.documents.get(targetDocument);
17346 if (count === void 0) {
17347 return;
17348 }
17349 if (count <= 1) {
17350 runtime.documents.delete(targetDocument);
17351 return;
17352 }
17353 runtime.documents.set(targetDocument, count - 1);
17354 };
17355 }
17356 function registerStyle13(hash, css) {
17357 const runtime = getRuntime13();
17358 runtime.styles.set(hash, css);
17359 for (const targetDocument of runtime.documents.keys()) {
17360 injectStyle13(targetDocument, hash, css);
17361 }
17362 }
17363 if (typeof process === "undefined" || true) {
17364 registerStyle13("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}');
17365 }
17366 var style_default9 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" };
17367 var InputLayoutSlot = (0, import_element34.forwardRef)(function InputLayoutSlot2({ padding = "default", className, ...restProps }, ref) {
17368 return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
17369 "div",
17370 {
17371 ref,
17372 className: clsx_default(
17373 style_default9["input-layout-slot"],
17374 style_default9[`is-padding-${padding}`],
17375 className
17376 ),
17377 ...restProps
17378 }
17379 );
17380 });
17381 InputLayoutSlot.displayName = "InputLayout.Slot";
17382
17383 // packages/ui/build-module/form/primitives/input-layout/index.mjs
17384 var InputLayout3 = Object.assign(InputLayout, {
17385 Slot: InputLayoutSlot
17386 });
17387
17388 // packages/ui/build-module/form/primitives/input/input.mjs
17389 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
17390 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash";
17391 function getRuntime14() {
17392 const globalScope = globalThis;
17393 if (globalScope.__wpStyleRuntime) {
17394 return globalScope.__wpStyleRuntime;
17395 }
17396 globalScope.__wpStyleRuntime = {
17397 documents: /* @__PURE__ */ new Map(),
17398 styles: /* @__PURE__ */ new Map(),
17399 injectedStyles: /* @__PURE__ */ new WeakMap()
17400 };
17401 if (typeof document !== "undefined") {
17402 registerDocument14(document);
17403 }
17404 return globalScope.__wpStyleRuntime;
17405 }
17406 function documentContainsStyleHash14(targetDocument, hash) {
17407 if (!targetDocument.head) {
17408 return false;
17409 }
17410 for (const style of targetDocument.head.querySelectorAll(
17411 `style[${STYLE_HASH_ATTRIBUTE14}]`
17412 )) {
17413 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) {
17414 return true;
17415 }
17416 }
17417 return false;
17418 }
17419 function injectStyle14(targetDocument, hash, css) {
17420 if (!targetDocument.head) {
17421 return;
17422 }
17423 const runtime = getRuntime14();
17424 let injectedStyles = runtime.injectedStyles.get(targetDocument);
17425 if (!injectedStyles) {
17426 injectedStyles = /* @__PURE__ */ new Set();
17427 runtime.injectedStyles.set(targetDocument, injectedStyles);
17428 }
17429 if (injectedStyles.has(hash)) {
17430 return;
17431 }
17432 if (documentContainsStyleHash14(targetDocument, hash)) {
17433 injectedStyles.add(hash);
17434 return;
17435 }
17436 const style = targetDocument.createElement("style");
17437 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash);
17438 style.appendChild(targetDocument.createTextNode(css));
17439 targetDocument.head.appendChild(style);
17440 injectedStyles.add(hash);
17441 }
17442 function registerDocument14(targetDocument) {
17443 const runtime = getRuntime14();
17444 runtime.documents.set(
17445 targetDocument,
17446 (runtime.documents.get(targetDocument) ?? 0) + 1
17447 );
17448 for (const [hash, css] of runtime.styles) {
17449 injectStyle14(targetDocument, hash, css);
17450 }
17451 return () => {
17452 const count = runtime.documents.get(targetDocument);
17453 if (count === void 0) {
17454 return;
17455 }
17456 if (count <= 1) {
17457 runtime.documents.delete(targetDocument);
17458 return;
17459 }
17460 runtime.documents.set(targetDocument, count - 1);
17461 };
17462 }
17463 function registerStyle14(hash, css) {
17464 const runtime = getRuntime14();
17465 runtime.styles.set(hash, css);
17466 for (const targetDocument of runtime.documents.keys()) {
17467 injectStyle14(targetDocument, hash, css);
17468 }
17469 }
17470 if (typeof process === "undefined" || true) {
17471 registerStyle14("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
17472 }
17473 var global_css_defense_default4 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
17474 if (typeof process === "undefined" || true) {
17475 registerStyle14("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
17476 }
17477 var focus_module_default2 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
17478 if (typeof process === "undefined" || true) {
17479 registerStyle14("1a25f6a232", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2ae7be2fc1bb17a3__input{--_gcd-input-padding:var(--wp-ui-input-padding-block,0px) var(--wp-ui-input-layout-padding-inline,0px);background:transparent;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:inherit;font-size:inherit;line-height:inherit;outline:none;padding-block:var(--wp-ui-input-padding-block,0);padding-inline:var(--wp-ui-input-layout-padding-inline,0);width:100%;&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}&:disabled,&[aria-disabled=true]{--_gcd-input-placeholder-color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}@media (forced-colors:active){color:GrayText}}&[type=email],&[type=url]{direction:ltr}&[type=number]{appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{appearance:none;margin:0}}}}}");
17480 }
17481 var style_default10 = { "input": "_2ae7be2fc1bb17a3__input" };
17482 var Input3 = (0, import_element35.forwardRef)(function Input22({ className, size: size4 = "default", prefix, suffix, style, ...restProps }, ref) {
17483 return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
17484 InputLayout3,
17485 {
17486 className: clsx_default(
17487 focus_module_default2["outset-ring--focus-within"],
17488 className
17489 ),
17490 style,
17491 size: size4,
17492 visuallyDisabled: restProps.disabled,
17493 prefix,
17494 suffix,
17495 children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
17496 Input,
17497 {
17498 ref,
17499 className: clsx_default(global_css_defense_default4.input, style_default10.input),
17500 ...restProps
17501 }
17502 )
17503 }
17504 );
17505 });
17506
17507 // packages/ui/build-module/form/primitives/autocomplete/input.mjs
17508 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
17509 var DEFAULT_RENDER2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Input3, { ...props });
17510 var Input4 = (0, import_element36.forwardRef)(
17511 function Input23({ render = DEFAULT_RENDER2, ...restProps }, ref) {
17512 return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
17513 index_parts_exports.Input,
17514 {
17515 ref,
17516 render,
17517 ...restProps
17518 }
17519 );
17520 }
17521 );
17522
17523 // packages/ui/build-module/form/primitives/autocomplete/item.mjs
17524 var import_element37 = __toESM(require_element(), 1);
17525 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
17526 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash";
17527 function getRuntime15() {
17528 const globalScope = globalThis;
17529 if (globalScope.__wpStyleRuntime) {
17530 return globalScope.__wpStyleRuntime;
17531 }
17532 globalScope.__wpStyleRuntime = {
17533 documents: /* @__PURE__ */ new Map(),
17534 styles: /* @__PURE__ */ new Map(),
17535 injectedStyles: /* @__PURE__ */ new WeakMap()
17536 };
17537 if (typeof document !== "undefined") {
17538 registerDocument15(document);
17539 }
17540 return globalScope.__wpStyleRuntime;
17541 }
17542 function documentContainsStyleHash15(targetDocument, hash) {
17543 if (!targetDocument.head) {
17544 return false;
17545 }
17546 for (const style of targetDocument.head.querySelectorAll(
17547 `style[${STYLE_HASH_ATTRIBUTE15}]`
17548 )) {
17549 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) {
17550 return true;
17551 }
17552 }
17553 return false;
17554 }
17555 function injectStyle15(targetDocument, hash, css) {
17556 if (!targetDocument.head) {
17557 return;
17558 }
17559 const runtime = getRuntime15();
17560 let injectedStyles = runtime.injectedStyles.get(targetDocument);
17561 if (!injectedStyles) {
17562 injectedStyles = /* @__PURE__ */ new Set();
17563 runtime.injectedStyles.set(targetDocument, injectedStyles);
17564 }
17565 if (injectedStyles.has(hash)) {
17566 return;
17567 }
17568 if (documentContainsStyleHash15(targetDocument, hash)) {
17569 injectedStyles.add(hash);
17570 return;
17571 }
17572 const style = targetDocument.createElement("style");
17573 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash);
17574 style.appendChild(targetDocument.createTextNode(css));
17575 targetDocument.head.appendChild(style);
17576 injectedStyles.add(hash);
17577 }
17578 function registerDocument15(targetDocument) {
17579 const runtime = getRuntime15();
17580 runtime.documents.set(
17581 targetDocument,
17582 (runtime.documents.get(targetDocument) ?? 0) + 1
17583 );
17584 for (const [hash, css] of runtime.styles) {
17585 injectStyle15(targetDocument, hash, css);
17586 }
17587 return () => {
17588 const count = runtime.documents.get(targetDocument);
17589 if (count === void 0) {
17590 return;
17591 }
17592 if (count <= 1) {
17593 runtime.documents.delete(targetDocument);
17594 return;
17595 }
17596 runtime.documents.set(targetDocument, count - 1);
17597 };
17598 }
17599 function registerStyle15(hash, css) {
17600 const runtime = getRuntime15();
17601 runtime.styles.set(hash, css);
17602 for (const targetDocument of runtime.documents.keys()) {
17603 injectStyle15(targetDocument, hash, css);
17604 }
17605 }
17606 if (typeof process === "undefined" || true) {
17607 registerStyle15("02571d1b6c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}');
17608 }
17609 var item_popup_default4 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" };
17610 if (typeof process === "undefined" || true) {
17611 registerStyle15("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
17612 }
17613 var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
17614 var Item = (0, import_element37.forwardRef)(
17615 function Item2({ className, children, ...restProps }, ref) {
17616 return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
17617 index_parts_exports.Item,
17618 {
17619 className: clsx_default(
17620 resets_default4["box-sizing"],
17621 item_popup_default4.item,
17622 className
17623 ),
17624 ref,
17625 ...restProps,
17626 children
17627 }
17628 );
17629 }
17630 );
17631
17632 // packages/ui/build-module/form/primitives/autocomplete/list.mjs
17633 var import_element38 = __toESM(require_element(), 1);
17634 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
17635 var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash";
17636 function getRuntime16() {
17637 const globalScope = globalThis;
17638 if (globalScope.__wpStyleRuntime) {
17639 return globalScope.__wpStyleRuntime;
17640 }
17641 globalScope.__wpStyleRuntime = {
17642 documents: /* @__PURE__ */ new Map(),
17643 styles: /* @__PURE__ */ new Map(),
17644 injectedStyles: /* @__PURE__ */ new WeakMap()
17645 };
17646 if (typeof document !== "undefined") {
17647 registerDocument16(document);
17648 }
17649 return globalScope.__wpStyleRuntime;
17650 }
17651 function documentContainsStyleHash16(targetDocument, hash) {
17652 if (!targetDocument.head) {
17653 return false;
17654 }
17655 for (const style of targetDocument.head.querySelectorAll(
17656 `style[${STYLE_HASH_ATTRIBUTE16}]`
17657 )) {
17658 if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) {
17659 return true;
17660 }
17661 }
17662 return false;
17663 }
17664 function injectStyle16(targetDocument, hash, css) {
17665 if (!targetDocument.head) {
17666 return;
17667 }
17668 const runtime = getRuntime16();
17669 let injectedStyles = runtime.injectedStyles.get(targetDocument);
17670 if (!injectedStyles) {
17671 injectedStyles = /* @__PURE__ */ new Set();
17672 runtime.injectedStyles.set(targetDocument, injectedStyles);
17673 }
17674 if (injectedStyles.has(hash)) {
17675 return;
17676 }
17677 if (documentContainsStyleHash16(targetDocument, hash)) {
17678 injectedStyles.add(hash);
17679 return;
17680 }
17681 const style = targetDocument.createElement("style");
17682 style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash);
17683 style.appendChild(targetDocument.createTextNode(css));
17684 targetDocument.head.appendChild(style);
17685 injectedStyles.add(hash);
17686 }
17687 function registerDocument16(targetDocument) {
17688 const runtime = getRuntime16();
17689 runtime.documents.set(
17690 targetDocument,
17691 (runtime.documents.get(targetDocument) ?? 0) + 1
17692 );
17693 for (const [hash, css] of runtime.styles) {
17694 injectStyle16(targetDocument, hash, css);
17695 }
17696 return () => {
17697 const count = runtime.documents.get(targetDocument);
17698 if (count === void 0) {
17699 return;
17700 }
17701 if (count <= 1) {
17702 runtime.documents.delete(targetDocument);
17703 return;
17704 }
17705 runtime.documents.set(targetDocument, count - 1);
17706 };
17707 }
17708 function registerStyle16(hash, css) {
17709 const runtime = getRuntime16();
17710 runtime.styles.set(hash, css);
17711 for (const targetDocument of runtime.documents.keys()) {
17712 injectStyle16(targetDocument, hash, css);
17713 }
17714 }
17715 if (typeof process === "undefined" || true) {
17716 registerStyle16("02571d1b6c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}');
17717 }
17718 var item_popup_default5 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" };
17719 var List = (0, import_element38.forwardRef)(
17720 function List2({ className, ...restProps }, ref) {
17721 return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
17722 index_parts_exports.List,
17723 {
17724 className: clsx_default(item_popup_default5.list, className),
17725 ref,
17726 ...restProps,
17727 "aria-orientation": void 0
17728 }
17729 );
17730 }
17731 );
17732
17733 // packages/ui/build-module/form/primitives/autocomplete/list-body.mjs
17734 var import_element39 = __toESM(require_element(), 1);
17735 var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash";
17736 function getRuntime17() {
17737 const globalScope = globalThis;
17738 if (globalScope.__wpStyleRuntime) {
17739 return globalScope.__wpStyleRuntime;
17740 }
17741 globalScope.__wpStyleRuntime = {
17742 documents: /* @__PURE__ */ new Map(),
17743 styles: /* @__PURE__ */ new Map(),
17744 injectedStyles: /* @__PURE__ */ new WeakMap()
17745 };
17746 if (typeof document !== "undefined") {
17747 registerDocument17(document);
17748 }
17749 return globalScope.__wpStyleRuntime;
17750 }
17751 function documentContainsStyleHash17(targetDocument, hash) {
17752 if (!targetDocument.head) {
17753 return false;
17754 }
17755 for (const style of targetDocument.head.querySelectorAll(
17756 `style[${STYLE_HASH_ATTRIBUTE17}]`
17757 )) {
17758 if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) {
17759 return true;
17760 }
17761 }
17762 return false;
17763 }
17764 function injectStyle17(targetDocument, hash, css) {
17765 if (!targetDocument.head) {
17766 return;
17767 }
17768 const runtime = getRuntime17();
17769 let injectedStyles = runtime.injectedStyles.get(targetDocument);
17770 if (!injectedStyles) {
17771 injectedStyles = /* @__PURE__ */ new Set();
17772 runtime.injectedStyles.set(targetDocument, injectedStyles);
17773 }
17774 if (injectedStyles.has(hash)) {
17775 return;
17776 }
17777 if (documentContainsStyleHash17(targetDocument, hash)) {
17778 injectedStyles.add(hash);
17779 return;
17780 }
17781 const style = targetDocument.createElement("style");
17782 style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash);
17783 style.appendChild(targetDocument.createTextNode(css));
17784 targetDocument.head.appendChild(style);
17785 injectedStyles.add(hash);
17786 }
17787 function registerDocument17(targetDocument) {
17788 const runtime = getRuntime17();
17789 runtime.documents.set(
17790 targetDocument,
17791 (runtime.documents.get(targetDocument) ?? 0) + 1
17792 );
17793 for (const [hash, css] of runtime.styles) {
17794 injectStyle17(targetDocument, hash, css);
17795 }
17796 return () => {
17797 const count = runtime.documents.get(targetDocument);
17798 if (count === void 0) {
17799 return;
17800 }
17801 if (count <= 1) {
17802 runtime.documents.delete(targetDocument);
17803 return;
17804 }
17805 runtime.documents.set(targetDocument, count - 1);
17806 };
17807 }
17808 function registerStyle17(hash, css) {
17809 const runtime = getRuntime17();
17810 runtime.styles.set(hash, css);
17811 for (const targetDocument of runtime.documents.keys()) {
17812 injectStyle17(targetDocument, hash, css);
17813 }
17814 }
17815 if (typeof process === "undefined" || true) {
17816 registerStyle17("02571d1b6c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}');
17817 }
17818 var item_popup_default6 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" };
17819 var ListBody = (0, import_element39.forwardRef)(
17820 function ListBody2({ render, ...props }, ref) {
17821 const element = useRender({
17822 defaultTagName: "div",
17823 render,
17824 ref,
17825 props: mergeProps(
17826 { className: item_popup_default6["list-scrollable-container"] },
17827 props
17828 )
17829 });
17830 return element;
17831 }
17832 );
17833
17834 // packages/ui/build-module/form/primitives/autocomplete/popup.mjs
17835 var import_element42 = __toESM(require_element(), 1);
17836
17837 // packages/ui/build-module/utils/css/item-popup.mjs
17838 var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash";
17839 function getRuntime18() {
17840 const globalScope = globalThis;
17841 if (globalScope.__wpStyleRuntime) {
17842 return globalScope.__wpStyleRuntime;
17843 }
17844 globalScope.__wpStyleRuntime = {
17845 documents: /* @__PURE__ */ new Map(),
17846 styles: /* @__PURE__ */ new Map(),
17847 injectedStyles: /* @__PURE__ */ new WeakMap()
17848 };
17849 if (typeof document !== "undefined") {
17850 registerDocument18(document);
17851 }
17852 return globalScope.__wpStyleRuntime;
17853 }
17854 function documentContainsStyleHash18(targetDocument, hash) {
17855 if (!targetDocument.head) {
17856 return false;
17857 }
17858 for (const style of targetDocument.head.querySelectorAll(
17859 `style[${STYLE_HASH_ATTRIBUTE18}]`
17860 )) {
17861 if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) {
17862 return true;
17863 }
17864 }
17865 return false;
17866 }
17867 function injectStyle18(targetDocument, hash, css) {
17868 if (!targetDocument.head) {
17869 return;
17870 }
17871 const runtime = getRuntime18();
17872 let injectedStyles = runtime.injectedStyles.get(targetDocument);
17873 if (!injectedStyles) {
17874 injectedStyles = /* @__PURE__ */ new Set();
17875 runtime.injectedStyles.set(targetDocument, injectedStyles);
17876 }
17877 if (injectedStyles.has(hash)) {
17878 return;
17879 }
17880 if (documentContainsStyleHash18(targetDocument, hash)) {
17881 injectedStyles.add(hash);
17882 return;
17883 }
17884 const style = targetDocument.createElement("style");
17885 style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash);
17886 style.appendChild(targetDocument.createTextNode(css));
17887 targetDocument.head.appendChild(style);
17888 injectedStyles.add(hash);
17889 }
17890 function registerDocument18(targetDocument) {
17891 const runtime = getRuntime18();
17892 runtime.documents.set(
17893 targetDocument,
17894 (runtime.documents.get(targetDocument) ?? 0) + 1
17895 );
17896 for (const [hash, css] of runtime.styles) {
17897 injectStyle18(targetDocument, hash, css);
17898 }
17899 return () => {
17900 const count = runtime.documents.get(targetDocument);
17901 if (count === void 0) {
17902 return;
17903 }
17904 if (count <= 1) {
17905 runtime.documents.delete(targetDocument);
17906 return;
17907 }
17908 runtime.documents.set(targetDocument, count - 1);
17909 };
17910 }
17911 function registerStyle18(hash, css) {
17912 const runtime = getRuntime18();
17913 runtime.styles.set(hash, css);
17914 for (const targetDocument of runtime.documents.keys()) {
17915 injectStyle18(targetDocument, hash, css);
17916 }
17917 }
17918 if (typeof process === "undefined" || true) {
17919 registerStyle18("02571d1b6c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}');
17920 }
17921 var item_popup_default7 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" };
17922 function getItemPopupWidthClassName(width = "anchor") {
17923 switch (width) {
17924 case "available":
17925 return item_popup_default7["is-width-available"];
17926 case "content":
17927 return item_popup_default7["is-width-content"];
17928 case "lg":
17929 return item_popup_default7["is-width-lg"];
17930 case "md":
17931 return item_popup_default7["is-width-md"];
17932 case "sm":
17933 return item_popup_default7["is-width-sm"];
17934 case "anchor":
17935 return item_popup_default7["is-width-anchor"];
17936 default:
17937 return false;
17938 }
17939 }
17940
17941 // packages/ui/build-module/form/primitives/autocomplete/portal.mjs
17942 var import_element40 = __toESM(require_element(), 1);
17943 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
17944 var Portal2 = (0, import_element40.forwardRef)(
17945 function AutocompletePortal({ container, ...restProps }, ref) {
17946 return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
17947 index_parts_exports.Portal,
17948 {
17949 container: container ?? getWpCompatOverlaySlot(),
17950 ...restProps,
17951 ref
17952 }
17953 );
17954 }
17955 );
17956
17957 // packages/ui/build-module/form/primitives/autocomplete/positioner.mjs
17958 var import_element41 = __toESM(require_element(), 1);
17959 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
17960 var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash";
17961 function getRuntime19() {
17962 const globalScope = globalThis;
17963 if (globalScope.__wpStyleRuntime) {
17964 return globalScope.__wpStyleRuntime;
17965 }
17966 globalScope.__wpStyleRuntime = {
17967 documents: /* @__PURE__ */ new Map(),
17968 styles: /* @__PURE__ */ new Map(),
17969 injectedStyles: /* @__PURE__ */ new WeakMap()
17970 };
17971 if (typeof document !== "undefined") {
17972 registerDocument19(document);
17973 }
17974 return globalScope.__wpStyleRuntime;
17975 }
17976 function documentContainsStyleHash19(targetDocument, hash) {
17977 if (!targetDocument.head) {
17978 return false;
17979 }
17980 for (const style of targetDocument.head.querySelectorAll(
17981 `style[${STYLE_HASH_ATTRIBUTE19}]`
17982 )) {
17983 if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) {
17984 return true;
17985 }
17986 }
17987 return false;
17988 }
17989 function injectStyle19(targetDocument, hash, css) {
17990 if (!targetDocument.head) {
17991 return;
17992 }
17993 const runtime = getRuntime19();
17994 let injectedStyles = runtime.injectedStyles.get(targetDocument);
17995 if (!injectedStyles) {
17996 injectedStyles = /* @__PURE__ */ new Set();
17997 runtime.injectedStyles.set(targetDocument, injectedStyles);
17998 }
17999 if (injectedStyles.has(hash)) {
18000 return;
18001 }
18002 if (documentContainsStyleHash19(targetDocument, hash)) {
18003 injectedStyles.add(hash);
18004 return;
18005 }
18006 const style = targetDocument.createElement("style");
18007 style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash);
18008 style.appendChild(targetDocument.createTextNode(css));
18009 targetDocument.head.appendChild(style);
18010 injectedStyles.add(hash);
18011 }
18012 function registerDocument19(targetDocument) {
18013 const runtime = getRuntime19();
18014 runtime.documents.set(
18015 targetDocument,
18016 (runtime.documents.get(targetDocument) ?? 0) + 1
18017 );
18018 for (const [hash, css] of runtime.styles) {
18019 injectStyle19(targetDocument, hash, css);
18020 }
18021 return () => {
18022 const count = runtime.documents.get(targetDocument);
18023 if (count === void 0) {
18024 return;
18025 }
18026 if (count <= 1) {
18027 runtime.documents.delete(targetDocument);
18028 return;
18029 }
18030 runtime.documents.set(targetDocument, count - 1);
18031 };
18032 }
18033 function registerStyle19(hash, css) {
18034 const runtime = getRuntime19();
18035 runtime.styles.set(hash, css);
18036 for (const targetDocument of runtime.documents.keys()) {
18037 injectStyle19(targetDocument, hash, css);
18038 }
18039 }
18040 if (typeof process === "undefined" || true) {
18041 registerStyle19("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
18042 }
18043 var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
18044 if (typeof process === "undefined" || true) {
18045 registerStyle19("e61eb95308", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._8eb0a29484225eea__positioner{z-index:var(--wp-ui-autocomplete-z-index,initial)}}}");
18046 }
18047 var style_default11 = { "positioner": "_8eb0a29484225eea__positioner" };
18048 var Positioner2 = (0, import_element41.forwardRef)(
18049 function AutocompletePositioner({ className, ...props }, ref) {
18050 return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
18051 index_parts_exports.Positioner,
18052 {
18053 ...ITEM_POPUP_POSITIONER_PROPS,
18054 ...props,
18055 ref,
18056 className: clsx_default(
18057 resets_default5["box-sizing"],
18058 style_default11.positioner,
18059 className
18060 )
18061 }
18062 );
18063 }
18064 );
18065
18066 // packages/ui/build-module/form/primitives/autocomplete/popup.mjs
18067 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
18068 var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash";
18069 function getRuntime20() {
18070 const globalScope = globalThis;
18071 if (globalScope.__wpStyleRuntime) {
18072 return globalScope.__wpStyleRuntime;
18073 }
18074 globalScope.__wpStyleRuntime = {
18075 documents: /* @__PURE__ */ new Map(),
18076 styles: /* @__PURE__ */ new Map(),
18077 injectedStyles: /* @__PURE__ */ new WeakMap()
18078 };
18079 if (typeof document !== "undefined") {
18080 registerDocument20(document);
18081 }
18082 return globalScope.__wpStyleRuntime;
18083 }
18084 function documentContainsStyleHash20(targetDocument, hash) {
18085 if (!targetDocument.head) {
18086 return false;
18087 }
18088 for (const style of targetDocument.head.querySelectorAll(
18089 `style[${STYLE_HASH_ATTRIBUTE20}]`
18090 )) {
18091 if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) {
18092 return true;
18093 }
18094 }
18095 return false;
18096 }
18097 function injectStyle20(targetDocument, hash, css) {
18098 if (!targetDocument.head) {
18099 return;
18100 }
18101 const runtime = getRuntime20();
18102 let injectedStyles = runtime.injectedStyles.get(targetDocument);
18103 if (!injectedStyles) {
18104 injectedStyles = /* @__PURE__ */ new Set();
18105 runtime.injectedStyles.set(targetDocument, injectedStyles);
18106 }
18107 if (injectedStyles.has(hash)) {
18108 return;
18109 }
18110 if (documentContainsStyleHash20(targetDocument, hash)) {
18111 injectedStyles.add(hash);
18112 return;
18113 }
18114 const style = targetDocument.createElement("style");
18115 style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash);
18116 style.appendChild(targetDocument.createTextNode(css));
18117 targetDocument.head.appendChild(style);
18118 injectedStyles.add(hash);
18119 }
18120 function registerDocument20(targetDocument) {
18121 const runtime = getRuntime20();
18122 runtime.documents.set(
18123 targetDocument,
18124 (runtime.documents.get(targetDocument) ?? 0) + 1
18125 );
18126 for (const [hash, css] of runtime.styles) {
18127 injectStyle20(targetDocument, hash, css);
18128 }
18129 return () => {
18130 const count = runtime.documents.get(targetDocument);
18131 if (count === void 0) {
18132 return;
18133 }
18134 if (count <= 1) {
18135 runtime.documents.delete(targetDocument);
18136 return;
18137 }
18138 runtime.documents.set(targetDocument, count - 1);
18139 };
18140 }
18141 function registerStyle20(hash, css) {
18142 const runtime = getRuntime20();
18143 runtime.styles.set(hash, css);
18144 for (const targetDocument of runtime.documents.keys()) {
18145 injectStyle20(targetDocument, hash, css);
18146 }
18147 }
18148 if (typeof process === "undefined" || true) {
18149 registerStyle20("02571d1b6c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}');
18150 }
18151 var item_popup_default8 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" };
18152 var Popup2 = (0, import_element42.forwardRef)(
18153 function Popup22({ className, portal, positioner, width, ...restProps }, ref) {
18154 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
18155 index_parts_exports.Popup,
18156 {
18157 ref,
18158 className: clsx_default(
18159 item_popup_default8.popup,
18160 getItemPopupWidthClassName(width),
18161 className
18162 ),
18163 ...restProps
18164 }
18165 );
18166 const positionedPopup = renderSlotWithChildren(
18167 positioner,
18168 /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Positioner2, {}),
18169 popupContent
18170 );
18171 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Portal2, {}), positionedPopup);
18172 }
18173 );
18174
18175 // packages/ui/build-module/form/primitives/autocomplete/context.mjs
18176 var import_element43 = __toESM(require_element(), 1);
18177 var AutocompleteGridContext = (0, import_element43.createContext)(false);
18178 var useAutocompleteGridContext = () => (0, import_element43.useContext)(AutocompleteGridContext);
18179
18180 // packages/ui/build-module/form/primitives/autocomplete/root.mjs
18181 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
18182 function Root2(props) {
18183 return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(AutocompleteGridContext.Provider, { value: Boolean(props.grid), children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(index_parts_exports.Root, { ...props }) }) });
18184 }
18185
18186 // packages/ui/build-module/form/primitives/autocomplete/row.mjs
18187 var import_element44 = __toESM(require_element(), 1);
18188 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
18189 var Row = (0, import_element44.forwardRef)(
18190 function Row2({ children, ...restProps }, ref) {
18191 const isGrid = useAutocompleteGridContext();
18192 if (!isGrid) {
18193 throw new Error(
18194 "Autocomplete.Row: Missing parent <Autocomplete.Root grid>. Render <Autocomplete.Row> inside <Autocomplete.Root grid>."
18195 );
18196 }
18197 return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(index_parts_exports.Row, { ref, ...restProps, children });
18198 }
18199 );
18200
18201 // packages/ui/build-module/form/primitives/autocomplete/status.mjs
18202 var import_element45 = __toESM(require_element(), 1);
18203 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
18204 var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash";
18205 function getRuntime21() {
18206 const globalScope = globalThis;
18207 if (globalScope.__wpStyleRuntime) {
18208 return globalScope.__wpStyleRuntime;
18209 }
18210 globalScope.__wpStyleRuntime = {
18211 documents: /* @__PURE__ */ new Map(),
18212 styles: /* @__PURE__ */ new Map(),
18213 injectedStyles: /* @__PURE__ */ new WeakMap()
18214 };
18215 if (typeof document !== "undefined") {
18216 registerDocument21(document);
18217 }
18218 return globalScope.__wpStyleRuntime;
18219 }
18220 function documentContainsStyleHash21(targetDocument, hash) {
18221 if (!targetDocument.head) {
18222 return false;
18223 }
18224 for (const style of targetDocument.head.querySelectorAll(
18225 `style[${STYLE_HASH_ATTRIBUTE21}]`
18226 )) {
18227 if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) {
18228 return true;
18229 }
18230 }
18231 return false;
18232 }
18233 function injectStyle21(targetDocument, hash, css) {
18234 if (!targetDocument.head) {
18235 return;
18236 }
18237 const runtime = getRuntime21();
18238 let injectedStyles = runtime.injectedStyles.get(targetDocument);
18239 if (!injectedStyles) {
18240 injectedStyles = /* @__PURE__ */ new Set();
18241 runtime.injectedStyles.set(targetDocument, injectedStyles);
18242 }
18243 if (injectedStyles.has(hash)) {
18244 return;
18245 }
18246 if (documentContainsStyleHash21(targetDocument, hash)) {
18247 injectedStyles.add(hash);
18248 return;
18249 }
18250 const style = targetDocument.createElement("style");
18251 style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash);
18252 style.appendChild(targetDocument.createTextNode(css));
18253 targetDocument.head.appendChild(style);
18254 injectedStyles.add(hash);
18255 }
18256 function registerDocument21(targetDocument) {
18257 const runtime = getRuntime21();
18258 runtime.documents.set(
18259 targetDocument,
18260 (runtime.documents.get(targetDocument) ?? 0) + 1
18261 );
18262 for (const [hash, css] of runtime.styles) {
18263 injectStyle21(targetDocument, hash, css);
18264 }
18265 return () => {
18266 const count = runtime.documents.get(targetDocument);
18267 if (count === void 0) {
18268 return;
18269 }
18270 if (count <= 1) {
18271 runtime.documents.delete(targetDocument);
18272 return;
18273 }
18274 runtime.documents.set(targetDocument, count - 1);
18275 };
18276 }
18277 function registerStyle21(hash, css) {
18278 const runtime = getRuntime21();
18279 runtime.styles.set(hash, css);
18280 for (const targetDocument of runtime.documents.keys()) {
18281 injectStyle21(targetDocument, hash, css);
18282 }
18283 }
18284 if (typeof process === "undefined" || true) {
18285 registerStyle21("02571d1b6c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);--_wp-ui-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-md);display:grid;grid-template-areas:"header" "status" "main";grid-template-rows:auto auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width);&.b9a9946a395ccad8__is-width-anchor{width:var(--anchor-width)}&._7c9f1b268b013f02__is-width-content{width:auto}&._6f31db51d79ec899__is-width-sm{width:min(var(--available-width),var(--wpds-dimension-surface-width-sm,320px))}&.fa45cdb5f45e57fb__is-width-md{width:min(var(--available-width),var(--wpds-dimension-surface-width-md,400px))}&._46a909337f6be21c__is-width-lg{width:min(var(--available-width),var(--wpds-dimension-surface-width-lg,560px))}&._6083938dff06df34__is-width-available{width:var(--available-width)}}._2fff4e9defe85de5__list-chrome{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px)}.f43dc7c768d7b622__list{display:grid;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);min-width:0;overflow-wrap:anywhere;padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._6eb78bc92f8d7795__status{grid-area:status}._06c7ff39d2f685b9__empty:not(:empty){grid-area:main}._06c7ff39d2f685b9__empty:not(:empty),._6eb78bc92f8d7795__status:not(:empty):not(:has([data-visually-hidden])){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}');
18286 }
18287 var item_popup_default9 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "is-width-anchor": "b9a9946a395ccad8__is-width-anchor", "is-width-content": "_7c9f1b268b013f02__is-width-content", "is-width-sm": "_6f31db51d79ec899__is-width-sm", "is-width-md": "fa45cdb5f45e57fb__is-width-md", "is-width-lg": "_46a909337f6be21c__is-width-lg", "is-width-available": "_6083938dff06df34__is-width-available", "list-chrome": "_2fff4e9defe85de5__list-chrome", "list": "f43dc7c768d7b622__list _2fff4e9defe85de5__list-chrome", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "status": "_6eb78bc92f8d7795__status", "empty": "_06c7ff39d2f685b9__empty" };
18288 var Status = (0, import_element45.forwardRef)(
18289 function Status2({ className, ...restProps }, ref) {
18290 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
18291 index_parts_exports.Status,
18292 {
18293 className: clsx_default(item_popup_default9.status, className),
18294 ref,
18295 ...restProps
18296 }
18297 );
18298 }
18299 );
18300
18301 // packages/ui/build-module/form/primitives/autocomplete/value.mjs
18302 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
18303 function Value(props) {
18304 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(index_parts_exports.Value, { ...props });
18305 }
18306
18307 // packages/workflow/build-module/components/workflow-menu.mjs
18308 var import_data = __toESM(require_data(), 1);
18309 var import_element46 = __toESM(require_element(), 1);
18310 var import_i18n5 = __toESM(require_i18n(), 1);
18311 var import_components = __toESM(require_components(), 1);
18312 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1);
18313 var import_keycodes = __toESM(require_keycodes(), 1);
18314 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
18315 import { executeAbility, store as abilitiesStore } from "@wordpress/abilities";
18316 if (typeof document !== "undefined" && (typeof process === "undefined" || true) && !document.head.querySelector("style[data-wp-hash='2114aa51e8']")) {
18317 const style = document.createElement("style");
18318 style.setAttribute("data-wp-hash", "2114aa51e8");
18319 style.appendChild(document.createTextNode(":root{--wp-block-synced-color:#7a00df;--wp-block-synced-color--rgb:122,0,223;--wp-bound-block-color:var(--wp-block-synced-color);--wp-editor-canvas-background:#ddd;--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,160.5;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.workflows-workflow-menu{border-radius:4px;margin:auto;max-width:400px;position:relative;top:calc(5% + 64px);width:calc(100% - 32px)}@media (min-width:600px){.workflows-workflow-menu{top:calc(10% + 64px)}}.workflows-workflow-menu .components-modal__content{margin:0;padding:0}.workflows-workflow-menu__overlay{align-items:start;display:block}.workflows-workflow-menu__container{will-change:transform}.workflows-workflow-menu__container:focus{outline:none}.workflows-workflow-menu__input{margin:8px}.workflows-workflow-menu__list{max-height:376px}.workflows-workflow-menu__list-body{padding:0 8px 8px}.workflows-workflow-menu__item-label{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.workflows-workflow-menu__item mark{background:unset;color:inherit;font-weight:var(--wpds-typography-font-weight-emphasis,600)}.workflows-workflow-menu__output{padding:16px}.workflows-workflow-menu__output-header{border-bottom:1px solid #ddd;margin-bottom:16px;padding-bottom:8px}.workflows-workflow-menu__output-header h3{color:#1e1e1e;font-size:16px;font-weight:var(--wpds-typography-font-weight-emphasis,600);margin:0 0 4px}.workflows-workflow-menu__output-hint{color:#757575;font-size:12px;margin:0}.workflows-workflow-menu__output-content{max-height:400px;overflow:auto}.workflows-workflow-menu__output-content pre{background:#f0f0f0;border-radius:2px;color:#1e1e1e;font-size:12px;line-height:1.5;margin:0;padding:12px;white-space:pre-wrap;word-break:break-word}.workflows-workflow-menu__output-error{background:#e0e0e0;border:1px solid #9e1313;border-radius:2px;color:#cc1818;padding:12px}.workflows-workflow-menu__output-error p{font-size:13px;margin:0}.workflows-workflow-menu__empty:not(:empty),.workflows-workflow-menu__executing:not(:empty){justify-content:center;padding:8px 0 16px}"));
18320 document.head.appendChild(style);
18321 }
18322 var EMPTY_ARRAY2 = [];
18323 var inputLabel = (0, import_i18n5.__)("Run abilities and workflows");
18324 function WorkflowMenu() {
18325 const { registerShortcut } = (0, import_data.useDispatch)(import_keyboard_shortcuts.store);
18326 const [search, setSearch] = (0, import_element46.useState)("");
18327 const [isOpen, setIsOpen] = (0, import_element46.useState)(false);
18328 const [abilityOutput, setAbilityOutput] = (0, import_element46.useState)(null);
18329 const [isExecuting, setIsExecuting] = (0, import_element46.useState)(false);
18330 const containerRef = (0, import_element46.useRef)();
18331 const inputRef = (0, import_element46.useRef)();
18332 const abilities = (0, import_data.useSelect)((select) => {
18333 const allAbilities = select(abilitiesStore).getAbilities();
18334 return allAbilities || EMPTY_ARRAY2;
18335 }, []);
18336 const filteredAbilities = (0, import_element46.useMemo)(() => {
18337 if (!search) {
18338 return abilities;
18339 }
18340 const searchLower = search.toLowerCase();
18341 return abilities.filter(
18342 (ability) => ability.label?.toLowerCase().includes(searchLower) || ability.name?.toLowerCase().includes(searchLower)
18343 );
18344 }, [abilities, search]);
18345 (0, import_element46.useEffect)(() => {
18346 if (abilityOutput && containerRef.current) {
18347 containerRef.current.focus();
18348 }
18349 }, [abilityOutput]);
18350 (0, import_element46.useEffect)(() => {
18351 if (isOpen && !abilityOutput) {
18352 inputRef.current?.focus();
18353 }
18354 }, [isOpen, abilityOutput]);
18355 (0, import_element46.useEffect)(() => {
18356 registerShortcut({
18357 name: "core/workflows",
18358 category: "global",
18359 description: (0, import_i18n5.__)("Open the workflow palette."),
18360 keyCombination: {
18361 modifier: "primary",
18362 character: "j"
18363 }
18364 });
18365 }, [registerShortcut]);
18366 (0, import_keyboard_shortcuts.useShortcut)(
18367 "core/workflows",
18368 /** @type {React.KeyboardEventHandler} */
18369 (0, import_keycodes.withIgnoreIMEEvents)((event) => {
18370 if (event.defaultPrevented) {
18371 return;
18372 }
18373 event.preventDefault();
18374 setIsOpen(!isOpen);
18375 }),
18376 {
18377 bindGlobal: true
18378 }
18379 );
18380 (0, import_element46.useEffect)(() => {
18381 if (isOpen) {
18382 import("@wordpress/core-abilities");
18383 }
18384 }, [isOpen]);
18385 const closeAndReset = () => {
18386 setSearch("");
18387 setIsOpen(false);
18388 setAbilityOutput(null);
18389 setIsExecuting(false);
18390 };
18391 const goBack = () => {
18392 setAbilityOutput(null);
18393 setIsExecuting(false);
18394 setSearch("");
18395 };
18396 const handleExecuteAbility = async (ability) => {
18397 setIsExecuting(true);
18398 try {
18399 const result = await executeAbility(ability.name);
18400 setAbilityOutput({
18401 name: ability.name,
18402 label: ability?.label || ability.name,
18403 description: ability?.description || "",
18404 success: true,
18405 data: result
18406 });
18407 } catch (error2) {
18408 setAbilityOutput({
18409 name: ability.name,
18410 label: ability?.label || ability.name,
18411 description: ability?.description || "",
18412 success: false,
18413 error: error2.message || String(error2)
18414 });
18415 } finally {
18416 setIsExecuting(false);
18417 }
18418 };
18419 const onContainerKeyDown = (event) => {
18420 if (abilityOutput && (event.key === "Escape" || event.key === "Backspace" || event.key === "Delete")) {
18421 event.preventDefault();
18422 event.stopPropagation();
18423 goBack();
18424 }
18425 };
18426 if (!isOpen) {
18427 return null;
18428 }
18429 const items = isExecuting ? EMPTY_ARRAY2 : filteredAbilities;
18430 const showEmpty = !isExecuting && !!search && !filteredAbilities.length;
18431 return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
18432 import_components.Modal,
18433 {
18434 className: "workflows-workflow-menu",
18435 overlayClassName: "workflows-workflow-menu__overlay",
18436 onRequestClose: abilityOutput ? goBack : closeAndReset,
18437 __experimentalHideHeader: true,
18438 contentLabel: (0, import_i18n5.__)("Workflow palette"),
18439 children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
18440 "div",
18441 {
18442 className: "workflows-workflow-menu__container",
18443 onKeyDown: (0, import_keycodes.withIgnoreIMEEvents)(onContainerKeyDown),
18444 ref: containerRef,
18445 tabIndex: -1,
18446 role: "presentation",
18447 children: abilityOutput ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "workflows-workflow-menu__output", children: [
18448 /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "workflows-workflow-menu__output-header", children: [
18449 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h3", { children: abilityOutput.label }),
18450 abilityOutput.description && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "workflows-workflow-menu__output-hint", children: abilityOutput.description })
18451 ] }),
18452 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "workflows-workflow-menu__output-content", children: abilityOutput.success ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("pre", { children: JSON.stringify(
18453 abilityOutput.data,
18454 null,
18455 2
18456 ) }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "workflows-workflow-menu__output-error", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { children: abilityOutput.error }) }) })
18457 ] }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
18458 autocomplete_exports.Root,
18459 {
18460 items: abilities,
18461 filteredItems: items,
18462 mode: "list",
18463 value: search,
18464 onValueChange: setSearch,
18465 open: true,
18466 inline: true,
18467 autoHighlight: true,
18468 children: [
18469 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
18470 autocomplete_exports.Input,
18471 {
18472 ref: inputRef,
18473 placeholder: inputLabel,
18474 "aria-label": inputLabel,
18475 className: "workflows-workflow-menu__input",
18476 render: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
18477 Input3,
18478 {
18479 prefix: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
18480 Icon,
18481 {
18482 icon: search_default,
18483 style: (0, import_i18n5.isRTL)() ? void 0 : {
18484 transform: "scaleX(-1)"
18485 }
18486 }
18487 ) })
18488 }
18489 )
18490 }
18491 ),
18492 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(autocomplete_exports.Status, { className: "workflows-workflow-menu__executing", children: isExecuting ? (0, import_i18n5.__)("Executing ability…") : null }),
18493 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(autocomplete_exports.Empty, { className: "workflows-workflow-menu__empty", children: showEmpty ? (0, import_i18n5.__)("No results found.") : null }),
18494 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
18495 autocomplete_exports.List,
18496 {
18497 className: "workflows-workflow-menu__list",
18498 "aria-label": (0, import_i18n5.__)("Workflow suggestions"),
18499 children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(autocomplete_exports.ListBody, { className: "workflows-workflow-menu__list-body", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(autocomplete_exports.Collection, { children: (item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
18500 autocomplete_exports.Item,
18501 {
18502 value: item,
18503 className: "workflows-workflow-menu__item",
18504 onClick: () => handleExecuteAbility(item),
18505 children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "workflows-workflow-menu__item-label", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
18506 import_components.TextHighlight,
18507 {
18508 text: item.label,
18509 highlight: search
18510 }
18511 ) })
18512 },
18513 item.name
18514 ) }) })
18515 }
18516 )
18517 ]
18518 }
18519 )
18520 }
18521 )
18522 }
18523 );
18524 }
18525
18526 // packages/workflow/build-module/index.mjs
18527 var root = document.createElement("div");
18528 document.body.appendChild(root);
18529 (0, import_element47.createRoot)(root).render((0, import_element47.createElement)(WorkflowMenu));
18530 /*! Bundled license information:
18531
18532 use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
18533 (**
18534 * @license React
18535 * use-sync-external-store-shim.development.js
18536 *
18537 * Copyright (c) Meta Platforms, Inc. and affiliates.
18538 *
18539 * This source code is licensed under the MIT license found in the
18540 * LICENSE file in the root directory of this source tree.
18541 *)
18542
18543 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
18544 (**
18545 * @license React
18546 * use-sync-external-store-shim/with-selector.development.js
18547 *
18548 * Copyright (c) Meta Platforms, Inc. and affiliates.
18549 *
18550 * This source code is licensed under the MIT license found in the
18551 * LICENSE file in the root directory of this source tree.
18552 *)
18553 */
18554 //# sourceMappingURL=index.js.map
18555