PluginProbe
Gutenberg / 23.6.0
Gutenberg v23.6.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 7.4.0 All 402 releases
gutenberg / build / scripts / edit-post / index.js

index.js in Gutenberg 23.6.0, at build/scripts/edit-post/index.js

11,909 lines 435.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var wp;
2 (wp ||= {}).editPost = (() => {
3 var __create = Object.create;
4 var __defProp = Object.defineProperty;
5 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6 var __getOwnPropNames = Object.getOwnPropertyNames;
7 var __getProtoOf = Object.getPrototypeOf;
8 var __hasOwnProp = Object.prototype.hasOwnProperty;
9 var __commonJS = (cb, mod) => function __require() {
10 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11 };
12 var __export = (target, all) => {
13 for (var name in all)
14 __defProp(target, name, { get: all[name], enumerable: true });
15 };
16 var __copyProps = (to, from, except, desc) => {
17 if (from && typeof from === "object" || typeof from === "function") {
18 for (let key of __getOwnPropNames(from))
19 if (!__hasOwnProp.call(to, key) && key !== except)
20 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21 }
22 return to;
23 };
24 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25 // If the importer is in node compatibility mode or this is not an ESM
26 // file that has been converted to a CommonJS file using a Babel-
27 // compatible transform (i.e. "__esModule" has not been set), then set
28 // "default" to the CommonJS "module.exports" for node compatibility.
29 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30 mod
31 ));
32 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
34 // package-external:@wordpress/blocks
35 var require_blocks = __commonJS({
36 "package-external:@wordpress/blocks"(exports, module) {
37 module.exports = window.wp.blocks;
38 }
39 });
40
41 // package-external:@wordpress/block-library
42 var require_block_library = __commonJS({
43 "package-external:@wordpress/block-library"(exports, module) {
44 module.exports = window.wp.blockLibrary;
45 }
46 });
47
48 // package-external:@wordpress/deprecated
49 var require_deprecated = __commonJS({
50 "package-external:@wordpress/deprecated"(exports, module) {
51 module.exports = window.wp.deprecated;
52 }
53 });
54
55 // package-external:@wordpress/element
56 var require_element = __commonJS({
57 "package-external:@wordpress/element"(exports, module) {
58 module.exports = window.wp.element;
59 }
60 });
61
62 // package-external:@wordpress/data
63 var require_data = __commonJS({
64 "package-external:@wordpress/data"(exports, module) {
65 module.exports = window.wp.data;
66 }
67 });
68
69 // package-external:@wordpress/preferences
70 var require_preferences = __commonJS({
71 "package-external:@wordpress/preferences"(exports, module) {
72 module.exports = window.wp.preferences;
73 }
74 });
75
76 // package-external:@wordpress/widgets
77 var require_widgets = __commonJS({
78 "package-external:@wordpress/widgets"(exports, module) {
79 module.exports = window.wp.widgets;
80 }
81 });
82
83 // package-external:@wordpress/editor
84 var require_editor = __commonJS({
85 "package-external:@wordpress/editor"(exports, module) {
86 module.exports = window.wp.editor;
87 }
88 });
89
90 // package-external:@wordpress/core-data
91 var require_core_data = __commonJS({
92 "package-external:@wordpress/core-data"(exports, module) {
93 module.exports = window.wp.coreData;
94 }
95 });
96
97 // package-external:@wordpress/api-fetch
98 var require_api_fetch = __commonJS({
99 "package-external:@wordpress/api-fetch"(exports, module) {
100 module.exports = window.wp.apiFetch;
101 }
102 });
103
104 // package-external:@wordpress/i18n
105 var require_i18n = __commonJS({
106 "package-external:@wordpress/i18n"(exports, module) {
107 module.exports = window.wp.i18n;
108 }
109 });
110
111 // vendor-external:react
112 var require_react = __commonJS({
113 "vendor-external:react"(exports, module) {
114 module.exports = window.React;
115 }
116 });
117
118 // vendor-external:react/jsx-runtime
119 var require_jsx_runtime = __commonJS({
120 "vendor-external:react/jsx-runtime"(exports, module) {
121 module.exports = window.ReactJSXRuntime;
122 }
123 });
124
125 // vendor-external:react-dom
126 var require_react_dom = __commonJS({
127 "vendor-external:react-dom"(exports, module) {
128 module.exports = window.ReactDOM;
129 }
130 });
131
132 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
133 var require_use_sync_external_store_shim_development = __commonJS({
134 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
135 "use strict";
136 (function() {
137 function is(x, y) {
138 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
139 }
140 function useSyncExternalStore$2(subscribe, getSnapshot) {
141 didWarnOld18Alpha || void 0 === React47.startTransition || (didWarnOld18Alpha = true, console.error(
142 "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."
143 ));
144 var value = getSnapshot();
145 if (!didWarnUncachedGetSnapshot) {
146 var cachedValue = getSnapshot();
147 objectIs(value, cachedValue) || (console.error(
148 "The result of getSnapshot should be cached to avoid an infinite loop"
149 ), didWarnUncachedGetSnapshot = true);
150 }
151 cachedValue = useState16({
152 inst: { value, getSnapshot }
153 });
154 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
155 useLayoutEffect3(
156 function() {
157 inst.value = value;
158 inst.getSnapshot = getSnapshot;
159 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
160 },
161 [subscribe, value, getSnapshot]
162 );
163 useEffect17(
164 function() {
165 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
166 return subscribe(function() {
167 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
168 });
169 },
170 [subscribe]
171 );
172 useDebugValue2(value);
173 return value;
174 }
175 function checkIfSnapshotChanged(inst) {
176 var latestGetSnapshot = inst.getSnapshot;
177 inst = inst.value;
178 try {
179 var nextValue = latestGetSnapshot();
180 return !objectIs(inst, nextValue);
181 } catch (error) {
182 return true;
183 }
184 }
185 function useSyncExternalStore$1(subscribe, getSnapshot) {
186 return getSnapshot();
187 }
188 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
189 var React47 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState16 = React47.useState, useEffect17 = React47.useEffect, useLayoutEffect3 = React47.useLayoutEffect, useDebugValue2 = React47.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
190 exports.useSyncExternalStore = void 0 !== React47.useSyncExternalStore ? React47.useSyncExternalStore : shim;
191 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
192 })();
193 }
194 });
195
196 // node_modules/use-sync-external-store/shim/index.js
197 var require_shim = __commonJS({
198 "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
199 "use strict";
200 if (false) {
201 module.exports = null;
202 } else {
203 module.exports = require_use_sync_external_store_shim_development();
204 }
205 }
206 });
207
208 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
209 var require_with_selector_development = __commonJS({
210 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
211 "use strict";
212 (function() {
213 function is(x, y) {
214 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
215 }
216 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
217 var React47 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef22 = React47.useRef, useEffect17 = React47.useEffect, useMemo16 = React47.useMemo, useDebugValue2 = React47.useDebugValue;
218 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
219 var instRef = useRef22(null);
220 if (null === instRef.current) {
221 var inst = { hasValue: false, value: null };
222 instRef.current = inst;
223 } else inst = instRef.current;
224 instRef = useMemo16(
225 function() {
226 function memoizedSelector(nextSnapshot) {
227 if (!hasMemo) {
228 hasMemo = true;
229 memoizedSnapshot = nextSnapshot;
230 nextSnapshot = selector(nextSnapshot);
231 if (void 0 !== isEqual && inst.hasValue) {
232 var currentSelection = inst.value;
233 if (isEqual(currentSelection, nextSnapshot))
234 return memoizedSelection = currentSelection;
235 }
236 return memoizedSelection = nextSnapshot;
237 }
238 currentSelection = memoizedSelection;
239 if (objectIs(memoizedSnapshot, nextSnapshot))
240 return currentSelection;
241 var nextSelection = selector(nextSnapshot);
242 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
243 return memoizedSnapshot = nextSnapshot, currentSelection;
244 memoizedSnapshot = nextSnapshot;
245 return memoizedSelection = nextSelection;
246 }
247 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
248 return [
249 function() {
250 return memoizedSelector(getSnapshot());
251 },
252 null === maybeGetServerSnapshot ? void 0 : function() {
253 return memoizedSelector(maybeGetServerSnapshot());
254 }
255 ];
256 },
257 [getSnapshot, getServerSnapshot, selector, isEqual]
258 );
259 var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]);
260 useEffect17(
261 function() {
262 inst.hasValue = true;
263 inst.value = value;
264 },
265 [value]
266 );
267 useDebugValue2(value);
268 return value;
269 };
270 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
271 })();
272 }
273 });
274
275 // node_modules/use-sync-external-store/shim/with-selector.js
276 var require_with_selector = __commonJS({
277 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
278 "use strict";
279 if (false) {
280 module.exports = null;
281 } else {
282 module.exports = require_with_selector_development();
283 }
284 }
285 });
286
287 // package-external:@wordpress/primitives
288 var require_primitives = __commonJS({
289 "package-external:@wordpress/primitives"(exports, module) {
290 module.exports = window.wp.primitives;
291 }
292 });
293
294 // package-external:@wordpress/compose
295 var require_compose = __commonJS({
296 "package-external:@wordpress/compose"(exports, module) {
297 module.exports = window.wp.compose;
298 }
299 });
300
301 // package-external:@wordpress/theme
302 var require_theme = __commonJS({
303 "package-external:@wordpress/theme"(exports, module) {
304 module.exports = window.wp.theme;
305 }
306 });
307
308 // package-external:@wordpress/private-apis
309 var require_private_apis = __commonJS({
310 "package-external:@wordpress/private-apis"(exports, module) {
311 module.exports = window.wp.privateApis;
312 }
313 });
314
315 // package-external:@wordpress/components
316 var require_components = __commonJS({
317 "package-external:@wordpress/components"(exports, module) {
318 module.exports = window.wp.components;
319 }
320 });
321
322 // package-external:@wordpress/block-editor
323 var require_block_editor = __commonJS({
324 "package-external:@wordpress/block-editor"(exports, module) {
325 module.exports = window.wp.blockEditor;
326 }
327 });
328
329 // package-external:@wordpress/style-engine
330 var require_style_engine = __commonJS({
331 "package-external:@wordpress/style-engine"(exports, module) {
332 module.exports = window.wp.styleEngine;
333 }
334 });
335
336 // package-external:@wordpress/plugins
337 var require_plugins = __commonJS({
338 "package-external:@wordpress/plugins"(exports, module) {
339 module.exports = window.wp.plugins;
340 }
341 });
342
343 // package-external:@wordpress/notices
344 var require_notices = __commonJS({
345 "package-external:@wordpress/notices"(exports, module) {
346 module.exports = window.wp.notices;
347 }
348 });
349
350 // package-external:@wordpress/commands
351 var require_commands = __commonJS({
352 "package-external:@wordpress/commands"(exports, module) {
353 module.exports = window.wp.commands;
354 }
355 });
356
357 // package-external:@wordpress/url
358 var require_url = __commonJS({
359 "package-external:@wordpress/url"(exports, module) {
360 module.exports = window.wp.url;
361 }
362 });
363
364 // package-external:@wordpress/html-entities
365 var require_html_entities = __commonJS({
366 "package-external:@wordpress/html-entities"(exports, module) {
367 module.exports = window.wp.htmlEntities;
368 }
369 });
370
371 // package-external:@wordpress/keyboard-shortcuts
372 var require_keyboard_shortcuts = __commonJS({
373 "package-external:@wordpress/keyboard-shortcuts"(exports, module) {
374 module.exports = window.wp.keyboardShortcuts;
375 }
376 });
377
378 // package-external:@wordpress/hooks
379 var require_hooks = __commonJS({
380 "package-external:@wordpress/hooks"(exports, module) {
381 module.exports = window.wp.hooks;
382 }
383 });
384
385 // package-external:@wordpress/keycodes
386 var require_keycodes = __commonJS({
387 "package-external:@wordpress/keycodes"(exports, module) {
388 module.exports = window.wp.keycodes;
389 }
390 });
391
392 // packages/edit-post/build-module/index.mjs
393 var index_exports = {};
394 __export(index_exports, {
395 PluginBlockSettingsMenuItem: () => PluginBlockSettingsMenuItem,
396 PluginDocumentSettingPanel: () => PluginDocumentSettingPanel,
397 PluginMoreMenuItem: () => PluginMoreMenuItem,
398 PluginPostPublishPanel: () => PluginPostPublishPanel,
399 PluginPostStatusInfo: () => PluginPostStatusInfo,
400 PluginPrePublishPanel: () => PluginPrePublishPanel,
401 PluginSidebar: () => PluginSidebar,
402 PluginSidebarMoreMenuItem: () => PluginSidebarMoreMenuItem,
403 __experimentalFullscreenModeClose: () => fullscreen_mode_close_default,
404 __experimentalMainDashboardButton: () => __experimentalMainDashboardButton,
405 __experimentalPluginPostExcerpt: () => __experimentalPluginPostExcerpt,
406 initializeEditor: () => initializeEditor,
407 reinitializeEditor: () => reinitializeEditor,
408 store: () => store
409 });
410 var import_blocks2 = __toESM(require_blocks(), 1);
411 var import_block_library2 = __toESM(require_block_library(), 1);
412 var import_deprecated4 = __toESM(require_deprecated(), 1);
413 var import_element29 = __toESM(require_element(), 1);
414 var import_data25 = __toESM(require_data(), 1);
415 var import_preferences11 = __toESM(require_preferences(), 1);
416 var import_widgets = __toESM(require_widgets(), 1);
417 var import_editor19 = __toESM(require_editor(), 1);
418 var import_core_data9 = __toESM(require_core_data(), 1);
419 var import_api_fetch2 = __toESM(require_api_fetch(), 1);
420
421 // node_modules/clsx/dist/clsx.mjs
422 function r(e) {
423 var t, f, n = "";
424 if ("string" == typeof e || "number" == typeof e) n += e;
425 else if ("object" == typeof e) if (Array.isArray(e)) {
426 var o = e.length;
427 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
428 } else for (f in e) e[f] && (n && (n += " "), n += f);
429 return n;
430 }
431 function clsx() {
432 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
433 return n;
434 }
435 var clsx_default = clsx;
436
437 // node_modules/@base-ui/utils/safeReact.mjs
438 var React = __toESM(require_react(), 1);
439 var SafeReact = {
440 ...React
441 };
442
443 // node_modules/@base-ui/utils/useRefWithInit.mjs
444 var React2 = __toESM(require_react(), 1);
445 var UNINITIALIZED = {};
446 function useRefWithInit(init, initArg) {
447 const ref = React2.useRef(UNINITIALIZED);
448 if (ref.current === UNINITIALIZED) {
449 ref.current = init(initArg);
450 }
451 return ref;
452 }
453
454 // node_modules/@base-ui/utils/useStableCallback.mjs
455 var useInsertionEffect = SafeReact.useInsertionEffect;
456 var useSafeInsertionEffect = (
457 // React 17 doesn't have useInsertionEffect.
458 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
459 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn()
460 );
461 function useStableCallback(callback) {
462 const stable = useRefWithInit(createStableCallback).current;
463 stable.next = callback;
464 useSafeInsertionEffect(stable.effect);
465 return stable.trampoline;
466 }
467 function createStableCallback() {
468 const stable = {
469 next: void 0,
470 callback: assertNotCalled,
471 trampoline: (...args) => stable.callback?.(...args),
472 effect: () => {
473 stable.callback = stable.next;
474 }
475 };
476 return stable;
477 }
478 function assertNotCalled() {
479 if (true) {
480 throw (
481 /* minify-error-disabled */
482 new Error("Base UI: Cannot call an event handler while rendering.")
483 );
484 }
485 }
486
487 // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs
488 var React3 = __toESM(require_react(), 1);
489 var noop = () => {
490 };
491 var useIsoLayoutEffect = typeof document !== "undefined" ? React3.useLayoutEffect : noop;
492
493 // node_modules/@base-ui/utils/warn.mjs
494 var set;
495 if (true) {
496 set = /* @__PURE__ */ new Set();
497 }
498 function warn(...messages) {
499 if (true) {
500 const messageKey = messages.join(" ");
501 if (!set.has(messageKey)) {
502 set.add(messageKey);
503 console.warn(`Base UI: ${messageKey}`);
504 }
505 }
506 }
507
508 // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs
509 var React4 = __toESM(require_react(), 1);
510 var DirectionContext = /* @__PURE__ */ React4.createContext(void 0);
511 if (true) DirectionContext.displayName = "DirectionContext";
512 function useDirection() {
513 const context = React4.useContext(DirectionContext);
514 return context?.direction ?? "ltr";
515 }
516
517 // node_modules/@base-ui/react/internals/useRenderElement.mjs
518 var React7 = __toESM(require_react(), 1);
519
520 // node_modules/@base-ui/utils/useMergedRefs.mjs
521 function useMergedRefs(a, b, c, d) {
522 const forkRef = useRefWithInit(createForkRef).current;
523 if (didChange(forkRef, a, b, c, d)) {
524 update(forkRef, [a, b, c, d]);
525 }
526 return forkRef.callback;
527 }
528 function useMergedRefsN(refs) {
529 const forkRef = useRefWithInit(createForkRef).current;
530 if (didChangeN(forkRef, refs)) {
531 update(forkRef, refs);
532 }
533 return forkRef.callback;
534 }
535 function createForkRef() {
536 return {
537 callback: null,
538 cleanup: null,
539 refs: []
540 };
541 }
542 function didChange(forkRef, a, b, c, d) {
543 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
544 }
545 function didChangeN(forkRef, newRefs) {
546 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]);
547 }
548 function update(forkRef, refs) {
549 forkRef.refs = refs;
550 if (refs.every((ref) => ref == null)) {
551 forkRef.callback = null;
552 return;
553 }
554 forkRef.callback = (instance) => {
555 if (forkRef.cleanup) {
556 forkRef.cleanup();
557 forkRef.cleanup = null;
558 }
559 if (instance != null) {
560 const cleanupCallbacks = Array(refs.length).fill(null);
561 for (let i = 0; i < refs.length; i += 1) {
562 const ref = refs[i];
563 if (ref == null) {
564 continue;
565 }
566 switch (typeof ref) {
567 case "function": {
568 const refCleanup = ref(instance);
569 if (typeof refCleanup === "function") {
570 cleanupCallbacks[i] = refCleanup;
571 }
572 break;
573 }
574 case "object": {
575 ref.current = instance;
576 break;
577 }
578 default:
579 }
580 }
581 forkRef.cleanup = () => {
582 for (let i = 0; i < refs.length; i += 1) {
583 const ref = refs[i];
584 if (ref == null) {
585 continue;
586 }
587 switch (typeof ref) {
588 case "function": {
589 const cleanupCallback = cleanupCallbacks[i];
590 if (typeof cleanupCallback === "function") {
591 cleanupCallback();
592 } else {
593 ref(null);
594 }
595 break;
596 }
597 case "object": {
598 ref.current = null;
599 break;
600 }
601 default:
602 }
603 }
604 };
605 }
606 };
607 }
608
609 // node_modules/@base-ui/utils/getReactElementRef.mjs
610 var React6 = __toESM(require_react(), 1);
611
612 // node_modules/@base-ui/utils/reactVersion.mjs
613 var React5 = __toESM(require_react(), 1);
614 var majorVersion = parseInt(React5.version, 10);
615 function isReactVersionAtLeast(reactVersionToCheck) {
616 return majorVersion >= reactVersionToCheck;
617 }
618
619 // node_modules/@base-ui/utils/getReactElementRef.mjs
620 function getReactElementRef(element) {
621 if (!/* @__PURE__ */ React6.isValidElement(element)) {
622 return null;
623 }
624 const reactElement = element;
625 const propsWithRef = reactElement.props;
626 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
627 }
628
629 // node_modules/@base-ui/utils/mergeObjects.mjs
630 function mergeObjects(a, b) {
631 if (a && !b) {
632 return a;
633 }
634 if (!a && b) {
635 return b;
636 }
637 if (a || b) {
638 return {
639 ...a,
640 ...b
641 };
642 }
643 return void 0;
644 }
645
646 // node_modules/@base-ui/utils/empty.mjs
647 function NOOP() {
648 }
649 var EMPTY_ARRAY = Object.freeze([]);
650 var EMPTY_OBJECT = Object.freeze({});
651
652 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
653 function getStateAttributesProps(state, customMapping) {
654 const props = {};
655 for (const key in state) {
656 const value = state[key];
657 if (customMapping?.hasOwnProperty(key)) {
658 const customProps = customMapping[key](value);
659 if (customProps != null) {
660 Object.assign(props, customProps);
661 }
662 continue;
663 }
664 if (value === true) {
665 props[`data-${key.toLowerCase()}`] = "";
666 } else if (value) {
667 props[`data-${key.toLowerCase()}`] = value.toString();
668 }
669 }
670 return props;
671 }
672
673 // node_modules/@base-ui/react/utils/resolveClassName.mjs
674 function resolveClassName(className, state) {
675 return typeof className === "function" ? className(state) : className;
676 }
677
678 // node_modules/@base-ui/react/utils/resolveStyle.mjs
679 function resolveStyle(style, state) {
680 return typeof style === "function" ? style(state) : style;
681 }
682
683 // node_modules/@base-ui/react/merge-props/mergeProps.mjs
684 var EMPTY_PROPS = {};
685 function mergeProps(a, b, c, d, e) {
686 if (!c && !d && !e && !a) {
687 return createInitialMergedProps(b);
688 }
689 let merged = createInitialMergedProps(a);
690 if (b) {
691 merged = mergeInto(merged, b);
692 }
693 if (c) {
694 merged = mergeInto(merged, c);
695 }
696 if (d) {
697 merged = mergeInto(merged, d);
698 }
699 if (e) {
700 merged = mergeInto(merged, e);
701 }
702 return merged;
703 }
704 function mergePropsN(props) {
705 if (props.length === 0) {
706 return EMPTY_PROPS;
707 }
708 if (props.length === 1) {
709 return createInitialMergedProps(props[0]);
710 }
711 let merged = createInitialMergedProps(props[0]);
712 for (let i = 1; i < props.length; i += 1) {
713 merged = mergeInto(merged, props[i]);
714 }
715 return merged;
716 }
717 function createInitialMergedProps(inputProps) {
718 if (isPropsGetter(inputProps)) {
719 return {
720 ...resolvePropsGetter(inputProps, EMPTY_PROPS)
721 };
722 }
723 return copyInitialProps(inputProps);
724 }
725 function mergeInto(merged, inputProps) {
726 if (isPropsGetter(inputProps)) {
727 return resolvePropsGetter(inputProps, merged);
728 }
729 return mutablyMergeInto(merged, inputProps);
730 }
731 function copyInitialProps(inputProps) {
732 const copiedProps = {
733 ...inputProps
734 };
735 for (const propName in copiedProps) {
736 const propValue = copiedProps[propName];
737 if (isEventHandler(propName, propValue)) {
738 copiedProps[propName] = wrapEventHandler(propValue);
739 }
740 }
741 return copiedProps;
742 }
743 function mutablyMergeInto(mergedProps, externalProps) {
744 if (!externalProps) {
745 return mergedProps;
746 }
747 for (const propName in externalProps) {
748 const externalPropValue = externalProps[propName];
749 switch (propName) {
750 case "style": {
751 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
752 break;
753 }
754 case "className": {
755 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
756 break;
757 }
758 default: {
759 if (isEventHandler(propName, externalPropValue)) {
760 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
761 } else {
762 mergedProps[propName] = externalPropValue;
763 }
764 }
765 }
766 }
767 return mergedProps;
768 }
769 function isEventHandler(key, value) {
770 const code0 = key.charCodeAt(0);
771 const code1 = key.charCodeAt(1);
772 const code2 = key.charCodeAt(2);
773 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
774 }
775 function isPropsGetter(inputProps) {
776 return typeof inputProps === "function";
777 }
778 function resolvePropsGetter(inputProps, previousProps) {
779 if (isPropsGetter(inputProps)) {
780 return inputProps(previousProps);
781 }
782 return inputProps ?? EMPTY_PROPS;
783 }
784 function mergeEventHandlers(ourHandler, theirHandler) {
785 if (!theirHandler) {
786 return ourHandler;
787 }
788 if (!ourHandler) {
789 return wrapEventHandler(theirHandler);
790 }
791 return (...args) => {
792 const event = args[0];
793 if (isSyntheticEvent(event)) {
794 const baseUIEvent = event;
795 makeEventPreventable(baseUIEvent);
796 const result2 = theirHandler(...args);
797 if (!baseUIEvent.baseUIHandlerPrevented) {
798 ourHandler?.(...args);
799 }
800 return result2;
801 }
802 const result = theirHandler(...args);
803 ourHandler?.(...args);
804 return result;
805 };
806 }
807 function wrapEventHandler(handler) {
808 if (!handler) {
809 return handler;
810 }
811 return (...args) => {
812 const event = args[0];
813 if (isSyntheticEvent(event)) {
814 makeEventPreventable(event);
815 }
816 return handler(...args);
817 };
818 }
819 function makeEventPreventable(event) {
820 event.preventBaseUIHandler = () => {
821 event.baseUIHandlerPrevented = true;
822 };
823 return event;
824 }
825 function mergeClassNames(ourClassName, theirClassName) {
826 if (theirClassName) {
827 if (ourClassName) {
828 return theirClassName + " " + ourClassName;
829 }
830 return theirClassName;
831 }
832 return ourClassName;
833 }
834 function isSyntheticEvent(event) {
835 return event != null && typeof event === "object" && "nativeEvent" in event;
836 }
837
838 // node_modules/@base-ui/react/internals/useRenderElement.mjs
839 var import_react = __toESM(require_react(), 1);
840 function useRenderElement(element, componentProps, params = {}) {
841 const renderProp = componentProps.render;
842 const outProps = useRenderElementProps(componentProps, params);
843 if (params.enabled === false) {
844 return null;
845 }
846 const state = params.state ?? EMPTY_OBJECT;
847 return evaluateRenderProp(element, renderProp, outProps, state);
848 }
849 function useRenderElementProps(componentProps, params = {}) {
850 const {
851 className: classNameProp,
852 style: styleProp,
853 render: renderProp
854 } = componentProps;
855 const {
856 state = EMPTY_OBJECT,
857 ref,
858 props,
859 stateAttributesMapping: stateAttributesMapping3,
860 enabled = true
861 } = params;
862 const className = enabled ? resolveClassName(classNameProp, state) : void 0;
863 const style = enabled ? resolveStyle(styleProp, state) : void 0;
864 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT;
865 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
866 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
867 if (typeof document !== "undefined") {
868 if (!enabled) {
869 useMergedRefs(null, null);
870 } else if (Array.isArray(ref)) {
871 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
872 } else {
873 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
874 }
875 }
876 if (!enabled) {
877 return EMPTY_OBJECT;
878 }
879 if (className !== void 0) {
880 outProps.className = mergeClassNames(outProps.className, className);
881 }
882 if (style !== void 0) {
883 outProps.style = mergeObjects(outProps.style, style);
884 }
885 return outProps;
886 }
887 function resolveRenderFunctionProps(props) {
888 if (Array.isArray(props)) {
889 return mergePropsN(props);
890 }
891 return mergeProps(void 0, props);
892 }
893 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
894 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
895 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
896 function evaluateRenderProp(element, render, props, state) {
897 if (render) {
898 if (typeof render === "function") {
899 if (true) {
900 warnIfRenderPropLooksLikeComponent(render);
901 }
902 return render(props, state);
903 }
904 const mergedProps = mergeProps(props, render.props);
905 mergedProps.ref = props.ref;
906 let newElement = render;
907 if (newElement?.$$typeof === REACT_LAZY_TYPE) {
908 const children = React7.Children.toArray(render);
909 newElement = children[0];
910 }
911 if (true) {
912 if (!/* @__PURE__ */ React7.isValidElement(newElement)) {
913 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"));
914 }
915 }
916 return /* @__PURE__ */ React7.cloneElement(newElement, mergedProps);
917 }
918 if (element) {
919 if (typeof element === "string") {
920 return renderTag(element, props);
921 }
922 }
923 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
924 }
925 function warnIfRenderPropLooksLikeComponent(renderFn) {
926 const functionName = renderFn.name;
927 if (functionName.length === 0) {
928 return;
929 }
930 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
931 return;
932 }
933 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
934 return;
935 }
936 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");
937 }
938 function renderTag(Tag, props) {
939 if (Tag === "button") {
940 return /* @__PURE__ */ (0, import_react.createElement)("button", {
941 type: "button",
942 ...props,
943 key: props.key
944 });
945 }
946 if (Tag === "img") {
947 return /* @__PURE__ */ (0, import_react.createElement)("img", {
948 alt: "",
949 ...props,
950 key: props.key
951 });
952 }
953 return /* @__PURE__ */ React7.createElement(Tag, props);
954 }
955
956 // node_modules/@base-ui/utils/useId.mjs
957 var React8 = __toESM(require_react(), 1);
958 var globalId = 0;
959 function useGlobalId(idOverride, prefix = "mui") {
960 const [defaultId, setDefaultId] = React8.useState(idOverride);
961 const id = idOverride || defaultId;
962 React8.useEffect(() => {
963 if (defaultId == null) {
964 globalId += 1;
965 setDefaultId(`${prefix}-${globalId}`);
966 }
967 }, [defaultId, prefix]);
968 return id;
969 }
970 var maybeReactUseId = SafeReact.useId;
971 function useId(idOverride, prefix) {
972 if (maybeReactUseId !== void 0) {
973 const reactId = maybeReactUseId();
974 return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
975 }
976 return useGlobalId(idOverride, prefix);
977 }
978
979 // node_modules/@base-ui/react/internals/useBaseUiId.mjs
980 function useBaseUiId(idOverride) {
981 return useId(idOverride, "base-ui");
982 }
983
984 // node_modules/@base-ui/react/internals/reason-parts.mjs
985 var reason_parts_exports = {};
986 __export(reason_parts_exports, {
987 cancelOpen: () => cancelOpen,
988 chipRemovePress: () => chipRemovePress,
989 clearPress: () => clearPress,
990 closePress: () => closePress,
991 closeWatcher: () => closeWatcher,
992 decrementPress: () => decrementPress,
993 disabled: () => disabled,
994 drag: () => drag,
995 escapeKey: () => escapeKey,
996 focusOut: () => focusOut,
997 imperativeAction: () => imperativeAction,
998 incrementPress: () => incrementPress,
999 initial: () => initial,
1000 inputBlur: () => inputBlur,
1001 inputChange: () => inputChange,
1002 inputClear: () => inputClear,
1003 inputPaste: () => inputPaste,
1004 inputPress: () => inputPress,
1005 itemPress: () => itemPress,
1006 keyboard: () => keyboard,
1007 linkPress: () => linkPress,
1008 listNavigation: () => listNavigation,
1009 missing: () => missing,
1010 none: () => none,
1011 outsidePress: () => outsidePress,
1012 pointer: () => pointer,
1013 scrub: () => scrub,
1014 siblingOpen: () => siblingOpen,
1015 swipe: () => swipe,
1016 trackPress: () => trackPress,
1017 triggerFocus: () => triggerFocus,
1018 triggerHover: () => triggerHover,
1019 triggerPress: () => triggerPress,
1020 wheel: () => wheel,
1021 windowResize: () => windowResize
1022 });
1023 var none = "none";
1024 var triggerPress = "trigger-press";
1025 var triggerHover = "trigger-hover";
1026 var triggerFocus = "trigger-focus";
1027 var outsidePress = "outside-press";
1028 var itemPress = "item-press";
1029 var closePress = "close-press";
1030 var linkPress = "link-press";
1031 var clearPress = "clear-press";
1032 var chipRemovePress = "chip-remove-press";
1033 var trackPress = "track-press";
1034 var incrementPress = "increment-press";
1035 var decrementPress = "decrement-press";
1036 var inputChange = "input-change";
1037 var inputClear = "input-clear";
1038 var inputBlur = "input-blur";
1039 var inputPaste = "input-paste";
1040 var inputPress = "input-press";
1041 var focusOut = "focus-out";
1042 var escapeKey = "escape-key";
1043 var closeWatcher = "close-watcher";
1044 var listNavigation = "list-navigation";
1045 var keyboard = "keyboard";
1046 var pointer = "pointer";
1047 var drag = "drag";
1048 var wheel = "wheel";
1049 var scrub = "scrub";
1050 var cancelOpen = "cancel-open";
1051 var siblingOpen = "sibling-open";
1052 var disabled = "disabled";
1053 var missing = "missing";
1054 var initial = "initial";
1055 var imperativeAction = "imperative-action";
1056 var swipe = "swipe";
1057 var windowResize = "window-resize";
1058
1059 // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs
1060 function createChangeEventDetails(reason, event, trigger, customProperties) {
1061 let canceled = false;
1062 let allowPropagation = false;
1063 const custom = customProperties ?? EMPTY_OBJECT;
1064 const details = {
1065 reason,
1066 event: event ?? new Event("base-ui"),
1067 cancel() {
1068 canceled = true;
1069 },
1070 allowPropagation() {
1071 allowPropagation = true;
1072 },
1073 get isCanceled() {
1074 return canceled;
1075 },
1076 get isPropagationAllowed() {
1077 return allowPropagation;
1078 },
1079 trigger,
1080 ...custom
1081 };
1082 return details;
1083 }
1084
1085 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
1086 var React10 = __toESM(require_react(), 1);
1087
1088 // node_modules/@base-ui/utils/useOnMount.mjs
1089 var React9 = __toESM(require_react(), 1);
1090 var EMPTY = [];
1091 function useOnMount(fn) {
1092 React9.useEffect(fn, EMPTY);
1093 }
1094
1095 // node_modules/@base-ui/utils/useAnimationFrame.mjs
1096 var EMPTY2 = null;
1097 var LAST_RAF = globalThis.requestAnimationFrame;
1098 var Scheduler = class {
1099 /* This implementation uses an array as a backing data-structure for frame callbacks.
1100 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
1101 * never calls the native `cancelAnimationFrame` if there are no frames left. This can
1102 * be much more efficient if there is a call pattern that alterns as
1103 * "request-cancel-request-cancel-…".
1104 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
1105 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
1106 callbacks = [];
1107 callbacksCount = 0;
1108 nextId = 1;
1109 startId = 1;
1110 isScheduled = false;
1111 tick = (timestamp) => {
1112 this.isScheduled = false;
1113 const currentCallbacks = this.callbacks;
1114 const currentCallbacksCount = this.callbacksCount;
1115 this.callbacks = [];
1116 this.callbacksCount = 0;
1117 this.startId = this.nextId;
1118 if (currentCallbacksCount > 0) {
1119 for (let i = 0; i < currentCallbacks.length; i += 1) {
1120 currentCallbacks[i]?.(timestamp);
1121 }
1122 }
1123 };
1124 request(fn) {
1125 const id = this.nextId;
1126 this.nextId += 1;
1127 this.callbacks.push(fn);
1128 this.callbacksCount += 1;
1129 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
1130 if (!this.isScheduled || didRAFChange) {
1131 requestAnimationFrame(this.tick);
1132 this.isScheduled = true;
1133 }
1134 return id;
1135 }
1136 cancel(id) {
1137 const index2 = id - this.startId;
1138 if (index2 < 0 || index2 >= this.callbacks.length) {
1139 return;
1140 }
1141 this.callbacks[index2] = null;
1142 this.callbacksCount -= 1;
1143 }
1144 };
1145 var scheduler = new Scheduler();
1146 var AnimationFrame = class _AnimationFrame {
1147 static create() {
1148 return new _AnimationFrame();
1149 }
1150 static request(fn) {
1151 return scheduler.request(fn);
1152 }
1153 static cancel(id) {
1154 return scheduler.cancel(id);
1155 }
1156 currentId = EMPTY2;
1157 /**
1158 * Executes `fn` after `delay`, clearing any previously scheduled call.
1159 */
1160 request(fn) {
1161 this.cancel();
1162 this.currentId = scheduler.request(() => {
1163 this.currentId = EMPTY2;
1164 fn();
1165 });
1166 }
1167 cancel = () => {
1168 if (this.currentId !== EMPTY2) {
1169 scheduler.cancel(this.currentId);
1170 this.currentId = EMPTY2;
1171 }
1172 };
1173 disposeEffect = () => {
1174 return this.cancel;
1175 };
1176 };
1177 function useAnimationFrame() {
1178 const timeout = useRefWithInit(AnimationFrame.create).current;
1179 useOnMount(timeout.disposeEffect);
1180 return timeout;
1181 }
1182
1183 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
1184 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {
1185 const [transitionStatus, setTransitionStatus] = React10.useState(open && enableIdleState ? "idle" : void 0);
1186 const [mounted, setMounted] = React10.useState(open);
1187 if (open && !mounted) {
1188 setMounted(true);
1189 setTransitionStatus("starting");
1190 }
1191 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) {
1192 setTransitionStatus("ending");
1193 }
1194 if (!open && !mounted && transitionStatus === "ending") {
1195 setTransitionStatus(void 0);
1196 }
1197 useIsoLayoutEffect(() => {
1198 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) {
1199 const frame = AnimationFrame.request(() => {
1200 setTransitionStatus("ending");
1201 });
1202 return () => {
1203 AnimationFrame.cancel(frame);
1204 };
1205 }
1206 return void 0;
1207 }, [open, mounted, transitionStatus, deferEndingState]);
1208 useIsoLayoutEffect(() => {
1209 if (!open || enableIdleState) {
1210 return void 0;
1211 }
1212 const frame = AnimationFrame.request(() => {
1213 setTransitionStatus(void 0);
1214 });
1215 return () => {
1216 AnimationFrame.cancel(frame);
1217 };
1218 }, [enableIdleState, open]);
1219 useIsoLayoutEffect(() => {
1220 if (!open || !enableIdleState) {
1221 return void 0;
1222 }
1223 if (open && mounted && transitionStatus !== "idle") {
1224 setTransitionStatus("starting");
1225 }
1226 const frame = AnimationFrame.request(() => {
1227 setTransitionStatus("idle");
1228 });
1229 return () => {
1230 AnimationFrame.cancel(frame);
1231 };
1232 }, [enableIdleState, open, mounted, transitionStatus]);
1233 return {
1234 mounted,
1235 setMounted,
1236 transitionStatus
1237 };
1238 }
1239
1240 // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs
1241 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) {
1242 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style";
1243 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style";
1244 return TransitionStatusDataAttributes2;
1245 })({});
1246 var STARTING_HOOK = {
1247 [TransitionStatusDataAttributes.startingStyle]: ""
1248 };
1249 var ENDING_HOOK = {
1250 [TransitionStatusDataAttributes.endingStyle]: ""
1251 };
1252 var transitionStatusMapping = {
1253 transitionStatus(value) {
1254 if (value === "starting") {
1255 return STARTING_HOOK;
1256 }
1257 if (value === "ending") {
1258 return ENDING_HOOK;
1259 }
1260 return null;
1261 }
1262 };
1263
1264 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
1265 function hasWindow() {
1266 return typeof window !== "undefined";
1267 }
1268 function getNodeName(node) {
1269 if (isNode(node)) {
1270 return (node.nodeName || "").toLowerCase();
1271 }
1272 return "#document";
1273 }
1274 function getWindow(node) {
1275 var _node$ownerDocument;
1276 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1277 }
1278 function getDocumentElement(node) {
1279 var _ref;
1280 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1281 }
1282 function isNode(value) {
1283 if (!hasWindow()) {
1284 return false;
1285 }
1286 return value instanceof Node || value instanceof getWindow(value).Node;
1287 }
1288 function isElement(value) {
1289 if (!hasWindow()) {
1290 return false;
1291 }
1292 return value instanceof Element || value instanceof getWindow(value).Element;
1293 }
1294 function isHTMLElement(value) {
1295 if (!hasWindow()) {
1296 return false;
1297 }
1298 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1299 }
1300 function isShadowRoot(value) {
1301 if (!hasWindow() || typeof ShadowRoot === "undefined") {
1302 return false;
1303 }
1304 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1305 }
1306 function isOverflowElement(element) {
1307 const {
1308 overflow,
1309 overflowX,
1310 overflowY,
1311 display
1312 } = getComputedStyle2(element);
1313 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
1314 }
1315 function isTableElement(element) {
1316 return /^(table|td|th)$/.test(getNodeName(element));
1317 }
1318 function isTopLayer(element) {
1319 try {
1320 if (element.matches(":popover-open")) {
1321 return true;
1322 }
1323 } catch (_e) {
1324 }
1325 try {
1326 return element.matches(":modal");
1327 } catch (_e) {
1328 return false;
1329 }
1330 }
1331 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
1332 var containRe = /paint|layout|strict|content/;
1333 var isNotNone = (value) => !!value && value !== "none";
1334 var isWebKitValue;
1335 function isContainingBlock(elementOrCss) {
1336 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
1337 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 || "");
1338 }
1339 function getContainingBlock(element) {
1340 let currentNode = getParentNode(element);
1341 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1342 if (isContainingBlock(currentNode)) {
1343 return currentNode;
1344 } else if (isTopLayer(currentNode)) {
1345 return null;
1346 }
1347 currentNode = getParentNode(currentNode);
1348 }
1349 return null;
1350 }
1351 function isWebKit() {
1352 if (isWebKitValue == null) {
1353 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
1354 }
1355 return isWebKitValue;
1356 }
1357 function isLastTraversableNode(node) {
1358 return /^(html|body|#document)$/.test(getNodeName(node));
1359 }
1360 function getComputedStyle2(element) {
1361 return getWindow(element).getComputedStyle(element);
1362 }
1363 function getNodeScroll(element) {
1364 if (isElement(element)) {
1365 return {
1366 scrollLeft: element.scrollLeft,
1367 scrollTop: element.scrollTop
1368 };
1369 }
1370 return {
1371 scrollLeft: element.scrollX,
1372 scrollTop: element.scrollY
1373 };
1374 }
1375 function getParentNode(node) {
1376 if (getNodeName(node) === "html") {
1377 return node;
1378 }
1379 const result = (
1380 // Step into the shadow DOM of the parent of a slotted node.
1381 node.assignedSlot || // DOM Element detected.
1382 node.parentNode || // ShadowRoot detected.
1383 isShadowRoot(node) && node.host || // Fallback.
1384 getDocumentElement(node)
1385 );
1386 return isShadowRoot(result) ? result.host : result;
1387 }
1388 function getNearestOverflowAncestor(node) {
1389 const parentNode = getParentNode(node);
1390 if (isLastTraversableNode(parentNode)) {
1391 return node.ownerDocument ? node.ownerDocument.body : node.body;
1392 }
1393 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1394 return parentNode;
1395 }
1396 return getNearestOverflowAncestor(parentNode);
1397 }
1398 function getOverflowAncestors(node, list, traverseIframes) {
1399 var _node$ownerDocument2;
1400 if (list === void 0) {
1401 list = [];
1402 }
1403 if (traverseIframes === void 0) {
1404 traverseIframes = true;
1405 }
1406 const scrollableAncestor = getNearestOverflowAncestor(node);
1407 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1408 const win = getWindow(scrollableAncestor);
1409 if (isBody) {
1410 const frameElement = getFrameElement(win);
1411 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1412 } else {
1413 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1414 }
1415 }
1416 function getFrameElement(win) {
1417 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1418 }
1419
1420 // node_modules/@base-ui/utils/addEventListener.mjs
1421 function addEventListener(target, type, listener, options) {
1422 target.addEventListener(type, listener, options);
1423 return () => {
1424 target.removeEventListener(type, listener, options);
1425 };
1426 }
1427
1428 // node_modules/@base-ui/utils/useValueAsRef.mjs
1429 function useValueAsRef(value) {
1430 const latest = useRefWithInit(createLatestRef, value).current;
1431 latest.next = value;
1432 useIsoLayoutEffect(latest.effect);
1433 return latest;
1434 }
1435 function createLatestRef(value) {
1436 const latest = {
1437 current: value,
1438 next: value,
1439 effect: () => {
1440 latest.current = latest.next;
1441 }
1442 };
1443 return latest;
1444 }
1445
1446 // node_modules/@base-ui/utils/owner.mjs
1447 function ownerDocument(node) {
1448 return node?.ownerDocument || document;
1449 }
1450
1451 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
1452 var React11 = __toESM(require_react(), 1);
1453
1454 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
1455 var ReactDOM = __toESM(require_react_dom(), 1);
1456
1457 // node_modules/@base-ui/react/utils/resolveRef.mjs
1458 function resolveRef(maybeRef) {
1459 if (maybeRef == null) {
1460 return maybeRef;
1461 }
1462 return "current" in maybeRef ? maybeRef.current : maybeRef;
1463 }
1464
1465 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
1466 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) {
1467 const frame = useAnimationFrame();
1468 return useStableCallback((fnToExecute, signal = null) => {
1469 frame.cancel();
1470 const element = resolveRef(elementOrRef);
1471 if (element == null) {
1472 return;
1473 }
1474 const resolvedElement = element;
1475 const done = () => {
1476 ReactDOM.flushSync(fnToExecute);
1477 };
1478 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
1479 fnToExecute();
1480 return;
1481 }
1482 function exec() {
1483 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => {
1484 if (!signal?.aborted) {
1485 done();
1486 }
1487 }).catch(() => {
1488 if (treatAbortedAsFinished) {
1489 if (!signal?.aborted) {
1490 done();
1491 }
1492 return;
1493 }
1494 const currentAnimations = resolvedElement.getAnimations();
1495 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) {
1496 exec();
1497 }
1498 });
1499 }
1500 if (waitForStartingStyleRemoved) {
1501 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle;
1502 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1503 frame.request(exec);
1504 return;
1505 }
1506 const attributeObserver = new MutationObserver(() => {
1507 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1508 attributeObserver.disconnect();
1509 exec();
1510 }
1511 });
1512 attributeObserver.observe(resolvedElement, {
1513 attributes: true,
1514 attributeFilter: [startingStyleAttribute]
1515 });
1516 signal?.addEventListener("abort", () => attributeObserver.disconnect(), {
1517 once: true
1518 });
1519 return;
1520 }
1521 frame.request(exec);
1522 });
1523 }
1524
1525 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
1526 function useOpenChangeComplete(parameters) {
1527 const {
1528 enabled = true,
1529 open,
1530 ref,
1531 onComplete: onCompleteParam
1532 } = parameters;
1533 const onComplete = useStableCallback(onCompleteParam);
1534 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false);
1535 React11.useEffect(() => {
1536 if (!enabled) {
1537 return void 0;
1538 }
1539 const abortController = new AbortController();
1540 runOnceAnimationsFinish(onComplete, abortController.signal);
1541 return () => {
1542 abortController.abort();
1543 };
1544 }, [enabled, open, onComplete, runOnceAnimationsFinish]);
1545 }
1546
1547 // node_modules/@base-ui/utils/useOnFirstRender.mjs
1548 var React12 = __toESM(require_react(), 1);
1549 function useOnFirstRender(fn) {
1550 const ref = React12.useRef(true);
1551 if (ref.current) {
1552 ref.current = false;
1553 fn();
1554 }
1555 }
1556
1557 // node_modules/@base-ui/utils/platform/parts.mjs
1558 var parts_exports = {};
1559 __export(parts_exports, {
1560 engine: () => engine_exports,
1561 env: () => env_exports,
1562 os: () => os_exports,
1563 screenReader: () => screen_reader_exports
1564 });
1565
1566 // node_modules/@base-ui/utils/platform/os.mjs
1567 var os_exports = {};
1568 __export(os_exports, {
1569 android: () => android,
1570 apple: () => apple,
1571 ios: () => ios,
1572 linux: () => linux,
1573 mac: () => mac,
1574 windows: () => windows
1575 });
1576
1577 // node_modules/@base-ui/utils/platform/shared.mjs
1578 function readRawData() {
1579 if (typeof navigator === "undefined") {
1580 return {
1581 userAgent: "",
1582 platform: "",
1583 maxTouchPoints: 0
1584 };
1585 }
1586 if (true) {
1587 const uaData = navigator.userAgentData;
1588 if (uaData && Array.isArray(uaData.brands)) {
1589 return {
1590 userAgent: uaData.brands.map(({
1591 brand,
1592 version: version2
1593 }) => `${brand}/${version2}`).join(" "),
1594 platform: uaData.platform ?? navigator.platform ?? "",
1595 maxTouchPoints: navigator.maxTouchPoints ?? 0
1596 };
1597 }
1598 }
1599 return {
1600 userAgent: navigator.userAgent,
1601 platform: navigator.platform ?? "",
1602 maxTouchPoints: navigator.maxTouchPoints ?? 0
1603 };
1604 }
1605 var {
1606 userAgent,
1607 platform,
1608 maxTouchPoints
1609 } = readRawData();
1610 var lowerUserAgent = userAgent.toLowerCase();
1611 var lowerPlatform = platform.toLowerCase();
1612
1613 // node_modules/@base-ui/utils/platform/os.mjs
1614 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1;
1615 var ANDROID_STRING = "android";
1616 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);
1617 var mac = !ios && lowerPlatform.startsWith("mac");
1618 var windows = lowerPlatform.startsWith("win");
1619 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform);
1620 var apple = mac || ios;
1621
1622 // node_modules/@base-ui/utils/platform/engine.mjs
1623 var engine_exports = {};
1624 __export(engine_exports, {
1625 blink: () => blink,
1626 gecko: () => gecko,
1627 webkit: () => webkit
1628 });
1629 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none");
1630 var gecko = !webkit && lowerUserAgent.includes("firefox");
1631 var blink = !webkit && lowerUserAgent.includes("chrom");
1632
1633 // node_modules/@base-ui/utils/platform/screen-reader.mjs
1634 var screen_reader_exports = {};
1635 __export(screen_reader_exports, {
1636 voiceOver: () => voiceOver
1637 });
1638 var voiceOver = apple;
1639
1640 // node_modules/@base-ui/utils/platform/env.mjs
1641 var env_exports = {};
1642 __export(env_exports, {
1643 jsdom: () => jsdom
1644 });
1645 var jsdom = /jsdom|happydom/.test(lowerUserAgent);
1646
1647 // node_modules/@base-ui/utils/useTimeout.mjs
1648 var EMPTY3 = 0;
1649 var Timeout = class _Timeout {
1650 static create() {
1651 return new _Timeout();
1652 }
1653 currentId = EMPTY3;
1654 /**
1655 * Executes `fn` after `delay`, clearing any previously scheduled call.
1656 */
1657 start(delay, fn) {
1658 this.clear();
1659 this.currentId = setTimeout(() => {
1660 this.currentId = EMPTY3;
1661 fn();
1662 }, delay);
1663 }
1664 isStarted() {
1665 return this.currentId !== EMPTY3;
1666 }
1667 clear = () => {
1668 if (this.currentId !== EMPTY3) {
1669 clearTimeout(this.currentId);
1670 this.currentId = EMPTY3;
1671 }
1672 };
1673 disposeEffect = () => {
1674 return this.clear;
1675 };
1676 };
1677 function useTimeout() {
1678 const timeout = useRefWithInit(Timeout.create).current;
1679 useOnMount(timeout.disposeEffect);
1680 return timeout;
1681 }
1682
1683 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
1684 var React13 = __toESM(require_react(), 1);
1685
1686 // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs
1687 function isReactEvent(event) {
1688 return "nativeEvent" in event;
1689 }
1690 function isMouseLikePointerType(pointerType, strict) {
1691 const values = ["mouse", "pen"];
1692 if (!strict) {
1693 values.push("", void 0);
1694 }
1695 return values.includes(pointerType);
1696 }
1697 function isClickLikeEvent(event) {
1698 const type = event.type;
1699 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
1700 }
1701
1702 // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs
1703 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable";
1704 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
1705
1706 // node_modules/@base-ui/react/internals/shadowDom.mjs
1707 function activeElement(doc) {
1708 let element = doc.activeElement;
1709 while (element?.shadowRoot?.activeElement != null) {
1710 element = element.shadowRoot.activeElement;
1711 }
1712 return element;
1713 }
1714 function contains(parent, child) {
1715 if (!parent || !child) {
1716 return false;
1717 }
1718 const rootNode = child.getRootNode?.();
1719 if (parent.contains(child)) {
1720 return true;
1721 }
1722 if (rootNode && isShadowRoot(rootNode)) {
1723 let next = child;
1724 while (next) {
1725 if (parent === next) {
1726 return true;
1727 }
1728 next = next.parentNode || next.host;
1729 }
1730 }
1731 return false;
1732 }
1733 function getTarget(event) {
1734 if ("composedPath" in event) {
1735 return event.composedPath()[0];
1736 }
1737 return event.target;
1738 }
1739
1740 // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs
1741 function isTargetInsideEnabledTrigger(target, triggerElements) {
1742 if (!isElement(target)) {
1743 return false;
1744 }
1745 const targetElement = target;
1746 if (triggerElements.hasElement(targetElement)) {
1747 return !targetElement.hasAttribute("data-trigger-disabled");
1748 }
1749 for (const [, trigger] of triggerElements.entries()) {
1750 if (contains(trigger, targetElement)) {
1751 return !trigger.hasAttribute("data-trigger-disabled");
1752 }
1753 }
1754 return false;
1755 }
1756 function isEventTargetWithin(event, node) {
1757 if (node == null) {
1758 return false;
1759 }
1760 if ("composedPath" in event) {
1761 return event.composedPath().includes(node);
1762 }
1763 const eventAgain = event;
1764 return eventAgain.target != null && node.contains(eventAgain.target);
1765 }
1766 function isRootElement(element) {
1767 return element.matches("html,body");
1768 }
1769 function isTypeableElement(element) {
1770 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
1771 }
1772 function isInteractiveElement(element) {
1773 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null;
1774 }
1775 function matchesFocusVisible(element) {
1776 if (!element || parts_exports.env.jsdom) {
1777 return true;
1778 }
1779 try {
1780 return element.matches(":focus-visible");
1781 } catch (_e) {
1782 return true;
1783 }
1784 }
1785
1786 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs
1787 function resolveValue(value, pointerType) {
1788 if (pointerType != null && !isMouseLikePointerType(pointerType)) {
1789 return 0;
1790 }
1791 if (typeof value === "function") {
1792 return value();
1793 }
1794 return value;
1795 }
1796 function getDelay(value, prop, pointerType) {
1797 const result = resolveValue(value, pointerType);
1798 if (typeof result === "number") {
1799 return result;
1800 }
1801 return result?.[prop];
1802 }
1803 function getRestMs(value) {
1804 if (typeof value === "function") {
1805 return value();
1806 }
1807 return value;
1808 }
1809 function isClickLikeOpenEvent(openEventType, interactedInside) {
1810 return interactedInside || openEventType === "click" || openEventType === "mousedown";
1811 }
1812 function isHoverOpenEvent(openEventType) {
1813 return openEventType?.includes("mouse") && openEventType !== "mousedown";
1814 }
1815
1816 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
1817 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
1818 var FloatingDelayGroupContext = /* @__PURE__ */ React13.createContext({
1819 hasProvider: false,
1820 timeoutMs: 0,
1821 delayRef: {
1822 current: 0
1823 },
1824 initialDelayRef: {
1825 current: 0
1826 },
1827 timeout: new Timeout(),
1828 currentIdRef: {
1829 current: null
1830 },
1831 currentContextRef: {
1832 current: null
1833 }
1834 });
1835 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext";
1836 function resetDelayRef(delayRef, initialDelayRef) {
1837 delayRef.current = initialDelayRef.current;
1838 }
1839 function FloatingDelayGroup(props) {
1840 const {
1841 children,
1842 delay,
1843 timeoutMs = 0
1844 } = props;
1845 const delayRef = React13.useRef(delay);
1846 const initialDelayRef = React13.useRef(delay);
1847 const currentIdRef = React13.useRef(null);
1848 const currentContextRef = React13.useRef(null);
1849 const timeout = useTimeout();
1850 useIsoLayoutEffect(() => {
1851 initialDelayRef.current = delay;
1852 if (!currentIdRef.current) {
1853 delayRef.current = delay;
1854 return;
1855 }
1856 delayRef.current = {
1857 open: getDelay(delayRef.current, "open"),
1858 close: getDelay(delay, "close")
1859 };
1860 }, [delay, currentIdRef, delayRef, initialDelayRef]);
1861 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, {
1862 value: React13.useMemo(() => ({
1863 hasProvider: true,
1864 delayRef,
1865 initialDelayRef,
1866 currentIdRef,
1867 timeoutMs,
1868 currentContextRef,
1869 timeout
1870 }), [timeoutMs, timeout]),
1871 children
1872 });
1873 }
1874 function useDelayGroup(context, options = {
1875 open: false
1876 }) {
1877 const {
1878 open
1879 } = options;
1880 const store2 = "rootStore" in context ? context.rootStore : context;
1881 const floatingId = store2.useState("floatingId");
1882 const groupContext = React13.useContext(FloatingDelayGroupContext);
1883 const {
1884 currentIdRef,
1885 delayRef,
1886 timeoutMs,
1887 initialDelayRef,
1888 currentContextRef,
1889 hasProvider,
1890 timeout
1891 } = groupContext;
1892 const [isInstantPhase, setIsInstantPhase] = React13.useState(false);
1893 const openRef = React13.useRef(open);
1894 const isUnmountedRef = React13.useRef(false);
1895 useIsoLayoutEffect(() => {
1896 openRef.current = open;
1897 }, [open]);
1898 useIsoLayoutEffect(() => {
1899 return () => {
1900 isUnmountedRef.current = true;
1901 };
1902 }, []);
1903 useIsoLayoutEffect(() => {
1904 function unset() {
1905 if (!isUnmountedRef.current) {
1906 setIsInstantPhase(false);
1907 }
1908 currentContextRef.current?.setIsInstantPhase(false);
1909 currentIdRef.current = null;
1910 currentContextRef.current = null;
1911 delayRef.current = initialDelayRef.current;
1912 timeout.clear();
1913 }
1914 if (!currentIdRef.current) {
1915 return void 0;
1916 }
1917 if (!open && currentIdRef.current === floatingId) {
1918 setIsInstantPhase(false);
1919 if (timeoutMs) {
1920 const closingId = floatingId;
1921 timeout.start(timeoutMs, () => {
1922 if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) {
1923 return;
1924 }
1925 unset();
1926 });
1927 return () => {
1928 if (openRef.current || currentIdRef.current !== closingId) {
1929 timeout.clear();
1930 }
1931 };
1932 }
1933 unset();
1934 }
1935 return void 0;
1936 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]);
1937 useIsoLayoutEffect(() => {
1938 if (!open) {
1939 return;
1940 }
1941 const prevContext = currentContextRef.current;
1942 const prevId = currentIdRef.current;
1943 timeout.clear();
1944 currentContextRef.current = {
1945 onOpenChange: store2.setOpen,
1946 setIsInstantPhase
1947 };
1948 currentIdRef.current = floatingId;
1949 delayRef.current = {
1950 open: 0,
1951 close: getDelay(initialDelayRef.current, "close")
1952 };
1953 if (prevId !== null && prevId !== floatingId) {
1954 setIsInstantPhase(true);
1955 prevContext?.setIsInstantPhase(true);
1956 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none));
1957 } else {
1958 setIsInstantPhase(false);
1959 prevContext?.setIsInstantPhase(false);
1960 }
1961 }, [open, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]);
1962 useIsoLayoutEffect(() => {
1963 return () => {
1964 if (currentIdRef.current === floatingId) {
1965 currentContextRef.current = null;
1966 if (!openRef.current) {
1967 return;
1968 }
1969 currentIdRef.current = null;
1970 resetDelayRef(delayRef, initialDelayRef);
1971 timeout.clear();
1972 }
1973 };
1974 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]);
1975 return React13.useMemo(() => ({
1976 hasProvider,
1977 delayRef,
1978 isInstantPhase
1979 }), [hasProvider, delayRef, isInstantPhase]);
1980 }
1981
1982 // node_modules/@base-ui/utils/mergeCleanups.mjs
1983 function mergeCleanups(...cleanups) {
1984 return () => {
1985 for (let i = 0; i < cleanups.length; i += 1) {
1986 const cleanup = cleanups[i];
1987 if (cleanup) {
1988 cleanup();
1989 }
1990 }
1991 };
1992 }
1993
1994 // node_modules/@base-ui/react/utils/FocusGuard.mjs
1995 var React14 = __toESM(require_react(), 1);
1996
1997 // node_modules/@base-ui/utils/visuallyHidden.mjs
1998 var visuallyHiddenBase = {
1999 clipPath: "inset(50%)",
2000 overflow: "hidden",
2001 whiteSpace: "nowrap",
2002 border: 0,
2003 padding: 0,
2004 width: 1,
2005 height: 1,
2006 margin: -1
2007 };
2008 var visuallyHidden = {
2009 ...visuallyHiddenBase,
2010 position: "fixed",
2011 top: 0,
2012 left: 0
2013 };
2014 var visuallyHiddenInput = {
2015 ...visuallyHiddenBase,
2016 position: "absolute"
2017 };
2018
2019 // node_modules/@base-ui/react/utils/FocusGuard.mjs
2020 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
2021 var FocusGuard = /* @__PURE__ */ React14.forwardRef(function FocusGuard2(props, ref) {
2022 const [role, setRole] = React14.useState();
2023 useIsoLayoutEffect(() => {
2024 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) {
2025 setRole("button");
2026 }
2027 }, []);
2028 const restProps = {
2029 tabIndex: 0,
2030 // Role is only for VoiceOver
2031 role
2032 };
2033 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
2034 ...props,
2035 ref,
2036 style: visuallyHidden,
2037 "aria-hidden": role ? void 0 : true,
2038 ...restProps,
2039 "data-base-ui-focus-guard": ""
2040 });
2041 });
2042 if (true) FocusGuard.displayName = "FocusGuard";
2043
2044 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
2045 var sides = ["top", "right", "bottom", "left"];
2046 var min = Math.min;
2047 var max = Math.max;
2048 var round = Math.round;
2049 var floor = Math.floor;
2050 var createCoords = (v) => ({
2051 x: v,
2052 y: v
2053 });
2054 var oppositeSideMap = {
2055 left: "right",
2056 right: "left",
2057 bottom: "top",
2058 top: "bottom"
2059 };
2060 function clamp(start, value, end) {
2061 return max(start, min(value, end));
2062 }
2063 function evaluate(value, param) {
2064 return typeof value === "function" ? value(param) : value;
2065 }
2066 function getSide(placement) {
2067 return placement.split("-")[0];
2068 }
2069 function getAlignment(placement) {
2070 return placement.split("-")[1];
2071 }
2072 function getOppositeAxis(axis) {
2073 return axis === "x" ? "y" : "x";
2074 }
2075 function getAxisLength(axis) {
2076 return axis === "y" ? "height" : "width";
2077 }
2078 function getSideAxis(placement) {
2079 const firstChar = placement[0];
2080 return firstChar === "t" || firstChar === "b" ? "y" : "x";
2081 }
2082 function getAlignmentAxis(placement) {
2083 return getOppositeAxis(getSideAxis(placement));
2084 }
2085 function getAlignmentSides(placement, rects, rtl) {
2086 if (rtl === void 0) {
2087 rtl = false;
2088 }
2089 const alignment = getAlignment(placement);
2090 const alignmentAxis = getAlignmentAxis(placement);
2091 const length = getAxisLength(alignmentAxis);
2092 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
2093 if (rects.reference[length] > rects.floating[length]) {
2094 mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
2095 }
2096 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
2097 }
2098 function getExpandedPlacements(placement) {
2099 const oppositePlacement = getOppositePlacement(placement);
2100 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
2101 }
2102 function getOppositeAlignmentPlacement(placement) {
2103 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
2104 }
2105 var lrPlacement = ["left", "right"];
2106 var rlPlacement = ["right", "left"];
2107 var tbPlacement = ["top", "bottom"];
2108 var btPlacement = ["bottom", "top"];
2109 function getSideList(side, isStart, rtl) {
2110 switch (side) {
2111 case "top":
2112 case "bottom":
2113 if (rtl) return isStart ? rlPlacement : lrPlacement;
2114 return isStart ? lrPlacement : rlPlacement;
2115 case "left":
2116 case "right":
2117 return isStart ? tbPlacement : btPlacement;
2118 default:
2119 return [];
2120 }
2121 }
2122 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
2123 const alignment = getAlignment(placement);
2124 let list = getSideList(getSide(placement), direction === "start", rtl);
2125 if (alignment) {
2126 list = list.map((side) => side + "-" + alignment);
2127 if (flipAlignment) {
2128 list = list.concat(list.map(getOppositeAlignmentPlacement));
2129 }
2130 }
2131 return list;
2132 }
2133 function getOppositePlacement(placement) {
2134 const side = getSide(placement);
2135 return oppositeSideMap[side] + placement.slice(side.length);
2136 }
2137 function expandPaddingObject(padding) {
2138 return {
2139 top: 0,
2140 right: 0,
2141 bottom: 0,
2142 left: 0,
2143 ...padding
2144 };
2145 }
2146 function getPaddingObject(padding) {
2147 return typeof padding !== "number" ? expandPaddingObject(padding) : {
2148 top: padding,
2149 right: padding,
2150 bottom: padding,
2151 left: padding
2152 };
2153 }
2154 function rectToClientRect(rect) {
2155 const {
2156 x,
2157 y,
2158 width,
2159 height
2160 } = rect;
2161 return {
2162 width,
2163 height,
2164 top: y,
2165 left: x,
2166 right: x + width,
2167 bottom: y + height,
2168 x,
2169 y
2170 };
2171 }
2172
2173 // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs
2174 function isHiddenByStyles(styles) {
2175 return styles.visibility === "hidden" || styles.visibility === "collapse";
2176 }
2177 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) {
2178 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
2179 return false;
2180 }
2181 if (typeof element.checkVisibility === "function") {
2182 return element.checkVisibility();
2183 }
2184 return styles.display !== "none" && styles.display !== "contents";
2185 }
2186
2187 // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs
2188 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';
2189 function getParentElement(element) {
2190 const assignedSlot = element.assignedSlot;
2191 if (assignedSlot) {
2192 return assignedSlot;
2193 }
2194 if (element.parentElement) {
2195 return element.parentElement;
2196 }
2197 const rootNode = element.getRootNode();
2198 return isShadowRoot(rootNode) ? rootNode.host : null;
2199 }
2200 function getDetailsSummary(details) {
2201 for (const child of Array.from(details.children)) {
2202 if (getNodeName(child) === "summary") {
2203 return child;
2204 }
2205 }
2206 return null;
2207 }
2208 function isWithinOpenDetailsSummary(element, details) {
2209 const summary = getDetailsSummary(details);
2210 return !!summary && (element === summary || contains(summary, element));
2211 }
2212 function isFocusableCandidate(element) {
2213 const nodeName = element ? getNodeName(element) : "";
2214 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");
2215 }
2216 function isFocusableElement(element) {
2217 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) {
2218 return false;
2219 }
2220 for (let current = element; current; current = getParentElement(current)) {
2221 const isAncestor = current !== element;
2222 const isSlot = getNodeName(current) === "slot";
2223 if (current.hasAttribute("inert")) {
2224 return false;
2225 }
2226 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {
2227 return false;
2228 }
2229 }
2230 return true;
2231 }
2232 function isVisibleInTabbableTree(element, isAncestor) {
2233 const styles = getComputedStyle2(element);
2234 if (!isAncestor) {
2235 return isElementVisible(element, styles);
2236 }
2237 return styles.display !== "none";
2238 }
2239 function getTabIndex(element) {
2240 const tabIndex = element.tabIndex;
2241 if (tabIndex < 0) {
2242 const nodeName = getNodeName(element);
2243 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) {
2244 return 0;
2245 }
2246 }
2247 return tabIndex;
2248 }
2249 function getNamedRadioInput(element) {
2250 if (getNodeName(element) !== "input") {
2251 return null;
2252 }
2253 const input = element;
2254 return input.type === "radio" && input.name !== "" ? input : null;
2255 }
2256 function isTabbableRadio(element, candidates) {
2257 const input = getNamedRadioInput(element);
2258 if (!input) {
2259 return true;
2260 }
2261 const checkedRadio = candidates.find((candidate) => {
2262 const radio = getNamedRadioInput(candidate);
2263 return radio?.name === input.name && radio.form === input.form && radio.checked;
2264 });
2265 if (checkedRadio) {
2266 return checkedRadio === input;
2267 }
2268 return candidates.find((candidate) => {
2269 const radio = getNamedRadioInput(candidate);
2270 return radio?.name === input.name && radio.form === input.form;
2271 }) === input;
2272 }
2273 function getComposedChildren(container) {
2274 if (isHTMLElement(container) && getNodeName(container) === "slot") {
2275 const assignedElements = container.assignedElements({
2276 flatten: true
2277 });
2278 if (assignedElements.length > 0) {
2279 return assignedElements;
2280 }
2281 }
2282 if (isHTMLElement(container) && container.shadowRoot) {
2283 return Array.from(container.shadowRoot.children);
2284 }
2285 return Array.from(container.children);
2286 }
2287 function appendCandidates(container, list) {
2288 getComposedChildren(container).forEach((child) => {
2289 if (isFocusableCandidate(child)) {
2290 list.push(child);
2291 }
2292 appendCandidates(child, list);
2293 });
2294 }
2295 function appendMatchingElements(container, selector, list) {
2296 getComposedChildren(container).forEach((child) => {
2297 if (isHTMLElement(child) && child.matches(selector)) {
2298 list.push(child);
2299 }
2300 appendMatchingElements(child, selector, list);
2301 });
2302 }
2303 function focusable(container) {
2304 const candidates = [];
2305 appendCandidates(container, candidates);
2306 return candidates.filter(isFocusableElement);
2307 }
2308 function tabbable(container) {
2309 const candidates = focusable(container);
2310 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));
2311 }
2312 function getTabbableIn(container, dir) {
2313 const list = tabbable(container);
2314 const len = list.length;
2315 if (len === 0) {
2316 return void 0;
2317 }
2318 const active = activeElement(ownerDocument(container));
2319 const index2 = list.indexOf(active);
2320 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir;
2321 return list[nextIndex];
2322 }
2323 function getNextTabbable(referenceElement) {
2324 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;
2325 }
2326 function getPreviousTabbable(referenceElement) {
2327 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
2328 }
2329 function isOutsideEvent(event, container) {
2330 const containerElement = container || event.currentTarget;
2331 const relatedTarget = event.relatedTarget;
2332 return !relatedTarget || !contains(containerElement, relatedTarget);
2333 }
2334 function disableFocusInside(container) {
2335 const tabbableElements = tabbable(container);
2336 tabbableElements.forEach((element) => {
2337 element.dataset.tabindex = element.getAttribute("tabindex") || "";
2338 element.setAttribute("tabindex", "-1");
2339 });
2340 }
2341 function enableFocusInside(container) {
2342 const elements = [];
2343 appendMatchingElements(container, "[data-tabindex]", elements);
2344 elements.forEach((element) => {
2345 const tabindex = element.dataset.tabindex;
2346 delete element.dataset.tabindex;
2347 if (tabindex) {
2348 element.setAttribute("tabindex", tabindex);
2349 } else {
2350 element.removeAttribute("tabindex");
2351 }
2352 });
2353 }
2354
2355 // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs
2356 function getNodeChildren(nodes, id, onlyOpenChildren = true) {
2357 const directChildren = nodes.filter((node) => node.parentId === id);
2358 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
2359 }
2360
2361 // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs
2362 function createAttribute(name) {
2363 return `data-base-ui-${name}`;
2364 }
2365
2366 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
2367 var React15 = __toESM(require_react(), 1);
2368 var ReactDOM2 = __toESM(require_react_dom(), 1);
2369
2370 // node_modules/@base-ui/react/internals/constants.mjs
2371 var DISABLED_TRANSITIONS_STYLE = {
2372 style: {
2373 transition: "none"
2374 }
2375 };
2376 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
2377 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
2378 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
2379 var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
2380 var POPUP_COLLISION_AVOIDANCE = {
2381 fallbackAxisSide: "end"
2382 };
2383 var ownerVisuallyHidden = {
2384 clipPath: "inset(50%)",
2385 position: "fixed",
2386 top: 0,
2387 left: 0
2388 };
2389
2390 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
2391 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
2392 var PortalContext = /* @__PURE__ */ React15.createContext(null);
2393 if (true) PortalContext.displayName = "PortalContext";
2394 var usePortalContext = () => React15.useContext(PortalContext);
2395 var attr = createAttribute("portal");
2396 function useFloatingPortalNode(props = {}) {
2397 const {
2398 ref,
2399 container: containerProp,
2400 componentProps = EMPTY_OBJECT,
2401 elementProps
2402 } = props;
2403 const uniqueId = useId();
2404 const portalContext = usePortalContext();
2405 const parentPortalNode = portalContext?.portalNode;
2406 const [containerElement, setContainerElement] = React15.useState(null);
2407 const [portalNode, setPortalNode] = React15.useState(null);
2408 const setPortalNodeRef = useStableCallback((node) => {
2409 if (node !== null) {
2410 setPortalNode(node);
2411 }
2412 });
2413 const containerRef = React15.useRef(null);
2414 useIsoLayoutEffect(() => {
2415 if (containerProp === null) {
2416 if (containerRef.current) {
2417 containerRef.current = null;
2418 setPortalNode(null);
2419 setContainerElement(null);
2420 }
2421 return;
2422 }
2423 if (uniqueId == null) {
2424 return;
2425 }
2426 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
2427 if (resolvedContainer == null) {
2428 if (containerRef.current) {
2429 containerRef.current = null;
2430 setPortalNode(null);
2431 setContainerElement(null);
2432 }
2433 return;
2434 }
2435 if (containerRef.current !== resolvedContainer) {
2436 containerRef.current = resolvedContainer;
2437 setPortalNode(null);
2438 setContainerElement(resolvedContainer);
2439 }
2440 }, [containerProp, parentPortalNode, uniqueId]);
2441 const portalElement = useRenderElement("div", componentProps, {
2442 ref: [ref, setPortalNodeRef],
2443 props: [{
2444 id: uniqueId,
2445 [attr]: ""
2446 }, elementProps]
2447 });
2448 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null;
2449 return {
2450 portalNode,
2451 portalSubtree
2452 };
2453 }
2454 var FloatingPortal = /* @__PURE__ */ React15.forwardRef(function FloatingPortal2(componentProps, forwardedRef) {
2455 const {
2456 render,
2457 className,
2458 style,
2459 children,
2460 container,
2461 renderGuards,
2462 ...elementProps
2463 } = componentProps;
2464 const {
2465 portalNode,
2466 portalSubtree
2467 } = useFloatingPortalNode({
2468 container,
2469 ref: forwardedRef,
2470 componentProps,
2471 elementProps
2472 });
2473 const beforeOutsideRef = React15.useRef(null);
2474 const afterOutsideRef = React15.useRef(null);
2475 const beforeInsideRef = React15.useRef(null);
2476 const afterInsideRef = React15.useRef(null);
2477 const [focusManagerState, setFocusManagerState] = React15.useState(null);
2478 const focusInsideDisabledRef = React15.useRef(false);
2479 const modal = focusManagerState?.modal;
2480 const open = focusManagerState?.open;
2481 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
2482 React15.useEffect(() => {
2483 if (!portalNode || modal) {
2484 return void 0;
2485 }
2486 function onFocus(event) {
2487 if (portalNode && event.relatedTarget && isOutsideEvent(event)) {
2488 if (event.type === "focusin") {
2489 if (focusInsideDisabledRef.current) {
2490 enableFocusInside(portalNode);
2491 focusInsideDisabledRef.current = false;
2492 }
2493 } else {
2494 disableFocusInside(portalNode);
2495 focusInsideDisabledRef.current = true;
2496 }
2497 }
2498 }
2499 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true));
2500 }, [portalNode, modal]);
2501 useIsoLayoutEffect(() => {
2502 if (!portalNode || open !== true || !focusInsideDisabledRef.current) {
2503 return;
2504 }
2505 enableFocusInside(portalNode);
2506 focusInsideDisabledRef.current = false;
2507 }, [open, portalNode]);
2508 const portalContextValue = React15.useMemo(() => ({
2509 beforeOutsideRef,
2510 afterOutsideRef,
2511 beforeInsideRef,
2512 afterInsideRef,
2513 portalNode,
2514 setFocusManagerState
2515 }), [portalNode]);
2516 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React15.Fragment, {
2517 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, {
2518 value: portalContextValue,
2519 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
2520 "data-type": "outside",
2521 ref: beforeOutsideRef,
2522 onFocus: (event) => {
2523 if (isOutsideEvent(event, portalNode)) {
2524 beforeInsideRef.current?.focus();
2525 } else {
2526 const domReference = focusManagerState ? focusManagerState.domReference : null;
2527 const prevTabbable = getPreviousTabbable(domReference);
2528 prevTabbable?.focus();
2529 }
2530 }
2531 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", {
2532 "aria-owns": portalNode.id,
2533 style: ownerVisuallyHidden
2534 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
2535 "data-type": "outside",
2536 ref: afterOutsideRef,
2537 onFocus: (event) => {
2538 if (isOutsideEvent(event, portalNode)) {
2539 afterInsideRef.current?.focus();
2540 } else {
2541 const domReference = focusManagerState ? focusManagerState.domReference : null;
2542 const nextTabbable = getNextTabbable(domReference);
2543 nextTabbable?.focus();
2544 if (focusManagerState?.closeOnFocusOut) {
2545 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent));
2546 }
2547 }
2548 }
2549 })]
2550 })]
2551 });
2552 });
2553 if (true) FloatingPortal.displayName = "FloatingPortal";
2554
2555 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
2556 var React16 = __toESM(require_react(), 1);
2557
2558 // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs
2559 function createEventEmitter() {
2560 const map = /* @__PURE__ */ new Map();
2561 return {
2562 emit(event, data) {
2563 map.get(event)?.forEach((listener) => listener(data));
2564 },
2565 on(event, listener) {
2566 if (!map.has(event)) {
2567 map.set(event, /* @__PURE__ */ new Set());
2568 }
2569 map.get(event).add(listener);
2570 },
2571 off(event, listener) {
2572 map.get(event)?.delete(listener);
2573 }
2574 };
2575 }
2576
2577 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
2578 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
2579 var FloatingNodeContext = /* @__PURE__ */ React16.createContext(null);
2580 if (true) FloatingNodeContext.displayName = "FloatingNodeContext";
2581 var FloatingTreeContext = /* @__PURE__ */ React16.createContext(null);
2582 if (true) FloatingTreeContext.displayName = "FloatingTreeContext";
2583 var useFloatingParentNodeId = () => React16.useContext(FloatingNodeContext)?.id || null;
2584 var useFloatingTree = (externalTree) => {
2585 const contextTree = React16.useContext(FloatingTreeContext);
2586 return externalTree ?? contextTree;
2587 };
2588
2589 // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs
2590 var React17 = __toESM(require_react(), 1);
2591 function createVirtualElement(domElement, data) {
2592 let offsetX = null;
2593 let offsetY = null;
2594 let isAutoUpdateEvent = false;
2595 return {
2596 contextElement: domElement || void 0,
2597 getBoundingClientRect() {
2598 const domRect = domElement?.getBoundingClientRect() || {
2599 width: 0,
2600 height: 0,
2601 x: 0,
2602 y: 0
2603 };
2604 const isXAxis = data.axis === "x" || data.axis === "both";
2605 const isYAxis = data.axis === "y" || data.axis === "both";
2606 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch";
2607 let width = domRect.width;
2608 let height = domRect.height;
2609 let x = domRect.x;
2610 let y = domRect.y;
2611 if (offsetX == null && data.x && isXAxis) {
2612 offsetX = domRect.x - data.x;
2613 }
2614 if (offsetY == null && data.y && isYAxis) {
2615 offsetY = domRect.y - data.y;
2616 }
2617 x -= offsetX || 0;
2618 y -= offsetY || 0;
2619 width = 0;
2620 height = 0;
2621 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
2622 width = data.axis === "y" ? domRect.width : 0;
2623 height = data.axis === "x" ? domRect.height : 0;
2624 x = isXAxis && data.x != null ? data.x : x;
2625 y = isYAxis && data.y != null ? data.y : y;
2626 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
2627 height = data.axis === "x" ? domRect.height : height;
2628 width = data.axis === "y" ? domRect.width : width;
2629 }
2630 isAutoUpdateEvent = true;
2631 return {
2632 width,
2633 height,
2634 x,
2635 y,
2636 top: y,
2637 right: x + width,
2638 bottom: y + height,
2639 left: x
2640 };
2641 }
2642 };
2643 }
2644 function isMouseBasedEvent(event) {
2645 return event != null && event.clientX != null;
2646 }
2647 function useClientPoint(context, props = {}) {
2648 const {
2649 enabled = true,
2650 axis = "both"
2651 } = props;
2652 const store2 = "rootStore" in context ? context.rootStore : context;
2653 const open = store2.useState("open");
2654 const floating = store2.useState("floatingElement");
2655 const domReference = store2.useState("domReferenceElement");
2656 const dataRef = store2.context.dataRef;
2657 const initialRef = React17.useRef(false);
2658 const cleanupListenerRef = React17.useRef(null);
2659 const [pointerType, setPointerType] = React17.useState();
2660 const [reactive, setReactive] = React17.useState([]);
2661 const resetReference = useStableCallback((reference2) => {
2662 store2.set("positionReference", reference2);
2663 });
2664 const setReference = useStableCallback((newX, newY, referenceElement) => {
2665 if (initialRef.current) {
2666 return;
2667 }
2668 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {
2669 return;
2670 }
2671 store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, {
2672 x: newX,
2673 y: newY,
2674 axis,
2675 dataRef,
2676 pointerType
2677 }));
2678 });
2679 const handleReferenceEnterOrMove = useStableCallback((event) => {
2680 if (!open) {
2681 setReference(event.clientX, event.clientY, event.currentTarget);
2682 } else if (!cleanupListenerRef.current) {
2683 setReference(event.clientX, event.clientY, event.currentTarget);
2684 setReactive([]);
2685 }
2686 });
2687 const openCheck = isMouseLikePointerType(pointerType) ? floating : open;
2688 React17.useEffect(() => {
2689 if (!enabled) {
2690 resetReference(domReference);
2691 return void 0;
2692 }
2693 if (!openCheck) {
2694 return void 0;
2695 }
2696 function cleanupListener() {
2697 cleanupListenerRef.current?.();
2698 cleanupListenerRef.current = null;
2699 }
2700 const win = getWindow(floating);
2701 function handleMouseMove(event) {
2702 const target = getTarget(event);
2703 if (!contains(floating, target)) {
2704 setReference(event.clientX, event.clientY);
2705 } else {
2706 cleanupListener();
2707 }
2708 }
2709 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {
2710 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove);
2711 } else {
2712 resetReference(domReference);
2713 }
2714 return cleanupListener;
2715 }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]);
2716 React17.useEffect(() => () => {
2717 store2.set("positionReference", null);
2718 }, [store2]);
2719 React17.useEffect(() => {
2720 if (enabled && !floating) {
2721 initialRef.current = false;
2722 }
2723 }, [enabled, floating]);
2724 React17.useEffect(() => {
2725 if (!enabled && open) {
2726 initialRef.current = true;
2727 }
2728 }, [enabled, open]);
2729 const reference = React17.useMemo(() => {
2730 function setPointerTypeRef(event) {
2731 setPointerType(event.pointerType);
2732 }
2733 return {
2734 onPointerDown: setPointerTypeRef,
2735 onPointerEnter: setPointerTypeRef,
2736 onMouseMove: handleReferenceEnterOrMove,
2737 onMouseEnter: handleReferenceEnterOrMove
2738 };
2739 }, [handleReferenceEnterOrMove]);
2740 return React17.useMemo(() => enabled ? {
2741 reference,
2742 trigger: reference
2743 } : {}, [enabled, reference]);
2744 }
2745
2746 // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs
2747 var React18 = __toESM(require_react(), 1);
2748 function alwaysFalse() {
2749 return false;
2750 }
2751 function normalizeProp(normalizable) {
2752 return {
2753 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false,
2754 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true
2755 };
2756 }
2757 function useDismiss(context, props = {}) {
2758 const {
2759 enabled = true,
2760 escapeKey: escapeKey2 = true,
2761 outsidePress: outsidePressProp = true,
2762 outsidePressEvent = "sloppy",
2763 referencePress = alwaysFalse,
2764 bubbles,
2765 externalTree
2766 } = props;
2767 const store2 = "rootStore" in context ? context.rootStore : context;
2768 const open = store2.useState("open");
2769 const floatingElement = store2.useState("floatingElement");
2770 const {
2771 dataRef
2772 } = store2.context;
2773 const tree = useFloatingTree(externalTree);
2774 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false);
2775 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp;
2776 const outsidePressEnabled = outsidePress2 !== false;
2777 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);
2778 const {
2779 escapeKey: escapeKeyBubbles,
2780 outsidePress: outsidePressBubbles
2781 } = normalizeProp(bubbles);
2782 const pressStartedInsideRef = React18.useRef(false);
2783 const pressStartPreventedRef = React18.useRef(false);
2784 const suppressNextOutsideClickRef = React18.useRef(false);
2785 const isComposingRef = React18.useRef(false);
2786 const currentPointerTypeRef = React18.useRef("");
2787 const touchStateRef = React18.useRef(null);
2788 const cancelDismissOnEndTimeout = useTimeout();
2789 const clearInsideReactTreeTimeout = useTimeout();
2790 const clearInsideReactTree = useStableCallback(() => {
2791 clearInsideReactTreeTimeout.clear();
2792 dataRef.current.insideReactTree = false;
2793 });
2794 const hasBlockingChild = useStableCallback((bubbleKey) => {
2795 const nodeId = dataRef.current.floatingContext?.nodeId;
2796 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
2797 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]);
2798 });
2799 const isEventWithinOwnElements = useStableCallback((event) => {
2800 return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement"));
2801 });
2802 const closeOnReferencePress = useStableCallback((event) => {
2803 if (!referencePress()) {
2804 return;
2805 }
2806 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
2807 });
2808 const closeOnEscapeKeyDown = useStableCallback((event) => {
2809 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") {
2810 return;
2811 }
2812 if (isComposingRef.current) {
2813 return;
2814 }
2815 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) {
2816 return;
2817 }
2818 const native = isReactEvent(event) ? event.nativeEvent : event;
2819 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native);
2820 store2.setOpen(false, eventDetails);
2821 if (!eventDetails.isCanceled) {
2822 event.preventDefault();
2823 }
2824 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {
2825 event.stopPropagation();
2826 }
2827 });
2828 const markInsideReactTree = useStableCallback(() => {
2829 dataRef.current.insideReactTree = true;
2830 clearInsideReactTreeTimeout.start(0, clearInsideReactTree);
2831 });
2832 const markPressStartedInsideReactTree = useStableCallback((event) => {
2833 if (!open || !enabled || event.button !== 0) {
2834 return;
2835 }
2836 const target = getTarget(event.nativeEvent);
2837 if (!contains(store2.select("floatingElement"), target)) {
2838 return;
2839 }
2840 if (!pressStartedInsideRef.current) {
2841 pressStartedInsideRef.current = true;
2842 pressStartPreventedRef.current = false;
2843 }
2844 });
2845 const markInsidePressStartPrevented = useStableCallback((event) => {
2846 if (!open || !enabled) {
2847 return;
2848 }
2849 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {
2850 return;
2851 }
2852 if (pressStartedInsideRef.current) {
2853 pressStartPreventedRef.current = true;
2854 }
2855 });
2856 React18.useEffect(() => {
2857 if (!open || !enabled) {
2858 return void 0;
2859 }
2860 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
2861 dataRef.current.__outsidePressBubbles = outsidePressBubbles;
2862 const compositionTimeout = new Timeout();
2863 const preventedPressSuppressionTimeout = new Timeout();
2864 function handleCompositionStart() {
2865 compositionTimeout.clear();
2866 isComposingRef.current = true;
2867 }
2868 function handleCompositionEnd() {
2869 compositionTimeout.start(
2870 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
2871 // Only apply to WebKit for the test to remain 0ms.
2872 parts_exports.engine.webkit ? 5 : 0,
2873 () => {
2874 isComposingRef.current = false;
2875 }
2876 );
2877 }
2878 function suppressImmediateOutsideClickAfterPreventedStart() {
2879 suppressNextOutsideClickRef.current = true;
2880 preventedPressSuppressionTimeout.start(0, () => {
2881 suppressNextOutsideClickRef.current = false;
2882 });
2883 }
2884 function resetPressStartState() {
2885 pressStartedInsideRef.current = false;
2886 pressStartPreventedRef.current = false;
2887 }
2888 function getOutsidePressEvent() {
2889 const type = currentPointerTypeRef.current;
2890 const computedType = type === "pen" || !type ? "mouse" : type;
2891 const outsidePressEventValue = getOutsidePressEventProp();
2892 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue;
2893 if (typeof resolved === "string") {
2894 return resolved;
2895 }
2896 return resolved[computedType];
2897 }
2898 function shouldIgnoreEvent(event) {
2899 const computedOutsidePressEvent = getOutsidePressEvent();
2900 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click";
2901 }
2902 function isEventWithinFloatingTree(event) {
2903 const nodeId = dataRef.current.floatingContext?.nodeId;
2904 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating));
2905 return isEventWithinOwnElements(event) || targetIsInsideChildren;
2906 }
2907 function closeOnPressOutside(event) {
2908 if (shouldIgnoreEvent(event)) {
2909 if (event.type !== "click" && !isEventWithinOwnElements(event)) {
2910 preventedPressSuppressionTimeout.clear();
2911 suppressNextOutsideClickRef.current = false;
2912 }
2913 clearInsideReactTree();
2914 return;
2915 }
2916 if (dataRef.current.insideReactTree) {
2917 clearInsideReactTree();
2918 return;
2919 }
2920 const target = getTarget(event);
2921 const inertSelector = `[${createAttribute("inert")}]`;
2922 const targetRoot = isElement(target) ? target.getRootNode() : null;
2923 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector));
2924 const triggers = store2.context.triggerElements;
2925 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) {
2926 return;
2927 }
2928 let targetRootAncestor = isElement(target) ? target : null;
2929 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
2930 const nextParent = getParentNode(targetRootAncestor);
2931 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
2932 break;
2933 }
2934 targetRootAncestor = nextParent;
2935 }
2936 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
2937 !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the
2938 // element was injected after the floating element rendered.
2939 markers.every((marker) => !contains(targetRootAncestor, marker))) {
2940 return;
2941 }
2942 if (isHTMLElement(target) && !("touches" in event)) {
2943 const lastTraversableNode = isLastTraversableNode(target);
2944 const style = getComputedStyle2(target);
2945 const scrollRe = /auto|scroll/;
2946 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
2947 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
2948 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
2949 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
2950 const isRTL3 = style.direction === "rtl";
2951 const pressedVerticalScrollbar = canScrollY && (isRTL3 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
2952 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
2953 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
2954 return;
2955 }
2956 }
2957 if (isEventWithinFloatingTree(event)) {
2958 return;
2959 }
2960 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) {
2961 preventedPressSuppressionTimeout.clear();
2962 suppressNextOutsideClickRef.current = false;
2963 return;
2964 }
2965 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
2966 return;
2967 }
2968 if (hasBlockingChild("__outsidePressBubbles")) {
2969 return;
2970 }
2971 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event));
2972 clearInsideReactTree();
2973 }
2974 function handlePointerDown(event) {
2975 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) {
2976 return;
2977 }
2978 closeOnPressOutside(event);
2979 }
2980 function handleTouchStart(event) {
2981 if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) {
2982 return;
2983 }
2984 const touch = event.touches[0];
2985 if (touch) {
2986 touchStateRef.current = {
2987 startTime: Date.now(),
2988 startX: touch.clientX,
2989 startY: touch.clientY,
2990 dismissOnTouchEnd: false,
2991 dismissOnMouseDown: true
2992 };
2993 cancelDismissOnEndTimeout.start(1e3, () => {
2994 if (touchStateRef.current) {
2995 touchStateRef.current.dismissOnTouchEnd = false;
2996 touchStateRef.current.dismissOnMouseDown = false;
2997 }
2998 });
2999 }
3000 }
3001 function addTargetEventListenerOnce(event, listener) {
3002 const target = getTarget(event);
3003 if (!target) {
3004 return;
3005 }
3006 const unsubscribe2 = addEventListener(target, event.type, () => {
3007 listener(event);
3008 unsubscribe2();
3009 });
3010 }
3011 function handleTouchStartCapture(event) {
3012 currentPointerTypeRef.current = "touch";
3013 addTargetEventListenerOnce(event, handleTouchStart);
3014 }
3015 function closeOnPressOutsideCapture(event) {
3016 cancelDismissOnEndTimeout.clear();
3017 if (event.type === "pointerdown") {
3018 currentPointerTypeRef.current = event.pointerType;
3019 }
3020 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {
3021 return;
3022 }
3023 addTargetEventListenerOnce(event, (targetEvent) => {
3024 if (targetEvent.type === "pointerdown") {
3025 handlePointerDown(targetEvent);
3026 } else {
3027 closeOnPressOutside(targetEvent);
3028 }
3029 });
3030 }
3031 function handlePressEndCapture(event) {
3032 if (!pressStartedInsideRef.current) {
3033 return;
3034 }
3035 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;
3036 resetPressStartState();
3037 if (getOutsidePressEvent() !== "intentional") {
3038 return;
3039 }
3040 if (event.type === "pointercancel") {
3041 if (pressStartedInsideDefaultPrevented) {
3042 suppressImmediateOutsideClickAfterPreventedStart();
3043 }
3044 return;
3045 }
3046 if (isEventWithinFloatingTree(event)) {
3047 return;
3048 }
3049 if (pressStartedInsideDefaultPrevented) {
3050 suppressImmediateOutsideClickAfterPreventedStart();
3051 return;
3052 }
3053 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
3054 return;
3055 }
3056 preventedPressSuppressionTimeout.clear();
3057 suppressNextOutsideClickRef.current = true;
3058 clearInsideReactTree();
3059 }
3060 function handleTouchMove(event) {
3061 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
3062 return;
3063 }
3064 const touch = event.touches[0];
3065 if (!touch) {
3066 return;
3067 }
3068 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);
3069 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);
3070 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
3071 if (distance > 5) {
3072 touchStateRef.current.dismissOnTouchEnd = true;
3073 }
3074 if (distance > 10) {
3075 closeOnPressOutside(event);
3076 cancelDismissOnEndTimeout.clear();
3077 touchStateRef.current = null;
3078 }
3079 }
3080 function handleTouchMoveCapture(event) {
3081 addTargetEventListenerOnce(event, handleTouchMove);
3082 }
3083 function handleTouchEnd(event) {
3084 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
3085 return;
3086 }
3087 if (touchStateRef.current.dismissOnTouchEnd) {
3088 closeOnPressOutside(event);
3089 }
3090 cancelDismissOnEndTimeout.clear();
3091 touchStateRef.current = null;
3092 }
3093 function handleTouchEndCapture(event) {
3094 addTargetEventListenerOnce(event, handleTouchEnd);
3095 }
3096 const doc = ownerDocument(floatingElement);
3097 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)));
3098 return () => {
3099 unsubscribe();
3100 compositionTimeout.clear();
3101 preventedPressSuppressionTimeout.clear();
3102 resetPressStartState();
3103 suppressNextOutsideClickRef.current = false;
3104 };
3105 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout]);
3106 React18.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]);
3107 const reference = React18.useMemo(() => ({
3108 onKeyDown: closeOnEscapeKeyDown,
3109 onPointerDown: closeOnReferencePress,
3110 onClick: closeOnReferencePress
3111 }), [closeOnEscapeKeyDown, closeOnReferencePress]);
3112 const floating = React18.useMemo(() => ({
3113 onKeyDown: closeOnEscapeKeyDown,
3114 // `onMouseDown` may be blocked if `event.preventDefault()` is called in
3115 // `onPointerDown`, such as with <NumberField.ScrubArea>.
3116 // See https://github.com/mui/base-ui/pull/3379
3117 onPointerDown: markInsidePressStartPrevented,
3118 onMouseDown: markInsidePressStartPrevented,
3119 onClickCapture: markInsideReactTree,
3120 onMouseDownCapture(event) {
3121 markInsideReactTree();
3122 markPressStartedInsideReactTree(event);
3123 },
3124 onPointerDownCapture(event) {
3125 markInsideReactTree();
3126 markPressStartedInsideReactTree(event);
3127 },
3128 onMouseUpCapture: markInsideReactTree,
3129 onTouchEndCapture: markInsideReactTree,
3130 onTouchMoveCapture: markInsideReactTree
3131 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);
3132 return React18.useMemo(() => enabled ? {
3133 reference,
3134 floating,
3135 trigger: reference
3136 } : {}, [enabled, reference, floating]);
3137 }
3138
3139 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
3140 var React25 = __toESM(require_react(), 1);
3141
3142 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
3143 function computeCoordsFromPlacement(_ref, placement, rtl) {
3144 let {
3145 reference,
3146 floating
3147 } = _ref;
3148 const sideAxis = getSideAxis(placement);
3149 const alignmentAxis = getAlignmentAxis(placement);
3150 const alignLength = getAxisLength(alignmentAxis);
3151 const side = getSide(placement);
3152 const isVertical = sideAxis === "y";
3153 const commonX = reference.x + reference.width / 2 - floating.width / 2;
3154 const commonY = reference.y + reference.height / 2 - floating.height / 2;
3155 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
3156 let coords;
3157 switch (side) {
3158 case "top":
3159 coords = {
3160 x: commonX,
3161 y: reference.y - floating.height
3162 };
3163 break;
3164 case "bottom":
3165 coords = {
3166 x: commonX,
3167 y: reference.y + reference.height
3168 };
3169 break;
3170 case "right":
3171 coords = {
3172 x: reference.x + reference.width,
3173 y: commonY
3174 };
3175 break;
3176 case "left":
3177 coords = {
3178 x: reference.x - floating.width,
3179 y: commonY
3180 };
3181 break;
3182 default:
3183 coords = {
3184 x: reference.x,
3185 y: reference.y
3186 };
3187 }
3188 switch (getAlignment(placement)) {
3189 case "start":
3190 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
3191 break;
3192 case "end":
3193 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
3194 break;
3195 }
3196 return coords;
3197 }
3198 async function detectOverflow(state, options) {
3199 var _await$platform$isEle;
3200 if (options === void 0) {
3201 options = {};
3202 }
3203 const {
3204 x,
3205 y,
3206 platform: platform3,
3207 rects,
3208 elements,
3209 strategy
3210 } = state;
3211 const {
3212 boundary = "clippingAncestors",
3213 rootBoundary = "viewport",
3214 elementContext = "floating",
3215 altBoundary = false,
3216 padding = 0
3217 } = evaluate(options, state);
3218 const paddingObject = getPaddingObject(padding);
3219 const altContext = elementContext === "floating" ? "reference" : "floating";
3220 const element = elements[altBoundary ? altContext : elementContext];
3221 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({
3222 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)),
3223 boundary,
3224 rootBoundary,
3225 strategy
3226 }));
3227 const rect = elementContext === "floating" ? {
3228 x,
3229 y,
3230 width: rects.floating.width,
3231 height: rects.floating.height
3232 } : rects.reference;
3233 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating));
3234 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || {
3235 x: 1,
3236 y: 1
3237 } : {
3238 x: 1,
3239 y: 1
3240 };
3241 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({
3242 elements,
3243 rect,
3244 offsetParent,
3245 strategy
3246 }) : rect);
3247 return {
3248 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
3249 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
3250 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
3251 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
3252 };
3253 }
3254 var MAX_RESET_COUNT = 50;
3255 var computePosition = async (reference, floating, config) => {
3256 const {
3257 placement = "bottom",
3258 strategy = "absolute",
3259 middleware = [],
3260 platform: platform3
3261 } = config;
3262 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : {
3263 ...platform3,
3264 detectOverflow
3265 };
3266 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating));
3267 let rects = await platform3.getElementRects({
3268 reference,
3269 floating,
3270 strategy
3271 });
3272 let {
3273 x,
3274 y
3275 } = computeCoordsFromPlacement(rects, placement, rtl);
3276 let statefulPlacement = placement;
3277 let resetCount = 0;
3278 const middlewareData = {};
3279 for (let i = 0; i < middleware.length; i++) {
3280 const currentMiddleware = middleware[i];
3281 if (!currentMiddleware) {
3282 continue;
3283 }
3284 const {
3285 name,
3286 fn
3287 } = currentMiddleware;
3288 const {
3289 x: nextX,
3290 y: nextY,
3291 data,
3292 reset
3293 } = await fn({
3294 x,
3295 y,
3296 initialPlacement: placement,
3297 placement: statefulPlacement,
3298 strategy,
3299 middlewareData,
3300 rects,
3301 platform: platformWithDetectOverflow,
3302 elements: {
3303 reference,
3304 floating
3305 }
3306 });
3307 x = nextX != null ? nextX : x;
3308 y = nextY != null ? nextY : y;
3309 middlewareData[name] = {
3310 ...middlewareData[name],
3311 ...data
3312 };
3313 if (reset && resetCount < MAX_RESET_COUNT) {
3314 resetCount++;
3315 if (typeof reset === "object") {
3316 if (reset.placement) {
3317 statefulPlacement = reset.placement;
3318 }
3319 if (reset.rects) {
3320 rects = reset.rects === true ? await platform3.getElementRects({
3321 reference,
3322 floating,
3323 strategy
3324 }) : reset.rects;
3325 }
3326 ({
3327 x,
3328 y
3329 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
3330 }
3331 i = -1;
3332 }
3333 }
3334 return {
3335 x,
3336 y,
3337 placement: statefulPlacement,
3338 strategy,
3339 middlewareData
3340 };
3341 };
3342 var flip = function(options) {
3343 if (options === void 0) {
3344 options = {};
3345 }
3346 return {
3347 name: "flip",
3348 options,
3349 async fn(state) {
3350 var _middlewareData$arrow, _middlewareData$flip;
3351 const {
3352 placement,
3353 middlewareData,
3354 rects,
3355 initialPlacement,
3356 platform: platform3,
3357 elements
3358 } = state;
3359 const {
3360 mainAxis: checkMainAxis = true,
3361 crossAxis: checkCrossAxis = true,
3362 fallbackPlacements: specifiedFallbackPlacements,
3363 fallbackStrategy = "bestFit",
3364 fallbackAxisSideDirection = "none",
3365 flipAlignment = true,
3366 ...detectOverflowOptions
3367 } = evaluate(options, state);
3368 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
3369 return {};
3370 }
3371 const side = getSide(placement);
3372 const initialSideAxis = getSideAxis(initialPlacement);
3373 const isBasePlacement = getSide(initialPlacement) === initialPlacement;
3374 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
3375 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
3376 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
3377 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
3378 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
3379 }
3380 const placements2 = [initialPlacement, ...fallbackPlacements];
3381 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
3382 const overflows = [];
3383 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
3384 if (checkMainAxis) {
3385 overflows.push(overflow[side]);
3386 }
3387 if (checkCrossAxis) {
3388 const sides2 = getAlignmentSides(placement, rects, rtl);
3389 overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
3390 }
3391 overflowsData = [...overflowsData, {
3392 placement,
3393 overflows
3394 }];
3395 if (!overflows.every((side2) => side2 <= 0)) {
3396 var _middlewareData$flip2, _overflowsData$filter;
3397 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
3398 const nextPlacement = placements2[nextIndex];
3399 if (nextPlacement) {
3400 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
3401 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
3402 // overflows the main axis.
3403 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
3404 return {
3405 data: {
3406 index: nextIndex,
3407 overflows: overflowsData
3408 },
3409 reset: {
3410 placement: nextPlacement
3411 }
3412 };
3413 }
3414 }
3415 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;
3416 if (!resetPlacement) {
3417 switch (fallbackStrategy) {
3418 case "bestFit": {
3419 var _overflowsData$filter2;
3420 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
3421 if (hasFallbackAxisSideDirection) {
3422 const currentSideAxis = getSideAxis(d.placement);
3423 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
3424 // reading directions favoring greater width.
3425 currentSideAxis === "y";
3426 }
3427 return true;
3428 }).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];
3429 if (placement2) {
3430 resetPlacement = placement2;
3431 }
3432 break;
3433 }
3434 case "initialPlacement":
3435 resetPlacement = initialPlacement;
3436 break;
3437 }
3438 }
3439 if (placement !== resetPlacement) {
3440 return {
3441 reset: {
3442 placement: resetPlacement
3443 }
3444 };
3445 }
3446 }
3447 return {};
3448 }
3449 };
3450 };
3451 function getSideOffsets(overflow, rect) {
3452 return {
3453 top: overflow.top - rect.height,
3454 right: overflow.right - rect.width,
3455 bottom: overflow.bottom - rect.height,
3456 left: overflow.left - rect.width
3457 };
3458 }
3459 function isAnySideFullyClipped(overflow) {
3460 return sides.some((side) => overflow[side] >= 0);
3461 }
3462 var hide = function(options) {
3463 if (options === void 0) {
3464 options = {};
3465 }
3466 return {
3467 name: "hide",
3468 options,
3469 async fn(state) {
3470 const {
3471 rects,
3472 platform: platform3
3473 } = state;
3474 const {
3475 strategy = "referenceHidden",
3476 ...detectOverflowOptions
3477 } = evaluate(options, state);
3478 switch (strategy) {
3479 case "referenceHidden": {
3480 const overflow = await platform3.detectOverflow(state, {
3481 ...detectOverflowOptions,
3482 elementContext: "reference"
3483 });
3484 const offsets = getSideOffsets(overflow, rects.reference);
3485 return {
3486 data: {
3487 referenceHiddenOffsets: offsets,
3488 referenceHidden: isAnySideFullyClipped(offsets)
3489 }
3490 };
3491 }
3492 case "escaped": {
3493 const overflow = await platform3.detectOverflow(state, {
3494 ...detectOverflowOptions,
3495 altBoundary: true
3496 });
3497 const offsets = getSideOffsets(overflow, rects.floating);
3498 return {
3499 data: {
3500 escapedOffsets: offsets,
3501 escaped: isAnySideFullyClipped(offsets)
3502 }
3503 };
3504 }
3505 default: {
3506 return {};
3507 }
3508 }
3509 }
3510 };
3511 };
3512 var originSides = /* @__PURE__ */ new Set(["left", "top"]);
3513 async function convertValueToCoords(state, options) {
3514 const {
3515 placement,
3516 platform: platform3,
3517 elements
3518 } = state;
3519 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
3520 const side = getSide(placement);
3521 const alignment = getAlignment(placement);
3522 const isVertical = getSideAxis(placement) === "y";
3523 const mainAxisMulti = originSides.has(side) ? -1 : 1;
3524 const crossAxisMulti = rtl && isVertical ? -1 : 1;
3525 const rawValue = evaluate(options, state);
3526 let {
3527 mainAxis,
3528 crossAxis,
3529 alignmentAxis
3530 } = typeof rawValue === "number" ? {
3531 mainAxis: rawValue,
3532 crossAxis: 0,
3533 alignmentAxis: null
3534 } : {
3535 mainAxis: rawValue.mainAxis || 0,
3536 crossAxis: rawValue.crossAxis || 0,
3537 alignmentAxis: rawValue.alignmentAxis
3538 };
3539 if (alignment && typeof alignmentAxis === "number") {
3540 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
3541 }
3542 return isVertical ? {
3543 x: crossAxis * crossAxisMulti,
3544 y: mainAxis * mainAxisMulti
3545 } : {
3546 x: mainAxis * mainAxisMulti,
3547 y: crossAxis * crossAxisMulti
3548 };
3549 }
3550 var offset = function(options) {
3551 if (options === void 0) {
3552 options = 0;
3553 }
3554 return {
3555 name: "offset",
3556 options,
3557 async fn(state) {
3558 var _middlewareData$offse, _middlewareData$arrow;
3559 const {
3560 x,
3561 y,
3562 placement,
3563 middlewareData
3564 } = state;
3565 const diffCoords = await convertValueToCoords(state, options);
3566 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
3567 return {};
3568 }
3569 return {
3570 x: x + diffCoords.x,
3571 y: y + diffCoords.y,
3572 data: {
3573 ...diffCoords,
3574 placement
3575 }
3576 };
3577 }
3578 };
3579 };
3580 var shift = function(options) {
3581 if (options === void 0) {
3582 options = {};
3583 }
3584 return {
3585 name: "shift",
3586 options,
3587 async fn(state) {
3588 const {
3589 x,
3590 y,
3591 placement,
3592 platform: platform3
3593 } = state;
3594 const {
3595 mainAxis: checkMainAxis = true,
3596 crossAxis: checkCrossAxis = false,
3597 limiter = {
3598 fn: (_ref) => {
3599 let {
3600 x: x2,
3601 y: y2
3602 } = _ref;
3603 return {
3604 x: x2,
3605 y: y2
3606 };
3607 }
3608 },
3609 ...detectOverflowOptions
3610 } = evaluate(options, state);
3611 const coords = {
3612 x,
3613 y
3614 };
3615 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
3616 const crossAxis = getSideAxis(getSide(placement));
3617 const mainAxis = getOppositeAxis(crossAxis);
3618 let mainAxisCoord = coords[mainAxis];
3619 let crossAxisCoord = coords[crossAxis];
3620 if (checkMainAxis) {
3621 const minSide = mainAxis === "y" ? "top" : "left";
3622 const maxSide = mainAxis === "y" ? "bottom" : "right";
3623 const min2 = mainAxisCoord + overflow[minSide];
3624 const max2 = mainAxisCoord - overflow[maxSide];
3625 mainAxisCoord = clamp(min2, mainAxisCoord, max2);
3626 }
3627 if (checkCrossAxis) {
3628 const minSide = crossAxis === "y" ? "top" : "left";
3629 const maxSide = crossAxis === "y" ? "bottom" : "right";
3630 const min2 = crossAxisCoord + overflow[minSide];
3631 const max2 = crossAxisCoord - overflow[maxSide];
3632 crossAxisCoord = clamp(min2, crossAxisCoord, max2);
3633 }
3634 const limitedCoords = limiter.fn({
3635 ...state,
3636 [mainAxis]: mainAxisCoord,
3637 [crossAxis]: crossAxisCoord
3638 });
3639 return {
3640 ...limitedCoords,
3641 data: {
3642 x: limitedCoords.x - x,
3643 y: limitedCoords.y - y,
3644 enabled: {
3645 [mainAxis]: checkMainAxis,
3646 [crossAxis]: checkCrossAxis
3647 }
3648 }
3649 };
3650 }
3651 };
3652 };
3653 var limitShift = function(options) {
3654 if (options === void 0) {
3655 options = {};
3656 }
3657 return {
3658 options,
3659 fn(state) {
3660 const {
3661 x,
3662 y,
3663 placement,
3664 rects,
3665 middlewareData
3666 } = state;
3667 const {
3668 offset: offset4 = 0,
3669 mainAxis: checkMainAxis = true,
3670 crossAxis: checkCrossAxis = true
3671 } = evaluate(options, state);
3672 const coords = {
3673 x,
3674 y
3675 };
3676 const crossAxis = getSideAxis(placement);
3677 const mainAxis = getOppositeAxis(crossAxis);
3678 let mainAxisCoord = coords[mainAxis];
3679 let crossAxisCoord = coords[crossAxis];
3680 const rawOffset = evaluate(offset4, state);
3681 const computedOffset = typeof rawOffset === "number" ? {
3682 mainAxis: rawOffset,
3683 crossAxis: 0
3684 } : {
3685 mainAxis: 0,
3686 crossAxis: 0,
3687 ...rawOffset
3688 };
3689 if (checkMainAxis) {
3690 const len = mainAxis === "y" ? "height" : "width";
3691 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
3692 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
3693 if (mainAxisCoord < limitMin) {
3694 mainAxisCoord = limitMin;
3695 } else if (mainAxisCoord > limitMax) {
3696 mainAxisCoord = limitMax;
3697 }
3698 }
3699 if (checkCrossAxis) {
3700 var _middlewareData$offse, _middlewareData$offse2;
3701 const len = mainAxis === "y" ? "width" : "height";
3702 const isOriginSide = originSides.has(getSide(placement));
3703 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);
3704 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);
3705 if (crossAxisCoord < limitMin) {
3706 crossAxisCoord = limitMin;
3707 } else if (crossAxisCoord > limitMax) {
3708 crossAxisCoord = limitMax;
3709 }
3710 }
3711 return {
3712 [mainAxis]: mainAxisCoord,
3713 [crossAxis]: crossAxisCoord
3714 };
3715 }
3716 };
3717 };
3718 var size = function(options) {
3719 if (options === void 0) {
3720 options = {};
3721 }
3722 return {
3723 name: "size",
3724 options,
3725 async fn(state) {
3726 var _state$middlewareData, _state$middlewareData2;
3727 const {
3728 placement,
3729 rects,
3730 platform: platform3,
3731 elements
3732 } = state;
3733 const {
3734 apply = () => {
3735 },
3736 ...detectOverflowOptions
3737 } = evaluate(options, state);
3738 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
3739 const side = getSide(placement);
3740 const alignment = getAlignment(placement);
3741 const isYAxis = getSideAxis(placement) === "y";
3742 const {
3743 width,
3744 height
3745 } = rects.floating;
3746 let heightSide;
3747 let widthSide;
3748 if (side === "top" || side === "bottom") {
3749 heightSide = side;
3750 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
3751 } else {
3752 widthSide = side;
3753 heightSide = alignment === "end" ? "top" : "bottom";
3754 }
3755 const maximumClippingHeight = height - overflow.top - overflow.bottom;
3756 const maximumClippingWidth = width - overflow.left - overflow.right;
3757 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
3758 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
3759 const noShift = !state.middlewareData.shift;
3760 let availableHeight = overflowAvailableHeight;
3761 let availableWidth = overflowAvailableWidth;
3762 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
3763 availableWidth = maximumClippingWidth;
3764 }
3765 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
3766 availableHeight = maximumClippingHeight;
3767 }
3768 if (noShift && !alignment) {
3769 const xMin = max(overflow.left, 0);
3770 const xMax = max(overflow.right, 0);
3771 const yMin = max(overflow.top, 0);
3772 const yMax = max(overflow.bottom, 0);
3773 if (isYAxis) {
3774 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
3775 } else {
3776 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
3777 }
3778 }
3779 await apply({
3780 ...state,
3781 availableWidth,
3782 availableHeight
3783 });
3784 const nextDimensions = await platform3.getDimensions(elements.floating);
3785 if (width !== nextDimensions.width || height !== nextDimensions.height) {
3786 return {
3787 reset: {
3788 rects: true
3789 }
3790 };
3791 }
3792 return {};
3793 }
3794 };
3795 };
3796
3797 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
3798 function getCssDimensions(element) {
3799 const css = getComputedStyle2(element);
3800 let width = parseFloat(css.width) || 0;
3801 let height = parseFloat(css.height) || 0;
3802 const hasOffset = isHTMLElement(element);
3803 const offsetWidth = hasOffset ? element.offsetWidth : width;
3804 const offsetHeight = hasOffset ? element.offsetHeight : height;
3805 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
3806 if (shouldFallback) {
3807 width = offsetWidth;
3808 height = offsetHeight;
3809 }
3810 return {
3811 width,
3812 height,
3813 $: shouldFallback
3814 };
3815 }
3816 function unwrapElement(element) {
3817 return !isElement(element) ? element.contextElement : element;
3818 }
3819 function getScale(element) {
3820 const domElement = unwrapElement(element);
3821 if (!isHTMLElement(domElement)) {
3822 return createCoords(1);
3823 }
3824 const rect = domElement.getBoundingClientRect();
3825 const {
3826 width,
3827 height,
3828 $
3829 } = getCssDimensions(domElement);
3830 let x = ($ ? round(rect.width) : rect.width) / width;
3831 let y = ($ ? round(rect.height) : rect.height) / height;
3832 if (!x || !Number.isFinite(x)) {
3833 x = 1;
3834 }
3835 if (!y || !Number.isFinite(y)) {
3836 y = 1;
3837 }
3838 return {
3839 x,
3840 y
3841 };
3842 }
3843 var noOffsets = /* @__PURE__ */ createCoords(0);
3844 function getVisualOffsets(element) {
3845 const win = getWindow(element);
3846 if (!isWebKit() || !win.visualViewport) {
3847 return noOffsets;
3848 }
3849 return {
3850 x: win.visualViewport.offsetLeft,
3851 y: win.visualViewport.offsetTop
3852 };
3853 }
3854 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
3855 if (isFixed === void 0) {
3856 isFixed = false;
3857 }
3858 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
3859 return false;
3860 }
3861 return isFixed;
3862 }
3863 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
3864 if (includeScale === void 0) {
3865 includeScale = false;
3866 }
3867 if (isFixedStrategy === void 0) {
3868 isFixedStrategy = false;
3869 }
3870 const clientRect = element.getBoundingClientRect();
3871 const domElement = unwrapElement(element);
3872 let scale = createCoords(1);
3873 if (includeScale) {
3874 if (offsetParent) {
3875 if (isElement(offsetParent)) {
3876 scale = getScale(offsetParent);
3877 }
3878 } else {
3879 scale = getScale(element);
3880 }
3881 }
3882 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
3883 let x = (clientRect.left + visualOffsets.x) / scale.x;
3884 let y = (clientRect.top + visualOffsets.y) / scale.y;
3885 let width = clientRect.width / scale.x;
3886 let height = clientRect.height / scale.y;
3887 if (domElement) {
3888 const win = getWindow(domElement);
3889 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
3890 let currentWin = win;
3891 let currentIFrame = getFrameElement(currentWin);
3892 while (currentIFrame && offsetParent && offsetWin !== currentWin) {
3893 const iframeScale = getScale(currentIFrame);
3894 const iframeRect = currentIFrame.getBoundingClientRect();
3895 const css = getComputedStyle2(currentIFrame);
3896 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
3897 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
3898 x *= iframeScale.x;
3899 y *= iframeScale.y;
3900 width *= iframeScale.x;
3901 height *= iframeScale.y;
3902 x += left;
3903 y += top;
3904 currentWin = getWindow(currentIFrame);
3905 currentIFrame = getFrameElement(currentWin);
3906 }
3907 }
3908 return rectToClientRect({
3909 width,
3910 height,
3911 x,
3912 y
3913 });
3914 }
3915 function getWindowScrollBarX(element, rect) {
3916 const leftScroll = getNodeScroll(element).scrollLeft;
3917 if (!rect) {
3918 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
3919 }
3920 return rect.left + leftScroll;
3921 }
3922 function getHTMLOffset(documentElement, scroll) {
3923 const htmlRect = documentElement.getBoundingClientRect();
3924 const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
3925 const y = htmlRect.top + scroll.scrollTop;
3926 return {
3927 x,
3928 y
3929 };
3930 }
3931 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
3932 let {
3933 elements,
3934 rect,
3935 offsetParent,
3936 strategy
3937 } = _ref;
3938 const isFixed = strategy === "fixed";
3939 const documentElement = getDocumentElement(offsetParent);
3940 const topLayer = elements ? isTopLayer(elements.floating) : false;
3941 if (offsetParent === documentElement || topLayer && isFixed) {
3942 return rect;
3943 }
3944 let scroll = {
3945 scrollLeft: 0,
3946 scrollTop: 0
3947 };
3948 let scale = createCoords(1);
3949 const offsets = createCoords(0);
3950 const isOffsetParentAnElement = isHTMLElement(offsetParent);
3951 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3952 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
3953 scroll = getNodeScroll(offsetParent);
3954 }
3955 if (isOffsetParentAnElement) {
3956 const offsetRect = getBoundingClientRect(offsetParent);
3957 scale = getScale(offsetParent);
3958 offsets.x = offsetRect.x + offsetParent.clientLeft;
3959 offsets.y = offsetRect.y + offsetParent.clientTop;
3960 }
3961 }
3962 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
3963 return {
3964 width: rect.width * scale.x,
3965 height: rect.height * scale.y,
3966 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
3967 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
3968 };
3969 }
3970 function getClientRects(element) {
3971 return Array.from(element.getClientRects());
3972 }
3973 function getDocumentRect(element) {
3974 const html = getDocumentElement(element);
3975 const scroll = getNodeScroll(element);
3976 const body = element.ownerDocument.body;
3977 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
3978 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
3979 let x = -scroll.scrollLeft + getWindowScrollBarX(element);
3980 const y = -scroll.scrollTop;
3981 if (getComputedStyle2(body).direction === "rtl") {
3982 x += max(html.clientWidth, body.clientWidth) - width;
3983 }
3984 return {
3985 width,
3986 height,
3987 x,
3988 y
3989 };
3990 }
3991 var SCROLLBAR_MAX = 25;
3992 function getViewportRect(element, strategy) {
3993 const win = getWindow(element);
3994 const html = getDocumentElement(element);
3995 const visualViewport = win.visualViewport;
3996 let width = html.clientWidth;
3997 let height = html.clientHeight;
3998 let x = 0;
3999 let y = 0;
4000 if (visualViewport) {
4001 width = visualViewport.width;
4002 height = visualViewport.height;
4003 const visualViewportBased = isWebKit();
4004 if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
4005 x = visualViewport.offsetLeft;
4006 y = visualViewport.offsetTop;
4007 }
4008 }
4009 const windowScrollbarX = getWindowScrollBarX(html);
4010 if (windowScrollbarX <= 0) {
4011 const doc = html.ownerDocument;
4012 const body = doc.body;
4013 const bodyStyles = getComputedStyle(body);
4014 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
4015 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
4016 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
4017 width -= clippingStableScrollbarWidth;
4018 }
4019 } else if (windowScrollbarX <= SCROLLBAR_MAX) {
4020 width += windowScrollbarX;
4021 }
4022 return {
4023 width,
4024 height,
4025 x,
4026 y
4027 };
4028 }
4029 function getInnerBoundingClientRect(element, strategy) {
4030 const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
4031 const top = clientRect.top + element.clientTop;
4032 const left = clientRect.left + element.clientLeft;
4033 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
4034 const width = element.clientWidth * scale.x;
4035 const height = element.clientHeight * scale.y;
4036 const x = left * scale.x;
4037 const y = top * scale.y;
4038 return {
4039 width,
4040 height,
4041 x,
4042 y
4043 };
4044 }
4045 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
4046 let rect;
4047 if (clippingAncestor === "viewport") {
4048 rect = getViewportRect(element, strategy);
4049 } else if (clippingAncestor === "document") {
4050 rect = getDocumentRect(getDocumentElement(element));
4051 } else if (isElement(clippingAncestor)) {
4052 rect = getInnerBoundingClientRect(clippingAncestor, strategy);
4053 } else {
4054 const visualOffsets = getVisualOffsets(element);
4055 rect = {
4056 x: clippingAncestor.x - visualOffsets.x,
4057 y: clippingAncestor.y - visualOffsets.y,
4058 width: clippingAncestor.width,
4059 height: clippingAncestor.height
4060 };
4061 }
4062 return rectToClientRect(rect);
4063 }
4064 function hasFixedPositionAncestor(element, stopNode) {
4065 const parentNode = getParentNode(element);
4066 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
4067 return false;
4068 }
4069 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
4070 }
4071 function getClippingElementAncestors(element, cache) {
4072 const cachedResult = cache.get(element);
4073 if (cachedResult) {
4074 return cachedResult;
4075 }
4076 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
4077 let currentContainingBlockComputedStyle = null;
4078 const elementIsFixed = getComputedStyle2(element).position === "fixed";
4079 let currentNode = elementIsFixed ? getParentNode(element) : element;
4080 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
4081 const computedStyle = getComputedStyle2(currentNode);
4082 const currentNodeIsContaining = isContainingBlock(currentNode);
4083 if (!currentNodeIsContaining && computedStyle.position === "fixed") {
4084 currentContainingBlockComputedStyle = null;
4085 }
4086 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
4087 if (shouldDropCurrentNode) {
4088 result = result.filter((ancestor) => ancestor !== currentNode);
4089 } else {
4090 currentContainingBlockComputedStyle = computedStyle;
4091 }
4092 currentNode = getParentNode(currentNode);
4093 }
4094 cache.set(element, result);
4095 return result;
4096 }
4097 function getClippingRect(_ref) {
4098 let {
4099 element,
4100 boundary,
4101 rootBoundary,
4102 strategy
4103 } = _ref;
4104 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
4105 const clippingAncestors = [...elementClippingAncestors, rootBoundary];
4106 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
4107 let top = firstRect.top;
4108 let right = firstRect.right;
4109 let bottom = firstRect.bottom;
4110 let left = firstRect.left;
4111 for (let i = 1; i < clippingAncestors.length; i++) {
4112 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
4113 top = max(rect.top, top);
4114 right = min(rect.right, right);
4115 bottom = min(rect.bottom, bottom);
4116 left = max(rect.left, left);
4117 }
4118 return {
4119 width: right - left,
4120 height: bottom - top,
4121 x: left,
4122 y: top
4123 };
4124 }
4125 function getDimensions(element) {
4126 const {
4127 width,
4128 height
4129 } = getCssDimensions(element);
4130 return {
4131 width,
4132 height
4133 };
4134 }
4135 function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
4136 const isOffsetParentAnElement = isHTMLElement(offsetParent);
4137 const documentElement = getDocumentElement(offsetParent);
4138 const isFixed = strategy === "fixed";
4139 const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
4140 let scroll = {
4141 scrollLeft: 0,
4142 scrollTop: 0
4143 };
4144 const offsets = createCoords(0);
4145 function setLeftRTLScrollbarOffset() {
4146 offsets.x = getWindowScrollBarX(documentElement);
4147 }
4148 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
4149 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
4150 scroll = getNodeScroll(offsetParent);
4151 }
4152 if (isOffsetParentAnElement) {
4153 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
4154 offsets.x = offsetRect.x + offsetParent.clientLeft;
4155 offsets.y = offsetRect.y + offsetParent.clientTop;
4156 } else if (documentElement) {
4157 setLeftRTLScrollbarOffset();
4158 }
4159 }
4160 if (isFixed && !isOffsetParentAnElement && documentElement) {
4161 setLeftRTLScrollbarOffset();
4162 }
4163 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
4164 const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
4165 const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
4166 return {
4167 x,
4168 y,
4169 width: rect.width,
4170 height: rect.height
4171 };
4172 }
4173 function isStaticPositioned(element) {
4174 return getComputedStyle2(element).position === "static";
4175 }
4176 function getTrueOffsetParent(element, polyfill) {
4177 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
4178 return null;
4179 }
4180 if (polyfill) {
4181 return polyfill(element);
4182 }
4183 let rawOffsetParent = element.offsetParent;
4184 if (getDocumentElement(element) === rawOffsetParent) {
4185 rawOffsetParent = rawOffsetParent.ownerDocument.body;
4186 }
4187 return rawOffsetParent;
4188 }
4189 function getOffsetParent(element, polyfill) {
4190 const win = getWindow(element);
4191 if (isTopLayer(element)) {
4192 return win;
4193 }
4194 if (!isHTMLElement(element)) {
4195 let svgOffsetParent = getParentNode(element);
4196 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
4197 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
4198 return svgOffsetParent;
4199 }
4200 svgOffsetParent = getParentNode(svgOffsetParent);
4201 }
4202 return win;
4203 }
4204 let offsetParent = getTrueOffsetParent(element, polyfill);
4205 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
4206 offsetParent = getTrueOffsetParent(offsetParent, polyfill);
4207 }
4208 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
4209 return win;
4210 }
4211 return offsetParent || getContainingBlock(element) || win;
4212 }
4213 var getElementRects = async function(data) {
4214 const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
4215 const getDimensionsFn = this.getDimensions;
4216 const floatingDimensions = await getDimensionsFn(data.floating);
4217 return {
4218 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
4219 floating: {
4220 x: 0,
4221 y: 0,
4222 width: floatingDimensions.width,
4223 height: floatingDimensions.height
4224 }
4225 };
4226 };
4227 function isRTL(element) {
4228 return getComputedStyle2(element).direction === "rtl";
4229 }
4230 var platform2 = {
4231 convertOffsetParentRelativeRectToViewportRelativeRect,
4232 getDocumentElement,
4233 getClippingRect,
4234 getOffsetParent,
4235 getElementRects,
4236 getClientRects,
4237 getDimensions,
4238 getScale,
4239 isElement,
4240 isRTL
4241 };
4242 function rectsAreEqual(a, b) {
4243 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
4244 }
4245 function observeMove(element, onMove) {
4246 let io = null;
4247 let timeoutId;
4248 const root = getDocumentElement(element);
4249 function cleanup() {
4250 var _io;
4251 clearTimeout(timeoutId);
4252 (_io = io) == null || _io.disconnect();
4253 io = null;
4254 }
4255 function refresh(skip, threshold) {
4256 if (skip === void 0) {
4257 skip = false;
4258 }
4259 if (threshold === void 0) {
4260 threshold = 1;
4261 }
4262 cleanup();
4263 const elementRectForRootMargin = element.getBoundingClientRect();
4264 const {
4265 left,
4266 top,
4267 width,
4268 height
4269 } = elementRectForRootMargin;
4270 if (!skip) {
4271 onMove();
4272 }
4273 if (!width || !height) {
4274 return;
4275 }
4276 const insetTop = floor(top);
4277 const insetRight = floor(root.clientWidth - (left + width));
4278 const insetBottom = floor(root.clientHeight - (top + height));
4279 const insetLeft = floor(left);
4280 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
4281 const options = {
4282 rootMargin,
4283 threshold: max(0, min(1, threshold)) || 1
4284 };
4285 let isFirstUpdate = true;
4286 function handleObserve(entries) {
4287 const ratio = entries[0].intersectionRatio;
4288 if (ratio !== threshold) {
4289 if (!isFirstUpdate) {
4290 return refresh();
4291 }
4292 if (!ratio) {
4293 timeoutId = setTimeout(() => {
4294 refresh(false, 1e-7);
4295 }, 1e3);
4296 } else {
4297 refresh(false, ratio);
4298 }
4299 }
4300 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
4301 refresh();
4302 }
4303 isFirstUpdate = false;
4304 }
4305 try {
4306 io = new IntersectionObserver(handleObserve, {
4307 ...options,
4308 // Handle <iframe>s
4309 root: root.ownerDocument
4310 });
4311 } catch (_e) {
4312 io = new IntersectionObserver(handleObserve, options);
4313 }
4314 io.observe(element);
4315 }
4316 refresh(true);
4317 return cleanup;
4318 }
4319 function autoUpdate(reference, floating, update2, options) {
4320 if (options === void 0) {
4321 options = {};
4322 }
4323 const {
4324 ancestorScroll = true,
4325 ancestorResize = true,
4326 elementResize = typeof ResizeObserver === "function",
4327 layoutShift = typeof IntersectionObserver === "function",
4328 animationFrame = false
4329 } = options;
4330 const referenceEl = unwrapElement(reference);
4331 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
4332 ancestors.forEach((ancestor) => {
4333 ancestorScroll && ancestor.addEventListener("scroll", update2, {
4334 passive: true
4335 });
4336 ancestorResize && ancestor.addEventListener("resize", update2);
4337 });
4338 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null;
4339 let reobserveFrame = -1;
4340 let resizeObserver = null;
4341 if (elementResize) {
4342 resizeObserver = new ResizeObserver((_ref) => {
4343 let [firstEntry] = _ref;
4344 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
4345 resizeObserver.unobserve(floating);
4346 cancelAnimationFrame(reobserveFrame);
4347 reobserveFrame = requestAnimationFrame(() => {
4348 var _resizeObserver;
4349 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
4350 });
4351 }
4352 update2();
4353 });
4354 if (referenceEl && !animationFrame) {
4355 resizeObserver.observe(referenceEl);
4356 }
4357 if (floating) {
4358 resizeObserver.observe(floating);
4359 }
4360 }
4361 let frameId;
4362 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
4363 if (animationFrame) {
4364 frameLoop();
4365 }
4366 function frameLoop() {
4367 const nextRefRect = getBoundingClientRect(reference);
4368 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
4369 update2();
4370 }
4371 prevRefRect = nextRefRect;
4372 frameId = requestAnimationFrame(frameLoop);
4373 }
4374 update2();
4375 return () => {
4376 var _resizeObserver2;
4377 ancestors.forEach((ancestor) => {
4378 ancestorScroll && ancestor.removeEventListener("scroll", update2);
4379 ancestorResize && ancestor.removeEventListener("resize", update2);
4380 });
4381 cleanupIo == null || cleanupIo();
4382 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
4383 resizeObserver = null;
4384 if (animationFrame) {
4385 cancelAnimationFrame(frameId);
4386 }
4387 };
4388 }
4389 var offset2 = offset;
4390 var shift2 = shift;
4391 var flip2 = flip;
4392 var size2 = size;
4393 var hide2 = hide;
4394 var limitShift2 = limitShift;
4395 var computePosition2 = (reference, floating, options) => {
4396 const cache = /* @__PURE__ */ new Map();
4397 const mergedOptions = {
4398 platform: platform2,
4399 ...options
4400 };
4401 const platformWithCache = {
4402 ...mergedOptions.platform,
4403 _c: cache
4404 };
4405 return computePosition(reference, floating, {
4406 ...mergedOptions,
4407 platform: platformWithCache
4408 });
4409 };
4410
4411 // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
4412 var React19 = __toESM(require_react(), 1);
4413 var import_react2 = __toESM(require_react(), 1);
4414 var ReactDOM3 = __toESM(require_react_dom(), 1);
4415 var isClient = typeof document !== "undefined";
4416 var noop2 = function noop3() {
4417 };
4418 var index = isClient ? import_react2.useLayoutEffect : noop2;
4419 function deepEqual(a, b) {
4420 if (a === b) {
4421 return true;
4422 }
4423 if (typeof a !== typeof b) {
4424 return false;
4425 }
4426 if (typeof a === "function" && a.toString() === b.toString()) {
4427 return true;
4428 }
4429 let length;
4430 let i;
4431 let keys;
4432 if (a && b && typeof a === "object") {
4433 if (Array.isArray(a)) {
4434 length = a.length;
4435 if (length !== b.length) return false;
4436 for (i = length; i-- !== 0; ) {
4437 if (!deepEqual(a[i], b[i])) {
4438 return false;
4439 }
4440 }
4441 return true;
4442 }
4443 keys = Object.keys(a);
4444 length = keys.length;
4445 if (length !== Object.keys(b).length) {
4446 return false;
4447 }
4448 for (i = length; i-- !== 0; ) {
4449 if (!{}.hasOwnProperty.call(b, keys[i])) {
4450 return false;
4451 }
4452 }
4453 for (i = length; i-- !== 0; ) {
4454 const key = keys[i];
4455 if (key === "_owner" && a.$$typeof) {
4456 continue;
4457 }
4458 if (!deepEqual(a[key], b[key])) {
4459 return false;
4460 }
4461 }
4462 return true;
4463 }
4464 return a !== a && b !== b;
4465 }
4466 function getDPR(element) {
4467 if (typeof window === "undefined") {
4468 return 1;
4469 }
4470 const win = element.ownerDocument.defaultView || window;
4471 return win.devicePixelRatio || 1;
4472 }
4473 function roundByDPR(element, value) {
4474 const dpr = getDPR(element);
4475 return Math.round(value * dpr) / dpr;
4476 }
4477 function useLatestRef(value) {
4478 const ref = React19.useRef(value);
4479 index(() => {
4480 ref.current = value;
4481 });
4482 return ref;
4483 }
4484 function useFloating(options) {
4485 if (options === void 0) {
4486 options = {};
4487 }
4488 const {
4489 placement = "bottom",
4490 strategy = "absolute",
4491 middleware = [],
4492 platform: platform3,
4493 elements: {
4494 reference: externalReference,
4495 floating: externalFloating
4496 } = {},
4497 transform = true,
4498 whileElementsMounted,
4499 open
4500 } = options;
4501 const [data, setData] = React19.useState({
4502 x: 0,
4503 y: 0,
4504 strategy,
4505 placement,
4506 middlewareData: {},
4507 isPositioned: false
4508 });
4509 const [latestMiddleware, setLatestMiddleware] = React19.useState(middleware);
4510 if (!deepEqual(latestMiddleware, middleware)) {
4511 setLatestMiddleware(middleware);
4512 }
4513 const [_reference, _setReference] = React19.useState(null);
4514 const [_floating, _setFloating] = React19.useState(null);
4515 const setReference = React19.useCallback((node) => {
4516 if (node !== referenceRef.current) {
4517 referenceRef.current = node;
4518 _setReference(node);
4519 }
4520 }, []);
4521 const setFloating = React19.useCallback((node) => {
4522 if (node !== floatingRef.current) {
4523 floatingRef.current = node;
4524 _setFloating(node);
4525 }
4526 }, []);
4527 const referenceEl = externalReference || _reference;
4528 const floatingEl = externalFloating || _floating;
4529 const referenceRef = React19.useRef(null);
4530 const floatingRef = React19.useRef(null);
4531 const dataRef = React19.useRef(data);
4532 const hasWhileElementsMounted = whileElementsMounted != null;
4533 const whileElementsMountedRef = useLatestRef(whileElementsMounted);
4534 const platformRef = useLatestRef(platform3);
4535 const openRef = useLatestRef(open);
4536 const update2 = React19.useCallback(() => {
4537 if (!referenceRef.current || !floatingRef.current) {
4538 return;
4539 }
4540 const config = {
4541 placement,
4542 strategy,
4543 middleware: latestMiddleware
4544 };
4545 if (platformRef.current) {
4546 config.platform = platformRef.current;
4547 }
4548 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
4549 const fullData = {
4550 ...data2,
4551 // The floating element's position may be recomputed while it's closed
4552 // but still mounted (such as when transitioning out). To ensure
4553 // `isPositioned` will be `false` initially on the next open, avoid
4554 // setting it to `true` when `open === false` (must be specified).
4555 isPositioned: openRef.current !== false
4556 };
4557 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
4558 dataRef.current = fullData;
4559 ReactDOM3.flushSync(() => {
4560 setData(fullData);
4561 });
4562 }
4563 });
4564 }, [latestMiddleware, placement, strategy, platformRef, openRef]);
4565 index(() => {
4566 if (open === false && dataRef.current.isPositioned) {
4567 dataRef.current.isPositioned = false;
4568 setData((data2) => ({
4569 ...data2,
4570 isPositioned: false
4571 }));
4572 }
4573 }, [open]);
4574 const isMountedRef = React19.useRef(false);
4575 index(() => {
4576 isMountedRef.current = true;
4577 return () => {
4578 isMountedRef.current = false;
4579 };
4580 }, []);
4581 index(() => {
4582 if (referenceEl) referenceRef.current = referenceEl;
4583 if (floatingEl) floatingRef.current = floatingEl;
4584 if (referenceEl && floatingEl) {
4585 if (whileElementsMountedRef.current) {
4586 return whileElementsMountedRef.current(referenceEl, floatingEl, update2);
4587 }
4588 update2();
4589 }
4590 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]);
4591 const refs = React19.useMemo(() => ({
4592 reference: referenceRef,
4593 floating: floatingRef,
4594 setReference,
4595 setFloating
4596 }), [setReference, setFloating]);
4597 const elements = React19.useMemo(() => ({
4598 reference: referenceEl,
4599 floating: floatingEl
4600 }), [referenceEl, floatingEl]);
4601 const floatingStyles = React19.useMemo(() => {
4602 const initialStyles = {
4603 position: strategy,
4604 left: 0,
4605 top: 0
4606 };
4607 if (!elements.floating) {
4608 return initialStyles;
4609 }
4610 const x = roundByDPR(elements.floating, data.x);
4611 const y = roundByDPR(elements.floating, data.y);
4612 if (transform) {
4613 return {
4614 ...initialStyles,
4615 transform: "translate(" + x + "px, " + y + "px)",
4616 ...getDPR(elements.floating) >= 1.5 && {
4617 willChange: "transform"
4618 }
4619 };
4620 }
4621 return {
4622 position: strategy,
4623 left: x,
4624 top: y
4625 };
4626 }, [strategy, transform, elements.floating, data.x, data.y]);
4627 return React19.useMemo(() => ({
4628 ...data,
4629 update: update2,
4630 refs,
4631 elements,
4632 floatingStyles
4633 }), [data, update2, refs, elements, floatingStyles]);
4634 }
4635 var offset3 = (options, deps) => {
4636 const result = offset2(options);
4637 return {
4638 name: result.name,
4639 fn: result.fn,
4640 options: [options, deps]
4641 };
4642 };
4643 var shift3 = (options, deps) => {
4644 const result = shift2(options);
4645 return {
4646 name: result.name,
4647 fn: result.fn,
4648 options: [options, deps]
4649 };
4650 };
4651 var limitShift3 = (options, deps) => {
4652 const result = limitShift2(options);
4653 return {
4654 fn: result.fn,
4655 options: [options, deps]
4656 };
4657 };
4658 var flip3 = (options, deps) => {
4659 const result = flip2(options);
4660 return {
4661 name: result.name,
4662 fn: result.fn,
4663 options: [options, deps]
4664 };
4665 };
4666 var size3 = (options, deps) => {
4667 const result = size2(options);
4668 return {
4669 name: result.name,
4670 fn: result.fn,
4671 options: [options, deps]
4672 };
4673 };
4674 var hide3 = (options, deps) => {
4675 const result = hide2(options);
4676 return {
4677 name: result.name,
4678 fn: result.fn,
4679 options: [options, deps]
4680 };
4681 };
4682
4683 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
4684 var React24 = __toESM(require_react(), 1);
4685 var ReactDOM4 = __toESM(require_react_dom(), 1);
4686
4687 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
4688 var React23 = __toESM(require_react(), 1);
4689
4690 // node_modules/@base-ui/utils/store/createSelector.mjs
4691 var createSelector = (a, b, c, d, e, f, ...other) => {
4692 if (other.length > 0) {
4693 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1));
4694 }
4695 let selector;
4696 if (a && b && c && d && e && f) {
4697 selector = (state, a1, a2, a3) => {
4698 const va = a(state, a1, a2, a3);
4699 const vb = b(state, a1, a2, a3);
4700 const vc = c(state, a1, a2, a3);
4701 const vd = d(state, a1, a2, a3);
4702 const ve = e(state, a1, a2, a3);
4703 return f(va, vb, vc, vd, ve, a1, a2, a3);
4704 };
4705 } else if (a && b && c && d && e) {
4706 selector = (state, a1, a2, a3) => {
4707 const va = a(state, a1, a2, a3);
4708 const vb = b(state, a1, a2, a3);
4709 const vc = c(state, a1, a2, a3);
4710 const vd = d(state, a1, a2, a3);
4711 return e(va, vb, vc, vd, a1, a2, a3);
4712 };
4713 } else if (a && b && c && d) {
4714 selector = (state, a1, a2, a3) => {
4715 const va = a(state, a1, a2, a3);
4716 const vb = b(state, a1, a2, a3);
4717 const vc = c(state, a1, a2, a3);
4718 return d(va, vb, vc, a1, a2, a3);
4719 };
4720 } else if (a && b && c) {
4721 selector = (state, a1, a2, a3) => {
4722 const va = a(state, a1, a2, a3);
4723 const vb = b(state, a1, a2, a3);
4724 return c(va, vb, a1, a2, a3);
4725 };
4726 } else if (a && b) {
4727 selector = (state, a1, a2, a3) => {
4728 const va = a(state, a1, a2, a3);
4729 return b(va, a1, a2, a3);
4730 };
4731 } else if (a) {
4732 selector = a;
4733 } else {
4734 throw (
4735 /* minify-error-disabled */
4736 new Error("Missing arguments")
4737 );
4738 }
4739 return selector;
4740 };
4741
4742 // node_modules/@base-ui/utils/store/useStore.mjs
4743 var React21 = __toESM(require_react(), 1);
4744 var import_shim = __toESM(require_shim(), 1);
4745 var import_with_selector = __toESM(require_with_selector(), 1);
4746
4747 // node_modules/@base-ui/utils/fastHooks.mjs
4748 var React20 = __toESM(require_react(), 1);
4749 var hooks = [];
4750 var currentInstance = void 0;
4751 function getInstance() {
4752 return currentInstance;
4753 }
4754 function register(hook) {
4755 hooks.push(hook);
4756 }
4757 function fastComponent(fn) {
4758 const FastComponent = (props, forwardedRef) => {
4759 const instance = useRefWithInit(createInstance).current;
4760 let result;
4761 try {
4762 currentInstance = instance;
4763 for (const hook of hooks) {
4764 hook.before(instance);
4765 }
4766 result = fn(props, forwardedRef);
4767 for (const hook of hooks) {
4768 hook.after(instance);
4769 }
4770 instance.didInitialize = true;
4771 } finally {
4772 currentInstance = void 0;
4773 }
4774 return result;
4775 };
4776 FastComponent.displayName = fn.displayName || fn.name;
4777 return FastComponent;
4778 }
4779 function fastComponentRef(fn) {
4780 return /* @__PURE__ */ React20.forwardRef(fastComponent(fn));
4781 }
4782 function createInstance() {
4783 return {
4784 didInitialize: false
4785 };
4786 }
4787
4788 // node_modules/@base-ui/utils/store/useStore.mjs
4789 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);
4790 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;
4791 function useStore(store2, selector, a1, a2, a3) {
4792 return useStoreImplementation(store2, selector, a1, a2, a3);
4793 }
4794 function useStoreR19(store2, selector, a1, a2, a3) {
4795 const getSelection = React21.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]);
4796 return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection);
4797 }
4798 register({
4799 before(instance) {
4800 instance.syncIndex = 0;
4801 if (!instance.didInitialize) {
4802 instance.syncTick = 1;
4803 instance.syncHooks = [];
4804 instance.didChangeStore = true;
4805 instance.getSnapshot = () => {
4806 let didChange2 = false;
4807 for (let i = 0; i < instance.syncHooks.length; i += 1) {
4808 const hook = instance.syncHooks[i];
4809 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);
4810 if (!Object.is(hook.value, value)) {
4811 didChange2 = true;
4812 hook.value = value;
4813 }
4814 }
4815 if (didChange2) {
4816 instance.syncTick += 1;
4817 }
4818 return instance.syncTick;
4819 };
4820 }
4821 },
4822 after(instance) {
4823 if (instance.syncHooks.length > 0) {
4824 if (instance.didChangeStore) {
4825 instance.didChangeStore = false;
4826 instance.subscribe = (onStoreChange) => {
4827 const stores = /* @__PURE__ */ new Set();
4828 for (const hook of instance.syncHooks) {
4829 stores.add(hook.store);
4830 }
4831 const unsubscribes = [];
4832 for (const store2 of stores) {
4833 unsubscribes.push(store2.subscribe(onStoreChange));
4834 }
4835 return () => {
4836 for (const unsubscribe of unsubscribes) {
4837 unsubscribe();
4838 }
4839 };
4840 };
4841 }
4842 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot);
4843 }
4844 }
4845 });
4846 function useStoreFast(store2, selector, a1, a2, a3) {
4847 const instance = getInstance();
4848 if (!instance) {
4849 return useStoreR19(store2, selector, a1, a2, a3);
4850 }
4851 const index2 = instance.syncIndex;
4852 instance.syncIndex += 1;
4853 let hook;
4854 if (!instance.didInitialize) {
4855 hook = {
4856 store: store2,
4857 selector,
4858 a1,
4859 a2,
4860 a3,
4861 value: selector(store2.getSnapshot(), a1, a2, a3)
4862 };
4863 instance.syncHooks.push(hook);
4864 } else {
4865 hook = instance.syncHooks[index2];
4866 if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {
4867 if (hook.store !== store2) {
4868 instance.didChangeStore = true;
4869 }
4870 hook.store = store2;
4871 hook.selector = selector;
4872 hook.a1 = a1;
4873 hook.a2 = a2;
4874 hook.a3 = a3;
4875 hook.value = selector(store2.getSnapshot(), a1, a2, a3);
4876 }
4877 }
4878 return hook.value;
4879 }
4880 function useStoreLegacy(store2, selector, a1, a2, a3) {
4881 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3));
4882 }
4883
4884 // node_modules/@base-ui/utils/store/Store.mjs
4885 var Store = class {
4886 /**
4887 * The current state of the store.
4888 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
4889 * 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).
4890 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
4891 *
4892 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
4893 */
4894 // Internal state to handle recursive `setState()` calls
4895 constructor(state) {
4896 this.state = state;
4897 this.listeners = /* @__PURE__ */ new Set();
4898 this.updateTick = 0;
4899 }
4900 /**
4901 * Registers a listener that will be called whenever the store's state changes.
4902 *
4903 * @param fn The listener function to be called on state changes.
4904 * @returns A function to unsubscribe the listener.
4905 */
4906 subscribe = (fn) => {
4907 this.listeners.add(fn);
4908 return () => {
4909 this.listeners.delete(fn);
4910 };
4911 };
4912 /**
4913 * Returns the current state of the store.
4914 */
4915 getSnapshot = () => {
4916 return this.state;
4917 };
4918 /**
4919 * Updates the entire store's state and notifies all registered listeners.
4920 *
4921 * @param newState The new state to set for the store.
4922 */
4923 setState(newState) {
4924 if (this.state === newState) {
4925 return;
4926 }
4927 this.state = newState;
4928 this.updateTick += 1;
4929 const currentTick = this.updateTick;
4930 for (const listener of this.listeners) {
4931 if (currentTick !== this.updateTick) {
4932 return;
4933 }
4934 listener(newState);
4935 }
4936 }
4937 /**
4938 * Merges the provided changes into the current state and notifies listeners if there are changes.
4939 *
4940 * @param changes An object containing the changes to apply to the current state.
4941 */
4942 update(changes) {
4943 for (const key in changes) {
4944 if (!Object.is(this.state[key], changes[key])) {
4945 this.setState({
4946 ...this.state,
4947 ...changes
4948 });
4949 return;
4950 }
4951 }
4952 }
4953 /**
4954 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
4955 *
4956 * @param key The key in the store's state to update.
4957 * @param value The new value to set for the specified key.
4958 */
4959 set(key, value) {
4960 if (!Object.is(this.state[key], value)) {
4961 this.setState({
4962 ...this.state,
4963 [key]: value
4964 });
4965 }
4966 }
4967 /**
4968 * Gives the state a new reference and updates all registered listeners.
4969 */
4970 notifyAll() {
4971 const newState = {
4972 ...this.state
4973 };
4974 this.setState(newState);
4975 }
4976 use(selector, a1, a2, a3) {
4977 return useStore(this, selector, a1, a2, a3);
4978 }
4979 };
4980
4981 // node_modules/@base-ui/utils/store/ReactStore.mjs
4982 var React22 = __toESM(require_react(), 1);
4983 var ReactStore = class extends Store {
4984 /**
4985 * Creates a new ReactStore instance.
4986 *
4987 * @param state Initial state of the store.
4988 * @param context Non-reactive context values.
4989 * @param selectors Optional selectors for use with `useState`.
4990 */
4991 constructor(state, context = {}, selectors3) {
4992 super(state);
4993 this.context = context;
4994 this.selectors = selectors3;
4995 }
4996 /**
4997 * Non-reactive values such as refs, callbacks, etc.
4998 */
4999 /**
5000 * Synchronizes a single external value into the store.
5001 *
5002 * Note that the while the value in `state` is updated immediately, the value returned
5003 * by `useState` is updated before the next render (similarly to React's `useState`).
5004 */
5005 useSyncedValue(key, value) {
5006 React22.useDebugValue(key);
5007 const store2 = this;
5008 useIsoLayoutEffect(() => {
5009 if (store2.state[key] !== value) {
5010 store2.set(key, value);
5011 }
5012 }, [store2, key, value]);
5013 }
5014 /**
5015 * Synchronizes a single external value into the store and
5016 * cleans it up (sets to `undefined`) on unmount.
5017 *
5018 * Note that the while the value in `state` is updated immediately, the value returned
5019 * by `useState` is updated before the next render (similarly to React's `useState`).
5020 */
5021 useSyncedValueWithCleanup(key, value) {
5022 const store2 = this;
5023 useIsoLayoutEffect(() => {
5024 if (store2.state[key] !== value) {
5025 store2.set(key, value);
5026 }
5027 return () => {
5028 store2.set(key, void 0);
5029 };
5030 }, [store2, key, value]);
5031 }
5032 /**
5033 * Synchronizes multiple external values into the store.
5034 *
5035 * Note that the while the values in `state` are updated immediately, the values returned
5036 * by `useState` are updated before the next render (similarly to React's `useState`).
5037 */
5038 useSyncedValues(statePart) {
5039 const store2 = this;
5040 if (true) {
5041 React22.useDebugValue(statePart, (p) => Object.keys(p));
5042 const keys = React22.useRef(Object.keys(statePart)).current;
5043 const nextKeys = Object.keys(statePart);
5044 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) {
5045 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
5046 }
5047 }
5048 const dependencies = Object.values(statePart);
5049 useIsoLayoutEffect(() => {
5050 store2.update(statePart);
5051 }, [store2, ...dependencies]);
5052 }
5053 /**
5054 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
5055 * is non-undefined, the store's state at `key` is updated to match `controlled`.
5056 */
5057 useControlledProp(key, controlled) {
5058 React22.useDebugValue(key);
5059 const store2 = this;
5060 const isControlled = controlled !== void 0;
5061 useIsoLayoutEffect(() => {
5062 if (isControlled && !Object.is(store2.state[key], controlled)) {
5063 store2.setState({
5064 ...store2.state,
5065 [key]: controlled
5066 });
5067 }
5068 }, [store2, key, controlled, isControlled]);
5069 if (true) {
5070 const cache = this.controlledValues ??= /* @__PURE__ */ new Map();
5071 if (!cache.has(key)) {
5072 cache.set(key, isControlled);
5073 }
5074 const previouslyControlled = cache.get(key);
5075 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) {
5076 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).`);
5077 }
5078 }
5079 }
5080 /** Gets the current value from the store using a selector with the provided key.
5081 *
5082 * @param key Key of the selector to use.
5083 */
5084 select(key, a1, a2, a3) {
5085 const selector = this.selectors[key];
5086 return selector(this.state, a1, a2, a3);
5087 }
5088 /**
5089 * Returns a value from the store's state using a selector function.
5090 * Used to subscribe to specific parts of the state.
5091 * This methods causes a rerender whenever the selected state changes.
5092 *
5093 * @param key Key of the selector to use.
5094 */
5095 useState(key, a1, a2, a3) {
5096 React22.useDebugValue(key);
5097 return useStore(this, this.selectors[key], a1, a2, a3);
5098 }
5099 /**
5100 * Wraps a function with `useStableCallback` to ensure it has a stable reference
5101 * and assigns it to the context.
5102 *
5103 * @param key Key of the event callback. Must be a function in the context.
5104 * @param fn Function to assign.
5105 */
5106 useContextCallback(key, fn) {
5107 React22.useDebugValue(key);
5108 const stableFunction = useStableCallback(fn ?? NOOP);
5109 this.context[key] = stableFunction;
5110 }
5111 /**
5112 * Returns a stable setter function for a specific key in the store's state.
5113 * It's commonly used to pass as a ref callback to React elements.
5114 *
5115 * @param key Key of the state to set.
5116 */
5117 useStateSetter(key) {
5118 const ref = React22.useRef(void 0);
5119 if (ref.current === void 0) {
5120 ref.current = (value) => {
5121 this.set(key, value);
5122 };
5123 }
5124 return ref.current;
5125 }
5126 /**
5127 * Observes changes derived from the store's selectors and calls the listener when the selected value changes.
5128 *
5129 * @param key Key of the selector to observe.
5130 * @param listener Listener function called when the selector result changes.
5131 */
5132 observe(selector, listener) {
5133 let selectFn;
5134 if (typeof selector === "function") {
5135 selectFn = selector;
5136 } else {
5137 selectFn = this.selectors[selector];
5138 }
5139 let prevValue = selectFn(this.state);
5140 listener(prevValue, prevValue, this);
5141 return this.subscribe((nextState) => {
5142 const nextValue = selectFn(nextState);
5143 if (!Object.is(prevValue, nextValue)) {
5144 const oldValue = prevValue;
5145 prevValue = nextValue;
5146 listener(nextValue, oldValue, this);
5147 }
5148 });
5149 }
5150 };
5151
5152 // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs
5153 var selectors = {
5154 open: createSelector((state) => state.open),
5155 transitionStatus: createSelector((state) => state.transitionStatus),
5156 domReferenceElement: createSelector((state) => state.domReferenceElement),
5157 referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement),
5158 floatingElement: createSelector((state) => state.floatingElement),
5159 floatingId: createSelector((state) => state.floatingId)
5160 };
5161 var FloatingRootStore = class extends ReactStore {
5162 constructor(options) {
5163 const {
5164 syncOnly,
5165 nested,
5166 onOpenChange,
5167 triggerElements,
5168 ...initialState
5169 } = options;
5170 super({
5171 ...initialState,
5172 positionReference: initialState.referenceElement,
5173 domReferenceElement: initialState.referenceElement
5174 }, {
5175 onOpenChange,
5176 dataRef: {
5177 current: {}
5178 },
5179 events: createEventEmitter(),
5180 nested,
5181 triggerElements
5182 }, selectors);
5183 this.syncOnly = syncOnly;
5184 }
5185 /**
5186 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.
5187 */
5188 syncOpenEvent = (newOpen, event) => {
5189 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
5190 // click events to upgrade a hover-open.
5191 event != null && isClickLikeEvent(event)) {
5192 this.context.dataRef.current.openEvent = newOpen ? event : void 0;
5193 }
5194 };
5195 /**
5196 * Runs the root-owned side effects for an open state change.
5197 */
5198 dispatchOpenChange = (newOpen, eventDetails) => {
5199 this.syncOpenEvent(newOpen, eventDetails.event);
5200 const details = {
5201 open: newOpen,
5202 reason: eventDetails.reason,
5203 nativeEvent: eventDetails.event,
5204 nested: this.context.nested,
5205 triggerElement: eventDetails.trigger
5206 };
5207 this.context.events.emit("openchange", details);
5208 };
5209 /**
5210 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
5211 *
5212 * @param newOpen The new open state.
5213 * @param eventDetails Details about the event that triggered the open state change.
5214 */
5215 setOpen = (newOpen, eventDetails) => {
5216 if (this.syncOnly) {
5217 this.context.onOpenChange?.(newOpen, eventDetails);
5218 return;
5219 }
5220 this.dispatchOpenChange(newOpen, eventDetails);
5221 this.context.onOpenChange?.(newOpen, eventDetails);
5222 };
5223 };
5224
5225 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
5226 function useSyncedFloatingRootContext(options) {
5227 const {
5228 popupStore,
5229 treatPopupAsFloatingElement = false,
5230 floatingRootContext: floatingRootContextProp,
5231 floatingId,
5232 nested,
5233 onOpenChange
5234 } = options;
5235 const open = popupStore.useState("open");
5236 const referenceElement = popupStore.useState("activeTriggerElement");
5237 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement");
5238 const triggerElements = popupStore.context.triggerElements;
5239 const handleOpenChange = onOpenChange;
5240 const internalStoreRef = React23.useRef(null);
5241 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) {
5242 internalStoreRef.current = new FloatingRootStore({
5243 open,
5244 transitionStatus: void 0,
5245 referenceElement,
5246 floatingElement,
5247 triggerElements,
5248 onOpenChange: handleOpenChange,
5249 floatingId,
5250 syncOnly: true,
5251 nested
5252 });
5253 }
5254 const store2 = floatingRootContextProp ?? internalStoreRef.current;
5255 popupStore.useSyncedValue("floatingId", floatingId);
5256 useIsoLayoutEffect(() => {
5257 const valuesToSync = {
5258 open,
5259 floatingId,
5260 referenceElement,
5261 floatingElement
5262 };
5263 if (isElement(referenceElement)) {
5264 valuesToSync.domReferenceElement = referenceElement;
5265 }
5266 if (store2.state.positionReference === store2.state.referenceElement) {
5267 valuesToSync.positionReference = referenceElement;
5268 }
5269 store2.update(valuesToSync);
5270 }, [open, floatingId, referenceElement, floatingElement, store2]);
5271 store2.context.onOpenChange = handleOpenChange;
5272 store2.context.nested = nested;
5273 return store2;
5274 }
5275
5276 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
5277 var FOCUSABLE_POPUP_PROPS = {
5278 tabIndex: -1,
5279 [FOCUSABLE_ATTRIBUTE]: ""
5280 };
5281 function usePopupStore(externalStore, createStore, treatPopupAsFloatingElement = false) {
5282 const floatingId = useId();
5283 const nested = useFloatingParentNodeId() != null;
5284 const internalStoreRef = React24.useRef(null);
5285 if (externalStore === void 0 && internalStoreRef.current === null) {
5286 internalStoreRef.current = createStore(floatingId, nested);
5287 }
5288 const store2 = externalStore ?? internalStoreRef.current;
5289 useSyncedFloatingRootContext({
5290 popupStore: store2,
5291 treatPopupAsFloatingElement,
5292 floatingRootContext: store2.state.floatingRootContext,
5293 floatingId,
5294 nested,
5295 onOpenChange: store2.setOpen
5296 });
5297 return {
5298 store: store2,
5299 internalStore: internalStoreRef.current
5300 };
5301 }
5302 function useTriggerRegistration(id, store2) {
5303 const registeredElementIdRef = React24.useRef(null);
5304 const registeredElementRef = React24.useRef(null);
5305 return React24.useCallback((element) => {
5306 if (id === void 0) {
5307 return;
5308 }
5309 let shouldSyncTriggerCount = false;
5310 if (registeredElementIdRef.current !== null) {
5311 const registeredId = registeredElementIdRef.current;
5312 const registeredElement = registeredElementRef.current;
5313 const currentElement = store2.context.triggerElements.getById(registeredId);
5314 if (registeredElement && currentElement === registeredElement) {
5315 store2.context.triggerElements.delete(registeredId);
5316 shouldSyncTriggerCount = true;
5317 }
5318 registeredElementIdRef.current = null;
5319 registeredElementRef.current = null;
5320 }
5321 if (element !== null) {
5322 registeredElementIdRef.current = id;
5323 registeredElementRef.current = element;
5324 store2.context.triggerElements.add(id, element);
5325 shouldSyncTriggerCount = true;
5326 }
5327 if (shouldSyncTriggerCount) {
5328 const triggerCount = store2.context.triggerElements.size;
5329 if (store2.select("open") && store2.state.triggerCount !== triggerCount) {
5330 store2.set("triggerCount", triggerCount);
5331 }
5332 }
5333 }, [store2, id]);
5334 }
5335 function setPopupOpenState(state, open, trigger, preventUnmountOnClose = false) {
5336 if (open) {
5337 state.preventUnmountingOnClose = false;
5338 } else if (preventUnmountOnClose) {
5339 state.preventUnmountingOnClose = true;
5340 }
5341 const triggerId = trigger?.id ?? null;
5342 if (triggerId || open) {
5343 state.activeTriggerId = triggerId;
5344 state.activeTriggerElement = trigger ?? null;
5345 }
5346 }
5347 function attachPreventUnmountOnClose(eventDetails) {
5348 let preventUnmountOnClose = false;
5349 eventDetails.preventUnmountOnClose = () => {
5350 preventUnmountOnClose = true;
5351 };
5352 return () => preventUnmountOnClose;
5353 }
5354 function applyPopupOpenChange(store2, nextOpen, eventDetails, options = {}) {
5355 const reason = eventDetails.reason;
5356 const isHover = reason === reason_parts_exports.triggerHover;
5357 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus;
5358 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey);
5359 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
5360 store2.context.onOpenChange?.(nextOpen, eventDetails);
5361 if (eventDetails.isCanceled) {
5362 return;
5363 }
5364 options.onBeforeDispatch?.();
5365 store2.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
5366 const changeState = () => {
5367 const updatedState = {
5368 ...options.extraState,
5369 open: nextOpen
5370 };
5371 if (isFocusOpen) {
5372 updatedState.instantType = "focus";
5373 } else if (isDismissClose) {
5374 updatedState.instantType = "dismiss";
5375 } else if (isHover) {
5376 updatedState.instantType = void 0;
5377 }
5378 setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
5379 store2.update(updatedState);
5380 };
5381 if (isHover) {
5382 ReactDOM4.flushSync(changeState);
5383 } else {
5384 changeState();
5385 }
5386 }
5387 function useInitialOpenSync(store2, openProp, defaultOpen, defaultTriggerId) {
5388 useOnFirstRender(() => {
5389 if (openProp === void 0 && store2.state.open === false && defaultOpen) {
5390 store2.state = {
5391 ...store2.state,
5392 open: true,
5393 activeTriggerId: defaultTriggerId,
5394 preventUnmountingOnClose: false
5395 };
5396 }
5397 });
5398 }
5399 function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) {
5400 const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId);
5401 const baseRegisterTrigger = useTriggerRegistration(triggerId, store2);
5402 const registerTrigger = useStableCallback((element) => {
5403 baseRegisterTrigger(element);
5404 if (!element) {
5405 return;
5406 }
5407 const open = store2.select("open");
5408 const activeTriggerId = store2.select("activeTriggerId");
5409 if (activeTriggerId === triggerId) {
5410 store2.update({
5411 activeTriggerElement: element,
5412 ...open ? stateUpdates : null
5413 });
5414 return;
5415 }
5416 if (activeTriggerId == null && open) {
5417 store2.update({
5418 activeTriggerId: triggerId,
5419 activeTriggerElement: element,
5420 ...stateUpdates
5421 });
5422 }
5423 });
5424 useIsoLayoutEffect(() => {
5425 if (isMountedByThisTrigger) {
5426 store2.update({
5427 activeTriggerElement: triggerElementRef.current,
5428 ...stateUpdates
5429 });
5430 }
5431 }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]);
5432 return {
5433 registerTrigger,
5434 isMountedByThisTrigger
5435 };
5436 }
5437 function useImplicitActiveTrigger(store2, options = {}) {
5438 const {
5439 closeOnActiveTriggerUnmount = false
5440 } = options;
5441 const open = store2.useState("open");
5442 const reactiveTriggerCount = store2.useState("triggerCount");
5443 useIsoLayoutEffect(() => {
5444 if (!open) {
5445 if (store2.state.triggerCount !== 0) {
5446 store2.set("triggerCount", 0);
5447 }
5448 return;
5449 }
5450 const triggerCount = store2.context.triggerElements.size;
5451 const stateUpdates = {};
5452 if (store2.state.triggerCount !== triggerCount) {
5453 stateUpdates.triggerCount = triggerCount;
5454 }
5455 const activeTriggerId = store2.select("activeTriggerId");
5456 let lostActiveTriggerId = null;
5457 if (activeTriggerId) {
5458 const activeTriggerElement = store2.context.triggerElements.getById(activeTriggerId);
5459 if (!activeTriggerElement) {
5460 lostActiveTriggerId = activeTriggerId;
5461 } else if (activeTriggerElement !== store2.state.activeTriggerElement) {
5462 stateUpdates.activeTriggerElement = activeTriggerElement;
5463 }
5464 }
5465 if (!lostActiveTriggerId && !activeTriggerId && triggerCount === 1) {
5466 const iteratorResult = store2.context.triggerElements.entries().next();
5467 if (!iteratorResult.done) {
5468 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;
5469 stateUpdates.activeTriggerId = implicitTriggerId;
5470 stateUpdates.activeTriggerElement = implicitTriggerElement;
5471 }
5472 }
5473 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) {
5474 store2.update(stateUpdates);
5475 }
5476 if (lostActiveTriggerId) {
5477 if (closeOnActiveTriggerUnmount) {
5478 queueMicrotask(() => {
5479 if (store2.select("open") && store2.select("activeTriggerId") === lostActiveTriggerId && !store2.context.triggerElements.getById(lostActiveTriggerId)) {
5480 const eventDetails = createChangeEventDetails(reason_parts_exports.none);
5481 store2.setOpen(false, eventDetails);
5482 if (!eventDetails.isCanceled) {
5483 store2.update({
5484 activeTriggerId: null,
5485 activeTriggerElement: null
5486 });
5487 }
5488 }
5489 });
5490 }
5491 }
5492 }, [open, store2, reactiveTriggerCount, closeOnActiveTriggerUnmount]);
5493 }
5494 function useOpenStateTransitions(open, store2, onUnmount) {
5495 const {
5496 mounted,
5497 setMounted,
5498 transitionStatus
5499 } = useTransitionStatus(open);
5500 const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose");
5501 const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose;
5502 store2.useSyncedValues({
5503 mounted,
5504 transitionStatus,
5505 preventUnmountingOnClose: syncedPreventUnmountingOnClose
5506 });
5507 const forceUnmount = useStableCallback(() => {
5508 setMounted(false);
5509 store2.update({
5510 activeTriggerId: null,
5511 activeTriggerElement: null,
5512 mounted: false,
5513 preventUnmountingOnClose: false
5514 });
5515 onUnmount?.();
5516 store2.context.onOpenChangeComplete?.(false);
5517 });
5518 useOpenChangeComplete({
5519 enabled: mounted && !open && !syncedPreventUnmountingOnClose,
5520 open,
5521 ref: store2.context.popupRef,
5522 onComplete() {
5523 if (!open) {
5524 forceUnmount();
5525 }
5526 }
5527 });
5528 return {
5529 forceUnmount,
5530 transitionStatus
5531 };
5532 }
5533 function usePopupInteractionProps(store2, statePart) {
5534 store2.useSyncedValues(statePart);
5535 useIsoLayoutEffect(() => () => {
5536 store2.update({
5537 activeTriggerProps: EMPTY_OBJECT,
5538 inactiveTriggerProps: EMPTY_OBJECT,
5539 popupProps: EMPTY_OBJECT
5540 });
5541 }, [store2]);
5542 }
5543
5544 // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs
5545 var PopupTriggerMap = class {
5546 constructor() {
5547 this.elementsSet = /* @__PURE__ */ new Set();
5548 this.idMap = /* @__PURE__ */ new Map();
5549 }
5550 /**
5551 * Adds a trigger element with the given ID.
5552 *
5553 * Note: The provided element is assumed to not be registered under multiple IDs.
5554 */
5555 add(id, element) {
5556 const existingElement = this.idMap.get(id);
5557 if (existingElement === element) {
5558 return;
5559 }
5560 if (existingElement !== void 0) {
5561 this.elementsSet.delete(existingElement);
5562 }
5563 this.elementsSet.add(element);
5564 this.idMap.set(id, element);
5565 if (true) {
5566 if (this.elementsSet.size !== this.idMap.size) {
5567 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");
5568 }
5569 }
5570 }
5571 /**
5572 * Removes the trigger element with the given ID.
5573 */
5574 delete(id) {
5575 const element = this.idMap.get(id);
5576 if (element) {
5577 this.elementsSet.delete(element);
5578 this.idMap.delete(id);
5579 }
5580 }
5581 /**
5582 * Whether the given element is registered as a trigger.
5583 */
5584 hasElement(element) {
5585 return this.elementsSet.has(element);
5586 }
5587 /**
5588 * Whether there is a registered trigger element matching the given predicate.
5589 */
5590 hasMatchingElement(predicate) {
5591 for (const element of this.elementsSet) {
5592 if (predicate(element)) {
5593 return true;
5594 }
5595 }
5596 return false;
5597 }
5598 /**
5599 * Returns the trigger element associated with the given ID, or undefined if no such element exists.
5600 */
5601 getById(id) {
5602 return this.idMap.get(id);
5603 }
5604 /**
5605 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].
5606 */
5607 entries() {
5608 return this.idMap.entries();
5609 }
5610 /**
5611 * Returns an iterable of all registered trigger elements.
5612 */
5613 elements() {
5614 return this.elementsSet.values();
5615 }
5616 /**
5617 * Returns the number of registered trigger elements.
5618 */
5619 get size() {
5620 return this.idMap.size;
5621 }
5622 };
5623
5624 // node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs
5625 function getEmptyRootContext() {
5626 return new FloatingRootStore({
5627 open: false,
5628 transitionStatus: void 0,
5629 floatingElement: null,
5630 referenceElement: null,
5631 triggerElements: new PopupTriggerMap(),
5632 floatingId: void 0,
5633 syncOnly: false,
5634 nested: false,
5635 onOpenChange: void 0
5636 });
5637 }
5638
5639 // node_modules/@base-ui/react/utils/popups/store.mjs
5640 function createInitialPopupStoreState() {
5641 return {
5642 open: false,
5643 openProp: void 0,
5644 mounted: false,
5645 transitionStatus: void 0,
5646 floatingRootContext: getEmptyRootContext(),
5647 floatingId: void 0,
5648 triggerCount: 0,
5649 preventUnmountingOnClose: false,
5650 payload: void 0,
5651 activeTriggerId: null,
5652 activeTriggerElement: null,
5653 triggerIdProp: void 0,
5654 popupElement: null,
5655 positionerElement: null,
5656 activeTriggerProps: EMPTY_OBJECT,
5657 inactiveTriggerProps: EMPTY_OBJECT,
5658 popupProps: EMPTY_OBJECT
5659 };
5660 }
5661 function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) {
5662 return new FloatingRootStore({
5663 open: false,
5664 transitionStatus: void 0,
5665 floatingElement: null,
5666 referenceElement: null,
5667 triggerElements,
5668 floatingId,
5669 syncOnly: true,
5670 nested,
5671 onOpenChange: void 0
5672 });
5673 }
5674 var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId);
5675 var openSelector = createSelector((state) => state.openProp ?? state.open);
5676 var popupIdSelector = createSelector((state) => {
5677 const popupId = state.popupElement?.id ?? state.floatingId;
5678 return popupId || void 0;
5679 });
5680 function triggerOwnsOpenPopup(state, triggerId) {
5681 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId;
5682 }
5683 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {
5684 if (triggerOwnsOpenPopup(state, triggerId)) {
5685 return true;
5686 }
5687 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1;
5688 }
5689 var popupStoreSelectors = {
5690 open: openSelector,
5691 mounted: createSelector((state) => state.mounted),
5692 transitionStatus: createSelector((state) => state.transitionStatus),
5693 floatingRootContext: createSelector((state) => state.floatingRootContext),
5694 triggerCount: createSelector((state) => state.triggerCount),
5695 preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose),
5696 payload: createSelector((state) => state.payload),
5697 activeTriggerId: activeTriggerIdSelector,
5698 activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null),
5699 popupId: popupIdSelector,
5700 /**
5701 * Whether the trigger with the given ID was used to open the popup.
5702 */
5703 isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId),
5704 /**
5705 * Whether the popup is open and was activated by a trigger with the given ID.
5706 */
5707 isOpenedByTrigger: createSelector((state, triggerId) => triggerOwnsOpenPopup(state, triggerId)),
5708 /**
5709 * Whether the popup is mounted and was activated by a trigger with the given ID.
5710 */
5711 isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted),
5712 triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps),
5713 /**
5714 * Popup id for the trigger that currently owns the open popup.
5715 */
5716 triggerPopupId: createSelector((state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0),
5717 popupProps: createSelector((state) => state.popupProps),
5718 popupElement: createSelector((state) => state.popupElement),
5719 positionerElement: createSelector((state) => state.positionerElement)
5720 };
5721
5722 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs
5723 function useFloatingRootContext(options) {
5724 const {
5725 open = false,
5726 onOpenChange,
5727 elements = {}
5728 } = options;
5729 const floatingId = useId();
5730 const nested = useFloatingParentNodeId() != null;
5731 if (true) {
5732 const optionDomReference = elements.reference;
5733 if (optionDomReference && !isElement(optionDomReference)) {
5734 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead.");
5735 }
5736 }
5737 const store2 = useRefWithInit(() => new FloatingRootStore({
5738 open,
5739 transitionStatus: void 0,
5740 onOpenChange,
5741 referenceElement: elements.reference ?? null,
5742 floatingElement: elements.floating ?? null,
5743 triggerElements: new PopupTriggerMap(),
5744 floatingId,
5745 syncOnly: false,
5746 nested
5747 })).current;
5748 useIsoLayoutEffect(() => {
5749 const valuesToSync = {
5750 open,
5751 floatingId
5752 };
5753 if (elements.reference !== void 0) {
5754 valuesToSync.referenceElement = elements.reference;
5755 valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;
5756 }
5757 if (elements.floating !== void 0) {
5758 valuesToSync.floatingElement = elements.floating;
5759 }
5760 store2.update(valuesToSync);
5761 }, [open, floatingId, elements.reference, elements.floating, store2]);
5762 store2.context.onOpenChange = onOpenChange;
5763 store2.context.nested = nested;
5764 return store2;
5765 }
5766
5767 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
5768 function useFloating2(options = {}) {
5769 const {
5770 nodeId,
5771 externalTree
5772 } = options;
5773 const internalStore = useFloatingRootContext(options);
5774 const store2 = options.rootContext || internalStore;
5775 const referenceElement = store2.useState("referenceElement");
5776 const floatingElement = store2.useState("floatingElement");
5777 const domReferenceElement = store2.useState("domReferenceElement");
5778 const open = store2.useState("open");
5779 const floatingId = store2.useState("floatingId");
5780 const [positionReference, setPositionReferenceRaw] = React25.useState(null);
5781 const [localDomReference, setLocalDomReference] = React25.useState(void 0);
5782 const [localFloatingElement, setLocalFloatingElement] = React25.useState(void 0);
5783 const domReferenceRef = React25.useRef(null);
5784 const tree = useFloatingTree(externalTree);
5785 const storeElements = React25.useMemo(() => ({
5786 reference: referenceElement,
5787 floating: floatingElement,
5788 domReference: domReferenceElement
5789 }), [referenceElement, floatingElement, domReferenceElement]);
5790 const position = useFloating({
5791 ...options,
5792 elements: {
5793 ...storeElements,
5794 ...positionReference && {
5795 reference: positionReference
5796 }
5797 }
5798 });
5799 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;
5800 const syncedFloatingElement = localFloatingElement === void 0 ? store2.state.floatingElement : localFloatingElement;
5801 store2.useSyncedValue("referenceElement", localDomReference ?? null);
5802 store2.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement);
5803 store2.useSyncedValue("floatingElement", syncedFloatingElement);
5804 const setPositionReference = React25.useCallback((node) => {
5805 const computedPositionReference = isElement(node) ? {
5806 getBoundingClientRect: () => node.getBoundingClientRect(),
5807 getClientRects: () => node.getClientRects(),
5808 contextElement: node
5809 } : node;
5810 setPositionReferenceRaw(computedPositionReference);
5811 position.refs.setReference(computedPositionReference);
5812 }, [position.refs]);
5813 const setReference = React25.useCallback((node) => {
5814 if (isElement(node) || node === null) {
5815 domReferenceRef.current = node;
5816 setLocalDomReference(node);
5817 }
5818 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
5819 // `null` to support `positionReference` + an unstable `reference`
5820 // callback ref.
5821 node !== null && !isElement(node)) {
5822 position.refs.setReference(node);
5823 }
5824 }, [position.refs, setLocalDomReference]);
5825 const setFloating = React25.useCallback((node) => {
5826 setLocalFloatingElement(node);
5827 position.refs.setFloating(node);
5828 }, [position.refs]);
5829 const refs = React25.useMemo(() => ({
5830 ...position.refs,
5831 setReference,
5832 setFloating,
5833 setPositionReference,
5834 domReference: domReferenceRef
5835 }), [position.refs, setReference, setFloating, setPositionReference]);
5836 const elements = React25.useMemo(() => ({
5837 ...position.elements,
5838 domReference: domReferenceElement
5839 }), [position.elements, domReferenceElement]);
5840 const context = React25.useMemo(() => ({
5841 ...position,
5842 dataRef: store2.context.dataRef,
5843 open,
5844 onOpenChange: store2.setOpen,
5845 events: store2.context.events,
5846 floatingId,
5847 refs,
5848 elements,
5849 nodeId,
5850 rootStore: store2
5851 }), [position, refs, elements, nodeId, store2, open, floatingId]);
5852 useIsoLayoutEffect(() => {
5853 if (domReferenceElement) {
5854 domReferenceRef.current = domReferenceElement;
5855 }
5856 }, [domReferenceElement]);
5857 useIsoLayoutEffect(() => {
5858 store2.context.dataRef.current.floatingContext = context;
5859 const node = tree?.nodesRef.current.find((n) => n.id === nodeId);
5860 if (node) {
5861 node.context = context;
5862 }
5863 });
5864 return React25.useMemo(() => ({
5865 ...position,
5866 context,
5867 refs,
5868 elements,
5869 rootStore: store2
5870 }), [position, refs, elements, context, store2]);
5871 }
5872
5873 // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs
5874 var React26 = __toESM(require_react(), 1);
5875 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit;
5876 function useFocus(context, props = {}) {
5877 const {
5878 enabled = true,
5879 delay
5880 } = props;
5881 const store2 = "rootStore" in context ? context.rootStore : context;
5882 const {
5883 events,
5884 dataRef
5885 } = store2.context;
5886 const blockFocusRef = React26.useRef(false);
5887 const blockedReferenceRef = React26.useRef(null);
5888 const keyboardModalityRef = React26.useRef(true);
5889 const timeout = useTimeout();
5890 React26.useEffect(() => {
5891 const domReference = store2.select("domReferenceElement");
5892 if (!enabled) {
5893 return void 0;
5894 }
5895 const win = getWindow(domReference);
5896 function onBlur() {
5897 const currentDomReference = store2.select("domReferenceElement");
5898 if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) {
5899 blockFocusRef.current = true;
5900 }
5901 }
5902 function onKeyDown() {
5903 keyboardModalityRef.current = true;
5904 }
5905 function onPointerDown() {
5906 keyboardModalityRef.current = false;
5907 }
5908 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true));
5909 }, [store2, enabled]);
5910 React26.useEffect(() => {
5911 if (!enabled) {
5912 return void 0;
5913 }
5914 function onOpenChangeLocal(details) {
5915 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) {
5916 const referenceElement = store2.select("domReferenceElement");
5917 if (isElement(referenceElement)) {
5918 blockedReferenceRef.current = referenceElement;
5919 blockFocusRef.current = true;
5920 }
5921 }
5922 }
5923 events.on("openchange", onOpenChangeLocal);
5924 return () => {
5925 events.off("openchange", onOpenChangeLocal);
5926 };
5927 }, [events, enabled, store2]);
5928 const reference = React26.useMemo(() => {
5929 function resetBlockedFocus() {
5930 blockFocusRef.current = false;
5931 blockedReferenceRef.current = null;
5932 }
5933 return {
5934 onMouseLeave() {
5935 resetBlockedFocus();
5936 },
5937 onFocus(event) {
5938 const focusTarget = event.currentTarget;
5939 if (blockFocusRef.current) {
5940 if (blockedReferenceRef.current === focusTarget) {
5941 return;
5942 }
5943 resetBlockedFocus();
5944 }
5945 const target = getTarget(event.nativeEvent);
5946 if (isElement(target)) {
5947 if (isMacSafari && !event.relatedTarget) {
5948 if (!keyboardModalityRef.current && !isTypeableElement(target)) {
5949 return;
5950 }
5951 } else if (!matchesFocusVisible(target)) {
5952 return;
5953 }
5954 }
5955 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements);
5956 const {
5957 nativeEvent,
5958 currentTarget
5959 } = event;
5960 const delayValue = typeof delay === "function" ? delay() : delay;
5961 if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) {
5962 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
5963 return;
5964 }
5965 timeout.start(delayValue, () => {
5966 if (blockFocusRef.current) {
5967 return;
5968 }
5969 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
5970 });
5971 },
5972 onBlur(event) {
5973 resetBlockedFocus();
5974 const relatedTarget = event.relatedTarget;
5975 const nativeEvent = event.nativeEvent;
5976 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
5977 timeout.start(0, () => {
5978 const domReference = store2.select("domReferenceElement");
5979 const activeEl = activeElement(ownerDocument(domReference));
5980 if (!relatedTarget && activeEl === domReference) {
5981 return;
5982 }
5983 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) {
5984 return;
5985 }
5986 const nextFocusedElement = relatedTarget ?? activeEl;
5987 if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) {
5988 return;
5989 }
5990 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent));
5991 });
5992 }
5993 };
5994 }, [dataRef, delay, store2, timeout]);
5995 return React26.useMemo(() => enabled ? {
5996 reference,
5997 trigger: reference
5998 } : {}, [enabled, reference]);
5999 }
6000
6001 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
6002 var React27 = __toESM(require_react(), 1);
6003
6004 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs
6005 var HoverInteraction = class _HoverInteraction {
6006 constructor() {
6007 this.pointerType = void 0;
6008 this.interactedInside = false;
6009 this.handler = void 0;
6010 this.blockMouseMove = true;
6011 this.performedPointerEventsMutation = false;
6012 this.pointerEventsScopeElement = null;
6013 this.pointerEventsReferenceElement = null;
6014 this.pointerEventsFloatingElement = null;
6015 this.restTimeoutPending = false;
6016 this.openChangeTimeout = new Timeout();
6017 this.restTimeout = new Timeout();
6018 this.handleCloseOptions = void 0;
6019 }
6020 static create() {
6021 return new _HoverInteraction();
6022 }
6023 dispose = () => {
6024 this.openChangeTimeout.clear();
6025 this.restTimeout.clear();
6026 };
6027 disposeEffect = () => {
6028 return this.dispose;
6029 };
6030 };
6031 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap();
6032 function clearSafePolygonPointerEventsMutation(instance) {
6033 if (!instance.performedPointerEventsMutation) {
6034 return;
6035 }
6036 const scopeElement = instance.pointerEventsScopeElement;
6037 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {
6038 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events");
6039 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events");
6040 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events");
6041 pointerEventsMutationOwnerByScopeElement.delete(scopeElement);
6042 }
6043 instance.performedPointerEventsMutation = false;
6044 instance.pointerEventsScopeElement = null;
6045 instance.pointerEventsReferenceElement = null;
6046 instance.pointerEventsFloatingElement = null;
6047 }
6048 function applySafePolygonPointerEventsMutation(instance, options) {
6049 const {
6050 scopeElement,
6051 referenceElement,
6052 floatingElement
6053 } = options;
6054 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);
6055 if (existingOwner && existingOwner !== instance) {
6056 clearSafePolygonPointerEventsMutation(existingOwner);
6057 }
6058 clearSafePolygonPointerEventsMutation(instance);
6059 instance.performedPointerEventsMutation = true;
6060 instance.pointerEventsScopeElement = scopeElement;
6061 instance.pointerEventsReferenceElement = referenceElement;
6062 instance.pointerEventsFloatingElement = floatingElement;
6063 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);
6064 scopeElement.style.pointerEvents = "none";
6065 referenceElement.style.pointerEvents = "auto";
6066 floatingElement.style.pointerEvents = "auto";
6067 }
6068 function useHoverInteractionSharedState(store2) {
6069 const data = store2.context.dataRef.current;
6070 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current;
6071 if (!data.hoverInteractionState) {
6072 data.hoverInteractionState = instance;
6073 }
6074 useOnMount(data.hoverInteractionState.disposeEffect);
6075 return data.hoverInteractionState;
6076 }
6077
6078 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
6079 function useHoverFloatingInteraction(context, parameters = {}) {
6080 const {
6081 enabled = true,
6082 closeDelay: closeDelayProp = 0,
6083 nodeId: nodeIdProp
6084 } = parameters;
6085 const store2 = "rootStore" in context ? context.rootStore : context;
6086 const open = store2.useState("open");
6087 const floatingElement = store2.useState("floatingElement");
6088 const domReferenceElement = store2.useState("domReferenceElement");
6089 const {
6090 dataRef
6091 } = store2.context;
6092 const tree = useFloatingTree();
6093 const parentId = useFloatingParentNodeId();
6094 const instance = useHoverInteractionSharedState(store2);
6095 const childClosedTimeout = useTimeout();
6096 const isClickLikeOpenEvent2 = useStableCallback(() => {
6097 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
6098 });
6099 const isHoverOpen = useStableCallback(() => {
6100 return isHoverOpenEvent(dataRef.current.openEvent?.type);
6101 });
6102 const clearPointerEvents = useStableCallback(() => {
6103 clearSafePolygonPointerEventsMutation(instance);
6104 });
6105 useIsoLayoutEffect(() => {
6106 if (!open) {
6107 instance.pointerType = void 0;
6108 instance.restTimeoutPending = false;
6109 instance.interactedInside = false;
6110 clearPointerEvents();
6111 }
6112 }, [open, instance, clearPointerEvents]);
6113 React27.useEffect(() => {
6114 return clearPointerEvents;
6115 }, [clearPointerEvents]);
6116 useIsoLayoutEffect(() => {
6117 if (!enabled) {
6118 return void 0;
6119 }
6120 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {
6121 const ref = domReferenceElement;
6122 const floatingEl = floatingElement;
6123 const doc = ownerDocument(floatingElement);
6124 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating;
6125 if (parentFloating) {
6126 parentFloating.style.pointerEvents = "";
6127 }
6128 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;
6129 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;
6130 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body;
6131 applySafePolygonPointerEventsMutation(instance, {
6132 scopeElement,
6133 referenceElement: ref,
6134 floatingElement: floatingEl
6135 });
6136 return () => {
6137 clearPointerEvents();
6138 };
6139 }
6140 return void 0;
6141 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);
6142 React27.useEffect(() => {
6143 if (!enabled) {
6144 return void 0;
6145 }
6146 function hasParentChildren() {
6147 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0);
6148 }
6149 function closeWithDelay(event) {
6150 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType);
6151 const close = () => {
6152 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
6153 tree?.events.emit("floating.closed", event);
6154 };
6155 if (closeDelay) {
6156 instance.openChangeTimeout.start(closeDelay, close);
6157 } else {
6158 instance.openChangeTimeout.clear();
6159 close();
6160 }
6161 }
6162 function handleInteractInside(event) {
6163 const target = getTarget(event);
6164 if (!isInteractiveElement(target)) {
6165 instance.interactedInside = false;
6166 return;
6167 }
6168 instance.interactedInside = target?.closest("[aria-haspopup]") != null;
6169 }
6170 function onFloatingMouseEnter() {
6171 instance.openChangeTimeout.clear();
6172 childClosedTimeout.clear();
6173 tree?.events.off("floating.closed", onNodeClosed);
6174 clearPointerEvents();
6175 }
6176 function onFloatingMouseLeave(event) {
6177 if (hasParentChildren() && tree) {
6178 tree.events.on("floating.closed", onNodeClosed);
6179 return;
6180 }
6181 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) {
6182 return;
6183 }
6184 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;
6185 const relatedTarget = event.relatedTarget;
6186 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget));
6187 if (isMovingIntoDescendantFloating) {
6188 return;
6189 }
6190 if (instance.handler) {
6191 instance.handler(event);
6192 return;
6193 }
6194 clearPointerEvents();
6195 if (isHoverOpen() && !isClickLikeOpenEvent2()) {
6196 closeWithDelay(event);
6197 }
6198 }
6199 function onNodeClosed(event) {
6200 if (!tree || !parentId || hasParentChildren()) {
6201 return;
6202 }
6203 childClosedTimeout.start(0, () => {
6204 tree.events.off("floating.closed", onNodeClosed);
6205 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
6206 tree.events.emit("floating.closed", event);
6207 });
6208 }
6209 const floating = floatingElement;
6210 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => {
6211 tree?.events.off("floating.closed", onNodeClosed);
6212 });
6213 }, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]);
6214 }
6215
6216 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs
6217 var React28 = __toESM(require_react(), 1);
6218 var ReactDOM5 = __toESM(require_react_dom(), 1);
6219 var EMPTY_REF = {
6220 current: null
6221 };
6222 function useHoverReferenceInteraction(context, props = {}) {
6223 const {
6224 enabled = true,
6225 delay = 0,
6226 handleClose = null,
6227 mouseOnly = false,
6228 restMs = 0,
6229 move = true,
6230 triggerElementRef = EMPTY_REF,
6231 externalTree,
6232 isActiveTrigger = true,
6233 getHandleCloseContext,
6234 isClosing,
6235 shouldOpen: shouldOpenProp
6236 } = props;
6237 const store2 = "rootStore" in context ? context.rootStore : context;
6238 const {
6239 dataRef,
6240 events
6241 } = store2.context;
6242 const tree = useFloatingTree(externalTree);
6243 const instance = useHoverInteractionSharedState(store2);
6244 const isHoverCloseActiveRef = React28.useRef(false);
6245 const handleCloseRef = useValueAsRef(handleClose);
6246 const delayRef = useValueAsRef(delay);
6247 const restMsRef = useValueAsRef(restMs);
6248 const enabledRef = useValueAsRef(enabled);
6249 const shouldOpenRef = useValueAsRef(shouldOpenProp);
6250 const isClosingRef = useValueAsRef(isClosing);
6251 const isClickLikeOpenEvent2 = useStableCallback(() => {
6252 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
6253 });
6254 const checkShouldOpen = useStableCallback(() => {
6255 return shouldOpenRef.current?.() !== false;
6256 });
6257 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {
6258 const allTriggers = store2.context.triggerElements;
6259 if (allTriggers.hasElement(currentTarget)) {
6260 return !currentDomReference || !contains(currentDomReference, currentTarget);
6261 }
6262 if (!isElement(target)) {
6263 return false;
6264 }
6265 const targetElement = target;
6266 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));
6267 });
6268 const cleanupMouseMoveHandler = useStableCallback(() => {
6269 if (!instance.handler) {
6270 return;
6271 }
6272 const doc = ownerDocument(store2.select("domReferenceElement"));
6273 doc.removeEventListener("mousemove", instance.handler);
6274 instance.handler = void 0;
6275 });
6276 const clearPointerEvents = useStableCallback(() => {
6277 clearSafePolygonPointerEventsMutation(instance);
6278 });
6279 if (isActiveTrigger) {
6280 instance.handleCloseOptions = handleCloseRef.current?.__options;
6281 }
6282 React28.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);
6283 React28.useEffect(() => {
6284 if (!enabled) {
6285 return void 0;
6286 }
6287 function onOpenChangeLocal(details) {
6288 if (!details.open) {
6289 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover;
6290 cleanupMouseMoveHandler();
6291 instance.openChangeTimeout.clear();
6292 instance.restTimeout.clear();
6293 instance.blockMouseMove = true;
6294 instance.restTimeoutPending = false;
6295 } else {
6296 isHoverCloseActiveRef.current = false;
6297 }
6298 }
6299 events.on("openchange", onOpenChangeLocal);
6300 return () => {
6301 events.off("openchange", onOpenChangeLocal);
6302 };
6303 }, [enabled, events, instance, cleanupMouseMoveHandler]);
6304 React28.useEffect(() => {
6305 if (!enabled) {
6306 return void 0;
6307 }
6308 function closeWithDelay(event, runElseBranch = true) {
6309 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType);
6310 if (closeDelay) {
6311 instance.openChangeTimeout.start(closeDelay, () => {
6312 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
6313 tree?.events.emit("floating.closed", event);
6314 });
6315 } else if (runElseBranch) {
6316 instance.openChangeTimeout.clear();
6317 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
6318 tree?.events.emit("floating.closed", event);
6319 }
6320 }
6321 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null);
6322 if (!isElement(trigger)) {
6323 return void 0;
6324 }
6325 function onMouseEnter(event) {
6326 instance.openChangeTimeout.clear();
6327 instance.blockMouseMove = false;
6328 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
6329 return;
6330 }
6331 const restMsValue = getRestMs(restMsRef.current);
6332 const openDelay = getDelay(delayRef.current, "open", instance.pointerType);
6333 const eventTarget = getTarget(event);
6334 const currentTarget = event.currentTarget ?? null;
6335 const currentDomReference = store2.select("domReferenceElement");
6336 let triggerNode = currentTarget;
6337 if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) {
6338 for (const triggerElement of store2.context.triggerElements.elements()) {
6339 if (contains(triggerElement, eventTarget)) {
6340 triggerNode = triggerElement;
6341 break;
6342 }
6343 }
6344 }
6345 if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {
6346 triggerNode = currentDomReference;
6347 }
6348 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);
6349 const isOpen = store2.select("open");
6350 const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending";
6351 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;
6352 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;
6353 const isRestOnlyDelay = restMsValue > 0 && !openDelay;
6354 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;
6355 const shouldOpen = !isOpen || isOverInactive;
6356 if (shouldOpenImmediately) {
6357 if (checkShouldOpen()) {
6358 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
6359 }
6360 return;
6361 }
6362 if (isRestOnlyDelay) {
6363 return;
6364 }
6365 if (openDelay) {
6366 instance.openChangeTimeout.start(openDelay, () => {
6367 if (shouldOpen && checkShouldOpen()) {
6368 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
6369 }
6370 });
6371 } else if (shouldOpen) {
6372 if (checkShouldOpen()) {
6373 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
6374 }
6375 }
6376 }
6377 function onMouseLeave(event) {
6378 if (isClickLikeOpenEvent2()) {
6379 clearPointerEvents();
6380 return;
6381 }
6382 cleanupMouseMoveHandler();
6383 const domReferenceElement = store2.select("domReferenceElement");
6384 const doc = ownerDocument(domReferenceElement);
6385 instance.restTimeout.clear();
6386 instance.restTimeoutPending = false;
6387 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();
6388 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) {
6389 return;
6390 }
6391 if (handleCloseRef.current && handleCloseContextBase) {
6392 if (!store2.select("open")) {
6393 instance.openChangeTimeout.clear();
6394 }
6395 const currentTrigger = triggerElementRef.current;
6396 instance.handler = handleCloseRef.current({
6397 ...handleCloseContextBase,
6398 tree,
6399 x: event.clientX,
6400 y: event.clientY,
6401 onClose() {
6402 clearPointerEvents();
6403 cleanupMouseMoveHandler();
6404 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) {
6405 closeWithDelay(event, true);
6406 }
6407 }
6408 });
6409 doc.addEventListener("mousemove", instance.handler);
6410 instance.handler(event);
6411 return;
6412 }
6413 const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true;
6414 if (shouldClose) {
6415 closeWithDelay(event);
6416 }
6417 }
6418 if (move) {
6419 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, {
6420 once: true
6421 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave));
6422 }
6423 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave));
6424 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen]);
6425 return React28.useMemo(() => {
6426 if (!enabled) {
6427 return void 0;
6428 }
6429 function setPointerRef(event) {
6430 instance.pointerType = event.pointerType;
6431 }
6432 return {
6433 onPointerDown: setPointerRef,
6434 onPointerEnter: setPointerRef,
6435 onMouseMove(event) {
6436 const {
6437 nativeEvent
6438 } = event;
6439 const trigger = event.currentTarget;
6440 const currentDomReference = store2.select("domReferenceElement");
6441 const currentOpen = store2.select("open");
6442 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
6443 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
6444 return;
6445 }
6446 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
6447 const floatingElement = store2.select("floatingElement");
6448 if (floatingElement) {
6449 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
6450 applySafePolygonPointerEventsMutation(instance, {
6451 scopeElement,
6452 referenceElement: trigger,
6453 floatingElement
6454 });
6455 }
6456 }
6457 const restMsValue = getRestMs(restMsRef.current);
6458 if (currentOpen && !isOverInactive || restMsValue === 0) {
6459 return;
6460 }
6461 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {
6462 return;
6463 }
6464 instance.restTimeout.clear();
6465 function handleMouseMove() {
6466 instance.restTimeoutPending = false;
6467 if (isClickLikeOpenEvent2()) {
6468 return;
6469 }
6470 const latestOpen = store2.select("open");
6471 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) {
6472 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger));
6473 }
6474 }
6475 if (instance.pointerType === "touch") {
6476 ReactDOM5.flushSync(() => {
6477 handleMouseMove();
6478 });
6479 } else if (isOverInactive && currentOpen) {
6480 handleMouseMove();
6481 } else {
6482 instance.restTimeoutPending = true;
6483 instance.restTimeout.start(restMsValue, handleMouseMove);
6484 }
6485 }
6486 };
6487 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]);
6488 }
6489
6490 // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs
6491 var CURSOR_SPEED_THRESHOLD = 0.1;
6492 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;
6493 var POLYGON_BUFFER = 0.5;
6494 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {
6495 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;
6496 }
6497 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {
6498 let isInsideValue = false;
6499 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {
6500 isInsideValue = !isInsideValue;
6501 }
6502 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {
6503 isInsideValue = !isInsideValue;
6504 }
6505 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {
6506 isInsideValue = !isInsideValue;
6507 }
6508 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {
6509 isInsideValue = !isInsideValue;
6510 }
6511 return isInsideValue;
6512 }
6513 function isInsideRect(pointX, pointY, rect) {
6514 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;
6515 }
6516 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {
6517 const minX = Math.min(x1, x2);
6518 const maxX = Math.max(x1, x2);
6519 const minY = Math.min(y1, y2);
6520 const maxY = Math.max(y1, y2);
6521 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;
6522 }
6523 function safePolygon(options = {}) {
6524 const {
6525 blockPointerEvents = false
6526 } = options;
6527 const timeout = new Timeout();
6528 const fn = ({
6529 x,
6530 y,
6531 placement,
6532 elements,
6533 onClose,
6534 nodeId,
6535 tree
6536 }) => {
6537 const side = placement?.split("-")[0];
6538 let hasLanded = false;
6539 let lastX = null;
6540 let lastY = null;
6541 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
6542 function isCursorMovingSlowly(nextX, nextY) {
6543 const currentTime = performance.now();
6544 const elapsedTime = currentTime - lastCursorTime;
6545 if (lastX === null || lastY === null || elapsedTime === 0) {
6546 lastX = nextX;
6547 lastY = nextY;
6548 lastCursorTime = currentTime;
6549 return false;
6550 }
6551 const deltaX = nextX - lastX;
6552 const deltaY = nextY - lastY;
6553 const distanceSquared = deltaX * deltaX + deltaY * deltaY;
6554 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;
6555 lastX = nextX;
6556 lastY = nextY;
6557 lastCursorTime = currentTime;
6558 return distanceSquared < thresholdSquared;
6559 }
6560 function close() {
6561 timeout.clear();
6562 onClose();
6563 }
6564 return function onMouseMove(event) {
6565 timeout.clear();
6566 const domReference = elements.domReference;
6567 const floating = elements.floating;
6568 if (!domReference || !floating || side == null || x == null || y == null) {
6569 return void 0;
6570 }
6571 const {
6572 clientX,
6573 clientY
6574 } = event;
6575 const target = getTarget(event);
6576 const isLeave = event.type === "mouseleave";
6577 const isOverFloatingEl = contains(floating, target);
6578 const isOverReferenceEl = contains(domReference, target);
6579 if (isOverFloatingEl) {
6580 hasLanded = true;
6581 if (!isLeave) {
6582 return void 0;
6583 }
6584 }
6585 if (isOverReferenceEl) {
6586 hasLanded = false;
6587 if (!isLeave) {
6588 hasLanded = true;
6589 return void 0;
6590 }
6591 }
6592 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {
6593 return void 0;
6594 }
6595 function hasOpenChildNode() {
6596 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);
6597 }
6598 function closeIfNoOpenChild() {
6599 if (!hasOpenChildNode()) {
6600 close();
6601 }
6602 }
6603 if (hasOpenChildNode()) {
6604 return void 0;
6605 }
6606 const refRect = domReference.getBoundingClientRect();
6607 const rect = floating.getBoundingClientRect();
6608 const cursorLeaveFromRight = x > rect.right - rect.width / 2;
6609 const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;
6610 const isFloatingWider = rect.width > refRect.width;
6611 const isFloatingTaller = rect.height > refRect.height;
6612 const left = (isFloatingWider ? refRect : rect).left;
6613 const right = (isFloatingWider ? refRect : rect).right;
6614 const top = (isFloatingTaller ? refRect : rect).top;
6615 const bottom = (isFloatingTaller ? refRect : rect).bottom;
6616 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) {
6617 closeIfNoOpenChild();
6618 return void 0;
6619 }
6620 let isInsideTroughRect = false;
6621 switch (side) {
6622 case "top":
6623 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);
6624 break;
6625 case "bottom":
6626 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);
6627 break;
6628 case "left":
6629 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);
6630 break;
6631 case "right":
6632 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);
6633 break;
6634 default:
6635 }
6636 if (isInsideTroughRect) {
6637 return void 0;
6638 }
6639 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {
6640 closeIfNoOpenChild();
6641 return void 0;
6642 }
6643 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {
6644 closeIfNoOpenChild();
6645 return void 0;
6646 }
6647 let isInsidePolygon = false;
6648 switch (side) {
6649 case "top": {
6650 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
6651 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
6652 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
6653 const cursorPointY = y + POLYGON_BUFFER + 1;
6654 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;
6655 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;
6656 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
6657 break;
6658 }
6659 case "bottom": {
6660 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
6661 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
6662 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
6663 const cursorPointY = y - POLYGON_BUFFER;
6664 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;
6665 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;
6666 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
6667 break;
6668 }
6669 case "left": {
6670 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
6671 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
6672 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
6673 const cursorPointX = x + POLYGON_BUFFER + 1;
6674 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;
6675 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;
6676 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);
6677 break;
6678 }
6679 case "right": {
6680 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
6681 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
6682 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
6683 const cursorPointX = x - POLYGON_BUFFER;
6684 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;
6685 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;
6686 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);
6687 break;
6688 }
6689 default:
6690 }
6691 if (!isInsidePolygon) {
6692 closeIfNoOpenChild();
6693 } else if (!hasLanded) {
6694 timeout.start(40, closeIfNoOpenChild);
6695 }
6696 return void 0;
6697 };
6698 };
6699 fn.__options = {
6700 ...options,
6701 blockPointerEvents
6702 };
6703 return fn;
6704 }
6705
6706 // node_modules/@base-ui/react/utils/popupStateMapping.mjs
6707 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) {
6708 CommonPopupDataAttributes2["open"] = "data-open";
6709 CommonPopupDataAttributes2["closed"] = "data-closed";
6710 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle";
6711 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle";
6712 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden";
6713 CommonPopupDataAttributes2["side"] = "data-side";
6714 CommonPopupDataAttributes2["align"] = "data-align";
6715 return CommonPopupDataAttributes2;
6716 })({});
6717 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) {
6718 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open";
6719 CommonTriggerDataAttributes2["pressed"] = "data-pressed";
6720 return CommonTriggerDataAttributes2;
6721 })({});
6722 var TRIGGER_HOOK = {
6723 [CommonTriggerDataAttributes.popupOpen]: ""
6724 };
6725 var PRESSABLE_TRIGGER_HOOK = {
6726 [CommonTriggerDataAttributes.popupOpen]: "",
6727 [CommonTriggerDataAttributes.pressed]: ""
6728 };
6729 var POPUP_OPEN_HOOK = {
6730 [CommonPopupDataAttributes.open]: ""
6731 };
6732 var POPUP_CLOSED_HOOK = {
6733 [CommonPopupDataAttributes.closed]: ""
6734 };
6735 var ANCHOR_HIDDEN_HOOK = {
6736 [CommonPopupDataAttributes.anchorHidden]: ""
6737 };
6738 var triggerOpenStateMapping = {
6739 open(value) {
6740 if (value) {
6741 return TRIGGER_HOOK;
6742 }
6743 return null;
6744 }
6745 };
6746 var popupStateMapping = {
6747 open(value) {
6748 if (value) {
6749 return POPUP_OPEN_HOOK;
6750 }
6751 return POPUP_CLOSED_HOOK;
6752 },
6753 anchorHidden(value) {
6754 if (value) {
6755 return ANCHOR_HIDDEN_HOOK;
6756 }
6757 return null;
6758 }
6759 };
6760
6761 // node_modules/@base-ui/utils/inertValue.mjs
6762 function inertValue(value) {
6763 if (isReactVersionAtLeast(19)) {
6764 return value;
6765 }
6766 return value ? "true" : void 0;
6767 }
6768
6769 // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs
6770 var React29 = __toESM(require_react(), 1);
6771
6772 // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs
6773 var baseArrow = (options) => ({
6774 name: "arrow",
6775 options,
6776 async fn(state) {
6777 const {
6778 x,
6779 y,
6780 placement,
6781 rects,
6782 platform: platform3,
6783 elements,
6784 middlewareData
6785 } = state;
6786 const {
6787 element,
6788 padding = 0,
6789 offsetParent = "real"
6790 } = evaluate(options, state) || {};
6791 if (element == null) {
6792 return {};
6793 }
6794 const paddingObject = getPaddingObject(padding);
6795 const coords = {
6796 x,
6797 y
6798 };
6799 const axis = getAlignmentAxis(placement);
6800 const length = getAxisLength(axis);
6801 const arrowDimensions = await platform3.getDimensions(element);
6802 const isYAxis = axis === "y";
6803 const minProp = isYAxis ? "top" : "left";
6804 const maxProp = isYAxis ? "bottom" : "right";
6805 const clientProp = isYAxis ? "clientHeight" : "clientWidth";
6806 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
6807 const startDiff = coords[axis] - rects.reference[axis];
6808 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating;
6809 let clientSize = elements.floating[clientProp] || rects.floating[length];
6810 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) {
6811 clientSize = elements.floating[clientProp] || rects.floating[length];
6812 }
6813 const centerToReference = endDiff / 2 - startDiff / 2;
6814 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
6815 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);
6816 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);
6817 const min2 = minPadding;
6818 const max2 = clientSize - arrowDimensions[length] - maxPadding;
6819 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
6820 const offset4 = clamp(min2, center, max2);
6821 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
6822 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0;
6823 return {
6824 [axis]: coords[axis] + alignmentOffset,
6825 data: {
6826 [axis]: offset4,
6827 centerOffset: center - offset4 - alignmentOffset,
6828 ...shouldAddOffset && {
6829 alignmentOffset
6830 }
6831 },
6832 reset: shouldAddOffset
6833 };
6834 }
6835 });
6836 var arrow4 = (options, deps) => ({
6837 ...baseArrow(options),
6838 options: [options, deps]
6839 });
6840
6841 // node_modules/@base-ui/react/utils/hideMiddleware.mjs
6842 var nativeHideFn = hide3().fn;
6843 var hide4 = {
6844 name: "hide",
6845 async fn(state) {
6846 const {
6847 width,
6848 height,
6849 x,
6850 y
6851 } = state.rects.reference;
6852 const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0;
6853 const nativeHideResult = await nativeHideFn(state);
6854 return {
6855 data: {
6856 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden
6857 }
6858 };
6859 }
6860 };
6861
6862 // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs
6863 var DEFAULT_SIDES = {
6864 sideX: "left",
6865 sideY: "top"
6866 };
6867 var adaptiveOrigin = {
6868 name: "adaptiveOrigin",
6869 async fn(state) {
6870 const {
6871 x: rawX,
6872 y: rawY,
6873 rects: {
6874 floating: floatRect
6875 },
6876 elements: {
6877 floating
6878 },
6879 platform: platform3,
6880 strategy,
6881 placement
6882 } = state;
6883 const win = getWindow(floating);
6884 const styles = win.getComputedStyle(floating);
6885 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== "";
6886 if (!hasTransition) {
6887 return {
6888 x: rawX,
6889 y: rawY,
6890 data: DEFAULT_SIDES
6891 };
6892 }
6893 const offsetParent = await platform3.getOffsetParent?.(floating);
6894 let offsetDimensions = {
6895 width: 0,
6896 height: 0
6897 };
6898 if (strategy === "fixed" && win?.visualViewport) {
6899 offsetDimensions = {
6900 width: win.visualViewport.width,
6901 height: win.visualViewport.height
6902 };
6903 } else if (offsetParent === win) {
6904 const doc = ownerDocument(floating);
6905 offsetDimensions = {
6906 width: doc.documentElement.clientWidth,
6907 height: doc.documentElement.clientHeight
6908 };
6909 } else if (await platform3.isElement?.(offsetParent)) {
6910 offsetDimensions = await platform3.getDimensions(offsetParent);
6911 }
6912 const currentSide = getSide(placement);
6913 let x = rawX;
6914 let y = rawY;
6915 if (currentSide === "left") {
6916 x = offsetDimensions.width - (rawX + floatRect.width);
6917 }
6918 if (currentSide === "top") {
6919 y = offsetDimensions.height - (rawY + floatRect.height);
6920 }
6921 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX;
6922 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY;
6923 return {
6924 x,
6925 y,
6926 data: {
6927 sideX,
6928 sideY
6929 }
6930 };
6931 }
6932 };
6933
6934 // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs
6935 function getLogicalSide(sideParam, renderedSide, isRtl) {
6936 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end";
6937 const logicalRight = isRtl ? "inline-start" : "inline-end";
6938 const logicalLeft = isRtl ? "inline-end" : "inline-start";
6939 return {
6940 top: "top",
6941 right: isLogicalSideParam ? logicalRight : "right",
6942 bottom: "bottom",
6943 left: isLogicalSideParam ? logicalLeft : "left"
6944 }[renderedSide];
6945 }
6946 function getOffsetData(state, sideParam, isRtl) {
6947 const {
6948 rects,
6949 placement
6950 } = state;
6951 const data = {
6952 side: getLogicalSide(sideParam, getSide(placement), isRtl),
6953 align: getAlignment(placement) || "center",
6954 anchor: {
6955 width: rects.reference.width,
6956 height: rects.reference.height
6957 },
6958 positioner: {
6959 width: rects.floating.width,
6960 height: rects.floating.height
6961 }
6962 };
6963 return data;
6964 }
6965 function useAnchorPositioning(params) {
6966 const {
6967 // Public parameters
6968 anchor,
6969 positionMethod = "absolute",
6970 side: sideParam = "bottom",
6971 sideOffset = 0,
6972 align = "center",
6973 alignOffset = 0,
6974 collisionBoundary,
6975 collisionPadding: collisionPaddingParam = 5,
6976 sticky = false,
6977 arrowPadding = 5,
6978 disableAnchorTracking = false,
6979 inline: inlineMiddleware,
6980 // Private parameters
6981 keepMounted = false,
6982 floatingRootContext,
6983 mounted,
6984 collisionAvoidance,
6985 shiftCrossAxis = false,
6986 nodeId,
6987 adaptiveOrigin: adaptiveOrigin2,
6988 lazyFlip = false,
6989 externalTree
6990 } = params;
6991 const [mountSide, setMountSide] = React29.useState(null);
6992 if (!mounted && mountSide !== null) {
6993 setMountSide(null);
6994 }
6995 const collisionAvoidanceSide = collisionAvoidance.side || "flip";
6996 const collisionAvoidanceAlign = collisionAvoidance.align || "flip";
6997 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end";
6998 const anchorFn = typeof anchor === "function" ? anchor : void 0;
6999 const anchorFnCallback = useStableCallback(anchorFn);
7000 const anchorDep = anchorFn ? anchorFnCallback : anchor;
7001 const anchorValueRef = useValueAsRef(anchor);
7002 const mountedRef = useValueAsRef(mounted);
7003 const direction = useDirection();
7004 const isRtl = direction === "rtl";
7005 const side = mountSide || {
7006 top: "top",
7007 right: "right",
7008 bottom: "bottom",
7009 left: "left",
7010 "inline-end": isRtl ? "left" : "right",
7011 "inline-start": isRtl ? "right" : "left"
7012 }[sideParam];
7013 const placement = align === "center" ? side : `${side}-${align}`;
7014 let collisionPadding = collisionPaddingParam;
7015 const bias = 1;
7016 const biasTop = sideParam === "bottom" ? bias : 0;
7017 const biasBottom = sideParam === "top" ? bias : 0;
7018 const biasLeft = sideParam === "right" ? bias : 0;
7019 const biasRight = sideParam === "left" ? bias : 0;
7020 if (typeof collisionPadding === "number") {
7021 collisionPadding = {
7022 top: collisionPadding + biasTop,
7023 right: collisionPadding + biasRight,
7024 bottom: collisionPadding + biasBottom,
7025 left: collisionPadding + biasLeft
7026 };
7027 } else if (collisionPadding) {
7028 collisionPadding = {
7029 top: (collisionPadding.top || 0) + biasTop,
7030 right: (collisionPadding.right || 0) + biasRight,
7031 bottom: (collisionPadding.bottom || 0) + biasBottom,
7032 left: (collisionPadding.left || 0) + biasLeft
7033 };
7034 }
7035 const commonCollisionProps = {
7036 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary,
7037 padding: collisionPadding
7038 };
7039 const arrowRef = React29.useRef(null);
7040 const sideOffsetRef = useValueAsRef(sideOffset);
7041 const alignOffsetRef = useValueAsRef(alignOffset);
7042 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0;
7043 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0;
7044 const middleware = [];
7045 if (inlineMiddleware) {
7046 middleware.push(inlineMiddleware);
7047 }
7048 middleware.push(offset3((state) => {
7049 const data = getOffsetData(state, sideParam, isRtl);
7050 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current;
7051 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current;
7052 return {
7053 mainAxis: sideAxis,
7054 crossAxis: alignAxis,
7055 alignmentAxis: alignAxis
7056 };
7057 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));
7058 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift";
7059 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift");
7060 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({
7061 ...commonCollisionProps,
7062 // Ensure the popup flips if it's been limited by its --available-height and it resizes.
7063 // Since the size() padding is smaller than the flip() padding, flip() will take precedence.
7064 padding: {
7065 top: collisionPadding.top + bias,
7066 right: collisionPadding.right + bias,
7067 bottom: collisionPadding.bottom + bias,
7068 left: collisionPadding.left + bias
7069 },
7070 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip",
7071 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false,
7072 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
7073 });
7074 const shiftMiddleware = shiftDisabled ? null : shift3((data) => {
7075 const html = ownerDocument(data.elements.floating).documentElement;
7076 return {
7077 ...commonCollisionProps,
7078 // Use the Layout Viewport to avoid shifting around when pinch-zooming
7079 // for context menus.
7080 rootBoundary: shiftCrossAxis ? {
7081 x: 0,
7082 y: 0,
7083 width: html.clientWidth,
7084 height: html.clientHeight
7085 } : void 0,
7086 mainAxis: collisionAvoidanceAlign !== "none",
7087 crossAxis: crossAxisShiftEnabled,
7088 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => {
7089 if (!arrowRef.current) {
7090 return {};
7091 }
7092 const {
7093 width,
7094 height
7095 } = arrowRef.current.getBoundingClientRect();
7096 const sideAxis = getSideAxis(getSide(limitData.placement));
7097 const arrowSize = sideAxis === "y" ? width : height;
7098 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
7099 return {
7100 offset: arrowSize / 2 + offsetAmount / 2
7101 };
7102 })
7103 };
7104 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]);
7105 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") {
7106 middleware.push(shiftMiddleware, flipMiddleware);
7107 } else {
7108 middleware.push(flipMiddleware, shiftMiddleware);
7109 }
7110 middleware.push(size3({
7111 ...commonCollisionProps,
7112 apply({
7113 elements: {
7114 floating
7115 },
7116 availableWidth,
7117 availableHeight,
7118 rects
7119 }) {
7120 if (!mountedRef.current) {
7121 return;
7122 }
7123 const floatingStyle = floating.style;
7124 floatingStyle.setProperty("--available-width", `${availableWidth}px`);
7125 floatingStyle.setProperty("--available-height", `${availableHeight}px`);
7126 const dpr = getWindow(floating).devicePixelRatio || 1;
7127 const {
7128 x: x2,
7129 y: y2,
7130 width,
7131 height
7132 } = rects.reference;
7133 const anchorWidth = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr;
7134 const anchorHeight = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr;
7135 floatingStyle.setProperty("--anchor-width", `${anchorWidth}px`);
7136 floatingStyle.setProperty("--anchor-height", `${anchorHeight}px`);
7137 }
7138 }), arrow4((state) => ({
7139 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,
7140 // we'll create a fake element.
7141 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"),
7142 padding: arrowPadding,
7143 offsetParent: "floating"
7144 }), [arrowPadding]), {
7145 name: "transformOrigin",
7146 fn(state) {
7147 const {
7148 elements: elements2,
7149 middlewareData: middlewareData2,
7150 placement: renderedPlacement2,
7151 rects,
7152 y: y2
7153 } = state;
7154 const currentRenderedSide = getSide(renderedPlacement2);
7155 const currentRenderedAxis = getSideAxis(currentRenderedSide);
7156 const arrowEl = arrowRef.current;
7157 const arrowX = middlewareData2.arrow?.x || 0;
7158 const arrowY = middlewareData2.arrow?.y || 0;
7159 const arrowWidth = arrowEl?.clientWidth || 0;
7160 const arrowHeight = arrowEl?.clientHeight || 0;
7161 const transformX = arrowX + arrowWidth / 2;
7162 const transformY = arrowY + arrowHeight / 2;
7163 const shiftY = Math.abs(middlewareData2.shift?.y || 0);
7164 const halfAnchorHeight = rects.reference.height / 2;
7165 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
7166 const isOverlappingAnchor = shiftY > sideOffsetValue;
7167 const adjacentTransformOrigin = {
7168 top: `${transformX}px calc(100% + ${sideOffsetValue}px)`,
7169 bottom: `${transformX}px ${-sideOffsetValue}px`,
7170 left: `calc(100% + ${sideOffsetValue}px) ${transformY}px`,
7171 right: `${-sideOffsetValue}px ${transformY}px`
7172 }[currentRenderedSide];
7173 const overlapTransformOrigin = `${transformX}px ${rects.reference.y + halfAnchorHeight - y2}px`;
7174 elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin);
7175 return {};
7176 }
7177 }, hide4, adaptiveOrigin2);
7178 useIsoLayoutEffect(() => {
7179 if (!mounted && floatingRootContext) {
7180 floatingRootContext.update({
7181 referenceElement: null,
7182 floatingElement: null,
7183 domReferenceElement: null,
7184 positionReference: null
7185 });
7186 }
7187 }, [mounted, floatingRootContext]);
7188 const autoUpdateOptions = React29.useMemo(() => ({
7189 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined",
7190 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined"
7191 }), [disableAnchorTracking]);
7192 const {
7193 refs,
7194 elements,
7195 x,
7196 y,
7197 middlewareData,
7198 update: update2,
7199 placement: renderedPlacement,
7200 context,
7201 isPositioned,
7202 floatingStyles: originalFloatingStyles
7203 } = useFloating2({
7204 rootContext: floatingRootContext,
7205 open: keepMounted ? mounted : void 0,
7206 placement,
7207 middleware,
7208 strategy: positionMethod,
7209 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions),
7210 nodeId,
7211 externalTree
7212 });
7213 const {
7214 sideX,
7215 sideY
7216 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;
7217 const resolvedPosition = isPositioned ? positionMethod : "fixed";
7218 const floatingStyles = React29.useMemo(() => {
7219 const base = adaptiveOrigin2 ? {
7220 position: resolvedPosition,
7221 [sideX]: x,
7222 [sideY]: y
7223 } : {
7224 position: resolvedPosition,
7225 ...originalFloatingStyles
7226 };
7227 if (!isPositioned) {
7228 base.opacity = 0;
7229 }
7230 return base;
7231 }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]);
7232 const registeredPositionReferenceRef = React29.useRef(null);
7233 useIsoLayoutEffect(() => {
7234 if (!mounted) {
7235 return;
7236 }
7237 const anchorValue = anchorValueRef.current;
7238 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue;
7239 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;
7240 const finalAnchor = unwrappedElement || null;
7241 if (finalAnchor !== registeredPositionReferenceRef.current) {
7242 refs.setPositionReference(finalAnchor);
7243 registeredPositionReferenceRef.current = finalAnchor;
7244 }
7245 }, [mounted, refs, anchorDep, anchorValueRef]);
7246 React29.useEffect(() => {
7247 if (!mounted) {
7248 return;
7249 }
7250 const anchorValue = anchorValueRef.current;
7251 if (typeof anchorValue === "function") {
7252 return;
7253 }
7254 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {
7255 refs.setPositionReference(anchorValue.current);
7256 registeredPositionReferenceRef.current = anchorValue.current;
7257 }
7258 }, [mounted, refs, anchorDep, anchorValueRef]);
7259 React29.useEffect(() => {
7260 if (keepMounted && mounted && elements.reference && elements.floating) {
7261 return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions);
7262 }
7263 return void 0;
7264 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]);
7265 const renderedSide = getSide(renderedPlacement);
7266 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);
7267 const renderedAlign = getAlignment(renderedPlacement) || "center";
7268 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);
7269 useIsoLayoutEffect(() => {
7270 if (lazyFlip && mounted && isPositioned) {
7271 setMountSide(renderedSide);
7272 }
7273 }, [lazyFlip, mounted, isPositioned, renderedSide]);
7274 const arrowStyles = React29.useMemo(() => ({
7275 position: "absolute",
7276 top: middlewareData.arrow?.y,
7277 left: middlewareData.arrow?.x
7278 }), [middlewareData.arrow]);
7279 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;
7280 return React29.useMemo(() => ({
7281 positionerStyles: floatingStyles,
7282 arrowStyles,
7283 arrowRef,
7284 arrowUncentered,
7285 side: logicalRenderedSide,
7286 align: renderedAlign,
7287 physicalSide: renderedSide,
7288 anchorHidden,
7289 refs,
7290 context,
7291 isPositioned,
7292 update: update2
7293 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]);
7294 }
7295 function isRef(param) {
7296 return param != null && "current" in param;
7297 }
7298
7299 // node_modules/@base-ui/react/utils/getDisabledMountTransitionStyles.mjs
7300 function getDisabledMountTransitionStyles(transitionStatus) {
7301 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;
7302 }
7303
7304 // node_modules/@base-ui/react/utils/usePositioner.mjs
7305 function usePositioner(componentProps, state, {
7306 styles,
7307 transitionStatus,
7308 props,
7309 refs,
7310 hidden,
7311 inert = false
7312 }) {
7313 const style = {
7314 ...styles
7315 };
7316 if (inert) {
7317 style.pointerEvents = "none";
7318 }
7319 return useRenderElement("div", componentProps, {
7320 state,
7321 ref: refs,
7322 props: [{
7323 role: "presentation",
7324 hidden,
7325 style
7326 }, getDisabledMountTransitionStyles(transitionStatus), props],
7327 stateAttributesMapping: popupStateMapping
7328 });
7329 }
7330
7331 // node_modules/@base-ui/react/utils/usePopupViewport.mjs
7332 var React32 = __toESM(require_react(), 1);
7333 var ReactDOM6 = __toESM(require_react_dom(), 1);
7334
7335 // node_modules/@base-ui/utils/usePreviousValue.mjs
7336 var React30 = __toESM(require_react(), 1);
7337 function usePreviousValue(value) {
7338 const [state, setState] = React30.useState({
7339 current: value,
7340 previous: null
7341 });
7342 if (value !== state.current) {
7343 setState({
7344 current: value,
7345 previous: state.current
7346 });
7347 }
7348 return state.previous;
7349 }
7350
7351 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
7352 var React31 = __toESM(require_react(), 1);
7353
7354 // node_modules/@base-ui/react/utils/getCssDimensions.mjs
7355 function getCssDimensions2(element) {
7356 const css = getComputedStyle2(element);
7357 let width = parseFloat(css.width) || 0;
7358 let height = parseFloat(css.height) || 0;
7359 const hasOffset = isHTMLElement(element);
7360 const offsetWidth = hasOffset ? element.offsetWidth : width;
7361 const offsetHeight = hasOffset ? element.offsetHeight : height;
7362 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
7363 if (shouldFallback) {
7364 width = offsetWidth;
7365 height = offsetHeight;
7366 }
7367 return {
7368 width,
7369 height
7370 };
7371 }
7372
7373 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
7374 function usePopupAutoResize(parameters) {
7375 const {
7376 popupElement,
7377 positionerElement,
7378 content,
7379 mounted,
7380 onMeasureLayout: onMeasureLayoutParam,
7381 onMeasureLayoutComplete: onMeasureLayoutCompleteParam,
7382 side,
7383 direction
7384 } = parameters;
7385 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false);
7386 const animationFrame = useAnimationFrame();
7387 const committedDimensionsRef = React31.useRef(null);
7388 const isInitialRenderRef = React31.useRef(true);
7389 const restoreAnchoringStylesRef = React31.useRef(NOOP);
7390 const onMeasureLayout = useStableCallback(onMeasureLayoutParam);
7391 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam);
7392 const anchoringStyles = React31.useMemo(() => {
7393 let isOriginSide = side === "top";
7394 let isPhysicalLeft = side === "left";
7395 if (direction === "rtl") {
7396 isOriginSide = isOriginSide || side === "inline-end";
7397 isPhysicalLeft = isPhysicalLeft || side === "inline-end";
7398 } else {
7399 isOriginSide = isOriginSide || side === "inline-start";
7400 isPhysicalLeft = isPhysicalLeft || side === "inline-start";
7401 }
7402 return isOriginSide ? {
7403 position: "absolute",
7404 [side === "top" ? "bottom" : "top"]: "0",
7405 [isPhysicalLeft ? "right" : "left"]: "0"
7406 } : EMPTY_OBJECT;
7407 }, [side, direction]);
7408 useIsoLayoutEffect(() => {
7409 if (!mounted) {
7410 restoreAnchoringStylesRef.current = NOOP;
7411 isInitialRenderRef.current = true;
7412 committedDimensionsRef.current = null;
7413 return void 0;
7414 }
7415 if (!popupElement || !positionerElement) {
7416 return void 0;
7417 }
7418 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles);
7419 setPopupCssSize(popupElement, "auto");
7420 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static");
7421 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none");
7422 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1");
7423 const restorePositionerAvailableSize = applyElementStyles(positionerElement, {
7424 "--available-width": "max-content",
7425 "--available-height": "max-content"
7426 });
7427 function restoreMeasurementOverrides() {
7428 restorePopupPosition();
7429 restorePopupTransform();
7430 restorePositionerAvailableSize();
7431 }
7432 function restoreMeasurementOverridesIncludingScale() {
7433 restoreMeasurementOverrides();
7434 restorePopupScale();
7435 }
7436 onMeasureLayout?.();
7437 if (isInitialRenderRef.current || committedDimensionsRef.current === null) {
7438 setPositionerCssSize(positionerElement, "max-content");
7439 const dimensions = getCssDimensions2(popupElement);
7440 committedDimensionsRef.current = dimensions;
7441 setPositionerCssSize(positionerElement, dimensions);
7442 restoreMeasurementOverridesIncludingScale();
7443 onMeasureLayoutComplete?.(null, dimensions);
7444 isInitialRenderRef.current = false;
7445 return () => {
7446 restoreAnchoringStylesRef.current();
7447 restoreAnchoringStylesRef.current = NOOP;
7448 };
7449 }
7450 setPositionerCssSize(positionerElement, "max-content");
7451 const previousDimensions = committedDimensionsRef.current;
7452 const newDimensions = getCssDimensions2(popupElement);
7453 committedDimensionsRef.current = newDimensions;
7454 setPopupCssSize(popupElement, previousDimensions);
7455 restoreMeasurementOverridesIncludingScale();
7456 onMeasureLayoutComplete?.(previousDimensions, newDimensions);
7457 setPositionerCssSize(positionerElement, newDimensions);
7458 const abortController = new AbortController();
7459 animationFrame.request(() => {
7460 setPopupCssSize(popupElement, newDimensions);
7461 runOnceAnimationsFinish(() => {
7462 popupElement.style.setProperty("--popup-width", "auto");
7463 popupElement.style.setProperty("--popup-height", "auto");
7464 }, abortController.signal);
7465 });
7466 return () => {
7467 abortController.abort();
7468 animationFrame.cancel();
7469 restoreAnchoringStylesRef.current();
7470 restoreAnchoringStylesRef.current = NOOP;
7471 };
7472 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]);
7473 }
7474 function overrideElementStyle(element, property, value) {
7475 const originalValue = element.style.getPropertyValue(property);
7476 element.style.setProperty(property, value);
7477 return () => {
7478 element.style.setProperty(property, originalValue);
7479 };
7480 }
7481 function applyElementStyles(element, styles) {
7482 const restorers = [];
7483 for (const [key, value] of Object.entries(styles)) {
7484 restorers.push(overrideElementStyle(element, key, value));
7485 }
7486 return restorers.length ? () => {
7487 restorers.forEach((restore) => restore());
7488 } : NOOP;
7489 }
7490 function setPopupCssSize(popupElement, size4) {
7491 const width = size4 === "auto" ? "auto" : `${size4.width}px`;
7492 const height = size4 === "auto" ? "auto" : `${size4.height}px`;
7493 popupElement.style.setProperty("--popup-width", width);
7494 popupElement.style.setProperty("--popup-height", height);
7495 }
7496 function setPositionerCssSize(positionerElement, size4) {
7497 const width = size4 === "max-content" ? "max-content" : `${size4.width}px`;
7498 const height = size4 === "max-content" ? "max-content" : `${size4.height}px`;
7499 positionerElement.style.setProperty("--positioner-width", width);
7500 positionerElement.style.setProperty("--positioner-height", height);
7501 }
7502
7503 // node_modules/@base-ui/react/utils/usePopupViewport.mjs
7504 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
7505 function usePopupViewport(parameters) {
7506 const {
7507 store: store2,
7508 side,
7509 cssVars,
7510 children
7511 } = parameters;
7512 const direction = useDirection();
7513 const activeTrigger = store2.useState("activeTriggerElement");
7514 const activeTriggerId = store2.useState("activeTriggerId");
7515 const open = store2.useState("open");
7516 const payload = store2.useState("payload");
7517 const mounted = store2.useState("mounted");
7518 const popupElement = store2.useState("popupElement");
7519 const positionerElement = store2.useState("positionerElement");
7520 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null);
7521 const currentContentKey = usePopupContentKey(activeTriggerId, payload);
7522 const capturedNodeRef = React32.useRef(null);
7523 const [previousContentNode, setPreviousContentNode] = React32.useState(null);
7524 const [newTriggerOffset, setNewTriggerOffset] = React32.useState(null);
7525 const currentContainerRef = React32.useRef(null);
7526 const previousContainerRef = React32.useRef(null);
7527 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false);
7528 const cleanupFrame = useAnimationFrame();
7529 const [previousContentDimensions, setPreviousContentDimensions] = React32.useState(null);
7530 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React32.useState(false);
7531 useIsoLayoutEffect(() => {
7532 store2.set("hasViewport", true);
7533 return () => {
7534 store2.set("hasViewport", false);
7535 };
7536 }, [store2]);
7537 const handleMeasureLayout = useStableCallback(() => {
7538 currentContainerRef.current?.style.setProperty("animation", "none");
7539 currentContainerRef.current?.style.setProperty("transition", "none");
7540 previousContainerRef.current?.style.setProperty("display", "none");
7541 });
7542 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => {
7543 currentContainerRef.current?.style.removeProperty("animation");
7544 currentContainerRef.current?.style.removeProperty("transition");
7545 previousContainerRef.current?.style.removeProperty("display");
7546 if (previousDimensions) {
7547 setPreviousContentDimensions(previousDimensions);
7548 }
7549 });
7550 const lastHandledTriggerRef = React32.useRef(null);
7551 useIsoLayoutEffect(() => {
7552 if (!open || !mounted) {
7553 lastHandledTriggerRef.current = null;
7554 }
7555 }, [open, mounted]);
7556 useIsoLayoutEffect(() => {
7557 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
7558 setPreviousContentNode(capturedNodeRef.current);
7559 setShowStartingStyleAttribute(true);
7560 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
7561 setNewTriggerOffset(offset4);
7562 cleanupFrame.request(() => {
7563 ReactDOM6.flushSync(() => {
7564 setShowStartingStyleAttribute(false);
7565 });
7566 onAnimationsFinished(() => {
7567 setPreviousContentNode(null);
7568 setPreviousContentDimensions(null);
7569 capturedNodeRef.current = null;
7570 });
7571 });
7572 lastHandledTriggerRef.current = activeTrigger;
7573 }
7574 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]);
7575 useIsoLayoutEffect(() => {
7576 const source = currentContainerRef.current;
7577 if (!source) {
7578 return;
7579 }
7580 const wrapper = ownerDocument(source).createElement("div");
7581 for (const child of Array.from(source.childNodes)) {
7582 wrapper.appendChild(child.cloneNode(true));
7583 }
7584 capturedNodeRef.current = wrapper;
7585 });
7586 const isTransitioning = previousContentNode != null;
7587 let childrenToRender;
7588 if (!isTransitioning) {
7589 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", {
7590 "data-current": true,
7591 ref: currentContainerRef,
7592 children
7593 }, currentContentKey);
7594 } else {
7595 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(React32.Fragment, {
7596 children: [/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", {
7597 "data-previous": true,
7598 inert: inertValue(true),
7599 ref: previousContainerRef,
7600 style: {
7601 ...previousContentDimensions ? {
7602 [cssVars.popupWidth]: `${previousContentDimensions.width}px`,
7603 [cssVars.popupHeight]: `${previousContentDimensions.height}px`
7604 } : null,
7605 position: "absolute"
7606 },
7607 "data-ending-style": showStartingStyleAttribute ? void 0 : ""
7608 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", {
7609 "data-current": true,
7610 ref: currentContainerRef,
7611 "data-starting-style": showStartingStyleAttribute ? "" : void 0,
7612 children
7613 }, currentContentKey)]
7614 });
7615 }
7616 useIsoLayoutEffect(() => {
7617 const container = previousContainerRef.current;
7618 if (!container || !previousContentNode) {
7619 return;
7620 }
7621 container.replaceChildren(...Array.from(previousContentNode.childNodes));
7622 }, [previousContentNode]);
7623 usePopupAutoResize({
7624 popupElement,
7625 positionerElement,
7626 mounted,
7627 content: payload,
7628 onMeasureLayout: handleMeasureLayout,
7629 onMeasureLayoutComplete: handleMeasureLayoutComplete,
7630 side,
7631 direction
7632 });
7633 const state = {
7634 activationDirection: getActivationDirection(newTriggerOffset),
7635 transitioning: isTransitioning
7636 };
7637 return {
7638 children: childrenToRender,
7639 state
7640 };
7641 }
7642 function getActivationDirection(offset4) {
7643 if (!offset4) {
7644 return void 0;
7645 }
7646 return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`;
7647 }
7648 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
7649 if (value > tolerance) {
7650 return positiveLabel;
7651 }
7652 if (value < -tolerance) {
7653 return negativeLabel;
7654 }
7655 return "";
7656 }
7657 function calculateRelativePosition(from, to) {
7658 const fromRect = from.getBoundingClientRect();
7659 const toRect = to.getBoundingClientRect();
7660 const fromCenter = {
7661 x: fromRect.left + fromRect.width / 2,
7662 y: fromRect.top + fromRect.height / 2
7663 };
7664 const toCenter = {
7665 x: toRect.left + toRect.width / 2,
7666 y: toRect.top + toRect.height / 2
7667 };
7668 return {
7669 horizontal: toCenter.x - fromCenter.x,
7670 vertical: toCenter.y - fromCenter.y
7671 };
7672 }
7673 function usePopupContentKey(activeTriggerId, payload) {
7674 const [contentKey, setContentKey] = React32.useState(0);
7675 const previousActiveTriggerIdRef = React32.useRef(activeTriggerId);
7676 const previousPayloadRef = React32.useRef(payload);
7677 const pendingPayloadUpdateRef = React32.useRef(false);
7678 useIsoLayoutEffect(() => {
7679 const previousActiveTriggerId = previousActiveTriggerIdRef.current;
7680 const previousPayload = previousPayloadRef.current;
7681 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId;
7682 const payloadChanged = payload !== previousPayload;
7683 if (triggerIdChanged) {
7684 setContentKey((value) => value + 1);
7685 pendingPayloadUpdateRef.current = !payloadChanged;
7686 } else if (pendingPayloadUpdateRef.current && payloadChanged) {
7687 setContentKey((value) => value + 1);
7688 pendingPayloadUpdateRef.current = false;
7689 }
7690 previousActiveTriggerIdRef.current = activeTriggerId;
7691 previousPayloadRef.current = payload;
7692 }, [activeTriggerId, payload]);
7693 return `${activeTriggerId ?? "current"}-${contentKey}`;
7694 }
7695
7696 // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs
7697 var React33 = __toESM(require_react(), 1);
7698 var ReactDOM7 = __toESM(require_react_dom(), 1);
7699 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
7700 var FloatingPortalLite = /* @__PURE__ */ React33.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) {
7701 const {
7702 children,
7703 container,
7704 className,
7705 render,
7706 style,
7707 ...elementProps
7708 } = componentProps;
7709 const {
7710 portalNode,
7711 portalSubtree
7712 } = useFloatingPortalNode({
7713 container,
7714 ref: forwardedRef,
7715 componentProps,
7716 elementProps
7717 });
7718 if (!portalSubtree && !portalNode) {
7719 return null;
7720 }
7721 return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React33.Fragment, {
7722 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)]
7723 });
7724 });
7725 if (true) FloatingPortalLite.displayName = "FloatingPortalLite";
7726
7727 // node_modules/@base-ui/react/tooltip/index.parts.mjs
7728 var index_parts_exports = {};
7729 __export(index_parts_exports, {
7730 Arrow: () => TooltipArrow,
7731 Handle: () => TooltipHandle,
7732 Popup: () => TooltipPopup,
7733 Portal: () => TooltipPortal,
7734 Positioner: () => TooltipPositioner,
7735 Provider: () => TooltipProvider,
7736 Root: () => TooltipRoot,
7737 Trigger: () => TooltipTrigger,
7738 Viewport: () => TooltipViewport,
7739 createHandle: () => createTooltipHandle
7740 });
7741
7742 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
7743 var React36 = __toESM(require_react(), 1);
7744
7745 // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs
7746 var React34 = __toESM(require_react(), 1);
7747 var TooltipRootContext = /* @__PURE__ */ React34.createContext(void 0);
7748 if (true) TooltipRootContext.displayName = "TooltipRootContext";
7749 function useTooltipRootContext(optional) {
7750 const context = React34.useContext(TooltipRootContext);
7751 if (context === void 0 && !optional) {
7752 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72));
7753 }
7754 return context;
7755 }
7756
7757 // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs
7758 var React35 = __toESM(require_react(), 1);
7759 var selectors2 = {
7760 ...popupStoreSelectors,
7761 disabled: createSelector((state) => state.disabled),
7762 instantType: createSelector((state) => state.instantType),
7763 isInstantPhase: createSelector((state) => state.isInstantPhase),
7764 trackCursorAxis: createSelector((state) => state.trackCursorAxis),
7765 disableHoverablePopup: createSelector((state) => state.disableHoverablePopup),
7766 lastOpenChangeReason: createSelector((state) => state.openChangeReason),
7767 closeOnClick: createSelector((state) => state.closeOnClick),
7768 closeDelay: createSelector((state) => state.closeDelay),
7769 hasViewport: createSelector((state) => state.hasViewport)
7770 };
7771 var TooltipStore = class _TooltipStore extends ReactStore {
7772 constructor(initialState, floatingId, nested = false) {
7773 const triggerElements = new PopupTriggerMap();
7774 const state = {
7775 ...createInitialState(),
7776 ...initialState
7777 };
7778 state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
7779 super(state, {
7780 popupRef: /* @__PURE__ */ React35.createRef(),
7781 onOpenChange: void 0,
7782 onOpenChangeComplete: void 0,
7783 triggerElements
7784 }, selectors2);
7785 }
7786 setOpen = (nextOpen, eventDetails) => {
7787 applyPopupOpenChange(this, nextOpen, eventDetails, {
7788 extraState: {
7789 openChangeReason: eventDetails.reason
7790 }
7791 });
7792 };
7793 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change.
7794 cancelPendingOpen(event) {
7795 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event));
7796 }
7797 static useStore(externalStore, initialState) {
7798 const store2 = usePopupStore(externalStore, (floatingId, nested) => new _TooltipStore(initialState, floatingId, nested)).store;
7799 return store2;
7800 }
7801 };
7802 function createInitialState() {
7803 return {
7804 ...createInitialPopupStoreState(),
7805 disabled: false,
7806 instantType: void 0,
7807 isInstantPhase: false,
7808 trackCursorAxis: "none",
7809 disableHoverablePopup: false,
7810 openChangeReason: null,
7811 closeOnClick: true,
7812 closeDelay: 0,
7813 hasViewport: false
7814 };
7815 }
7816
7817 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
7818 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
7819 var TooltipRoot = fastComponent(function TooltipRoot2(props) {
7820 const {
7821 disabled: disabled2 = false,
7822 defaultOpen = false,
7823 open: openProp,
7824 disableHoverablePopup = false,
7825 trackCursorAxis = "none",
7826 actionsRef,
7827 onOpenChange,
7828 onOpenChangeComplete,
7829 handle,
7830 triggerId: triggerIdProp,
7831 defaultTriggerId: defaultTriggerIdProp = null,
7832 children
7833 } = props;
7834 const store2 = TooltipStore.useStore(handle?.store, {
7835 open: defaultOpen,
7836 openProp,
7837 activeTriggerId: defaultTriggerIdProp,
7838 triggerIdProp
7839 });
7840 useInitialOpenSync(store2, openProp, defaultOpen, defaultTriggerIdProp);
7841 store2.useControlledProp("openProp", openProp);
7842 store2.useControlledProp("triggerIdProp", triggerIdProp);
7843 store2.useContextCallback("onOpenChange", onOpenChange);
7844 store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
7845 const openState = store2.useState("open");
7846 const open = !disabled2 && openState;
7847 const activeTriggerId = store2.useState("activeTriggerId");
7848 const mounted = store2.useState("mounted");
7849 const payload = store2.useState("payload");
7850 store2.useSyncedValues({
7851 trackCursorAxis,
7852 disableHoverablePopup
7853 });
7854 store2.useSyncedValue("disabled", disabled2);
7855 useImplicitActiveTrigger(store2, {
7856 closeOnActiveTriggerUnmount: true
7857 });
7858 const {
7859 forceUnmount,
7860 transitionStatus
7861 } = useOpenStateTransitions(open, store2);
7862 const isInstantPhase = store2.useState("isInstantPhase");
7863 const instantType = store2.useState("instantType");
7864 const lastOpenChangeReason = store2.useState("lastOpenChangeReason");
7865 const previousInstantTypeRef = React36.useRef(null);
7866 useIsoLayoutEffect(() => {
7867 if (openState && disabled2) {
7868 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled));
7869 }
7870 }, [openState, disabled2, store2]);
7871 useIsoLayoutEffect(() => {
7872 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) {
7873 if (instantType !== "delay") {
7874 previousInstantTypeRef.current = instantType;
7875 }
7876 store2.set("instantType", "delay");
7877 } else if (previousInstantTypeRef.current !== null) {
7878 store2.set("instantType", previousInstantTypeRef.current);
7879 previousInstantTypeRef.current = null;
7880 }
7881 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]);
7882 useIsoLayoutEffect(() => {
7883 if (open) {
7884 if (activeTriggerId == null) {
7885 store2.set("payload", void 0);
7886 }
7887 }
7888 }, [store2, activeTriggerId, open]);
7889 const handleImperativeClose = React36.useCallback(() => {
7890 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction));
7891 }, [store2]);
7892 React36.useImperativeHandle(actionsRef, () => ({
7893 unmount: forceUnmount,
7894 close: handleImperativeClose
7895 }), [forceUnmount, handleImperativeClose]);
7896 const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none";
7897 return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(TooltipRootContext.Provider, {
7898 value: store2,
7899 children: [shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipInteractions, {
7900 store: store2,
7901 disabled: disabled2,
7902 trackCursorAxis
7903 }), typeof children === "function" ? children({
7904 payload
7905 }) : children]
7906 });
7907 });
7908 if (true) TooltipRoot.displayName = "TooltipRoot";
7909 function TooltipInteractions({
7910 store: store2,
7911 disabled: disabled2,
7912 trackCursorAxis
7913 }) {
7914 const floatingRootContext = store2.useState("floatingRootContext");
7915 const dismiss = useDismiss(floatingRootContext, {
7916 enabled: !disabled2,
7917 referencePress: () => store2.select("closeOnClick")
7918 });
7919 const clientPoint = useClientPoint(floatingRootContext, {
7920 enabled: !disabled2 && trackCursorAxis !== "none",
7921 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis
7922 });
7923 const activeTriggerProps = React36.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]);
7924 const inactiveTriggerProps = React36.useMemo(() => mergeProps(clientPoint.trigger, dismiss.trigger), [clientPoint.trigger, dismiss.trigger]);
7925 const popupProps = React36.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [clientPoint.floating, dismiss.floating]);
7926 usePopupInteractionProps(store2, {
7927 activeTriggerProps,
7928 inactiveTriggerProps,
7929 popupProps
7930 });
7931 return null;
7932 }
7933
7934 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
7935 var React38 = __toESM(require_react(), 1);
7936
7937 // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs
7938 var React37 = __toESM(require_react(), 1);
7939 var TooltipProviderContext = /* @__PURE__ */ React37.createContext(void 0);
7940 if (true) TooltipProviderContext.displayName = "TooltipProviderContext";
7941 function useTooltipProviderContext() {
7942 return React37.useContext(TooltipProviderContext);
7943 }
7944
7945 // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs
7946 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) {
7947 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen";
7948 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled";
7949 return TooltipTriggerDataAttributes2;
7950 })({});
7951
7952 // node_modules/@base-ui/react/tooltip/utils/constants.mjs
7953 var OPEN_DELAY = 600;
7954
7955 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
7956 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger";
7957 function getTargetElement(event) {
7958 if ("composedPath" in event) {
7959 const path = event.composedPath();
7960 for (let i = 0; i < path.length; i += 1) {
7961 const element = path[i];
7962 if (isElement(element)) {
7963 return element;
7964 }
7965 }
7966 }
7967 const target = event.target;
7968 if (isElement(target)) {
7969 return target;
7970 }
7971 return null;
7972 }
7973 function closestEnabledTooltipTrigger(element) {
7974 let current = element;
7975 while (current) {
7976 if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) {
7977 return current;
7978 }
7979 const parentElement = current.parentElement;
7980 if (parentElement) {
7981 current = parentElement;
7982 continue;
7983 }
7984 const root = current.getRootNode();
7985 current = "host" in root && isElement(root.host) ? root.host : null;
7986 }
7987 return null;
7988 }
7989 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) {
7990 const {
7991 render,
7992 className,
7993 style,
7994 handle,
7995 payload,
7996 disabled: disabledProp,
7997 delay,
7998 closeOnClick = true,
7999 closeDelay,
8000 id: idProp,
8001 ...elementProps
8002 } = componentProps;
8003 const rootContext = useTooltipRootContext(true);
8004 const store2 = handle?.store ?? rootContext;
8005 if (!store2) {
8006 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));
8007 }
8008 const thisTriggerId = useBaseUiId(idProp);
8009 const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId);
8010 const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId);
8011 const floatingRootContext = store2.useState("floatingRootContext");
8012 const triggerElementRef = React38.useRef(null);
8013 const delayWithDefault = delay ?? OPEN_DELAY;
8014 const closeDelayWithDefault = closeDelay ?? 0;
8015 const {
8016 registerTrigger,
8017 isMountedByThisTrigger
8018 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, {
8019 payload,
8020 closeOnClick,
8021 closeDelay: closeDelayWithDefault
8022 });
8023 const providerContext = useTooltipProviderContext();
8024 const {
8025 delayRef,
8026 isInstantPhase,
8027 hasProvider
8028 } = useDelayGroup(floatingRootContext, {
8029 open: isOpenedByThisTrigger
8030 });
8031 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext);
8032 store2.useSyncedValue("isInstantPhase", isInstantPhase);
8033 const rootDisabled = store2.useState("disabled");
8034 const disabled2 = disabledProp ?? rootDisabled;
8035 const disabledRef = useValueAsRef(disabled2);
8036 const trackCursorAxis = store2.useState("trackCursorAxis");
8037 const disableHoverablePopup = store2.useState("disableHoverablePopup");
8038 const isNestedTriggerHoveredRef = React38.useRef(false);
8039 const nestedTriggerOpenTimeout = useTimeout();
8040 const pointerTypeRef = React38.useRef(void 0);
8041 function getOpenDelay() {
8042 const providerDelay = providerContext?.delay;
8043 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0;
8044 let computedOpenDelay = delayWithDefault;
8045 if (hasProvider) {
8046 if (groupOpenValue !== 0) {
8047 computedOpenDelay = delay ?? providerDelay ?? delayWithDefault;
8048 } else {
8049 computedOpenDelay = 0;
8050 }
8051 }
8052 return computedOpenDelay;
8053 }
8054 function isEnabledNestedTriggerTarget(target) {
8055 const triggerEl = triggerElementRef.current;
8056 if (!triggerEl || !target) {
8057 return false;
8058 }
8059 const nearestTrigger = closestEnabledTooltipTrigger(target);
8060 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger);
8061 }
8062 function detectNestedTriggerHover(target) {
8063 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target);
8064 isNestedTriggerHoveredRef.current = nestedTriggerHovered;
8065 if (nestedTriggerHovered) {
8066 hoverInteraction.openChangeTimeout.clear();
8067 hoverInteraction.restTimeout.clear();
8068 hoverInteraction.restTimeoutPending = false;
8069 nestedTriggerOpenTimeout.clear();
8070 }
8071 return nestedTriggerHovered;
8072 }
8073 const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
8074 enabled: !disabled2,
8075 mouseOnly: true,
8076 move: false,
8077 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null,
8078 restMs: getOpenDelay,
8079 delay() {
8080 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0;
8081 let computedCloseDelay = closeDelayWithDefault;
8082 if (closeDelay == null && hasProvider) {
8083 computedCloseDelay = closeValue;
8084 }
8085 return {
8086 close: computedCloseDelay
8087 };
8088 },
8089 triggerElementRef,
8090 isActiveTrigger: isTriggerActive,
8091 isClosing: () => store2.select("transitionStatus") === "ending",
8092 shouldOpen() {
8093 return !isNestedTriggerHoveredRef.current;
8094 }
8095 });
8096 const focusProps = useFocus(floatingRootContext, {
8097 enabled: !disabled2
8098 }).reference;
8099 const handleNestedTriggerHover = (event) => {
8100 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current;
8101 const target = getTargetElement(event);
8102 const nestedTriggerHovered = detectNestedTriggerHover(target);
8103 const triggerEl = triggerElementRef.current;
8104 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target);
8105 if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) {
8106 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
8107 return;
8108 }
8109 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences.
8110 isMouseLikePointerType(pointerTypeRef.current)) {
8111 const open = () => {
8112 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) {
8113 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl));
8114 }
8115 };
8116 const openDelay = getOpenDelay();
8117 if (openDelay === 0) {
8118 nestedTriggerOpenTimeout.clear();
8119 open();
8120 } else {
8121 nestedTriggerOpenTimeout.start(openDelay, open);
8122 }
8123 }
8124 };
8125 const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger);
8126 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none";
8127 const state = {
8128 open: isOpenedByThisTrigger
8129 };
8130 const element = useRenderElement("button", componentProps, {
8131 state,
8132 ref: [forwardedRef, registerTrigger, triggerElementRef],
8133 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, {
8134 onMouseOver(event) {
8135 handleNestedTriggerHover(event.nativeEvent);
8136 },
8137 onFocus(event) {
8138 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) {
8139 event.preventBaseUIHandler();
8140 }
8141 },
8142 onMouseLeave() {
8143 isNestedTriggerHoveredRef.current = false;
8144 nestedTriggerOpenTimeout.clear();
8145 pointerTypeRef.current = void 0;
8146 },
8147 onPointerEnter(event) {
8148 pointerTypeRef.current = event.pointerType;
8149 },
8150 onPointerDown(event) {
8151 pointerTypeRef.current = event.pointerType;
8152 store2.set("closeOnClick", closeOnClick);
8153 if (closeOnClick && !store2.select("open")) {
8154 store2.cancelPendingOpen(event.nativeEvent);
8155 }
8156 },
8157 onClick(event) {
8158 if (closeOnClick && !store2.select("open")) {
8159 store2.cancelPendingOpen(event.nativeEvent);
8160 }
8161 },
8162 id: thisTriggerId,
8163 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0,
8164 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : ""
8165 }, elementProps],
8166 stateAttributesMapping: triggerOpenStateMapping
8167 });
8168 return element;
8169 });
8170 if (true) TooltipTrigger.displayName = "TooltipTrigger";
8171
8172 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
8173 var React40 = __toESM(require_react(), 1);
8174
8175 // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs
8176 var React39 = __toESM(require_react(), 1);
8177 var TooltipPortalContext = /* @__PURE__ */ React39.createContext(void 0);
8178 if (true) TooltipPortalContext.displayName = "TooltipPortalContext";
8179 function useTooltipPortalContext() {
8180 const value = React39.useContext(TooltipPortalContext);
8181 if (value === void 0) {
8182 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70));
8183 }
8184 return value;
8185 }
8186
8187 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
8188 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
8189 var TooltipPortal = /* @__PURE__ */ React40.forwardRef(function TooltipPortal2(props, forwardedRef) {
8190 const {
8191 keepMounted = false,
8192 ...portalProps
8193 } = props;
8194 const store2 = useTooltipRootContext();
8195 const mounted = store2.useState("mounted");
8196 const shouldRender = mounted || keepMounted;
8197 if (!shouldRender) {
8198 return null;
8199 }
8200 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipPortalContext.Provider, {
8201 value: keepMounted,
8202 children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FloatingPortalLite, {
8203 ref: forwardedRef,
8204 ...portalProps
8205 })
8206 });
8207 });
8208 if (true) TooltipPortal.displayName = "TooltipPortal";
8209
8210 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
8211 var React42 = __toESM(require_react(), 1);
8212
8213 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs
8214 var React41 = __toESM(require_react(), 1);
8215 var TooltipPositionerContext = /* @__PURE__ */ React41.createContext(void 0);
8216 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext";
8217 function useTooltipPositionerContext() {
8218 const context = React41.useContext(TooltipPositionerContext);
8219 if (context === void 0) {
8220 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71));
8221 }
8222 return context;
8223 }
8224
8225 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
8226 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
8227 var TooltipPositioner = /* @__PURE__ */ React42.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) {
8228 const {
8229 render,
8230 className,
8231 anchor,
8232 positionMethod = "absolute",
8233 side = "top",
8234 align = "center",
8235 sideOffset = 0,
8236 alignOffset = 0,
8237 collisionBoundary = "clipping-ancestors",
8238 collisionPadding = 5,
8239 arrowPadding = 5,
8240 sticky = false,
8241 disableAnchorTracking = false,
8242 collisionAvoidance = POPUP_COLLISION_AVOIDANCE,
8243 style,
8244 ...elementProps
8245 } = componentProps;
8246 const store2 = useTooltipRootContext();
8247 const keepMounted = useTooltipPortalContext();
8248 const open = store2.useState("open");
8249 const mounted = store2.useState("mounted");
8250 const trackCursorAxis = store2.useState("trackCursorAxis");
8251 const disableHoverablePopup = store2.useState("disableHoverablePopup");
8252 const floatingRootContext = store2.useState("floatingRootContext");
8253 const instantType = store2.useState("instantType");
8254 const transitionStatus = store2.useState("transitionStatus");
8255 const hasViewport = store2.useState("hasViewport");
8256 const positioning = useAnchorPositioning({
8257 anchor,
8258 positionMethod,
8259 floatingRootContext,
8260 mounted,
8261 side,
8262 sideOffset,
8263 align,
8264 alignOffset,
8265 collisionBoundary,
8266 collisionPadding,
8267 sticky,
8268 arrowPadding,
8269 disableAnchorTracking,
8270 keepMounted,
8271 collisionAvoidance,
8272 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0
8273 });
8274 const state = React42.useMemo(() => ({
8275 open,
8276 side: positioning.side,
8277 align: positioning.align,
8278 anchorHidden: positioning.anchorHidden,
8279 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType
8280 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]);
8281 const element = usePositioner(componentProps, state, {
8282 styles: positioning.positionerStyles,
8283 transitionStatus,
8284 props: elementProps,
8285 refs: [forwardedRef, store2.useStateSetter("positionerElement")],
8286 hidden: !mounted,
8287 inert: !open || trackCursorAxis === "both" || disableHoverablePopup
8288 });
8289 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPositionerContext.Provider, {
8290 value: positioning,
8291 children: element
8292 });
8293 });
8294 if (true) TooltipPositioner.displayName = "TooltipPositioner";
8295
8296 // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs
8297 var React43 = __toESM(require_react(), 1);
8298 var stateAttributesMapping = {
8299 ...popupStateMapping,
8300 ...transitionStatusMapping
8301 };
8302 var TooltipPopup = /* @__PURE__ */ React43.forwardRef(function TooltipPopup2(componentProps, forwardedRef) {
8303 const {
8304 render,
8305 className,
8306 style,
8307 ...elementProps
8308 } = componentProps;
8309 const store2 = useTooltipRootContext();
8310 const {
8311 side,
8312 align
8313 } = useTooltipPositionerContext();
8314 const open = store2.useState("open");
8315 const instantType = store2.useState("instantType");
8316 const transitionStatus = store2.useState("transitionStatus");
8317 const popupProps = store2.useState("popupProps");
8318 const floatingContext = store2.useState("floatingRootContext");
8319 const disabled2 = store2.useState("disabled");
8320 const closeDelay = store2.useState("closeDelay");
8321 useOpenChangeComplete({
8322 open,
8323 ref: store2.context.popupRef,
8324 onComplete() {
8325 if (open) {
8326 store2.context.onOpenChangeComplete?.(true);
8327 }
8328 }
8329 });
8330 useHoverFloatingInteraction(floatingContext, {
8331 enabled: !disabled2,
8332 closeDelay
8333 });
8334 const setPopupElement = store2.useStateSetter("popupElement");
8335 const state = {
8336 open,
8337 side,
8338 align,
8339 instant: instantType,
8340 transitionStatus
8341 };
8342 const element = useRenderElement("div", componentProps, {
8343 state,
8344 ref: [forwardedRef, store2.context.popupRef, setPopupElement],
8345 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps],
8346 stateAttributesMapping
8347 });
8348 return element;
8349 });
8350 if (true) TooltipPopup.displayName = "TooltipPopup";
8351
8352 // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs
8353 var React44 = __toESM(require_react(), 1);
8354 var TooltipArrow = /* @__PURE__ */ React44.forwardRef(function TooltipArrow2(componentProps, forwardedRef) {
8355 const {
8356 render,
8357 className,
8358 style,
8359 ...elementProps
8360 } = componentProps;
8361 const store2 = useTooltipRootContext();
8362 const {
8363 arrowRef,
8364 side,
8365 align,
8366 arrowUncentered,
8367 arrowStyles
8368 } = useTooltipPositionerContext();
8369 const open = store2.useState("open");
8370 const instantType = store2.useState("instantType");
8371 const state = {
8372 open,
8373 side,
8374 align,
8375 uncentered: arrowUncentered,
8376 instant: instantType
8377 };
8378 const element = useRenderElement("div", componentProps, {
8379 state,
8380 ref: [forwardedRef, arrowRef],
8381 props: [{
8382 style: arrowStyles,
8383 "aria-hidden": true
8384 }, elementProps],
8385 stateAttributesMapping: popupStateMapping
8386 });
8387 return element;
8388 });
8389 if (true) TooltipArrow.displayName = "TooltipArrow";
8390
8391 // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs
8392 var React45 = __toESM(require_react(), 1);
8393 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
8394 var TooltipProvider = function TooltipProvider2(props) {
8395 const {
8396 delay,
8397 closeDelay,
8398 timeout = 400
8399 } = props;
8400 const contextValue = React45.useMemo(() => ({
8401 delay,
8402 closeDelay
8403 }), [delay, closeDelay]);
8404 const delayValue = React45.useMemo(() => ({
8405 open: delay,
8406 close: closeDelay
8407 }), [delay, closeDelay]);
8408 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipProviderContext.Provider, {
8409 value: contextValue,
8410 children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FloatingDelayGroup, {
8411 delay: delayValue,
8412 timeoutMs: timeout,
8413 children: props.children
8414 })
8415 });
8416 };
8417 if (true) TooltipProvider.displayName = "TooltipProvider";
8418
8419 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs
8420 var React46 = __toESM(require_react(), 1);
8421
8422 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewportCssVars.mjs
8423 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) {
8424 TooltipViewportCssVars2["popupWidth"] = "--popup-width";
8425 TooltipViewportCssVars2["popupHeight"] = "--popup-height";
8426 return TooltipViewportCssVars2;
8427 })({});
8428
8429 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs
8430 var stateAttributesMapping2 = {
8431 activationDirection: (value) => value ? {
8432 "data-activation-direction": value
8433 } : null
8434 };
8435 var TooltipViewport = /* @__PURE__ */ React46.forwardRef(function TooltipViewport2(componentProps, forwardedRef) {
8436 const {
8437 render,
8438 className,
8439 style,
8440 children,
8441 ...elementProps
8442 } = componentProps;
8443 const store2 = useTooltipRootContext();
8444 const positioner = useTooltipPositionerContext();
8445 const instantType = store2.useState("instantType");
8446 const {
8447 children: childrenToRender,
8448 state: viewportState
8449 } = usePopupViewport({
8450 store: store2,
8451 side: positioner.side,
8452 cssVars: TooltipViewportCssVars,
8453 children
8454 });
8455 const state = {
8456 activationDirection: viewportState.activationDirection,
8457 transitioning: viewportState.transitioning,
8458 instant: instantType
8459 };
8460 return useRenderElement("div", componentProps, {
8461 state,
8462 ref: forwardedRef,
8463 props: [elementProps, {
8464 children: childrenToRender
8465 }],
8466 stateAttributesMapping: stateAttributesMapping2
8467 });
8468 });
8469 if (true) TooltipViewport.displayName = "TooltipViewport";
8470
8471 // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs
8472 var TooltipHandle = class {
8473 /**
8474 * Internal store holding the tooltip state.
8475 * @internal
8476 */
8477 constructor() {
8478 this.store = new TooltipStore();
8479 }
8480 /**
8481 * Opens the tooltip and associates it with the trigger with the given ID.
8482 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop.
8483 *
8484 * This method should only be called in an event handler or an effect (not during rendering).
8485 *
8486 * @param triggerId ID of the trigger to associate with the tooltip.
8487 */
8488 open(triggerId) {
8489 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0;
8490 if (triggerId && !triggerElement) {
8491 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "${triggerId}".` : formatErrorMessage_default(81, triggerId));
8492 }
8493 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement));
8494 }
8495 /**
8496 * Closes the tooltip.
8497 */
8498 close() {
8499 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0));
8500 }
8501 /**
8502 * Indicates whether the tooltip is currently open.
8503 */
8504 get isOpen() {
8505 return this.store.select("open");
8506 }
8507 };
8508 function createTooltipHandle() {
8509 return new TooltipHandle();
8510 }
8511
8512 // node_modules/@base-ui/react/use-render/useRender.mjs
8513 function useRender(params) {
8514 return useRenderElement(params.defaultTagName ?? "div", params, params);
8515 }
8516
8517 // packages/icons/build-module/library/chevron-down.mjs
8518 var import_primitives = __toESM(require_primitives(), 1);
8519 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
8520 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) });
8521
8522 // packages/icons/build-module/library/chevron-left.mjs
8523 var import_primitives2 = __toESM(require_primitives(), 1);
8524 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
8525 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives2.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) });
8526
8527 // packages/icons/build-module/library/chevron-right.mjs
8528 var import_primitives3 = __toESM(require_primitives(), 1);
8529 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
8530 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives3.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) });
8531
8532 // packages/icons/build-module/library/chevron-up.mjs
8533 var import_primitives4 = __toESM(require_primitives(), 1);
8534 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
8535 var chevron_up_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) });
8536
8537 // packages/icons/build-module/library/fullscreen.mjs
8538 var import_primitives5 = __toESM(require_primitives(), 1);
8539 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
8540 var fullscreen_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives5.Path, { d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" }) });
8541
8542 // packages/ui/build-module/utils/render-slot-with-children.mjs
8543 var import_element10 = __toESM(require_element(), 1);
8544 function renderSlotWithChildren(slot, defaultSlot, children) {
8545 return (0, import_element10.cloneElement)(slot ?? defaultSlot, { children });
8546 }
8547
8548 // packages/ui/build-module/utils/theme-provider.mjs
8549 var theme = __toESM(require_theme(), 1);
8550
8551 // packages/ui/build-module/lock-unlock.mjs
8552 var import_private_apis = __toESM(require_private_apis(), 1);
8553 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
8554 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
8555 "@wordpress/ui"
8556 );
8557
8558 // packages/ui/build-module/utils/theme-provider.mjs
8559 function getThemeProvider() {
8560 const themePackage = theme;
8561 if (themePackage.ThemeProvider) {
8562 return themePackage.ThemeProvider;
8563 }
8564 if (!themePackage.privateApis) {
8565 throw new Error(
8566 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`."
8567 );
8568 }
8569 return unlock(
8570 themePackage.privateApis
8571 ).ThemeProvider;
8572 }
8573 var ThemeProvider = getThemeProvider();
8574
8575 // packages/ui/build-module/stack/stack.mjs
8576 var import_element11 = __toESM(require_element(), 1);
8577 var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
8578 function getRuntime() {
8579 const globalScope = globalThis;
8580 if (globalScope.__wpStyleRuntime) {
8581 return globalScope.__wpStyleRuntime;
8582 }
8583 globalScope.__wpStyleRuntime = {
8584 documents: /* @__PURE__ */ new Map(),
8585 styles: /* @__PURE__ */ new Map(),
8586 injectedStyles: /* @__PURE__ */ new WeakMap()
8587 };
8588 if (typeof document !== "undefined") {
8589 registerDocument(document);
8590 }
8591 return globalScope.__wpStyleRuntime;
8592 }
8593 function documentContainsStyleHash(targetDocument, hash) {
8594 if (!targetDocument.head) {
8595 return false;
8596 }
8597 for (const style of targetDocument.head.querySelectorAll(
8598 `style[${STYLE_HASH_ATTRIBUTE}]`
8599 )) {
8600 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
8601 return true;
8602 }
8603 }
8604 return false;
8605 }
8606 function injectStyle(targetDocument, hash, css) {
8607 if (!targetDocument.head) {
8608 return;
8609 }
8610 const runtime = getRuntime();
8611 let injectedStyles = runtime.injectedStyles.get(targetDocument);
8612 if (!injectedStyles) {
8613 injectedStyles = /* @__PURE__ */ new Set();
8614 runtime.injectedStyles.set(targetDocument, injectedStyles);
8615 }
8616 if (injectedStyles.has(hash)) {
8617 return;
8618 }
8619 if (documentContainsStyleHash(targetDocument, hash)) {
8620 injectedStyles.add(hash);
8621 return;
8622 }
8623 const style = targetDocument.createElement("style");
8624 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
8625 style.appendChild(targetDocument.createTextNode(css));
8626 targetDocument.head.appendChild(style);
8627 injectedStyles.add(hash);
8628 }
8629 function registerDocument(targetDocument) {
8630 const runtime = getRuntime();
8631 runtime.documents.set(
8632 targetDocument,
8633 (runtime.documents.get(targetDocument) ?? 0) + 1
8634 );
8635 for (const [hash, css] of runtime.styles) {
8636 injectStyle(targetDocument, hash, css);
8637 }
8638 return () => {
8639 const count = runtime.documents.get(targetDocument);
8640 if (count === void 0) {
8641 return;
8642 }
8643 if (count <= 1) {
8644 runtime.documents.delete(targetDocument);
8645 return;
8646 }
8647 runtime.documents.set(targetDocument, count - 1);
8648 };
8649 }
8650 function registerStyle(hash, css) {
8651 const runtime = getRuntime();
8652 runtime.styles.set(hash, css);
8653 for (const targetDocument of runtime.documents.keys()) {
8654 injectStyle(targetDocument, hash, css);
8655 }
8656 }
8657 if (typeof process === "undefined" || true) {
8658 registerStyle("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}");
8659 }
8660 var style_default = { "stack": "_19ce0419607e1896__stack" };
8661 var gapTokens = {
8662 xs: "var(--wpds-dimension-gap-xs, 4px)",
8663 sm: "var(--wpds-dimension-gap-sm, 8px)",
8664 md: "var(--wpds-dimension-gap-md, 12px)",
8665 lg: "var(--wpds-dimension-gap-lg, 16px)",
8666 xl: "var(--wpds-dimension-gap-xl, 24px)",
8667 "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
8668 "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
8669 };
8670 var Stack = (0, import_element11.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {
8671 const style = {
8672 gap: gap && gapTokens[gap],
8673 alignItems: align,
8674 justifyContent: justify,
8675 flexDirection: direction,
8676 flexWrap: wrap
8677 };
8678 const element = useRender({
8679 render,
8680 ref,
8681 props: mergeProps(props, { style, className: style_default.stack })
8682 });
8683 return element;
8684 });
8685
8686 // packages/ui/build-module/tooltip/index.mjs
8687 var tooltip_exports = {};
8688 __export(tooltip_exports, {
8689 Popup: () => Popup,
8690 Portal: () => Portal,
8691 Positioner: () => Positioner,
8692 Provider: () => Provider,
8693 Root: () => Root,
8694 Trigger: () => Trigger
8695 });
8696
8697 // packages/ui/build-module/tooltip/popup.mjs
8698 var import_element14 = __toESM(require_element(), 1);
8699
8700 // packages/ui/build-module/tooltip/portal.mjs
8701 var import_element12 = __toESM(require_element(), 1);
8702
8703 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs
8704 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
8705 function getRuntime2() {
8706 const globalScope = globalThis;
8707 if (globalScope.__wpStyleRuntime) {
8708 return globalScope.__wpStyleRuntime;
8709 }
8710 globalScope.__wpStyleRuntime = {
8711 documents: /* @__PURE__ */ new Map(),
8712 styles: /* @__PURE__ */ new Map(),
8713 injectedStyles: /* @__PURE__ */ new WeakMap()
8714 };
8715 if (typeof document !== "undefined") {
8716 registerDocument2(document);
8717 }
8718 return globalScope.__wpStyleRuntime;
8719 }
8720 function documentContainsStyleHash2(targetDocument, hash) {
8721 if (!targetDocument.head) {
8722 return false;
8723 }
8724 for (const style of targetDocument.head.querySelectorAll(
8725 `style[${STYLE_HASH_ATTRIBUTE2}]`
8726 )) {
8727 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
8728 return true;
8729 }
8730 }
8731 return false;
8732 }
8733 function injectStyle2(targetDocument, hash, css) {
8734 if (!targetDocument.head) {
8735 return;
8736 }
8737 const runtime = getRuntime2();
8738 let injectedStyles = runtime.injectedStyles.get(targetDocument);
8739 if (!injectedStyles) {
8740 injectedStyles = /* @__PURE__ */ new Set();
8741 runtime.injectedStyles.set(targetDocument, injectedStyles);
8742 }
8743 if (injectedStyles.has(hash)) {
8744 return;
8745 }
8746 if (documentContainsStyleHash2(targetDocument, hash)) {
8747 injectedStyles.add(hash);
8748 return;
8749 }
8750 const style = targetDocument.createElement("style");
8751 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
8752 style.appendChild(targetDocument.createTextNode(css));
8753 targetDocument.head.appendChild(style);
8754 injectedStyles.add(hash);
8755 }
8756 function registerDocument2(targetDocument) {
8757 const runtime = getRuntime2();
8758 runtime.documents.set(
8759 targetDocument,
8760 (runtime.documents.get(targetDocument) ?? 0) + 1
8761 );
8762 for (const [hash, css] of runtime.styles) {
8763 injectStyle2(targetDocument, hash, css);
8764 }
8765 return () => {
8766 const count = runtime.documents.get(targetDocument);
8767 if (count === void 0) {
8768 return;
8769 }
8770 if (count <= 1) {
8771 runtime.documents.delete(targetDocument);
8772 return;
8773 }
8774 runtime.documents.set(targetDocument, count - 1);
8775 };
8776 }
8777 function registerStyle2(hash, css) {
8778 const runtime = getRuntime2();
8779 runtime.styles.set(hash, css);
8780 for (const targetDocument of runtime.documents.keys()) {
8781 injectStyle2(targetDocument, hash, css);
8782 }
8783 }
8784 if (typeof process === "undefined" || true) {
8785 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}}}");
8786 }
8787 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" };
8788 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot";
8789 function resolveOwnerDocument() {
8790 return typeof document === "undefined" ? null : document;
8791 }
8792 function isInWordPressEnvironment() {
8793 let topWp;
8794 try {
8795 topWp = window.top?.wp;
8796 } catch {
8797 }
8798 const wp = topWp ?? window.wp;
8799 return typeof wp?.components === "object" && wp.components !== null;
8800 }
8801 var cachedSlot = null;
8802 function ensureSlotIsAccessible(element) {
8803 element.setAttribute("aria-hidden", "false");
8804 return element;
8805 }
8806 function createSlot(ownerDocument2) {
8807 const element = ownerDocument2.createElement("div");
8808 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, "");
8809 if (wp_compat_overlay_slot_default.slot) {
8810 element.classList.add(wp_compat_overlay_slot_default.slot);
8811 }
8812 ownerDocument2.body.appendChild(element);
8813 return element;
8814 }
8815 function getWpCompatOverlaySlot() {
8816 if (typeof window === "undefined") {
8817 return void 0;
8818 }
8819 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) {
8820 return void 0;
8821 }
8822 const ownerDocument2 = resolveOwnerDocument();
8823 if (!ownerDocument2 || !ownerDocument2.body) {
8824 return void 0;
8825 }
8826 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) {
8827 return ensureSlotIsAccessible(cachedSlot);
8828 }
8829 const existing = ownerDocument2.querySelector(
8830 `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]`
8831 );
8832 if (existing instanceof HTMLDivElement) {
8833 cachedSlot = ensureSlotIsAccessible(existing);
8834 return cachedSlot;
8835 }
8836 if (cachedSlot?.isConnected) {
8837 cachedSlot.remove();
8838 }
8839 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2));
8840 return cachedSlot;
8841 }
8842
8843 // packages/ui/build-module/tooltip/portal.mjs
8844 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
8845 var Portal = (0, import_element12.forwardRef)(
8846 function TooltipPortal3({ container, ...restProps }, ref) {
8847 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
8848 index_parts_exports.Portal,
8849 {
8850 container: container ?? getWpCompatOverlaySlot(),
8851 ...restProps,
8852 ref
8853 }
8854 );
8855 }
8856 );
8857
8858 // packages/ui/build-module/tooltip/positioner.mjs
8859 var import_element13 = __toESM(require_element(), 1);
8860 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
8861 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
8862 function getRuntime3() {
8863 const globalScope = globalThis;
8864 if (globalScope.__wpStyleRuntime) {
8865 return globalScope.__wpStyleRuntime;
8866 }
8867 globalScope.__wpStyleRuntime = {
8868 documents: /* @__PURE__ */ new Map(),
8869 styles: /* @__PURE__ */ new Map(),
8870 injectedStyles: /* @__PURE__ */ new WeakMap()
8871 };
8872 if (typeof document !== "undefined") {
8873 registerDocument3(document);
8874 }
8875 return globalScope.__wpStyleRuntime;
8876 }
8877 function documentContainsStyleHash3(targetDocument, hash) {
8878 if (!targetDocument.head) {
8879 return false;
8880 }
8881 for (const style of targetDocument.head.querySelectorAll(
8882 `style[${STYLE_HASH_ATTRIBUTE3}]`
8883 )) {
8884 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
8885 return true;
8886 }
8887 }
8888 return false;
8889 }
8890 function injectStyle3(targetDocument, hash, css) {
8891 if (!targetDocument.head) {
8892 return;
8893 }
8894 const runtime = getRuntime3();
8895 let injectedStyles = runtime.injectedStyles.get(targetDocument);
8896 if (!injectedStyles) {
8897 injectedStyles = /* @__PURE__ */ new Set();
8898 runtime.injectedStyles.set(targetDocument, injectedStyles);
8899 }
8900 if (injectedStyles.has(hash)) {
8901 return;
8902 }
8903 if (documentContainsStyleHash3(targetDocument, hash)) {
8904 injectedStyles.add(hash);
8905 return;
8906 }
8907 const style = targetDocument.createElement("style");
8908 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
8909 style.appendChild(targetDocument.createTextNode(css));
8910 targetDocument.head.appendChild(style);
8911 injectedStyles.add(hash);
8912 }
8913 function registerDocument3(targetDocument) {
8914 const runtime = getRuntime3();
8915 runtime.documents.set(
8916 targetDocument,
8917 (runtime.documents.get(targetDocument) ?? 0) + 1
8918 );
8919 for (const [hash, css] of runtime.styles) {
8920 injectStyle3(targetDocument, hash, css);
8921 }
8922 return () => {
8923 const count = runtime.documents.get(targetDocument);
8924 if (count === void 0) {
8925 return;
8926 }
8927 if (count <= 1) {
8928 runtime.documents.delete(targetDocument);
8929 return;
8930 }
8931 runtime.documents.set(targetDocument, count - 1);
8932 };
8933 }
8934 function registerStyle3(hash, css) {
8935 const runtime = getRuntime3();
8936 runtime.styles.set(hash, css);
8937 for (const targetDocument of runtime.documents.keys()) {
8938 injectStyle3(targetDocument, hash, css);
8939 }
8940 }
8941 if (typeof process === "undefined" || true) {
8942 registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
8943 }
8944 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
8945 if (typeof process === "undefined" || true) {
8946 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}}}}');
8947 }
8948 var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
8949 var Positioner = (0, import_element13.forwardRef)(
8950 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) {
8951 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
8952 index_parts_exports.Positioner,
8953 {
8954 ref,
8955 align,
8956 side,
8957 sideOffset,
8958 ...props,
8959 className: clsx_default(
8960 resets_default["box-sizing"],
8961 style_default2.positioner,
8962 className
8963 )
8964 }
8965 );
8966 }
8967 );
8968
8969 // packages/ui/build-module/tooltip/popup.mjs
8970 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
8971 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
8972 function getRuntime4() {
8973 const globalScope = globalThis;
8974 if (globalScope.__wpStyleRuntime) {
8975 return globalScope.__wpStyleRuntime;
8976 }
8977 globalScope.__wpStyleRuntime = {
8978 documents: /* @__PURE__ */ new Map(),
8979 styles: /* @__PURE__ */ new Map(),
8980 injectedStyles: /* @__PURE__ */ new WeakMap()
8981 };
8982 if (typeof document !== "undefined") {
8983 registerDocument4(document);
8984 }
8985 return globalScope.__wpStyleRuntime;
8986 }
8987 function documentContainsStyleHash4(targetDocument, hash) {
8988 if (!targetDocument.head) {
8989 return false;
8990 }
8991 for (const style of targetDocument.head.querySelectorAll(
8992 `style[${STYLE_HASH_ATTRIBUTE4}]`
8993 )) {
8994 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
8995 return true;
8996 }
8997 }
8998 return false;
8999 }
9000 function injectStyle4(targetDocument, hash, css) {
9001 if (!targetDocument.head) {
9002 return;
9003 }
9004 const runtime = getRuntime4();
9005 let injectedStyles = runtime.injectedStyles.get(targetDocument);
9006 if (!injectedStyles) {
9007 injectedStyles = /* @__PURE__ */ new Set();
9008 runtime.injectedStyles.set(targetDocument, injectedStyles);
9009 }
9010 if (injectedStyles.has(hash)) {
9011 return;
9012 }
9013 if (documentContainsStyleHash4(targetDocument, hash)) {
9014 injectedStyles.add(hash);
9015 return;
9016 }
9017 const style = targetDocument.createElement("style");
9018 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
9019 style.appendChild(targetDocument.createTextNode(css));
9020 targetDocument.head.appendChild(style);
9021 injectedStyles.add(hash);
9022 }
9023 function registerDocument4(targetDocument) {
9024 const runtime = getRuntime4();
9025 runtime.documents.set(
9026 targetDocument,
9027 (runtime.documents.get(targetDocument) ?? 0) + 1
9028 );
9029 for (const [hash, css] of runtime.styles) {
9030 injectStyle4(targetDocument, hash, css);
9031 }
9032 return () => {
9033 const count = runtime.documents.get(targetDocument);
9034 if (count === void 0) {
9035 return;
9036 }
9037 if (count <= 1) {
9038 runtime.documents.delete(targetDocument);
9039 return;
9040 }
9041 runtime.documents.set(targetDocument, count - 1);
9042 };
9043 }
9044 function registerStyle4(hash, css) {
9045 const runtime = getRuntime4();
9046 runtime.styles.set(hash, css);
9047 for (const targetDocument of runtime.documents.keys()) {
9048 injectStyle4(targetDocument, hash, css);
9049 }
9050 }
9051 if (typeof process === "undefined" || true) {
9052 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}}}}');
9053 }
9054 var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
9055 var POPUP_COLOR = { background: "#1e1e1e" };
9056 var Popup = (0, import_element14.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) {
9057 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
9058 index_parts_exports.Popup,
9059 {
9060 ref,
9061 className: clsx_default(style_default3.popup, className),
9062 ...props,
9063 children
9064 }
9065 ) });
9066 const positionedPopup = renderSlotWithChildren(
9067 positioner,
9068 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Positioner, {}),
9069 popupContent
9070 );
9071 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Portal, {}), positionedPopup);
9072 });
9073
9074 // packages/ui/build-module/tooltip/trigger.mjs
9075 var import_element15 = __toESM(require_element(), 1);
9076 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
9077 var Trigger = (0, import_element15.forwardRef)(
9078 function TooltipTrigger3(props, ref) {
9079 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(index_parts_exports.Trigger, { ref, ...props });
9080 }
9081 );
9082
9083 // packages/ui/build-module/tooltip/root.mjs
9084 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
9085 function Root(props) {
9086 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(index_parts_exports.Root, { ...props });
9087 }
9088
9089 // packages/ui/build-module/tooltip/provider.mjs
9090 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
9091 function Provider({ ...props }) {
9092 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(index_parts_exports.Provider, { ...props });
9093 }
9094
9095 // packages/ui/build-module/visually-hidden/visually-hidden.mjs
9096 var import_element16 = __toESM(require_element(), 1);
9097 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash";
9098 function getRuntime5() {
9099 const globalScope = globalThis;
9100 if (globalScope.__wpStyleRuntime) {
9101 return globalScope.__wpStyleRuntime;
9102 }
9103 globalScope.__wpStyleRuntime = {
9104 documents: /* @__PURE__ */ new Map(),
9105 styles: /* @__PURE__ */ new Map(),
9106 injectedStyles: /* @__PURE__ */ new WeakMap()
9107 };
9108 if (typeof document !== "undefined") {
9109 registerDocument5(document);
9110 }
9111 return globalScope.__wpStyleRuntime;
9112 }
9113 function documentContainsStyleHash5(targetDocument, hash) {
9114 if (!targetDocument.head) {
9115 return false;
9116 }
9117 for (const style of targetDocument.head.querySelectorAll(
9118 `style[${STYLE_HASH_ATTRIBUTE5}]`
9119 )) {
9120 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) {
9121 return true;
9122 }
9123 }
9124 return false;
9125 }
9126 function injectStyle5(targetDocument, hash, css) {
9127 if (!targetDocument.head) {
9128 return;
9129 }
9130 const runtime = getRuntime5();
9131 let injectedStyles = runtime.injectedStyles.get(targetDocument);
9132 if (!injectedStyles) {
9133 injectedStyles = /* @__PURE__ */ new Set();
9134 runtime.injectedStyles.set(targetDocument, injectedStyles);
9135 }
9136 if (injectedStyles.has(hash)) {
9137 return;
9138 }
9139 if (documentContainsStyleHash5(targetDocument, hash)) {
9140 injectedStyles.add(hash);
9141 return;
9142 }
9143 const style = targetDocument.createElement("style");
9144 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash);
9145 style.appendChild(targetDocument.createTextNode(css));
9146 targetDocument.head.appendChild(style);
9147 injectedStyles.add(hash);
9148 }
9149 function registerDocument5(targetDocument) {
9150 const runtime = getRuntime5();
9151 runtime.documents.set(
9152 targetDocument,
9153 (runtime.documents.get(targetDocument) ?? 0) + 1
9154 );
9155 for (const [hash, css] of runtime.styles) {
9156 injectStyle5(targetDocument, hash, css);
9157 }
9158 return () => {
9159 const count = runtime.documents.get(targetDocument);
9160 if (count === void 0) {
9161 return;
9162 }
9163 if (count <= 1) {
9164 runtime.documents.delete(targetDocument);
9165 return;
9166 }
9167 runtime.documents.set(targetDocument, count - 1);
9168 };
9169 }
9170 function registerStyle5(hash, css) {
9171 const runtime = getRuntime5();
9172 runtime.styles.set(hash, css);
9173 for (const targetDocument of runtime.documents.keys()) {
9174 injectStyle5(targetDocument, hash, css);
9175 }
9176 }
9177 if (typeof process === "undefined" || true) {
9178 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}}}");
9179 }
9180 var style_default4 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
9181 var VisuallyHidden = (0, import_element16.forwardRef)(
9182 function VisuallyHidden2({ render, ...restProps }, ref) {
9183 const element = useRender({
9184 render,
9185 ref,
9186 props: mergeProps(
9187 { className: style_default4["visually-hidden"] },
9188 restProps,
9189 {
9190 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
9191 "data-visually-hidden": ""
9192 }
9193 )
9194 });
9195 return element;
9196 }
9197 );
9198
9199 // packages/admin-ui/build-module/navigable-region/index.mjs
9200 var import_element17 = __toESM(require_element(), 1);
9201 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
9202 var NavigableRegion = (0, import_element17.forwardRef)(
9203 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
9204 return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
9205 Tag,
9206 {
9207 ref,
9208 className: clsx_default("admin-ui-navigable-region", className),
9209 "aria-label": ariaLabel,
9210 role: "region",
9211 tabIndex: "-1",
9212 ...props,
9213 children
9214 }
9215 );
9216 }
9217 );
9218 NavigableRegion.displayName = "NavigableRegion";
9219 var navigable_region_default = NavigableRegion;
9220
9221 // packages/edit-post/build-module/components/layout/index.mjs
9222 var import_editor17 = __toESM(require_editor(), 1);
9223 var import_data24 = __toESM(require_data(), 1);
9224 var import_block_editor = __toESM(require_block_editor(), 1);
9225
9226 // packages/global-styles-engine/build-module/utils/common.mjs
9227 var import_style_engine = __toESM(require_style_engine(), 1);
9228 var ROOT_BLOCK_SELECTOR = "body";
9229 var ROOT_CSS_PROPERTIES_SELECTOR = ":root";
9230
9231 // packages/global-styles-engine/build-module/core/render.mjs
9232 var import_blocks = __toESM(require_blocks(), 1);
9233 var import_style_engine2 = __toESM(require_style_engine(), 1);
9234 var import_data = __toESM(require_data(), 1);
9235
9236 // packages/global-styles-engine/build-module/utils/spacing.mjs
9237 function getSpacingPresetCssVar(value) {
9238 if (!value) {
9239 return;
9240 }
9241 const slug = value.match(/var:preset\|spacing\|(.+)/);
9242 if (!slug) {
9243 return value;
9244 }
9245 return `var(--wp--preset--spacing--${slug[1]})`;
9246 }
9247
9248 // packages/global-styles-engine/build-module/utils/gap.mjs
9249 function getGapBoxControlValueFromStyle(blockGapValue) {
9250 if (!blockGapValue) {
9251 return null;
9252 }
9253 const isValueString = typeof blockGapValue === "string";
9254 return {
9255 top: isValueString ? blockGapValue : blockGapValue?.top,
9256 left: isValueString ? blockGapValue : blockGapValue?.left
9257 };
9258 }
9259 function getGapCSSValue(blockGapValue, defaultValue = "0") {
9260 const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue);
9261 if (!blockGapBoxControlValue) {
9262 return null;
9263 }
9264 const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue;
9265 const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue;
9266 return row === column ? row : `${row} ${column}`;
9267 }
9268
9269 // packages/global-styles-engine/build-module/utils/layout.mjs
9270 var LAYOUT_DEFINITIONS = {
9271 default: {
9272 name: "default",
9273 slug: "flow",
9274 className: "is-layout-flow",
9275 baseStyles: [
9276 {
9277 selector: " > .alignleft",
9278 rules: {
9279 float: "left",
9280 "margin-inline-start": "0",
9281 "margin-inline-end": "2em"
9282 }
9283 },
9284 {
9285 selector: " > .alignright",
9286 rules: {
9287 float: "right",
9288 "margin-inline-start": "2em",
9289 "margin-inline-end": "0"
9290 }
9291 },
9292 {
9293 selector: " > .aligncenter",
9294 rules: {
9295 "margin-left": "auto !important",
9296 "margin-right": "auto !important"
9297 }
9298 }
9299 ],
9300 spacingStyles: [
9301 {
9302 selector: " > :first-child",
9303 rules: {
9304 "margin-block-start": "0"
9305 }
9306 },
9307 {
9308 selector: " > :last-child",
9309 rules: {
9310 "margin-block-end": "0"
9311 }
9312 },
9313 {
9314 selector: " > *",
9315 rules: {
9316 "margin-block-start": null,
9317 "margin-block-end": "0"
9318 }
9319 }
9320 ]
9321 },
9322 constrained: {
9323 name: "constrained",
9324 slug: "constrained",
9325 className: "is-layout-constrained",
9326 baseStyles: [
9327 {
9328 selector: " > .alignleft",
9329 rules: {
9330 float: "left",
9331 "margin-inline-start": "0",
9332 "margin-inline-end": "2em"
9333 }
9334 },
9335 {
9336 selector: " > .alignright",
9337 rules: {
9338 float: "right",
9339 "margin-inline-start": "2em",
9340 "margin-inline-end": "0"
9341 }
9342 },
9343 {
9344 selector: " > .aligncenter",
9345 rules: {
9346 "margin-left": "auto !important",
9347 "margin-right": "auto !important"
9348 }
9349 },
9350 {
9351 selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))",
9352 rules: {
9353 "max-width": "var(--wp--style--global--content-size)",
9354 "margin-left": "auto !important",
9355 "margin-right": "auto !important"
9356 }
9357 },
9358 {
9359 selector: " > .alignwide",
9360 rules: {
9361 "max-width": "var(--wp--style--global--wide-size)"
9362 }
9363 }
9364 ],
9365 spacingStyles: [
9366 {
9367 selector: " > :first-child",
9368 rules: {
9369 "margin-block-start": "0"
9370 }
9371 },
9372 {
9373 selector: " > :last-child",
9374 rules: {
9375 "margin-block-end": "0"
9376 }
9377 },
9378 {
9379 selector: " > *",
9380 rules: {
9381 "margin-block-start": null,
9382 "margin-block-end": "0"
9383 }
9384 }
9385 ]
9386 },
9387 flex: {
9388 name: "flex",
9389 slug: "flex",
9390 className: "is-layout-flex",
9391 displayMode: "flex",
9392 baseStyles: [
9393 {
9394 selector: "",
9395 rules: {
9396 "flex-wrap": "wrap",
9397 "align-items": "center"
9398 }
9399 },
9400 {
9401 selector: " > :is(*, div)",
9402 // :is(*, div) instead of just * increases the specificity by 001.
9403 rules: {
9404 margin: "0"
9405 }
9406 }
9407 ],
9408 spacingStyles: [
9409 {
9410 selector: "",
9411 rules: {
9412 gap: null
9413 }
9414 }
9415 ]
9416 },
9417 grid: {
9418 name: "grid",
9419 slug: "grid",
9420 className: "is-layout-grid",
9421 displayMode: "grid",
9422 baseStyles: [
9423 {
9424 selector: " > :is(*, div)",
9425 // :is(*, div) instead of just * increases the specificity by 001.
9426 rules: {
9427 margin: "0"
9428 }
9429 }
9430 ],
9431 spacingStyles: [
9432 {
9433 selector: "",
9434 rules: {
9435 gap: null
9436 }
9437 }
9438 ]
9439 }
9440 };
9441
9442 // packages/global-styles-engine/build-module/core/render.mjs
9443 function getLayoutStyles({
9444 layoutDefinitions = LAYOUT_DEFINITIONS,
9445 style,
9446 selector,
9447 hasBlockGapSupport,
9448 hasFallbackGapSupport,
9449 fallbackGapValue
9450 }) {
9451 let ruleset = "";
9452 let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : "";
9453 if (hasFallbackGapSupport) {
9454 if (selector === ROOT_BLOCK_SELECTOR) {
9455 gapValue = !gapValue ? "0.5em" : gapValue;
9456 } else if (!hasBlockGapSupport && fallbackGapValue) {
9457 gapValue = fallbackGapValue;
9458 }
9459 }
9460 if (gapValue && layoutDefinitions) {
9461 Object.values(layoutDefinitions).forEach(
9462 ({ className, name, spacingStyles }) => {
9463 if (!hasBlockGapSupport && "flex" !== name && "grid" !== name) {
9464 return;
9465 }
9466 if (spacingStyles?.length) {
9467 spacingStyles.forEach((spacingStyle) => {
9468 const declarations = [];
9469 if (spacingStyle.rules) {
9470 Object.entries(spacingStyle.rules).forEach(
9471 ([cssProperty, cssValue]) => {
9472 declarations.push(
9473 `${cssProperty}: ${cssValue ? cssValue : gapValue}`
9474 );
9475 }
9476 );
9477 }
9478 if (declarations.length) {
9479 let combinedSelector = "";
9480 if (!hasBlockGapSupport) {
9481 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ""})` : `:where(${selector}.${className}${spacingStyle?.selector || ""})`;
9482 } else {
9483 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.${className})${spacingStyle?.selector || ""}` : `:root :where(${selector}-${className})${spacingStyle?.selector || ""}`;
9484 }
9485 ruleset += `${combinedSelector} { ${declarations.join(
9486 "; "
9487 )}; }`;
9488 }
9489 });
9490 }
9491 }
9492 );
9493 if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) {
9494 ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: ${gapValue}; }`;
9495 }
9496 }
9497 if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) {
9498 const validDisplayModes = ["block", "flex", "grid"];
9499 Object.values(layoutDefinitions).forEach(
9500 ({ className, displayMode, baseStyles }) => {
9501 if (displayMode && validDisplayModes.includes(displayMode)) {
9502 ruleset += `${selector} .${className} { display:${displayMode}; }`;
9503 }
9504 if (baseStyles?.length) {
9505 baseStyles.forEach((baseStyle) => {
9506 const declarations = [];
9507 if (baseStyle.rules) {
9508 Object.entries(baseStyle.rules).forEach(
9509 ([cssProperty, cssValue]) => {
9510 declarations.push(
9511 `${cssProperty}: ${cssValue}`
9512 );
9513 }
9514 );
9515 }
9516 if (declarations.length) {
9517 const combinedSelector = `.${className}${baseStyle?.selector || ""}`;
9518 ruleset += `${combinedSelector} { ${declarations.join(
9519 "; "
9520 )}; }`;
9521 }
9522 });
9523 }
9524 }
9525 );
9526 }
9527 return ruleset;
9528 }
9529
9530 // packages/edit-post/build-module/components/layout/index.mjs
9531 var import_plugins = __toESM(require_plugins(), 1);
9532 var import_i18n14 = __toESM(require_i18n(), 1);
9533 var import_element28 = __toESM(require_element(), 1);
9534 var import_notices3 = __toESM(require_notices(), 1);
9535 var import_preferences10 = __toESM(require_preferences(), 1);
9536 var import_commands2 = __toESM(require_commands(), 1);
9537 var import_block_library = __toESM(require_block_library(), 1);
9538 var import_url5 = __toESM(require_url(), 1);
9539 var import_html_entities = __toESM(require_html_entities(), 1);
9540 var import_core_data8 = __toESM(require_core_data(), 1);
9541 var import_components9 = __toESM(require_components(), 1);
9542 var import_compose2 = __toESM(require_compose(), 1);
9543
9544 // packages/edit-post/build-module/components/back-button/index.mjs
9545 var import_editor2 = __toESM(require_editor(), 1);
9546 var import_components2 = __toESM(require_components(), 1);
9547
9548 // packages/edit-post/build-module/components/back-button/fullscreen-mode-close.mjs
9549 var import_data2 = __toESM(require_data(), 1);
9550 var import_components = __toESM(require_components(), 1);
9551 var import_i18n = __toESM(require_i18n(), 1);
9552 var import_url = __toESM(require_url(), 1);
9553 var import_editor = __toESM(require_editor(), 1);
9554 var import_core_data = __toESM(require_core_data(), 1);
9555 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
9556 function FullscreenModeClose({ showTooltip, icon, href, initialPost }) {
9557 const postType = (0, import_data2.useSelect)(
9558 (select3) => {
9559 const { getCurrentPostType } = select3(import_editor.store);
9560 const { getPostType } = select3(import_core_data.store);
9561 return getPostType(initialPost?.type || getCurrentPostType());
9562 },
9563 [initialPost?.type]
9564 );
9565 if (!postType) {
9566 return null;
9567 }
9568 const buttonHref = href ?? (0, import_url.addQueryArgs)("edit.php", {
9569 post_type: postType.slug
9570 });
9571 const buttonLabel = postType?.labels?.view_items ?? (0, import_i18n.__)("Back");
9572 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
9573 import_components.Button,
9574 {
9575 size: "compact",
9576 href: buttonHref,
9577 label: buttonLabel,
9578 showTooltip,
9579 tooltipPosition: "bottom",
9580 icon: icon ?? ((0, import_i18n.isRTL)() ? chevron_right_default : chevron_left_default)
9581 }
9582 );
9583 }
9584 var fullscreen_mode_close_default = FullscreenModeClose;
9585
9586 // packages/edit-post/build-module/lock-unlock.mjs
9587 var import_private_apis2 = __toESM(require_private_apis(), 1);
9588 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
9589 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
9590 "@wordpress/edit-post"
9591 );
9592
9593 // packages/edit-post/build-module/components/back-button/index.mjs
9594 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
9595 var { BackButton: BackButtonFill } = unlock2(import_editor2.privateApis);
9596 var slideX = {
9597 hidden: { x: "-100%" },
9598 distractionFreeInactive: { x: 0 },
9599 hover: { x: 0, transition: { type: "tween", delay: 0.2 } }
9600 };
9601 function BackButton({ initialPost }) {
9602 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(BackButtonFill, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
9603 import_components2.__unstableMotion.div,
9604 {
9605 variants: slideX,
9606 transition: { type: "tween", delay: 0.8 },
9607 children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
9608 fullscreen_mode_close_default,
9609 {
9610 showTooltip: true,
9611 initialPost
9612 }
9613 )
9614 }
9615 ) });
9616 }
9617 var back_button_default = BackButton;
9618
9619 // packages/edit-post/build-module/components/editor-initialization/listener-hooks.mjs
9620 var import_data3 = __toESM(require_data(), 1);
9621 var import_element18 = __toESM(require_element(), 1);
9622 var import_editor3 = __toESM(require_editor(), 1);
9623 var import_core_data2 = __toESM(require_core_data(), 1);
9624
9625 // packages/edit-post/build-module/store/constants.mjs
9626 var STORE_NAME = "core/edit-post";
9627 var VIEW_AS_LINK_SELECTOR = "#wp-admin-bar-view a";
9628 var VIEW_AS_PREVIEW_LINK_SELECTOR = "#wp-admin-bar-preview a";
9629
9630 // packages/edit-post/build-module/components/editor-initialization/listener-hooks.mjs
9631 var useUpdatePostLinkListener = () => {
9632 const { isViewable, newPermalink } = (0, import_data3.useSelect)((select3) => {
9633 const { getPostType } = select3(import_core_data2.store);
9634 const { getCurrentPost, getEditedPostAttribute } = select3(import_editor3.store);
9635 const postType = getPostType(getEditedPostAttribute("type"));
9636 return {
9637 isViewable: postType?.viewable,
9638 newPermalink: getCurrentPost().link
9639 };
9640 }, []);
9641 const nodeToUpdateRef = (0, import_element18.useRef)();
9642 (0, import_element18.useEffect)(() => {
9643 nodeToUpdateRef.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR);
9644 }, []);
9645 (0, import_element18.useEffect)(() => {
9646 if (!newPermalink || !nodeToUpdateRef.current) {
9647 return;
9648 }
9649 if (!isViewable) {
9650 nodeToUpdateRef.current.style.display = "none";
9651 return;
9652 }
9653 nodeToUpdateRef.current.style.display = "";
9654 nodeToUpdateRef.current.setAttribute("href", newPermalink);
9655 }, [newPermalink, isViewable]);
9656 };
9657
9658 // packages/edit-post/build-module/components/editor-initialization/index.mjs
9659 function EditorInitialization() {
9660 useUpdatePostLinkListener();
9661 return null;
9662 }
9663
9664 // packages/edit-post/build-module/components/keyboard-shortcuts/index.mjs
9665 var import_element19 = __toESM(require_element(), 1);
9666 var import_data7 = __toESM(require_data(), 1);
9667 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1);
9668 var import_i18n3 = __toESM(require_i18n(), 1);
9669
9670 // packages/edit-post/build-module/store/index.mjs
9671 var import_data6 = __toESM(require_data(), 1);
9672
9673 // packages/edit-post/build-module/store/reducer.mjs
9674 var import_data4 = __toESM(require_data(), 1);
9675 function isSavingMetaBoxes(state = false, action) {
9676 switch (action.type) {
9677 case "REQUEST_META_BOX_UPDATES":
9678 return true;
9679 case "META_BOX_UPDATES_SUCCESS":
9680 case "META_BOX_UPDATES_FAILURE":
9681 return false;
9682 default:
9683 return state;
9684 }
9685 }
9686 function mergeMetaboxes(metaboxes = [], newMetaboxes) {
9687 const mergedMetaboxes = [...metaboxes];
9688 for (const metabox of newMetaboxes) {
9689 const existing = mergedMetaboxes.findIndex(
9690 (box) => box.id === metabox.id
9691 );
9692 if (existing !== -1) {
9693 mergedMetaboxes[existing] = {
9694 ...mergedMetaboxes[existing],
9695 ...metabox
9696 };
9697 } else {
9698 mergedMetaboxes.push(metabox);
9699 }
9700 }
9701 return mergedMetaboxes;
9702 }
9703 function metaBoxLocations(state = {}, action) {
9704 switch (action.type) {
9705 case "SET_META_BOXES_PER_LOCATIONS": {
9706 const newState = { ...state };
9707 for (const [location, metaboxes] of Object.entries(
9708 action.metaBoxesPerLocation
9709 )) {
9710 newState[location] = mergeMetaboxes(
9711 newState[location],
9712 metaboxes
9713 );
9714 }
9715 return newState;
9716 }
9717 }
9718 return state;
9719 }
9720 function metaBoxesInitialized(state = false, action) {
9721 switch (action.type) {
9722 case "META_BOXES_INITIALIZED":
9723 return true;
9724 }
9725 return state;
9726 }
9727 var metaBoxes = (0, import_data4.combineReducers)({
9728 isSaving: isSavingMetaBoxes,
9729 locations: metaBoxLocations,
9730 initialized: metaBoxesInitialized
9731 });
9732 var reducer_default = (0, import_data4.combineReducers)({
9733 metaBoxes
9734 });
9735
9736 // packages/edit-post/build-module/store/actions.mjs
9737 var actions_exports = {};
9738 __export(actions_exports, {
9739 __experimentalSetPreviewDeviceType: () => __experimentalSetPreviewDeviceType,
9740 __unstableCreateTemplate: () => __unstableCreateTemplate,
9741 closeGeneralSidebar: () => closeGeneralSidebar,
9742 closeModal: () => closeModal,
9743 closePublishSidebar: () => closePublishSidebar,
9744 hideBlockTypes: () => hideBlockTypes,
9745 initializeMetaBoxes: () => initializeMetaBoxes,
9746 metaBoxUpdatesFailure: () => metaBoxUpdatesFailure,
9747 metaBoxUpdatesSuccess: () => metaBoxUpdatesSuccess,
9748 openGeneralSidebar: () => openGeneralSidebar,
9749 openModal: () => openModal,
9750 openPublishSidebar: () => openPublishSidebar,
9751 removeEditorPanel: () => removeEditorPanel,
9752 requestMetaBoxUpdates: () => requestMetaBoxUpdates,
9753 setAvailableMetaBoxesPerLocation: () => setAvailableMetaBoxesPerLocation,
9754 setIsEditingTemplate: () => setIsEditingTemplate,
9755 setIsInserterOpened: () => setIsInserterOpened,
9756 setIsListViewOpened: () => setIsListViewOpened,
9757 showBlockTypes: () => showBlockTypes,
9758 switchEditorMode: () => switchEditorMode,
9759 toggleDistractionFree: () => toggleDistractionFree,
9760 toggleEditorPanelEnabled: () => toggleEditorPanelEnabled,
9761 toggleEditorPanelOpened: () => toggleEditorPanelOpened,
9762 toggleFeature: () => toggleFeature,
9763 toggleFullscreenMode: () => toggleFullscreenMode,
9764 togglePinnedPluginItem: () => togglePinnedPluginItem,
9765 togglePublishSidebar: () => togglePublishSidebar,
9766 updatePreferredStyleVariations: () => updatePreferredStyleVariations
9767 });
9768 var import_api_fetch = __toESM(require_api_fetch(), 1);
9769 var import_preferences = __toESM(require_preferences(), 1);
9770 var import_editor4 = __toESM(require_editor(), 1);
9771 var import_deprecated = __toESM(require_deprecated(), 1);
9772 var import_hooks = __toESM(require_hooks(), 1);
9773 var import_core_data3 = __toESM(require_core_data(), 1);
9774 var import_notices = __toESM(require_notices(), 1);
9775 var import_i18n2 = __toESM(require_i18n(), 1);
9776
9777 // packages/edit-post/build-module/utils/meta-boxes.mjs
9778 var getMetaBoxContainer = (location) => {
9779 const area = document.querySelector(
9780 `.edit-post-meta-boxes-area.is-${location} .metabox-location-${location}`
9781 );
9782 if (area) {
9783 return area;
9784 }
9785 return document.querySelector("#metaboxes .metabox-location-" + location);
9786 };
9787
9788 // packages/edit-post/build-module/store/actions.mjs
9789 var { interfaceStore } = unlock2(import_editor4.privateApis);
9790 var openGeneralSidebar = (name) => ({ registry }) => {
9791 registry.dispatch(interfaceStore).enableComplementaryArea("core", name);
9792 };
9793 var closeGeneralSidebar = () => ({ registry }) => registry.dispatch(interfaceStore).disableComplementaryArea("core");
9794 var openModal = (name) => ({ registry }) => {
9795 (0, import_deprecated.default)("select( 'core/edit-post' ).openModal( name )", {
9796 since: "6.3",
9797 alternative: "select( 'core/interface').openModal( name )"
9798 });
9799 return registry.dispatch(interfaceStore).openModal(name);
9800 };
9801 var closeModal = () => ({ registry }) => {
9802 (0, import_deprecated.default)("select( 'core/edit-post' ).closeModal()", {
9803 since: "6.3",
9804 alternative: "select( 'core/interface').closeModal()"
9805 });
9806 return registry.dispatch(interfaceStore).closeModal();
9807 };
9808 var openPublishSidebar = () => ({ registry }) => {
9809 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).openPublishSidebar", {
9810 since: "6.6",
9811 alternative: "dispatch( 'core/editor').openPublishSidebar"
9812 });
9813 registry.dispatch(import_editor4.store).openPublishSidebar();
9814 };
9815 var closePublishSidebar = () => ({ registry }) => {
9816 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).closePublishSidebar", {
9817 since: "6.6",
9818 alternative: "dispatch( 'core/editor').closePublishSidebar"
9819 });
9820 registry.dispatch(import_editor4.store).closePublishSidebar();
9821 };
9822 var togglePublishSidebar = () => ({ registry }) => {
9823 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).togglePublishSidebar", {
9824 since: "6.6",
9825 alternative: "dispatch( 'core/editor').togglePublishSidebar"
9826 });
9827 registry.dispatch(import_editor4.store).togglePublishSidebar();
9828 };
9829 var toggleEditorPanelEnabled = (panelName) => ({ registry }) => {
9830 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled", {
9831 since: "6.5",
9832 alternative: "dispatch( 'core/editor').toggleEditorPanelEnabled"
9833 });
9834 registry.dispatch(import_editor4.store).toggleEditorPanelEnabled(panelName);
9835 };
9836 var toggleEditorPanelOpened = (panelName) => ({ registry }) => {
9837 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleEditorPanelOpened", {
9838 since: "6.5",
9839 alternative: "dispatch( 'core/editor').toggleEditorPanelOpened"
9840 });
9841 registry.dispatch(import_editor4.store).toggleEditorPanelOpened(panelName);
9842 };
9843 var removeEditorPanel = (panelName) => ({ registry }) => {
9844 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).removeEditorPanel", {
9845 since: "6.5",
9846 alternative: "dispatch( 'core/editor').removeEditorPanel"
9847 });
9848 registry.dispatch(import_editor4.store).removeEditorPanel(panelName);
9849 };
9850 var toggleFeature = (feature) => ({ registry }) => registry.dispatch(import_preferences.store).toggle("core/edit-post", feature);
9851 var switchEditorMode = (mode) => ({ registry }) => {
9852 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).switchEditorMode", {
9853 since: "6.6",
9854 alternative: "dispatch( 'core/editor').switchEditorMode"
9855 });
9856 registry.dispatch(import_editor4.store).switchEditorMode(mode);
9857 };
9858 var togglePinnedPluginItem = (pluginName) => ({ registry }) => {
9859 const isPinned = registry.select(interfaceStore).isItemPinned("core", pluginName);
9860 registry.dispatch(interfaceStore)[isPinned ? "unpinItem" : "pinItem"]("core", pluginName);
9861 };
9862 function updatePreferredStyleVariations() {
9863 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).updatePreferredStyleVariations", {
9864 since: "6.6",
9865 hint: "Preferred Style Variations are not supported anymore."
9866 });
9867 return { type: "NOTHING" };
9868 }
9869 var showBlockTypes = (blockNames) => ({ registry }) => {
9870 unlock2(registry.dispatch(import_editor4.store)).showBlockTypes(blockNames);
9871 };
9872 var hideBlockTypes = (blockNames) => ({ registry }) => {
9873 unlock2(registry.dispatch(import_editor4.store)).hideBlockTypes(blockNames);
9874 };
9875 function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) {
9876 return {
9877 type: "SET_META_BOXES_PER_LOCATIONS",
9878 metaBoxesPerLocation
9879 };
9880 }
9881 var requestMetaBoxUpdates = () => async ({ registry, select: select3, dispatch: dispatch2 }) => {
9882 dispatch2({
9883 type: "REQUEST_META_BOX_UPDATES"
9884 });
9885 if (window.tinyMCE) {
9886 window.tinyMCE.triggerSave();
9887 }
9888 const baseFormData = new window.FormData(
9889 document.querySelector(".metabox-base-form")
9890 );
9891 const postId = baseFormData.get("post_ID");
9892 const postType = baseFormData.get("post_type");
9893 const post = registry.select(import_core_data3.store).getEditedEntityRecord("postType", postType, postId);
9894 const additionalData = [
9895 post.comment_status ? ["comment_status", post.comment_status] : false,
9896 post.ping_status ? ["ping_status", post.ping_status] : false,
9897 post.sticky ? ["sticky", post.sticky] : false,
9898 post.author ? ["post_author", post.author] : false
9899 ].filter(Boolean);
9900 const activeMetaBoxLocations = select3.getActiveMetaBoxLocations();
9901 const formDataToMerge = [
9902 baseFormData,
9903 ...activeMetaBoxLocations.map(
9904 (location) => new window.FormData(getMetaBoxContainer(location))
9905 )
9906 ];
9907 const formData = formDataToMerge.reduce((memo, currentFormData) => {
9908 for (const [key, value] of currentFormData) {
9909 memo.append(key, value);
9910 }
9911 return memo;
9912 }, new window.FormData());
9913 additionalData.forEach(
9914 ([key, value]) => formData.append(key, value)
9915 );
9916 try {
9917 await (0, import_api_fetch.default)({
9918 url: window._wpMetaBoxUrl,
9919 method: "POST",
9920 body: formData,
9921 parse: false
9922 });
9923 dispatch2.metaBoxUpdatesSuccess();
9924 } catch {
9925 dispatch2.metaBoxUpdatesFailure();
9926 }
9927 };
9928 function metaBoxUpdatesSuccess() {
9929 return {
9930 type: "META_BOX_UPDATES_SUCCESS"
9931 };
9932 }
9933 function metaBoxUpdatesFailure() {
9934 return {
9935 type: "META_BOX_UPDATES_FAILURE"
9936 };
9937 }
9938 var __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => {
9939 (0, import_deprecated.default)(
9940 "dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType",
9941 {
9942 since: "6.5",
9943 version: "6.7",
9944 hint: "registry.dispatch( editorStore ).setDeviceType"
9945 }
9946 );
9947 registry.dispatch(import_editor4.store).setDeviceType(deviceType);
9948 };
9949 var setIsInserterOpened = (value) => ({ registry }) => {
9950 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsInserterOpened", {
9951 since: "6.5",
9952 alternative: "dispatch( 'core/editor').setIsInserterOpened"
9953 });
9954 registry.dispatch(import_editor4.store).setIsInserterOpened(value);
9955 };
9956 var setIsListViewOpened = (isOpen) => ({ registry }) => {
9957 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsListViewOpened", {
9958 since: "6.5",
9959 alternative: "dispatch( 'core/editor').setIsListViewOpened"
9960 });
9961 registry.dispatch(import_editor4.store).setIsListViewOpened(isOpen);
9962 };
9963 function setIsEditingTemplate() {
9964 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsEditingTemplate", {
9965 since: "6.5",
9966 alternative: "dispatch( 'core/editor').setRenderingMode"
9967 });
9968 return { type: "NOTHING" };
9969 }
9970 function __unstableCreateTemplate() {
9971 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).__unstableCreateTemplate", {
9972 since: "6.5"
9973 });
9974 return { type: "NOTHING" };
9975 }
9976 var metaBoxesInitialized2 = false;
9977 var initializeMetaBoxes = () => ({ registry, select: select3, dispatch: dispatch2 }) => {
9978 const isEditorReady = registry.select(import_editor4.store).__unstableIsEditorReady();
9979 if (!isEditorReady) {
9980 return;
9981 }
9982 if (metaBoxesInitialized2) {
9983 return;
9984 }
9985 const postType = registry.select(import_editor4.store).getCurrentPostType();
9986 if (window.postboxes.page !== postType) {
9987 window.postboxes.add_postbox_toggles(postType);
9988 }
9989 metaBoxesInitialized2 = true;
9990 (0, import_hooks.addAction)(
9991 "editor.savePost",
9992 "core/edit-post/save-metaboxes",
9993 async (post, options) => {
9994 if (!options.isAutosave && select3.hasMetaBoxes()) {
9995 await dispatch2.requestMetaBoxUpdates();
9996 }
9997 }
9998 );
9999 dispatch2({
10000 type: "META_BOXES_INITIALIZED"
10001 });
10002 };
10003 var toggleDistractionFree = () => ({ registry }) => {
10004 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleDistractionFree", {
10005 since: "6.6",
10006 alternative: "dispatch( 'core/editor').toggleDistractionFree"
10007 });
10008 registry.dispatch(import_editor4.store).toggleDistractionFree();
10009 };
10010 var toggleFullscreenMode = () => ({ registry }) => {
10011 const isFullscreen = registry.select(import_preferences.store).get("core/edit-post", "fullscreenMode");
10012 registry.dispatch(import_preferences.store).toggle("core/edit-post", "fullscreenMode");
10013 registry.dispatch(import_notices.store).createInfoNotice(
10014 isFullscreen ? (0, import_i18n2.__)("Fullscreen mode deactivated.") : (0, import_i18n2.__)("Fullscreen mode activated."),
10015 {
10016 id: "core/edit-post/toggle-fullscreen-mode/notice",
10017 type: "snackbar",
10018 actions: [
10019 {
10020 label: (0, import_i18n2.__)("Undo"),
10021 onClick: () => {
10022 registry.dispatch(import_preferences.store).toggle(
10023 "core/edit-post",
10024 "fullscreenMode"
10025 );
10026 }
10027 }
10028 ]
10029 }
10030 );
10031 };
10032
10033 // packages/edit-post/build-module/store/selectors.mjs
10034 var selectors_exports = {};
10035 __export(selectors_exports, {
10036 __experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint,
10037 __experimentalGetPreviewDeviceType: () => __experimentalGetPreviewDeviceType,
10038 areMetaBoxesInitialized: () => areMetaBoxesInitialized,
10039 getActiveGeneralSidebarName: () => getActiveGeneralSidebarName,
10040 getActiveMetaBoxLocations: () => getActiveMetaBoxLocations,
10041 getAllMetaBoxes: () => getAllMetaBoxes,
10042 getEditedPostTemplate: () => getEditedPostTemplate,
10043 getEditorMode: () => getEditorMode,
10044 getHiddenBlockTypes: () => getHiddenBlockTypes,
10045 getMetaBoxesPerLocation: () => getMetaBoxesPerLocation,
10046 getPreference: () => getPreference,
10047 getPreferences: () => getPreferences,
10048 hasMetaBoxes: () => hasMetaBoxes,
10049 isEditingTemplate: () => isEditingTemplate,
10050 isEditorPanelEnabled: () => isEditorPanelEnabled,
10051 isEditorPanelOpened: () => isEditorPanelOpened,
10052 isEditorPanelRemoved: () => isEditorPanelRemoved,
10053 isEditorSidebarOpened: () => isEditorSidebarOpened,
10054 isFeatureActive: () => isFeatureActive,
10055 isInserterOpened: () => isInserterOpened,
10056 isListViewOpened: () => isListViewOpened,
10057 isMetaBoxLocationActive: () => isMetaBoxLocationActive,
10058 isMetaBoxLocationVisible: () => isMetaBoxLocationVisible,
10059 isModalActive: () => isModalActive,
10060 isPluginItemPinned: () => isPluginItemPinned,
10061 isPluginSidebarOpened: () => isPluginSidebarOpened,
10062 isPublishSidebarOpened: () => isPublishSidebarOpened,
10063 isSavingMetaBoxes: () => isSavingMetaBoxes2
10064 });
10065 var import_data5 = __toESM(require_data(), 1);
10066 var import_preferences2 = __toESM(require_preferences(), 1);
10067 var import_core_data4 = __toESM(require_core_data(), 1);
10068 var import_editor5 = __toESM(require_editor(), 1);
10069 var import_deprecated2 = __toESM(require_deprecated(), 1);
10070 var { interfaceStore: interfaceStore2 } = unlock2(import_editor5.privateApis);
10071 var EMPTY_ARRAY2 = [];
10072 var EMPTY_OBJECT2 = {};
10073 var getEditorMode = (0, import_data5.createRegistrySelector)(
10074 (select3) => () => select3(import_preferences2.store).get("core", "editorMode") ?? "visual"
10075 );
10076 var isEditorSidebarOpened = (0, import_data5.createRegistrySelector)(
10077 (select3) => () => {
10078 const activeGeneralSidebar = select3(interfaceStore2).getActiveComplementaryArea("core");
10079 return ["edit-post/document", "edit-post/block"].includes(
10080 activeGeneralSidebar
10081 );
10082 }
10083 );
10084 var isPluginSidebarOpened = (0, import_data5.createRegistrySelector)(
10085 (select3) => () => {
10086 const activeGeneralSidebar = select3(interfaceStore2).getActiveComplementaryArea("core");
10087 return !!activeGeneralSidebar && !["edit-post/document", "edit-post/block"].includes(
10088 activeGeneralSidebar
10089 );
10090 }
10091 );
10092 var getActiveGeneralSidebarName = (0, import_data5.createRegistrySelector)(
10093 (select3) => () => {
10094 return select3(interfaceStore2).getActiveComplementaryArea("core");
10095 }
10096 );
10097 function convertPanelsToOldFormat(inactivePanels, openPanels) {
10098 const panelsWithEnabledState = inactivePanels?.reduce(
10099 (accumulatedPanels, panelName) => ({
10100 ...accumulatedPanels,
10101 [panelName]: {
10102 enabled: false
10103 }
10104 }),
10105 {}
10106 );
10107 const panels = openPanels?.reduce((accumulatedPanels, panelName) => {
10108 const currentPanelState = accumulatedPanels?.[panelName];
10109 return {
10110 ...accumulatedPanels,
10111 [panelName]: {
10112 ...currentPanelState,
10113 opened: true
10114 }
10115 };
10116 }, panelsWithEnabledState ?? {});
10117 return panels ?? panelsWithEnabledState ?? EMPTY_OBJECT2;
10118 }
10119 var getPreferences = (0, import_data5.createRegistrySelector)((select3) => () => {
10120 (0, import_deprecated2.default)(`select( 'core/edit-post' ).getPreferences`, {
10121 since: "6.0",
10122 alternative: `select( 'core/preferences' ).get`
10123 });
10124 const corePreferences = ["editorMode", "hiddenBlockTypes"].reduce(
10125 (accumulatedPrefs, preferenceKey) => {
10126 const value = select3(import_preferences2.store).get(
10127 "core",
10128 preferenceKey
10129 );
10130 return {
10131 ...accumulatedPrefs,
10132 [preferenceKey]: value
10133 };
10134 },
10135 {}
10136 );
10137 const inactivePanels = select3(import_preferences2.store).get(
10138 "core",
10139 "inactivePanels"
10140 );
10141 const openPanels = select3(import_preferences2.store).get("core", "openPanels");
10142 const panels = convertPanelsToOldFormat(inactivePanels, openPanels);
10143 return {
10144 ...corePreferences,
10145 panels
10146 };
10147 });
10148 function getPreference(state, preferenceKey, defaultValue) {
10149 (0, import_deprecated2.default)(`select( 'core/edit-post' ).getPreference`, {
10150 since: "6.0",
10151 alternative: `select( 'core/preferences' ).get`
10152 });
10153 const preferences = getPreferences(state);
10154 const value = preferences[preferenceKey];
10155 return value === void 0 ? defaultValue : value;
10156 }
10157 var getHiddenBlockTypes = (0, import_data5.createRegistrySelector)((select3) => () => {
10158 return select3(import_preferences2.store).get("core", "hiddenBlockTypes") ?? EMPTY_ARRAY2;
10159 });
10160 var isPublishSidebarOpened = (0, import_data5.createRegistrySelector)(
10161 (select3) => () => {
10162 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isPublishSidebarOpened`, {
10163 since: "6.6",
10164 alternative: `select( 'core/editor' ).isPublishSidebarOpened`
10165 });
10166 return select3(import_editor5.store).isPublishSidebarOpened();
10167 }
10168 );
10169 var isEditorPanelRemoved = (0, import_data5.createRegistrySelector)(
10170 (select3) => (state, panelName) => {
10171 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelRemoved`, {
10172 since: "6.5",
10173 alternative: `select( 'core/editor' ).isEditorPanelRemoved`
10174 });
10175 return select3(import_editor5.store).isEditorPanelRemoved(panelName);
10176 }
10177 );
10178 var isEditorPanelEnabled = (0, import_data5.createRegistrySelector)(
10179 (select3) => (state, panelName) => {
10180 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelEnabled`, {
10181 since: "6.5",
10182 alternative: `select( 'core/editor' ).isEditorPanelEnabled`
10183 });
10184 return select3(import_editor5.store).isEditorPanelEnabled(panelName);
10185 }
10186 );
10187 var isEditorPanelOpened = (0, import_data5.createRegistrySelector)(
10188 (select3) => (state, panelName) => {
10189 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelOpened`, {
10190 since: "6.5",
10191 alternative: `select( 'core/editor' ).isEditorPanelOpened`
10192 });
10193 return select3(import_editor5.store).isEditorPanelOpened(panelName);
10194 }
10195 );
10196 var isModalActive = (0, import_data5.createRegistrySelector)(
10197 (select3) => (state, modalName) => {
10198 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isModalActive`, {
10199 since: "6.3",
10200 alternative: `select( 'core/interface' ).isModalActive`
10201 });
10202 return !!select3(interfaceStore2).isModalActive(modalName);
10203 }
10204 );
10205 var isFeatureActive = (0, import_data5.createRegistrySelector)(
10206 (select3) => (state, feature) => {
10207 return !!select3(import_preferences2.store).get("core/edit-post", feature);
10208 }
10209 );
10210 var isPluginItemPinned = (0, import_data5.createRegistrySelector)(
10211 (select3) => (state, pluginName) => {
10212 return select3(interfaceStore2).isItemPinned("core", pluginName);
10213 }
10214 );
10215 var getActiveMetaBoxLocations = (0, import_data5.createSelector)(
10216 (state) => {
10217 return Object.keys(state.metaBoxes.locations).filter(
10218 (location) => isMetaBoxLocationActive(state, location)
10219 );
10220 },
10221 (state) => [state.metaBoxes.locations]
10222 );
10223 var isMetaBoxLocationVisible = (0, import_data5.createRegistrySelector)(
10224 (select3) => (state, location) => {
10225 return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({ id }) => {
10226 return select3(import_editor5.store).isEditorPanelEnabled(
10227 `meta-box-${id}`
10228 );
10229 });
10230 }
10231 );
10232 function isMetaBoxLocationActive(state, location) {
10233 const metaBoxes2 = getMetaBoxesPerLocation(state, location);
10234 return !!metaBoxes2 && metaBoxes2.length !== 0;
10235 }
10236 function getMetaBoxesPerLocation(state, location) {
10237 return state.metaBoxes.locations[location];
10238 }
10239 var getAllMetaBoxes = (0, import_data5.createSelector)(
10240 (state) => {
10241 return Object.values(state.metaBoxes.locations).flat();
10242 },
10243 (state) => [state.metaBoxes.locations]
10244 );
10245 function hasMetaBoxes(state) {
10246 return getActiveMetaBoxLocations(state).length > 0;
10247 }
10248 function isSavingMetaBoxes2(state) {
10249 return state.metaBoxes.isSaving;
10250 }
10251 var __experimentalGetPreviewDeviceType = (0, import_data5.createRegistrySelector)(
10252 (select3) => () => {
10253 (0, import_deprecated2.default)(
10254 `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,
10255 {
10256 since: "6.5",
10257 version: "6.7",
10258 alternative: `select( 'core/editor' ).getDeviceType`
10259 }
10260 );
10261 return select3(import_editor5.store).getDeviceType();
10262 }
10263 );
10264 var isInserterOpened = (0, import_data5.createRegistrySelector)((select3) => () => {
10265 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isInserterOpened`, {
10266 since: "6.5",
10267 alternative: `select( 'core/editor' ).isInserterOpened`
10268 });
10269 return select3(import_editor5.store).isInserterOpened();
10270 });
10271 var __experimentalGetInsertionPoint = (0, import_data5.createRegistrySelector)(
10272 (select3) => () => {
10273 (0, import_deprecated2.default)(
10274 `select( 'core/edit-post' ).__experimentalGetInsertionPoint`,
10275 {
10276 since: "6.5",
10277 version: "6.7"
10278 }
10279 );
10280 return unlock2(select3(import_editor5.store)).getInserter();
10281 }
10282 );
10283 var isListViewOpened = (0, import_data5.createRegistrySelector)((select3) => () => {
10284 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isListViewOpened`, {
10285 since: "6.5",
10286 alternative: `select( 'core/editor' ).isListViewOpened`
10287 });
10288 return select3(import_editor5.store).isListViewOpened();
10289 });
10290 var isEditingTemplate = (0, import_data5.createRegistrySelector)((select3) => () => {
10291 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditingTemplate`, {
10292 since: "6.5",
10293 alternative: `select( 'core/editor' ).getRenderingMode`
10294 });
10295 return select3(import_editor5.store).getCurrentPostType() === "wp_template";
10296 });
10297 function areMetaBoxesInitialized(state) {
10298 return state.metaBoxes.initialized;
10299 }
10300 var getEditedPostTemplate = (0, import_data5.createRegistrySelector)(
10301 (select3) => () => {
10302 const { id: postId, type: postType } = select3(import_editor5.store).getCurrentPost();
10303 const templateId = unlock2(select3(import_core_data4.store)).getTemplateId(
10304 postType,
10305 postId
10306 );
10307 if (!templateId) {
10308 return void 0;
10309 }
10310 return select3(import_core_data4.store).getEditedEntityRecord(
10311 "postType",
10312 "wp_template",
10313 templateId
10314 );
10315 }
10316 );
10317
10318 // packages/edit-post/build-module/store/index.mjs
10319 var store = (0, import_data6.createReduxStore)(STORE_NAME, {
10320 reducer: reducer_default,
10321 actions: actions_exports,
10322 selectors: selectors_exports
10323 });
10324 (0, import_data6.register)(store);
10325
10326 // packages/edit-post/build-module/components/keyboard-shortcuts/index.mjs
10327 function KeyboardShortcuts() {
10328 const { toggleFullscreenMode: toggleFullscreenMode2 } = (0, import_data7.useDispatch)(store);
10329 const { registerShortcut } = (0, import_data7.useDispatch)(import_keyboard_shortcuts.store);
10330 (0, import_element19.useEffect)(() => {
10331 registerShortcut({
10332 name: "core/edit-post/toggle-fullscreen",
10333 category: "global",
10334 description: (0, import_i18n3.__)("Enable or disable fullscreen mode."),
10335 keyCombination: {
10336 modifier: "secondary",
10337 character: "f"
10338 }
10339 });
10340 }, []);
10341 (0, import_keyboard_shortcuts.useShortcut)("core/edit-post/toggle-fullscreen", () => {
10342 toggleFullscreenMode2();
10343 });
10344 return null;
10345 }
10346 var keyboard_shortcuts_default = KeyboardShortcuts;
10347
10348 // packages/edit-post/build-module/components/init-pattern-modal/index.mjs
10349 var import_data8 = __toESM(require_data(), 1);
10350 var import_i18n4 = __toESM(require_i18n(), 1);
10351 var import_components3 = __toESM(require_components(), 1);
10352 var import_element20 = __toESM(require_element(), 1);
10353 var import_editor6 = __toESM(require_editor(), 1);
10354 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
10355 function InitPatternModal() {
10356 const { editPost } = (0, import_data8.useDispatch)(import_editor6.store);
10357 const { isCleanNewPost } = (0, import_data8.useSelect)(import_editor6.store);
10358 const [syncType, setSyncType] = (0, import_element20.useState)(void 0);
10359 const [title, setTitle] = (0, import_element20.useState)("");
10360 const [isModalOpen, setIsModalOpen] = (0, import_element20.useState)(() => isCleanNewPost());
10361 if (!isModalOpen) {
10362 return null;
10363 }
10364 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
10365 import_components3.Modal,
10366 {
10367 title: (0, import_i18n4.__)("Create pattern"),
10368 onRequestClose: () => {
10369 setIsModalOpen(false);
10370 },
10371 overlayClassName: "patterns-create-modal",
10372 children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
10373 "form",
10374 {
10375 onSubmit: (event) => {
10376 event.preventDefault();
10377 setIsModalOpen(false);
10378 editPost({
10379 title,
10380 meta: {
10381 wp_pattern_sync_status: syncType
10382 }
10383 });
10384 },
10385 children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Stack, { direction: "column", gap: "lg", children: [
10386 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
10387 import_components3.TextControl,
10388 {
10389 label: (0, import_i18n4.__)("Name"),
10390 value: title,
10391 onChange: setTitle,
10392 placeholder: (0, import_i18n4.__)("My pattern"),
10393 className: "patterns-create-modal__name-input"
10394 }
10395 ),
10396 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
10397 import_components3.ToggleControl,
10398 {
10399 label: (0, import_i18n4._x)("Synced", "pattern (singular)"),
10400 help: (0, import_i18n4.__)(
10401 "Sync this pattern across multiple locations."
10402 ),
10403 checked: !syncType,
10404 onChange: () => {
10405 setSyncType(!syncType ? "unsynced" : void 0);
10406 }
10407 }
10408 ),
10409 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Stack, { justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
10410 import_components3.Button,
10411 {
10412 __next40pxDefaultSize: true,
10413 variant: "primary",
10414 type: "submit",
10415 disabled: !title,
10416 accessibleWhenDisabled: true,
10417 children: (0, import_i18n4.__)("Create")
10418 }
10419 ) })
10420 ] })
10421 }
10422 )
10423 }
10424 );
10425 }
10426
10427 // packages/edit-post/build-module/components/browser-url/index.mjs
10428 var import_element21 = __toESM(require_element(), 1);
10429 var import_data9 = __toESM(require_data(), 1);
10430 var import_url2 = __toESM(require_url(), 1);
10431 var import_editor7 = __toESM(require_editor(), 1);
10432 function getPostEditURL(postId) {
10433 return (0, import_url2.addQueryArgs)("post.php", { post: postId, action: "edit" });
10434 }
10435 function BrowserURL() {
10436 const [historyId, setHistoryId] = (0, import_element21.useState)(null);
10437 const { postId, postStatus } = (0, import_data9.useSelect)((select3) => {
10438 const { getCurrentPost } = select3(import_editor7.store);
10439 const post = getCurrentPost();
10440 let { id, status, type } = post;
10441 const isTemplate = ["wp_template", "wp_template_part"].includes(
10442 type
10443 );
10444 if (isTemplate) {
10445 id = post.wp_id;
10446 }
10447 return {
10448 postId: id,
10449 postStatus: status
10450 };
10451 }, []);
10452 (0, import_element21.useEffect)(() => {
10453 if (postId && postId !== historyId && postStatus !== "auto-draft") {
10454 window.history.replaceState(
10455 { id: postId },
10456 "Post " + postId,
10457 getPostEditURL(postId)
10458 );
10459 setHistoryId(postId);
10460 }
10461 }, [postId, postStatus, historyId]);
10462 return null;
10463 }
10464
10465 // packages/edit-post/build-module/components/meta-boxes/index.mjs
10466 var import_data12 = __toESM(require_data(), 1);
10467
10468 // packages/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.mjs
10469 var import_element22 = __toESM(require_element(), 1);
10470 var import_components4 = __toESM(require_components(), 1);
10471 var import_data10 = __toESM(require_data(), 1);
10472 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
10473 function MetaBoxesArea({ location }) {
10474 const container = (0, import_element22.useRef)(null);
10475 const formRef = (0, import_element22.useRef)(null);
10476 (0, import_element22.useEffect)(() => {
10477 formRef.current = document.querySelector(
10478 ".metabox-location-" + location
10479 );
10480 if (formRef.current) {
10481 container.current.appendChild(formRef.current);
10482 }
10483 return () => {
10484 if (formRef.current) {
10485 document.querySelector("#metaboxes").appendChild(formRef.current);
10486 }
10487 };
10488 }, [location]);
10489 const isSaving = (0, import_data10.useSelect)((select3) => {
10490 return select3(store).isSavingMetaBoxes();
10491 }, []);
10492 const classes = clsx_default("edit-post-meta-boxes-area", `is-${location}`, {
10493 "is-loading": isSaving
10494 });
10495 return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: classes, children: [
10496 isSaving && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components4.Spinner, { className: "edit-post-meta-boxes-area__spinner" }),
10497 /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
10498 "div",
10499 {
10500 className: "edit-post-meta-boxes-area__container",
10501 ref: container
10502 }
10503 ),
10504 /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "edit-post-meta-boxes-area__clear" })
10505 ] });
10506 }
10507 var meta_boxes_area_default = MetaBoxesArea;
10508
10509 // packages/edit-post/build-module/components/meta-boxes/meta-box-visibility.mjs
10510 var import_element23 = __toESM(require_element(), 1);
10511 var import_data11 = __toESM(require_data(), 1);
10512 var import_editor8 = __toESM(require_editor(), 1);
10513 function MetaBoxVisibility({ id }) {
10514 const isVisible = (0, import_data11.useSelect)(
10515 (select3) => {
10516 return select3(import_editor8.store).isEditorPanelEnabled(
10517 `meta-box-${id}`
10518 );
10519 },
10520 [id]
10521 );
10522 (0, import_element23.useEffect)(() => {
10523 const element = document.getElementById(id);
10524 if (!element) {
10525 return;
10526 }
10527 if (isVisible) {
10528 element.classList.remove("is-hidden");
10529 } else {
10530 element.classList.add("is-hidden");
10531 }
10532 }, [id, isVisible]);
10533 return null;
10534 }
10535
10536 // packages/edit-post/build-module/components/meta-boxes/index.mjs
10537 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
10538 function MetaBoxes({ location }) {
10539 const metaBoxes2 = (0, import_data12.useSelect)(
10540 (select3) => select3(store).getMetaBoxesPerLocation(location),
10541 [location]
10542 );
10543 return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
10544 (metaBoxes2 ?? []).map(({ id }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MetaBoxVisibility, { id }, id)),
10545 /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(meta_boxes_area_default, { location })
10546 ] });
10547 }
10548
10549 // packages/edit-post/build-module/components/more-menu/index.mjs
10550 var import_i18n10 = __toESM(require_i18n(), 1);
10551 var import_compose = __toESM(require_compose(), 1);
10552 var import_editor14 = __toESM(require_editor(), 1);
10553 var import_keycodes = __toESM(require_keycodes(), 1);
10554 var import_preferences8 = __toESM(require_preferences(), 1);
10555
10556 // packages/edit-post/build-module/components/more-menu/manage-patterns-menu-item.mjs
10557 var import_components5 = __toESM(require_components(), 1);
10558 var import_core_data5 = __toESM(require_core_data(), 1);
10559 var import_data13 = __toESM(require_data(), 1);
10560 var import_i18n5 = __toESM(require_i18n(), 1);
10561 var import_url3 = __toESM(require_url(), 1);
10562 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
10563 function ManagePatternsMenuItem() {
10564 const url = (0, import_data13.useSelect)((select3) => {
10565 const { canUser } = select3(import_core_data5.store);
10566 const defaultUrl = (0, import_url3.addQueryArgs)("edit.php", {
10567 post_type: "wp_block"
10568 });
10569 const patternsUrl = (0, import_url3.addQueryArgs)("site-editor.php", {
10570 p: "/pattern"
10571 });
10572 return canUser("create", {
10573 kind: "postType",
10574 name: "wp_template"
10575 }) ? patternsUrl : defaultUrl;
10576 }, []);
10577 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components5.MenuItem, { role: "menuitem", href: url, children: (0, import_i18n5.__)("Manage patterns") });
10578 }
10579 var manage_patterns_menu_item_default = ManagePatternsMenuItem;
10580
10581 // packages/edit-post/build-module/components/more-menu/welcome-guide-menu-item.mjs
10582 var import_data14 = __toESM(require_data(), 1);
10583 var import_preferences3 = __toESM(require_preferences(), 1);
10584 var import_i18n6 = __toESM(require_i18n(), 1);
10585 var import_editor9 = __toESM(require_editor(), 1);
10586 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
10587 function WelcomeGuideMenuItem() {
10588 const isEditingTemplate2 = (0, import_data14.useSelect)(
10589 (select3) => select3(import_editor9.store).getCurrentPostType() === "wp_template",
10590 []
10591 );
10592 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10593 import_preferences3.PreferenceToggleMenuItem,
10594 {
10595 scope: "core/edit-post",
10596 name: isEditingTemplate2 ? "welcomeGuideTemplate" : "welcomeGuide",
10597 label: (0, import_i18n6.__)("Welcome Guide")
10598 }
10599 );
10600 }
10601
10602 // packages/edit-post/build-module/components/preferences-modal/index.mjs
10603 var import_i18n9 = __toESM(require_i18n(), 1);
10604 var import_preferences7 = __toESM(require_preferences(), 1);
10605 var import_editor13 = __toESM(require_editor(), 1);
10606
10607 // packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.mjs
10608 var import_i18n8 = __toESM(require_i18n(), 1);
10609 var import_data17 = __toESM(require_data(), 1);
10610 var import_editor12 = __toESM(require_editor(), 1);
10611 var import_preferences6 = __toESM(require_preferences(), 1);
10612
10613 // packages/edit-post/build-module/components/preferences-modal/enable-custom-fields.mjs
10614 var import_element24 = __toESM(require_element(), 1);
10615 var import_i18n7 = __toESM(require_i18n(), 1);
10616 var import_components6 = __toESM(require_components(), 1);
10617 var import_data15 = __toESM(require_data(), 1);
10618 var import_editor10 = __toESM(require_editor(), 1);
10619 var import_preferences4 = __toESM(require_preferences(), 1);
10620 var import_url4 = __toESM(require_url(), 1);
10621 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
10622 var { PreferenceBaseOption } = unlock2(import_preferences4.privateApis);
10623 function submitCustomFieldsForm() {
10624 const customFieldsForm = document.getElementById(
10625 "toggle-custom-fields-form"
10626 );
10627 customFieldsForm.querySelector('[name="_wp_http_referer"]').setAttribute("value", (0, import_url4.getPathAndQueryString)(window.location.href));
10628 customFieldsForm.submit();
10629 }
10630 function CustomFieldsConfirmation({ willEnable }) {
10631 const [isReloading, setIsReloading] = (0, import_element24.useState)(false);
10632 return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
10633 /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "edit-post-preferences-modal__custom-fields-confirmation-message", children: (0, import_i18n7.__)(
10634 "A page reload is required for this change. Make sure your content is saved before reloading."
10635 ) }),
10636 /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10637 import_components6.Button,
10638 {
10639 __next40pxDefaultSize: true,
10640 variant: "secondary",
10641 isBusy: isReloading,
10642 accessibleWhenDisabled: true,
10643 disabled: isReloading,
10644 onClick: () => {
10645 setIsReloading(true);
10646 submitCustomFieldsForm();
10647 },
10648 children: willEnable ? (0, import_i18n7.__)("Show & Reload Page") : (0, import_i18n7.__)("Hide & Reload Page")
10649 }
10650 )
10651 ] });
10652 }
10653 function EnableCustomFieldsOption({ label }) {
10654 const areCustomFieldsEnabled = (0, import_data15.useSelect)((select3) => {
10655 return !!select3(import_editor10.store).getEditorSettings().enableCustomFields;
10656 }, []);
10657 const [isChecked, setIsChecked] = (0, import_element24.useState)(areCustomFieldsEnabled);
10658 return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10659 PreferenceBaseOption,
10660 {
10661 label,
10662 isChecked,
10663 onChange: setIsChecked,
10664 children: isChecked !== areCustomFieldsEnabled && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CustomFieldsConfirmation, { willEnable: isChecked })
10665 }
10666 );
10667 }
10668
10669 // packages/edit-post/build-module/components/preferences-modal/enable-panel.mjs
10670 var import_data16 = __toESM(require_data(), 1);
10671 var import_editor11 = __toESM(require_editor(), 1);
10672 var import_preferences5 = __toESM(require_preferences(), 1);
10673 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
10674 var { PreferenceBaseOption: PreferenceBaseOption2 } = unlock2(import_preferences5.privateApis);
10675 function EnablePanelOption(props) {
10676 const { toggleEditorPanelEnabled: toggleEditorPanelEnabled2 } = (0, import_data16.useDispatch)(import_editor11.store);
10677 const { isChecked, isRemoved } = (0, import_data16.useSelect)(
10678 (select3) => {
10679 const { isEditorPanelEnabled: isEditorPanelEnabled2, isEditorPanelRemoved: isEditorPanelRemoved2 } = select3(import_editor11.store);
10680 return {
10681 isChecked: isEditorPanelEnabled2(props.panelName),
10682 isRemoved: isEditorPanelRemoved2(props.panelName)
10683 };
10684 },
10685 [props.panelName]
10686 );
10687 if (isRemoved) {
10688 return null;
10689 }
10690 return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10691 PreferenceBaseOption2,
10692 {
10693 isChecked,
10694 onChange: () => toggleEditorPanelEnabled2(props.panelName),
10695 ...props
10696 }
10697 );
10698 }
10699
10700 // packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.mjs
10701 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
10702 var { PreferencesModalSection } = unlock2(import_preferences6.privateApis);
10703 function MetaBoxesSection(sectionProps) {
10704 const { areCustomFieldsRegistered, metaBoxes: metaBoxes2 } = (0, import_data17.useSelect)((select3) => {
10705 const { getEditorSettings } = select3(import_editor12.store);
10706 const { getAllMetaBoxes: getAllMetaBoxes2 } = select3(store);
10707 return {
10708 areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== void 0,
10709 metaBoxes: getAllMetaBoxes2()
10710 };
10711 }, []);
10712 const thirdPartyMetaBoxes = metaBoxes2.filter(
10713 ({ id }) => id !== "postcustom"
10714 );
10715 if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) {
10716 return null;
10717 }
10718 return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(PreferencesModalSection, { ...sectionProps, children: [
10719 areCustomFieldsRegistered && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EnableCustomFieldsOption, { label: (0, import_i18n8.__)("Custom fields") }),
10720 thirdPartyMetaBoxes.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
10721 EnablePanelOption,
10722 {
10723 label: title,
10724 panelName: `meta-box-${id}`
10725 },
10726 id
10727 ))
10728 ] });
10729 }
10730
10731 // packages/edit-post/build-module/components/preferences-modal/index.mjs
10732 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
10733 var { PreferenceToggleControl } = unlock2(import_preferences7.privateApis);
10734 var { PreferencesModal } = unlock2(import_editor13.privateApis);
10735 function EditPostPreferencesModal() {
10736 const extraSections = {
10737 general: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MetaBoxesSection, { title: (0, import_i18n9.__)("Advanced") }),
10738 appearance: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
10739 PreferenceToggleControl,
10740 {
10741 scope: "core/edit-post",
10742 featureName: "themeStyles",
10743 help: (0, import_i18n9.__)("Make the editor look like your theme."),
10744 label: (0, import_i18n9.__)("Use theme styles")
10745 }
10746 )
10747 };
10748 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PreferencesModal, { extraSections });
10749 }
10750
10751 // packages/edit-post/build-module/components/more-menu/index.mjs
10752 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
10753 var { ToolsMoreMenuGroup, ViewMoreMenuGroup } = unlock2(import_editor14.privateApis);
10754 var MoreMenu = () => {
10755 const isLargeViewport = (0, import_compose.useViewportMatch)("large");
10756 return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
10757 isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ViewMoreMenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10758 import_preferences8.PreferenceToggleMenuItem,
10759 {
10760 scope: "core/edit-post",
10761 name: "fullscreenMode",
10762 label: (0, import_i18n10.__)("Fullscreen mode"),
10763 info: (0, import_i18n10.__)("Show and hide the admin user interface"),
10764 messageActivated: (0, import_i18n10.__)("Fullscreen mode activated."),
10765 messageDeactivated: (0, import_i18n10.__)(
10766 "Fullscreen mode deactivated."
10767 ),
10768 shortcut: import_keycodes.displayShortcut.secondary("f")
10769 }
10770 ) }),
10771 /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(ToolsMoreMenuGroup, { children: [
10772 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(manage_patterns_menu_item_default, {}),
10773 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(WelcomeGuideMenuItem, {})
10774 ] }),
10775 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EditPostPreferencesModal, {})
10776 ] });
10777 };
10778 var more_menu_default = MoreMenu;
10779
10780 // packages/edit-post/build-module/components/welcome-guide/index.mjs
10781 var import_data20 = __toESM(require_data(), 1);
10782
10783 // packages/edit-post/build-module/components/welcome-guide/default.mjs
10784 var import_data18 = __toESM(require_data(), 1);
10785 var import_components7 = __toESM(require_components(), 1);
10786 var import_i18n11 = __toESM(require_i18n(), 1);
10787 var import_element25 = __toESM(require_element(), 1);
10788
10789 // packages/edit-post/build-module/components/welcome-guide/image.mjs
10790 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
10791 function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) {
10792 return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("picture", { className: "edit-post-welcome-guide__image", children: [
10793 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
10794 "source",
10795 {
10796 srcSet: nonAnimatedSrc,
10797 media: "(prefers-reduced-motion: reduce)"
10798 }
10799 ),
10800 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" })
10801 ] });
10802 }
10803
10804 // packages/edit-post/build-module/components/welcome-guide/default.mjs
10805 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
10806 function WelcomeGuideDefault() {
10807 const { toggleFeature: toggleFeature2 } = (0, import_data18.useDispatch)(store);
10808 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10809 import_components7.Guide,
10810 {
10811 className: "edit-post-welcome-guide",
10812 contentLabel: (0, import_i18n11.__)("Welcome to the editor"),
10813 finishButtonText: (0, import_i18n11.__)("Get started"),
10814 onFinish: () => toggleFeature2("welcomeGuide"),
10815 pages: [
10816 {
10817 image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10818 WelcomeGuideImage,
10819 {
10820 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
10821 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
10822 }
10823 ),
10824 content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
10825 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Welcome to the editor") }),
10826 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n11.__)(
10827 "In the WordPress editor, each paragraph, image, or video is presented as a distinct \u201Cblock\u201D of content."
10828 ) })
10829 ] })
10830 },
10831 {
10832 image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10833 WelcomeGuideImage,
10834 {
10835 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
10836 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
10837 }
10838 ),
10839 content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
10840 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Customize each block") }),
10841 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n11.__)(
10842 "Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected."
10843 ) })
10844 ] })
10845 },
10846 {
10847 image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10848 WelcomeGuideImage,
10849 {
10850 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
10851 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
10852 }
10853 ),
10854 content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
10855 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Explore all blocks") }),
10856 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element25.createInterpolateElement)(
10857 (0, import_i18n11.__)(
10858 "All of the blocks available to you live in the block library. You\u2019ll find it wherever you see the <InserterIconImage /> icon."
10859 ),
10860 {
10861 InserterIconImage: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10862 "img",
10863 {
10864 alt: (0, import_i18n11.__)("inserter"),
10865 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"
10866 }
10867 )
10868 }
10869 ) })
10870 ] })
10871 },
10872 {
10873 image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10874 WelcomeGuideImage,
10875 {
10876 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
10877 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
10878 }
10879 ),
10880 content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
10881 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Learn more") }),
10882 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element25.createInterpolateElement)(
10883 (0, import_i18n11.__)(
10884 "New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>"
10885 ),
10886 {
10887 a: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10888 import_components7.ExternalLink,
10889 {
10890 href: (0, import_i18n11.__)(
10891 "https://wordpress.org/documentation/article/wordpress-block-editor/"
10892 )
10893 }
10894 )
10895 }
10896 ) })
10897 ] })
10898 }
10899 ]
10900 }
10901 );
10902 }
10903
10904 // packages/edit-post/build-module/components/welcome-guide/template.mjs
10905 var import_data19 = __toESM(require_data(), 1);
10906 var import_components8 = __toESM(require_components(), 1);
10907 var import_i18n12 = __toESM(require_i18n(), 1);
10908 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
10909 function WelcomeGuideTemplate() {
10910 const { toggleFeature: toggleFeature2 } = (0, import_data19.useDispatch)(store);
10911 return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
10912 import_components8.Guide,
10913 {
10914 className: "edit-template-welcome-guide",
10915 contentLabel: (0, import_i18n12.__)("Welcome to the template editor"),
10916 finishButtonText: (0, import_i18n12.__)("Get started"),
10917 onFinish: () => toggleFeature2("welcomeGuideTemplate"),
10918 pages: [
10919 {
10920 image: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
10921 WelcomeGuideImage,
10922 {
10923 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg",
10924 animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif"
10925 }
10926 ),
10927 content: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
10928 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n12.__)("Welcome to the template editor") }),
10929 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n12.__)(
10930 "Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor."
10931 ) })
10932 ] })
10933 }
10934 ]
10935 }
10936 );
10937 }
10938
10939 // packages/edit-post/build-module/components/welcome-guide/index.mjs
10940 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
10941 function WelcomeGuide({ postType }) {
10942 const { isActive, isEditingTemplate: isEditingTemplate2 } = (0, import_data20.useSelect)(
10943 (select3) => {
10944 const { isFeatureActive: isFeatureActive2 } = select3(store);
10945 const _isEditingTemplate = postType === "wp_template";
10946 const feature = _isEditingTemplate ? "welcomeGuideTemplate" : "welcomeGuide";
10947 return {
10948 isActive: isFeatureActive2(feature),
10949 isEditingTemplate: _isEditingTemplate
10950 };
10951 },
10952 [postType]
10953 );
10954 if (!isActive) {
10955 return null;
10956 }
10957 return isEditingTemplate2 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WelcomeGuideTemplate, {}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WelcomeGuideDefault, {});
10958 }
10959
10960 // packages/edit-post/build-module/commands/use-commands.mjs
10961 var import_data21 = __toESM(require_data(), 1);
10962 var import_i18n13 = __toESM(require_i18n(), 1);
10963 var import_commands = __toESM(require_commands(), 1);
10964 var import_preferences9 = __toESM(require_preferences(), 1);
10965 var import_notices2 = __toESM(require_notices(), 1);
10966 function useCommands() {
10967 const { isFullscreen } = (0, import_data21.useSelect)((select3) => {
10968 const { get } = select3(import_preferences9.store);
10969 return {
10970 isFullscreen: get("core/edit-post", "fullscreenMode")
10971 };
10972 }, []);
10973 const { toggle } = (0, import_data21.useDispatch)(import_preferences9.store);
10974 const { createInfoNotice } = (0, import_data21.useDispatch)(import_notices2.store);
10975 (0, import_commands.useCommand)({
10976 name: "core/toggle-fullscreen-mode",
10977 label: isFullscreen ? (0, import_i18n13.__)("Exit fullscreen") : (0, import_i18n13.__)("Enter fullscreen"),
10978 icon: fullscreen_default,
10979 category: "command",
10980 callback: ({ close }) => {
10981 toggle("core/edit-post", "fullscreenMode");
10982 close();
10983 createInfoNotice(
10984 isFullscreen ? (0, import_i18n13.__)("Fullscreen off.") : (0, import_i18n13.__)("Fullscreen on."),
10985 {
10986 id: "core/edit-post/toggle-fullscreen-mode/notice",
10987 type: "snackbar",
10988 actions: [
10989 {
10990 label: (0, import_i18n13.__)("Undo"),
10991 onClick: () => {
10992 toggle("core/edit-post", "fullscreenMode");
10993 }
10994 }
10995 ]
10996 }
10997 );
10998 }
10999 });
11000 }
11001
11002 // packages/edit-post/build-module/hooks/use-navigate-to-entity-record.mjs
11003 var import_element26 = __toESM(require_element(), 1);
11004 var import_data22 = __toESM(require_data(), 1);
11005 var import_editor15 = __toESM(require_editor(), 1);
11006 var import_core_data6 = __toESM(require_core_data(), 1);
11007 function useNavigateToEntityRecord(initialPostId, initialPostType, defaultRenderingMode) {
11008 const registry = (0, import_data22.useRegistry)();
11009 const [postHistory, dispatch2] = (0, import_element26.useReducer)(
11010 (historyState, { type, post: post2, previousRenderingMode: previousRenderingMode2, selectedBlockClientId }) => {
11011 if (type === "push") {
11012 const updatedHistory = [...historyState];
11013 const currentIndex = updatedHistory.length - 1;
11014 updatedHistory[currentIndex] = {
11015 ...updatedHistory[currentIndex],
11016 selectedBlockClientId
11017 };
11018 return [...updatedHistory, { post: post2, previousRenderingMode: previousRenderingMode2 }];
11019 }
11020 if (type === "pop") {
11021 if (historyState.length > 1) {
11022 return historyState.slice(0, -1);
11023 }
11024 }
11025 return historyState;
11026 },
11027 [
11028 {
11029 post: { postId: initialPostId, postType: initialPostType }
11030 }
11031 ]
11032 );
11033 const { post, previousRenderingMode } = postHistory[postHistory.length - 1];
11034 const { getRenderingMode } = (0, import_data22.useSelect)(import_editor15.store);
11035 const { setRenderingMode } = (0, import_data22.useDispatch)(import_editor15.store);
11036 const { editEntityRecord } = (0, import_data22.useDispatch)(import_core_data6.store);
11037 const onNavigateToEntityRecord = (0, import_element26.useCallback)(
11038 (params) => {
11039 const entityEdits = registry.select(import_core_data6.store).getEntityRecordEdits("postType", post.postType, post.postId);
11040 const externalClientId = entityEdits?.selection?.selectionStart?.clientId ?? null;
11041 dispatch2({
11042 type: "push",
11043 post: { postId: params.postId, postType: params.postType },
11044 // Save the current rendering mode so we can restore it when navigating back.
11045 previousRenderingMode: getRenderingMode(),
11046 selectedBlockClientId: externalClientId
11047 });
11048 setRenderingMode(defaultRenderingMode);
11049 },
11050 [
11051 registry,
11052 post.postType,
11053 post.postId,
11054 getRenderingMode,
11055 setRenderingMode,
11056 defaultRenderingMode
11057 ]
11058 );
11059 const onNavigateToPreviousEntityRecord = (0, import_element26.useCallback)(() => {
11060 if (postHistory.length > 1) {
11061 const previousItem = postHistory[postHistory.length - 2];
11062 if (previousItem.selectedBlockClientId) {
11063 editEntityRecord(
11064 "postType",
11065 previousItem.post.postType,
11066 previousItem.post.postId,
11067 {
11068 selection: {
11069 selectionStart: {
11070 clientId: previousItem.selectedBlockClientId
11071 },
11072 selectionEnd: {
11073 clientId: previousItem.selectedBlockClientId
11074 }
11075 }
11076 },
11077 { undoIgnore: true }
11078 );
11079 }
11080 }
11081 dispatch2({
11082 type: "pop"
11083 });
11084 if (previousRenderingMode) {
11085 setRenderingMode(previousRenderingMode);
11086 }
11087 }, [
11088 setRenderingMode,
11089 previousRenderingMode,
11090 postHistory,
11091 editEntityRecord
11092 ]);
11093 return {
11094 currentPost: post,
11095 onNavigateToEntityRecord,
11096 onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : void 0
11097 };
11098 }
11099
11100 // packages/edit-post/build-module/components/meta-boxes/use-meta-box-initialization.mjs
11101 var import_data23 = __toESM(require_data(), 1);
11102 var import_editor16 = __toESM(require_editor(), 1);
11103 var import_core_data7 = __toESM(require_core_data(), 1);
11104 var import_element27 = __toESM(require_element(), 1);
11105 var useMetaBoxInitialization = (enabled) => {
11106 const {
11107 isEnabledAndEditorReady,
11108 isCollaborationEnabled,
11109 hasIncompatibleMetaBoxes,
11110 hasActiveMetaBoxes
11111 } = (0, import_data23.useSelect)(
11112 (select3) => {
11113 const {
11114 __unstableIsEditorReady,
11115 isCollaborationEnabledForCurrentPost
11116 } = unlock2(select3(import_editor16.store));
11117 return {
11118 isEnabledAndEditorReady: enabled && __unstableIsEditorReady(),
11119 isCollaborationEnabled: isCollaborationEnabledForCurrentPost(),
11120 hasIncompatibleMetaBoxes: enabled ? select3(store).getAllMetaBoxes().some((metaBox) => !metaBox.__rtc_compatible) : false,
11121 hasActiveMetaBoxes: enabled && select3(store).hasMetaBoxes()
11122 };
11123 },
11124 [enabled]
11125 );
11126 const { setCollaborationSupported } = unlock2((0, import_data23.useDispatch)(import_core_data7.store));
11127 const { updateEditorSettings } = (0, import_data23.useDispatch)(import_editor16.store);
11128 const { initializeMetaBoxes: initializeMetaBoxes2 } = (0, import_data23.useDispatch)(store);
11129 (0, import_element27.useEffect)(() => {
11130 if (isEnabledAndEditorReady) {
11131 initializeMetaBoxes2();
11132 if (isCollaborationEnabled && hasIncompatibleMetaBoxes) {
11133 setCollaborationSupported(false);
11134 }
11135 if (hasActiveMetaBoxes) {
11136 updateEditorSettings({ disableVisualRevisions: true });
11137 }
11138 }
11139 }, [
11140 isEnabledAndEditorReady,
11141 initializeMetaBoxes2,
11142 isCollaborationEnabled,
11143 setCollaborationSupported,
11144 hasIncompatibleMetaBoxes,
11145 hasActiveMetaBoxes,
11146 updateEditorSettings
11147 ]);
11148 };
11149
11150 // packages/edit-post/build-module/components/layout/index.mjs
11151 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
11152 var { useCommandContext } = unlock2(import_commands2.privateApis);
11153 var { useDrag } = unlock2(import_components9.privateApis);
11154 var { Editor, FullscreenMode, UploadProgressSnackbar } = unlock2(import_editor17.privateApis);
11155 var { BlockKeyboardShortcuts } = unlock2(import_block_library.privateApis);
11156 var DESIGN_POST_TYPES = [
11157 "wp_template",
11158 "wp_template_part",
11159 "wp_block",
11160 "wp_navigation"
11161 ];
11162 function useEditorStyles(settings) {
11163 const { hasThemeStyleSupport } = (0, import_data24.useSelect)((select3) => {
11164 return {
11165 hasThemeStyleSupport: select3(store).isFeatureActive("themeStyles")
11166 };
11167 }, []);
11168 return (0, import_element28.useMemo)(() => {
11169 const presetStyles = settings.styles?.filter(
11170 (style) => style.__unstableType && style.__unstableType !== "theme"
11171 ) ?? [];
11172 const defaultEditorStyles = [
11173 ...settings?.defaultEditorStyles ?? [],
11174 ...presetStyles
11175 ];
11176 const hasThemeStyles = hasThemeStyleSupport && presetStyles.length !== (settings.styles?.length ?? 0);
11177 if (!settings.disableLayoutStyles && !hasThemeStyles) {
11178 defaultEditorStyles.push({
11179 css: getLayoutStyles({
11180 style: {},
11181 selector: "body",
11182 hasBlockGapSupport: false,
11183 hasFallbackGapSupport: true,
11184 fallbackGapValue: "0.5em"
11185 })
11186 });
11187 }
11188 return hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles;
11189 }, [
11190 settings.defaultEditorStyles,
11191 settings.disableLayoutStyles,
11192 settings.styles,
11193 hasThemeStyleSupport
11194 ]);
11195 }
11196 function MetaBoxesMain() {
11197 const [isOpen, openHeight, hasAnyVisible] = (0, import_data24.useSelect)((select3) => {
11198 const { get } = select3(import_preferences10.store);
11199 const { isMetaBoxLocationVisible: isMetaBoxLocationVisible2 } = select3(store);
11200 return [
11201 !!get("core/edit-post", "metaBoxesMainIsOpen"),
11202 get("core/edit-post", "metaBoxesMainOpenHeight"),
11203 isMetaBoxLocationVisible2("normal") || isMetaBoxLocationVisible2("advanced") || isMetaBoxLocationVisible2("side")
11204 ];
11205 }, []);
11206 const { set: setPreference } = (0, import_data24.useDispatch)(import_preferences10.store);
11207 const isShort = (0, import_compose2.useMediaQuery)("(max-height: 549px)");
11208 const [{ min: min2 = 0, max: max2 }, setHeightConstraints] = (0, import_element28.useState)(() => ({}));
11209 const effectSizeConstraints = (0, import_compose2.useRefEffect)((node) => {
11210 const container = node.closest(
11211 ".interface-interface-skeleton__content"
11212 );
11213 if (!container) {
11214 return;
11215 }
11216 const noticeContainer = container.querySelector(".editor-notices");
11217 const resizeHandle = container.querySelector(
11218 ".edit-post-meta-boxes-main__presenter"
11219 );
11220 const deriveConstraints = () => {
11221 const fullHeight = container.offsetHeight;
11222 let nextMax = fullHeight;
11223 if (noticeContainer) {
11224 nextMax -= noticeContainer.offsetHeight;
11225 }
11226 const nextMin = resizeHandle?.offsetHeight ?? 0;
11227 setHeightConstraints({ min: nextMin, max: nextMax });
11228 };
11229 const observer = new window.ResizeObserver(deriveConstraints);
11230 observer.observe(container);
11231 if (noticeContainer) {
11232 observer.observe(noticeContainer);
11233 }
11234 return () => observer.disconnect();
11235 }, []);
11236 const metaBoxesMainRef = (0, import_element28.useRef)();
11237 const setMainRefs = (0, import_compose2.useMergeRefs)([
11238 metaBoxesMainRef,
11239 effectSizeConstraints
11240 ]);
11241 const separatorRef = (0, import_element28.useRef)();
11242 const separatorHelpId = (0, import_element28.useId)();
11243 const heightRef = (0, import_element28.useRef)();
11244 const getAriaValueNow = (height) => Math.round((height - min2) / (max2 - min2) * 100);
11245 const persistIsOpen = (to = !isOpen) => setPreference("core/edit-post", "metaBoxesMainIsOpen", to);
11246 const applyHeight = (candidateHeight = "auto", isPersistent) => {
11247 let styleHeight;
11248 if (candidateHeight === "auto") {
11249 isPersistent = false;
11250 styleHeight = candidateHeight;
11251 } else {
11252 candidateHeight = Math.min(max2, Math.max(min2, candidateHeight));
11253 heightRef.current = candidateHeight;
11254 styleHeight = `${candidateHeight}px`;
11255 }
11256 if (isPersistent) {
11257 setPreference(
11258 "core/edit-post",
11259 "metaBoxesMainOpenHeight",
11260 candidateHeight
11261 );
11262 } else {
11263 metaBoxesMainRef.current.style.height = styleHeight;
11264 if (!isShort) {
11265 separatorRef.current.ariaValueNow = getAriaValueNow(candidateHeight);
11266 }
11267 }
11268 };
11269 const bindDragGesture = useDrag(
11270 ({ movement, first, last, memo, tap, args }) => {
11271 const pane = metaBoxesMainRef.current;
11272 const [, yMovement] = movement;
11273 if (first) {
11274 pane.classList.add("is-resizing");
11275 let fromHeight = heightRef.current ?? pane.offsetHeight;
11276 if (isOpen) {
11277 if (fromHeight > max2) {
11278 fromHeight = max2;
11279 }
11280 } else {
11281 fromHeight = min2;
11282 }
11283 applyHeight(fromHeight - yMovement);
11284 return { fromHeight };
11285 }
11286 if (!first && !last && !tap) {
11287 applyHeight(memo.fromHeight - yMovement);
11288 return memo;
11289 }
11290 pane.classList.remove("is-resizing");
11291 if (tap) {
11292 const [onTap] = args;
11293 onTap?.();
11294 return;
11295 }
11296 const nextIsOpen = heightRef.current > min2;
11297 persistIsOpen(nextIsOpen);
11298 applyHeight(heightRef.current, nextIsOpen);
11299 },
11300 { keyboardDisplacement: 20, filterTaps: true }
11301 );
11302 if (!hasAnyVisible) {
11303 return;
11304 }
11305 const contents = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
11306 "div",
11307 {
11308 className: "edit-post-layout__metaboxes edit-post-meta-boxes-main__liner",
11309 hidden: !isOpen,
11310 children: [
11311 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxes, { location: "normal" }),
11312 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxes, { location: "advanced" })
11313 ]
11314 }
11315 );
11316 const isAutoHeight = openHeight === void 0;
11317 const usedOpenHeight = isShort ? "auto" : openHeight;
11318 const usedHeight = isOpen ? usedOpenHeight : min2;
11319 const usedAriaValueNow = max2 === void 0 || isAutoHeight ? 50 : getAriaValueNow(usedHeight);
11320 const paneLabel = (0, import_i18n14.__)("Meta Boxes");
11321 const toggle = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
11322 "button",
11323 {
11324 "aria-expanded": isOpen,
11325 onClick: ({ detail }) => {
11326 if (isShort || !detail) {
11327 persistIsOpen();
11328 }
11329 },
11330 ...!isShort && bindDragGesture(persistIsOpen),
11331 children: [
11332 paneLabel,
11333 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components9.Icon, { icon: isOpen ? chevron_up_default : chevron_down_default })
11334 ]
11335 }
11336 );
11337 const separator = !isShort && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
11338 /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(tooltip_exports.Root, { children: [
11339 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
11340 tooltip_exports.Trigger,
11341 {
11342 render: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
11343 "button",
11344 {
11345 ref: separatorRef,
11346 role: "separator",
11347 "aria-valuenow": usedAriaValueNow,
11348 "aria-label": (0, import_i18n14.__)("Drag to resize"),
11349 "aria-describedby": separatorHelpId,
11350 ...bindDragGesture()
11351 }
11352 )
11353 }
11354 ),
11355 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(tooltip_exports.Popup, { children: (0, import_i18n14.__)("Drag to resize") })
11356 ] }),
11357 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(VisuallyHidden, { id: separatorHelpId, children: (0, import_i18n14.__)(
11358 "Use up and down arrow keys to resize the meta box pane."
11359 ) })
11360 ] });
11361 return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
11362 navigable_region_default,
11363 {
11364 ariaLabel: paneLabel,
11365 ref: setMainRefs,
11366 className: clsx_default(
11367 "edit-post-meta-boxes-main",
11368 !isShort && "is-resizable"
11369 ),
11370 style: { height: usedHeight },
11371 children: [
11372 /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "edit-post-meta-boxes-main__presenter", children: [
11373 toggle,
11374 separator
11375 ] }),
11376 contents
11377 ]
11378 }
11379 );
11380 }
11381 function Layout({
11382 postId: initialPostId,
11383 postType: initialPostType,
11384 settings,
11385 initialEdits
11386 }) {
11387 useCommands();
11388 const { createErrorNotice } = (0, import_data24.useDispatch)(import_notices3.store);
11389 const {
11390 currentPost: { postId: currentPostId, postType: currentPostType },
11391 onNavigateToEntityRecord,
11392 onNavigateToPreviousEntityRecord
11393 } = useNavigateToEntityRecord(
11394 initialPostId,
11395 initialPostType,
11396 "post-only"
11397 );
11398 const isEditingTemplate2 = currentPostType === "wp_template";
11399 const {
11400 mode,
11401 isFullscreenActive,
11402 hasResolvedMode,
11403 hasActiveMetaboxes,
11404 hasBlockSelected,
11405 showIconLabels,
11406 isDistractionFree,
11407 showMetaBoxes,
11408 isWelcomeGuideVisible,
11409 templateId
11410 } = (0, import_data24.useSelect)(
11411 (select3) => {
11412 const { get } = select3(import_preferences10.store);
11413 const { isFeatureActive: isFeatureActive2, hasMetaBoxes: hasMetaBoxes2 } = select3(store);
11414 const { canUser, getPostType, getTemplateId } = unlock2(
11415 select3(import_core_data8.store)
11416 );
11417 const supportsTemplateMode = settings.supportsTemplateMode;
11418 const isViewable = getPostType(currentPostType)?.viewable ?? false;
11419 const canViewTemplate = canUser("read", {
11420 kind: "postType",
11421 name: "wp_template"
11422 });
11423 const { getBlockSelectionStart, isZoomOut } = unlock2(
11424 select3(import_block_editor.store)
11425 );
11426 const { getEditorMode: getEditorMode2, getDefaultRenderingMode } = unlock2(
11427 select3(import_editor17.store)
11428 );
11429 const isNotDesignPostType = !DESIGN_POST_TYPES.includes(currentPostType);
11430 const isDirectlyEditingPattern = currentPostType === "wp_block" && !onNavigateToPreviousEntityRecord;
11431 const _templateId = getTemplateId(currentPostType, currentPostId);
11432 const defaultMode = getDefaultRenderingMode(currentPostType);
11433 return {
11434 mode: getEditorMode2(),
11435 isFullscreenActive: isFeatureActive2("fullscreenMode"),
11436 hasActiveMetaboxes: hasMetaBoxes2(),
11437 hasResolvedMode: defaultMode === "template-locked" ? !!_templateId : defaultMode !== void 0,
11438 hasBlockSelected: !!getBlockSelectionStart(),
11439 showIconLabels: get("core", "showIconLabels"),
11440 isDistractionFree: get("core", "distractionFree"),
11441 showMetaBoxes: isNotDesignPostType && !isZoomOut() || isDirectlyEditingPattern,
11442 isWelcomeGuideVisible: isFeatureActive2("welcomeGuide"),
11443 templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate2 ? _templateId : null
11444 };
11445 },
11446 [
11447 currentPostType,
11448 currentPostId,
11449 isEditingTemplate2,
11450 settings.supportsTemplateMode,
11451 onNavigateToPreviousEntityRecord
11452 ]
11453 );
11454 useMetaBoxInitialization(hasActiveMetaboxes && hasResolvedMode);
11455 const commandContext = hasBlockSelected ? "block-selection-edit" : "entity-edit";
11456 useCommandContext(commandContext);
11457 const styles = useEditorStyles(settings);
11458 const editorSettings = (0, import_element28.useMemo)(
11459 () => ({
11460 ...settings,
11461 styles,
11462 onNavigateToEntityRecord,
11463 onNavigateToPreviousEntityRecord
11464 }),
11465 [
11466 settings,
11467 styles,
11468 onNavigateToEntityRecord,
11469 onNavigateToPreviousEntityRecord
11470 ]
11471 );
11472 if (showIconLabels) {
11473 document.body.classList.add("show-icon-labels");
11474 } else {
11475 document.body.classList.remove("show-icon-labels");
11476 }
11477 const navigateRegionsProps = (0, import_components9.__unstableUseNavigateRegions)();
11478 const className = clsx_default("edit-post-layout", "is-mode-" + mode, {
11479 "has-metaboxes": hasActiveMetaboxes
11480 });
11481 function onPluginAreaError(name) {
11482 createErrorNotice(
11483 (0, import_i18n14.sprintf)(
11484 /* translators: %s: plugin name */
11485 (0, import_i18n14.__)(
11486 'The "%s" plugin has encountered an error and cannot be rendered.'
11487 ),
11488 name
11489 )
11490 );
11491 }
11492 const { createSuccessNotice } = (0, import_data24.useDispatch)(import_notices3.store);
11493 const onActionPerformed = (0, import_element28.useCallback)(
11494 (actionId, items) => {
11495 switch (actionId) {
11496 case "move-to-trash":
11497 {
11498 document.location.href = (0, import_url5.addQueryArgs)("edit.php", {
11499 trashed: 1,
11500 post_type: items[0].type,
11501 ids: items[0].id
11502 });
11503 }
11504 break;
11505 case "duplicate-post":
11506 {
11507 const newItem = items[0];
11508 const title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered;
11509 createSuccessNotice(
11510 (0, import_i18n14.sprintf)(
11511 // translators: %s: Title of the created post or template, e.g: "Hello world".
11512 (0, import_i18n14.__)('"%s" successfully created.'),
11513 (0, import_html_entities.decodeEntities)(title) || (0, import_i18n14.__)("(no title)")
11514 ),
11515 {
11516 type: "snackbar",
11517 id: "duplicate-post-action",
11518 actions: [
11519 {
11520 label: (0, import_i18n14.__)("Edit"),
11521 onClick: () => {
11522 const postId = newItem.id;
11523 document.location.href = (0, import_url5.addQueryArgs)("post.php", {
11524 post: postId,
11525 action: "edit"
11526 });
11527 }
11528 }
11529 ]
11530 }
11531 );
11532 }
11533 break;
11534 }
11535 },
11536 [createSuccessNotice]
11537 );
11538 const initialPost = (0, import_element28.useMemo)(() => {
11539 return {
11540 type: initialPostType,
11541 id: initialPostId
11542 };
11543 }, [initialPostType, initialPostId]);
11544 const backButton = (0, import_compose2.useViewportMatch)("medium") && isFullscreenActive ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(back_button_default, { initialPost }) : null;
11545 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components9.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(tooltip_exports.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_editor17.ErrorBoundary, { canCopyContent: true, children: [
11546 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WelcomeGuide, { postType: currentPostType }),
11547 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { ...navigateRegionsProps, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
11548 Editor,
11549 {
11550 settings: editorSettings,
11551 initialEdits,
11552 postType: currentPostType,
11553 postId: currentPostId,
11554 templateId,
11555 className,
11556 forceIsDirty: hasActiveMetaboxes,
11557 autoFocus: !isWelcomeGuideVisible,
11558 onActionPerformed,
11559 extraSidebarPanels: showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxes, { location: "side" }),
11560 extraContent: !isDistractionFree && showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxesMain, {}),
11561 children: [
11562 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor17.PostLockedModal, {}),
11563 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(EditorInitialization, {}),
11564 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(FullscreenMode, { isActive: isFullscreenActive }),
11565 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BrowserURL, {}),
11566 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor17.UnsavedChangesWarning, {}),
11567 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor17.AutosaveMonitor, {}),
11568 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor17.LocalAutosaveMonitor, {}),
11569 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(keyboard_shortcuts_default, {}),
11570 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor17.EditorKeyboardShortcutsRegister, {}),
11571 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BlockKeyboardShortcuts, {}),
11572 currentPostType === "wp_block" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(InitPatternModal, {}),
11573 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_plugins.PluginArea, { onError: onPluginAreaError }),
11574 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(more_menu_default, {}),
11575 backButton,
11576 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_notices3.SnackbarNotices, { className: "edit-post-layout__snackbar" }),
11577 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UploadProgressSnackbar, {})
11578 ]
11579 }
11580 ) })
11581 ] }) }) });
11582 }
11583 var layout_default = Layout;
11584
11585 // packages/edit-post/build-module/deprecated.mjs
11586 var import_editor18 = __toESM(require_editor(), 1);
11587 var import_url6 = __toESM(require_url(), 1);
11588 var import_deprecated3 = __toESM(require_deprecated(), 1);
11589 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
11590 var { PluginPostExcerpt } = unlock2(import_editor18.privateApis);
11591 var isSiteEditor = (0, import_url6.getPath)(window.location.href)?.includes(
11592 "site-editor.php"
11593 );
11594 var deprecateSlot = (name) => {
11595 (0, import_deprecated3.default)(`wp.editPost.${name}`, {
11596 since: "6.6",
11597 alternative: `wp.editor.${name}`
11598 });
11599 };
11600 function PluginBlockSettingsMenuItem(props) {
11601 if (isSiteEditor) {
11602 return null;
11603 }
11604 deprecateSlot("PluginBlockSettingsMenuItem");
11605 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginBlockSettingsMenuItem, { ...props });
11606 }
11607 function PluginDocumentSettingPanel(props) {
11608 if (isSiteEditor) {
11609 return null;
11610 }
11611 deprecateSlot("PluginDocumentSettingPanel");
11612 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginDocumentSettingPanel, { ...props });
11613 }
11614 function PluginMoreMenuItem(props) {
11615 if (isSiteEditor) {
11616 return null;
11617 }
11618 deprecateSlot("PluginMoreMenuItem");
11619 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginMoreMenuItem, { ...props });
11620 }
11621 function PluginPrePublishPanel(props) {
11622 if (isSiteEditor) {
11623 return null;
11624 }
11625 deprecateSlot("PluginPrePublishPanel");
11626 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginPrePublishPanel, { ...props });
11627 }
11628 function PluginPostPublishPanel(props) {
11629 if (isSiteEditor) {
11630 return null;
11631 }
11632 deprecateSlot("PluginPostPublishPanel");
11633 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginPostPublishPanel, { ...props });
11634 }
11635 function PluginPostStatusInfo(props) {
11636 if (isSiteEditor) {
11637 return null;
11638 }
11639 deprecateSlot("PluginPostStatusInfo");
11640 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginPostStatusInfo, { ...props });
11641 }
11642 function PluginSidebar(props) {
11643 if (isSiteEditor) {
11644 return null;
11645 }
11646 deprecateSlot("PluginSidebar");
11647 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginSidebar, { ...props });
11648 }
11649 function PluginSidebarMoreMenuItem(props) {
11650 if (isSiteEditor) {
11651 return null;
11652 }
11653 deprecateSlot("PluginSidebarMoreMenuItem");
11654 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginSidebarMoreMenuItem, { ...props });
11655 }
11656 function __experimentalPluginPostExcerpt() {
11657 if (isSiteEditor) {
11658 return null;
11659 }
11660 (0, import_deprecated3.default)("wp.editPost.__experimentalPluginPostExcerpt", {
11661 since: "6.6",
11662 hint: "Core and custom panels can be access programmatically using their panel name.",
11663 link: "https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically"
11664 });
11665 return PluginPostExcerpt;
11666 }
11667
11668 // packages/edit-post/build-module/index.mjs
11669 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
11670 var {
11671 BackButton: __experimentalMainDashboardButton,
11672 registerCoreBlockBindingsSources
11673 } = unlock2(import_editor19.privateApis);
11674 var { enablePreloadMultiUse, clearPreloadedData } = unlock2(
11675 import_api_fetch2.default.privateApis
11676 );
11677 function initializeEditor(id, postType, postId, settings, initialEdits) {
11678 const isMediumOrBigger = window.matchMedia("(min-width: 782px)").matches;
11679 const target = document.getElementById(id);
11680 const root = (0, import_element29.createRoot)(target);
11681 (0, import_data25.dispatch)(import_preferences11.store).setDefaults("core/edit-post", {
11682 fullscreenMode: true,
11683 themeStyles: true,
11684 welcomeGuide: true,
11685 welcomeGuideTemplate: true
11686 });
11687 (0, import_data25.dispatch)(import_preferences11.store).setDefaults("core", {
11688 allowRightClickOverrides: true,
11689 editorMode: "visual",
11690 editorTool: "edit",
11691 fixedToolbar: false,
11692 hiddenBlockTypes: [],
11693 inactivePanels: [],
11694 openPanels: ["post-status"],
11695 showBlockBreadcrumbs: true,
11696 showIconLabels: false,
11697 showListViewByDefault: false,
11698 enableChoosePatternModal: true,
11699 isPublishSidebarEnabled: true,
11700 showCollaborationCursor: false,
11701 showCollaborationJoinNotifications: true,
11702 showCollaborationLeaveNotifications: true,
11703 showCollaborationPostSaveNotifications: true
11704 });
11705 if (window.__clientSideMediaProcessing) {
11706 (0, import_data25.dispatch)(import_preferences11.store).setDefaults("core/media", {
11707 requireApproval: true,
11708 optimizeOnUpload: true
11709 });
11710 }
11711 (0, import_data25.dispatch)(import_blocks2.store).reapplyBlockTypeFilters();
11712 if (isMediumOrBigger && (0, import_data25.select)(import_preferences11.store).get("core", "showListViewByDefault") && !(0, import_data25.select)(import_preferences11.store).get("core", "distractionFree")) {
11713 (0, import_data25.dispatch)(import_editor19.store).setIsListViewOpened(true);
11714 }
11715 (0, import_block_library2.registerCoreBlocks)();
11716 registerCoreBlockBindingsSources();
11717 (0, import_widgets.registerLegacyWidgetBlock)({ inserter: false });
11718 (0, import_widgets.registerWidgetGroupBlock)({ inserter: false });
11719 if (true) {
11720 (0, import_block_library2.__experimentalRegisterExperimentalCoreBlocks)({
11721 enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks
11722 });
11723 }
11724 const documentMode = document.compatMode === "CSS1Compat" ? "Standards" : "Quirks";
11725 if (documentMode !== "Standards") {
11726 console.warn(
11727 "Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins."
11728 );
11729 }
11730 const isIphone = window.navigator.userAgent.indexOf("iPhone") !== -1;
11731 if (isIphone) {
11732 window.addEventListener("scroll", (event) => {
11733 const editorScrollContainer = document.getElementsByClassName(
11734 "interface-interface-skeleton__body"
11735 )[0];
11736 if (event.target === document) {
11737 if (window.scrollY > 100) {
11738 editorScrollContainer.scrollTop = editorScrollContainer.scrollTop + window.scrollY;
11739 }
11740 if (document.getElementsByClassName("is-mode-visual")[0]) {
11741 window.scrollTo(0, 0);
11742 }
11743 }
11744 });
11745 }
11746 window.addEventListener("dragover", (e) => e.preventDefault(), false);
11747 window.addEventListener("drop", (e) => e.preventDefault(), false);
11748 enablePreloadMultiUse();
11749 const preloadedResolutions = preloadResolutions(postType, postId);
11750 preloadedResolutions.finally(() => {
11751 clearPreloadedData();
11752 if (postType && postId) {
11753 const post = (0, import_data25.select)(import_core_data9.store).getEntityRecord(
11754 "postType",
11755 postType,
11756 postId
11757 );
11758 if (post) {
11759 (0, import_data25.dispatch)(import_editor19.store).setupEditor(
11760 post,
11761 initialEdits,
11762 settings.template
11763 );
11764 }
11765 }
11766 root.render(
11767 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_element29.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11768 layout_default,
11769 {
11770 settings,
11771 postId,
11772 postType,
11773 initialEdits
11774 }
11775 ) })
11776 );
11777 });
11778 return root;
11779 }
11780 async function preloadResolutions(postType, postId) {
11781 const core = (0, import_data25.resolveSelect)(import_core_data9.store);
11782 const coreSelect = (0, import_data25.select)(import_core_data9.store);
11783 try {
11784 await Promise.all([
11785 core.getCurrentUser(),
11786 core.getEntitiesConfig("postType"),
11787 core.getEntitiesConfig("taxonomy"),
11788 core.getEntitiesConfig("root"),
11789 core.getEntityRecords("root", "taxonomy"),
11790 core.getCurrentTheme(),
11791 // Forward-resolver alias of `getCurrentTheme` with its own
11792 // resolution metadata, so it needs a separate kick.
11793 core.getThemeSupports(),
11794 core.getBlockPatternCategories(),
11795 core.__experimentalGetCurrentGlobalStylesId(),
11796 core.__experimentalGetCurrentThemeBaseGlobalStyles(),
11797 core.__experimentalGetCurrentThemeGlobalStylesVariations(),
11798 core.getEntityRecord("root", "__unstableBase"),
11799 core.getEntityRecord("root", "site"),
11800 core.canUser("read", { kind: "root", name: "site" }),
11801 core.canUser("create", { kind: "postType", name: "attachment" }),
11802 core.canUser("create", { kind: "postType", name: "page" }),
11803 core.canUser("create", { kind: "postType", name: "wp_block" }),
11804 core.canUser("create", {
11805 kind: "postType",
11806 name: "wp_template"
11807 }),
11808 // The DataForm-based inspector requests the entity form config
11809 // when the document sidebar mounts. The args must match the
11810 // `useViewConfig` call in `@wordpress/views` exactly for the
11811 // resolution (and its preload entry) to be shared.
11812 ...postType && window?.__experimentalDataFormInspector ? [
11813 unlock2(core).getViewConfig("postType", postType, {
11814 fields: "form"
11815 })
11816 ] : [],
11817 // Per-post resolvers. `getPostType` and `getEditedEntityRecord`
11818 // are shorthand/forward-resolver aliases with their own
11819 // resolution metadata, so they need separate kicks.
11820 ...postType && postId ? [
11821 core.getPostType(postType),
11822 core.getEntityRecord("postType", postType, postId),
11823 core.getEditedEntityRecord(
11824 "postType",
11825 postType,
11826 postId
11827 ),
11828 core.getAutosaves(postType, postId),
11829 core.getDefaultTemplateId({ slug: "front-page" }),
11830 core.canUser("create", {
11831 kind: "postType",
11832 name: postType
11833 })
11834 ] : []
11835 ]);
11836 const tasks = [];
11837 const globalStylesId = coreSelect.__experimentalGetCurrentGlobalStylesId();
11838 if (globalStylesId) {
11839 tasks.push(
11840 core.getEntityRecord("root", "globalStyles", globalStylesId),
11841 core.canUser("read", {
11842 kind: "root",
11843 name: "globalStyles",
11844 id: globalStylesId
11845 })
11846 );
11847 }
11848 if (postType && postId) {
11849 const post = coreSelect.getEntityRecord(
11850 "postType",
11851 postType,
11852 postId
11853 );
11854 if (post) {
11855 let slug = "page" === postType ? "page" : "single-" + postType;
11856 if (post.slug) {
11857 slug += "-" + post.slug;
11858 }
11859 tasks.push(core.getDefaultTemplateId({ slug }));
11860 if (post.author) {
11861 tasks.push(
11862 core.getUser(post.author, {
11863 context: "view",
11864 _fields: "id,name"
11865 })
11866 );
11867 }
11868 }
11869 }
11870 if (tasks.length) {
11871 await Promise.all(tasks);
11872 }
11873 } catch {
11874 }
11875 }
11876 function reinitializeEditor() {
11877 (0, import_deprecated4.default)("wp.editPost.reinitializeEditor", {
11878 since: "6.2",
11879 version: "6.3"
11880 });
11881 }
11882 return __toCommonJS(index_exports);
11883 })();
11884 /*! Bundled license information:
11885
11886 use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
11887 (**
11888 * @license React
11889 * use-sync-external-store-shim.development.js
11890 *
11891 * Copyright (c) Meta Platforms, Inc. and affiliates.
11892 *
11893 * This source code is licensed under the MIT license found in the
11894 * LICENSE file in the root directory of this source tree.
11895 *)
11896
11897 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
11898 (**
11899 * @license React
11900 * use-sync-external-store-shim/with-selector.development.js
11901 *
11902 * Copyright (c) Meta Platforms, Inc. and affiliates.
11903 *
11904 * This source code is licensed under the MIT license found in the
11905 * LICENSE file in the root directory of this source tree.
11906 *)
11907 */
11908 //# sourceMappingURL=index.js.map
11909