PluginProbe
Gutenberg / 23.3.0
Gutenberg v23.3.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.3.0, at build/scripts/edit-post/index.js

11,687 lines 430.3 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 === React48.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 useLayoutEffect4(
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 React48 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState16 = React48.useState, useEffect17 = React48.useEffect, useLayoutEffect4 = React48.useLayoutEffect, useDebugValue2 = React48.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 !== React48.useSyncExternalStore ? React48.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 React48 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef21 = React48.useRef, useEffect17 = React48.useEffect, useMemo17 = React48.useMemo, useDebugValue2 = React48.useDebugValue;
218 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
219 var instRef = useRef21(null);
220 if (null === instRef.current) {
221 var inst = { hasValue: false, value: null };
222 instRef.current = inst;
223 } else inst = instRef.current;
224 instRef = useMemo17(
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_blocks3 = __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_element26 = __toESM(require_element(), 1);
414 var import_data26 = __toESM(require_data(), 1);
415 var import_preferences11 = __toESM(require_preferences(), 1);
416 var import_widgets = __toESM(require_widgets(), 1);
417 var import_editor20 = __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/esm/useStableCallback.js
438 var React2 = __toESM(require_react(), 1);
439
440 // node_modules/@base-ui/utils/esm/useRefWithInit.js
441 var React = __toESM(require_react(), 1);
442 var UNINITIALIZED = {};
443 function useRefWithInit(init, initArg) {
444 const ref = React.useRef(UNINITIALIZED);
445 if (ref.current === UNINITIALIZED) {
446 ref.current = init(initArg);
447 }
448 return ref;
449 }
450
451 // node_modules/@base-ui/utils/esm/useStableCallback.js
452 var useInsertionEffect = React2[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)];
453 var useSafeInsertionEffect = (
454 // React 17 doesn't have useInsertionEffect.
455 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
456 useInsertionEffect !== React2.useLayoutEffect ? useInsertionEffect : (fn) => fn()
457 );
458 function useStableCallback(callback) {
459 const stable = useRefWithInit(createStableCallback).current;
460 stable.next = callback;
461 useSafeInsertionEffect(stable.effect);
462 return stable.trampoline;
463 }
464 function createStableCallback() {
465 const stable = {
466 next: void 0,
467 callback: assertNotCalled,
468 trampoline: (...args) => stable.callback?.(...args),
469 effect: () => {
470 stable.callback = stable.next;
471 }
472 };
473 return stable;
474 }
475 function assertNotCalled() {
476 if (true) {
477 throw (
478 /* minify-error-disabled */
479 new Error("Base UI: Cannot call an event handler while rendering.")
480 );
481 }
482 }
483
484 // node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js
485 var React3 = __toESM(require_react(), 1);
486 var noop = () => {
487 };
488 var useIsoLayoutEffect = typeof document !== "undefined" ? React3.useLayoutEffect : noop;
489
490 // node_modules/@base-ui/utils/esm/warn.js
491 var set;
492 if (true) {
493 set = /* @__PURE__ */ new Set();
494 }
495 function warn(...messages) {
496 if (true) {
497 const messageKey = messages.join(" ");
498 if (!set.has(messageKey)) {
499 set.add(messageKey);
500 console.warn(`Base UI: ${messageKey}`);
501 }
502 }
503 }
504
505 // node_modules/@base-ui/react/esm/internals/direction-context/DirectionContext.js
506 var React4 = __toESM(require_react(), 1);
507 var DirectionContext = /* @__PURE__ */ React4.createContext(void 0);
508 if (true) DirectionContext.displayName = "DirectionContext";
509 function useDirection() {
510 const context = React4.useContext(DirectionContext);
511 return context?.direction ?? "ltr";
512 }
513
514 // node_modules/@base-ui/react/esm/internals/useRenderElement.js
515 var React7 = __toESM(require_react(), 1);
516
517 // node_modules/@base-ui/utils/esm/useMergedRefs.js
518 function useMergedRefs(a, b, c, d) {
519 const forkRef = useRefWithInit(createForkRef).current;
520 if (didChange(forkRef, a, b, c, d)) {
521 update(forkRef, [a, b, c, d]);
522 }
523 return forkRef.callback;
524 }
525 function useMergedRefsN(refs) {
526 const forkRef = useRefWithInit(createForkRef).current;
527 if (didChangeN(forkRef, refs)) {
528 update(forkRef, refs);
529 }
530 return forkRef.callback;
531 }
532 function createForkRef() {
533 return {
534 callback: null,
535 cleanup: null,
536 refs: []
537 };
538 }
539 function didChange(forkRef, a, b, c, d) {
540 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
541 }
542 function didChangeN(forkRef, newRefs) {
543 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]);
544 }
545 function update(forkRef, refs) {
546 forkRef.refs = refs;
547 if (refs.every((ref) => ref == null)) {
548 forkRef.callback = null;
549 return;
550 }
551 forkRef.callback = (instance) => {
552 if (forkRef.cleanup) {
553 forkRef.cleanup();
554 forkRef.cleanup = null;
555 }
556 if (instance != null) {
557 const cleanupCallbacks = Array(refs.length).fill(null);
558 for (let i = 0; i < refs.length; i += 1) {
559 const ref = refs[i];
560 if (ref == null) {
561 continue;
562 }
563 switch (typeof ref) {
564 case "function": {
565 const refCleanup = ref(instance);
566 if (typeof refCleanup === "function") {
567 cleanupCallbacks[i] = refCleanup;
568 }
569 break;
570 }
571 case "object": {
572 ref.current = instance;
573 break;
574 }
575 default:
576 }
577 }
578 forkRef.cleanup = () => {
579 for (let i = 0; i < refs.length; i += 1) {
580 const ref = refs[i];
581 if (ref == null) {
582 continue;
583 }
584 switch (typeof ref) {
585 case "function": {
586 const cleanupCallback = cleanupCallbacks[i];
587 if (typeof cleanupCallback === "function") {
588 cleanupCallback();
589 } else {
590 ref(null);
591 }
592 break;
593 }
594 case "object": {
595 ref.current = null;
596 break;
597 }
598 default:
599 }
600 }
601 };
602 }
603 };
604 }
605
606 // node_modules/@base-ui/utils/esm/getReactElementRef.js
607 var React6 = __toESM(require_react(), 1);
608
609 // node_modules/@base-ui/utils/esm/reactVersion.js
610 var React5 = __toESM(require_react(), 1);
611 var majorVersion = parseInt(React5.version, 10);
612 function isReactVersionAtLeast(reactVersionToCheck) {
613 return majorVersion >= reactVersionToCheck;
614 }
615
616 // node_modules/@base-ui/utils/esm/getReactElementRef.js
617 function getReactElementRef(element) {
618 if (!/* @__PURE__ */ React6.isValidElement(element)) {
619 return null;
620 }
621 const reactElement = element;
622 const propsWithRef = reactElement.props;
623 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
624 }
625
626 // node_modules/@base-ui/utils/esm/mergeObjects.js
627 function mergeObjects(a, b) {
628 if (a && !b) {
629 return a;
630 }
631 if (!a && b) {
632 return b;
633 }
634 if (a || b) {
635 return {
636 ...a,
637 ...b
638 };
639 }
640 return void 0;
641 }
642
643 // node_modules/@base-ui/utils/esm/empty.js
644 function NOOP() {
645 }
646 var EMPTY_ARRAY = Object.freeze([]);
647 var EMPTY_OBJECT = Object.freeze({});
648
649 // node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js
650 function getStateAttributesProps(state, customMapping) {
651 const props = {};
652 for (const key in state) {
653 const value = state[key];
654 if (customMapping?.hasOwnProperty(key)) {
655 const customProps = customMapping[key](value);
656 if (customProps != null) {
657 Object.assign(props, customProps);
658 }
659 continue;
660 }
661 if (value === true) {
662 props[`data-${key.toLowerCase()}`] = "";
663 } else if (value) {
664 props[`data-${key.toLowerCase()}`] = value.toString();
665 }
666 }
667 return props;
668 }
669
670 // node_modules/@base-ui/react/esm/utils/resolveClassName.js
671 function resolveClassName(className, state) {
672 return typeof className === "function" ? className(state) : className;
673 }
674
675 // node_modules/@base-ui/react/esm/utils/resolveStyle.js
676 function resolveStyle(style, state) {
677 return typeof style === "function" ? style(state) : style;
678 }
679
680 // node_modules/@base-ui/react/esm/merge-props/mergeProps.js
681 var EMPTY_PROPS = {};
682 function mergeProps(a, b, c, d, e) {
683 if (!c && !d && !e && !a) {
684 return createInitialMergedProps(b);
685 }
686 let merged = createInitialMergedProps(a);
687 if (b) {
688 merged = mergeInto(merged, b);
689 }
690 if (c) {
691 merged = mergeInto(merged, c);
692 }
693 if (d) {
694 merged = mergeInto(merged, d);
695 }
696 if (e) {
697 merged = mergeInto(merged, e);
698 }
699 return merged;
700 }
701 function mergePropsN(props) {
702 if (props.length === 0) {
703 return EMPTY_PROPS;
704 }
705 if (props.length === 1) {
706 return createInitialMergedProps(props[0]);
707 }
708 let merged = createInitialMergedProps(props[0]);
709 for (let i = 1; i < props.length; i += 1) {
710 merged = mergeInto(merged, props[i]);
711 }
712 return merged;
713 }
714 function createInitialMergedProps(inputProps) {
715 if (isPropsGetter(inputProps)) {
716 return {
717 ...resolvePropsGetter(inputProps, EMPTY_PROPS)
718 };
719 }
720 return copyInitialProps(inputProps);
721 }
722 function mergeInto(merged, inputProps) {
723 if (isPropsGetter(inputProps)) {
724 return resolvePropsGetter(inputProps, merged);
725 }
726 return mutablyMergeInto(merged, inputProps);
727 }
728 function copyInitialProps(inputProps) {
729 const copiedProps = {
730 ...inputProps
731 };
732 for (const propName in copiedProps) {
733 const propValue = copiedProps[propName];
734 if (isEventHandler(propName, propValue)) {
735 copiedProps[propName] = wrapEventHandler(propValue);
736 }
737 }
738 return copiedProps;
739 }
740 function mutablyMergeInto(mergedProps, externalProps) {
741 if (!externalProps) {
742 return mergedProps;
743 }
744 for (const propName in externalProps) {
745 const externalPropValue = externalProps[propName];
746 switch (propName) {
747 case "style": {
748 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
749 break;
750 }
751 case "className": {
752 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
753 break;
754 }
755 default: {
756 if (isEventHandler(propName, externalPropValue)) {
757 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
758 } else {
759 mergedProps[propName] = externalPropValue;
760 }
761 }
762 }
763 }
764 return mergedProps;
765 }
766 function isEventHandler(key, value) {
767 const code0 = key.charCodeAt(0);
768 const code1 = key.charCodeAt(1);
769 const code2 = key.charCodeAt(2);
770 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
771 }
772 function isPropsGetter(inputProps) {
773 return typeof inputProps === "function";
774 }
775 function resolvePropsGetter(inputProps, previousProps) {
776 if (isPropsGetter(inputProps)) {
777 return inputProps(previousProps);
778 }
779 return inputProps ?? EMPTY_PROPS;
780 }
781 function mergeEventHandlers(ourHandler, theirHandler) {
782 if (!theirHandler) {
783 return ourHandler;
784 }
785 if (!ourHandler) {
786 return wrapEventHandler(theirHandler);
787 }
788 return (...args) => {
789 const event = args[0];
790 if (isSyntheticEvent(event)) {
791 const baseUIEvent = event;
792 makeEventPreventable(baseUIEvent);
793 const result2 = theirHandler(...args);
794 if (!baseUIEvent.baseUIHandlerPrevented) {
795 ourHandler?.(...args);
796 }
797 return result2;
798 }
799 const result = theirHandler(...args);
800 ourHandler?.(...args);
801 return result;
802 };
803 }
804 function wrapEventHandler(handler) {
805 if (!handler) {
806 return handler;
807 }
808 return (...args) => {
809 const event = args[0];
810 if (isSyntheticEvent(event)) {
811 makeEventPreventable(event);
812 }
813 return handler(...args);
814 };
815 }
816 function makeEventPreventable(event) {
817 event.preventBaseUIHandler = () => {
818 event.baseUIHandlerPrevented = true;
819 };
820 return event;
821 }
822 function mergeClassNames(ourClassName, theirClassName) {
823 if (theirClassName) {
824 if (ourClassName) {
825 return theirClassName + " " + ourClassName;
826 }
827 return theirClassName;
828 }
829 return ourClassName;
830 }
831 function isSyntheticEvent(event) {
832 return event != null && typeof event === "object" && "nativeEvent" in event;
833 }
834
835 // node_modules/@base-ui/react/esm/internals/useRenderElement.js
836 var import_react = __toESM(require_react(), 1);
837 function useRenderElement(element, componentProps, params = {}) {
838 const renderProp = componentProps.render;
839 const outProps = useRenderElementProps(componentProps, params);
840 if (params.enabled === false) {
841 return null;
842 }
843 const state = params.state ?? EMPTY_OBJECT;
844 return evaluateRenderProp(element, renderProp, outProps, state);
845 }
846 function useRenderElementProps(componentProps, params = {}) {
847 const {
848 className: classNameProp,
849 style: styleProp,
850 render: renderProp
851 } = componentProps;
852 const {
853 state = EMPTY_OBJECT,
854 ref,
855 props,
856 stateAttributesMapping: stateAttributesMapping3,
857 enabled = true
858 } = params;
859 const className = enabled ? resolveClassName(classNameProp, state) : void 0;
860 const style = enabled ? resolveStyle(styleProp, state) : void 0;
861 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT;
862 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
863 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
864 if (typeof document !== "undefined") {
865 if (!enabled) {
866 useMergedRefs(null, null);
867 } else if (Array.isArray(ref)) {
868 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
869 } else {
870 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
871 }
872 }
873 if (!enabled) {
874 return EMPTY_OBJECT;
875 }
876 if (className !== void 0) {
877 outProps.className = mergeClassNames(outProps.className, className);
878 }
879 if (style !== void 0) {
880 outProps.style = mergeObjects(outProps.style, style);
881 }
882 return outProps;
883 }
884 function resolveRenderFunctionProps(props) {
885 if (Array.isArray(props)) {
886 return mergePropsN(props);
887 }
888 return mergeProps(void 0, props);
889 }
890 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
891 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
892 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
893 function evaluateRenderProp(element, render, props, state) {
894 if (render) {
895 if (typeof render === "function") {
896 if (true) {
897 warnIfRenderPropLooksLikeComponent(render);
898 }
899 return render(props, state);
900 }
901 const mergedProps = mergeProps(props, render.props);
902 mergedProps.ref = props.ref;
903 let newElement = render;
904 if (newElement?.$$typeof === REACT_LAZY_TYPE) {
905 const children = React7.Children.toArray(render);
906 newElement = children[0];
907 }
908 if (true) {
909 if (!/* @__PURE__ */ React7.isValidElement(newElement)) {
910 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"));
911 }
912 }
913 return /* @__PURE__ */ React7.cloneElement(newElement, mergedProps);
914 }
915 if (element) {
916 if (typeof element === "string") {
917 return renderTag(element, props);
918 }
919 }
920 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
921 }
922 function warnIfRenderPropLooksLikeComponent(renderFn) {
923 const functionName = renderFn.name;
924 if (functionName.length === 0) {
925 return;
926 }
927 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
928 return;
929 }
930 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
931 return;
932 }
933 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");
934 }
935 function renderTag(Tag, props) {
936 if (Tag === "button") {
937 return /* @__PURE__ */ (0, import_react.createElement)("button", {
938 type: "button",
939 ...props,
940 key: props.key
941 });
942 }
943 if (Tag === "img") {
944 return /* @__PURE__ */ (0, import_react.createElement)("img", {
945 alt: "",
946 ...props,
947 key: props.key
948 });
949 }
950 return /* @__PURE__ */ React7.createElement(Tag, props);
951 }
952
953 // node_modules/@base-ui/react/esm/internals/reason-parts.js
954 var reason_parts_exports = {};
955 __export(reason_parts_exports, {
956 cancelOpen: () => cancelOpen,
957 chipRemovePress: () => chipRemovePress,
958 clearPress: () => clearPress,
959 closePress: () => closePress,
960 closeWatcher: () => closeWatcher,
961 decrementPress: () => decrementPress,
962 disabled: () => disabled,
963 drag: () => drag,
964 escapeKey: () => escapeKey,
965 focusOut: () => focusOut,
966 imperativeAction: () => imperativeAction,
967 incrementPress: () => incrementPress,
968 inputBlur: () => inputBlur,
969 inputChange: () => inputChange,
970 inputClear: () => inputClear,
971 inputPaste: () => inputPaste,
972 inputPress: () => inputPress,
973 itemPress: () => itemPress,
974 keyboard: () => keyboard,
975 linkPress: () => linkPress,
976 listNavigation: () => listNavigation,
977 none: () => none,
978 outsidePress: () => outsidePress,
979 pointer: () => pointer,
980 scrub: () => scrub,
981 siblingOpen: () => siblingOpen,
982 swipe: () => swipe,
983 trackPress: () => trackPress,
984 triggerFocus: () => triggerFocus,
985 triggerHover: () => triggerHover,
986 triggerPress: () => triggerPress,
987 wheel: () => wheel,
988 windowResize: () => windowResize
989 });
990 var none = "none";
991 var triggerPress = "trigger-press";
992 var triggerHover = "trigger-hover";
993 var triggerFocus = "trigger-focus";
994 var outsidePress = "outside-press";
995 var itemPress = "item-press";
996 var closePress = "close-press";
997 var linkPress = "link-press";
998 var clearPress = "clear-press";
999 var chipRemovePress = "chip-remove-press";
1000 var trackPress = "track-press";
1001 var incrementPress = "increment-press";
1002 var decrementPress = "decrement-press";
1003 var inputChange = "input-change";
1004 var inputClear = "input-clear";
1005 var inputBlur = "input-blur";
1006 var inputPaste = "input-paste";
1007 var inputPress = "input-press";
1008 var focusOut = "focus-out";
1009 var escapeKey = "escape-key";
1010 var closeWatcher = "close-watcher";
1011 var listNavigation = "list-navigation";
1012 var keyboard = "keyboard";
1013 var pointer = "pointer";
1014 var drag = "drag";
1015 var wheel = "wheel";
1016 var scrub = "scrub";
1017 var cancelOpen = "cancel-open";
1018 var siblingOpen = "sibling-open";
1019 var disabled = "disabled";
1020 var imperativeAction = "imperative-action";
1021 var swipe = "swipe";
1022 var windowResize = "window-resize";
1023
1024 // node_modules/@base-ui/react/esm/internals/createBaseUIEventDetails.js
1025 function createChangeEventDetails(reason, event, trigger, customProperties) {
1026 let canceled = false;
1027 let allowPropagation = false;
1028 const custom = customProperties ?? EMPTY_OBJECT;
1029 const details = {
1030 reason,
1031 event: event ?? new Event("base-ui"),
1032 cancel() {
1033 canceled = true;
1034 },
1035 allowPropagation() {
1036 allowPropagation = true;
1037 },
1038 get isCanceled() {
1039 return canceled;
1040 },
1041 get isPropagationAllowed() {
1042 return allowPropagation;
1043 },
1044 trigger,
1045 ...custom
1046 };
1047 return details;
1048 }
1049
1050 // node_modules/@base-ui/utils/esm/useId.js
1051 var React9 = __toESM(require_react(), 1);
1052
1053 // node_modules/@base-ui/utils/esm/safeReact.js
1054 var React8 = __toESM(require_react(), 1);
1055 var SafeReact = {
1056 ...React8
1057 };
1058
1059 // node_modules/@base-ui/utils/esm/useId.js
1060 var globalId = 0;
1061 function useGlobalId(idOverride, prefix = "mui") {
1062 const [defaultId, setDefaultId] = React9.useState(idOverride);
1063 const id = idOverride || defaultId;
1064 React9.useEffect(() => {
1065 if (defaultId == null) {
1066 globalId += 1;
1067 setDefaultId(`${prefix}-${globalId}`);
1068 }
1069 }, [defaultId, prefix]);
1070 return id;
1071 }
1072 var maybeReactUseId = SafeReact.useId;
1073 function useId(idOverride, prefix) {
1074 if (maybeReactUseId !== void 0) {
1075 const reactId = maybeReactUseId();
1076 return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
1077 }
1078 return useGlobalId(idOverride, prefix);
1079 }
1080
1081 // node_modules/@base-ui/react/esm/internals/useBaseUiId.js
1082 function useBaseUiId(idOverride) {
1083 return useId(idOverride, "base-ui");
1084 }
1085
1086 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js
1087 var ReactDOM = __toESM(require_react_dom(), 1);
1088
1089 // node_modules/@base-ui/utils/esm/useOnMount.js
1090 var React10 = __toESM(require_react(), 1);
1091 var EMPTY = [];
1092 function useOnMount(fn) {
1093 React10.useEffect(fn, EMPTY);
1094 }
1095
1096 // node_modules/@base-ui/utils/esm/useAnimationFrame.js
1097 var EMPTY2 = null;
1098 var LAST_RAF = globalThis.requestAnimationFrame;
1099 var Scheduler = class {
1100 /* This implementation uses an array as a backing data-structure for frame callbacks.
1101 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
1102 * never calls the native `cancelAnimationFrame` if there are no frames left. This can
1103 * be much more efficient if there is a call pattern that alterns as
1104 * "request-cancel-request-cancel-…".
1105 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
1106 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
1107 callbacks = [];
1108 callbacksCount = 0;
1109 nextId = 1;
1110 startId = 1;
1111 isScheduled = false;
1112 tick = (timestamp) => {
1113 this.isScheduled = false;
1114 const currentCallbacks = this.callbacks;
1115 const currentCallbacksCount = this.callbacksCount;
1116 this.callbacks = [];
1117 this.callbacksCount = 0;
1118 this.startId = this.nextId;
1119 if (currentCallbacksCount > 0) {
1120 for (let i = 0; i < currentCallbacks.length; i += 1) {
1121 currentCallbacks[i]?.(timestamp);
1122 }
1123 }
1124 };
1125 request(fn) {
1126 const id = this.nextId;
1127 this.nextId += 1;
1128 this.callbacks.push(fn);
1129 this.callbacksCount += 1;
1130 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
1131 if (!this.isScheduled || didRAFChange) {
1132 requestAnimationFrame(this.tick);
1133 this.isScheduled = true;
1134 }
1135 return id;
1136 }
1137 cancel(id) {
1138 const index2 = id - this.startId;
1139 if (index2 < 0 || index2 >= this.callbacks.length) {
1140 return;
1141 }
1142 this.callbacks[index2] = null;
1143 this.callbacksCount -= 1;
1144 }
1145 };
1146 var scheduler = new Scheduler();
1147 var AnimationFrame = class _AnimationFrame {
1148 static create() {
1149 return new _AnimationFrame();
1150 }
1151 static request(fn) {
1152 return scheduler.request(fn);
1153 }
1154 static cancel(id) {
1155 return scheduler.cancel(id);
1156 }
1157 currentId = EMPTY2;
1158 /**
1159 * Executes `fn` after `delay`, clearing any previously scheduled call.
1160 */
1161 request(fn) {
1162 this.cancel();
1163 this.currentId = scheduler.request(() => {
1164 this.currentId = EMPTY2;
1165 fn();
1166 });
1167 }
1168 cancel = () => {
1169 if (this.currentId !== EMPTY2) {
1170 scheduler.cancel(this.currentId);
1171 this.currentId = EMPTY2;
1172 }
1173 };
1174 disposeEffect = () => {
1175 return this.cancel;
1176 };
1177 };
1178 function useAnimationFrame() {
1179 const timeout = useRefWithInit(AnimationFrame.create).current;
1180 useOnMount(timeout.disposeEffect);
1181 return timeout;
1182 }
1183
1184 // node_modules/@base-ui/react/esm/utils/resolveRef.js
1185 function resolveRef(maybeRef) {
1186 if (maybeRef == null) {
1187 return maybeRef;
1188 }
1189 return "current" in maybeRef ? maybeRef.current : maybeRef;
1190 }
1191
1192 // node_modules/@base-ui/react/esm/internals/stateAttributesMapping.js
1193 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) {
1194 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style";
1195 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style";
1196 return TransitionStatusDataAttributes2;
1197 })({});
1198 var STARTING_HOOK = {
1199 [TransitionStatusDataAttributes.startingStyle]: ""
1200 };
1201 var ENDING_HOOK = {
1202 [TransitionStatusDataAttributes.endingStyle]: ""
1203 };
1204 var transitionStatusMapping = {
1205 transitionStatus(value) {
1206 if (value === "starting") {
1207 return STARTING_HOOK;
1208 }
1209 if (value === "ending") {
1210 return ENDING_HOOK;
1211 }
1212 return null;
1213 }
1214 };
1215
1216 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js
1217 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) {
1218 const frame = useAnimationFrame();
1219 return useStableCallback((fnToExecute, signal = null) => {
1220 frame.cancel();
1221 const element = resolveRef(elementOrRef);
1222 if (element == null) {
1223 return;
1224 }
1225 const resolvedElement = element;
1226 const done = () => {
1227 ReactDOM.flushSync(fnToExecute);
1228 };
1229 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
1230 fnToExecute();
1231 return;
1232 }
1233 function exec() {
1234 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => {
1235 if (!signal?.aborted) {
1236 done();
1237 }
1238 }).catch(() => {
1239 if (treatAbortedAsFinished) {
1240 if (!signal?.aborted) {
1241 done();
1242 }
1243 return;
1244 }
1245 const currentAnimations = resolvedElement.getAnimations();
1246 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) {
1247 exec();
1248 }
1249 });
1250 }
1251 if (waitForStartingStyleRemoved) {
1252 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle;
1253 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1254 frame.request(exec);
1255 return;
1256 }
1257 const attributeObserver = new MutationObserver(() => {
1258 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1259 attributeObserver.disconnect();
1260 exec();
1261 }
1262 });
1263 attributeObserver.observe(resolvedElement, {
1264 attributes: true,
1265 attributeFilter: [startingStyleAttribute]
1266 });
1267 signal?.addEventListener("abort", () => attributeObserver.disconnect(), {
1268 once: true
1269 });
1270 return;
1271 }
1272 frame.request(exec);
1273 });
1274 }
1275
1276 // node_modules/@base-ui/react/esm/internals/useTransitionStatus.js
1277 var React11 = __toESM(require_react(), 1);
1278 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {
1279 const [transitionStatus, setTransitionStatus] = React11.useState(open && enableIdleState ? "idle" : void 0);
1280 const [mounted, setMounted] = React11.useState(open);
1281 if (open && !mounted) {
1282 setMounted(true);
1283 setTransitionStatus("starting");
1284 }
1285 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) {
1286 setTransitionStatus("ending");
1287 }
1288 if (!open && !mounted && transitionStatus === "ending") {
1289 setTransitionStatus(void 0);
1290 }
1291 useIsoLayoutEffect(() => {
1292 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) {
1293 const frame = AnimationFrame.request(() => {
1294 setTransitionStatus("ending");
1295 });
1296 return () => {
1297 AnimationFrame.cancel(frame);
1298 };
1299 }
1300 return void 0;
1301 }, [open, mounted, transitionStatus, deferEndingState]);
1302 useIsoLayoutEffect(() => {
1303 if (!open || enableIdleState) {
1304 return void 0;
1305 }
1306 const frame = AnimationFrame.request(() => {
1307 setTransitionStatus(void 0);
1308 });
1309 return () => {
1310 AnimationFrame.cancel(frame);
1311 };
1312 }, [enableIdleState, open]);
1313 useIsoLayoutEffect(() => {
1314 if (!open || !enableIdleState) {
1315 return void 0;
1316 }
1317 if (open && mounted && transitionStatus !== "idle") {
1318 setTransitionStatus("starting");
1319 }
1320 const frame = AnimationFrame.request(() => {
1321 setTransitionStatus("idle");
1322 });
1323 return () => {
1324 AnimationFrame.cancel(frame);
1325 };
1326 }, [enableIdleState, open, mounted, transitionStatus]);
1327 return {
1328 mounted,
1329 setMounted,
1330 transitionStatus
1331 };
1332 }
1333
1334 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
1335 function hasWindow() {
1336 return typeof window !== "undefined";
1337 }
1338 function getNodeName(node) {
1339 if (isNode(node)) {
1340 return (node.nodeName || "").toLowerCase();
1341 }
1342 return "#document";
1343 }
1344 function getWindow(node) {
1345 var _node$ownerDocument;
1346 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1347 }
1348 function getDocumentElement(node) {
1349 var _ref;
1350 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1351 }
1352 function isNode(value) {
1353 if (!hasWindow()) {
1354 return false;
1355 }
1356 return value instanceof Node || value instanceof getWindow(value).Node;
1357 }
1358 function isElement(value) {
1359 if (!hasWindow()) {
1360 return false;
1361 }
1362 return value instanceof Element || value instanceof getWindow(value).Element;
1363 }
1364 function isHTMLElement(value) {
1365 if (!hasWindow()) {
1366 return false;
1367 }
1368 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1369 }
1370 function isShadowRoot(value) {
1371 if (!hasWindow() || typeof ShadowRoot === "undefined") {
1372 return false;
1373 }
1374 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1375 }
1376 function isOverflowElement(element) {
1377 const {
1378 overflow,
1379 overflowX,
1380 overflowY,
1381 display
1382 } = getComputedStyle2(element);
1383 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
1384 }
1385 function isTableElement(element) {
1386 return /^(table|td|th)$/.test(getNodeName(element));
1387 }
1388 function isTopLayer(element) {
1389 try {
1390 if (element.matches(":popover-open")) {
1391 return true;
1392 }
1393 } catch (_e) {
1394 }
1395 try {
1396 return element.matches(":modal");
1397 } catch (_e) {
1398 return false;
1399 }
1400 }
1401 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
1402 var containRe = /paint|layout|strict|content/;
1403 var isNotNone = (value) => !!value && value !== "none";
1404 var isWebKitValue;
1405 function isContainingBlock(elementOrCss) {
1406 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
1407 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 || "");
1408 }
1409 function getContainingBlock(element) {
1410 let currentNode = getParentNode(element);
1411 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1412 if (isContainingBlock(currentNode)) {
1413 return currentNode;
1414 } else if (isTopLayer(currentNode)) {
1415 return null;
1416 }
1417 currentNode = getParentNode(currentNode);
1418 }
1419 return null;
1420 }
1421 function isWebKit() {
1422 if (isWebKitValue == null) {
1423 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
1424 }
1425 return isWebKitValue;
1426 }
1427 function isLastTraversableNode(node) {
1428 return /^(html|body|#document)$/.test(getNodeName(node));
1429 }
1430 function getComputedStyle2(element) {
1431 return getWindow(element).getComputedStyle(element);
1432 }
1433 function getNodeScroll(element) {
1434 if (isElement(element)) {
1435 return {
1436 scrollLeft: element.scrollLeft,
1437 scrollTop: element.scrollTop
1438 };
1439 }
1440 return {
1441 scrollLeft: element.scrollX,
1442 scrollTop: element.scrollY
1443 };
1444 }
1445 function getParentNode(node) {
1446 if (getNodeName(node) === "html") {
1447 return node;
1448 }
1449 const result = (
1450 // Step into the shadow DOM of the parent of a slotted node.
1451 node.assignedSlot || // DOM Element detected.
1452 node.parentNode || // ShadowRoot detected.
1453 isShadowRoot(node) && node.host || // Fallback.
1454 getDocumentElement(node)
1455 );
1456 return isShadowRoot(result) ? result.host : result;
1457 }
1458 function getNearestOverflowAncestor(node) {
1459 const parentNode = getParentNode(node);
1460 if (isLastTraversableNode(parentNode)) {
1461 return node.ownerDocument ? node.ownerDocument.body : node.body;
1462 }
1463 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1464 return parentNode;
1465 }
1466 return getNearestOverflowAncestor(parentNode);
1467 }
1468 function getOverflowAncestors(node, list, traverseIframes) {
1469 var _node$ownerDocument2;
1470 if (list === void 0) {
1471 list = [];
1472 }
1473 if (traverseIframes === void 0) {
1474 traverseIframes = true;
1475 }
1476 const scrollableAncestor = getNearestOverflowAncestor(node);
1477 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1478 const win = getWindow(scrollableAncestor);
1479 if (isBody) {
1480 const frameElement = getFrameElement(win);
1481 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1482 } else {
1483 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1484 }
1485 }
1486 function getFrameElement(win) {
1487 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1488 }
1489
1490 // node_modules/@base-ui/utils/esm/detectBrowser.js
1491 var hasNavigator = typeof navigator !== "undefined";
1492 var nav = getNavigatorData();
1493 var platform = getPlatform();
1494 var userAgent = getUserAgent();
1495 var isWebKit2 = typeof CSS === "undefined" || !CSS.supports ? false : CSS.supports("-webkit-backdrop-filter:none");
1496 var isIOS = (
1497 // iPads can claim to be MacIntel
1498 nav.platform === "MacIntel" && nav.maxTouchPoints > 1 ? true : /iP(hone|ad|od)|iOS/.test(nav.platform)
1499 );
1500 var isFirefox = hasNavigator && /firefox/i.test(userAgent);
1501 var isSafari = hasNavigator && /apple/i.test(navigator.vendor);
1502 var isEdge = hasNavigator && /Edg/i.test(userAgent);
1503 var isAndroid = hasNavigator && /android/i.test(platform) || /android/i.test(userAgent);
1504 var isMac = hasNavigator && platform.toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
1505 var isJSDOM = userAgent.includes("jsdom/");
1506 function getNavigatorData() {
1507 if (!hasNavigator) {
1508 return {
1509 platform: "",
1510 maxTouchPoints: -1
1511 };
1512 }
1513 const uaData = navigator.userAgentData;
1514 if (uaData?.platform) {
1515 return {
1516 platform: uaData.platform,
1517 maxTouchPoints: navigator.maxTouchPoints
1518 };
1519 }
1520 return {
1521 platform: navigator.platform ?? "",
1522 maxTouchPoints: navigator.maxTouchPoints ?? -1
1523 };
1524 }
1525 function getUserAgent() {
1526 if (!hasNavigator) {
1527 return "";
1528 }
1529 const uaData = navigator.userAgentData;
1530 if (uaData && Array.isArray(uaData.brands)) {
1531 return uaData.brands.map(({
1532 brand,
1533 version: version2
1534 }) => `${brand}/${version2}`).join(" ");
1535 }
1536 return navigator.userAgent;
1537 }
1538 function getPlatform() {
1539 if (!hasNavigator) {
1540 return "";
1541 }
1542 const uaData = navigator.userAgentData;
1543 if (uaData?.platform) {
1544 return uaData.platform;
1545 }
1546 return navigator.platform ?? "";
1547 }
1548
1549 // node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js
1550 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable";
1551 var ACTIVE_KEY = "active";
1552 var SELECTED_KEY = "selected";
1553 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
1554
1555 // node_modules/@base-ui/react/esm/internals/shadowDom.js
1556 function activeElement(doc) {
1557 let element = doc.activeElement;
1558 while (element?.shadowRoot?.activeElement != null) {
1559 element = element.shadowRoot.activeElement;
1560 }
1561 return element;
1562 }
1563 function contains(parent, child) {
1564 if (!parent || !child) {
1565 return false;
1566 }
1567 const rootNode = child.getRootNode?.();
1568 if (parent.contains(child)) {
1569 return true;
1570 }
1571 if (rootNode && isShadowRoot(rootNode)) {
1572 let next = child;
1573 while (next) {
1574 if (parent === next) {
1575 return true;
1576 }
1577 next = next.parentNode || next.host;
1578 }
1579 }
1580 return false;
1581 }
1582 function getTarget(event) {
1583 if ("composedPath" in event) {
1584 return event.composedPath()[0];
1585 }
1586 return event.target;
1587 }
1588
1589 // node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js
1590 function isTargetInsideEnabledTrigger(target, triggerElements) {
1591 if (!isElement(target)) {
1592 return false;
1593 }
1594 const targetElement = target;
1595 if (triggerElements.hasElement(targetElement)) {
1596 return !targetElement.hasAttribute("data-trigger-disabled");
1597 }
1598 for (const [, trigger] of triggerElements.entries()) {
1599 if (contains(trigger, targetElement)) {
1600 return !trigger.hasAttribute("data-trigger-disabled");
1601 }
1602 }
1603 return false;
1604 }
1605 function isEventTargetWithin(event, node) {
1606 if (node == null) {
1607 return false;
1608 }
1609 if ("composedPath" in event) {
1610 return event.composedPath().includes(node);
1611 }
1612 const eventAgain = event;
1613 return eventAgain.target != null && node.contains(eventAgain.target);
1614 }
1615 function isRootElement(element) {
1616 return element.matches("html,body");
1617 }
1618 function isTypeableElement(element) {
1619 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
1620 }
1621 function isInteractiveElement(element) {
1622 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null;
1623 }
1624 function matchesFocusVisible(element) {
1625 if (!element || isJSDOM) {
1626 return true;
1627 }
1628 try {
1629 return element.matches(":focus-visible");
1630 } catch (_e) {
1631 return true;
1632 }
1633 }
1634
1635 // node_modules/@base-ui/react/esm/floating-ui-react/utils/nodes.js
1636 function getNodeChildren(nodes, id, onlyOpenChildren = true) {
1637 const directChildren = nodes.filter((node) => node.parentId === id);
1638 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
1639 }
1640
1641 // node_modules/@base-ui/react/esm/floating-ui-react/utils/event.js
1642 function isReactEvent(event) {
1643 return "nativeEvent" in event;
1644 }
1645 function isMouseLikePointerType(pointerType, strict) {
1646 const values = ["mouse", "pen"];
1647 if (!strict) {
1648 values.push("", void 0);
1649 }
1650 return values.includes(pointerType);
1651 }
1652 function isClickLikeEvent(event) {
1653 const type = event.type;
1654 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
1655 }
1656
1657 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
1658 var sides = ["top", "right", "bottom", "left"];
1659 var min = Math.min;
1660 var max = Math.max;
1661 var round = Math.round;
1662 var floor = Math.floor;
1663 var createCoords = (v) => ({
1664 x: v,
1665 y: v
1666 });
1667 var oppositeSideMap = {
1668 left: "right",
1669 right: "left",
1670 bottom: "top",
1671 top: "bottom"
1672 };
1673 function clamp(start, value, end) {
1674 return max(start, min(value, end));
1675 }
1676 function evaluate(value, param) {
1677 return typeof value === "function" ? value(param) : value;
1678 }
1679 function getSide(placement) {
1680 return placement.split("-")[0];
1681 }
1682 function getAlignment(placement) {
1683 return placement.split("-")[1];
1684 }
1685 function getOppositeAxis(axis) {
1686 return axis === "x" ? "y" : "x";
1687 }
1688 function getAxisLength(axis) {
1689 return axis === "y" ? "height" : "width";
1690 }
1691 function getSideAxis(placement) {
1692 const firstChar = placement[0];
1693 return firstChar === "t" || firstChar === "b" ? "y" : "x";
1694 }
1695 function getAlignmentAxis(placement) {
1696 return getOppositeAxis(getSideAxis(placement));
1697 }
1698 function getAlignmentSides(placement, rects, rtl) {
1699 if (rtl === void 0) {
1700 rtl = false;
1701 }
1702 const alignment = getAlignment(placement);
1703 const alignmentAxis = getAlignmentAxis(placement);
1704 const length = getAxisLength(alignmentAxis);
1705 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
1706 if (rects.reference[length] > rects.floating[length]) {
1707 mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
1708 }
1709 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
1710 }
1711 function getExpandedPlacements(placement) {
1712 const oppositePlacement = getOppositePlacement(placement);
1713 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
1714 }
1715 function getOppositeAlignmentPlacement(placement) {
1716 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
1717 }
1718 var lrPlacement = ["left", "right"];
1719 var rlPlacement = ["right", "left"];
1720 var tbPlacement = ["top", "bottom"];
1721 var btPlacement = ["bottom", "top"];
1722 function getSideList(side, isStart, rtl) {
1723 switch (side) {
1724 case "top":
1725 case "bottom":
1726 if (rtl) return isStart ? rlPlacement : lrPlacement;
1727 return isStart ? lrPlacement : rlPlacement;
1728 case "left":
1729 case "right":
1730 return isStart ? tbPlacement : btPlacement;
1731 default:
1732 return [];
1733 }
1734 }
1735 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
1736 const alignment = getAlignment(placement);
1737 let list = getSideList(getSide(placement), direction === "start", rtl);
1738 if (alignment) {
1739 list = list.map((side) => side + "-" + alignment);
1740 if (flipAlignment) {
1741 list = list.concat(list.map(getOppositeAlignmentPlacement));
1742 }
1743 }
1744 return list;
1745 }
1746 function getOppositePlacement(placement) {
1747 const side = getSide(placement);
1748 return oppositeSideMap[side] + placement.slice(side.length);
1749 }
1750 function expandPaddingObject(padding) {
1751 return {
1752 top: 0,
1753 right: 0,
1754 bottom: 0,
1755 left: 0,
1756 ...padding
1757 };
1758 }
1759 function getPaddingObject(padding) {
1760 return typeof padding !== "number" ? expandPaddingObject(padding) : {
1761 top: padding,
1762 right: padding,
1763 bottom: padding,
1764 left: padding
1765 };
1766 }
1767 function rectToClientRect(rect) {
1768 const {
1769 x,
1770 y,
1771 width,
1772 height
1773 } = rect;
1774 return {
1775 width,
1776 height,
1777 top: y,
1778 left: x,
1779 right: x + width,
1780 bottom: y + height,
1781 x,
1782 y
1783 };
1784 }
1785
1786 // node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js
1787 function isHiddenByStyles(styles) {
1788 return styles.visibility === "hidden" || styles.visibility === "collapse";
1789 }
1790 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) {
1791 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
1792 return false;
1793 }
1794 if (typeof element.checkVisibility === "function") {
1795 return element.checkVisibility();
1796 }
1797 return styles.display !== "none" && styles.display !== "contents";
1798 }
1799
1800 // node_modules/@base-ui/utils/esm/owner.js
1801 function ownerDocument(node) {
1802 return node?.ownerDocument || document;
1803 }
1804
1805 // node_modules/@base-ui/react/esm/floating-ui-react/utils/tabbable.js
1806 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';
1807 function getParentElement(element) {
1808 const assignedSlot = element.assignedSlot;
1809 if (assignedSlot) {
1810 return assignedSlot;
1811 }
1812 if (element.parentElement) {
1813 return element.parentElement;
1814 }
1815 const rootNode = element.getRootNode();
1816 return isShadowRoot(rootNode) ? rootNode.host : null;
1817 }
1818 function getDetailsSummary(details) {
1819 for (const child of Array.from(details.children)) {
1820 if (getNodeName(child) === "summary") {
1821 return child;
1822 }
1823 }
1824 return null;
1825 }
1826 function isWithinOpenDetailsSummary(element, details) {
1827 const summary = getDetailsSummary(details);
1828 return !!summary && (element === summary || contains(summary, element));
1829 }
1830 function isFocusableCandidate(element) {
1831 const nodeName = element ? getNodeName(element) : "";
1832 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");
1833 }
1834 function isFocusableElement(element) {
1835 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) {
1836 return false;
1837 }
1838 for (let current = element; current; current = getParentElement(current)) {
1839 const isAncestor = current !== element;
1840 const isSlot = getNodeName(current) === "slot";
1841 if (current.hasAttribute("inert")) {
1842 return false;
1843 }
1844 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {
1845 return false;
1846 }
1847 }
1848 return true;
1849 }
1850 function isVisibleInTabbableTree(element, isAncestor) {
1851 const styles = getComputedStyle2(element);
1852 if (!isAncestor) {
1853 return isElementVisible(element, styles);
1854 }
1855 return styles.display !== "none";
1856 }
1857 function getTabIndex(element) {
1858 const tabIndex = element.tabIndex;
1859 if (tabIndex < 0) {
1860 const nodeName = getNodeName(element);
1861 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) {
1862 return 0;
1863 }
1864 }
1865 return tabIndex;
1866 }
1867 function getNamedRadioInput(element) {
1868 if (getNodeName(element) !== "input") {
1869 return null;
1870 }
1871 const input = element;
1872 return input.type === "radio" && input.name !== "" ? input : null;
1873 }
1874 function isTabbableRadio(element, candidates) {
1875 const input = getNamedRadioInput(element);
1876 if (!input) {
1877 return true;
1878 }
1879 const checkedRadio = candidates.find((candidate) => {
1880 const radio = getNamedRadioInput(candidate);
1881 return radio?.name === input.name && radio.form === input.form && radio.checked;
1882 });
1883 if (checkedRadio) {
1884 return checkedRadio === input;
1885 }
1886 return candidates.find((candidate) => {
1887 const radio = getNamedRadioInput(candidate);
1888 return radio?.name === input.name && radio.form === input.form;
1889 }) === input;
1890 }
1891 function getComposedChildren(container) {
1892 if (isHTMLElement(container) && getNodeName(container) === "slot") {
1893 const assignedElements = container.assignedElements({
1894 flatten: true
1895 });
1896 if (assignedElements.length > 0) {
1897 return assignedElements;
1898 }
1899 }
1900 if (isHTMLElement(container) && container.shadowRoot) {
1901 return Array.from(container.shadowRoot.children);
1902 }
1903 return Array.from(container.children);
1904 }
1905 function appendCandidates(container, list) {
1906 getComposedChildren(container).forEach((child) => {
1907 if (isFocusableCandidate(child)) {
1908 list.push(child);
1909 }
1910 appendCandidates(child, list);
1911 });
1912 }
1913 function appendMatchingElements(container, selector, list) {
1914 getComposedChildren(container).forEach((child) => {
1915 if (isHTMLElement(child) && child.matches(selector)) {
1916 list.push(child);
1917 }
1918 appendMatchingElements(child, selector, list);
1919 });
1920 }
1921 function focusable(container) {
1922 const candidates = [];
1923 appendCandidates(container, candidates);
1924 return candidates.filter(isFocusableElement);
1925 }
1926 function tabbable(container) {
1927 const candidates = focusable(container);
1928 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));
1929 }
1930 function getTabbableIn(container, dir) {
1931 const list = tabbable(container);
1932 const len = list.length;
1933 if (len === 0) {
1934 return void 0;
1935 }
1936 const active = activeElement(ownerDocument(container));
1937 const index2 = list.indexOf(active);
1938 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir;
1939 return list[nextIndex];
1940 }
1941 function getNextTabbable(referenceElement) {
1942 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;
1943 }
1944 function getPreviousTabbable(referenceElement) {
1945 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
1946 }
1947 function isOutsideEvent(event, container) {
1948 const containerElement = container || event.currentTarget;
1949 const relatedTarget = event.relatedTarget;
1950 return !relatedTarget || !contains(containerElement, relatedTarget);
1951 }
1952 function disableFocusInside(container) {
1953 const tabbableElements = tabbable(container);
1954 tabbableElements.forEach((element) => {
1955 element.dataset.tabindex = element.getAttribute("tabindex") || "";
1956 element.setAttribute("tabindex", "-1");
1957 });
1958 }
1959 function enableFocusInside(container) {
1960 const elements = [];
1961 appendMatchingElements(container, "[data-tabindex]", elements);
1962 elements.forEach((element) => {
1963 const tabindex = element.dataset.tabindex;
1964 delete element.dataset.tabindex;
1965 if (tabindex) {
1966 element.setAttribute("tabindex", tabindex);
1967 } else {
1968 element.removeAttribute("tabindex");
1969 }
1970 });
1971 }
1972
1973 // node_modules/@base-ui/utils/esm/addEventListener.js
1974 function addEventListener(target, type, listener, options) {
1975 target.addEventListener(type, listener, options);
1976 return () => {
1977 target.removeEventListener(type, listener, options);
1978 };
1979 }
1980
1981 // node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js
1982 var React12 = __toESM(require_react(), 1);
1983 function useOpenChangeComplete(parameters) {
1984 const {
1985 enabled = true,
1986 open,
1987 ref,
1988 onComplete: onCompleteParam
1989 } = parameters;
1990 const onComplete = useStableCallback(onCompleteParam);
1991 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false);
1992 React12.useEffect(() => {
1993 if (!enabled) {
1994 return void 0;
1995 }
1996 const abortController = new AbortController();
1997 runOnceAnimationsFinish(onComplete, abortController.signal);
1998 return () => {
1999 abortController.abort();
2000 };
2001 }, [enabled, open, onComplete, runOnceAnimationsFinish]);
2002 }
2003
2004 // node_modules/@base-ui/utils/esm/useOnFirstRender.js
2005 var React13 = __toESM(require_react(), 1);
2006 function useOnFirstRender(fn) {
2007 const ref = React13.useRef(true);
2008 if (ref.current) {
2009 ref.current = false;
2010 fn();
2011 }
2012 }
2013
2014 // node_modules/@base-ui/utils/esm/useTimeout.js
2015 var EMPTY3 = 0;
2016 var Timeout = class _Timeout {
2017 static create() {
2018 return new _Timeout();
2019 }
2020 currentId = EMPTY3;
2021 /**
2022 * Executes `fn` after `delay`, clearing any previously scheduled call.
2023 */
2024 start(delay, fn) {
2025 this.clear();
2026 this.currentId = setTimeout(() => {
2027 this.currentId = EMPTY3;
2028 fn();
2029 }, delay);
2030 }
2031 isStarted() {
2032 return this.currentId !== EMPTY3;
2033 }
2034 clear = () => {
2035 if (this.currentId !== EMPTY3) {
2036 clearTimeout(this.currentId);
2037 this.currentId = EMPTY3;
2038 }
2039 };
2040 disposeEffect = () => {
2041 return this.clear;
2042 };
2043 };
2044 function useTimeout() {
2045 const timeout = useRefWithInit(Timeout.create).current;
2046 useOnMount(timeout.disposeEffect);
2047 return timeout;
2048 }
2049
2050 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js
2051 var React14 = __toESM(require_react(), 1);
2052
2053 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverShared.js
2054 function resolveValue(value, pointerType) {
2055 if (pointerType != null && !isMouseLikePointerType(pointerType)) {
2056 return 0;
2057 }
2058 if (typeof value === "function") {
2059 return value();
2060 }
2061 return value;
2062 }
2063 function getDelay(value, prop, pointerType) {
2064 const result = resolveValue(value, pointerType);
2065 if (typeof result === "number") {
2066 return result;
2067 }
2068 return result?.[prop];
2069 }
2070 function getRestMs(value) {
2071 if (typeof value === "function") {
2072 return value();
2073 }
2074 return value;
2075 }
2076 function isClickLikeOpenEvent(openEventType, interactedInside) {
2077 return interactedInside || openEventType === "click" || openEventType === "mousedown";
2078 }
2079
2080 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js
2081 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
2082 var FloatingDelayGroupContext = /* @__PURE__ */ React14.createContext({
2083 hasProvider: false,
2084 timeoutMs: 0,
2085 delayRef: {
2086 current: 0
2087 },
2088 initialDelayRef: {
2089 current: 0
2090 },
2091 timeout: new Timeout(),
2092 currentIdRef: {
2093 current: null
2094 },
2095 currentContextRef: {
2096 current: null
2097 }
2098 });
2099 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext";
2100 function FloatingDelayGroup(props) {
2101 const {
2102 children,
2103 delay,
2104 timeoutMs = 0
2105 } = props;
2106 const delayRef = React14.useRef(delay);
2107 const initialDelayRef = React14.useRef(delay);
2108 const currentIdRef = React14.useRef(null);
2109 const currentContextRef = React14.useRef(null);
2110 const timeout = useTimeout();
2111 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, {
2112 value: React14.useMemo(() => ({
2113 hasProvider: true,
2114 delayRef,
2115 initialDelayRef,
2116 currentIdRef,
2117 timeoutMs,
2118 currentContextRef,
2119 timeout
2120 }), [timeoutMs, timeout]),
2121 children
2122 });
2123 }
2124 function useDelayGroup(context, options = {
2125 open: false
2126 }) {
2127 const store2 = "rootStore" in context ? context.rootStore : context;
2128 const floatingId = store2.useState("floatingId");
2129 const {
2130 open
2131 } = options;
2132 const groupContext = React14.useContext(FloatingDelayGroupContext);
2133 const {
2134 currentIdRef,
2135 delayRef,
2136 timeoutMs,
2137 initialDelayRef,
2138 currentContextRef,
2139 hasProvider,
2140 timeout
2141 } = groupContext;
2142 const [isInstantPhase, setIsInstantPhase] = React14.useState(false);
2143 useIsoLayoutEffect(() => {
2144 function unset() {
2145 setIsInstantPhase(false);
2146 currentContextRef.current?.setIsInstantPhase(false);
2147 currentIdRef.current = null;
2148 currentContextRef.current = null;
2149 delayRef.current = initialDelayRef.current;
2150 }
2151 if (!currentIdRef.current) {
2152 return void 0;
2153 }
2154 if (!open && currentIdRef.current === floatingId) {
2155 setIsInstantPhase(false);
2156 if (timeoutMs) {
2157 const closingId = floatingId;
2158 timeout.start(timeoutMs, () => {
2159 if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) {
2160 return;
2161 }
2162 unset();
2163 });
2164 return () => {
2165 timeout.clear();
2166 };
2167 }
2168 unset();
2169 }
2170 return void 0;
2171 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]);
2172 useIsoLayoutEffect(() => {
2173 if (!open) {
2174 return;
2175 }
2176 const prevContext = currentContextRef.current;
2177 const prevId = currentIdRef.current;
2178 timeout.clear();
2179 currentContextRef.current = {
2180 onOpenChange: store2.setOpen,
2181 setIsInstantPhase
2182 };
2183 currentIdRef.current = floatingId;
2184 delayRef.current = {
2185 open: 0,
2186 close: getDelay(initialDelayRef.current, "close")
2187 };
2188 if (prevId !== null && prevId !== floatingId) {
2189 setIsInstantPhase(true);
2190 prevContext?.setIsInstantPhase(true);
2191 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none));
2192 } else {
2193 setIsInstantPhase(false);
2194 prevContext?.setIsInstantPhase(false);
2195 }
2196 }, [open, floatingId, store2, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout]);
2197 useIsoLayoutEffect(() => {
2198 return () => {
2199 currentContextRef.current = null;
2200 };
2201 }, [currentContextRef]);
2202 return React14.useMemo(() => ({
2203 hasProvider,
2204 delayRef,
2205 isInstantPhase
2206 }), [hasProvider, delayRef, isInstantPhase]);
2207 }
2208
2209 // node_modules/@base-ui/utils/esm/mergeCleanups.js
2210 function mergeCleanups(...cleanups) {
2211 return () => {
2212 for (let i = 0; i < cleanups.length; i += 1) {
2213 const cleanup = cleanups[i];
2214 if (cleanup) {
2215 cleanup();
2216 }
2217 }
2218 };
2219 }
2220
2221 // node_modules/@base-ui/utils/esm/useValueAsRef.js
2222 function useValueAsRef(value) {
2223 const latest = useRefWithInit(createLatestRef, value).current;
2224 latest.next = value;
2225 useIsoLayoutEffect(latest.effect);
2226 return latest;
2227 }
2228 function createLatestRef(value) {
2229 const latest = {
2230 current: value,
2231 next: value,
2232 effect: () => {
2233 latest.current = latest.next;
2234 }
2235 };
2236 return latest;
2237 }
2238
2239 // node_modules/@base-ui/react/esm/utils/FocusGuard.js
2240 var React15 = __toESM(require_react(), 1);
2241
2242 // node_modules/@base-ui/utils/esm/visuallyHidden.js
2243 var visuallyHiddenBase = {
2244 clipPath: "inset(50%)",
2245 overflow: "hidden",
2246 whiteSpace: "nowrap",
2247 border: 0,
2248 padding: 0,
2249 width: 1,
2250 height: 1,
2251 margin: -1
2252 };
2253 var visuallyHidden = {
2254 ...visuallyHiddenBase,
2255 position: "fixed",
2256 top: 0,
2257 left: 0
2258 };
2259 var visuallyHiddenInput = {
2260 ...visuallyHiddenBase,
2261 position: "absolute"
2262 };
2263
2264 // node_modules/@base-ui/react/esm/utils/FocusGuard.js
2265 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
2266 var FocusGuard = /* @__PURE__ */ React15.forwardRef(function FocusGuard2(props, ref) {
2267 const [role, setRole] = React15.useState();
2268 useIsoLayoutEffect(() => {
2269 if (isSafari) {
2270 setRole("button");
2271 }
2272 }, []);
2273 const restProps = {
2274 tabIndex: 0,
2275 // Role is only for VoiceOver
2276 role
2277 };
2278 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
2279 ...props,
2280 ref,
2281 style: visuallyHidden,
2282 "aria-hidden": role ? void 0 : true,
2283 ...restProps,
2284 "data-base-ui-focus-guard": ""
2285 });
2286 });
2287 if (true) FocusGuard.displayName = "FocusGuard";
2288
2289 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createAttribute.js
2290 function createAttribute(name) {
2291 return `data-base-ui-${name}`;
2292 }
2293
2294 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js
2295 var React16 = __toESM(require_react(), 1);
2296 var ReactDOM2 = __toESM(require_react_dom(), 1);
2297
2298 // node_modules/@base-ui/react/esm/internals/constants.js
2299 var DISABLED_TRANSITIONS_STYLE = {
2300 style: {
2301 transition: "none"
2302 }
2303 };
2304 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
2305 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
2306 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
2307 var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
2308 var POPUP_COLLISION_AVOIDANCE = {
2309 fallbackAxisSide: "end"
2310 };
2311 var ownerVisuallyHidden = {
2312 clipPath: "inset(50%)",
2313 position: "fixed",
2314 top: 0,
2315 left: 0
2316 };
2317
2318 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js
2319 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
2320 var PortalContext = /* @__PURE__ */ React16.createContext(null);
2321 if (true) PortalContext.displayName = "PortalContext";
2322 var usePortalContext = () => React16.useContext(PortalContext);
2323 var attr = createAttribute("portal");
2324 function useFloatingPortalNode(props = {}) {
2325 const {
2326 ref,
2327 container: containerProp,
2328 componentProps = EMPTY_OBJECT,
2329 elementProps
2330 } = props;
2331 const uniqueId = useId();
2332 const portalContext = usePortalContext();
2333 const parentPortalNode = portalContext?.portalNode;
2334 const [containerElement, setContainerElement] = React16.useState(null);
2335 const [portalNode, setPortalNode] = React16.useState(null);
2336 const setPortalNodeRef = useStableCallback((node) => {
2337 if (node !== null) {
2338 setPortalNode(node);
2339 }
2340 });
2341 const containerRef = React16.useRef(null);
2342 useIsoLayoutEffect(() => {
2343 if (containerProp === null) {
2344 if (containerRef.current) {
2345 containerRef.current = null;
2346 setPortalNode(null);
2347 setContainerElement(null);
2348 }
2349 return;
2350 }
2351 if (uniqueId == null) {
2352 return;
2353 }
2354 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
2355 if (resolvedContainer == null) {
2356 if (containerRef.current) {
2357 containerRef.current = null;
2358 setPortalNode(null);
2359 setContainerElement(null);
2360 }
2361 return;
2362 }
2363 if (containerRef.current !== resolvedContainer) {
2364 containerRef.current = resolvedContainer;
2365 setPortalNode(null);
2366 setContainerElement(resolvedContainer);
2367 }
2368 }, [containerProp, parentPortalNode, uniqueId]);
2369 const portalElement = useRenderElement("div", componentProps, {
2370 ref: [ref, setPortalNodeRef],
2371 props: [{
2372 id: uniqueId,
2373 [attr]: ""
2374 }, elementProps]
2375 });
2376 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null;
2377 return {
2378 portalNode,
2379 portalSubtree
2380 };
2381 }
2382 var FloatingPortal = /* @__PURE__ */ React16.forwardRef(function FloatingPortal2(componentProps, forwardedRef) {
2383 const {
2384 children,
2385 container,
2386 className,
2387 render,
2388 renderGuards,
2389 style,
2390 ...elementProps
2391 } = componentProps;
2392 const {
2393 portalNode,
2394 portalSubtree
2395 } = useFloatingPortalNode({
2396 container,
2397 ref: forwardedRef,
2398 componentProps,
2399 elementProps
2400 });
2401 const beforeOutsideRef = React16.useRef(null);
2402 const afterOutsideRef = React16.useRef(null);
2403 const beforeInsideRef = React16.useRef(null);
2404 const afterInsideRef = React16.useRef(null);
2405 const [focusManagerState, setFocusManagerState] = React16.useState(null);
2406 const focusInsideDisabledRef = React16.useRef(false);
2407 const modal = focusManagerState?.modal;
2408 const open = focusManagerState?.open;
2409 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
2410 React16.useEffect(() => {
2411 if (!portalNode || modal) {
2412 return void 0;
2413 }
2414 function onFocus(event) {
2415 if (portalNode && event.relatedTarget && isOutsideEvent(event)) {
2416 if (event.type === "focusin") {
2417 if (focusInsideDisabledRef.current) {
2418 enableFocusInside(portalNode);
2419 focusInsideDisabledRef.current = false;
2420 }
2421 } else {
2422 disableFocusInside(portalNode);
2423 focusInsideDisabledRef.current = true;
2424 }
2425 }
2426 }
2427 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true));
2428 }, [portalNode, modal]);
2429 React16.useEffect(() => {
2430 if (!portalNode || open !== false) {
2431 return;
2432 }
2433 enableFocusInside(portalNode);
2434 focusInsideDisabledRef.current = false;
2435 }, [open, portalNode]);
2436 const portalContextValue = React16.useMemo(() => ({
2437 beforeOutsideRef,
2438 afterOutsideRef,
2439 beforeInsideRef,
2440 afterInsideRef,
2441 portalNode,
2442 setFocusManagerState
2443 }), [portalNode]);
2444 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React16.Fragment, {
2445 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, {
2446 value: portalContextValue,
2447 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
2448 "data-type": "outside",
2449 ref: beforeOutsideRef,
2450 onFocus: (event) => {
2451 if (isOutsideEvent(event, portalNode)) {
2452 beforeInsideRef.current?.focus();
2453 } else {
2454 const domReference = focusManagerState ? focusManagerState.domReference : null;
2455 const prevTabbable = getPreviousTabbable(domReference);
2456 prevTabbable?.focus();
2457 }
2458 }
2459 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", {
2460 "aria-owns": portalNode.id,
2461 style: ownerVisuallyHidden
2462 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
2463 "data-type": "outside",
2464 ref: afterOutsideRef,
2465 onFocus: (event) => {
2466 if (isOutsideEvent(event, portalNode)) {
2467 afterInsideRef.current?.focus();
2468 } else {
2469 const domReference = focusManagerState ? focusManagerState.domReference : null;
2470 const nextTabbable = getNextTabbable(domReference);
2471 nextTabbable?.focus();
2472 if (focusManagerState?.closeOnFocusOut) {
2473 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent));
2474 }
2475 }
2476 }
2477 })]
2478 })]
2479 });
2480 });
2481 if (true) FloatingPortal.displayName = "FloatingPortal";
2482
2483 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js
2484 var React17 = __toESM(require_react(), 1);
2485
2486 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createEventEmitter.js
2487 function createEventEmitter() {
2488 const map = /* @__PURE__ */ new Map();
2489 return {
2490 emit(event, data) {
2491 map.get(event)?.forEach((listener) => listener(data));
2492 },
2493 on(event, listener) {
2494 if (!map.has(event)) {
2495 map.set(event, /* @__PURE__ */ new Set());
2496 }
2497 map.get(event).add(listener);
2498 },
2499 off(event, listener) {
2500 map.get(event)?.delete(listener);
2501 }
2502 };
2503 }
2504
2505 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js
2506 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
2507 var FloatingNodeContext = /* @__PURE__ */ React17.createContext(null);
2508 if (true) FloatingNodeContext.displayName = "FloatingNodeContext";
2509 var FloatingTreeContext = /* @__PURE__ */ React17.createContext(null);
2510 if (true) FloatingTreeContext.displayName = "FloatingTreeContext";
2511 var useFloatingParentNodeId = () => React17.useContext(FloatingNodeContext)?.id || null;
2512 var useFloatingTree = (externalTree) => {
2513 const contextTree = React17.useContext(FloatingTreeContext);
2514 return externalTree ?? contextTree;
2515 };
2516
2517 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useClientPoint.js
2518 var React18 = __toESM(require_react(), 1);
2519 function createVirtualElement(domElement, data) {
2520 let offsetX = null;
2521 let offsetY = null;
2522 let isAutoUpdateEvent = false;
2523 return {
2524 contextElement: domElement || void 0,
2525 getBoundingClientRect() {
2526 const domRect = domElement?.getBoundingClientRect() || {
2527 width: 0,
2528 height: 0,
2529 x: 0,
2530 y: 0
2531 };
2532 const isXAxis = data.axis === "x" || data.axis === "both";
2533 const isYAxis = data.axis === "y" || data.axis === "both";
2534 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch";
2535 let width = domRect.width;
2536 let height = domRect.height;
2537 let x = domRect.x;
2538 let y = domRect.y;
2539 if (offsetX == null && data.x && isXAxis) {
2540 offsetX = domRect.x - data.x;
2541 }
2542 if (offsetY == null && data.y && isYAxis) {
2543 offsetY = domRect.y - data.y;
2544 }
2545 x -= offsetX || 0;
2546 y -= offsetY || 0;
2547 width = 0;
2548 height = 0;
2549 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
2550 width = data.axis === "y" ? domRect.width : 0;
2551 height = data.axis === "x" ? domRect.height : 0;
2552 x = isXAxis && data.x != null ? data.x : x;
2553 y = isYAxis && data.y != null ? data.y : y;
2554 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
2555 height = data.axis === "x" ? domRect.height : height;
2556 width = data.axis === "y" ? domRect.width : width;
2557 }
2558 isAutoUpdateEvent = true;
2559 return {
2560 width,
2561 height,
2562 x,
2563 y,
2564 top: y,
2565 right: x + width,
2566 bottom: y + height,
2567 left: x
2568 };
2569 }
2570 };
2571 }
2572 function isMouseBasedEvent(event) {
2573 return event != null && event.clientX != null;
2574 }
2575 function useClientPoint(context, props = {}) {
2576 const store2 = "rootStore" in context ? context.rootStore : context;
2577 const open = store2.useState("open");
2578 const floating = store2.useState("floatingElement");
2579 const domReference = store2.useState("domReferenceElement");
2580 const dataRef = store2.context.dataRef;
2581 const {
2582 enabled = true,
2583 axis = "both"
2584 } = props;
2585 const initialRef = React18.useRef(false);
2586 const cleanupListenerRef = React18.useRef(null);
2587 const [pointerType, setPointerType] = React18.useState();
2588 const [reactive, setReactive] = React18.useState([]);
2589 const setReference = useStableCallback((newX, newY, referenceElement) => {
2590 if (initialRef.current) {
2591 return;
2592 }
2593 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {
2594 return;
2595 }
2596 store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, {
2597 x: newX,
2598 y: newY,
2599 axis,
2600 dataRef,
2601 pointerType
2602 }));
2603 });
2604 const handleReferenceEnterOrMove = useStableCallback((event) => {
2605 if (!open) {
2606 setReference(event.clientX, event.clientY, event.currentTarget);
2607 } else if (!cleanupListenerRef.current) {
2608 setReactive([]);
2609 }
2610 });
2611 const openCheck = isMouseLikePointerType(pointerType) ? floating : open;
2612 const addListener = React18.useCallback(() => {
2613 if (!openCheck || !enabled) {
2614 return void 0;
2615 }
2616 const win = getWindow(floating);
2617 function handleMouseMove(event) {
2618 const target = getTarget(event);
2619 if (!contains(floating, target)) {
2620 setReference(event.clientX, event.clientY);
2621 } else {
2622 cleanupListenerRef.current?.();
2623 cleanupListenerRef.current = null;
2624 }
2625 }
2626 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {
2627 const cleanup = () => {
2628 cleanupListenerRef.current?.();
2629 cleanupListenerRef.current = null;
2630 };
2631 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove);
2632 return cleanup;
2633 }
2634 store2.set("positionReference", domReference);
2635 return void 0;
2636 }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference]);
2637 React18.useEffect(() => {
2638 return addListener();
2639 }, [addListener, reactive]);
2640 React18.useEffect(() => {
2641 if (enabled && !floating) {
2642 initialRef.current = false;
2643 }
2644 }, [enabled, floating]);
2645 React18.useEffect(() => {
2646 if (!enabled && open) {
2647 initialRef.current = true;
2648 }
2649 }, [enabled, open]);
2650 const reference = React18.useMemo(() => {
2651 function setPointerTypeRef(event) {
2652 setPointerType(event.pointerType);
2653 }
2654 return {
2655 onPointerDown: setPointerTypeRef,
2656 onPointerEnter: setPointerTypeRef,
2657 onMouseMove: handleReferenceEnterOrMove,
2658 onMouseEnter: handleReferenceEnterOrMove
2659 };
2660 }, [handleReferenceEnterOrMove]);
2661 return React18.useMemo(() => enabled ? {
2662 reference,
2663 trigger: reference
2664 } : {}, [enabled, reference]);
2665 }
2666
2667 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useDismiss.js
2668 var React19 = __toESM(require_react(), 1);
2669 var bubbleHandlerKeys = {
2670 intentional: "onClick",
2671 sloppy: "onPointerDown"
2672 };
2673 function alwaysFalse() {
2674 return false;
2675 }
2676 function normalizeProp(normalizable) {
2677 return {
2678 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false,
2679 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true
2680 };
2681 }
2682 function useDismiss(context, props = {}) {
2683 const store2 = "rootStore" in context ? context.rootStore : context;
2684 const open = store2.useState("open");
2685 const floatingElement = store2.useState("floatingElement");
2686 const {
2687 dataRef
2688 } = store2.context;
2689 const {
2690 enabled = true,
2691 escapeKey: escapeKey2 = true,
2692 outsidePress: outsidePressProp = true,
2693 outsidePressEvent = "sloppy",
2694 referencePress = alwaysFalse,
2695 referencePressEvent = "sloppy",
2696 bubbles,
2697 externalTree
2698 } = props;
2699 const tree = useFloatingTree(externalTree);
2700 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false);
2701 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp;
2702 const outsidePressEnabled = outsidePress2 !== false;
2703 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);
2704 const pressStartedInsideRef = React19.useRef(false);
2705 const pressStartPreventedRef = React19.useRef(false);
2706 const suppressNextOutsideClickRef = React19.useRef(false);
2707 const {
2708 escapeKey: escapeKeyBubbles,
2709 outsidePress: outsidePressBubbles
2710 } = normalizeProp(bubbles);
2711 const touchStateRef = React19.useRef(null);
2712 const cancelDismissOnEndTimeout = useTimeout();
2713 const clearInsideReactTreeTimeout = useTimeout();
2714 const clearInsideReactTree = useStableCallback(() => {
2715 clearInsideReactTreeTimeout.clear();
2716 dataRef.current.insideReactTree = false;
2717 });
2718 const isComposingRef = React19.useRef(false);
2719 const currentPointerTypeRef = React19.useRef("");
2720 const isReferencePressEnabled = useStableCallback(referencePress);
2721 const closeOnEscapeKeyDown = useStableCallback((event) => {
2722 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") {
2723 return;
2724 }
2725 if (isComposingRef.current) {
2726 return;
2727 }
2728 const nodeId = dataRef.current.floatingContext?.nodeId;
2729 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
2730 if (!escapeKeyBubbles) {
2731 if (children.length > 0) {
2732 let shouldDismiss = true;
2733 children.forEach((child) => {
2734 if (child.context?.open && !child.context.dataRef.current.__escapeKeyBubbles) {
2735 shouldDismiss = false;
2736 }
2737 });
2738 if (!shouldDismiss) {
2739 return;
2740 }
2741 }
2742 }
2743 const native = isReactEvent(event) ? event.nativeEvent : event;
2744 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native);
2745 store2.setOpen(false, eventDetails);
2746 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {
2747 event.stopPropagation();
2748 }
2749 });
2750 const markInsideReactTree = useStableCallback(() => {
2751 dataRef.current.insideReactTree = true;
2752 clearInsideReactTreeTimeout.start(0, clearInsideReactTree);
2753 });
2754 React19.useEffect(() => {
2755 if (!open || !enabled) {
2756 return void 0;
2757 }
2758 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
2759 dataRef.current.__outsidePressBubbles = outsidePressBubbles;
2760 const compositionTimeout = new Timeout();
2761 const preventedPressSuppressionTimeout = new Timeout();
2762 function handleCompositionStart() {
2763 compositionTimeout.clear();
2764 isComposingRef.current = true;
2765 }
2766 function handleCompositionEnd() {
2767 compositionTimeout.start(
2768 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
2769 // Only apply to WebKit for the test to remain 0ms.
2770 isWebKit() ? 5 : 0,
2771 () => {
2772 isComposingRef.current = false;
2773 }
2774 );
2775 }
2776 function suppressImmediateOutsideClickAfterPreventedStart() {
2777 suppressNextOutsideClickRef.current = true;
2778 preventedPressSuppressionTimeout.start(0, () => {
2779 suppressNextOutsideClickRef.current = false;
2780 });
2781 }
2782 function resetPressStartState() {
2783 pressStartedInsideRef.current = false;
2784 pressStartPreventedRef.current = false;
2785 }
2786 function getOutsidePressEvent() {
2787 const type = currentPointerTypeRef.current;
2788 const computedType = type === "pen" || !type ? "mouse" : type;
2789 const outsidePressEventValue = getOutsidePressEventProp();
2790 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue;
2791 if (typeof resolved === "string") {
2792 return resolved;
2793 }
2794 return resolved[computedType];
2795 }
2796 function shouldIgnoreEvent(event) {
2797 const computedOutsidePressEvent = getOutsidePressEvent();
2798 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click";
2799 }
2800 function isEventWithinFloatingTree(event) {
2801 const nodeId = dataRef.current.floatingContext?.nodeId;
2802 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating));
2803 return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement")) || targetIsInsideChildren;
2804 }
2805 function closeOnPressOutside(event) {
2806 if (shouldIgnoreEvent(event)) {
2807 clearInsideReactTree();
2808 return;
2809 }
2810 if (dataRef.current.insideReactTree) {
2811 clearInsideReactTree();
2812 return;
2813 }
2814 const target = getTarget(event);
2815 const inertSelector = `[${createAttribute("inert")}]`;
2816 const targetRoot = isElement(target) ? target.getRootNode() : null;
2817 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector));
2818 const triggers = store2.context.triggerElements;
2819 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) {
2820 return;
2821 }
2822 let targetRootAncestor = isElement(target) ? target : null;
2823 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
2824 const nextParent = getParentNode(targetRootAncestor);
2825 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
2826 break;
2827 }
2828 targetRootAncestor = nextParent;
2829 }
2830 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
2831 !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the
2832 // element was injected after the floating element rendered.
2833 markers.every((marker) => !contains(targetRootAncestor, marker))) {
2834 return;
2835 }
2836 if (isHTMLElement(target) && !("touches" in event)) {
2837 const lastTraversableNode = isLastTraversableNode(target);
2838 const style = getComputedStyle2(target);
2839 const scrollRe = /auto|scroll/;
2840 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
2841 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
2842 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
2843 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
2844 const isRTL3 = style.direction === "rtl";
2845 const pressedVerticalScrollbar = canScrollY && (isRTL3 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
2846 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
2847 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
2848 return;
2849 }
2850 }
2851 if (isEventWithinFloatingTree(event)) {
2852 return;
2853 }
2854 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) {
2855 preventedPressSuppressionTimeout.clear();
2856 suppressNextOutsideClickRef.current = false;
2857 return;
2858 }
2859 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
2860 return;
2861 }
2862 const nodeId = dataRef.current.floatingContext?.nodeId;
2863 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
2864 if (children.length > 0) {
2865 let shouldDismiss = true;
2866 children.forEach((child) => {
2867 if (child.context?.open && !child.context.dataRef.current.__outsidePressBubbles) {
2868 shouldDismiss = false;
2869 }
2870 });
2871 if (!shouldDismiss) {
2872 return;
2873 }
2874 }
2875 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event));
2876 clearInsideReactTree();
2877 }
2878 function handlePointerDown(event) {
2879 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement"))) {
2880 return;
2881 }
2882 closeOnPressOutside(event);
2883 }
2884 function handleTouchStart(event) {
2885 if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement"))) {
2886 return;
2887 }
2888 const touch = event.touches[0];
2889 if (touch) {
2890 touchStateRef.current = {
2891 startTime: Date.now(),
2892 startX: touch.clientX,
2893 startY: touch.clientY,
2894 dismissOnTouchEnd: false,
2895 dismissOnMouseDown: true
2896 };
2897 cancelDismissOnEndTimeout.start(1e3, () => {
2898 if (touchStateRef.current) {
2899 touchStateRef.current.dismissOnTouchEnd = false;
2900 touchStateRef.current.dismissOnMouseDown = false;
2901 }
2902 });
2903 }
2904 }
2905 function addTargetEventListenerOnce(event, listener) {
2906 const target = getTarget(event);
2907 if (!target) {
2908 return;
2909 }
2910 const unsubscribe2 = addEventListener(target, event.type, () => {
2911 listener(event);
2912 unsubscribe2();
2913 });
2914 }
2915 function handleTouchStartCapture(event) {
2916 currentPointerTypeRef.current = "touch";
2917 addTargetEventListenerOnce(event, handleTouchStart);
2918 }
2919 function closeOnPressOutsideCapture(event) {
2920 cancelDismissOnEndTimeout.clear();
2921 if (event.type === "pointerdown") {
2922 currentPointerTypeRef.current = event.pointerType;
2923 }
2924 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {
2925 return;
2926 }
2927 addTargetEventListenerOnce(event, (targetEvent) => {
2928 if (targetEvent.type === "pointerdown") {
2929 handlePointerDown(targetEvent);
2930 } else {
2931 closeOnPressOutside(targetEvent);
2932 }
2933 });
2934 }
2935 function handlePressEndCapture(event) {
2936 if (!pressStartedInsideRef.current) {
2937 return;
2938 }
2939 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;
2940 resetPressStartState();
2941 if (getOutsidePressEvent() !== "intentional") {
2942 return;
2943 }
2944 if (event.type === "pointercancel") {
2945 if (pressStartedInsideDefaultPrevented) {
2946 suppressImmediateOutsideClickAfterPreventedStart();
2947 }
2948 return;
2949 }
2950 if (isEventWithinFloatingTree(event)) {
2951 return;
2952 }
2953 if (pressStartedInsideDefaultPrevented) {
2954 suppressImmediateOutsideClickAfterPreventedStart();
2955 return;
2956 }
2957 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
2958 return;
2959 }
2960 preventedPressSuppressionTimeout.clear();
2961 suppressNextOutsideClickRef.current = true;
2962 clearInsideReactTree();
2963 }
2964 function handleTouchMove(event) {
2965 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement"))) {
2966 return;
2967 }
2968 const touch = event.touches[0];
2969 if (!touch) {
2970 return;
2971 }
2972 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);
2973 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);
2974 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
2975 if (distance > 5) {
2976 touchStateRef.current.dismissOnTouchEnd = true;
2977 }
2978 if (distance > 10) {
2979 closeOnPressOutside(event);
2980 cancelDismissOnEndTimeout.clear();
2981 touchStateRef.current = null;
2982 }
2983 }
2984 function handleTouchMoveCapture(event) {
2985 addTargetEventListenerOnce(event, handleTouchMove);
2986 }
2987 function handleTouchEnd(event) {
2988 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement"))) {
2989 return;
2990 }
2991 if (touchStateRef.current.dismissOnTouchEnd) {
2992 closeOnPressOutside(event);
2993 }
2994 cancelDismissOnEndTimeout.clear();
2995 touchStateRef.current = null;
2996 }
2997 function handleTouchEndCapture(event) {
2998 addTargetEventListenerOnce(event, handleTouchEnd);
2999 }
3000 const doc = ownerDocument(floatingElement);
3001 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)));
3002 return () => {
3003 unsubscribe();
3004 compositionTimeout.clear();
3005 preventedPressSuppressionTimeout.clear();
3006 resetPressStartState();
3007 suppressNextOutsideClickRef.current = false;
3008 };
3009 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, tree, store2, cancelDismissOnEndTimeout]);
3010 React19.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]);
3011 const reference = React19.useMemo(() => ({
3012 onKeyDown: closeOnEscapeKeyDown,
3013 [bubbleHandlerKeys[referencePressEvent]]: (event) => {
3014 if (!isReferencePressEnabled()) {
3015 return;
3016 }
3017 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
3018 },
3019 ...referencePressEvent !== "intentional" && {
3020 onClick(event) {
3021 if (!isReferencePressEnabled()) {
3022 return;
3023 }
3024 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
3025 }
3026 }
3027 }), [closeOnEscapeKeyDown, store2, referencePressEvent, isReferencePressEnabled]);
3028 const markPressStartedInsideReactTree = useStableCallback((event) => {
3029 if (!open || !enabled || event.button !== 0) {
3030 return;
3031 }
3032 const target = getTarget(event.nativeEvent);
3033 if (!contains(store2.select("floatingElement"), target)) {
3034 return;
3035 }
3036 if (!pressStartedInsideRef.current) {
3037 pressStartedInsideRef.current = true;
3038 pressStartPreventedRef.current = false;
3039 }
3040 });
3041 const markInsidePressStartPrevented = useStableCallback((event) => {
3042 if (!open || !enabled) {
3043 return;
3044 }
3045 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {
3046 return;
3047 }
3048 if (pressStartedInsideRef.current) {
3049 pressStartPreventedRef.current = true;
3050 }
3051 });
3052 const floating = React19.useMemo(() => ({
3053 onKeyDown: closeOnEscapeKeyDown,
3054 // `onMouseDown` may be blocked if `event.preventDefault()` is called in
3055 // `onPointerDown`, such as with <NumberField.ScrubArea>.
3056 // See https://github.com/mui/base-ui/pull/3379
3057 onPointerDown: markInsidePressStartPrevented,
3058 onMouseDown: markInsidePressStartPrevented,
3059 onClickCapture: markInsideReactTree,
3060 onMouseDownCapture(event) {
3061 markInsideReactTree();
3062 markPressStartedInsideReactTree(event);
3063 },
3064 onPointerDownCapture(event) {
3065 markInsideReactTree();
3066 markPressStartedInsideReactTree(event);
3067 },
3068 onMouseUpCapture: markInsideReactTree,
3069 onTouchEndCapture: markInsideReactTree,
3070 onTouchMoveCapture: markInsideReactTree
3071 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);
3072 return React19.useMemo(() => enabled ? {
3073 reference,
3074 floating,
3075 trigger: reference
3076 } : {}, [enabled, reference, floating]);
3077 }
3078
3079 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js
3080 var React25 = __toESM(require_react(), 1);
3081
3082 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
3083 function computeCoordsFromPlacement(_ref, placement, rtl) {
3084 let {
3085 reference,
3086 floating
3087 } = _ref;
3088 const sideAxis = getSideAxis(placement);
3089 const alignmentAxis = getAlignmentAxis(placement);
3090 const alignLength = getAxisLength(alignmentAxis);
3091 const side = getSide(placement);
3092 const isVertical = sideAxis === "y";
3093 const commonX = reference.x + reference.width / 2 - floating.width / 2;
3094 const commonY = reference.y + reference.height / 2 - floating.height / 2;
3095 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
3096 let coords;
3097 switch (side) {
3098 case "top":
3099 coords = {
3100 x: commonX,
3101 y: reference.y - floating.height
3102 };
3103 break;
3104 case "bottom":
3105 coords = {
3106 x: commonX,
3107 y: reference.y + reference.height
3108 };
3109 break;
3110 case "right":
3111 coords = {
3112 x: reference.x + reference.width,
3113 y: commonY
3114 };
3115 break;
3116 case "left":
3117 coords = {
3118 x: reference.x - floating.width,
3119 y: commonY
3120 };
3121 break;
3122 default:
3123 coords = {
3124 x: reference.x,
3125 y: reference.y
3126 };
3127 }
3128 switch (getAlignment(placement)) {
3129 case "start":
3130 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
3131 break;
3132 case "end":
3133 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
3134 break;
3135 }
3136 return coords;
3137 }
3138 async function detectOverflow(state, options) {
3139 var _await$platform$isEle;
3140 if (options === void 0) {
3141 options = {};
3142 }
3143 const {
3144 x,
3145 y,
3146 platform: platform3,
3147 rects,
3148 elements,
3149 strategy
3150 } = state;
3151 const {
3152 boundary = "clippingAncestors",
3153 rootBoundary = "viewport",
3154 elementContext = "floating",
3155 altBoundary = false,
3156 padding = 0
3157 } = evaluate(options, state);
3158 const paddingObject = getPaddingObject(padding);
3159 const altContext = elementContext === "floating" ? "reference" : "floating";
3160 const element = elements[altBoundary ? altContext : elementContext];
3161 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({
3162 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)),
3163 boundary,
3164 rootBoundary,
3165 strategy
3166 }));
3167 const rect = elementContext === "floating" ? {
3168 x,
3169 y,
3170 width: rects.floating.width,
3171 height: rects.floating.height
3172 } : rects.reference;
3173 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating));
3174 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || {
3175 x: 1,
3176 y: 1
3177 } : {
3178 x: 1,
3179 y: 1
3180 };
3181 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({
3182 elements,
3183 rect,
3184 offsetParent,
3185 strategy
3186 }) : rect);
3187 return {
3188 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
3189 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
3190 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
3191 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
3192 };
3193 }
3194 var MAX_RESET_COUNT = 50;
3195 var computePosition = async (reference, floating, config) => {
3196 const {
3197 placement = "bottom",
3198 strategy = "absolute",
3199 middleware = [],
3200 platform: platform3
3201 } = config;
3202 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : {
3203 ...platform3,
3204 detectOverflow
3205 };
3206 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating));
3207 let rects = await platform3.getElementRects({
3208 reference,
3209 floating,
3210 strategy
3211 });
3212 let {
3213 x,
3214 y
3215 } = computeCoordsFromPlacement(rects, placement, rtl);
3216 let statefulPlacement = placement;
3217 let resetCount = 0;
3218 const middlewareData = {};
3219 for (let i = 0; i < middleware.length; i++) {
3220 const currentMiddleware = middleware[i];
3221 if (!currentMiddleware) {
3222 continue;
3223 }
3224 const {
3225 name,
3226 fn
3227 } = currentMiddleware;
3228 const {
3229 x: nextX,
3230 y: nextY,
3231 data,
3232 reset
3233 } = await fn({
3234 x,
3235 y,
3236 initialPlacement: placement,
3237 placement: statefulPlacement,
3238 strategy,
3239 middlewareData,
3240 rects,
3241 platform: platformWithDetectOverflow,
3242 elements: {
3243 reference,
3244 floating
3245 }
3246 });
3247 x = nextX != null ? nextX : x;
3248 y = nextY != null ? nextY : y;
3249 middlewareData[name] = {
3250 ...middlewareData[name],
3251 ...data
3252 };
3253 if (reset && resetCount < MAX_RESET_COUNT) {
3254 resetCount++;
3255 if (typeof reset === "object") {
3256 if (reset.placement) {
3257 statefulPlacement = reset.placement;
3258 }
3259 if (reset.rects) {
3260 rects = reset.rects === true ? await platform3.getElementRects({
3261 reference,
3262 floating,
3263 strategy
3264 }) : reset.rects;
3265 }
3266 ({
3267 x,
3268 y
3269 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
3270 }
3271 i = -1;
3272 }
3273 }
3274 return {
3275 x,
3276 y,
3277 placement: statefulPlacement,
3278 strategy,
3279 middlewareData
3280 };
3281 };
3282 var flip = function(options) {
3283 if (options === void 0) {
3284 options = {};
3285 }
3286 return {
3287 name: "flip",
3288 options,
3289 async fn(state) {
3290 var _middlewareData$arrow, _middlewareData$flip;
3291 const {
3292 placement,
3293 middlewareData,
3294 rects,
3295 initialPlacement,
3296 platform: platform3,
3297 elements
3298 } = state;
3299 const {
3300 mainAxis: checkMainAxis = true,
3301 crossAxis: checkCrossAxis = true,
3302 fallbackPlacements: specifiedFallbackPlacements,
3303 fallbackStrategy = "bestFit",
3304 fallbackAxisSideDirection = "none",
3305 flipAlignment = true,
3306 ...detectOverflowOptions
3307 } = evaluate(options, state);
3308 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
3309 return {};
3310 }
3311 const side = getSide(placement);
3312 const initialSideAxis = getSideAxis(initialPlacement);
3313 const isBasePlacement = getSide(initialPlacement) === initialPlacement;
3314 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
3315 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
3316 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
3317 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
3318 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
3319 }
3320 const placements2 = [initialPlacement, ...fallbackPlacements];
3321 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
3322 const overflows = [];
3323 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
3324 if (checkMainAxis) {
3325 overflows.push(overflow[side]);
3326 }
3327 if (checkCrossAxis) {
3328 const sides2 = getAlignmentSides(placement, rects, rtl);
3329 overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
3330 }
3331 overflowsData = [...overflowsData, {
3332 placement,
3333 overflows
3334 }];
3335 if (!overflows.every((side2) => side2 <= 0)) {
3336 var _middlewareData$flip2, _overflowsData$filter;
3337 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
3338 const nextPlacement = placements2[nextIndex];
3339 if (nextPlacement) {
3340 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
3341 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
3342 // overflows the main axis.
3343 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
3344 return {
3345 data: {
3346 index: nextIndex,
3347 overflows: overflowsData
3348 },
3349 reset: {
3350 placement: nextPlacement
3351 }
3352 };
3353 }
3354 }
3355 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;
3356 if (!resetPlacement) {
3357 switch (fallbackStrategy) {
3358 case "bestFit": {
3359 var _overflowsData$filter2;
3360 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
3361 if (hasFallbackAxisSideDirection) {
3362 const currentSideAxis = getSideAxis(d.placement);
3363 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
3364 // reading directions favoring greater width.
3365 currentSideAxis === "y";
3366 }
3367 return true;
3368 }).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];
3369 if (placement2) {
3370 resetPlacement = placement2;
3371 }
3372 break;
3373 }
3374 case "initialPlacement":
3375 resetPlacement = initialPlacement;
3376 break;
3377 }
3378 }
3379 if (placement !== resetPlacement) {
3380 return {
3381 reset: {
3382 placement: resetPlacement
3383 }
3384 };
3385 }
3386 }
3387 return {};
3388 }
3389 };
3390 };
3391 function getSideOffsets(overflow, rect) {
3392 return {
3393 top: overflow.top - rect.height,
3394 right: overflow.right - rect.width,
3395 bottom: overflow.bottom - rect.height,
3396 left: overflow.left - rect.width
3397 };
3398 }
3399 function isAnySideFullyClipped(overflow) {
3400 return sides.some((side) => overflow[side] >= 0);
3401 }
3402 var hide = function(options) {
3403 if (options === void 0) {
3404 options = {};
3405 }
3406 return {
3407 name: "hide",
3408 options,
3409 async fn(state) {
3410 const {
3411 rects,
3412 platform: platform3
3413 } = state;
3414 const {
3415 strategy = "referenceHidden",
3416 ...detectOverflowOptions
3417 } = evaluate(options, state);
3418 switch (strategy) {
3419 case "referenceHidden": {
3420 const overflow = await platform3.detectOverflow(state, {
3421 ...detectOverflowOptions,
3422 elementContext: "reference"
3423 });
3424 const offsets = getSideOffsets(overflow, rects.reference);
3425 return {
3426 data: {
3427 referenceHiddenOffsets: offsets,
3428 referenceHidden: isAnySideFullyClipped(offsets)
3429 }
3430 };
3431 }
3432 case "escaped": {
3433 const overflow = await platform3.detectOverflow(state, {
3434 ...detectOverflowOptions,
3435 altBoundary: true
3436 });
3437 const offsets = getSideOffsets(overflow, rects.floating);
3438 return {
3439 data: {
3440 escapedOffsets: offsets,
3441 escaped: isAnySideFullyClipped(offsets)
3442 }
3443 };
3444 }
3445 default: {
3446 return {};
3447 }
3448 }
3449 }
3450 };
3451 };
3452 var originSides = /* @__PURE__ */ new Set(["left", "top"]);
3453 async function convertValueToCoords(state, options) {
3454 const {
3455 placement,
3456 platform: platform3,
3457 elements
3458 } = state;
3459 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
3460 const side = getSide(placement);
3461 const alignment = getAlignment(placement);
3462 const isVertical = getSideAxis(placement) === "y";
3463 const mainAxisMulti = originSides.has(side) ? -1 : 1;
3464 const crossAxisMulti = rtl && isVertical ? -1 : 1;
3465 const rawValue = evaluate(options, state);
3466 let {
3467 mainAxis,
3468 crossAxis,
3469 alignmentAxis
3470 } = typeof rawValue === "number" ? {
3471 mainAxis: rawValue,
3472 crossAxis: 0,
3473 alignmentAxis: null
3474 } : {
3475 mainAxis: rawValue.mainAxis || 0,
3476 crossAxis: rawValue.crossAxis || 0,
3477 alignmentAxis: rawValue.alignmentAxis
3478 };
3479 if (alignment && typeof alignmentAxis === "number") {
3480 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
3481 }
3482 return isVertical ? {
3483 x: crossAxis * crossAxisMulti,
3484 y: mainAxis * mainAxisMulti
3485 } : {
3486 x: mainAxis * mainAxisMulti,
3487 y: crossAxis * crossAxisMulti
3488 };
3489 }
3490 var offset = function(options) {
3491 if (options === void 0) {
3492 options = 0;
3493 }
3494 return {
3495 name: "offset",
3496 options,
3497 async fn(state) {
3498 var _middlewareData$offse, _middlewareData$arrow;
3499 const {
3500 x,
3501 y,
3502 placement,
3503 middlewareData
3504 } = state;
3505 const diffCoords = await convertValueToCoords(state, options);
3506 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
3507 return {};
3508 }
3509 return {
3510 x: x + diffCoords.x,
3511 y: y + diffCoords.y,
3512 data: {
3513 ...diffCoords,
3514 placement
3515 }
3516 };
3517 }
3518 };
3519 };
3520 var shift = function(options) {
3521 if (options === void 0) {
3522 options = {};
3523 }
3524 return {
3525 name: "shift",
3526 options,
3527 async fn(state) {
3528 const {
3529 x,
3530 y,
3531 placement,
3532 platform: platform3
3533 } = state;
3534 const {
3535 mainAxis: checkMainAxis = true,
3536 crossAxis: checkCrossAxis = false,
3537 limiter = {
3538 fn: (_ref) => {
3539 let {
3540 x: x2,
3541 y: y2
3542 } = _ref;
3543 return {
3544 x: x2,
3545 y: y2
3546 };
3547 }
3548 },
3549 ...detectOverflowOptions
3550 } = evaluate(options, state);
3551 const coords = {
3552 x,
3553 y
3554 };
3555 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
3556 const crossAxis = getSideAxis(getSide(placement));
3557 const mainAxis = getOppositeAxis(crossAxis);
3558 let mainAxisCoord = coords[mainAxis];
3559 let crossAxisCoord = coords[crossAxis];
3560 if (checkMainAxis) {
3561 const minSide = mainAxis === "y" ? "top" : "left";
3562 const maxSide = mainAxis === "y" ? "bottom" : "right";
3563 const min2 = mainAxisCoord + overflow[minSide];
3564 const max2 = mainAxisCoord - overflow[maxSide];
3565 mainAxisCoord = clamp(min2, mainAxisCoord, max2);
3566 }
3567 if (checkCrossAxis) {
3568 const minSide = crossAxis === "y" ? "top" : "left";
3569 const maxSide = crossAxis === "y" ? "bottom" : "right";
3570 const min2 = crossAxisCoord + overflow[minSide];
3571 const max2 = crossAxisCoord - overflow[maxSide];
3572 crossAxisCoord = clamp(min2, crossAxisCoord, max2);
3573 }
3574 const limitedCoords = limiter.fn({
3575 ...state,
3576 [mainAxis]: mainAxisCoord,
3577 [crossAxis]: crossAxisCoord
3578 });
3579 return {
3580 ...limitedCoords,
3581 data: {
3582 x: limitedCoords.x - x,
3583 y: limitedCoords.y - y,
3584 enabled: {
3585 [mainAxis]: checkMainAxis,
3586 [crossAxis]: checkCrossAxis
3587 }
3588 }
3589 };
3590 }
3591 };
3592 };
3593 var limitShift = function(options) {
3594 if (options === void 0) {
3595 options = {};
3596 }
3597 return {
3598 options,
3599 fn(state) {
3600 const {
3601 x,
3602 y,
3603 placement,
3604 rects,
3605 middlewareData
3606 } = state;
3607 const {
3608 offset: offset4 = 0,
3609 mainAxis: checkMainAxis = true,
3610 crossAxis: checkCrossAxis = true
3611 } = evaluate(options, state);
3612 const coords = {
3613 x,
3614 y
3615 };
3616 const crossAxis = getSideAxis(placement);
3617 const mainAxis = getOppositeAxis(crossAxis);
3618 let mainAxisCoord = coords[mainAxis];
3619 let crossAxisCoord = coords[crossAxis];
3620 const rawOffset = evaluate(offset4, state);
3621 const computedOffset = typeof rawOffset === "number" ? {
3622 mainAxis: rawOffset,
3623 crossAxis: 0
3624 } : {
3625 mainAxis: 0,
3626 crossAxis: 0,
3627 ...rawOffset
3628 };
3629 if (checkMainAxis) {
3630 const len = mainAxis === "y" ? "height" : "width";
3631 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
3632 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
3633 if (mainAxisCoord < limitMin) {
3634 mainAxisCoord = limitMin;
3635 } else if (mainAxisCoord > limitMax) {
3636 mainAxisCoord = limitMax;
3637 }
3638 }
3639 if (checkCrossAxis) {
3640 var _middlewareData$offse, _middlewareData$offse2;
3641 const len = mainAxis === "y" ? "width" : "height";
3642 const isOriginSide = originSides.has(getSide(placement));
3643 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);
3644 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);
3645 if (crossAxisCoord < limitMin) {
3646 crossAxisCoord = limitMin;
3647 } else if (crossAxisCoord > limitMax) {
3648 crossAxisCoord = limitMax;
3649 }
3650 }
3651 return {
3652 [mainAxis]: mainAxisCoord,
3653 [crossAxis]: crossAxisCoord
3654 };
3655 }
3656 };
3657 };
3658 var size = function(options) {
3659 if (options === void 0) {
3660 options = {};
3661 }
3662 return {
3663 name: "size",
3664 options,
3665 async fn(state) {
3666 var _state$middlewareData, _state$middlewareData2;
3667 const {
3668 placement,
3669 rects,
3670 platform: platform3,
3671 elements
3672 } = state;
3673 const {
3674 apply = () => {
3675 },
3676 ...detectOverflowOptions
3677 } = evaluate(options, state);
3678 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
3679 const side = getSide(placement);
3680 const alignment = getAlignment(placement);
3681 const isYAxis = getSideAxis(placement) === "y";
3682 const {
3683 width,
3684 height
3685 } = rects.floating;
3686 let heightSide;
3687 let widthSide;
3688 if (side === "top" || side === "bottom") {
3689 heightSide = side;
3690 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
3691 } else {
3692 widthSide = side;
3693 heightSide = alignment === "end" ? "top" : "bottom";
3694 }
3695 const maximumClippingHeight = height - overflow.top - overflow.bottom;
3696 const maximumClippingWidth = width - overflow.left - overflow.right;
3697 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
3698 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
3699 const noShift = !state.middlewareData.shift;
3700 let availableHeight = overflowAvailableHeight;
3701 let availableWidth = overflowAvailableWidth;
3702 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
3703 availableWidth = maximumClippingWidth;
3704 }
3705 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
3706 availableHeight = maximumClippingHeight;
3707 }
3708 if (noShift && !alignment) {
3709 const xMin = max(overflow.left, 0);
3710 const xMax = max(overflow.right, 0);
3711 const yMin = max(overflow.top, 0);
3712 const yMax = max(overflow.bottom, 0);
3713 if (isYAxis) {
3714 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
3715 } else {
3716 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
3717 }
3718 }
3719 await apply({
3720 ...state,
3721 availableWidth,
3722 availableHeight
3723 });
3724 const nextDimensions = await platform3.getDimensions(elements.floating);
3725 if (width !== nextDimensions.width || height !== nextDimensions.height) {
3726 return {
3727 reset: {
3728 rects: true
3729 }
3730 };
3731 }
3732 return {};
3733 }
3734 };
3735 };
3736
3737 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
3738 function getCssDimensions(element) {
3739 const css = getComputedStyle2(element);
3740 let width = parseFloat(css.width) || 0;
3741 let height = parseFloat(css.height) || 0;
3742 const hasOffset = isHTMLElement(element);
3743 const offsetWidth = hasOffset ? element.offsetWidth : width;
3744 const offsetHeight = hasOffset ? element.offsetHeight : height;
3745 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
3746 if (shouldFallback) {
3747 width = offsetWidth;
3748 height = offsetHeight;
3749 }
3750 return {
3751 width,
3752 height,
3753 $: shouldFallback
3754 };
3755 }
3756 function unwrapElement(element) {
3757 return !isElement(element) ? element.contextElement : element;
3758 }
3759 function getScale(element) {
3760 const domElement = unwrapElement(element);
3761 if (!isHTMLElement(domElement)) {
3762 return createCoords(1);
3763 }
3764 const rect = domElement.getBoundingClientRect();
3765 const {
3766 width,
3767 height,
3768 $
3769 } = getCssDimensions(domElement);
3770 let x = ($ ? round(rect.width) : rect.width) / width;
3771 let y = ($ ? round(rect.height) : rect.height) / height;
3772 if (!x || !Number.isFinite(x)) {
3773 x = 1;
3774 }
3775 if (!y || !Number.isFinite(y)) {
3776 y = 1;
3777 }
3778 return {
3779 x,
3780 y
3781 };
3782 }
3783 var noOffsets = /* @__PURE__ */ createCoords(0);
3784 function getVisualOffsets(element) {
3785 const win = getWindow(element);
3786 if (!isWebKit() || !win.visualViewport) {
3787 return noOffsets;
3788 }
3789 return {
3790 x: win.visualViewport.offsetLeft,
3791 y: win.visualViewport.offsetTop
3792 };
3793 }
3794 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
3795 if (isFixed === void 0) {
3796 isFixed = false;
3797 }
3798 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
3799 return false;
3800 }
3801 return isFixed;
3802 }
3803 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
3804 if (includeScale === void 0) {
3805 includeScale = false;
3806 }
3807 if (isFixedStrategy === void 0) {
3808 isFixedStrategy = false;
3809 }
3810 const clientRect = element.getBoundingClientRect();
3811 const domElement = unwrapElement(element);
3812 let scale = createCoords(1);
3813 if (includeScale) {
3814 if (offsetParent) {
3815 if (isElement(offsetParent)) {
3816 scale = getScale(offsetParent);
3817 }
3818 } else {
3819 scale = getScale(element);
3820 }
3821 }
3822 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
3823 let x = (clientRect.left + visualOffsets.x) / scale.x;
3824 let y = (clientRect.top + visualOffsets.y) / scale.y;
3825 let width = clientRect.width / scale.x;
3826 let height = clientRect.height / scale.y;
3827 if (domElement) {
3828 const win = getWindow(domElement);
3829 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
3830 let currentWin = win;
3831 let currentIFrame = getFrameElement(currentWin);
3832 while (currentIFrame && offsetParent && offsetWin !== currentWin) {
3833 const iframeScale = getScale(currentIFrame);
3834 const iframeRect = currentIFrame.getBoundingClientRect();
3835 const css = getComputedStyle2(currentIFrame);
3836 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
3837 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
3838 x *= iframeScale.x;
3839 y *= iframeScale.y;
3840 width *= iframeScale.x;
3841 height *= iframeScale.y;
3842 x += left;
3843 y += top;
3844 currentWin = getWindow(currentIFrame);
3845 currentIFrame = getFrameElement(currentWin);
3846 }
3847 }
3848 return rectToClientRect({
3849 width,
3850 height,
3851 x,
3852 y
3853 });
3854 }
3855 function getWindowScrollBarX(element, rect) {
3856 const leftScroll = getNodeScroll(element).scrollLeft;
3857 if (!rect) {
3858 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
3859 }
3860 return rect.left + leftScroll;
3861 }
3862 function getHTMLOffset(documentElement, scroll) {
3863 const htmlRect = documentElement.getBoundingClientRect();
3864 const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
3865 const y = htmlRect.top + scroll.scrollTop;
3866 return {
3867 x,
3868 y
3869 };
3870 }
3871 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
3872 let {
3873 elements,
3874 rect,
3875 offsetParent,
3876 strategy
3877 } = _ref;
3878 const isFixed = strategy === "fixed";
3879 const documentElement = getDocumentElement(offsetParent);
3880 const topLayer = elements ? isTopLayer(elements.floating) : false;
3881 if (offsetParent === documentElement || topLayer && isFixed) {
3882 return rect;
3883 }
3884 let scroll = {
3885 scrollLeft: 0,
3886 scrollTop: 0
3887 };
3888 let scale = createCoords(1);
3889 const offsets = createCoords(0);
3890 const isOffsetParentAnElement = isHTMLElement(offsetParent);
3891 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3892 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
3893 scroll = getNodeScroll(offsetParent);
3894 }
3895 if (isOffsetParentAnElement) {
3896 const offsetRect = getBoundingClientRect(offsetParent);
3897 scale = getScale(offsetParent);
3898 offsets.x = offsetRect.x + offsetParent.clientLeft;
3899 offsets.y = offsetRect.y + offsetParent.clientTop;
3900 }
3901 }
3902 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
3903 return {
3904 width: rect.width * scale.x,
3905 height: rect.height * scale.y,
3906 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
3907 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
3908 };
3909 }
3910 function getClientRects(element) {
3911 return Array.from(element.getClientRects());
3912 }
3913 function getDocumentRect(element) {
3914 const html = getDocumentElement(element);
3915 const scroll = getNodeScroll(element);
3916 const body = element.ownerDocument.body;
3917 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
3918 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
3919 let x = -scroll.scrollLeft + getWindowScrollBarX(element);
3920 const y = -scroll.scrollTop;
3921 if (getComputedStyle2(body).direction === "rtl") {
3922 x += max(html.clientWidth, body.clientWidth) - width;
3923 }
3924 return {
3925 width,
3926 height,
3927 x,
3928 y
3929 };
3930 }
3931 var SCROLLBAR_MAX = 25;
3932 function getViewportRect(element, strategy) {
3933 const win = getWindow(element);
3934 const html = getDocumentElement(element);
3935 const visualViewport = win.visualViewport;
3936 let width = html.clientWidth;
3937 let height = html.clientHeight;
3938 let x = 0;
3939 let y = 0;
3940 if (visualViewport) {
3941 width = visualViewport.width;
3942 height = visualViewport.height;
3943 const visualViewportBased = isWebKit();
3944 if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
3945 x = visualViewport.offsetLeft;
3946 y = visualViewport.offsetTop;
3947 }
3948 }
3949 const windowScrollbarX = getWindowScrollBarX(html);
3950 if (windowScrollbarX <= 0) {
3951 const doc = html.ownerDocument;
3952 const body = doc.body;
3953 const bodyStyles = getComputedStyle(body);
3954 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
3955 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
3956 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
3957 width -= clippingStableScrollbarWidth;
3958 }
3959 } else if (windowScrollbarX <= SCROLLBAR_MAX) {
3960 width += windowScrollbarX;
3961 }
3962 return {
3963 width,
3964 height,
3965 x,
3966 y
3967 };
3968 }
3969 function getInnerBoundingClientRect(element, strategy) {
3970 const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
3971 const top = clientRect.top + element.clientTop;
3972 const left = clientRect.left + element.clientLeft;
3973 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
3974 const width = element.clientWidth * scale.x;
3975 const height = element.clientHeight * scale.y;
3976 const x = left * scale.x;
3977 const y = top * scale.y;
3978 return {
3979 width,
3980 height,
3981 x,
3982 y
3983 };
3984 }
3985 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
3986 let rect;
3987 if (clippingAncestor === "viewport") {
3988 rect = getViewportRect(element, strategy);
3989 } else if (clippingAncestor === "document") {
3990 rect = getDocumentRect(getDocumentElement(element));
3991 } else if (isElement(clippingAncestor)) {
3992 rect = getInnerBoundingClientRect(clippingAncestor, strategy);
3993 } else {
3994 const visualOffsets = getVisualOffsets(element);
3995 rect = {
3996 x: clippingAncestor.x - visualOffsets.x,
3997 y: clippingAncestor.y - visualOffsets.y,
3998 width: clippingAncestor.width,
3999 height: clippingAncestor.height
4000 };
4001 }
4002 return rectToClientRect(rect);
4003 }
4004 function hasFixedPositionAncestor(element, stopNode) {
4005 const parentNode = getParentNode(element);
4006 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
4007 return false;
4008 }
4009 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
4010 }
4011 function getClippingElementAncestors(element, cache) {
4012 const cachedResult = cache.get(element);
4013 if (cachedResult) {
4014 return cachedResult;
4015 }
4016 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
4017 let currentContainingBlockComputedStyle = null;
4018 const elementIsFixed = getComputedStyle2(element).position === "fixed";
4019 let currentNode = elementIsFixed ? getParentNode(element) : element;
4020 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
4021 const computedStyle = getComputedStyle2(currentNode);
4022 const currentNodeIsContaining = isContainingBlock(currentNode);
4023 if (!currentNodeIsContaining && computedStyle.position === "fixed") {
4024 currentContainingBlockComputedStyle = null;
4025 }
4026 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
4027 if (shouldDropCurrentNode) {
4028 result = result.filter((ancestor) => ancestor !== currentNode);
4029 } else {
4030 currentContainingBlockComputedStyle = computedStyle;
4031 }
4032 currentNode = getParentNode(currentNode);
4033 }
4034 cache.set(element, result);
4035 return result;
4036 }
4037 function getClippingRect(_ref) {
4038 let {
4039 element,
4040 boundary,
4041 rootBoundary,
4042 strategy
4043 } = _ref;
4044 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
4045 const clippingAncestors = [...elementClippingAncestors, rootBoundary];
4046 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
4047 let top = firstRect.top;
4048 let right = firstRect.right;
4049 let bottom = firstRect.bottom;
4050 let left = firstRect.left;
4051 for (let i = 1; i < clippingAncestors.length; i++) {
4052 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
4053 top = max(rect.top, top);
4054 right = min(rect.right, right);
4055 bottom = min(rect.bottom, bottom);
4056 left = max(rect.left, left);
4057 }
4058 return {
4059 width: right - left,
4060 height: bottom - top,
4061 x: left,
4062 y: top
4063 };
4064 }
4065 function getDimensions(element) {
4066 const {
4067 width,
4068 height
4069 } = getCssDimensions(element);
4070 return {
4071 width,
4072 height
4073 };
4074 }
4075 function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
4076 const isOffsetParentAnElement = isHTMLElement(offsetParent);
4077 const documentElement = getDocumentElement(offsetParent);
4078 const isFixed = strategy === "fixed";
4079 const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
4080 let scroll = {
4081 scrollLeft: 0,
4082 scrollTop: 0
4083 };
4084 const offsets = createCoords(0);
4085 function setLeftRTLScrollbarOffset() {
4086 offsets.x = getWindowScrollBarX(documentElement);
4087 }
4088 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
4089 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
4090 scroll = getNodeScroll(offsetParent);
4091 }
4092 if (isOffsetParentAnElement) {
4093 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
4094 offsets.x = offsetRect.x + offsetParent.clientLeft;
4095 offsets.y = offsetRect.y + offsetParent.clientTop;
4096 } else if (documentElement) {
4097 setLeftRTLScrollbarOffset();
4098 }
4099 }
4100 if (isFixed && !isOffsetParentAnElement && documentElement) {
4101 setLeftRTLScrollbarOffset();
4102 }
4103 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
4104 const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
4105 const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
4106 return {
4107 x,
4108 y,
4109 width: rect.width,
4110 height: rect.height
4111 };
4112 }
4113 function isStaticPositioned(element) {
4114 return getComputedStyle2(element).position === "static";
4115 }
4116 function getTrueOffsetParent(element, polyfill) {
4117 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
4118 return null;
4119 }
4120 if (polyfill) {
4121 return polyfill(element);
4122 }
4123 let rawOffsetParent = element.offsetParent;
4124 if (getDocumentElement(element) === rawOffsetParent) {
4125 rawOffsetParent = rawOffsetParent.ownerDocument.body;
4126 }
4127 return rawOffsetParent;
4128 }
4129 function getOffsetParent(element, polyfill) {
4130 const win = getWindow(element);
4131 if (isTopLayer(element)) {
4132 return win;
4133 }
4134 if (!isHTMLElement(element)) {
4135 let svgOffsetParent = getParentNode(element);
4136 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
4137 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
4138 return svgOffsetParent;
4139 }
4140 svgOffsetParent = getParentNode(svgOffsetParent);
4141 }
4142 return win;
4143 }
4144 let offsetParent = getTrueOffsetParent(element, polyfill);
4145 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
4146 offsetParent = getTrueOffsetParent(offsetParent, polyfill);
4147 }
4148 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
4149 return win;
4150 }
4151 return offsetParent || getContainingBlock(element) || win;
4152 }
4153 var getElementRects = async function(data) {
4154 const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
4155 const getDimensionsFn = this.getDimensions;
4156 const floatingDimensions = await getDimensionsFn(data.floating);
4157 return {
4158 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
4159 floating: {
4160 x: 0,
4161 y: 0,
4162 width: floatingDimensions.width,
4163 height: floatingDimensions.height
4164 }
4165 };
4166 };
4167 function isRTL(element) {
4168 return getComputedStyle2(element).direction === "rtl";
4169 }
4170 var platform2 = {
4171 convertOffsetParentRelativeRectToViewportRelativeRect,
4172 getDocumentElement,
4173 getClippingRect,
4174 getOffsetParent,
4175 getElementRects,
4176 getClientRects,
4177 getDimensions,
4178 getScale,
4179 isElement,
4180 isRTL
4181 };
4182 function rectsAreEqual(a, b) {
4183 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
4184 }
4185 function observeMove(element, onMove) {
4186 let io = null;
4187 let timeoutId;
4188 const root = getDocumentElement(element);
4189 function cleanup() {
4190 var _io;
4191 clearTimeout(timeoutId);
4192 (_io = io) == null || _io.disconnect();
4193 io = null;
4194 }
4195 function refresh(skip, threshold) {
4196 if (skip === void 0) {
4197 skip = false;
4198 }
4199 if (threshold === void 0) {
4200 threshold = 1;
4201 }
4202 cleanup();
4203 const elementRectForRootMargin = element.getBoundingClientRect();
4204 const {
4205 left,
4206 top,
4207 width,
4208 height
4209 } = elementRectForRootMargin;
4210 if (!skip) {
4211 onMove();
4212 }
4213 if (!width || !height) {
4214 return;
4215 }
4216 const insetTop = floor(top);
4217 const insetRight = floor(root.clientWidth - (left + width));
4218 const insetBottom = floor(root.clientHeight - (top + height));
4219 const insetLeft = floor(left);
4220 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
4221 const options = {
4222 rootMargin,
4223 threshold: max(0, min(1, threshold)) || 1
4224 };
4225 let isFirstUpdate = true;
4226 function handleObserve(entries) {
4227 const ratio = entries[0].intersectionRatio;
4228 if (ratio !== threshold) {
4229 if (!isFirstUpdate) {
4230 return refresh();
4231 }
4232 if (!ratio) {
4233 timeoutId = setTimeout(() => {
4234 refresh(false, 1e-7);
4235 }, 1e3);
4236 } else {
4237 refresh(false, ratio);
4238 }
4239 }
4240 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
4241 refresh();
4242 }
4243 isFirstUpdate = false;
4244 }
4245 try {
4246 io = new IntersectionObserver(handleObserve, {
4247 ...options,
4248 // Handle <iframe>s
4249 root: root.ownerDocument
4250 });
4251 } catch (_e) {
4252 io = new IntersectionObserver(handleObserve, options);
4253 }
4254 io.observe(element);
4255 }
4256 refresh(true);
4257 return cleanup;
4258 }
4259 function autoUpdate(reference, floating, update2, options) {
4260 if (options === void 0) {
4261 options = {};
4262 }
4263 const {
4264 ancestorScroll = true,
4265 ancestorResize = true,
4266 elementResize = typeof ResizeObserver === "function",
4267 layoutShift = typeof IntersectionObserver === "function",
4268 animationFrame = false
4269 } = options;
4270 const referenceEl = unwrapElement(reference);
4271 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
4272 ancestors.forEach((ancestor) => {
4273 ancestorScroll && ancestor.addEventListener("scroll", update2, {
4274 passive: true
4275 });
4276 ancestorResize && ancestor.addEventListener("resize", update2);
4277 });
4278 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null;
4279 let reobserveFrame = -1;
4280 let resizeObserver = null;
4281 if (elementResize) {
4282 resizeObserver = new ResizeObserver((_ref) => {
4283 let [firstEntry] = _ref;
4284 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
4285 resizeObserver.unobserve(floating);
4286 cancelAnimationFrame(reobserveFrame);
4287 reobserveFrame = requestAnimationFrame(() => {
4288 var _resizeObserver;
4289 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
4290 });
4291 }
4292 update2();
4293 });
4294 if (referenceEl && !animationFrame) {
4295 resizeObserver.observe(referenceEl);
4296 }
4297 if (floating) {
4298 resizeObserver.observe(floating);
4299 }
4300 }
4301 let frameId;
4302 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
4303 if (animationFrame) {
4304 frameLoop();
4305 }
4306 function frameLoop() {
4307 const nextRefRect = getBoundingClientRect(reference);
4308 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
4309 update2();
4310 }
4311 prevRefRect = nextRefRect;
4312 frameId = requestAnimationFrame(frameLoop);
4313 }
4314 update2();
4315 return () => {
4316 var _resizeObserver2;
4317 ancestors.forEach((ancestor) => {
4318 ancestorScroll && ancestor.removeEventListener("scroll", update2);
4319 ancestorResize && ancestor.removeEventListener("resize", update2);
4320 });
4321 cleanupIo == null || cleanupIo();
4322 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
4323 resizeObserver = null;
4324 if (animationFrame) {
4325 cancelAnimationFrame(frameId);
4326 }
4327 };
4328 }
4329 var offset2 = offset;
4330 var shift2 = shift;
4331 var flip2 = flip;
4332 var size2 = size;
4333 var hide2 = hide;
4334 var limitShift2 = limitShift;
4335 var computePosition2 = (reference, floating, options) => {
4336 const cache = /* @__PURE__ */ new Map();
4337 const mergedOptions = {
4338 platform: platform2,
4339 ...options
4340 };
4341 const platformWithCache = {
4342 ...mergedOptions.platform,
4343 _c: cache
4344 };
4345 return computePosition(reference, floating, {
4346 ...mergedOptions,
4347 platform: platformWithCache
4348 });
4349 };
4350
4351 // node_modules/@base-ui/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
4352 var React20 = __toESM(require_react(), 1);
4353 var import_react2 = __toESM(require_react(), 1);
4354 var ReactDOM3 = __toESM(require_react_dom(), 1);
4355 var isClient = typeof document !== "undefined";
4356 var noop2 = function noop3() {
4357 };
4358 var index = isClient ? import_react2.useLayoutEffect : noop2;
4359 function deepEqual(a, b) {
4360 if (a === b) {
4361 return true;
4362 }
4363 if (typeof a !== typeof b) {
4364 return false;
4365 }
4366 if (typeof a === "function" && a.toString() === b.toString()) {
4367 return true;
4368 }
4369 let length;
4370 let i;
4371 let keys;
4372 if (a && b && typeof a === "object") {
4373 if (Array.isArray(a)) {
4374 length = a.length;
4375 if (length !== b.length) return false;
4376 for (i = length; i-- !== 0; ) {
4377 if (!deepEqual(a[i], b[i])) {
4378 return false;
4379 }
4380 }
4381 return true;
4382 }
4383 keys = Object.keys(a);
4384 length = keys.length;
4385 if (length !== Object.keys(b).length) {
4386 return false;
4387 }
4388 for (i = length; i-- !== 0; ) {
4389 if (!{}.hasOwnProperty.call(b, keys[i])) {
4390 return false;
4391 }
4392 }
4393 for (i = length; i-- !== 0; ) {
4394 const key = keys[i];
4395 if (key === "_owner" && a.$$typeof) {
4396 continue;
4397 }
4398 if (!deepEqual(a[key], b[key])) {
4399 return false;
4400 }
4401 }
4402 return true;
4403 }
4404 return a !== a && b !== b;
4405 }
4406 function getDPR(element) {
4407 if (typeof window === "undefined") {
4408 return 1;
4409 }
4410 const win = element.ownerDocument.defaultView || window;
4411 return win.devicePixelRatio || 1;
4412 }
4413 function roundByDPR(element, value) {
4414 const dpr = getDPR(element);
4415 return Math.round(value * dpr) / dpr;
4416 }
4417 function useLatestRef(value) {
4418 const ref = React20.useRef(value);
4419 index(() => {
4420 ref.current = value;
4421 });
4422 return ref;
4423 }
4424 function useFloating(options) {
4425 if (options === void 0) {
4426 options = {};
4427 }
4428 const {
4429 placement = "bottom",
4430 strategy = "absolute",
4431 middleware = [],
4432 platform: platform3,
4433 elements: {
4434 reference: externalReference,
4435 floating: externalFloating
4436 } = {},
4437 transform = true,
4438 whileElementsMounted,
4439 open
4440 } = options;
4441 const [data, setData] = React20.useState({
4442 x: 0,
4443 y: 0,
4444 strategy,
4445 placement,
4446 middlewareData: {},
4447 isPositioned: false
4448 });
4449 const [latestMiddleware, setLatestMiddleware] = React20.useState(middleware);
4450 if (!deepEqual(latestMiddleware, middleware)) {
4451 setLatestMiddleware(middleware);
4452 }
4453 const [_reference, _setReference] = React20.useState(null);
4454 const [_floating, _setFloating] = React20.useState(null);
4455 const setReference = React20.useCallback((node) => {
4456 if (node !== referenceRef.current) {
4457 referenceRef.current = node;
4458 _setReference(node);
4459 }
4460 }, []);
4461 const setFloating = React20.useCallback((node) => {
4462 if (node !== floatingRef.current) {
4463 floatingRef.current = node;
4464 _setFloating(node);
4465 }
4466 }, []);
4467 const referenceEl = externalReference || _reference;
4468 const floatingEl = externalFloating || _floating;
4469 const referenceRef = React20.useRef(null);
4470 const floatingRef = React20.useRef(null);
4471 const dataRef = React20.useRef(data);
4472 const hasWhileElementsMounted = whileElementsMounted != null;
4473 const whileElementsMountedRef = useLatestRef(whileElementsMounted);
4474 const platformRef = useLatestRef(platform3);
4475 const openRef = useLatestRef(open);
4476 const update2 = React20.useCallback(() => {
4477 if (!referenceRef.current || !floatingRef.current) {
4478 return;
4479 }
4480 const config = {
4481 placement,
4482 strategy,
4483 middleware: latestMiddleware
4484 };
4485 if (platformRef.current) {
4486 config.platform = platformRef.current;
4487 }
4488 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
4489 const fullData = {
4490 ...data2,
4491 // The floating element's position may be recomputed while it's closed
4492 // but still mounted (such as when transitioning out). To ensure
4493 // `isPositioned` will be `false` initially on the next open, avoid
4494 // setting it to `true` when `open === false` (must be specified).
4495 isPositioned: openRef.current !== false
4496 };
4497 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
4498 dataRef.current = fullData;
4499 ReactDOM3.flushSync(() => {
4500 setData(fullData);
4501 });
4502 }
4503 });
4504 }, [latestMiddleware, placement, strategy, platformRef, openRef]);
4505 index(() => {
4506 if (open === false && dataRef.current.isPositioned) {
4507 dataRef.current.isPositioned = false;
4508 setData((data2) => ({
4509 ...data2,
4510 isPositioned: false
4511 }));
4512 }
4513 }, [open]);
4514 const isMountedRef = React20.useRef(false);
4515 index(() => {
4516 isMountedRef.current = true;
4517 return () => {
4518 isMountedRef.current = false;
4519 };
4520 }, []);
4521 index(() => {
4522 if (referenceEl) referenceRef.current = referenceEl;
4523 if (floatingEl) floatingRef.current = floatingEl;
4524 if (referenceEl && floatingEl) {
4525 if (whileElementsMountedRef.current) {
4526 return whileElementsMountedRef.current(referenceEl, floatingEl, update2);
4527 }
4528 update2();
4529 }
4530 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]);
4531 const refs = React20.useMemo(() => ({
4532 reference: referenceRef,
4533 floating: floatingRef,
4534 setReference,
4535 setFloating
4536 }), [setReference, setFloating]);
4537 const elements = React20.useMemo(() => ({
4538 reference: referenceEl,
4539 floating: floatingEl
4540 }), [referenceEl, floatingEl]);
4541 const floatingStyles = React20.useMemo(() => {
4542 const initialStyles = {
4543 position: strategy,
4544 left: 0,
4545 top: 0
4546 };
4547 if (!elements.floating) {
4548 return initialStyles;
4549 }
4550 const x = roundByDPR(elements.floating, data.x);
4551 const y = roundByDPR(elements.floating, data.y);
4552 if (transform) {
4553 return {
4554 ...initialStyles,
4555 transform: "translate(" + x + "px, " + y + "px)",
4556 ...getDPR(elements.floating) >= 1.5 && {
4557 willChange: "transform"
4558 }
4559 };
4560 }
4561 return {
4562 position: strategy,
4563 left: x,
4564 top: y
4565 };
4566 }, [strategy, transform, elements.floating, data.x, data.y]);
4567 return React20.useMemo(() => ({
4568 ...data,
4569 update: update2,
4570 refs,
4571 elements,
4572 floatingStyles
4573 }), [data, update2, refs, elements, floatingStyles]);
4574 }
4575 var offset3 = (options, deps) => {
4576 const result = offset2(options);
4577 return {
4578 name: result.name,
4579 fn: result.fn,
4580 options: [options, deps]
4581 };
4582 };
4583 var shift3 = (options, deps) => {
4584 const result = shift2(options);
4585 return {
4586 name: result.name,
4587 fn: result.fn,
4588 options: [options, deps]
4589 };
4590 };
4591 var limitShift3 = (options, deps) => {
4592 const result = limitShift2(options);
4593 return {
4594 fn: result.fn,
4595 options: [options, deps]
4596 };
4597 };
4598 var flip3 = (options, deps) => {
4599 const result = flip2(options);
4600 return {
4601 name: result.name,
4602 fn: result.fn,
4603 options: [options, deps]
4604 };
4605 };
4606 var size3 = (options, deps) => {
4607 const result = size2(options);
4608 return {
4609 name: result.name,
4610 fn: result.fn,
4611 options: [options, deps]
4612 };
4613 };
4614 var hide3 = (options, deps) => {
4615 const result = hide2(options);
4616 return {
4617 name: result.name,
4618 fn: result.fn,
4619 options: [options, deps]
4620 };
4621 };
4622
4623 // node_modules/@base-ui/utils/esm/store/createSelector.js
4624 var createSelector = (a, b, c, d, e, f, ...other) => {
4625 if (other.length > 0) {
4626 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1));
4627 }
4628 let selector;
4629 if (a && b && c && d && e && f) {
4630 selector = (state, a1, a2, a3) => {
4631 const va = a(state, a1, a2, a3);
4632 const vb = b(state, a1, a2, a3);
4633 const vc = c(state, a1, a2, a3);
4634 const vd = d(state, a1, a2, a3);
4635 const ve = e(state, a1, a2, a3);
4636 return f(va, vb, vc, vd, ve, a1, a2, a3);
4637 };
4638 } else if (a && b && c && d && e) {
4639 selector = (state, a1, a2, a3) => {
4640 const va = a(state, a1, a2, a3);
4641 const vb = b(state, a1, a2, a3);
4642 const vc = c(state, a1, a2, a3);
4643 const vd = d(state, a1, a2, a3);
4644 return e(va, vb, vc, vd, a1, a2, a3);
4645 };
4646 } else if (a && b && c && d) {
4647 selector = (state, a1, a2, a3) => {
4648 const va = a(state, a1, a2, a3);
4649 const vb = b(state, a1, a2, a3);
4650 const vc = c(state, a1, a2, a3);
4651 return d(va, vb, vc, a1, a2, a3);
4652 };
4653 } else if (a && b && c) {
4654 selector = (state, a1, a2, a3) => {
4655 const va = a(state, a1, a2, a3);
4656 const vb = b(state, a1, a2, a3);
4657 return c(va, vb, a1, a2, a3);
4658 };
4659 } else if (a && b) {
4660 selector = (state, a1, a2, a3) => {
4661 const va = a(state, a1, a2, a3);
4662 return b(va, a1, a2, a3);
4663 };
4664 } else if (a) {
4665 selector = a;
4666 } else {
4667 throw (
4668 /* minify-error-disabled */
4669 new Error("Missing arguments")
4670 );
4671 }
4672 return selector;
4673 };
4674
4675 // node_modules/@base-ui/utils/esm/store/useStore.js
4676 var React22 = __toESM(require_react(), 1);
4677 var import_shim = __toESM(require_shim(), 1);
4678 var import_with_selector = __toESM(require_with_selector(), 1);
4679
4680 // node_modules/@base-ui/utils/esm/fastHooks.js
4681 var React21 = __toESM(require_react(), 1);
4682 var hooks = [];
4683 var currentInstance = void 0;
4684 function getInstance() {
4685 return currentInstance;
4686 }
4687 function register(hook) {
4688 hooks.push(hook);
4689 }
4690 function fastComponent(fn) {
4691 const FastComponent = (props, forwardedRef) => {
4692 const instance = useRefWithInit(createInstance).current;
4693 let result;
4694 try {
4695 currentInstance = instance;
4696 for (const hook of hooks) {
4697 hook.before(instance);
4698 }
4699 result = fn(props, forwardedRef);
4700 for (const hook of hooks) {
4701 hook.after(instance);
4702 }
4703 instance.didInitialize = true;
4704 } finally {
4705 currentInstance = void 0;
4706 }
4707 return result;
4708 };
4709 FastComponent.displayName = fn.displayName || fn.name;
4710 return FastComponent;
4711 }
4712 function fastComponentRef(fn) {
4713 return /* @__PURE__ */ React21.forwardRef(fastComponent(fn));
4714 }
4715 function createInstance() {
4716 return {
4717 didInitialize: false
4718 };
4719 }
4720
4721 // node_modules/@base-ui/utils/esm/store/useStore.js
4722 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);
4723 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;
4724 function useStore(store2, selector, a1, a2, a3) {
4725 return useStoreImplementation(store2, selector, a1, a2, a3);
4726 }
4727 function useStoreR19(store2, selector, a1, a2, a3) {
4728 const getSelection = React22.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]);
4729 return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection);
4730 }
4731 register({
4732 before(instance) {
4733 instance.syncIndex = 0;
4734 if (!instance.didInitialize) {
4735 instance.syncTick = 1;
4736 instance.syncHooks = [];
4737 instance.didChangeStore = true;
4738 instance.getSnapshot = () => {
4739 let didChange2 = false;
4740 for (let i = 0; i < instance.syncHooks.length; i += 1) {
4741 const hook = instance.syncHooks[i];
4742 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);
4743 if (hook.didChange || !Object.is(hook.value, value)) {
4744 didChange2 = true;
4745 hook.value = value;
4746 hook.didChange = false;
4747 }
4748 }
4749 if (didChange2) {
4750 instance.syncTick += 1;
4751 }
4752 return instance.syncTick;
4753 };
4754 }
4755 },
4756 after(instance) {
4757 if (instance.syncHooks.length > 0) {
4758 if (instance.didChangeStore) {
4759 instance.didChangeStore = false;
4760 instance.subscribe = (onStoreChange) => {
4761 const stores = /* @__PURE__ */ new Set();
4762 for (const hook of instance.syncHooks) {
4763 stores.add(hook.store);
4764 }
4765 const unsubscribes = [];
4766 for (const store2 of stores) {
4767 unsubscribes.push(store2.subscribe(onStoreChange));
4768 }
4769 return () => {
4770 for (const unsubscribe of unsubscribes) {
4771 unsubscribe();
4772 }
4773 };
4774 };
4775 }
4776 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot);
4777 }
4778 }
4779 });
4780 function useStoreFast(store2, selector, a1, a2, a3) {
4781 const instance = getInstance();
4782 if (!instance) {
4783 return useStoreR19(store2, selector, a1, a2, a3);
4784 }
4785 const index2 = instance.syncIndex;
4786 instance.syncIndex += 1;
4787 let hook;
4788 if (!instance.didInitialize) {
4789 hook = {
4790 store: store2,
4791 selector,
4792 a1,
4793 a2,
4794 a3,
4795 value: selector(store2.getSnapshot(), a1, a2, a3),
4796 didChange: false
4797 };
4798 instance.syncHooks.push(hook);
4799 } else {
4800 hook = instance.syncHooks[index2];
4801 if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {
4802 if (hook.store !== store2) {
4803 instance.didChangeStore = true;
4804 }
4805 hook.store = store2;
4806 hook.selector = selector;
4807 hook.a1 = a1;
4808 hook.a2 = a2;
4809 hook.a3 = a3;
4810 hook.didChange = true;
4811 }
4812 }
4813 return hook.value;
4814 }
4815 function useStoreLegacy(store2, selector, a1, a2, a3) {
4816 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3));
4817 }
4818
4819 // node_modules/@base-ui/utils/esm/store/Store.js
4820 var Store = class {
4821 /**
4822 * The current state of the store.
4823 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
4824 * 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).
4825 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
4826 *
4827 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
4828 */
4829 // Internal state to handle recursive `setState()` calls
4830 constructor(state) {
4831 this.state = state;
4832 this.listeners = /* @__PURE__ */ new Set();
4833 this.updateTick = 0;
4834 }
4835 /**
4836 * Registers a listener that will be called whenever the store's state changes.
4837 *
4838 * @param fn The listener function to be called on state changes.
4839 * @returns A function to unsubscribe the listener.
4840 */
4841 subscribe = (fn) => {
4842 this.listeners.add(fn);
4843 return () => {
4844 this.listeners.delete(fn);
4845 };
4846 };
4847 /**
4848 * Returns the current state of the store.
4849 */
4850 getSnapshot = () => {
4851 return this.state;
4852 };
4853 /**
4854 * Updates the entire store's state and notifies all registered listeners.
4855 *
4856 * @param newState The new state to set for the store.
4857 */
4858 setState(newState) {
4859 if (this.state === newState) {
4860 return;
4861 }
4862 this.state = newState;
4863 this.updateTick += 1;
4864 const currentTick = this.updateTick;
4865 for (const listener of this.listeners) {
4866 if (currentTick !== this.updateTick) {
4867 return;
4868 }
4869 listener(newState);
4870 }
4871 }
4872 /**
4873 * Merges the provided changes into the current state and notifies listeners if there are changes.
4874 *
4875 * @param changes An object containing the changes to apply to the current state.
4876 */
4877 update(changes) {
4878 for (const key in changes) {
4879 if (!Object.is(this.state[key], changes[key])) {
4880 this.setState({
4881 ...this.state,
4882 ...changes
4883 });
4884 return;
4885 }
4886 }
4887 }
4888 /**
4889 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
4890 *
4891 * @param key The key in the store's state to update.
4892 * @param value The new value to set for the specified key.
4893 */
4894 set(key, value) {
4895 if (!Object.is(this.state[key], value)) {
4896 this.setState({
4897 ...this.state,
4898 [key]: value
4899 });
4900 }
4901 }
4902 /**
4903 * Gives the state a new reference and updates all registered listeners.
4904 */
4905 notifyAll() {
4906 const newState = {
4907 ...this.state
4908 };
4909 this.setState(newState);
4910 }
4911 use(selector, a1, a2, a3) {
4912 return useStore(this, selector, a1, a2, a3);
4913 }
4914 };
4915
4916 // node_modules/@base-ui/utils/esm/store/ReactStore.js
4917 var React23 = __toESM(require_react(), 1);
4918 var ReactStore = class extends Store {
4919 /**
4920 * Creates a new ReactStore instance.
4921 *
4922 * @param state Initial state of the store.
4923 * @param context Non-reactive context values.
4924 * @param selectors Optional selectors for use with `useState`.
4925 */
4926 constructor(state, context = {}, selectors3) {
4927 super(state);
4928 this.context = context;
4929 this.selectors = selectors3;
4930 }
4931 /**
4932 * Non-reactive values such as refs, callbacks, etc.
4933 */
4934 /**
4935 * Synchronizes a single external value into the store.
4936 *
4937 * Note that the while the value in `state` is updated immediately, the value returned
4938 * by `useState` is updated before the next render (similarly to React's `useState`).
4939 */
4940 useSyncedValue(key, value) {
4941 React23.useDebugValue(key);
4942 useIsoLayoutEffect(() => {
4943 if (this.state[key] !== value) {
4944 this.set(key, value);
4945 }
4946 }, [key, value]);
4947 }
4948 /**
4949 * Synchronizes a single external value into the store and
4950 * cleans it up (sets to `undefined`) on unmount.
4951 *
4952 * Note that the while the value in `state` is updated immediately, the value returned
4953 * by `useState` is updated before the next render (similarly to React's `useState`).
4954 */
4955 useSyncedValueWithCleanup(key, value) {
4956 const store2 = this;
4957 useIsoLayoutEffect(() => {
4958 if (store2.state[key] !== value) {
4959 store2.set(key, value);
4960 }
4961 return () => {
4962 store2.set(key, void 0);
4963 };
4964 }, [store2, key, value]);
4965 }
4966 /**
4967 * Synchronizes multiple external values into the store.
4968 *
4969 * Note that the while the values in `state` are updated immediately, the values returned
4970 * by `useState` are updated before the next render (similarly to React's `useState`).
4971 */
4972 useSyncedValues(statePart) {
4973 const store2 = this;
4974 if (true) {
4975 React23.useDebugValue(statePart, (p) => Object.keys(p));
4976 const keys = React23.useRef(Object.keys(statePart)).current;
4977 const nextKeys = Object.keys(statePart);
4978 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) {
4979 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
4980 }
4981 }
4982 const dependencies = Object.values(statePart);
4983 useIsoLayoutEffect(() => {
4984 store2.update(statePart);
4985 }, [store2, ...dependencies]);
4986 }
4987 /**
4988 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
4989 * is non-undefined, the store's state at `key` is updated to match `controlled`.
4990 */
4991 useControlledProp(key, controlled) {
4992 React23.useDebugValue(key);
4993 const isControlled = controlled !== void 0;
4994 useIsoLayoutEffect(() => {
4995 if (isControlled && !Object.is(this.state[key], controlled)) {
4996 super.setState({
4997 ...this.state,
4998 [key]: controlled
4999 });
5000 }
5001 }, [key, controlled, isControlled]);
5002 if (true) {
5003 const cache = this.controlledValues ??= /* @__PURE__ */ new Map();
5004 if (!cache.has(key)) {
5005 cache.set(key, isControlled);
5006 }
5007 const previouslyControlled = cache.get(key);
5008 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) {
5009 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).`);
5010 }
5011 }
5012 }
5013 /** Gets the current value from the store using a selector with the provided key.
5014 *
5015 * @param key Key of the selector to use.
5016 */
5017 select(key, a1, a2, a3) {
5018 const selector = this.selectors[key];
5019 return selector(this.state, a1, a2, a3);
5020 }
5021 /**
5022 * Returns a value from the store's state using a selector function.
5023 * Used to subscribe to specific parts of the state.
5024 * This methods causes a rerender whenever the selected state changes.
5025 *
5026 * @param key Key of the selector to use.
5027 */
5028 useState(key, a1, a2, a3) {
5029 React23.useDebugValue(key);
5030 return useStore(this, this.selectors[key], a1, a2, a3);
5031 }
5032 /**
5033 * Wraps a function with `useStableCallback` to ensure it has a stable reference
5034 * and assigns it to the context.
5035 *
5036 * @param key Key of the event callback. Must be a function in the context.
5037 * @param fn Function to assign.
5038 */
5039 useContextCallback(key, fn) {
5040 React23.useDebugValue(key);
5041 const stableFunction = useStableCallback(fn ?? NOOP);
5042 this.context[key] = stableFunction;
5043 }
5044 /**
5045 * Returns a stable setter function for a specific key in the store's state.
5046 * It's commonly used to pass as a ref callback to React elements.
5047 *
5048 * @param key Key of the state to set.
5049 */
5050 useStateSetter(key) {
5051 const ref = React23.useRef(void 0);
5052 if (ref.current === void 0) {
5053 ref.current = (value) => {
5054 this.set(key, value);
5055 };
5056 }
5057 return ref.current;
5058 }
5059 /**
5060 * Observes changes derived from the store's selectors and calls the listener when the selected value changes.
5061 *
5062 * @param key Key of the selector to observe.
5063 * @param listener Listener function called when the selector result changes.
5064 */
5065 observe(selector, listener) {
5066 let selectFn;
5067 if (typeof selector === "function") {
5068 selectFn = selector;
5069 } else {
5070 selectFn = this.selectors[selector];
5071 }
5072 let prevValue = selectFn(this.state);
5073 listener(prevValue, prevValue, this);
5074 return this.subscribe((nextState) => {
5075 const nextValue = selectFn(nextState);
5076 if (!Object.is(prevValue, nextValue)) {
5077 const oldValue = prevValue;
5078 prevValue = nextValue;
5079 listener(nextValue, oldValue, this);
5080 }
5081 });
5082 }
5083 };
5084
5085 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingRootStore.js
5086 var selectors = {
5087 open: createSelector((state) => state.open),
5088 transitionStatus: createSelector((state) => state.transitionStatus),
5089 domReferenceElement: createSelector((state) => state.domReferenceElement),
5090 referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement),
5091 floatingElement: createSelector((state) => state.floatingElement),
5092 floatingId: createSelector((state) => state.floatingId)
5093 };
5094 var FloatingRootStore = class extends ReactStore {
5095 constructor(options) {
5096 const {
5097 syncOnly,
5098 nested,
5099 onOpenChange,
5100 triggerElements,
5101 ...initialState
5102 } = options;
5103 super({
5104 ...initialState,
5105 positionReference: initialState.referenceElement,
5106 domReferenceElement: initialState.referenceElement
5107 }, {
5108 onOpenChange,
5109 dataRef: {
5110 current: {}
5111 },
5112 events: createEventEmitter(),
5113 nested,
5114 triggerElements
5115 }, selectors);
5116 this.syncOnly = syncOnly;
5117 }
5118 /**
5119 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.
5120 */
5121 syncOpenEvent = (newOpen, event) => {
5122 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
5123 // click events to upgrade a hover-open.
5124 event != null && isClickLikeEvent(event)) {
5125 this.context.dataRef.current.openEvent = newOpen ? event : void 0;
5126 }
5127 };
5128 /**
5129 * Runs the root-owned side effects for an open state change.
5130 */
5131 dispatchOpenChange = (newOpen, eventDetails) => {
5132 this.syncOpenEvent(newOpen, eventDetails.event);
5133 const details = {
5134 open: newOpen,
5135 reason: eventDetails.reason,
5136 nativeEvent: eventDetails.event,
5137 nested: this.context.nested,
5138 triggerElement: eventDetails.trigger
5139 };
5140 this.context.events.emit("openchange", details);
5141 };
5142 /**
5143 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
5144 *
5145 * @param newOpen The new open state.
5146 * @param eventDetails Details about the event that triggered the open state change.
5147 */
5148 setOpen = (newOpen, eventDetails) => {
5149 if (this.syncOnly) {
5150 this.context.onOpenChange?.(newOpen, eventDetails);
5151 return;
5152 }
5153 this.dispatchOpenChange(newOpen, eventDetails);
5154 this.context.onOpenChange?.(newOpen, eventDetails);
5155 };
5156 };
5157
5158 // node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js
5159 var React24 = __toESM(require_react(), 1);
5160 function useTriggerRegistration(id, store2) {
5161 const registeredElementIdRef = React24.useRef(null);
5162 const registeredElementRef = React24.useRef(null);
5163 return React24.useCallback((element) => {
5164 if (id === void 0) {
5165 return;
5166 }
5167 if (registeredElementIdRef.current !== null) {
5168 const registeredId = registeredElementIdRef.current;
5169 const registeredElement = registeredElementRef.current;
5170 const currentElement = store2.context.triggerElements.getById(registeredId);
5171 if (registeredElement && currentElement === registeredElement) {
5172 store2.context.triggerElements.delete(registeredId);
5173 }
5174 registeredElementIdRef.current = null;
5175 registeredElementRef.current = null;
5176 }
5177 if (element !== null) {
5178 registeredElementIdRef.current = id;
5179 registeredElementRef.current = element;
5180 store2.context.triggerElements.add(id, element);
5181 }
5182 }, [store2, id]);
5183 }
5184 function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) {
5185 const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId);
5186 const baseRegisterTrigger = useTriggerRegistration(triggerId, store2);
5187 const registerTrigger = useStableCallback((element) => {
5188 baseRegisterTrigger(element);
5189 if (!element || !store2.select("open")) {
5190 return;
5191 }
5192 const activeTriggerId = store2.select("activeTriggerId");
5193 if (activeTriggerId === triggerId) {
5194 store2.update({
5195 activeTriggerElement: element,
5196 ...stateUpdates
5197 });
5198 return;
5199 }
5200 if (activeTriggerId == null) {
5201 store2.update({
5202 activeTriggerId: triggerId,
5203 activeTriggerElement: element,
5204 ...stateUpdates
5205 });
5206 }
5207 });
5208 useIsoLayoutEffect(() => {
5209 if (isMountedByThisTrigger) {
5210 store2.update({
5211 activeTriggerElement: triggerElementRef.current,
5212 ...stateUpdates
5213 });
5214 }
5215 }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]);
5216 return {
5217 registerTrigger,
5218 isMountedByThisTrigger
5219 };
5220 }
5221 function useImplicitActiveTrigger(store2) {
5222 const open = store2.useState("open");
5223 useIsoLayoutEffect(() => {
5224 if (open && !store2.select("activeTriggerId") && store2.context.triggerElements.size === 1) {
5225 const iteratorResult = store2.context.triggerElements.entries().next();
5226 if (!iteratorResult.done) {
5227 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;
5228 store2.update({
5229 activeTriggerId: implicitTriggerId,
5230 activeTriggerElement: implicitTriggerElement
5231 });
5232 }
5233 }
5234 }, [open, store2]);
5235 }
5236 function useOpenStateTransitions(open, store2, onUnmount) {
5237 const {
5238 mounted,
5239 setMounted,
5240 transitionStatus
5241 } = useTransitionStatus(open);
5242 store2.useSyncedValues({
5243 mounted,
5244 transitionStatus
5245 });
5246 const forceUnmount = useStableCallback(() => {
5247 setMounted(false);
5248 store2.update({
5249 activeTriggerId: null,
5250 activeTriggerElement: null,
5251 mounted: false
5252 });
5253 onUnmount?.();
5254 store2.context.onOpenChangeComplete?.(false);
5255 });
5256 const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose");
5257 useOpenChangeComplete({
5258 enabled: !preventUnmountingOnClose,
5259 open,
5260 ref: store2.context.popupRef,
5261 onComplete() {
5262 if (!open) {
5263 forceUnmount();
5264 }
5265 }
5266 });
5267 return {
5268 forceUnmount,
5269 transitionStatus
5270 };
5271 }
5272
5273 // node_modules/@base-ui/react/esm/utils/popups/popupTriggerMap.js
5274 var PopupTriggerMap = class {
5275 constructor() {
5276 this.elementsSet = /* @__PURE__ */ new Set();
5277 this.idMap = /* @__PURE__ */ new Map();
5278 }
5279 /**
5280 * Adds a trigger element with the given ID.
5281 *
5282 * Note: The provided element is assumed to not be registered under multiple IDs.
5283 */
5284 add(id, element) {
5285 const existingElement = this.idMap.get(id);
5286 if (existingElement === element) {
5287 return;
5288 }
5289 if (existingElement !== void 0) {
5290 this.elementsSet.delete(existingElement);
5291 }
5292 this.elementsSet.add(element);
5293 this.idMap.set(id, element);
5294 if (true) {
5295 if (this.elementsSet.size !== this.idMap.size) {
5296 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");
5297 }
5298 }
5299 }
5300 /**
5301 * Removes the trigger element with the given ID.
5302 */
5303 delete(id) {
5304 const element = this.idMap.get(id);
5305 if (element) {
5306 this.elementsSet.delete(element);
5307 this.idMap.delete(id);
5308 }
5309 }
5310 /**
5311 * Whether the given element is registered as a trigger.
5312 */
5313 hasElement(element) {
5314 return this.elementsSet.has(element);
5315 }
5316 /**
5317 * Whether there is a registered trigger element matching the given predicate.
5318 */
5319 hasMatchingElement(predicate) {
5320 for (const element of this.elementsSet) {
5321 if (predicate(element)) {
5322 return true;
5323 }
5324 }
5325 return false;
5326 }
5327 /**
5328 * Returns the trigger element associated with the given ID, or undefined if no such element exists.
5329 */
5330 getById(id) {
5331 return this.idMap.get(id);
5332 }
5333 /**
5334 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].
5335 */
5336 entries() {
5337 return this.idMap.entries();
5338 }
5339 /**
5340 * Returns an iterable of all registered trigger elements.
5341 */
5342 elements() {
5343 return this.elementsSet.values();
5344 }
5345 /**
5346 * Returns the number of registered trigger elements.
5347 */
5348 get size() {
5349 return this.idMap.size;
5350 }
5351 };
5352
5353 // node_modules/@base-ui/react/esm/floating-ui-react/utils/getEmptyRootContext.js
5354 function getEmptyRootContext() {
5355 return new FloatingRootStore({
5356 open: false,
5357 transitionStatus: void 0,
5358 floatingElement: null,
5359 referenceElement: null,
5360 triggerElements: new PopupTriggerMap(),
5361 floatingId: "",
5362 syncOnly: false,
5363 nested: false,
5364 onOpenChange: void 0
5365 });
5366 }
5367
5368 // node_modules/@base-ui/react/esm/utils/popups/store.js
5369 function createInitialPopupStoreState() {
5370 return {
5371 open: false,
5372 openProp: void 0,
5373 mounted: false,
5374 transitionStatus: void 0,
5375 floatingRootContext: getEmptyRootContext(),
5376 preventUnmountingOnClose: false,
5377 payload: void 0,
5378 activeTriggerId: null,
5379 activeTriggerElement: null,
5380 triggerIdProp: void 0,
5381 popupElement: null,
5382 positionerElement: null,
5383 activeTriggerProps: EMPTY_OBJECT,
5384 inactiveTriggerProps: EMPTY_OBJECT,
5385 popupProps: EMPTY_OBJECT
5386 };
5387 }
5388 var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId);
5389 var popupStoreSelectors = {
5390 open: createSelector((state) => state.openProp ?? state.open),
5391 mounted: createSelector((state) => state.mounted),
5392 transitionStatus: createSelector((state) => state.transitionStatus),
5393 floatingRootContext: createSelector((state) => state.floatingRootContext),
5394 preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose),
5395 payload: createSelector((state) => state.payload),
5396 activeTriggerId: activeTriggerIdSelector,
5397 activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null),
5398 /**
5399 * Whether the trigger with the given ID was used to open the popup.
5400 */
5401 isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId),
5402 /**
5403 * Whether the popup is open and was activated by a trigger with the given ID.
5404 */
5405 isOpenedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.open),
5406 /**
5407 * Whether the popup is mounted and was activated by a trigger with the given ID.
5408 */
5409 isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted),
5410 triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps),
5411 popupProps: createSelector((state) => state.popupProps),
5412 popupElement: createSelector((state) => state.popupElement),
5413 positionerElement: createSelector((state) => state.positionerElement)
5414 };
5415
5416 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloatingRootContext.js
5417 function useFloatingRootContext(options) {
5418 const {
5419 open = false,
5420 onOpenChange,
5421 elements = {}
5422 } = options;
5423 const floatingId = useId();
5424 const nested = useFloatingParentNodeId() != null;
5425 if (true) {
5426 const optionDomReference = elements.reference;
5427 if (optionDomReference && !isElement(optionDomReference)) {
5428 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead.");
5429 }
5430 }
5431 const store2 = useRefWithInit(() => new FloatingRootStore({
5432 open,
5433 transitionStatus: void 0,
5434 onOpenChange,
5435 referenceElement: elements.reference ?? null,
5436 floatingElement: elements.floating ?? null,
5437 triggerElements: new PopupTriggerMap(),
5438 floatingId,
5439 syncOnly: false,
5440 nested
5441 })).current;
5442 useIsoLayoutEffect(() => {
5443 const valuesToSync = {
5444 open,
5445 floatingId
5446 };
5447 if (elements.reference !== void 0) {
5448 valuesToSync.referenceElement = elements.reference;
5449 valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;
5450 }
5451 if (elements.floating !== void 0) {
5452 valuesToSync.floatingElement = elements.floating;
5453 }
5454 store2.update(valuesToSync);
5455 }, [open, floatingId, elements.reference, elements.floating, store2]);
5456 store2.context.onOpenChange = onOpenChange;
5457 store2.context.nested = nested;
5458 return store2;
5459 }
5460
5461 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js
5462 function useFloating2(options = {}) {
5463 const {
5464 nodeId,
5465 externalTree
5466 } = options;
5467 const internalRootStore = useFloatingRootContext(options);
5468 const rootContext = options.rootContext || internalRootStore;
5469 const rootContextElements = {
5470 reference: rootContext.useState("referenceElement"),
5471 floating: rootContext.useState("floatingElement"),
5472 domReference: rootContext.useState("domReferenceElement")
5473 };
5474 const [positionReference, setPositionReferenceRaw] = React25.useState(null);
5475 const domReferenceRef = React25.useRef(null);
5476 const tree = useFloatingTree(externalTree);
5477 useIsoLayoutEffect(() => {
5478 if (rootContextElements.domReference) {
5479 domReferenceRef.current = rootContextElements.domReference;
5480 }
5481 }, [rootContextElements.domReference]);
5482 const position = useFloating({
5483 ...options,
5484 elements: {
5485 ...rootContextElements,
5486 ...positionReference && {
5487 reference: positionReference
5488 }
5489 }
5490 });
5491 const setPositionReference = React25.useCallback((node) => {
5492 const computedPositionReference = isElement(node) ? {
5493 getBoundingClientRect: () => node.getBoundingClientRect(),
5494 getClientRects: () => node.getClientRects(),
5495 contextElement: node
5496 } : node;
5497 setPositionReferenceRaw(computedPositionReference);
5498 position.refs.setReference(computedPositionReference);
5499 }, [position.refs]);
5500 const [localDomReference, setLocalDomReference] = React25.useState(void 0);
5501 const [localFloatingElement, setLocalFloatingElement] = React25.useState(null);
5502 rootContext.useSyncedValue("referenceElement", localDomReference ?? null);
5503 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;
5504 rootContext.useSyncedValue("domReferenceElement", localDomReference === void 0 ? rootContextElements.domReference : localDomReferenceElement);
5505 rootContext.useSyncedValue("floatingElement", localFloatingElement);
5506 const setReference = React25.useCallback((node) => {
5507 if (isElement(node) || node === null) {
5508 domReferenceRef.current = node;
5509 setLocalDomReference(node);
5510 }
5511 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
5512 // `null` to support `positionReference` + an unstable `reference`
5513 // callback ref.
5514 node !== null && !isElement(node)) {
5515 position.refs.setReference(node);
5516 }
5517 }, [position.refs, setLocalDomReference]);
5518 const setFloating = React25.useCallback((node) => {
5519 setLocalFloatingElement(node);
5520 position.refs.setFloating(node);
5521 }, [position.refs]);
5522 const refs = React25.useMemo(() => ({
5523 ...position.refs,
5524 setReference,
5525 setFloating,
5526 setPositionReference,
5527 domReference: domReferenceRef
5528 }), [position.refs, setReference, setFloating, setPositionReference]);
5529 const elements = React25.useMemo(() => ({
5530 ...position.elements,
5531 domReference: rootContextElements.domReference
5532 }), [position.elements, rootContextElements.domReference]);
5533 const open = rootContext.useState("open");
5534 const floatingId = rootContext.useState("floatingId");
5535 const context = React25.useMemo(() => ({
5536 ...position,
5537 dataRef: rootContext.context.dataRef,
5538 open,
5539 onOpenChange: rootContext.setOpen,
5540 events: rootContext.context.events,
5541 floatingId,
5542 refs,
5543 elements,
5544 nodeId,
5545 rootStore: rootContext
5546 }), [position, refs, elements, nodeId, rootContext, open, floatingId]);
5547 useIsoLayoutEffect(() => {
5548 rootContext.context.dataRef.current.floatingContext = context;
5549 const node = tree?.nodesRef.current.find((n) => n.id === nodeId);
5550 if (node) {
5551 node.context = context;
5552 }
5553 });
5554 return React25.useMemo(() => ({
5555 ...position,
5556 context,
5557 refs,
5558 elements,
5559 rootStore: rootContext
5560 }), [position, refs, elements, context, rootContext]);
5561 }
5562
5563 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js
5564 function useSyncedFloatingRootContext(options) {
5565 const {
5566 popupStore,
5567 treatPopupAsFloatingElement = false,
5568 onOpenChange
5569 } = options;
5570 const floatingId = useId();
5571 const nested = useFloatingParentNodeId() != null;
5572 const open = popupStore.useState("open");
5573 const referenceElement = popupStore.useState("activeTriggerElement");
5574 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement");
5575 const triggerElements = popupStore.context.triggerElements;
5576 const store2 = useRefWithInit(() => new FloatingRootStore({
5577 open,
5578 transitionStatus: void 0,
5579 referenceElement,
5580 floatingElement,
5581 triggerElements,
5582 onOpenChange,
5583 floatingId,
5584 syncOnly: true,
5585 nested
5586 })).current;
5587 useIsoLayoutEffect(() => {
5588 const valuesToSync = {
5589 open,
5590 floatingId,
5591 referenceElement,
5592 floatingElement
5593 };
5594 if (isElement(referenceElement)) {
5595 valuesToSync.domReferenceElement = referenceElement;
5596 }
5597 if (store2.state.positionReference === store2.state.referenceElement) {
5598 valuesToSync.positionReference = referenceElement;
5599 }
5600 store2.update(valuesToSync);
5601 }, [open, floatingId, referenceElement, floatingElement, store2]);
5602 store2.context.onOpenChange = onOpenChange;
5603 store2.context.nested = nested;
5604 return store2;
5605 }
5606
5607 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFocus.js
5608 var React26 = __toESM(require_react(), 1);
5609 var isMacSafari = isMac && isSafari;
5610 function useFocus(context, props = {}) {
5611 const store2 = "rootStore" in context ? context.rootStore : context;
5612 const {
5613 events,
5614 dataRef
5615 } = store2.context;
5616 const {
5617 enabled = true,
5618 delay
5619 } = props;
5620 const blockFocusRef = React26.useRef(false);
5621 const blockedReferenceRef = React26.useRef(null);
5622 const timeout = useTimeout();
5623 const keyboardModalityRef = React26.useRef(true);
5624 React26.useEffect(() => {
5625 const domReference = store2.select("domReferenceElement");
5626 if (!enabled) {
5627 return void 0;
5628 }
5629 const win = getWindow(domReference);
5630 function onBlur() {
5631 const currentDomReference = store2.select("domReferenceElement");
5632 if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) {
5633 blockFocusRef.current = true;
5634 }
5635 }
5636 function onKeyDown() {
5637 keyboardModalityRef.current = true;
5638 }
5639 function onPointerDown() {
5640 keyboardModalityRef.current = false;
5641 }
5642 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true));
5643 }, [store2, enabled]);
5644 React26.useEffect(() => {
5645 if (!enabled) {
5646 return void 0;
5647 }
5648 function onOpenChangeLocal(details) {
5649 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) {
5650 const referenceElement = store2.select("domReferenceElement");
5651 if (isElement(referenceElement)) {
5652 blockedReferenceRef.current = referenceElement;
5653 blockFocusRef.current = true;
5654 }
5655 }
5656 }
5657 events.on("openchange", onOpenChangeLocal);
5658 return () => {
5659 events.off("openchange", onOpenChangeLocal);
5660 };
5661 }, [events, enabled, store2]);
5662 const reference = React26.useMemo(() => ({
5663 onMouseLeave() {
5664 blockFocusRef.current = false;
5665 blockedReferenceRef.current = null;
5666 },
5667 onFocus(event) {
5668 const focusTarget = event.currentTarget;
5669 if (blockFocusRef.current) {
5670 if (blockedReferenceRef.current === focusTarget) {
5671 return;
5672 }
5673 blockFocusRef.current = false;
5674 blockedReferenceRef.current = null;
5675 }
5676 const target = getTarget(event.nativeEvent);
5677 if (isElement(target)) {
5678 if (isMacSafari && !event.relatedTarget) {
5679 if (!keyboardModalityRef.current && !isTypeableElement(target)) {
5680 return;
5681 }
5682 } else if (!matchesFocusVisible(target)) {
5683 return;
5684 }
5685 }
5686 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements);
5687 const {
5688 nativeEvent,
5689 currentTarget
5690 } = event;
5691 const delayValue = typeof delay === "function" ? delay() : delay;
5692 if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) {
5693 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
5694 return;
5695 }
5696 timeout.start(delayValue, () => {
5697 if (blockFocusRef.current) {
5698 return;
5699 }
5700 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
5701 });
5702 },
5703 onBlur(event) {
5704 blockFocusRef.current = false;
5705 blockedReferenceRef.current = null;
5706 const relatedTarget = event.relatedTarget;
5707 const nativeEvent = event.nativeEvent;
5708 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
5709 timeout.start(0, () => {
5710 const domReference = store2.select("domReferenceElement");
5711 const activeEl = activeElement(ownerDocument(domReference));
5712 if (!relatedTarget && activeEl === domReference) {
5713 return;
5714 }
5715 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) {
5716 return;
5717 }
5718 const nextFocusedElement = relatedTarget ?? activeEl;
5719 if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) {
5720 return;
5721 }
5722 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent));
5723 });
5724 }
5725 }), [dataRef, store2, timeout, delay]);
5726 return React26.useMemo(() => enabled ? {
5727 reference,
5728 trigger: reference
5729 } : {}, [enabled, reference]);
5730 }
5731
5732 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js
5733 var React27 = __toESM(require_react(), 1);
5734
5735 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js
5736 var HoverInteraction = class _HoverInteraction {
5737 constructor() {
5738 this.pointerType = void 0;
5739 this.interactedInside = false;
5740 this.handler = void 0;
5741 this.blockMouseMove = true;
5742 this.performedPointerEventsMutation = false;
5743 this.pointerEventsScopeElement = null;
5744 this.pointerEventsReferenceElement = null;
5745 this.pointerEventsFloatingElement = null;
5746 this.restTimeoutPending = false;
5747 this.openChangeTimeout = new Timeout();
5748 this.restTimeout = new Timeout();
5749 this.handleCloseOptions = void 0;
5750 }
5751 static create() {
5752 return new _HoverInteraction();
5753 }
5754 dispose = () => {
5755 this.openChangeTimeout.clear();
5756 this.restTimeout.clear();
5757 };
5758 disposeEffect = () => {
5759 return this.dispose;
5760 };
5761 };
5762 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap();
5763 function clearSafePolygonPointerEventsMutation(instance) {
5764 if (!instance.performedPointerEventsMutation) {
5765 return;
5766 }
5767 const scopeElement = instance.pointerEventsScopeElement;
5768 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {
5769 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events");
5770 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events");
5771 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events");
5772 pointerEventsMutationOwnerByScopeElement.delete(scopeElement);
5773 }
5774 instance.performedPointerEventsMutation = false;
5775 instance.pointerEventsScopeElement = null;
5776 instance.pointerEventsReferenceElement = null;
5777 instance.pointerEventsFloatingElement = null;
5778 }
5779 function applySafePolygonPointerEventsMutation(instance, options) {
5780 const {
5781 scopeElement,
5782 referenceElement,
5783 floatingElement
5784 } = options;
5785 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);
5786 if (existingOwner && existingOwner !== instance) {
5787 clearSafePolygonPointerEventsMutation(existingOwner);
5788 }
5789 clearSafePolygonPointerEventsMutation(instance);
5790 instance.performedPointerEventsMutation = true;
5791 instance.pointerEventsScopeElement = scopeElement;
5792 instance.pointerEventsReferenceElement = referenceElement;
5793 instance.pointerEventsFloatingElement = floatingElement;
5794 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);
5795 scopeElement.style.pointerEvents = "none";
5796 referenceElement.style.pointerEvents = "auto";
5797 floatingElement.style.pointerEvents = "auto";
5798 }
5799 function useHoverInteractionSharedState(store2) {
5800 const instance = useRefWithInit(HoverInteraction.create).current;
5801 const data = store2.context.dataRef.current;
5802 if (!data.hoverInteractionState) {
5803 data.hoverInteractionState = instance;
5804 }
5805 useOnMount(data.hoverInteractionState.disposeEffect);
5806 return data.hoverInteractionState;
5807 }
5808
5809 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js
5810 function useHoverFloatingInteraction(context, parameters = {}) {
5811 const store2 = "rootStore" in context ? context.rootStore : context;
5812 const open = store2.useState("open");
5813 const floatingElement = store2.useState("floatingElement");
5814 const domReferenceElement = store2.useState("domReferenceElement");
5815 const {
5816 dataRef
5817 } = store2.context;
5818 const {
5819 enabled = true,
5820 closeDelay: closeDelayProp = 0,
5821 nodeId: nodeIdProp
5822 } = parameters;
5823 const instance = useHoverInteractionSharedState(store2);
5824 const tree = useFloatingTree();
5825 const parentId = useFloatingParentNodeId();
5826 const isClickLikeOpenEvent2 = useStableCallback(() => {
5827 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
5828 });
5829 const isHoverOpen = useStableCallback(() => {
5830 const type = dataRef.current.openEvent?.type;
5831 return type?.includes("mouse") && type !== "mousedown";
5832 });
5833 const isRelatedTargetInsideEnabledTrigger = useStableCallback((target) => {
5834 return isTargetInsideEnabledTrigger(target, store2.context.triggerElements);
5835 });
5836 const closeWithDelay = React27.useCallback((event) => {
5837 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType);
5838 const close = () => {
5839 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
5840 tree?.events.emit("floating.closed", event);
5841 };
5842 if (closeDelay) {
5843 instance.openChangeTimeout.start(closeDelay, close);
5844 } else {
5845 instance.openChangeTimeout.clear();
5846 close();
5847 }
5848 }, [closeDelayProp, store2, instance, tree]);
5849 const clearPointerEvents = useStableCallback(() => {
5850 clearSafePolygonPointerEventsMutation(instance);
5851 });
5852 const handleInteractInside = useStableCallback((event) => {
5853 const target = getTarget(event);
5854 if (!isInteractiveElement(target)) {
5855 instance.interactedInside = false;
5856 return;
5857 }
5858 instance.interactedInside = target?.closest("[aria-haspopup]") != null;
5859 });
5860 useIsoLayoutEffect(() => {
5861 if (!open) {
5862 instance.pointerType = void 0;
5863 instance.restTimeoutPending = false;
5864 instance.interactedInside = false;
5865 clearPointerEvents();
5866 }
5867 }, [open, instance, clearPointerEvents]);
5868 React27.useEffect(() => {
5869 return clearPointerEvents;
5870 }, [clearPointerEvents]);
5871 useIsoLayoutEffect(() => {
5872 if (!enabled) {
5873 return void 0;
5874 }
5875 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {
5876 const ref = domReferenceElement;
5877 const floatingEl = floatingElement;
5878 const doc = ownerDocument(floatingElement);
5879 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating;
5880 if (parentFloating) {
5881 parentFloating.style.pointerEvents = "";
5882 }
5883 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? instance.pointerEventsScopeElement ?? parentFloating ?? ref.closest("[data-rootownerid]") ?? doc.body;
5884 applySafePolygonPointerEventsMutation(instance, {
5885 scopeElement,
5886 referenceElement: ref,
5887 floatingElement: floatingEl
5888 });
5889 return () => {
5890 clearPointerEvents();
5891 };
5892 }
5893 return void 0;
5894 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);
5895 const childClosedTimeout = useTimeout();
5896 React27.useEffect(() => {
5897 if (!enabled) {
5898 return void 0;
5899 }
5900 function onFloatingMouseEnter() {
5901 instance.openChangeTimeout.clear();
5902 childClosedTimeout.clear();
5903 tree?.events.off("floating.closed", onNodeClosed);
5904 clearPointerEvents();
5905 }
5906 function onFloatingMouseLeave(event) {
5907 if (tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0) {
5908 tree.events.on("floating.closed", onNodeClosed);
5909 return;
5910 }
5911 if (isRelatedTargetInsideEnabledTrigger(event.relatedTarget)) {
5912 return;
5913 }
5914 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;
5915 const relatedTarget = event.relatedTarget;
5916 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget));
5917 if (isMovingIntoDescendantFloating) {
5918 return;
5919 }
5920 if (instance.handler) {
5921 instance.handler(event);
5922 return;
5923 }
5924 clearPointerEvents();
5925 if (!isClickLikeOpenEvent2()) {
5926 closeWithDelay(event);
5927 }
5928 }
5929 function onNodeClosed(event) {
5930 if (!tree || !parentId || getNodeChildren(tree.nodesRef.current, parentId).length > 0) {
5931 return;
5932 }
5933 childClosedTimeout.start(0, () => {
5934 tree.events.off("floating.closed", onNodeClosed);
5935 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
5936 tree.events.emit("floating.closed", event);
5937 });
5938 }
5939 const floating = floatingElement;
5940 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => {
5941 tree?.events.off("floating.closed", onNodeClosed);
5942 });
5943 }, [enabled, floatingElement, store2, dataRef, nodeIdProp, isClickLikeOpenEvent2, isRelatedTargetInsideEnabledTrigger, closeWithDelay, clearPointerEvents, handleInteractInside, instance, tree, parentId, childClosedTimeout]);
5944 }
5945
5946 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js
5947 var React28 = __toESM(require_react(), 1);
5948 var ReactDOM4 = __toESM(require_react_dom(), 1);
5949 var EMPTY_REF = {
5950 current: null
5951 };
5952 function useHoverReferenceInteraction(context, props = {}) {
5953 const store2 = "rootStore" in context ? context.rootStore : context;
5954 const {
5955 dataRef,
5956 events
5957 } = store2.context;
5958 const {
5959 enabled = true,
5960 delay = 0,
5961 handleClose = null,
5962 mouseOnly = false,
5963 restMs = 0,
5964 move = true,
5965 triggerElementRef = EMPTY_REF,
5966 externalTree,
5967 isActiveTrigger = true,
5968 getHandleCloseContext,
5969 isClosing
5970 } = props;
5971 const tree = useFloatingTree(externalTree);
5972 const instance = useHoverInteractionSharedState(store2);
5973 const isHoverCloseActiveRef = React28.useRef(false);
5974 const handleCloseRef = useValueAsRef(handleClose);
5975 const delayRef = useValueAsRef(delay);
5976 const restMsRef = useValueAsRef(restMs);
5977 const enabledRef = useValueAsRef(enabled);
5978 const isClosingRef = useValueAsRef(isClosing);
5979 if (isActiveTrigger) {
5980 instance.handleCloseOptions = handleCloseRef.current?.__options;
5981 }
5982 const isClickLikeOpenEvent2 = useStableCallback(() => {
5983 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
5984 });
5985 const isRelatedTargetInsideEnabledTrigger = useStableCallback((target) => {
5986 return isTargetInsideEnabledTrigger(target, store2.context.triggerElements);
5987 });
5988 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {
5989 const allTriggers = store2.context.triggerElements;
5990 if (allTriggers.hasElement(currentTarget)) {
5991 return !currentDomReference || !contains(currentDomReference, currentTarget);
5992 }
5993 if (!isElement(target)) {
5994 return false;
5995 }
5996 const targetElement = target;
5997 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));
5998 });
5999 const closeWithDelay = useStableCallback((event, runElseBranch = true) => {
6000 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType);
6001 if (closeDelay) {
6002 instance.openChangeTimeout.start(closeDelay, () => {
6003 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
6004 tree?.events.emit("floating.closed", event);
6005 });
6006 } else if (runElseBranch) {
6007 instance.openChangeTimeout.clear();
6008 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
6009 tree?.events.emit("floating.closed", event);
6010 }
6011 });
6012 const cleanupMouseMoveHandler = useStableCallback(() => {
6013 if (!instance.handler) {
6014 return;
6015 }
6016 const doc = ownerDocument(store2.select("domReferenceElement"));
6017 doc.removeEventListener("mousemove", instance.handler);
6018 instance.handler = void 0;
6019 });
6020 const clearPointerEvents = useStableCallback(() => {
6021 clearSafePolygonPointerEventsMutation(instance);
6022 });
6023 React28.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);
6024 React28.useEffect(() => {
6025 if (!enabled) {
6026 return void 0;
6027 }
6028 function onOpenChangeLocal(details) {
6029 if (!details.open) {
6030 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover;
6031 cleanupMouseMoveHandler();
6032 instance.openChangeTimeout.clear();
6033 instance.restTimeout.clear();
6034 instance.blockMouseMove = true;
6035 instance.restTimeoutPending = false;
6036 } else {
6037 isHoverCloseActiveRef.current = false;
6038 }
6039 }
6040 events.on("openchange", onOpenChangeLocal);
6041 return () => {
6042 events.off("openchange", onOpenChangeLocal);
6043 };
6044 }, [enabled, events, instance, cleanupMouseMoveHandler]);
6045 React28.useEffect(() => {
6046 if (!enabled) {
6047 return void 0;
6048 }
6049 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null);
6050 if (!isElement(trigger)) {
6051 return void 0;
6052 }
6053 function onMouseEnter(event) {
6054 instance.openChangeTimeout.clear();
6055 instance.blockMouseMove = false;
6056 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
6057 return;
6058 }
6059 const restMsValue = getRestMs(restMsRef.current);
6060 const openDelay = getDelay(delayRef.current, "open", instance.pointerType);
6061 const eventTarget = getTarget(event);
6062 const currentTarget = event.currentTarget ?? null;
6063 const currentDomReference = store2.select("domReferenceElement");
6064 let triggerNode = currentTarget;
6065 if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) {
6066 for (const triggerElement of store2.context.triggerElements.elements()) {
6067 if (contains(triggerElement, eventTarget)) {
6068 triggerNode = triggerElement;
6069 break;
6070 }
6071 }
6072 }
6073 if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {
6074 triggerNode = currentDomReference;
6075 }
6076 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);
6077 const isOpen = store2.select("open");
6078 const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending";
6079 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;
6080 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;
6081 const isRestOnlyDelay = restMsValue > 0 && !openDelay;
6082 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;
6083 const shouldOpen = !isOpen || isOverInactive;
6084 if (shouldOpenImmediately) {
6085 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
6086 return;
6087 }
6088 if (isRestOnlyDelay) {
6089 return;
6090 }
6091 if (openDelay) {
6092 instance.openChangeTimeout.start(openDelay, () => {
6093 if (shouldOpen) {
6094 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
6095 }
6096 });
6097 } else if (shouldOpen) {
6098 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
6099 }
6100 }
6101 function onMouseLeave(event) {
6102 if (isClickLikeOpenEvent2()) {
6103 clearPointerEvents();
6104 return;
6105 }
6106 cleanupMouseMoveHandler();
6107 const domReferenceElement = store2.select("domReferenceElement");
6108 const doc = ownerDocument(domReferenceElement);
6109 instance.restTimeout.clear();
6110 instance.restTimeoutPending = false;
6111 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();
6112 const ignoreRelatedTargetTrigger = isRelatedTargetInsideEnabledTrigger(event.relatedTarget);
6113 if (ignoreRelatedTargetTrigger) {
6114 return;
6115 }
6116 if (handleCloseRef.current && handleCloseContextBase) {
6117 if (!store2.select("open")) {
6118 instance.openChangeTimeout.clear();
6119 }
6120 const currentTrigger = triggerElementRef.current;
6121 instance.handler = handleCloseRef.current({
6122 ...handleCloseContextBase,
6123 tree,
6124 x: event.clientX,
6125 y: event.clientY,
6126 onClose() {
6127 clearPointerEvents();
6128 cleanupMouseMoveHandler();
6129 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) {
6130 closeWithDelay(event, true);
6131 }
6132 }
6133 });
6134 doc.addEventListener("mousemove", instance.handler);
6135 instance.handler(event);
6136 return;
6137 }
6138 const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true;
6139 if (shouldClose) {
6140 closeWithDelay(event);
6141 }
6142 }
6143 if (move) {
6144 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, {
6145 once: true
6146 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave));
6147 }
6148 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave));
6149 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, closeWithDelay, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, isRelatedTargetInsideEnabledTrigger, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef]);
6150 return React28.useMemo(() => {
6151 if (!enabled) {
6152 return void 0;
6153 }
6154 function setPointerRef(event) {
6155 instance.pointerType = event.pointerType;
6156 }
6157 return {
6158 onPointerDown: setPointerRef,
6159 onPointerEnter: setPointerRef,
6160 onMouseMove(event) {
6161 const {
6162 nativeEvent
6163 } = event;
6164 const trigger = event.currentTarget;
6165 const currentDomReference = store2.select("domReferenceElement");
6166 const currentOpen = store2.select("open");
6167 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
6168 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
6169 return;
6170 }
6171 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
6172 const floatingElement = store2.select("floatingElement");
6173 if (floatingElement) {
6174 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
6175 applySafePolygonPointerEventsMutation(instance, {
6176 scopeElement,
6177 referenceElement: trigger,
6178 floatingElement
6179 });
6180 }
6181 }
6182 const restMsValue = getRestMs(restMsRef.current);
6183 if (currentOpen && !isOverInactive || restMsValue === 0) {
6184 return;
6185 }
6186 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {
6187 return;
6188 }
6189 instance.restTimeout.clear();
6190 function handleMouseMove() {
6191 instance.restTimeoutPending = false;
6192 if (isClickLikeOpenEvent2()) {
6193 return;
6194 }
6195 const latestOpen = store2.select("open");
6196 if (!instance.blockMouseMove && (!latestOpen || isOverInactive)) {
6197 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger));
6198 }
6199 }
6200 if (instance.pointerType === "touch") {
6201 ReactDOM4.flushSync(() => {
6202 handleMouseMove();
6203 });
6204 } else if (isOverInactive && currentOpen) {
6205 handleMouseMove();
6206 } else {
6207 instance.restTimeoutPending = true;
6208 instance.restTimeout.start(restMsValue, handleMouseMove);
6209 }
6210 }
6211 };
6212 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef]);
6213 }
6214
6215 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useInteractions.js
6216 var React29 = __toESM(require_react(), 1);
6217 function useInteractions(propsList = []) {
6218 const referenceDeps = propsList.map((key) => key?.reference);
6219 const floatingDeps = propsList.map((key) => key?.floating);
6220 const itemDeps = propsList.map((key) => key?.item);
6221 const triggerDeps = propsList.map((key) => key?.trigger);
6222 const getReferenceProps = React29.useCallback(
6223 (userProps) => mergeProps2(userProps, propsList, "reference"),
6224 // eslint-disable-next-line react-hooks/exhaustive-deps
6225 referenceDeps
6226 );
6227 const getFloatingProps = React29.useCallback(
6228 (userProps) => mergeProps2(userProps, propsList, "floating"),
6229 // eslint-disable-next-line react-hooks/exhaustive-deps
6230 floatingDeps
6231 );
6232 const getItemProps = React29.useCallback(
6233 (userProps) => mergeProps2(userProps, propsList, "item"),
6234 // eslint-disable-next-line react-hooks/exhaustive-deps
6235 itemDeps
6236 );
6237 const getTriggerProps = React29.useCallback(
6238 (userProps) => mergeProps2(userProps, propsList, "trigger"),
6239 // eslint-disable-next-line react-hooks/exhaustive-deps
6240 triggerDeps
6241 );
6242 return React29.useMemo(() => ({
6243 getReferenceProps,
6244 getFloatingProps,
6245 getItemProps,
6246 getTriggerProps
6247 }), [getReferenceProps, getFloatingProps, getItemProps, getTriggerProps]);
6248 }
6249 function mergeProps2(userProps, propsList, elementKey) {
6250 const eventHandlers = /* @__PURE__ */ new Map();
6251 const isItem = elementKey === "item";
6252 const outputProps = {};
6253 if (elementKey === "floating") {
6254 outputProps.tabIndex = -1;
6255 outputProps[FOCUSABLE_ATTRIBUTE] = "";
6256 }
6257 for (const key in userProps) {
6258 if (isItem && userProps) {
6259 if (key === ACTIVE_KEY || key === SELECTED_KEY) {
6260 continue;
6261 }
6262 }
6263 outputProps[key] = userProps[key];
6264 }
6265 for (let i = 0; i < propsList.length; i += 1) {
6266 let props;
6267 const propsOrGetProps = propsList[i]?.[elementKey];
6268 if (typeof propsOrGetProps === "function") {
6269 props = userProps ? propsOrGetProps(userProps) : null;
6270 } else {
6271 props = propsOrGetProps;
6272 }
6273 if (!props) {
6274 continue;
6275 }
6276 mutablyMergeProps(outputProps, props, isItem, eventHandlers);
6277 }
6278 mutablyMergeProps(outputProps, userProps, isItem, eventHandlers);
6279 return outputProps;
6280 }
6281 function mutablyMergeProps(outputProps, props, isItem, eventHandlers) {
6282 for (const key in props) {
6283 const value = props[key];
6284 if (isItem && (key === ACTIVE_KEY || key === SELECTED_KEY)) {
6285 continue;
6286 }
6287 if (!key.startsWith("on")) {
6288 outputProps[key] = value;
6289 } else {
6290 if (!eventHandlers.has(key)) {
6291 eventHandlers.set(key, []);
6292 }
6293 if (typeof value === "function") {
6294 eventHandlers.get(key)?.push(value);
6295 outputProps[key] = (...args) => {
6296 return eventHandlers.get(key)?.map((fn) => fn(...args)).find((val) => val !== void 0);
6297 };
6298 }
6299 }
6300 }
6301 }
6302
6303 // node_modules/@base-ui/react/esm/floating-ui-react/safePolygon.js
6304 var CURSOR_SPEED_THRESHOLD = 0.1;
6305 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;
6306 var POLYGON_BUFFER = 0.5;
6307 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {
6308 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;
6309 }
6310 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {
6311 let isInsideValue = false;
6312 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {
6313 isInsideValue = !isInsideValue;
6314 }
6315 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {
6316 isInsideValue = !isInsideValue;
6317 }
6318 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {
6319 isInsideValue = !isInsideValue;
6320 }
6321 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {
6322 isInsideValue = !isInsideValue;
6323 }
6324 return isInsideValue;
6325 }
6326 function isInsideRect(pointX, pointY, rect) {
6327 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;
6328 }
6329 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {
6330 const minX = Math.min(x1, x2);
6331 const maxX = Math.max(x1, x2);
6332 const minY = Math.min(y1, y2);
6333 const maxY = Math.max(y1, y2);
6334 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;
6335 }
6336 function safePolygon(options = {}) {
6337 const {
6338 blockPointerEvents = false
6339 } = options;
6340 const timeout = new Timeout();
6341 const fn = ({
6342 x,
6343 y,
6344 placement,
6345 elements,
6346 onClose,
6347 nodeId,
6348 tree
6349 }) => {
6350 const side = placement?.split("-")[0];
6351 let hasLanded = false;
6352 let lastX = null;
6353 let lastY = null;
6354 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
6355 function isCursorMovingSlowly(nextX, nextY) {
6356 const currentTime = performance.now();
6357 const elapsedTime = currentTime - lastCursorTime;
6358 if (lastX === null || lastY === null || elapsedTime === 0) {
6359 lastX = nextX;
6360 lastY = nextY;
6361 lastCursorTime = currentTime;
6362 return false;
6363 }
6364 const deltaX = nextX - lastX;
6365 const deltaY = nextY - lastY;
6366 const distanceSquared = deltaX * deltaX + deltaY * deltaY;
6367 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;
6368 lastX = nextX;
6369 lastY = nextY;
6370 lastCursorTime = currentTime;
6371 return distanceSquared < thresholdSquared;
6372 }
6373 function close() {
6374 timeout.clear();
6375 onClose();
6376 }
6377 return function onMouseMove(event) {
6378 timeout.clear();
6379 const domReference = elements.domReference;
6380 const floating = elements.floating;
6381 if (!domReference || !floating || side == null || x == null || y == null) {
6382 return void 0;
6383 }
6384 const {
6385 clientX,
6386 clientY
6387 } = event;
6388 const target = getTarget(event);
6389 const isLeave = event.type === "mouseleave";
6390 const isOverFloatingEl = contains(floating, target);
6391 const isOverReferenceEl = contains(domReference, target);
6392 if (isOverFloatingEl) {
6393 hasLanded = true;
6394 if (!isLeave) {
6395 return void 0;
6396 }
6397 }
6398 if (isOverReferenceEl) {
6399 hasLanded = false;
6400 if (!isLeave) {
6401 hasLanded = true;
6402 return void 0;
6403 }
6404 }
6405 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {
6406 return void 0;
6407 }
6408 function hasOpenChildNode() {
6409 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);
6410 }
6411 function closeIfNoOpenChild() {
6412 if (!hasOpenChildNode()) {
6413 close();
6414 }
6415 }
6416 if (hasOpenChildNode()) {
6417 return void 0;
6418 }
6419 const refRect = domReference.getBoundingClientRect();
6420 const rect = floating.getBoundingClientRect();
6421 const cursorLeaveFromRight = x > rect.right - rect.width / 2;
6422 const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;
6423 const isFloatingWider = rect.width > refRect.width;
6424 const isFloatingTaller = rect.height > refRect.height;
6425 const left = (isFloatingWider ? refRect : rect).left;
6426 const right = (isFloatingWider ? refRect : rect).right;
6427 const top = (isFloatingTaller ? refRect : rect).top;
6428 const bottom = (isFloatingTaller ? refRect : rect).bottom;
6429 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) {
6430 closeIfNoOpenChild();
6431 return void 0;
6432 }
6433 let isInsideTroughRect = false;
6434 switch (side) {
6435 case "top":
6436 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);
6437 break;
6438 case "bottom":
6439 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);
6440 break;
6441 case "left":
6442 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);
6443 break;
6444 case "right":
6445 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);
6446 break;
6447 default:
6448 }
6449 if (isInsideTroughRect) {
6450 return void 0;
6451 }
6452 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {
6453 closeIfNoOpenChild();
6454 return void 0;
6455 }
6456 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {
6457 closeIfNoOpenChild();
6458 return void 0;
6459 }
6460 let isInsidePolygon = false;
6461 switch (side) {
6462 case "top": {
6463 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
6464 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
6465 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
6466 const cursorPointY = y + POLYGON_BUFFER + 1;
6467 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;
6468 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;
6469 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
6470 break;
6471 }
6472 case "bottom": {
6473 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
6474 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
6475 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;
6476 const cursorPointY = y - POLYGON_BUFFER;
6477 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;
6478 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;
6479 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
6480 break;
6481 }
6482 case "left": {
6483 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
6484 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
6485 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
6486 const cursorPointX = x + POLYGON_BUFFER + 1;
6487 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;
6488 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;
6489 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);
6490 break;
6491 }
6492 case "right": {
6493 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
6494 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
6495 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;
6496 const cursorPointX = x - POLYGON_BUFFER;
6497 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;
6498 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;
6499 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);
6500 break;
6501 }
6502 default:
6503 }
6504 if (!isInsidePolygon) {
6505 closeIfNoOpenChild();
6506 } else if (!hasLanded) {
6507 timeout.start(40, closeIfNoOpenChild);
6508 }
6509 return void 0;
6510 };
6511 };
6512 fn.__options = {
6513 ...options,
6514 blockPointerEvents
6515 };
6516 return fn;
6517 }
6518
6519 // node_modules/@base-ui/react/esm/utils/popupStateMapping.js
6520 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) {
6521 CommonPopupDataAttributes2["open"] = "data-open";
6522 CommonPopupDataAttributes2["closed"] = "data-closed";
6523 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle";
6524 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle";
6525 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden";
6526 CommonPopupDataAttributes2["side"] = "data-side";
6527 CommonPopupDataAttributes2["align"] = "data-align";
6528 return CommonPopupDataAttributes2;
6529 })({});
6530 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) {
6531 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open";
6532 CommonTriggerDataAttributes2["pressed"] = "data-pressed";
6533 return CommonTriggerDataAttributes2;
6534 })({});
6535 var TRIGGER_HOOK = {
6536 [CommonTriggerDataAttributes.popupOpen]: ""
6537 };
6538 var PRESSABLE_TRIGGER_HOOK = {
6539 [CommonTriggerDataAttributes.popupOpen]: "",
6540 [CommonTriggerDataAttributes.pressed]: ""
6541 };
6542 var POPUP_OPEN_HOOK = {
6543 [CommonPopupDataAttributes.open]: ""
6544 };
6545 var POPUP_CLOSED_HOOK = {
6546 [CommonPopupDataAttributes.closed]: ""
6547 };
6548 var ANCHOR_HIDDEN_HOOK = {
6549 [CommonPopupDataAttributes.anchorHidden]: ""
6550 };
6551 var triggerOpenStateMapping = {
6552 open(value) {
6553 if (value) {
6554 return TRIGGER_HOOK;
6555 }
6556 return null;
6557 }
6558 };
6559 var popupStateMapping = {
6560 open(value) {
6561 if (value) {
6562 return POPUP_OPEN_HOOK;
6563 }
6564 return POPUP_CLOSED_HOOK;
6565 },
6566 anchorHidden(value) {
6567 if (value) {
6568 return ANCHOR_HIDDEN_HOOK;
6569 }
6570 return null;
6571 }
6572 };
6573
6574 // node_modules/@base-ui/utils/esm/inertValue.js
6575 function inertValue(value) {
6576 if (isReactVersionAtLeast(19)) {
6577 return value;
6578 }
6579 return value ? "true" : void 0;
6580 }
6581
6582 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js
6583 var React30 = __toESM(require_react(), 1);
6584
6585 // node_modules/@base-ui/react/esm/floating-ui-react/middleware/arrow.js
6586 var baseArrow = (options) => ({
6587 name: "arrow",
6588 options,
6589 async fn(state) {
6590 const {
6591 x,
6592 y,
6593 placement,
6594 rects,
6595 platform: platform3,
6596 elements,
6597 middlewareData
6598 } = state;
6599 const {
6600 element,
6601 padding = 0,
6602 offsetParent = "real"
6603 } = evaluate(options, state) || {};
6604 if (element == null) {
6605 return {};
6606 }
6607 const paddingObject = getPaddingObject(padding);
6608 const coords = {
6609 x,
6610 y
6611 };
6612 const axis = getAlignmentAxis(placement);
6613 const length = getAxisLength(axis);
6614 const arrowDimensions = await platform3.getDimensions(element);
6615 const isYAxis = axis === "y";
6616 const minProp = isYAxis ? "top" : "left";
6617 const maxProp = isYAxis ? "bottom" : "right";
6618 const clientProp = isYAxis ? "clientHeight" : "clientWidth";
6619 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
6620 const startDiff = coords[axis] - rects.reference[axis];
6621 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating;
6622 let clientSize = elements.floating[clientProp] || rects.floating[length];
6623 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) {
6624 clientSize = elements.floating[clientProp] || rects.floating[length];
6625 }
6626 const centerToReference = endDiff / 2 - startDiff / 2;
6627 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
6628 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);
6629 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);
6630 const min2 = minPadding;
6631 const max2 = clientSize - arrowDimensions[length] - maxPadding;
6632 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
6633 const offset4 = clamp(min2, center, max2);
6634 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
6635 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0;
6636 return {
6637 [axis]: coords[axis] + alignmentOffset,
6638 data: {
6639 [axis]: offset4,
6640 centerOffset: center - offset4 - alignmentOffset,
6641 ...shouldAddOffset && {
6642 alignmentOffset
6643 }
6644 },
6645 reset: shouldAddOffset
6646 };
6647 }
6648 });
6649 var arrow4 = (options, deps) => ({
6650 ...baseArrow(options),
6651 options: [options, deps]
6652 });
6653
6654 // node_modules/@base-ui/react/esm/utils/hideMiddleware.js
6655 var hide4 = {
6656 name: "hide",
6657 async fn(state) {
6658 const {
6659 width,
6660 height,
6661 x,
6662 y
6663 } = state.rects.reference;
6664 const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0;
6665 const nativeHideResult = await hide3().fn(state);
6666 return {
6667 data: {
6668 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden
6669 }
6670 };
6671 }
6672 };
6673
6674 // node_modules/@base-ui/react/esm/utils/adaptiveOriginMiddleware.js
6675 var DEFAULT_SIDES = {
6676 sideX: "left",
6677 sideY: "top"
6678 };
6679 var adaptiveOrigin = {
6680 name: "adaptiveOrigin",
6681 async fn(state) {
6682 const {
6683 x: rawX,
6684 y: rawY,
6685 rects: {
6686 floating: floatRect
6687 },
6688 elements: {
6689 floating
6690 },
6691 platform: platform3,
6692 strategy,
6693 placement
6694 } = state;
6695 const win = getWindow(floating);
6696 const styles = win.getComputedStyle(floating);
6697 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== "";
6698 if (!hasTransition) {
6699 return {
6700 x: rawX,
6701 y: rawY,
6702 data: DEFAULT_SIDES
6703 };
6704 }
6705 const offsetParent = await platform3.getOffsetParent?.(floating);
6706 let offsetDimensions = {
6707 width: 0,
6708 height: 0
6709 };
6710 if (strategy === "fixed" && win?.visualViewport) {
6711 offsetDimensions = {
6712 width: win.visualViewport.width,
6713 height: win.visualViewport.height
6714 };
6715 } else if (offsetParent === win) {
6716 const doc = ownerDocument(floating);
6717 offsetDimensions = {
6718 width: doc.documentElement.clientWidth,
6719 height: doc.documentElement.clientHeight
6720 };
6721 } else if (await platform3.isElement?.(offsetParent)) {
6722 offsetDimensions = await platform3.getDimensions(offsetParent);
6723 }
6724 const currentSide = getSide(placement);
6725 let x = rawX;
6726 let y = rawY;
6727 if (currentSide === "left") {
6728 x = offsetDimensions.width - (rawX + floatRect.width);
6729 }
6730 if (currentSide === "top") {
6731 y = offsetDimensions.height - (rawY + floatRect.height);
6732 }
6733 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX;
6734 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY;
6735 return {
6736 x,
6737 y,
6738 data: {
6739 sideX,
6740 sideY
6741 }
6742 };
6743 }
6744 };
6745
6746 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js
6747 function getLogicalSide(sideParam, renderedSide, isRtl) {
6748 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end";
6749 const logicalRight = isRtl ? "inline-start" : "inline-end";
6750 const logicalLeft = isRtl ? "inline-end" : "inline-start";
6751 return {
6752 top: "top",
6753 right: isLogicalSideParam ? logicalRight : "right",
6754 bottom: "bottom",
6755 left: isLogicalSideParam ? logicalLeft : "left"
6756 }[renderedSide];
6757 }
6758 function getOffsetData(state, sideParam, isRtl) {
6759 const {
6760 rects,
6761 placement
6762 } = state;
6763 const data = {
6764 side: getLogicalSide(sideParam, getSide(placement), isRtl),
6765 align: getAlignment(placement) || "center",
6766 anchor: {
6767 width: rects.reference.width,
6768 height: rects.reference.height
6769 },
6770 positioner: {
6771 width: rects.floating.width,
6772 height: rects.floating.height
6773 }
6774 };
6775 return data;
6776 }
6777 function useAnchorPositioning(params) {
6778 const {
6779 // Public parameters
6780 anchor,
6781 positionMethod = "absolute",
6782 side: sideParam = "bottom",
6783 sideOffset = 0,
6784 align = "center",
6785 alignOffset = 0,
6786 collisionBoundary,
6787 collisionPadding: collisionPaddingParam = 5,
6788 sticky = false,
6789 arrowPadding = 5,
6790 disableAnchorTracking = false,
6791 // Private parameters
6792 keepMounted = false,
6793 floatingRootContext,
6794 mounted,
6795 collisionAvoidance,
6796 shiftCrossAxis = false,
6797 nodeId,
6798 adaptiveOrigin: adaptiveOrigin2,
6799 lazyFlip = false,
6800 externalTree
6801 } = params;
6802 const [mountSide, setMountSide] = React30.useState(null);
6803 if (!mounted && mountSide !== null) {
6804 setMountSide(null);
6805 }
6806 const collisionAvoidanceSide = collisionAvoidance.side || "flip";
6807 const collisionAvoidanceAlign = collisionAvoidance.align || "flip";
6808 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end";
6809 const anchorFn = typeof anchor === "function" ? anchor : void 0;
6810 const anchorFnCallback = useStableCallback(anchorFn);
6811 const anchorDep = anchorFn ? anchorFnCallback : anchor;
6812 const anchorValueRef = useValueAsRef(anchor);
6813 const mountedRef = useValueAsRef(mounted);
6814 const direction = useDirection();
6815 const isRtl = direction === "rtl";
6816 const side = mountSide || {
6817 top: "top",
6818 right: "right",
6819 bottom: "bottom",
6820 left: "left",
6821 "inline-end": isRtl ? "left" : "right",
6822 "inline-start": isRtl ? "right" : "left"
6823 }[sideParam];
6824 const placement = align === "center" ? side : `${side}-${align}`;
6825 let collisionPadding = collisionPaddingParam;
6826 const bias = 1;
6827 const biasTop = sideParam === "bottom" ? bias : 0;
6828 const biasBottom = sideParam === "top" ? bias : 0;
6829 const biasLeft = sideParam === "right" ? bias : 0;
6830 const biasRight = sideParam === "left" ? bias : 0;
6831 if (typeof collisionPadding === "number") {
6832 collisionPadding = {
6833 top: collisionPadding + biasTop,
6834 right: collisionPadding + biasRight,
6835 bottom: collisionPadding + biasBottom,
6836 left: collisionPadding + biasLeft
6837 };
6838 } else if (collisionPadding) {
6839 collisionPadding = {
6840 top: (collisionPadding.top || 0) + biasTop,
6841 right: (collisionPadding.right || 0) + biasRight,
6842 bottom: (collisionPadding.bottom || 0) + biasBottom,
6843 left: (collisionPadding.left || 0) + biasLeft
6844 };
6845 }
6846 const commonCollisionProps = {
6847 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary,
6848 padding: collisionPadding
6849 };
6850 const arrowRef = React30.useRef(null);
6851 const sideOffsetRef = useValueAsRef(sideOffset);
6852 const alignOffsetRef = useValueAsRef(alignOffset);
6853 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0;
6854 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0;
6855 const middleware = [offset3((state) => {
6856 const data = getOffsetData(state, sideParam, isRtl);
6857 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current;
6858 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current;
6859 return {
6860 mainAxis: sideAxis,
6861 crossAxis: alignAxis,
6862 alignmentAxis: alignAxis
6863 };
6864 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])];
6865 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift";
6866 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift");
6867 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({
6868 ...commonCollisionProps,
6869 // Ensure the popup flips if it's been limited by its --available-height and it resizes.
6870 // Since the size() padding is smaller than the flip() padding, flip() will take precedence.
6871 padding: {
6872 top: collisionPadding.top + bias,
6873 right: collisionPadding.right + bias,
6874 bottom: collisionPadding.bottom + bias,
6875 left: collisionPadding.left + bias
6876 },
6877 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip",
6878 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false,
6879 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
6880 });
6881 const shiftMiddleware = shiftDisabled ? null : shift3((data) => {
6882 const html = ownerDocument(data.elements.floating).documentElement;
6883 return {
6884 ...commonCollisionProps,
6885 // Use the Layout Viewport to avoid shifting around when pinch-zooming
6886 // for context menus.
6887 rootBoundary: shiftCrossAxis ? {
6888 x: 0,
6889 y: 0,
6890 width: html.clientWidth,
6891 height: html.clientHeight
6892 } : void 0,
6893 mainAxis: collisionAvoidanceAlign !== "none",
6894 crossAxis: crossAxisShiftEnabled,
6895 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => {
6896 if (!arrowRef.current) {
6897 return {};
6898 }
6899 const {
6900 width,
6901 height
6902 } = arrowRef.current.getBoundingClientRect();
6903 const sideAxis = getSideAxis(getSide(limitData.placement));
6904 const arrowSize = sideAxis === "y" ? width : height;
6905 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
6906 return {
6907 offset: arrowSize / 2 + offsetAmount / 2
6908 };
6909 })
6910 };
6911 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]);
6912 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") {
6913 middleware.push(shiftMiddleware, flipMiddleware);
6914 } else {
6915 middleware.push(flipMiddleware, shiftMiddleware);
6916 }
6917 middleware.push(size3({
6918 ...commonCollisionProps,
6919 apply({
6920 elements: {
6921 floating
6922 },
6923 availableWidth,
6924 availableHeight,
6925 rects
6926 }) {
6927 if (!mountedRef.current) {
6928 return;
6929 }
6930 const floatingStyle = floating.style;
6931 floatingStyle.setProperty("--available-width", `${availableWidth}px`);
6932 floatingStyle.setProperty("--available-height", `${availableHeight}px`);
6933 const dpr = getWindow(floating).devicePixelRatio || 1;
6934 const {
6935 x: x2,
6936 y: y2,
6937 width,
6938 height
6939 } = rects.reference;
6940 const anchorWidth = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr;
6941 const anchorHeight = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr;
6942 floatingStyle.setProperty("--anchor-width", `${anchorWidth}px`);
6943 floatingStyle.setProperty("--anchor-height", `${anchorHeight}px`);
6944 }
6945 }), arrow4(() => ({
6946 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,
6947 // we'll create a fake element.
6948 element: arrowRef.current || ownerDocument(arrowRef.current).createElement("div"),
6949 padding: arrowPadding,
6950 offsetParent: "floating"
6951 }), [arrowPadding]), {
6952 name: "transformOrigin",
6953 fn(state) {
6954 const {
6955 elements: elements2,
6956 middlewareData: middlewareData2,
6957 placement: renderedPlacement2,
6958 rects,
6959 y: y2
6960 } = state;
6961 const currentRenderedSide = getSide(renderedPlacement2);
6962 const currentRenderedAxis = getSideAxis(currentRenderedSide);
6963 const arrowEl = arrowRef.current;
6964 const arrowX = middlewareData2.arrow?.x || 0;
6965 const arrowY = middlewareData2.arrow?.y || 0;
6966 const arrowWidth = arrowEl?.clientWidth || 0;
6967 const arrowHeight = arrowEl?.clientHeight || 0;
6968 const transformX = arrowX + arrowWidth / 2;
6969 const transformY = arrowY + arrowHeight / 2;
6970 const shiftY = Math.abs(middlewareData2.shift?.y || 0);
6971 const halfAnchorHeight = rects.reference.height / 2;
6972 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
6973 const isOverlappingAnchor = shiftY > sideOffsetValue;
6974 const adjacentTransformOrigin = {
6975 top: `${transformX}px calc(100% + ${sideOffsetValue}px)`,
6976 bottom: `${transformX}px ${-sideOffsetValue}px`,
6977 left: `calc(100% + ${sideOffsetValue}px) ${transformY}px`,
6978 right: `${-sideOffsetValue}px ${transformY}px`
6979 }[currentRenderedSide];
6980 const overlapTransformOrigin = `${transformX}px ${rects.reference.y + halfAnchorHeight - y2}px`;
6981 elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin);
6982 return {};
6983 }
6984 }, hide4, adaptiveOrigin2);
6985 useIsoLayoutEffect(() => {
6986 if (!mounted && floatingRootContext) {
6987 floatingRootContext.update({
6988 referenceElement: null,
6989 floatingElement: null,
6990 domReferenceElement: null,
6991 positionReference: null
6992 });
6993 }
6994 }, [mounted, floatingRootContext]);
6995 const autoUpdateOptions = React30.useMemo(() => ({
6996 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined",
6997 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined"
6998 }), [disableAnchorTracking]);
6999 const {
7000 refs,
7001 elements,
7002 x,
7003 y,
7004 middlewareData,
7005 update: update2,
7006 placement: renderedPlacement,
7007 context,
7008 isPositioned,
7009 floatingStyles: originalFloatingStyles
7010 } = useFloating2({
7011 rootContext: floatingRootContext,
7012 open: keepMounted ? mounted : void 0,
7013 placement,
7014 middleware,
7015 strategy: positionMethod,
7016 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions),
7017 nodeId,
7018 externalTree
7019 });
7020 const {
7021 sideX,
7022 sideY
7023 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;
7024 const resolvedPosition = isPositioned ? positionMethod : "fixed";
7025 const floatingStyles = React30.useMemo(() => {
7026 const base = adaptiveOrigin2 ? {
7027 position: resolvedPosition,
7028 [sideX]: x,
7029 [sideY]: y
7030 } : {
7031 position: resolvedPosition,
7032 ...originalFloatingStyles
7033 };
7034 if (!isPositioned) {
7035 base.opacity = 0;
7036 }
7037 return base;
7038 }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]);
7039 const registeredPositionReferenceRef = React30.useRef(null);
7040 useIsoLayoutEffect(() => {
7041 if (!mounted) {
7042 return;
7043 }
7044 const anchorValue = anchorValueRef.current;
7045 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue;
7046 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;
7047 const finalAnchor = unwrappedElement || null;
7048 if (finalAnchor !== registeredPositionReferenceRef.current) {
7049 refs.setPositionReference(finalAnchor);
7050 registeredPositionReferenceRef.current = finalAnchor;
7051 }
7052 }, [mounted, refs, anchorDep, anchorValueRef]);
7053 React30.useEffect(() => {
7054 if (!mounted) {
7055 return;
7056 }
7057 const anchorValue = anchorValueRef.current;
7058 if (typeof anchorValue === "function") {
7059 return;
7060 }
7061 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {
7062 refs.setPositionReference(anchorValue.current);
7063 registeredPositionReferenceRef.current = anchorValue.current;
7064 }
7065 }, [mounted, refs, anchorDep, anchorValueRef]);
7066 React30.useEffect(() => {
7067 if (keepMounted && mounted && elements.domReference && elements.floating) {
7068 return autoUpdate(elements.domReference, elements.floating, update2, autoUpdateOptions);
7069 }
7070 return void 0;
7071 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]);
7072 const renderedSide = getSide(renderedPlacement);
7073 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);
7074 const renderedAlign = getAlignment(renderedPlacement) || "center";
7075 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);
7076 useIsoLayoutEffect(() => {
7077 if (lazyFlip && mounted && isPositioned) {
7078 setMountSide(renderedSide);
7079 }
7080 }, [lazyFlip, mounted, isPositioned, renderedSide]);
7081 const arrowStyles = React30.useMemo(() => ({
7082 position: "absolute",
7083 top: middlewareData.arrow?.y,
7084 left: middlewareData.arrow?.x
7085 }), [middlewareData.arrow]);
7086 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;
7087 return React30.useMemo(() => ({
7088 positionerStyles: floatingStyles,
7089 arrowStyles,
7090 arrowRef,
7091 arrowUncentered,
7092 side: logicalRenderedSide,
7093 align: renderedAlign,
7094 physicalSide: renderedSide,
7095 anchorHidden,
7096 refs,
7097 context,
7098 isPositioned,
7099 update: update2
7100 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]);
7101 }
7102 function isRef(param) {
7103 return param != null && "current" in param;
7104 }
7105
7106 // node_modules/@base-ui/react/esm/utils/getDisabledMountTransitionStyles.js
7107 function getDisabledMountTransitionStyles(transitionStatus) {
7108 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;
7109 }
7110
7111 // node_modules/@base-ui/react/esm/utils/usePositioner.js
7112 function usePositioner(componentProps, state, {
7113 styles,
7114 transitionStatus,
7115 props,
7116 refs,
7117 hidden,
7118 inert = false
7119 }) {
7120 const style = {
7121 ...styles
7122 };
7123 if (inert) {
7124 style.pointerEvents = "none";
7125 }
7126 return useRenderElement("div", componentProps, {
7127 state,
7128 ref: refs,
7129 props: [{
7130 role: "presentation",
7131 hidden,
7132 style
7133 }, getDisabledMountTransitionStyles(transitionStatus), props],
7134 stateAttributesMapping: popupStateMapping
7135 });
7136 }
7137
7138 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js
7139 var React33 = __toESM(require_react(), 1);
7140 var ReactDOM5 = __toESM(require_react_dom(), 1);
7141
7142 // node_modules/@base-ui/utils/esm/usePreviousValue.js
7143 var React31 = __toESM(require_react(), 1);
7144 function usePreviousValue(value) {
7145 const [state, setState] = React31.useState({
7146 current: value,
7147 previous: null
7148 });
7149 if (value !== state.current) {
7150 setState({
7151 current: value,
7152 previous: state.current
7153 });
7154 }
7155 return state.previous;
7156 }
7157
7158 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js
7159 var React32 = __toESM(require_react(), 1);
7160
7161 // node_modules/@base-ui/react/esm/utils/getCssDimensions.js
7162 function getCssDimensions2(element) {
7163 const css = getComputedStyle2(element);
7164 let width = parseFloat(css.width) || 0;
7165 let height = parseFloat(css.height) || 0;
7166 const hasOffset = isHTMLElement(element);
7167 const offsetWidth = hasOffset ? element.offsetWidth : width;
7168 const offsetHeight = hasOffset ? element.offsetHeight : height;
7169 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
7170 if (shouldFallback) {
7171 width = offsetWidth;
7172 height = offsetHeight;
7173 }
7174 return {
7175 width,
7176 height
7177 };
7178 }
7179
7180 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js
7181 var DEFAULT_ENABLED = () => true;
7182 function usePopupAutoResize(parameters) {
7183 const {
7184 popupElement,
7185 positionerElement,
7186 content,
7187 mounted,
7188 enabled = DEFAULT_ENABLED,
7189 onMeasureLayout: onMeasureLayoutParam,
7190 onMeasureLayoutComplete: onMeasureLayoutCompleteParam,
7191 side,
7192 direction
7193 } = parameters;
7194 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false);
7195 const animationFrame = useAnimationFrame();
7196 const committedDimensionsRef = React32.useRef(null);
7197 const liveDimensionsRef = React32.useRef(null);
7198 const isInitialRenderRef = React32.useRef(true);
7199 const restoreAnchoringStylesRef = React32.useRef(NOOP);
7200 const onMeasureLayout = useStableCallback(onMeasureLayoutParam);
7201 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam);
7202 const anchoringStyles = React32.useMemo(() => {
7203 let isOriginSide = side === "top";
7204 let isPhysicalLeft = side === "left";
7205 if (direction === "rtl") {
7206 isOriginSide = isOriginSide || side === "inline-end";
7207 isPhysicalLeft = isPhysicalLeft || side === "inline-end";
7208 } else {
7209 isOriginSide = isOriginSide || side === "inline-start";
7210 isPhysicalLeft = isPhysicalLeft || side === "inline-start";
7211 }
7212 return isOriginSide ? {
7213 position: "absolute",
7214 [side === "top" ? "bottom" : "top"]: "0",
7215 [isPhysicalLeft ? "right" : "left"]: "0"
7216 } : EMPTY_OBJECT;
7217 }, [side, direction]);
7218 useIsoLayoutEffect(() => {
7219 if (!mounted || !enabled() || typeof ResizeObserver !== "function") {
7220 restoreAnchoringStylesRef.current = NOOP;
7221 isInitialRenderRef.current = true;
7222 committedDimensionsRef.current = null;
7223 liveDimensionsRef.current = null;
7224 return void 0;
7225 }
7226 if (!popupElement || !positionerElement) {
7227 return void 0;
7228 }
7229 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles);
7230 const observer = new ResizeObserver((entries) => {
7231 const entry = entries[0];
7232 if (entry) {
7233 liveDimensionsRef.current = {
7234 width: Math.ceil(entry.borderBoxSize[0].inlineSize),
7235 height: Math.ceil(entry.borderBoxSize[0].blockSize)
7236 };
7237 }
7238 });
7239 observer.observe(popupElement);
7240 setPopupCssSize(popupElement, "auto");
7241 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static");
7242 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none");
7243 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1");
7244 const restorePositionerAvailableSize = applyElementStyles(positionerElement, {
7245 "--available-width": "max-content",
7246 "--available-height": "max-content"
7247 });
7248 function restoreMeasurementOverrides() {
7249 restorePopupPosition();
7250 restorePopupTransform();
7251 restorePositionerAvailableSize();
7252 }
7253 function restoreMeasurementOverridesIncludingScale() {
7254 restoreMeasurementOverrides();
7255 restorePopupScale();
7256 }
7257 onMeasureLayout?.();
7258 if (isInitialRenderRef.current || committedDimensionsRef.current === null) {
7259 setPositionerCssSize(positionerElement, "max-content");
7260 const dimensions = getCssDimensions2(popupElement);
7261 committedDimensionsRef.current = dimensions;
7262 setPositionerCssSize(positionerElement, dimensions);
7263 restoreMeasurementOverridesIncludingScale();
7264 onMeasureLayoutComplete?.(null, dimensions);
7265 isInitialRenderRef.current = false;
7266 return () => {
7267 observer.disconnect();
7268 restoreAnchoringStylesRef.current();
7269 restoreAnchoringStylesRef.current = NOOP;
7270 };
7271 }
7272 setPopupCssSize(popupElement, "auto");
7273 setPositionerCssSize(positionerElement, "max-content");
7274 const previousDimensions = committedDimensionsRef.current ?? liveDimensionsRef.current;
7275 const newDimensions = getCssDimensions2(popupElement);
7276 committedDimensionsRef.current = newDimensions;
7277 if (!previousDimensions) {
7278 setPositionerCssSize(positionerElement, newDimensions);
7279 restoreMeasurementOverridesIncludingScale();
7280 onMeasureLayoutComplete?.(null, newDimensions);
7281 return () => {
7282 observer.disconnect();
7283 animationFrame.cancel();
7284 restoreAnchoringStylesRef.current();
7285 restoreAnchoringStylesRef.current = NOOP;
7286 };
7287 }
7288 setPopupCssSize(popupElement, previousDimensions);
7289 restoreMeasurementOverridesIncludingScale();
7290 onMeasureLayoutComplete?.(previousDimensions, newDimensions);
7291 setPositionerCssSize(positionerElement, newDimensions);
7292 const abortController = new AbortController();
7293 animationFrame.request(() => {
7294 setPopupCssSize(popupElement, newDimensions);
7295 runOnceAnimationsFinish(() => {
7296 popupElement.style.setProperty("--popup-width", "auto");
7297 popupElement.style.setProperty("--popup-height", "auto");
7298 }, abortController.signal);
7299 });
7300 return () => {
7301 observer.disconnect();
7302 abortController.abort();
7303 animationFrame.cancel();
7304 restoreAnchoringStylesRef.current();
7305 restoreAnchoringStylesRef.current = NOOP;
7306 };
7307 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, enabled, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]);
7308 }
7309 function overrideElementStyle(element, property, value) {
7310 const originalValue = element.style.getPropertyValue(property);
7311 element.style.setProperty(property, value);
7312 return () => {
7313 element.style.setProperty(property, originalValue);
7314 };
7315 }
7316 function applyElementStyles(element, styles) {
7317 const restorers = [];
7318 for (const [key, value] of Object.entries(styles)) {
7319 restorers.push(overrideElementStyle(element, key, value));
7320 }
7321 return restorers.length ? () => {
7322 restorers.forEach((restore) => restore());
7323 } : NOOP;
7324 }
7325 function setPopupCssSize(popupElement, size4) {
7326 const width = size4 === "auto" ? "auto" : `${size4.width}px`;
7327 const height = size4 === "auto" ? "auto" : `${size4.height}px`;
7328 popupElement.style.setProperty("--popup-width", width);
7329 popupElement.style.setProperty("--popup-height", height);
7330 }
7331 function setPositionerCssSize(positionerElement, size4) {
7332 const width = size4 === "max-content" ? "max-content" : `${size4.width}px`;
7333 const height = size4 === "max-content" ? "max-content" : `${size4.height}px`;
7334 positionerElement.style.setProperty("--positioner-width", width);
7335 positionerElement.style.setProperty("--positioner-height", height);
7336 }
7337
7338 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js
7339 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
7340 function usePopupViewport(parameters) {
7341 const {
7342 store: store2,
7343 side,
7344 cssVars,
7345 children
7346 } = parameters;
7347 const direction = useDirection();
7348 const activeTrigger = store2.useState("activeTriggerElement");
7349 const activeTriggerId = store2.useState("activeTriggerId");
7350 const open = store2.useState("open");
7351 const payload = store2.useState("payload");
7352 const mounted = store2.useState("mounted");
7353 const popupElement = store2.useState("popupElement");
7354 const positionerElement = store2.useState("positionerElement");
7355 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null);
7356 const currentContentKey = usePopupContentKey(activeTriggerId, payload);
7357 const capturedNodeRef = React33.useRef(null);
7358 const [previousContentNode, setPreviousContentNode] = React33.useState(null);
7359 const [newTriggerOffset, setNewTriggerOffset] = React33.useState(null);
7360 const currentContainerRef = React33.useRef(null);
7361 const previousContainerRef = React33.useRef(null);
7362 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false);
7363 const cleanupFrame = useAnimationFrame();
7364 const [previousContentDimensions, setPreviousContentDimensions] = React33.useState(null);
7365 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React33.useState(false);
7366 useIsoLayoutEffect(() => {
7367 store2.set("hasViewport", true);
7368 return () => {
7369 store2.set("hasViewport", false);
7370 };
7371 }, [store2]);
7372 const handleMeasureLayout = useStableCallback(() => {
7373 currentContainerRef.current?.style.setProperty("animation", "none");
7374 currentContainerRef.current?.style.setProperty("transition", "none");
7375 previousContainerRef.current?.style.setProperty("display", "none");
7376 });
7377 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => {
7378 currentContainerRef.current?.style.removeProperty("animation");
7379 currentContainerRef.current?.style.removeProperty("transition");
7380 previousContainerRef.current?.style.removeProperty("display");
7381 if (previousDimensions) {
7382 setPreviousContentDimensions(previousDimensions);
7383 }
7384 });
7385 const lastHandledTriggerRef = React33.useRef(null);
7386 useIsoLayoutEffect(() => {
7387 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
7388 setPreviousContentNode(capturedNodeRef.current);
7389 setShowStartingStyleAttribute(true);
7390 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
7391 setNewTriggerOffset(offset4);
7392 cleanupFrame.request(() => {
7393 ReactDOM5.flushSync(() => {
7394 setShowStartingStyleAttribute(false);
7395 });
7396 onAnimationsFinished(() => {
7397 setPreviousContentNode(null);
7398 setPreviousContentDimensions(null);
7399 capturedNodeRef.current = null;
7400 });
7401 });
7402 lastHandledTriggerRef.current = activeTrigger;
7403 }
7404 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]);
7405 useIsoLayoutEffect(() => {
7406 const source = currentContainerRef.current;
7407 if (!source) {
7408 return;
7409 }
7410 const wrapper = ownerDocument(source).createElement("div");
7411 for (const child of Array.from(source.childNodes)) {
7412 wrapper.appendChild(child.cloneNode(true));
7413 }
7414 capturedNodeRef.current = wrapper;
7415 });
7416 const isTransitioning = previousContentNode != null;
7417 let childrenToRender;
7418 if (!isTransitioning) {
7419 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", {
7420 "data-current": true,
7421 ref: currentContainerRef,
7422 children
7423 }, currentContentKey);
7424 } else {
7425 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(React33.Fragment, {
7426 children: [/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", {
7427 "data-previous": true,
7428 inert: inertValue(true),
7429 ref: previousContainerRef,
7430 style: {
7431 ...previousContentDimensions ? {
7432 [cssVars.popupWidth]: `${previousContentDimensions.width}px`,
7433 [cssVars.popupHeight]: `${previousContentDimensions.height}px`
7434 } : null,
7435 position: "absolute"
7436 },
7437 "data-ending-style": showStartingStyleAttribute ? void 0 : ""
7438 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", {
7439 "data-current": true,
7440 ref: currentContainerRef,
7441 "data-starting-style": showStartingStyleAttribute ? "" : void 0,
7442 children
7443 }, currentContentKey)]
7444 });
7445 }
7446 useIsoLayoutEffect(() => {
7447 const container = previousContainerRef.current;
7448 if (!container || !previousContentNode) {
7449 return;
7450 }
7451 container.replaceChildren(...Array.from(previousContentNode.childNodes));
7452 }, [previousContentNode]);
7453 usePopupAutoResize({
7454 popupElement,
7455 positionerElement,
7456 mounted,
7457 content: payload,
7458 onMeasureLayout: handleMeasureLayout,
7459 onMeasureLayoutComplete: handleMeasureLayoutComplete,
7460 side,
7461 direction
7462 });
7463 const state = {
7464 activationDirection: getActivationDirection(newTriggerOffset),
7465 transitioning: isTransitioning
7466 };
7467 return {
7468 children: childrenToRender,
7469 state
7470 };
7471 }
7472 function getActivationDirection(offset4) {
7473 if (!offset4) {
7474 return void 0;
7475 }
7476 return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`;
7477 }
7478 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
7479 if (value > tolerance) {
7480 return positiveLabel;
7481 }
7482 if (value < -tolerance) {
7483 return negativeLabel;
7484 }
7485 return "";
7486 }
7487 function calculateRelativePosition(from, to) {
7488 const fromRect = from.getBoundingClientRect();
7489 const toRect = to.getBoundingClientRect();
7490 const fromCenter = {
7491 x: fromRect.left + fromRect.width / 2,
7492 y: fromRect.top + fromRect.height / 2
7493 };
7494 const toCenter = {
7495 x: toRect.left + toRect.width / 2,
7496 y: toRect.top + toRect.height / 2
7497 };
7498 return {
7499 horizontal: toCenter.x - fromCenter.x,
7500 vertical: toCenter.y - fromCenter.y
7501 };
7502 }
7503 function usePopupContentKey(activeTriggerId, payload) {
7504 const [contentKey, setContentKey] = React33.useState(0);
7505 const previousActiveTriggerIdRef = React33.useRef(activeTriggerId);
7506 const previousPayloadRef = React33.useRef(payload);
7507 const pendingPayloadUpdateRef = React33.useRef(false);
7508 useIsoLayoutEffect(() => {
7509 const previousActiveTriggerId = previousActiveTriggerIdRef.current;
7510 const previousPayload = previousPayloadRef.current;
7511 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId;
7512 const payloadChanged = payload !== previousPayload;
7513 if (triggerIdChanged) {
7514 setContentKey((value) => value + 1);
7515 pendingPayloadUpdateRef.current = !payloadChanged;
7516 } else if (pendingPayloadUpdateRef.current && payloadChanged) {
7517 setContentKey((value) => value + 1);
7518 pendingPayloadUpdateRef.current = false;
7519 }
7520 previousActiveTriggerIdRef.current = activeTriggerId;
7521 previousPayloadRef.current = payload;
7522 }, [activeTriggerId, payload]);
7523 return `${activeTriggerId ?? "current"}-${contentKey}`;
7524 }
7525
7526 // node_modules/@base-ui/react/esm/utils/FloatingPortalLite.js
7527 var React34 = __toESM(require_react(), 1);
7528 var ReactDOM6 = __toESM(require_react_dom(), 1);
7529 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
7530 var FloatingPortalLite = /* @__PURE__ */ React34.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) {
7531 const {
7532 children,
7533 container,
7534 className,
7535 render,
7536 style,
7537 ...elementProps
7538 } = componentProps;
7539 const {
7540 portalNode,
7541 portalSubtree
7542 } = useFloatingPortalNode({
7543 container,
7544 ref: forwardedRef,
7545 componentProps,
7546 elementProps
7547 });
7548 if (!portalSubtree && !portalNode) {
7549 return null;
7550 }
7551 return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React34.Fragment, {
7552 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM6.createPortal(children, portalNode)]
7553 });
7554 });
7555 if (true) FloatingPortalLite.displayName = "FloatingPortalLite";
7556
7557 // node_modules/@base-ui/react/esm/tooltip/index.parts.js
7558 var index_parts_exports = {};
7559 __export(index_parts_exports, {
7560 Arrow: () => TooltipArrow,
7561 Handle: () => TooltipHandle,
7562 Popup: () => TooltipPopup,
7563 Portal: () => TooltipPortal,
7564 Positioner: () => TooltipPositioner,
7565 Provider: () => TooltipProvider,
7566 Root: () => TooltipRoot,
7567 Trigger: () => TooltipTrigger,
7568 Viewport: () => TooltipViewport,
7569 createHandle: () => createTooltipHandle
7570 });
7571
7572 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js
7573 var React37 = __toESM(require_react(), 1);
7574
7575 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRootContext.js
7576 var React35 = __toESM(require_react(), 1);
7577 var TooltipRootContext = /* @__PURE__ */ React35.createContext(void 0);
7578 if (true) TooltipRootContext.displayName = "TooltipRootContext";
7579 function useTooltipRootContext(optional) {
7580 const context = React35.useContext(TooltipRootContext);
7581 if (context === void 0 && !optional) {
7582 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72));
7583 }
7584 return context;
7585 }
7586
7587 // node_modules/@base-ui/react/esm/tooltip/store/TooltipStore.js
7588 var React36 = __toESM(require_react(), 1);
7589 var ReactDOM7 = __toESM(require_react_dom(), 1);
7590 var selectors2 = {
7591 ...popupStoreSelectors,
7592 disabled: createSelector((state) => state.disabled),
7593 instantType: createSelector((state) => state.instantType),
7594 isInstantPhase: createSelector((state) => state.isInstantPhase),
7595 trackCursorAxis: createSelector((state) => state.trackCursorAxis),
7596 disableHoverablePopup: createSelector((state) => state.disableHoverablePopup),
7597 lastOpenChangeReason: createSelector((state) => state.openChangeReason),
7598 closeOnClick: createSelector((state) => state.closeOnClick),
7599 closeDelay: createSelector((state) => state.closeDelay),
7600 hasViewport: createSelector((state) => state.hasViewport)
7601 };
7602 var TooltipStore = class _TooltipStore extends ReactStore {
7603 constructor(initialState) {
7604 super({
7605 ...createInitialState(),
7606 ...initialState
7607 }, {
7608 popupRef: /* @__PURE__ */ React36.createRef(),
7609 onOpenChange: void 0,
7610 onOpenChangeComplete: void 0,
7611 triggerElements: new PopupTriggerMap()
7612 }, selectors2);
7613 }
7614 setOpen = (nextOpen, eventDetails) => {
7615 const reason = eventDetails.reason;
7616 const isHover = reason === reason_parts_exports.triggerHover;
7617 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus;
7618 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey);
7619 eventDetails.preventUnmountOnClose = () => {
7620 this.set("preventUnmountingOnClose", true);
7621 };
7622 this.context.onOpenChange?.(nextOpen, eventDetails);
7623 if (eventDetails.isCanceled) {
7624 return;
7625 }
7626 this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
7627 const changeState = () => {
7628 const updatedState = {
7629 open: nextOpen,
7630 openChangeReason: reason
7631 };
7632 if (isFocusOpen) {
7633 updatedState.instantType = "focus";
7634 } else if (isDismissClose) {
7635 updatedState.instantType = "dismiss";
7636 } else if (reason === reason_parts_exports.triggerHover) {
7637 updatedState.instantType = void 0;
7638 }
7639 const newTriggerId = eventDetails.trigger?.id ?? null;
7640 if (newTriggerId || nextOpen) {
7641 updatedState.activeTriggerId = newTriggerId;
7642 updatedState.activeTriggerElement = eventDetails.trigger ?? null;
7643 }
7644 this.update(updatedState);
7645 };
7646 if (isHover) {
7647 ReactDOM7.flushSync(changeState);
7648 } else {
7649 changeState();
7650 }
7651 };
7652 static useStore(externalStore, initialState) {
7653 const internalStore = useRefWithInit(() => {
7654 return new _TooltipStore(initialState);
7655 }).current;
7656 const store2 = externalStore ?? internalStore;
7657 const floatingRootContext = useSyncedFloatingRootContext({
7658 popupStore: store2,
7659 onOpenChange: store2.setOpen
7660 });
7661 store2.state.floatingRootContext = floatingRootContext;
7662 return store2;
7663 }
7664 };
7665 function createInitialState() {
7666 return {
7667 ...createInitialPopupStoreState(),
7668 disabled: false,
7669 instantType: void 0,
7670 isInstantPhase: false,
7671 trackCursorAxis: "none",
7672 disableHoverablePopup: false,
7673 openChangeReason: null,
7674 closeOnClick: true,
7675 closeDelay: 0,
7676 hasViewport: false
7677 };
7678 }
7679
7680 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js
7681 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
7682 var TooltipRoot = fastComponent(function TooltipRoot2(props) {
7683 const {
7684 disabled: disabled2 = false,
7685 defaultOpen = false,
7686 open: openProp,
7687 disableHoverablePopup = false,
7688 trackCursorAxis = "none",
7689 actionsRef,
7690 onOpenChange,
7691 onOpenChangeComplete,
7692 handle,
7693 triggerId: triggerIdProp,
7694 defaultTriggerId: defaultTriggerIdProp = null,
7695 children
7696 } = props;
7697 const store2 = TooltipStore.useStore(handle?.store, {
7698 open: defaultOpen,
7699 openProp,
7700 activeTriggerId: defaultTriggerIdProp,
7701 triggerIdProp
7702 });
7703 useOnFirstRender(() => {
7704 if (openProp === void 0 && store2.state.open === false && defaultOpen === true) {
7705 store2.update({
7706 open: true,
7707 activeTriggerId: defaultTriggerIdProp
7708 });
7709 }
7710 });
7711 store2.useControlledProp("openProp", openProp);
7712 store2.useControlledProp("triggerIdProp", triggerIdProp);
7713 store2.useContextCallback("onOpenChange", onOpenChange);
7714 store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
7715 const openState = store2.useState("open");
7716 const open = !disabled2 && openState;
7717 const activeTriggerId = store2.useState("activeTriggerId");
7718 const payload = store2.useState("payload");
7719 store2.useSyncedValues({
7720 trackCursorAxis,
7721 disableHoverablePopup
7722 });
7723 useIsoLayoutEffect(() => {
7724 if (openState && disabled2) {
7725 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled));
7726 }
7727 }, [openState, disabled2, store2]);
7728 store2.useSyncedValue("disabled", disabled2);
7729 useImplicitActiveTrigger(store2);
7730 const {
7731 forceUnmount,
7732 transitionStatus
7733 } = useOpenStateTransitions(open, store2);
7734 const floatingRootContext = store2.select("floatingRootContext");
7735 const isInstantPhase = store2.useState("isInstantPhase");
7736 const instantType = store2.useState("instantType");
7737 const lastOpenChangeReason = store2.useState("lastOpenChangeReason");
7738 const previousInstantTypeRef = React37.useRef(null);
7739 useIsoLayoutEffect(() => {
7740 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) {
7741 if (instantType !== "delay") {
7742 previousInstantTypeRef.current = instantType;
7743 }
7744 store2.set("instantType", "delay");
7745 } else if (previousInstantTypeRef.current !== null) {
7746 store2.set("instantType", previousInstantTypeRef.current);
7747 previousInstantTypeRef.current = null;
7748 }
7749 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]);
7750 useIsoLayoutEffect(() => {
7751 if (open) {
7752 if (activeTriggerId == null) {
7753 store2.set("payload", void 0);
7754 }
7755 }
7756 }, [store2, activeTriggerId, open]);
7757 const handleImperativeClose = React37.useCallback(() => {
7758 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction));
7759 }, [store2]);
7760 React37.useImperativeHandle(actionsRef, () => ({
7761 unmount: forceUnmount,
7762 close: handleImperativeClose
7763 }), [forceUnmount, handleImperativeClose]);
7764 const dismiss = useDismiss(floatingRootContext, {
7765 enabled: !disabled2,
7766 referencePress: () => store2.select("closeOnClick")
7767 });
7768 const clientPoint = useClientPoint(floatingRootContext, {
7769 enabled: !disabled2 && trackCursorAxis !== "none",
7770 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis
7771 });
7772 const {
7773 getReferenceProps,
7774 getFloatingProps,
7775 getTriggerProps
7776 } = useInteractions([dismiss, clientPoint]);
7777 const activeTriggerProps = React37.useMemo(() => getReferenceProps(), [getReferenceProps]);
7778 const inactiveTriggerProps = React37.useMemo(() => getTriggerProps(), [getTriggerProps]);
7779 const popupProps = React37.useMemo(() => getFloatingProps(), [getFloatingProps]);
7780 store2.useSyncedValues({
7781 activeTriggerProps,
7782 inactiveTriggerProps,
7783 popupProps
7784 });
7785 return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipRootContext.Provider, {
7786 value: store2,
7787 children: typeof children === "function" ? children({
7788 payload
7789 }) : children
7790 });
7791 });
7792 if (true) TooltipRoot.displayName = "TooltipRoot";
7793
7794 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js
7795 var React39 = __toESM(require_react(), 1);
7796
7797 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProviderContext.js
7798 var React38 = __toESM(require_react(), 1);
7799 var TooltipProviderContext = /* @__PURE__ */ React38.createContext(void 0);
7800 if (true) TooltipProviderContext.displayName = "TooltipProviderContext";
7801 function useTooltipProviderContext() {
7802 return React38.useContext(TooltipProviderContext);
7803 }
7804
7805 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTriggerDataAttributes.js
7806 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) {
7807 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen";
7808 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled";
7809 return TooltipTriggerDataAttributes2;
7810 })({});
7811
7812 // node_modules/@base-ui/react/esm/tooltip/utils/constants.js
7813 var OPEN_DELAY = 600;
7814
7815 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js
7816 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) {
7817 const {
7818 className,
7819 render,
7820 handle,
7821 payload,
7822 disabled: disabledProp,
7823 delay,
7824 closeOnClick = true,
7825 closeDelay,
7826 id: idProp,
7827 style,
7828 ...elementProps
7829 } = componentProps;
7830 const rootContext = useTooltipRootContext(true);
7831 const store2 = handle?.store ?? rootContext;
7832 if (!store2) {
7833 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));
7834 }
7835 const thisTriggerId = useBaseUiId(idProp);
7836 const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId);
7837 const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId);
7838 const floatingRootContext = store2.useState("floatingRootContext");
7839 const triggerElementRef = React39.useRef(null);
7840 const delayWithDefault = delay ?? OPEN_DELAY;
7841 const closeDelayWithDefault = closeDelay ?? 0;
7842 const {
7843 registerTrigger,
7844 isMountedByThisTrigger
7845 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, {
7846 payload,
7847 closeOnClick,
7848 closeDelay: closeDelayWithDefault
7849 });
7850 const providerContext = useTooltipProviderContext();
7851 const {
7852 delayRef,
7853 isInstantPhase,
7854 hasProvider
7855 } = useDelayGroup(floatingRootContext, {
7856 open: isOpenedByThisTrigger
7857 });
7858 store2.useSyncedValue("isInstantPhase", isInstantPhase);
7859 const rootDisabled = store2.useState("disabled");
7860 const disabled2 = disabledProp ?? rootDisabled;
7861 const trackCursorAxis = store2.useState("trackCursorAxis");
7862 const disableHoverablePopup = store2.useState("disableHoverablePopup");
7863 const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
7864 enabled: !disabled2,
7865 mouseOnly: true,
7866 move: false,
7867 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null,
7868 restMs() {
7869 const providerDelay = providerContext?.delay;
7870 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0;
7871 let computedRestMs = delayWithDefault;
7872 if (hasProvider) {
7873 if (groupOpenValue !== 0) {
7874 computedRestMs = delay ?? providerDelay ?? delayWithDefault;
7875 } else {
7876 computedRestMs = 0;
7877 }
7878 }
7879 return computedRestMs;
7880 },
7881 delay() {
7882 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0;
7883 let computedCloseDelay = closeDelayWithDefault;
7884 if (closeDelay == null && hasProvider) {
7885 computedCloseDelay = closeValue;
7886 }
7887 return {
7888 close: computedCloseDelay
7889 };
7890 },
7891 triggerElementRef,
7892 isActiveTrigger: isTriggerActive,
7893 isClosing: () => store2.select("transitionStatus") === "ending"
7894 });
7895 const focusProps = useFocus(floatingRootContext, {
7896 enabled: !disabled2
7897 }).reference;
7898 const state = {
7899 open: isOpenedByThisTrigger
7900 };
7901 const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger);
7902 const element = useRenderElement("button", componentProps, {
7903 state,
7904 ref: [forwardedRef, registerTrigger, triggerElementRef],
7905 props: [hoverProps, focusProps, rootTriggerProps, {
7906 onPointerDown() {
7907 store2.set("closeOnClick", closeOnClick);
7908 },
7909 id: thisTriggerId,
7910 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0
7911 }, elementProps],
7912 stateAttributesMapping: triggerOpenStateMapping
7913 });
7914 return element;
7915 });
7916 if (true) TooltipTrigger.displayName = "TooltipTrigger";
7917
7918 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js
7919 var React41 = __toESM(require_react(), 1);
7920
7921 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortalContext.js
7922 var React40 = __toESM(require_react(), 1);
7923 var TooltipPortalContext = /* @__PURE__ */ React40.createContext(void 0);
7924 if (true) TooltipPortalContext.displayName = "TooltipPortalContext";
7925 function useTooltipPortalContext() {
7926 const value = React40.useContext(TooltipPortalContext);
7927 if (value === void 0) {
7928 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70));
7929 }
7930 return value;
7931 }
7932
7933 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js
7934 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
7935 var TooltipPortal = /* @__PURE__ */ React41.forwardRef(function TooltipPortal2(props, forwardedRef) {
7936 const {
7937 keepMounted = false,
7938 ...portalProps
7939 } = props;
7940 const store2 = useTooltipRootContext();
7941 const mounted = store2.useState("mounted");
7942 const shouldRender = mounted || keepMounted;
7943 if (!shouldRender) {
7944 return null;
7945 }
7946 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipPortalContext.Provider, {
7947 value: keepMounted,
7948 children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FloatingPortalLite, {
7949 ref: forwardedRef,
7950 ...portalProps
7951 })
7952 });
7953 });
7954 if (true) TooltipPortal.displayName = "TooltipPortal";
7955
7956 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js
7957 var React43 = __toESM(require_react(), 1);
7958
7959 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositionerContext.js
7960 var React42 = __toESM(require_react(), 1);
7961 var TooltipPositionerContext = /* @__PURE__ */ React42.createContext(void 0);
7962 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext";
7963 function useTooltipPositionerContext() {
7964 const context = React42.useContext(TooltipPositionerContext);
7965 if (context === void 0) {
7966 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71));
7967 }
7968 return context;
7969 }
7970
7971 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js
7972 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
7973 var TooltipPositioner = /* @__PURE__ */ React43.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) {
7974 const {
7975 render,
7976 className,
7977 anchor,
7978 positionMethod = "absolute",
7979 side = "top",
7980 align = "center",
7981 sideOffset = 0,
7982 alignOffset = 0,
7983 collisionBoundary = "clipping-ancestors",
7984 collisionPadding = 5,
7985 arrowPadding = 5,
7986 sticky = false,
7987 disableAnchorTracking = false,
7988 collisionAvoidance = POPUP_COLLISION_AVOIDANCE,
7989 style,
7990 ...elementProps
7991 } = componentProps;
7992 const store2 = useTooltipRootContext();
7993 const keepMounted = useTooltipPortalContext();
7994 const open = store2.useState("open");
7995 const mounted = store2.useState("mounted");
7996 const trackCursorAxis = store2.useState("trackCursorAxis");
7997 const disableHoverablePopup = store2.useState("disableHoverablePopup");
7998 const floatingRootContext = store2.useState("floatingRootContext");
7999 const instantType = store2.useState("instantType");
8000 const transitionStatus = store2.useState("transitionStatus");
8001 const hasViewport = store2.useState("hasViewport");
8002 const positioning = useAnchorPositioning({
8003 anchor,
8004 positionMethod,
8005 floatingRootContext,
8006 mounted,
8007 side,
8008 sideOffset,
8009 align,
8010 alignOffset,
8011 collisionBoundary,
8012 collisionPadding,
8013 sticky,
8014 arrowPadding,
8015 disableAnchorTracking,
8016 keepMounted,
8017 collisionAvoidance,
8018 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0
8019 });
8020 const state = React43.useMemo(() => ({
8021 open,
8022 side: positioning.side,
8023 align: positioning.align,
8024 anchorHidden: positioning.anchorHidden,
8025 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType
8026 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]);
8027 const element = usePositioner(componentProps, state, {
8028 styles: positioning.positionerStyles,
8029 transitionStatus,
8030 props: elementProps,
8031 refs: [forwardedRef, store2.useStateSetter("positionerElement")],
8032 hidden: !mounted,
8033 inert: !open || trackCursorAxis === "both" || disableHoverablePopup
8034 });
8035 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPositionerContext.Provider, {
8036 value: positioning,
8037 children: element
8038 });
8039 });
8040 if (true) TooltipPositioner.displayName = "TooltipPositioner";
8041
8042 // node_modules/@base-ui/react/esm/tooltip/popup/TooltipPopup.js
8043 var React44 = __toESM(require_react(), 1);
8044 var stateAttributesMapping = {
8045 ...popupStateMapping,
8046 ...transitionStatusMapping
8047 };
8048 var TooltipPopup = /* @__PURE__ */ React44.forwardRef(function TooltipPopup2(componentProps, forwardedRef) {
8049 const {
8050 className,
8051 render,
8052 style,
8053 ...elementProps
8054 } = componentProps;
8055 const store2 = useTooltipRootContext();
8056 const {
8057 side,
8058 align
8059 } = useTooltipPositionerContext();
8060 const open = store2.useState("open");
8061 const instantType = store2.useState("instantType");
8062 const transitionStatus = store2.useState("transitionStatus");
8063 const popupProps = store2.useState("popupProps");
8064 const floatingContext = store2.useState("floatingRootContext");
8065 useOpenChangeComplete({
8066 open,
8067 ref: store2.context.popupRef,
8068 onComplete() {
8069 if (open) {
8070 store2.context.onOpenChangeComplete?.(true);
8071 }
8072 }
8073 });
8074 const disabled2 = store2.useState("disabled");
8075 const closeDelay = store2.useState("closeDelay");
8076 useHoverFloatingInteraction(floatingContext, {
8077 enabled: !disabled2,
8078 closeDelay
8079 });
8080 const state = {
8081 open,
8082 side,
8083 align,
8084 instant: instantType,
8085 transitionStatus
8086 };
8087 const element = useRenderElement("div", componentProps, {
8088 state,
8089 ref: [forwardedRef, store2.context.popupRef, store2.useStateSetter("popupElement")],
8090 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps],
8091 stateAttributesMapping
8092 });
8093 return element;
8094 });
8095 if (true) TooltipPopup.displayName = "TooltipPopup";
8096
8097 // node_modules/@base-ui/react/esm/tooltip/arrow/TooltipArrow.js
8098 var React45 = __toESM(require_react(), 1);
8099 var TooltipArrow = /* @__PURE__ */ React45.forwardRef(function TooltipArrow2(componentProps, forwardedRef) {
8100 const {
8101 className,
8102 render,
8103 style,
8104 ...elementProps
8105 } = componentProps;
8106 const store2 = useTooltipRootContext();
8107 const open = store2.useState("open");
8108 const instantType = store2.useState("instantType");
8109 const {
8110 arrowRef,
8111 side,
8112 align,
8113 arrowUncentered,
8114 arrowStyles
8115 } = useTooltipPositionerContext();
8116 const state = {
8117 open,
8118 side,
8119 align,
8120 uncentered: arrowUncentered,
8121 instant: instantType
8122 };
8123 const element = useRenderElement("div", componentProps, {
8124 state,
8125 ref: [forwardedRef, arrowRef],
8126 props: [{
8127 style: arrowStyles,
8128 "aria-hidden": true
8129 }, elementProps],
8130 stateAttributesMapping: popupStateMapping
8131 });
8132 return element;
8133 });
8134 if (true) TooltipArrow.displayName = "TooltipArrow";
8135
8136 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProvider.js
8137 var React46 = __toESM(require_react(), 1);
8138 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
8139 var TooltipProvider = function TooltipProvider2(props) {
8140 const {
8141 delay,
8142 closeDelay,
8143 timeout = 400
8144 } = props;
8145 const contextValue = React46.useMemo(() => ({
8146 delay,
8147 closeDelay
8148 }), [delay, closeDelay]);
8149 const delayValue = React46.useMemo(() => ({
8150 open: delay,
8151 close: closeDelay
8152 }), [delay, closeDelay]);
8153 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipProviderContext.Provider, {
8154 value: contextValue,
8155 children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FloatingDelayGroup, {
8156 delay: delayValue,
8157 timeoutMs: timeout,
8158 children: props.children
8159 })
8160 });
8161 };
8162 if (true) TooltipProvider.displayName = "TooltipProvider";
8163
8164 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js
8165 var React47 = __toESM(require_react(), 1);
8166
8167 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewportCssVars.js
8168 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) {
8169 TooltipViewportCssVars2["popupWidth"] = "--popup-width";
8170 TooltipViewportCssVars2["popupHeight"] = "--popup-height";
8171 return TooltipViewportCssVars2;
8172 })({});
8173
8174 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js
8175 var stateAttributesMapping2 = {
8176 activationDirection: (value) => value ? {
8177 "data-activation-direction": value
8178 } : null
8179 };
8180 var TooltipViewport = /* @__PURE__ */ React47.forwardRef(function TooltipViewport2(componentProps, forwardedRef) {
8181 const {
8182 render,
8183 className,
8184 style,
8185 children,
8186 ...elementProps
8187 } = componentProps;
8188 const store2 = useTooltipRootContext();
8189 const positioner = useTooltipPositionerContext();
8190 const instantType = store2.useState("instantType");
8191 const {
8192 children: childrenToRender,
8193 state: viewportState
8194 } = usePopupViewport({
8195 store: store2,
8196 side: positioner.side,
8197 cssVars: TooltipViewportCssVars,
8198 children
8199 });
8200 const state = {
8201 activationDirection: viewportState.activationDirection,
8202 transitioning: viewportState.transitioning,
8203 instant: instantType
8204 };
8205 return useRenderElement("div", componentProps, {
8206 state,
8207 ref: forwardedRef,
8208 props: [elementProps, {
8209 children: childrenToRender
8210 }],
8211 stateAttributesMapping: stateAttributesMapping2
8212 });
8213 });
8214 if (true) TooltipViewport.displayName = "TooltipViewport";
8215
8216 // node_modules/@base-ui/react/esm/tooltip/store/TooltipHandle.js
8217 var TooltipHandle = class {
8218 /**
8219 * Internal store holding the tooltip state.
8220 * @internal
8221 */
8222 constructor() {
8223 this.store = new TooltipStore();
8224 }
8225 /**
8226 * Opens the tooltip and associates it with the trigger with the given ID.
8227 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop.
8228 *
8229 * This method should only be called in an event handler or an effect (not during rendering).
8230 *
8231 * @param triggerId ID of the trigger to associate with the tooltip.
8232 */
8233 open(triggerId) {
8234 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0;
8235 if (triggerId && !triggerElement) {
8236 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "${triggerId}".` : formatErrorMessage_default(81, triggerId));
8237 }
8238 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement));
8239 }
8240 /**
8241 * Closes the tooltip.
8242 */
8243 close() {
8244 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0));
8245 }
8246 /**
8247 * Indicates whether the tooltip is currently open.
8248 */
8249 get isOpen() {
8250 return this.store.state.open;
8251 }
8252 };
8253 function createTooltipHandle() {
8254 return new TooltipHandle();
8255 }
8256
8257 // node_modules/@base-ui/react/esm/use-render/useRender.js
8258 function useRender(params) {
8259 return useRenderElement(params.defaultTagName ?? "div", params, params);
8260 }
8261
8262 // packages/icons/build-module/library/arrow-up-left.mjs
8263 var import_primitives = __toESM(require_primitives(), 1);
8264 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
8265 var arrow_up_left_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives.Path, { d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" }) });
8266
8267 // packages/icons/build-module/library/arrow-up-right.mjs
8268 var import_primitives2 = __toESM(require_primitives(), 1);
8269 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
8270 var arrow_up_right_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives2.Path, { d: "M10 6H18V14H16.5V8.5L7 18L6 17L15.5 7.5H10V6Z" }) });
8271
8272 // packages/icons/build-module/library/chevron-down.mjs
8273 var import_primitives3 = __toESM(require_primitives(), 1);
8274 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
8275 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives3.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) });
8276
8277 // packages/icons/build-module/library/chevron-left.mjs
8278 var import_primitives4 = __toESM(require_primitives(), 1);
8279 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
8280 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) });
8281
8282 // packages/icons/build-module/library/chevron-right.mjs
8283 var import_primitives5 = __toESM(require_primitives(), 1);
8284 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
8285 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives5.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) });
8286
8287 // packages/icons/build-module/library/chevron-up.mjs
8288 var import_primitives6 = __toESM(require_primitives(), 1);
8289 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
8290 var chevron_up_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives6.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) });
8291
8292 // packages/icons/build-module/library/fullscreen.mjs
8293 var import_primitives7 = __toESM(require_primitives(), 1);
8294 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
8295 var fullscreen_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives7.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" }) });
8296
8297 // packages/icons/build-module/library/wordpress.mjs
8298 var import_primitives8 = __toESM(require_primitives(), 1);
8299 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
8300 var wordpress_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives8.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) });
8301
8302 // packages/ui/build-module/utils/render-slot-with-children.mjs
8303 var import_element8 = __toESM(require_element(), 1);
8304 function renderSlotWithChildren(slot, defaultSlot, children) {
8305 return (0, import_element8.cloneElement)(
8306 slot ?? defaultSlot,
8307 { children }
8308 );
8309 }
8310
8311 // packages/ui/build-module/lock-unlock.mjs
8312 var import_private_apis = __toESM(require_private_apis(), 1);
8313 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
8314 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
8315 "@wordpress/ui"
8316 );
8317
8318 // packages/ui/build-module/tooltip/index.mjs
8319 var tooltip_exports = {};
8320 __export(tooltip_exports, {
8321 Popup: () => Popup,
8322 Portal: () => Portal,
8323 Positioner: () => Positioner,
8324 Provider: () => Provider,
8325 Root: () => Root,
8326 Trigger: () => Trigger
8327 });
8328
8329 // packages/ui/build-module/tooltip/popup.mjs
8330 var import_element11 = __toESM(require_element(), 1);
8331 var import_theme = __toESM(require_theme(), 1);
8332
8333 // packages/ui/build-module/tooltip/portal.mjs
8334 var import_element9 = __toESM(require_element(), 1);
8335
8336 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs
8337 var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
8338 function getRuntime() {
8339 const globalScope = globalThis;
8340 if (globalScope.__wpStyleRuntime) {
8341 return globalScope.__wpStyleRuntime;
8342 }
8343 globalScope.__wpStyleRuntime = {
8344 documents: /* @__PURE__ */ new Map(),
8345 styles: /* @__PURE__ */ new Map(),
8346 injectedStyles: /* @__PURE__ */ new WeakMap()
8347 };
8348 if (typeof document !== "undefined") {
8349 registerDocument(document);
8350 }
8351 return globalScope.__wpStyleRuntime;
8352 }
8353 function documentContainsStyleHash(targetDocument, hash) {
8354 if (!targetDocument.head) {
8355 return false;
8356 }
8357 for (const style of targetDocument.head.querySelectorAll(
8358 `style[${STYLE_HASH_ATTRIBUTE}]`
8359 )) {
8360 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
8361 return true;
8362 }
8363 }
8364 return false;
8365 }
8366 function injectStyle(targetDocument, hash, css) {
8367 if (!targetDocument.head) {
8368 return;
8369 }
8370 const runtime = getRuntime();
8371 let injectedStyles = runtime.injectedStyles.get(targetDocument);
8372 if (!injectedStyles) {
8373 injectedStyles = /* @__PURE__ */ new Set();
8374 runtime.injectedStyles.set(targetDocument, injectedStyles);
8375 }
8376 if (injectedStyles.has(hash)) {
8377 return;
8378 }
8379 if (documentContainsStyleHash(targetDocument, hash)) {
8380 injectedStyles.add(hash);
8381 return;
8382 }
8383 const style = targetDocument.createElement("style");
8384 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
8385 style.appendChild(targetDocument.createTextNode(css));
8386 targetDocument.head.appendChild(style);
8387 injectedStyles.add(hash);
8388 }
8389 function registerDocument(targetDocument) {
8390 const runtime = getRuntime();
8391 runtime.documents.set(
8392 targetDocument,
8393 (runtime.documents.get(targetDocument) ?? 0) + 1
8394 );
8395 for (const [hash, css] of runtime.styles) {
8396 injectStyle(targetDocument, hash, css);
8397 }
8398 return () => {
8399 const count = runtime.documents.get(targetDocument);
8400 if (count === void 0) {
8401 return;
8402 }
8403 if (count <= 1) {
8404 runtime.documents.delete(targetDocument);
8405 return;
8406 }
8407 runtime.documents.set(targetDocument, count - 1);
8408 };
8409 }
8410 function registerStyle(hash, css) {
8411 const runtime = getRuntime();
8412 runtime.styles.set(hash, css);
8413 for (const targetDocument of runtime.documents.keys()) {
8414 injectStyle(targetDocument, hash, css);
8415 }
8416 }
8417 if (typeof process === "undefined" || true) {
8418 registerStyle("45eb1fe20f", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui-utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}");
8419 }
8420 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" };
8421 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot";
8422 function resolveOwnerDocument() {
8423 return typeof document === "undefined" ? null : document;
8424 }
8425 function isInWordPressEnvironment() {
8426 let topWp;
8427 try {
8428 topWp = window.top?.wp;
8429 } catch {
8430 }
8431 const wp = topWp ?? window.wp;
8432 return typeof wp?.components === "object" && wp.components !== null;
8433 }
8434 var cachedSlot = null;
8435 function createSlot(ownerDocument2) {
8436 const element = ownerDocument2.createElement("div");
8437 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, "");
8438 if (wp_compat_overlay_slot_default.slot) {
8439 element.classList.add(wp_compat_overlay_slot_default.slot);
8440 }
8441 ownerDocument2.body.appendChild(element);
8442 return element;
8443 }
8444 function getWpCompatOverlaySlot() {
8445 if (typeof window === "undefined") {
8446 return void 0;
8447 }
8448 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) {
8449 return void 0;
8450 }
8451 const ownerDocument2 = resolveOwnerDocument();
8452 if (!ownerDocument2 || !ownerDocument2.body) {
8453 return void 0;
8454 }
8455 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) {
8456 return cachedSlot;
8457 }
8458 const existing = ownerDocument2.querySelector(
8459 `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]`
8460 );
8461 if (existing instanceof HTMLDivElement) {
8462 cachedSlot = existing;
8463 return existing;
8464 }
8465 if (cachedSlot?.isConnected) {
8466 cachedSlot.remove();
8467 }
8468 cachedSlot = createSlot(ownerDocument2);
8469 return cachedSlot;
8470 }
8471
8472 // packages/ui/build-module/tooltip/portal.mjs
8473 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
8474 var Portal = (0, import_element9.forwardRef)(
8475 function TooltipPortal3({ container, ...restProps }, ref) {
8476 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8477 index_parts_exports.Portal,
8478 {
8479 container: container ?? getWpCompatOverlaySlot(),
8480 ...restProps,
8481 ref
8482 }
8483 );
8484 }
8485 );
8486
8487 // packages/ui/build-module/tooltip/positioner.mjs
8488 var import_element10 = __toESM(require_element(), 1);
8489 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
8490 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
8491 function getRuntime2() {
8492 const globalScope = globalThis;
8493 if (globalScope.__wpStyleRuntime) {
8494 return globalScope.__wpStyleRuntime;
8495 }
8496 globalScope.__wpStyleRuntime = {
8497 documents: /* @__PURE__ */ new Map(),
8498 styles: /* @__PURE__ */ new Map(),
8499 injectedStyles: /* @__PURE__ */ new WeakMap()
8500 };
8501 if (typeof document !== "undefined") {
8502 registerDocument2(document);
8503 }
8504 return globalScope.__wpStyleRuntime;
8505 }
8506 function documentContainsStyleHash2(targetDocument, hash) {
8507 if (!targetDocument.head) {
8508 return false;
8509 }
8510 for (const style of targetDocument.head.querySelectorAll(
8511 `style[${STYLE_HASH_ATTRIBUTE2}]`
8512 )) {
8513 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
8514 return true;
8515 }
8516 }
8517 return false;
8518 }
8519 function injectStyle2(targetDocument, hash, css) {
8520 if (!targetDocument.head) {
8521 return;
8522 }
8523 const runtime = getRuntime2();
8524 let injectedStyles = runtime.injectedStyles.get(targetDocument);
8525 if (!injectedStyles) {
8526 injectedStyles = /* @__PURE__ */ new Set();
8527 runtime.injectedStyles.set(targetDocument, injectedStyles);
8528 }
8529 if (injectedStyles.has(hash)) {
8530 return;
8531 }
8532 if (documentContainsStyleHash2(targetDocument, hash)) {
8533 injectedStyles.add(hash);
8534 return;
8535 }
8536 const style = targetDocument.createElement("style");
8537 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
8538 style.appendChild(targetDocument.createTextNode(css));
8539 targetDocument.head.appendChild(style);
8540 injectedStyles.add(hash);
8541 }
8542 function registerDocument2(targetDocument) {
8543 const runtime = getRuntime2();
8544 runtime.documents.set(
8545 targetDocument,
8546 (runtime.documents.get(targetDocument) ?? 0) + 1
8547 );
8548 for (const [hash, css] of runtime.styles) {
8549 injectStyle2(targetDocument, hash, css);
8550 }
8551 return () => {
8552 const count = runtime.documents.get(targetDocument);
8553 if (count === void 0) {
8554 return;
8555 }
8556 if (count <= 1) {
8557 runtime.documents.delete(targetDocument);
8558 return;
8559 }
8560 runtime.documents.set(targetDocument, count - 1);
8561 };
8562 }
8563 function registerStyle2(hash, css) {
8564 const runtime = getRuntime2();
8565 runtime.styles.set(hash, css);
8566 for (const targetDocument of runtime.documents.keys()) {
8567 injectStyle2(targetDocument, hash, css);
8568 }
8569 }
8570 if (typeof process === "undefined" || true) {
8571 registerStyle2("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}");
8572 }
8573 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
8574 if (typeof process === "undefined" || true) {
8575 registerStyle2("8293efbb49", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-sm,2px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-fg-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}}}');
8576 }
8577 var style_default = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
8578 var Positioner = (0, import_element10.forwardRef)(
8579 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) {
8580 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8581 index_parts_exports.Positioner,
8582 {
8583 ref,
8584 align,
8585 side,
8586 sideOffset,
8587 ...props,
8588 className: clsx_default(
8589 resets_default["box-sizing"],
8590 style_default.positioner,
8591 className
8592 )
8593 }
8594 );
8595 }
8596 );
8597
8598 // packages/ui/build-module/tooltip/popup.mjs
8599 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
8600 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
8601 function getRuntime3() {
8602 const globalScope = globalThis;
8603 if (globalScope.__wpStyleRuntime) {
8604 return globalScope.__wpStyleRuntime;
8605 }
8606 globalScope.__wpStyleRuntime = {
8607 documents: /* @__PURE__ */ new Map(),
8608 styles: /* @__PURE__ */ new Map(),
8609 injectedStyles: /* @__PURE__ */ new WeakMap()
8610 };
8611 if (typeof document !== "undefined") {
8612 registerDocument3(document);
8613 }
8614 return globalScope.__wpStyleRuntime;
8615 }
8616 function documentContainsStyleHash3(targetDocument, hash) {
8617 if (!targetDocument.head) {
8618 return false;
8619 }
8620 for (const style of targetDocument.head.querySelectorAll(
8621 `style[${STYLE_HASH_ATTRIBUTE3}]`
8622 )) {
8623 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
8624 return true;
8625 }
8626 }
8627 return false;
8628 }
8629 function injectStyle3(targetDocument, hash, css) {
8630 if (!targetDocument.head) {
8631 return;
8632 }
8633 const runtime = getRuntime3();
8634 let injectedStyles = runtime.injectedStyles.get(targetDocument);
8635 if (!injectedStyles) {
8636 injectedStyles = /* @__PURE__ */ new Set();
8637 runtime.injectedStyles.set(targetDocument, injectedStyles);
8638 }
8639 if (injectedStyles.has(hash)) {
8640 return;
8641 }
8642 if (documentContainsStyleHash3(targetDocument, hash)) {
8643 injectedStyles.add(hash);
8644 return;
8645 }
8646 const style = targetDocument.createElement("style");
8647 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
8648 style.appendChild(targetDocument.createTextNode(css));
8649 targetDocument.head.appendChild(style);
8650 injectedStyles.add(hash);
8651 }
8652 function registerDocument3(targetDocument) {
8653 const runtime = getRuntime3();
8654 runtime.documents.set(
8655 targetDocument,
8656 (runtime.documents.get(targetDocument) ?? 0) + 1
8657 );
8658 for (const [hash, css] of runtime.styles) {
8659 injectStyle3(targetDocument, hash, css);
8660 }
8661 return () => {
8662 const count = runtime.documents.get(targetDocument);
8663 if (count === void 0) {
8664 return;
8665 }
8666 if (count <= 1) {
8667 runtime.documents.delete(targetDocument);
8668 return;
8669 }
8670 runtime.documents.set(targetDocument, count - 1);
8671 };
8672 }
8673 function registerStyle3(hash, css) {
8674 const runtime = getRuntime3();
8675 runtime.styles.set(hash, css);
8676 for (const targetDocument of runtime.documents.keys()) {
8677 injectStyle3(targetDocument, hash, css);
8678 }
8679 }
8680 if (typeof process === "undefined" || true) {
8681 registerStyle3("8293efbb49", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-sm,2px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-fg-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}}}');
8682 }
8683 var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
8684 var ThemeProvider = unlock(import_theme.privateApis).ThemeProvider;
8685 var Popup = (0, import_element11.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) {
8686 const popupContent = (
8687 /* This should ideally use whatever dark color makes sense,
8688 * and not be hardcoded to #1e1e1e. The solutions would be to:
8689 * - review the design of the tooltip, in case we want to stop
8690 * hardcoding it to a dark background
8691 * - create new semantic tokens as needed (aliasing either the
8692 * "inverted bg" or "perma-dark bg" private tokens) and have
8693 * Tooltip.Popup use them;
8694 * - remove the hardcoded `bg` setting from the `ThemeProvider`
8695 * below
8696 */
8697 /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ThemeProvider, { color: { bg: "#1e1e1e" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8698 index_parts_exports.Popup,
8699 {
8700 ref,
8701 className: clsx_default(style_default2.popup, className),
8702 ...props,
8703 children
8704 }
8705 ) })
8706 );
8707 const positionedPopup = renderSlotWithChildren(
8708 positioner,
8709 /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Positioner, {}),
8710 popupContent
8711 );
8712 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Portal, {}), positionedPopup);
8713 });
8714
8715 // packages/ui/build-module/tooltip/trigger.mjs
8716 var import_element12 = __toESM(require_element(), 1);
8717 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
8718 var Trigger = (0, import_element12.forwardRef)(
8719 function TooltipTrigger3(props, ref) {
8720 return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(index_parts_exports.Trigger, { ref, ...props });
8721 }
8722 );
8723
8724 // packages/ui/build-module/tooltip/root.mjs
8725 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
8726 function Root(props) {
8727 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(index_parts_exports.Root, { ...props });
8728 }
8729
8730 // packages/ui/build-module/tooltip/provider.mjs
8731 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
8732 function Provider({ ...props }) {
8733 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(index_parts_exports.Provider, { ...props });
8734 }
8735
8736 // packages/ui/build-module/visually-hidden/visually-hidden.mjs
8737 var import_element13 = __toESM(require_element(), 1);
8738 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
8739 function getRuntime4() {
8740 const globalScope = globalThis;
8741 if (globalScope.__wpStyleRuntime) {
8742 return globalScope.__wpStyleRuntime;
8743 }
8744 globalScope.__wpStyleRuntime = {
8745 documents: /* @__PURE__ */ new Map(),
8746 styles: /* @__PURE__ */ new Map(),
8747 injectedStyles: /* @__PURE__ */ new WeakMap()
8748 };
8749 if (typeof document !== "undefined") {
8750 registerDocument4(document);
8751 }
8752 return globalScope.__wpStyleRuntime;
8753 }
8754 function documentContainsStyleHash4(targetDocument, hash) {
8755 if (!targetDocument.head) {
8756 return false;
8757 }
8758 for (const style of targetDocument.head.querySelectorAll(
8759 `style[${STYLE_HASH_ATTRIBUTE4}]`
8760 )) {
8761 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
8762 return true;
8763 }
8764 }
8765 return false;
8766 }
8767 function injectStyle4(targetDocument, hash, css) {
8768 if (!targetDocument.head) {
8769 return;
8770 }
8771 const runtime = getRuntime4();
8772 let injectedStyles = runtime.injectedStyles.get(targetDocument);
8773 if (!injectedStyles) {
8774 injectedStyles = /* @__PURE__ */ new Set();
8775 runtime.injectedStyles.set(targetDocument, injectedStyles);
8776 }
8777 if (injectedStyles.has(hash)) {
8778 return;
8779 }
8780 if (documentContainsStyleHash4(targetDocument, hash)) {
8781 injectedStyles.add(hash);
8782 return;
8783 }
8784 const style = targetDocument.createElement("style");
8785 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
8786 style.appendChild(targetDocument.createTextNode(css));
8787 targetDocument.head.appendChild(style);
8788 injectedStyles.add(hash);
8789 }
8790 function registerDocument4(targetDocument) {
8791 const runtime = getRuntime4();
8792 runtime.documents.set(
8793 targetDocument,
8794 (runtime.documents.get(targetDocument) ?? 0) + 1
8795 );
8796 for (const [hash, css] of runtime.styles) {
8797 injectStyle4(targetDocument, hash, css);
8798 }
8799 return () => {
8800 const count = runtime.documents.get(targetDocument);
8801 if (count === void 0) {
8802 return;
8803 }
8804 if (count <= 1) {
8805 runtime.documents.delete(targetDocument);
8806 return;
8807 }
8808 runtime.documents.set(targetDocument, count - 1);
8809 };
8810 }
8811 function registerStyle4(hash, css) {
8812 const runtime = getRuntime4();
8813 runtime.styles.set(hash, css);
8814 for (const targetDocument of runtime.documents.keys()) {
8815 injectStyle4(targetDocument, hash, css);
8816 }
8817 }
8818 if (typeof process === "undefined" || true) {
8819 registerStyle4("c46e8cb841", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-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}}");
8820 }
8821 var style_default3 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
8822 var VisuallyHidden = (0, import_element13.forwardRef)(
8823 function VisuallyHidden2({ render, ...restProps }, ref) {
8824 const element = useRender({
8825 render,
8826 ref,
8827 props: mergeProps(
8828 { className: style_default3["visually-hidden"] },
8829 restProps,
8830 {
8831 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
8832 "data-visually-hidden": ""
8833 }
8834 )
8835 });
8836 return element;
8837 }
8838 );
8839
8840 // packages/admin-ui/build-module/navigable-region/index.mjs
8841 var import_element14 = __toESM(require_element(), 1);
8842 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
8843 var NavigableRegion = (0, import_element14.forwardRef)(
8844 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
8845 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
8846 Tag,
8847 {
8848 ref,
8849 className: clsx_default("admin-ui-navigable-region", className),
8850 "aria-label": ariaLabel,
8851 role: "region",
8852 tabIndex: "-1",
8853 ...props,
8854 children
8855 }
8856 );
8857 }
8858 );
8859 NavigableRegion.displayName = "NavigableRegion";
8860 var navigable_region_default = NavigableRegion;
8861
8862 // packages/edit-post/build-module/components/layout/index.mjs
8863 var import_editor18 = __toESM(require_editor(), 1);
8864 var import_data25 = __toESM(require_data(), 1);
8865 var import_block_editor2 = __toESM(require_block_editor(), 1);
8866
8867 // packages/global-styles-engine/build-module/utils/common.mjs
8868 var import_style_engine = __toESM(require_style_engine(), 1);
8869 var ROOT_BLOCK_SELECTOR = "body";
8870 var ROOT_CSS_PROPERTIES_SELECTOR = ":root";
8871
8872 // packages/global-styles-engine/build-module/core/render.mjs
8873 var import_blocks = __toESM(require_blocks(), 1);
8874 var import_style_engine2 = __toESM(require_style_engine(), 1);
8875 var import_data = __toESM(require_data(), 1);
8876
8877 // packages/global-styles-engine/build-module/utils/spacing.mjs
8878 function getSpacingPresetCssVar(value) {
8879 if (!value) {
8880 return;
8881 }
8882 const slug = value.match(/var:preset\|spacing\|(.+)/);
8883 if (!slug) {
8884 return value;
8885 }
8886 return `var(--wp--preset--spacing--${slug[1]})`;
8887 }
8888
8889 // packages/global-styles-engine/build-module/utils/gap.mjs
8890 function getGapBoxControlValueFromStyle(blockGapValue) {
8891 if (!blockGapValue) {
8892 return null;
8893 }
8894 const isValueString = typeof blockGapValue === "string";
8895 return {
8896 top: isValueString ? blockGapValue : blockGapValue?.top,
8897 left: isValueString ? blockGapValue : blockGapValue?.left
8898 };
8899 }
8900 function getGapCSSValue(blockGapValue, defaultValue = "0") {
8901 const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue);
8902 if (!blockGapBoxControlValue) {
8903 return null;
8904 }
8905 const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue;
8906 const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue;
8907 return row === column ? row : `${row} ${column}`;
8908 }
8909
8910 // packages/global-styles-engine/build-module/utils/layout.mjs
8911 var LAYOUT_DEFINITIONS = {
8912 default: {
8913 name: "default",
8914 slug: "flow",
8915 className: "is-layout-flow",
8916 baseStyles: [
8917 {
8918 selector: " > .alignleft",
8919 rules: {
8920 float: "left",
8921 "margin-inline-start": "0",
8922 "margin-inline-end": "2em"
8923 }
8924 },
8925 {
8926 selector: " > .alignright",
8927 rules: {
8928 float: "right",
8929 "margin-inline-start": "2em",
8930 "margin-inline-end": "0"
8931 }
8932 },
8933 {
8934 selector: " > .aligncenter",
8935 rules: {
8936 "margin-left": "auto !important",
8937 "margin-right": "auto !important"
8938 }
8939 }
8940 ],
8941 spacingStyles: [
8942 {
8943 selector: " > :first-child",
8944 rules: {
8945 "margin-block-start": "0"
8946 }
8947 },
8948 {
8949 selector: " > :last-child",
8950 rules: {
8951 "margin-block-end": "0"
8952 }
8953 },
8954 {
8955 selector: " > *",
8956 rules: {
8957 "margin-block-start": null,
8958 "margin-block-end": "0"
8959 }
8960 }
8961 ]
8962 },
8963 constrained: {
8964 name: "constrained",
8965 slug: "constrained",
8966 className: "is-layout-constrained",
8967 baseStyles: [
8968 {
8969 selector: " > .alignleft",
8970 rules: {
8971 float: "left",
8972 "margin-inline-start": "0",
8973 "margin-inline-end": "2em"
8974 }
8975 },
8976 {
8977 selector: " > .alignright",
8978 rules: {
8979 float: "right",
8980 "margin-inline-start": "2em",
8981 "margin-inline-end": "0"
8982 }
8983 },
8984 {
8985 selector: " > .aligncenter",
8986 rules: {
8987 "margin-left": "auto !important",
8988 "margin-right": "auto !important"
8989 }
8990 },
8991 {
8992 selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))",
8993 rules: {
8994 "max-width": "var(--wp--style--global--content-size)",
8995 "margin-left": "auto !important",
8996 "margin-right": "auto !important"
8997 }
8998 },
8999 {
9000 selector: " > .alignwide",
9001 rules: {
9002 "max-width": "var(--wp--style--global--wide-size)"
9003 }
9004 }
9005 ],
9006 spacingStyles: [
9007 {
9008 selector: " > :first-child",
9009 rules: {
9010 "margin-block-start": "0"
9011 }
9012 },
9013 {
9014 selector: " > :last-child",
9015 rules: {
9016 "margin-block-end": "0"
9017 }
9018 },
9019 {
9020 selector: " > *",
9021 rules: {
9022 "margin-block-start": null,
9023 "margin-block-end": "0"
9024 }
9025 }
9026 ]
9027 },
9028 flex: {
9029 name: "flex",
9030 slug: "flex",
9031 className: "is-layout-flex",
9032 displayMode: "flex",
9033 baseStyles: [
9034 {
9035 selector: "",
9036 rules: {
9037 "flex-wrap": "wrap",
9038 "align-items": "center"
9039 }
9040 },
9041 {
9042 selector: " > :is(*, div)",
9043 // :is(*, div) instead of just * increases the specificity by 001.
9044 rules: {
9045 margin: "0"
9046 }
9047 }
9048 ],
9049 spacingStyles: [
9050 {
9051 selector: "",
9052 rules: {
9053 gap: null
9054 }
9055 }
9056 ]
9057 },
9058 grid: {
9059 name: "grid",
9060 slug: "grid",
9061 className: "is-layout-grid",
9062 displayMode: "grid",
9063 baseStyles: [
9064 {
9065 selector: " > :is(*, div)",
9066 // :is(*, div) instead of just * increases the specificity by 001.
9067 rules: {
9068 margin: "0"
9069 }
9070 }
9071 ],
9072 spacingStyles: [
9073 {
9074 selector: "",
9075 rules: {
9076 gap: null
9077 }
9078 }
9079 ]
9080 }
9081 };
9082
9083 // packages/global-styles-engine/build-module/core/render.mjs
9084 function getLayoutStyles({
9085 layoutDefinitions = LAYOUT_DEFINITIONS,
9086 style,
9087 selector,
9088 hasBlockGapSupport,
9089 hasFallbackGapSupport,
9090 fallbackGapValue
9091 }) {
9092 let ruleset = "";
9093 let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : "";
9094 if (hasFallbackGapSupport) {
9095 if (selector === ROOT_BLOCK_SELECTOR) {
9096 gapValue = !gapValue ? "0.5em" : gapValue;
9097 } else if (!hasBlockGapSupport && fallbackGapValue) {
9098 gapValue = fallbackGapValue;
9099 }
9100 }
9101 if (gapValue && layoutDefinitions) {
9102 Object.values(layoutDefinitions).forEach(
9103 ({ className, name, spacingStyles }) => {
9104 if (!hasBlockGapSupport && "flex" !== name && "grid" !== name) {
9105 return;
9106 }
9107 if (spacingStyles?.length) {
9108 spacingStyles.forEach((spacingStyle) => {
9109 const declarations = [];
9110 if (spacingStyle.rules) {
9111 Object.entries(spacingStyle.rules).forEach(
9112 ([cssProperty, cssValue]) => {
9113 declarations.push(
9114 `${cssProperty}: ${cssValue ? cssValue : gapValue}`
9115 );
9116 }
9117 );
9118 }
9119 if (declarations.length) {
9120 let combinedSelector = "";
9121 if (!hasBlockGapSupport) {
9122 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ""})` : `:where(${selector}.${className}${spacingStyle?.selector || ""})`;
9123 } else {
9124 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.${className})${spacingStyle?.selector || ""}` : `:root :where(${selector}-${className})${spacingStyle?.selector || ""}`;
9125 }
9126 ruleset += `${combinedSelector} { ${declarations.join(
9127 "; "
9128 )}; }`;
9129 }
9130 });
9131 }
9132 }
9133 );
9134 if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) {
9135 ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: ${gapValue}; }`;
9136 }
9137 }
9138 if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) {
9139 const validDisplayModes = ["block", "flex", "grid"];
9140 Object.values(layoutDefinitions).forEach(
9141 ({ className, displayMode, baseStyles }) => {
9142 if (displayMode && validDisplayModes.includes(displayMode)) {
9143 ruleset += `${selector} .${className} { display:${displayMode}; }`;
9144 }
9145 if (baseStyles?.length) {
9146 baseStyles.forEach((baseStyle) => {
9147 const declarations = [];
9148 if (baseStyle.rules) {
9149 Object.entries(baseStyle.rules).forEach(
9150 ([cssProperty, cssValue]) => {
9151 declarations.push(
9152 `${cssProperty}: ${cssValue}`
9153 );
9154 }
9155 );
9156 }
9157 if (declarations.length) {
9158 const combinedSelector = `.${className}${baseStyle?.selector || ""}`;
9159 ruleset += `${combinedSelector} { ${declarations.join(
9160 "; "
9161 )}; }`;
9162 }
9163 });
9164 }
9165 }
9166 );
9167 }
9168 return ruleset;
9169 }
9170
9171 // packages/edit-post/build-module/components/layout/index.mjs
9172 var import_plugins = __toESM(require_plugins(), 1);
9173 var import_i18n14 = __toESM(require_i18n(), 1);
9174 var import_element25 = __toESM(require_element(), 1);
9175 var import_notices3 = __toESM(require_notices(), 1);
9176 var import_preferences10 = __toESM(require_preferences(), 1);
9177 var import_commands2 = __toESM(require_commands(), 1);
9178 var import_block_library = __toESM(require_block_library(), 1);
9179 var import_url5 = __toESM(require_url(), 1);
9180 var import_html_entities = __toESM(require_html_entities(), 1);
9181 var import_core_data8 = __toESM(require_core_data(), 1);
9182 var import_components9 = __toESM(require_components(), 1);
9183 var import_compose3 = __toESM(require_compose(), 1);
9184
9185 // packages/edit-post/build-module/components/back-button/index.mjs
9186 var import_editor2 = __toESM(require_editor(), 1);
9187 var import_components2 = __toESM(require_components(), 1);
9188
9189 // packages/edit-post/build-module/components/back-button/fullscreen-mode-close.mjs
9190 var import_data2 = __toESM(require_data(), 1);
9191 var import_components = __toESM(require_components(), 1);
9192 var import_i18n = __toESM(require_i18n(), 1);
9193 var import_url = __toESM(require_url(), 1);
9194 var import_editor = __toESM(require_editor(), 1);
9195 var import_core_data = __toESM(require_core_data(), 1);
9196 var import_compose = __toESM(require_compose(), 1);
9197 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
9198 var siteIconVariants = {
9199 edit: {
9200 clipPath: "inset(0% round 0px)"
9201 },
9202 hover: {
9203 clipPath: "inset( 22% round 2px )"
9204 },
9205 tap: {
9206 clipPath: "inset(0% round 0px)"
9207 }
9208 };
9209 var toggleHomeIconVariants = {
9210 edit: {
9211 opacity: 0,
9212 scale: 0.2
9213 },
9214 hover: {
9215 opacity: 1,
9216 scale: 1,
9217 clipPath: "inset( 22% round 2px )"
9218 }
9219 };
9220 function FullscreenModeClose({ showTooltip, icon, href, initialPost }) {
9221 const { isRequestingSiteIcon, postType, siteIconUrl } = (0, import_data2.useSelect)(
9222 (select3) => {
9223 const { getCurrentPostType } = select3(import_editor.store);
9224 const { getEntityRecord, getPostType, isResolving } = select3(import_core_data.store);
9225 const siteData = getEntityRecord("root", "__unstableBase", void 0) || {};
9226 const _postType = initialPost?.type || getCurrentPostType();
9227 return {
9228 isRequestingSiteIcon: isResolving("getEntityRecord", [
9229 "root",
9230 "__unstableBase",
9231 void 0
9232 ]),
9233 postType: getPostType(_postType),
9234 siteIconUrl: siteData.site_icon_url
9235 };
9236 },
9237 [initialPost?.type]
9238 );
9239 const disableMotion = (0, import_compose.useReducedMotion)();
9240 const transition = {
9241 duration: disableMotion ? 0 : 0.2
9242 };
9243 if (!postType) {
9244 return null;
9245 }
9246 let siteIconContent;
9247 if (isRequestingSiteIcon && !siteIconUrl) {
9248 siteIconContent = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "edit-post-fullscreen-mode-close-site-icon__image" });
9249 } else if (siteIconUrl) {
9250 siteIconContent = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9251 "img",
9252 {
9253 className: "edit-post-fullscreen-mode-close-site-icon__image",
9254 alt: (0, import_i18n.__)("Site Icon"),
9255 src: siteIconUrl
9256 }
9257 );
9258 } else {
9259 siteIconContent = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9260 import_components.Icon,
9261 {
9262 className: "edit-post-fullscreen-mode-close-site-icon__icon",
9263 icon: wordpress_default,
9264 size: 48
9265 }
9266 );
9267 }
9268 const buttonIcon = icon ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components.Icon, { size: "36px", icon }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "edit-post-fullscreen-mode-close-site-icon", children: siteIconContent });
9269 const classes = clsx_default("edit-post-fullscreen-mode-close", {
9270 "has-icon": siteIconUrl
9271 });
9272 const buttonHref = href ?? (0, import_url.addQueryArgs)("edit.php", {
9273 post_type: postType.slug
9274 });
9275 const buttonLabel = postType?.labels?.view_items ?? (0, import_i18n.__)("Back");
9276 const hasAdminBarInEditor = window.__experimentalAdminBarInEditor;
9277 return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
9278 import_components.__unstableMotion.div,
9279 {
9280 className: "edit-post-fullscreen-mode-close__view-mode-toggle",
9281 animate: "edit",
9282 initial: "edit",
9283 whileHover: "hover",
9284 whileTap: "tap",
9285 transition,
9286 children: [
9287 /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9288 import_components.Button,
9289 {
9290 __next40pxDefaultSize: true,
9291 className: classes,
9292 href: buttonHref,
9293 label: buttonLabel,
9294 showTooltip,
9295 tooltipPosition: "bottom",
9296 children: !hasAdminBarInEditor && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9297 import_components.__unstableMotion.div,
9298 {
9299 variants: !disableMotion && siteIconVariants,
9300 children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "edit-post-fullscreen-mode-close__view-mode-toggle-icon", children: buttonIcon })
9301 }
9302 )
9303 }
9304 ),
9305 hasAdminBarInEditor ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "edit-post-fullscreen-mode-close__back-icon", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components.Icon, { icon: (0, import_i18n.isRTL)() ? chevron_right_default : chevron_left_default }) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9306 import_components.__unstableMotion.div,
9307 {
9308 className: clsx_default(
9309 "edit-post-fullscreen-mode-close__back-icon",
9310 {
9311 "has-site-icon": siteIconUrl
9312 }
9313 ),
9314 variants: !disableMotion && toggleHomeIconVariants,
9315 children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components.Icon, { icon: (0, import_i18n.isRTL)() ? arrow_up_right_default : arrow_up_left_default })
9316 }
9317 )
9318 ]
9319 }
9320 );
9321 }
9322 var fullscreen_mode_close_default = FullscreenModeClose;
9323
9324 // packages/edit-post/build-module/lock-unlock.mjs
9325 var import_private_apis2 = __toESM(require_private_apis(), 1);
9326 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
9327 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
9328 "@wordpress/edit-post"
9329 );
9330
9331 // packages/edit-post/build-module/components/back-button/index.mjs
9332 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
9333 var { BackButton: BackButtonFill } = unlock2(import_editor2.privateApis);
9334 var slideX = {
9335 hidden: { x: "-100%" },
9336 distractionFreeInactive: { x: 0 },
9337 hover: { x: 0, transition: { type: "tween", delay: 0.2 } }
9338 };
9339 function BackButton({ initialPost }) {
9340 return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BackButtonFill, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9341 import_components2.__unstableMotion.div,
9342 {
9343 variants: slideX,
9344 transition: { type: "tween", delay: 0.8 },
9345 children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9346 fullscreen_mode_close_default,
9347 {
9348 showTooltip: true,
9349 initialPost
9350 }
9351 )
9352 }
9353 ) });
9354 }
9355 var back_button_default = BackButton;
9356
9357 // packages/edit-post/build-module/components/editor-initialization/listener-hooks.mjs
9358 var import_data3 = __toESM(require_data(), 1);
9359 var import_element15 = __toESM(require_element(), 1);
9360 var import_editor3 = __toESM(require_editor(), 1);
9361 var import_core_data2 = __toESM(require_core_data(), 1);
9362
9363 // packages/edit-post/build-module/store/constants.mjs
9364 var STORE_NAME = "core/edit-post";
9365 var VIEW_AS_LINK_SELECTOR = "#wp-admin-bar-view a";
9366 var VIEW_AS_PREVIEW_LINK_SELECTOR = "#wp-admin-bar-preview a";
9367
9368 // packages/edit-post/build-module/components/editor-initialization/listener-hooks.mjs
9369 var useUpdatePostLinkListener = () => {
9370 const { isViewable, newPermalink } = (0, import_data3.useSelect)((select3) => {
9371 const { getPostType } = select3(import_core_data2.store);
9372 const { getCurrentPost, getEditedPostAttribute } = select3(import_editor3.store);
9373 const postType = getPostType(getEditedPostAttribute("type"));
9374 return {
9375 isViewable: postType?.viewable,
9376 newPermalink: getCurrentPost().link
9377 };
9378 }, []);
9379 const nodeToUpdateRef = (0, import_element15.useRef)();
9380 (0, import_element15.useEffect)(() => {
9381 nodeToUpdateRef.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR);
9382 }, []);
9383 (0, import_element15.useEffect)(() => {
9384 if (!newPermalink || !nodeToUpdateRef.current) {
9385 return;
9386 }
9387 if (!isViewable) {
9388 nodeToUpdateRef.current.style.display = "none";
9389 return;
9390 }
9391 nodeToUpdateRef.current.style.display = "";
9392 nodeToUpdateRef.current.setAttribute("href", newPermalink);
9393 }, [newPermalink, isViewable]);
9394 };
9395
9396 // packages/edit-post/build-module/components/editor-initialization/index.mjs
9397 function EditorInitialization() {
9398 useUpdatePostLinkListener();
9399 return null;
9400 }
9401
9402 // packages/edit-post/build-module/components/keyboard-shortcuts/index.mjs
9403 var import_element16 = __toESM(require_element(), 1);
9404 var import_data7 = __toESM(require_data(), 1);
9405 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1);
9406 var import_i18n3 = __toESM(require_i18n(), 1);
9407
9408 // packages/edit-post/build-module/store/index.mjs
9409 var import_data6 = __toESM(require_data(), 1);
9410
9411 // packages/edit-post/build-module/store/reducer.mjs
9412 var import_data4 = __toESM(require_data(), 1);
9413 function isSavingMetaBoxes(state = false, action) {
9414 switch (action.type) {
9415 case "REQUEST_META_BOX_UPDATES":
9416 return true;
9417 case "META_BOX_UPDATES_SUCCESS":
9418 case "META_BOX_UPDATES_FAILURE":
9419 return false;
9420 default:
9421 return state;
9422 }
9423 }
9424 function mergeMetaboxes(metaboxes = [], newMetaboxes) {
9425 const mergedMetaboxes = [...metaboxes];
9426 for (const metabox of newMetaboxes) {
9427 const existing = mergedMetaboxes.findIndex(
9428 (box) => box.id === metabox.id
9429 );
9430 if (existing !== -1) {
9431 mergedMetaboxes[existing] = {
9432 ...mergedMetaboxes[existing],
9433 ...metabox
9434 };
9435 } else {
9436 mergedMetaboxes.push(metabox);
9437 }
9438 }
9439 return mergedMetaboxes;
9440 }
9441 function metaBoxLocations(state = {}, action) {
9442 switch (action.type) {
9443 case "SET_META_BOXES_PER_LOCATIONS": {
9444 const newState = { ...state };
9445 for (const [location, metaboxes] of Object.entries(
9446 action.metaBoxesPerLocation
9447 )) {
9448 newState[location] = mergeMetaboxes(
9449 newState[location],
9450 metaboxes
9451 );
9452 }
9453 return newState;
9454 }
9455 }
9456 return state;
9457 }
9458 function metaBoxesInitialized(state = false, action) {
9459 switch (action.type) {
9460 case "META_BOXES_INITIALIZED":
9461 return true;
9462 }
9463 return state;
9464 }
9465 var metaBoxes = (0, import_data4.combineReducers)({
9466 isSaving: isSavingMetaBoxes,
9467 locations: metaBoxLocations,
9468 initialized: metaBoxesInitialized
9469 });
9470 var reducer_default = (0, import_data4.combineReducers)({
9471 metaBoxes
9472 });
9473
9474 // packages/edit-post/build-module/store/actions.mjs
9475 var actions_exports = {};
9476 __export(actions_exports, {
9477 __experimentalSetPreviewDeviceType: () => __experimentalSetPreviewDeviceType,
9478 __unstableCreateTemplate: () => __unstableCreateTemplate,
9479 closeGeneralSidebar: () => closeGeneralSidebar,
9480 closeModal: () => closeModal,
9481 closePublishSidebar: () => closePublishSidebar,
9482 hideBlockTypes: () => hideBlockTypes,
9483 initializeMetaBoxes: () => initializeMetaBoxes,
9484 metaBoxUpdatesFailure: () => metaBoxUpdatesFailure,
9485 metaBoxUpdatesSuccess: () => metaBoxUpdatesSuccess,
9486 openGeneralSidebar: () => openGeneralSidebar,
9487 openModal: () => openModal,
9488 openPublishSidebar: () => openPublishSidebar,
9489 removeEditorPanel: () => removeEditorPanel,
9490 requestMetaBoxUpdates: () => requestMetaBoxUpdates,
9491 setAvailableMetaBoxesPerLocation: () => setAvailableMetaBoxesPerLocation,
9492 setIsEditingTemplate: () => setIsEditingTemplate,
9493 setIsInserterOpened: () => setIsInserterOpened,
9494 setIsListViewOpened: () => setIsListViewOpened,
9495 showBlockTypes: () => showBlockTypes,
9496 switchEditorMode: () => switchEditorMode,
9497 toggleDistractionFree: () => toggleDistractionFree,
9498 toggleEditorPanelEnabled: () => toggleEditorPanelEnabled,
9499 toggleEditorPanelOpened: () => toggleEditorPanelOpened,
9500 toggleFeature: () => toggleFeature,
9501 toggleFullscreenMode: () => toggleFullscreenMode,
9502 togglePinnedPluginItem: () => togglePinnedPluginItem,
9503 togglePublishSidebar: () => togglePublishSidebar,
9504 updatePreferredStyleVariations: () => updatePreferredStyleVariations
9505 });
9506 var import_api_fetch = __toESM(require_api_fetch(), 1);
9507 var import_preferences = __toESM(require_preferences(), 1);
9508 var import_editor4 = __toESM(require_editor(), 1);
9509 var import_deprecated = __toESM(require_deprecated(), 1);
9510 var import_hooks = __toESM(require_hooks(), 1);
9511 var import_core_data3 = __toESM(require_core_data(), 1);
9512 var import_notices = __toESM(require_notices(), 1);
9513 var import_i18n2 = __toESM(require_i18n(), 1);
9514
9515 // packages/edit-post/build-module/utils/meta-boxes.mjs
9516 var getMetaBoxContainer = (location) => {
9517 const area = document.querySelector(
9518 `.edit-post-meta-boxes-area.is-${location} .metabox-location-${location}`
9519 );
9520 if (area) {
9521 return area;
9522 }
9523 return document.querySelector("#metaboxes .metabox-location-" + location);
9524 };
9525
9526 // packages/edit-post/build-module/store/actions.mjs
9527 var { interfaceStore } = unlock2(import_editor4.privateApis);
9528 var openGeneralSidebar = (name) => ({ registry }) => {
9529 registry.dispatch(interfaceStore).enableComplementaryArea("core", name);
9530 };
9531 var closeGeneralSidebar = () => ({ registry }) => registry.dispatch(interfaceStore).disableComplementaryArea("core");
9532 var openModal = (name) => ({ registry }) => {
9533 (0, import_deprecated.default)("select( 'core/edit-post' ).openModal( name )", {
9534 since: "6.3",
9535 alternative: "select( 'core/interface').openModal( name )"
9536 });
9537 return registry.dispatch(interfaceStore).openModal(name);
9538 };
9539 var closeModal = () => ({ registry }) => {
9540 (0, import_deprecated.default)("select( 'core/edit-post' ).closeModal()", {
9541 since: "6.3",
9542 alternative: "select( 'core/interface').closeModal()"
9543 });
9544 return registry.dispatch(interfaceStore).closeModal();
9545 };
9546 var openPublishSidebar = () => ({ registry }) => {
9547 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).openPublishSidebar", {
9548 since: "6.6",
9549 alternative: "dispatch( 'core/editor').openPublishSidebar"
9550 });
9551 registry.dispatch(import_editor4.store).openPublishSidebar();
9552 };
9553 var closePublishSidebar = () => ({ registry }) => {
9554 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).closePublishSidebar", {
9555 since: "6.6",
9556 alternative: "dispatch( 'core/editor').closePublishSidebar"
9557 });
9558 registry.dispatch(import_editor4.store).closePublishSidebar();
9559 };
9560 var togglePublishSidebar = () => ({ registry }) => {
9561 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).togglePublishSidebar", {
9562 since: "6.6",
9563 alternative: "dispatch( 'core/editor').togglePublishSidebar"
9564 });
9565 registry.dispatch(import_editor4.store).togglePublishSidebar();
9566 };
9567 var toggleEditorPanelEnabled = (panelName) => ({ registry }) => {
9568 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled", {
9569 since: "6.5",
9570 alternative: "dispatch( 'core/editor').toggleEditorPanelEnabled"
9571 });
9572 registry.dispatch(import_editor4.store).toggleEditorPanelEnabled(panelName);
9573 };
9574 var toggleEditorPanelOpened = (panelName) => ({ registry }) => {
9575 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleEditorPanelOpened", {
9576 since: "6.5",
9577 alternative: "dispatch( 'core/editor').toggleEditorPanelOpened"
9578 });
9579 registry.dispatch(import_editor4.store).toggleEditorPanelOpened(panelName);
9580 };
9581 var removeEditorPanel = (panelName) => ({ registry }) => {
9582 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).removeEditorPanel", {
9583 since: "6.5",
9584 alternative: "dispatch( 'core/editor').removeEditorPanel"
9585 });
9586 registry.dispatch(import_editor4.store).removeEditorPanel(panelName);
9587 };
9588 var toggleFeature = (feature) => ({ registry }) => registry.dispatch(import_preferences.store).toggle("core/edit-post", feature);
9589 var switchEditorMode = (mode) => ({ registry }) => {
9590 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).switchEditorMode", {
9591 since: "6.6",
9592 alternative: "dispatch( 'core/editor').switchEditorMode"
9593 });
9594 registry.dispatch(import_editor4.store).switchEditorMode(mode);
9595 };
9596 var togglePinnedPluginItem = (pluginName) => ({ registry }) => {
9597 const isPinned = registry.select(interfaceStore).isItemPinned("core", pluginName);
9598 registry.dispatch(interfaceStore)[isPinned ? "unpinItem" : "pinItem"]("core", pluginName);
9599 };
9600 function updatePreferredStyleVariations() {
9601 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).updatePreferredStyleVariations", {
9602 since: "6.6",
9603 hint: "Preferred Style Variations are not supported anymore."
9604 });
9605 return { type: "NOTHING" };
9606 }
9607 var showBlockTypes = (blockNames) => ({ registry }) => {
9608 unlock2(registry.dispatch(import_editor4.store)).showBlockTypes(blockNames);
9609 };
9610 var hideBlockTypes = (blockNames) => ({ registry }) => {
9611 unlock2(registry.dispatch(import_editor4.store)).hideBlockTypes(blockNames);
9612 };
9613 function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) {
9614 return {
9615 type: "SET_META_BOXES_PER_LOCATIONS",
9616 metaBoxesPerLocation
9617 };
9618 }
9619 var requestMetaBoxUpdates = () => async ({ registry, select: select3, dispatch: dispatch2 }) => {
9620 dispatch2({
9621 type: "REQUEST_META_BOX_UPDATES"
9622 });
9623 if (window.tinyMCE) {
9624 window.tinyMCE.triggerSave();
9625 }
9626 const baseFormData = new window.FormData(
9627 document.querySelector(".metabox-base-form")
9628 );
9629 const postId = baseFormData.get("post_ID");
9630 const postType = baseFormData.get("post_type");
9631 const post = registry.select(import_core_data3.store).getEditedEntityRecord("postType", postType, postId);
9632 const additionalData = [
9633 post.comment_status ? ["comment_status", post.comment_status] : false,
9634 post.ping_status ? ["ping_status", post.ping_status] : false,
9635 post.sticky ? ["sticky", post.sticky] : false,
9636 post.author ? ["post_author", post.author] : false
9637 ].filter(Boolean);
9638 const activeMetaBoxLocations = select3.getActiveMetaBoxLocations();
9639 const formDataToMerge = [
9640 baseFormData,
9641 ...activeMetaBoxLocations.map(
9642 (location) => new window.FormData(getMetaBoxContainer(location))
9643 )
9644 ];
9645 const formData = formDataToMerge.reduce((memo, currentFormData) => {
9646 for (const [key, value] of currentFormData) {
9647 memo.append(key, value);
9648 }
9649 return memo;
9650 }, new window.FormData());
9651 additionalData.forEach(
9652 ([key, value]) => formData.append(key, value)
9653 );
9654 try {
9655 await (0, import_api_fetch.default)({
9656 url: window._wpMetaBoxUrl,
9657 method: "POST",
9658 body: formData,
9659 parse: false
9660 });
9661 dispatch2.metaBoxUpdatesSuccess();
9662 } catch {
9663 dispatch2.metaBoxUpdatesFailure();
9664 }
9665 };
9666 function metaBoxUpdatesSuccess() {
9667 return {
9668 type: "META_BOX_UPDATES_SUCCESS"
9669 };
9670 }
9671 function metaBoxUpdatesFailure() {
9672 return {
9673 type: "META_BOX_UPDATES_FAILURE"
9674 };
9675 }
9676 var __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => {
9677 (0, import_deprecated.default)(
9678 "dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType",
9679 {
9680 since: "6.5",
9681 version: "6.7",
9682 hint: "registry.dispatch( editorStore ).setDeviceType"
9683 }
9684 );
9685 registry.dispatch(import_editor4.store).setDeviceType(deviceType);
9686 };
9687 var setIsInserterOpened = (value) => ({ registry }) => {
9688 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsInserterOpened", {
9689 since: "6.5",
9690 alternative: "dispatch( 'core/editor').setIsInserterOpened"
9691 });
9692 registry.dispatch(import_editor4.store).setIsInserterOpened(value);
9693 };
9694 var setIsListViewOpened = (isOpen) => ({ registry }) => {
9695 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsListViewOpened", {
9696 since: "6.5",
9697 alternative: "dispatch( 'core/editor').setIsListViewOpened"
9698 });
9699 registry.dispatch(import_editor4.store).setIsListViewOpened(isOpen);
9700 };
9701 function setIsEditingTemplate() {
9702 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsEditingTemplate", {
9703 since: "6.5",
9704 alternative: "dispatch( 'core/editor').setRenderingMode"
9705 });
9706 return { type: "NOTHING" };
9707 }
9708 function __unstableCreateTemplate() {
9709 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).__unstableCreateTemplate", {
9710 since: "6.5"
9711 });
9712 return { type: "NOTHING" };
9713 }
9714 var metaBoxesInitialized2 = false;
9715 var initializeMetaBoxes = () => ({ registry, select: select3, dispatch: dispatch2 }) => {
9716 const isEditorReady = registry.select(import_editor4.store).__unstableIsEditorReady();
9717 if (!isEditorReady) {
9718 return;
9719 }
9720 if (metaBoxesInitialized2) {
9721 return;
9722 }
9723 const postType = registry.select(import_editor4.store).getCurrentPostType();
9724 if (window.postboxes.page !== postType) {
9725 window.postboxes.add_postbox_toggles(postType);
9726 }
9727 metaBoxesInitialized2 = true;
9728 (0, import_hooks.addAction)(
9729 "editor.savePost",
9730 "core/edit-post/save-metaboxes",
9731 async (post, options) => {
9732 if (!options.isAutosave && select3.hasMetaBoxes()) {
9733 await dispatch2.requestMetaBoxUpdates();
9734 }
9735 }
9736 );
9737 dispatch2({
9738 type: "META_BOXES_INITIALIZED"
9739 });
9740 };
9741 var toggleDistractionFree = () => ({ registry }) => {
9742 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleDistractionFree", {
9743 since: "6.6",
9744 alternative: "dispatch( 'core/editor').toggleDistractionFree"
9745 });
9746 registry.dispatch(import_editor4.store).toggleDistractionFree();
9747 };
9748 var toggleFullscreenMode = () => ({ registry }) => {
9749 const isFullscreen = registry.select(import_preferences.store).get("core/edit-post", "fullscreenMode");
9750 registry.dispatch(import_preferences.store).toggle("core/edit-post", "fullscreenMode");
9751 registry.dispatch(import_notices.store).createInfoNotice(
9752 isFullscreen ? (0, import_i18n2.__)("Fullscreen mode deactivated.") : (0, import_i18n2.__)("Fullscreen mode activated."),
9753 {
9754 id: "core/edit-post/toggle-fullscreen-mode/notice",
9755 type: "snackbar",
9756 actions: [
9757 {
9758 label: (0, import_i18n2.__)("Undo"),
9759 onClick: () => {
9760 registry.dispatch(import_preferences.store).toggle(
9761 "core/edit-post",
9762 "fullscreenMode"
9763 );
9764 }
9765 }
9766 ]
9767 }
9768 );
9769 };
9770
9771 // packages/edit-post/build-module/store/selectors.mjs
9772 var selectors_exports = {};
9773 __export(selectors_exports, {
9774 __experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint,
9775 __experimentalGetPreviewDeviceType: () => __experimentalGetPreviewDeviceType,
9776 areMetaBoxesInitialized: () => areMetaBoxesInitialized,
9777 getActiveGeneralSidebarName: () => getActiveGeneralSidebarName,
9778 getActiveMetaBoxLocations: () => getActiveMetaBoxLocations,
9779 getAllMetaBoxes: () => getAllMetaBoxes,
9780 getEditedPostTemplate: () => getEditedPostTemplate,
9781 getEditorMode: () => getEditorMode,
9782 getHiddenBlockTypes: () => getHiddenBlockTypes,
9783 getMetaBoxesPerLocation: () => getMetaBoxesPerLocation,
9784 getPreference: () => getPreference,
9785 getPreferences: () => getPreferences,
9786 hasMetaBoxes: () => hasMetaBoxes,
9787 isEditingTemplate: () => isEditingTemplate,
9788 isEditorPanelEnabled: () => isEditorPanelEnabled,
9789 isEditorPanelOpened: () => isEditorPanelOpened,
9790 isEditorPanelRemoved: () => isEditorPanelRemoved,
9791 isEditorSidebarOpened: () => isEditorSidebarOpened,
9792 isFeatureActive: () => isFeatureActive,
9793 isInserterOpened: () => isInserterOpened,
9794 isListViewOpened: () => isListViewOpened,
9795 isMetaBoxLocationActive: () => isMetaBoxLocationActive,
9796 isMetaBoxLocationVisible: () => isMetaBoxLocationVisible,
9797 isModalActive: () => isModalActive,
9798 isPluginItemPinned: () => isPluginItemPinned,
9799 isPluginSidebarOpened: () => isPluginSidebarOpened,
9800 isPublishSidebarOpened: () => isPublishSidebarOpened,
9801 isSavingMetaBoxes: () => isSavingMetaBoxes2
9802 });
9803 var import_data5 = __toESM(require_data(), 1);
9804 var import_preferences2 = __toESM(require_preferences(), 1);
9805 var import_core_data4 = __toESM(require_core_data(), 1);
9806 var import_editor5 = __toESM(require_editor(), 1);
9807 var import_deprecated2 = __toESM(require_deprecated(), 1);
9808 var { interfaceStore: interfaceStore2 } = unlock2(import_editor5.privateApis);
9809 var EMPTY_ARRAY2 = [];
9810 var EMPTY_OBJECT2 = {};
9811 var getEditorMode = (0, import_data5.createRegistrySelector)(
9812 (select3) => () => select3(import_preferences2.store).get("core", "editorMode") ?? "visual"
9813 );
9814 var isEditorSidebarOpened = (0, import_data5.createRegistrySelector)(
9815 (select3) => () => {
9816 const activeGeneralSidebar = select3(interfaceStore2).getActiveComplementaryArea("core");
9817 return ["edit-post/document", "edit-post/block"].includes(
9818 activeGeneralSidebar
9819 );
9820 }
9821 );
9822 var isPluginSidebarOpened = (0, import_data5.createRegistrySelector)(
9823 (select3) => () => {
9824 const activeGeneralSidebar = select3(interfaceStore2).getActiveComplementaryArea("core");
9825 return !!activeGeneralSidebar && !["edit-post/document", "edit-post/block"].includes(
9826 activeGeneralSidebar
9827 );
9828 }
9829 );
9830 var getActiveGeneralSidebarName = (0, import_data5.createRegistrySelector)(
9831 (select3) => () => {
9832 return select3(interfaceStore2).getActiveComplementaryArea("core");
9833 }
9834 );
9835 function convertPanelsToOldFormat(inactivePanels, openPanels) {
9836 const panelsWithEnabledState = inactivePanels?.reduce(
9837 (accumulatedPanels, panelName) => ({
9838 ...accumulatedPanels,
9839 [panelName]: {
9840 enabled: false
9841 }
9842 }),
9843 {}
9844 );
9845 const panels = openPanels?.reduce((accumulatedPanels, panelName) => {
9846 const currentPanelState = accumulatedPanels?.[panelName];
9847 return {
9848 ...accumulatedPanels,
9849 [panelName]: {
9850 ...currentPanelState,
9851 opened: true
9852 }
9853 };
9854 }, panelsWithEnabledState ?? {});
9855 return panels ?? panelsWithEnabledState ?? EMPTY_OBJECT2;
9856 }
9857 var getPreferences = (0, import_data5.createRegistrySelector)((select3) => () => {
9858 (0, import_deprecated2.default)(`select( 'core/edit-post' ).getPreferences`, {
9859 since: "6.0",
9860 alternative: `select( 'core/preferences' ).get`
9861 });
9862 const corePreferences = ["editorMode", "hiddenBlockTypes"].reduce(
9863 (accumulatedPrefs, preferenceKey) => {
9864 const value = select3(import_preferences2.store).get(
9865 "core",
9866 preferenceKey
9867 );
9868 return {
9869 ...accumulatedPrefs,
9870 [preferenceKey]: value
9871 };
9872 },
9873 {}
9874 );
9875 const inactivePanels = select3(import_preferences2.store).get(
9876 "core",
9877 "inactivePanels"
9878 );
9879 const openPanels = select3(import_preferences2.store).get("core", "openPanels");
9880 const panels = convertPanelsToOldFormat(inactivePanels, openPanels);
9881 return {
9882 ...corePreferences,
9883 panels
9884 };
9885 });
9886 function getPreference(state, preferenceKey, defaultValue) {
9887 (0, import_deprecated2.default)(`select( 'core/edit-post' ).getPreference`, {
9888 since: "6.0",
9889 alternative: `select( 'core/preferences' ).get`
9890 });
9891 const preferences = getPreferences(state);
9892 const value = preferences[preferenceKey];
9893 return value === void 0 ? defaultValue : value;
9894 }
9895 var getHiddenBlockTypes = (0, import_data5.createRegistrySelector)((select3) => () => {
9896 return select3(import_preferences2.store).get("core", "hiddenBlockTypes") ?? EMPTY_ARRAY2;
9897 });
9898 var isPublishSidebarOpened = (0, import_data5.createRegistrySelector)(
9899 (select3) => () => {
9900 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isPublishSidebarOpened`, {
9901 since: "6.6",
9902 alternative: `select( 'core/editor' ).isPublishSidebarOpened`
9903 });
9904 return select3(import_editor5.store).isPublishSidebarOpened();
9905 }
9906 );
9907 var isEditorPanelRemoved = (0, import_data5.createRegistrySelector)(
9908 (select3) => (state, panelName) => {
9909 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelRemoved`, {
9910 since: "6.5",
9911 alternative: `select( 'core/editor' ).isEditorPanelRemoved`
9912 });
9913 return select3(import_editor5.store).isEditorPanelRemoved(panelName);
9914 }
9915 );
9916 var isEditorPanelEnabled = (0, import_data5.createRegistrySelector)(
9917 (select3) => (state, panelName) => {
9918 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelEnabled`, {
9919 since: "6.5",
9920 alternative: `select( 'core/editor' ).isEditorPanelEnabled`
9921 });
9922 return select3(import_editor5.store).isEditorPanelEnabled(panelName);
9923 }
9924 );
9925 var isEditorPanelOpened = (0, import_data5.createRegistrySelector)(
9926 (select3) => (state, panelName) => {
9927 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelOpened`, {
9928 since: "6.5",
9929 alternative: `select( 'core/editor' ).isEditorPanelOpened`
9930 });
9931 return select3(import_editor5.store).isEditorPanelOpened(panelName);
9932 }
9933 );
9934 var isModalActive = (0, import_data5.createRegistrySelector)(
9935 (select3) => (state, modalName) => {
9936 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isModalActive`, {
9937 since: "6.3",
9938 alternative: `select( 'core/interface' ).isModalActive`
9939 });
9940 return !!select3(interfaceStore2).isModalActive(modalName);
9941 }
9942 );
9943 var isFeatureActive = (0, import_data5.createRegistrySelector)(
9944 (select3) => (state, feature) => {
9945 return !!select3(import_preferences2.store).get("core/edit-post", feature);
9946 }
9947 );
9948 var isPluginItemPinned = (0, import_data5.createRegistrySelector)(
9949 (select3) => (state, pluginName) => {
9950 return select3(interfaceStore2).isItemPinned("core", pluginName);
9951 }
9952 );
9953 var getActiveMetaBoxLocations = (0, import_data5.createSelector)(
9954 (state) => {
9955 return Object.keys(state.metaBoxes.locations).filter(
9956 (location) => isMetaBoxLocationActive(state, location)
9957 );
9958 },
9959 (state) => [state.metaBoxes.locations]
9960 );
9961 var isMetaBoxLocationVisible = (0, import_data5.createRegistrySelector)(
9962 (select3) => (state, location) => {
9963 return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({ id }) => {
9964 return select3(import_editor5.store).isEditorPanelEnabled(
9965 `meta-box-${id}`
9966 );
9967 });
9968 }
9969 );
9970 function isMetaBoxLocationActive(state, location) {
9971 const metaBoxes2 = getMetaBoxesPerLocation(state, location);
9972 return !!metaBoxes2 && metaBoxes2.length !== 0;
9973 }
9974 function getMetaBoxesPerLocation(state, location) {
9975 return state.metaBoxes.locations[location];
9976 }
9977 var getAllMetaBoxes = (0, import_data5.createSelector)(
9978 (state) => {
9979 return Object.values(state.metaBoxes.locations).flat();
9980 },
9981 (state) => [state.metaBoxes.locations]
9982 );
9983 function hasMetaBoxes(state) {
9984 return getActiveMetaBoxLocations(state).length > 0;
9985 }
9986 function isSavingMetaBoxes2(state) {
9987 return state.metaBoxes.isSaving;
9988 }
9989 var __experimentalGetPreviewDeviceType = (0, import_data5.createRegistrySelector)(
9990 (select3) => () => {
9991 (0, import_deprecated2.default)(
9992 `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,
9993 {
9994 since: "6.5",
9995 version: "6.7",
9996 alternative: `select( 'core/editor' ).getDeviceType`
9997 }
9998 );
9999 return select3(import_editor5.store).getDeviceType();
10000 }
10001 );
10002 var isInserterOpened = (0, import_data5.createRegistrySelector)((select3) => () => {
10003 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isInserterOpened`, {
10004 since: "6.5",
10005 alternative: `select( 'core/editor' ).isInserterOpened`
10006 });
10007 return select3(import_editor5.store).isInserterOpened();
10008 });
10009 var __experimentalGetInsertionPoint = (0, import_data5.createRegistrySelector)(
10010 (select3) => () => {
10011 (0, import_deprecated2.default)(
10012 `select( 'core/edit-post' ).__experimentalGetInsertionPoint`,
10013 {
10014 since: "6.5",
10015 version: "6.7"
10016 }
10017 );
10018 return unlock2(select3(import_editor5.store)).getInserter();
10019 }
10020 );
10021 var isListViewOpened = (0, import_data5.createRegistrySelector)((select3) => () => {
10022 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isListViewOpened`, {
10023 since: "6.5",
10024 alternative: `select( 'core/editor' ).isListViewOpened`
10025 });
10026 return select3(import_editor5.store).isListViewOpened();
10027 });
10028 var isEditingTemplate = (0, import_data5.createRegistrySelector)((select3) => () => {
10029 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditingTemplate`, {
10030 since: "6.5",
10031 alternative: `select( 'core/editor' ).getRenderingMode`
10032 });
10033 return select3(import_editor5.store).getCurrentPostType() === "wp_template";
10034 });
10035 function areMetaBoxesInitialized(state) {
10036 return state.metaBoxes.initialized;
10037 }
10038 var getEditedPostTemplate = (0, import_data5.createRegistrySelector)(
10039 (select3) => () => {
10040 const { id: postId, type: postType } = select3(import_editor5.store).getCurrentPost();
10041 const templateId = unlock2(select3(import_core_data4.store)).getTemplateId(
10042 postType,
10043 postId
10044 );
10045 if (!templateId) {
10046 return void 0;
10047 }
10048 return select3(import_core_data4.store).getEditedEntityRecord(
10049 "postType",
10050 "wp_template",
10051 templateId
10052 );
10053 }
10054 );
10055
10056 // packages/edit-post/build-module/store/index.mjs
10057 var store = (0, import_data6.createReduxStore)(STORE_NAME, {
10058 reducer: reducer_default,
10059 actions: actions_exports,
10060 selectors: selectors_exports
10061 });
10062 (0, import_data6.register)(store);
10063
10064 // packages/edit-post/build-module/components/keyboard-shortcuts/index.mjs
10065 function KeyboardShortcuts() {
10066 const { toggleFullscreenMode: toggleFullscreenMode2 } = (0, import_data7.useDispatch)(store);
10067 const { registerShortcut } = (0, import_data7.useDispatch)(import_keyboard_shortcuts.store);
10068 (0, import_element16.useEffect)(() => {
10069 registerShortcut({
10070 name: "core/edit-post/toggle-fullscreen",
10071 category: "global",
10072 description: (0, import_i18n3.__)("Enable or disable fullscreen mode."),
10073 keyCombination: {
10074 modifier: "secondary",
10075 character: "f"
10076 }
10077 });
10078 }, []);
10079 (0, import_keyboard_shortcuts.useShortcut)("core/edit-post/toggle-fullscreen", () => {
10080 toggleFullscreenMode2();
10081 });
10082 return null;
10083 }
10084 var keyboard_shortcuts_default = KeyboardShortcuts;
10085
10086 // packages/edit-post/build-module/components/init-pattern-modal/index.mjs
10087 var import_data8 = __toESM(require_data(), 1);
10088 var import_i18n4 = __toESM(require_i18n(), 1);
10089 var import_components3 = __toESM(require_components(), 1);
10090 var import_element17 = __toESM(require_element(), 1);
10091 var import_editor6 = __toESM(require_editor(), 1);
10092 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
10093 function InitPatternModal() {
10094 const { editPost } = (0, import_data8.useDispatch)(import_editor6.store);
10095 const [syncType, setSyncType] = (0, import_element17.useState)(void 0);
10096 const [title, setTitle] = (0, import_element17.useState)("");
10097 const isNewPost = (0, import_data8.useSelect)(
10098 (select3) => select3(import_editor6.store).isCleanNewPost(),
10099 []
10100 );
10101 const [isModalOpen, setIsModalOpen] = (0, import_element17.useState)(() => isNewPost);
10102 if (!isNewPost) {
10103 return null;
10104 }
10105 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10106 import_components3.Modal,
10107 {
10108 title: (0, import_i18n4.__)("Create pattern"),
10109 onRequestClose: () => {
10110 setIsModalOpen(false);
10111 },
10112 overlayClassName: "reusable-blocks-menu-items__convert-modal",
10113 children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10114 "form",
10115 {
10116 onSubmit: (event) => {
10117 event.preventDefault();
10118 setIsModalOpen(false);
10119 editPost({
10120 title,
10121 meta: {
10122 wp_pattern_sync_status: syncType
10123 }
10124 });
10125 },
10126 children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_components3.__experimentalVStack, { spacing: "5", children: [
10127 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10128 import_components3.TextControl,
10129 {
10130 label: (0, import_i18n4.__)("Name"),
10131 value: title,
10132 onChange: setTitle,
10133 placeholder: (0, import_i18n4.__)("My pattern"),
10134 className: "patterns-create-modal__name-input",
10135 __next40pxDefaultSize: true
10136 }
10137 ),
10138 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10139 import_components3.ToggleControl,
10140 {
10141 label: (0, import_i18n4._x)("Synced", "pattern (singular)"),
10142 help: (0, import_i18n4.__)(
10143 "Sync this pattern across multiple locations."
10144 ),
10145 checked: !syncType,
10146 onChange: () => {
10147 setSyncType(
10148 !syncType ? "unsynced" : void 0
10149 );
10150 }
10151 }
10152 ),
10153 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components3.__experimentalHStack, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10154 import_components3.Button,
10155 {
10156 __next40pxDefaultSize: true,
10157 variant: "primary",
10158 type: "submit",
10159 disabled: !title,
10160 accessibleWhenDisabled: true,
10161 children: (0, import_i18n4.__)("Create")
10162 }
10163 ) })
10164 ] })
10165 }
10166 )
10167 }
10168 ) });
10169 }
10170
10171 // packages/edit-post/build-module/components/browser-url/index.mjs
10172 var import_element18 = __toESM(require_element(), 1);
10173 var import_data9 = __toESM(require_data(), 1);
10174 var import_url2 = __toESM(require_url(), 1);
10175 var import_editor7 = __toESM(require_editor(), 1);
10176 function getPostEditURL(postId) {
10177 return (0, import_url2.addQueryArgs)("post.php", { post: postId, action: "edit" });
10178 }
10179 function BrowserURL() {
10180 const [historyId, setHistoryId] = (0, import_element18.useState)(null);
10181 const { postId, postStatus } = (0, import_data9.useSelect)((select3) => {
10182 const { getCurrentPost } = select3(import_editor7.store);
10183 const post = getCurrentPost();
10184 let { id, status, type } = post;
10185 const isTemplate = ["wp_template", "wp_template_part"].includes(
10186 type
10187 );
10188 if (isTemplate) {
10189 id = post.wp_id;
10190 }
10191 return {
10192 postId: id,
10193 postStatus: status
10194 };
10195 }, []);
10196 (0, import_element18.useEffect)(() => {
10197 if (postId && postId !== historyId && postStatus !== "auto-draft") {
10198 window.history.replaceState(
10199 { id: postId },
10200 "Post " + postId,
10201 getPostEditURL(postId)
10202 );
10203 setHistoryId(postId);
10204 }
10205 }, [postId, postStatus, historyId]);
10206 return null;
10207 }
10208
10209 // packages/edit-post/build-module/components/meta-boxes/index.mjs
10210 var import_data12 = __toESM(require_data(), 1);
10211
10212 // packages/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.mjs
10213 var import_element19 = __toESM(require_element(), 1);
10214 var import_components4 = __toESM(require_components(), 1);
10215 var import_data10 = __toESM(require_data(), 1);
10216 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
10217 function MetaBoxesArea({ location }) {
10218 const container = (0, import_element19.useRef)(null);
10219 const formRef = (0, import_element19.useRef)(null);
10220 (0, import_element19.useEffect)(() => {
10221 formRef.current = document.querySelector(
10222 ".metabox-location-" + location
10223 );
10224 if (formRef.current) {
10225 container.current.appendChild(formRef.current);
10226 }
10227 return () => {
10228 if (formRef.current) {
10229 document.querySelector("#metaboxes").appendChild(formRef.current);
10230 }
10231 };
10232 }, [location]);
10233 const isSaving = (0, import_data10.useSelect)((select3) => {
10234 return select3(store).isSavingMetaBoxes();
10235 }, []);
10236 const classes = clsx_default("edit-post-meta-boxes-area", `is-${location}`, {
10237 "is-loading": isSaving
10238 });
10239 return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: classes, children: [
10240 isSaving && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components4.Spinner, { className: "edit-post-meta-boxes-area__spinner" }),
10241 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10242 "div",
10243 {
10244 className: "edit-post-meta-boxes-area__container",
10245 ref: container
10246 }
10247 ),
10248 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "edit-post-meta-boxes-area__clear" })
10249 ] });
10250 }
10251 var meta_boxes_area_default = MetaBoxesArea;
10252
10253 // packages/edit-post/build-module/components/meta-boxes/meta-box-visibility.mjs
10254 var import_element20 = __toESM(require_element(), 1);
10255 var import_data11 = __toESM(require_data(), 1);
10256 var import_editor8 = __toESM(require_editor(), 1);
10257 function MetaBoxVisibility({ id }) {
10258 const isVisible = (0, import_data11.useSelect)(
10259 (select3) => {
10260 return select3(import_editor8.store).isEditorPanelEnabled(
10261 `meta-box-${id}`
10262 );
10263 },
10264 [id]
10265 );
10266 (0, import_element20.useEffect)(() => {
10267 const element = document.getElementById(id);
10268 if (!element) {
10269 return;
10270 }
10271 if (isVisible) {
10272 element.classList.remove("is-hidden");
10273 } else {
10274 element.classList.add("is-hidden");
10275 }
10276 }, [id, isVisible]);
10277 return null;
10278 }
10279
10280 // packages/edit-post/build-module/components/meta-boxes/index.mjs
10281 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
10282 function MetaBoxes({ location }) {
10283 const metaBoxes2 = (0, import_data12.useSelect)(
10284 (select3) => select3(store).getMetaBoxesPerLocation(location),
10285 [location]
10286 );
10287 return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
10288 (metaBoxes2 ?? []).map(({ id }) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MetaBoxVisibility, { id }, id)),
10289 /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(meta_boxes_area_default, { location })
10290 ] });
10291 }
10292
10293 // packages/edit-post/build-module/components/more-menu/index.mjs
10294 var import_i18n10 = __toESM(require_i18n(), 1);
10295 var import_compose2 = __toESM(require_compose(), 1);
10296 var import_editor14 = __toESM(require_editor(), 1);
10297 var import_keycodes = __toESM(require_keycodes(), 1);
10298 var import_preferences8 = __toESM(require_preferences(), 1);
10299
10300 // packages/edit-post/build-module/components/more-menu/manage-patterns-menu-item.mjs
10301 var import_components5 = __toESM(require_components(), 1);
10302 var import_core_data5 = __toESM(require_core_data(), 1);
10303 var import_data13 = __toESM(require_data(), 1);
10304 var import_i18n5 = __toESM(require_i18n(), 1);
10305 var import_url3 = __toESM(require_url(), 1);
10306 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
10307 function ManagePatternsMenuItem() {
10308 const url = (0, import_data13.useSelect)((select3) => {
10309 const { canUser } = select3(import_core_data5.store);
10310 const defaultUrl = (0, import_url3.addQueryArgs)("edit.php", {
10311 post_type: "wp_block"
10312 });
10313 const patternsUrl = (0, import_url3.addQueryArgs)("site-editor.php", {
10314 p: "/pattern"
10315 });
10316 return canUser("create", {
10317 kind: "postType",
10318 name: "wp_template"
10319 }) ? patternsUrl : defaultUrl;
10320 }, []);
10321 return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components5.MenuItem, { role: "menuitem", href: url, children: (0, import_i18n5.__)("Manage patterns") });
10322 }
10323 var manage_patterns_menu_item_default = ManagePatternsMenuItem;
10324
10325 // packages/edit-post/build-module/components/more-menu/welcome-guide-menu-item.mjs
10326 var import_data14 = __toESM(require_data(), 1);
10327 var import_preferences3 = __toESM(require_preferences(), 1);
10328 var import_i18n6 = __toESM(require_i18n(), 1);
10329 var import_editor9 = __toESM(require_editor(), 1);
10330 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
10331 function WelcomeGuideMenuItem() {
10332 const isEditingTemplate2 = (0, import_data14.useSelect)(
10333 (select3) => select3(import_editor9.store).getCurrentPostType() === "wp_template",
10334 []
10335 );
10336 return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
10337 import_preferences3.PreferenceToggleMenuItem,
10338 {
10339 scope: "core/edit-post",
10340 name: isEditingTemplate2 ? "welcomeGuideTemplate" : "welcomeGuide",
10341 label: (0, import_i18n6.__)("Welcome Guide")
10342 }
10343 );
10344 }
10345
10346 // packages/edit-post/build-module/components/preferences-modal/index.mjs
10347 var import_i18n9 = __toESM(require_i18n(), 1);
10348 var import_preferences7 = __toESM(require_preferences(), 1);
10349 var import_editor13 = __toESM(require_editor(), 1);
10350
10351 // packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.mjs
10352 var import_i18n8 = __toESM(require_i18n(), 1);
10353 var import_data17 = __toESM(require_data(), 1);
10354 var import_editor12 = __toESM(require_editor(), 1);
10355 var import_preferences6 = __toESM(require_preferences(), 1);
10356
10357 // packages/edit-post/build-module/components/preferences-modal/enable-custom-fields.mjs
10358 var import_element21 = __toESM(require_element(), 1);
10359 var import_i18n7 = __toESM(require_i18n(), 1);
10360 var import_components6 = __toESM(require_components(), 1);
10361 var import_data15 = __toESM(require_data(), 1);
10362 var import_editor10 = __toESM(require_editor(), 1);
10363 var import_preferences4 = __toESM(require_preferences(), 1);
10364 var import_url4 = __toESM(require_url(), 1);
10365 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
10366 var { PreferenceBaseOption } = unlock2(import_preferences4.privateApis);
10367 function submitCustomFieldsForm() {
10368 const customFieldsForm = document.getElementById(
10369 "toggle-custom-fields-form"
10370 );
10371 customFieldsForm.querySelector('[name="_wp_http_referer"]').setAttribute("value", (0, import_url4.getPathAndQueryString)(window.location.href));
10372 customFieldsForm.submit();
10373 }
10374 function CustomFieldsConfirmation({ willEnable }) {
10375 const [isReloading, setIsReloading] = (0, import_element21.useState)(false);
10376 return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
10377 /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "edit-post-preferences-modal__custom-fields-confirmation-message", children: (0, import_i18n7.__)(
10378 "A page reload is required for this change. Make sure your content is saved before reloading."
10379 ) }),
10380 /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
10381 import_components6.Button,
10382 {
10383 __next40pxDefaultSize: true,
10384 variant: "secondary",
10385 isBusy: isReloading,
10386 accessibleWhenDisabled: true,
10387 disabled: isReloading,
10388 onClick: () => {
10389 setIsReloading(true);
10390 submitCustomFieldsForm();
10391 },
10392 children: willEnable ? (0, import_i18n7.__)("Show & Reload Page") : (0, import_i18n7.__)("Hide & Reload Page")
10393 }
10394 )
10395 ] });
10396 }
10397 function EnableCustomFieldsOption({ label }) {
10398 const areCustomFieldsEnabled = (0, import_data15.useSelect)((select3) => {
10399 return !!select3(import_editor10.store).getEditorSettings().enableCustomFields;
10400 }, []);
10401 const [isChecked, setIsChecked] = (0, import_element21.useState)(areCustomFieldsEnabled);
10402 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
10403 PreferenceBaseOption,
10404 {
10405 label,
10406 isChecked,
10407 onChange: setIsChecked,
10408 children: isChecked !== areCustomFieldsEnabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomFieldsConfirmation, { willEnable: isChecked })
10409 }
10410 );
10411 }
10412
10413 // packages/edit-post/build-module/components/preferences-modal/enable-panel.mjs
10414 var import_data16 = __toESM(require_data(), 1);
10415 var import_editor11 = __toESM(require_editor(), 1);
10416 var import_preferences5 = __toESM(require_preferences(), 1);
10417 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
10418 var { PreferenceBaseOption: PreferenceBaseOption2 } = unlock2(import_preferences5.privateApis);
10419 function EnablePanelOption(props) {
10420 const { toggleEditorPanelEnabled: toggleEditorPanelEnabled2 } = (0, import_data16.useDispatch)(import_editor11.store);
10421 const { isChecked, isRemoved } = (0, import_data16.useSelect)(
10422 (select3) => {
10423 const { isEditorPanelEnabled: isEditorPanelEnabled2, isEditorPanelRemoved: isEditorPanelRemoved2 } = select3(import_editor11.store);
10424 return {
10425 isChecked: isEditorPanelEnabled2(props.panelName),
10426 isRemoved: isEditorPanelRemoved2(props.panelName)
10427 };
10428 },
10429 [props.panelName]
10430 );
10431 if (isRemoved) {
10432 return null;
10433 }
10434 return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10435 PreferenceBaseOption2,
10436 {
10437 isChecked,
10438 onChange: () => toggleEditorPanelEnabled2(props.panelName),
10439 ...props
10440 }
10441 );
10442 }
10443
10444 // packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.mjs
10445 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
10446 var { PreferencesModalSection } = unlock2(import_preferences6.privateApis);
10447 function MetaBoxesSection({
10448 areCustomFieldsRegistered,
10449 metaBoxes: metaBoxes2,
10450 ...sectionProps
10451 }) {
10452 const thirdPartyMetaBoxes = metaBoxes2.filter(
10453 ({ id }) => id !== "postcustom"
10454 );
10455 if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) {
10456 return null;
10457 }
10458 return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(PreferencesModalSection, { ...sectionProps, children: [
10459 areCustomFieldsRegistered && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(EnableCustomFieldsOption, { label: (0, import_i18n8.__)("Custom fields") }),
10460 thirdPartyMetaBoxes.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
10461 EnablePanelOption,
10462 {
10463 label: title,
10464 panelName: `meta-box-${id}`
10465 },
10466 id
10467 ))
10468 ] });
10469 }
10470 var meta_boxes_section_default = (0, import_data17.withSelect)((select3) => {
10471 const { getEditorSettings } = select3(import_editor12.store);
10472 const { getAllMetaBoxes: getAllMetaBoxes2 } = select3(store);
10473 return {
10474 // This setting should not live in the block editor's store.
10475 areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== void 0,
10476 metaBoxes: getAllMetaBoxes2()
10477 };
10478 })(MetaBoxesSection);
10479
10480 // packages/edit-post/build-module/components/preferences-modal/index.mjs
10481 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
10482 var { PreferenceToggleControl } = unlock2(import_preferences7.privateApis);
10483 var { PreferencesModal } = unlock2(import_editor13.privateApis);
10484 function EditPostPreferencesModal() {
10485 const extraSections = {
10486 general: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(meta_boxes_section_default, { title: (0, import_i18n9.__)("Advanced") }),
10487 appearance: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10488 PreferenceToggleControl,
10489 {
10490 scope: "core/edit-post",
10491 featureName: "themeStyles",
10492 help: (0, import_i18n9.__)("Make the editor look like your theme."),
10493 label: (0, import_i18n9.__)("Use theme styles")
10494 }
10495 )
10496 };
10497 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PreferencesModal, { extraSections });
10498 }
10499
10500 // packages/edit-post/build-module/components/more-menu/index.mjs
10501 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
10502 var { ToolsMoreMenuGroup, ViewMoreMenuGroup } = unlock2(import_editor14.privateApis);
10503 var MoreMenu = () => {
10504 const isLargeViewport = (0, import_compose2.useViewportMatch)("large");
10505 return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
10506 isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ViewMoreMenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
10507 import_preferences8.PreferenceToggleMenuItem,
10508 {
10509 scope: "core/edit-post",
10510 name: "fullscreenMode",
10511 label: (0, import_i18n10.__)("Fullscreen mode"),
10512 info: (0, import_i18n10.__)("Show and hide the admin user interface"),
10513 messageActivated: (0, import_i18n10.__)("Fullscreen mode activated."),
10514 messageDeactivated: (0, import_i18n10.__)(
10515 "Fullscreen mode deactivated."
10516 ),
10517 shortcut: import_keycodes.displayShortcut.secondary("f")
10518 }
10519 ) }),
10520 /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(ToolsMoreMenuGroup, { children: [
10521 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(manage_patterns_menu_item_default, {}),
10522 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(WelcomeGuideMenuItem, {})
10523 ] }),
10524 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(EditPostPreferencesModal, {})
10525 ] });
10526 };
10527 var more_menu_default = MoreMenu;
10528
10529 // packages/edit-post/build-module/components/welcome-guide/index.mjs
10530 var import_data20 = __toESM(require_data(), 1);
10531
10532 // packages/edit-post/build-module/components/welcome-guide/default.mjs
10533 var import_data18 = __toESM(require_data(), 1);
10534 var import_components7 = __toESM(require_components(), 1);
10535 var import_i18n11 = __toESM(require_i18n(), 1);
10536 var import_element22 = __toESM(require_element(), 1);
10537
10538 // packages/edit-post/build-module/components/welcome-guide/image.mjs
10539 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
10540 function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) {
10541 return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("picture", { className: "edit-post-welcome-guide__image", children: [
10542 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
10543 "source",
10544 {
10545 srcSet: nonAnimatedSrc,
10546 media: "(prefers-reduced-motion: reduce)"
10547 }
10548 ),
10549 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" })
10550 ] });
10551 }
10552
10553 // packages/edit-post/build-module/components/welcome-guide/default.mjs
10554 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
10555 function WelcomeGuideDefault() {
10556 const { toggleFeature: toggleFeature2 } = (0, import_data18.useDispatch)(store);
10557 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
10558 import_components7.Guide,
10559 {
10560 className: "edit-post-welcome-guide",
10561 contentLabel: (0, import_i18n11.__)("Welcome to the editor"),
10562 finishButtonText: (0, import_i18n11.__)("Get started"),
10563 onFinish: () => toggleFeature2("welcomeGuide"),
10564 pages: [
10565 {
10566 image: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
10567 WelcomeGuideImage,
10568 {
10569 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
10570 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
10571 }
10572 ),
10573 content: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
10574 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Welcome to the editor") }),
10575 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n11.__)(
10576 "In the WordPress editor, each paragraph, image, or video is presented as a distinct \u201Cblock\u201D of content."
10577 ) })
10578 ] })
10579 },
10580 {
10581 image: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
10582 WelcomeGuideImage,
10583 {
10584 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
10585 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
10586 }
10587 ),
10588 content: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
10589 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Customize each block") }),
10590 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n11.__)(
10591 "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."
10592 ) })
10593 ] })
10594 },
10595 {
10596 image: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
10597 WelcomeGuideImage,
10598 {
10599 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
10600 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
10601 }
10602 ),
10603 content: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
10604 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Explore all blocks") }),
10605 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element22.createInterpolateElement)(
10606 (0, import_i18n11.__)(
10607 "All of the blocks available to you live in the block library. You\u2019ll find it wherever you see the <InserterIconImage /> icon."
10608 ),
10609 {
10610 InserterIconImage: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
10611 "img",
10612 {
10613 alt: (0, import_i18n11.__)("inserter"),
10614 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"
10615 }
10616 )
10617 }
10618 ) })
10619 ] })
10620 },
10621 {
10622 image: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
10623 WelcomeGuideImage,
10624 {
10625 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
10626 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
10627 }
10628 ),
10629 content: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
10630 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Learn more") }),
10631 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element22.createInterpolateElement)(
10632 (0, import_i18n11.__)(
10633 "New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>"
10634 ),
10635 {
10636 a: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
10637 import_components7.ExternalLink,
10638 {
10639 href: (0, import_i18n11.__)(
10640 "https://wordpress.org/documentation/article/wordpress-block-editor/"
10641 )
10642 }
10643 )
10644 }
10645 ) })
10646 ] })
10647 }
10648 ]
10649 }
10650 );
10651 }
10652
10653 // packages/edit-post/build-module/components/welcome-guide/template.mjs
10654 var import_data19 = __toESM(require_data(), 1);
10655 var import_components8 = __toESM(require_components(), 1);
10656 var import_i18n12 = __toESM(require_i18n(), 1);
10657 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
10658 function WelcomeGuideTemplate() {
10659 const { toggleFeature: toggleFeature2 } = (0, import_data19.useDispatch)(store);
10660 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
10661 import_components8.Guide,
10662 {
10663 className: "edit-template-welcome-guide",
10664 contentLabel: (0, import_i18n12.__)("Welcome to the template editor"),
10665 finishButtonText: (0, import_i18n12.__)("Get started"),
10666 onFinish: () => toggleFeature2("welcomeGuideTemplate"),
10667 pages: [
10668 {
10669 image: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
10670 WelcomeGuideImage,
10671 {
10672 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg",
10673 animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif"
10674 }
10675 ),
10676 content: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
10677 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n12.__)("Welcome to the template editor") }),
10678 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n12.__)(
10679 "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."
10680 ) })
10681 ] })
10682 }
10683 ]
10684 }
10685 );
10686 }
10687
10688 // packages/edit-post/build-module/components/welcome-guide/index.mjs
10689 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
10690 function WelcomeGuide({ postType }) {
10691 const { isActive, isEditingTemplate: isEditingTemplate2 } = (0, import_data20.useSelect)(
10692 (select3) => {
10693 const { isFeatureActive: isFeatureActive2 } = select3(store);
10694 const _isEditingTemplate = postType === "wp_template";
10695 const feature = _isEditingTemplate ? "welcomeGuideTemplate" : "welcomeGuide";
10696 return {
10697 isActive: isFeatureActive2(feature),
10698 isEditingTemplate: _isEditingTemplate
10699 };
10700 },
10701 [postType]
10702 );
10703 if (!isActive) {
10704 return null;
10705 }
10706 return isEditingTemplate2 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(WelcomeGuideTemplate, {}) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(WelcomeGuideDefault, {});
10707 }
10708
10709 // packages/edit-post/build-module/commands/use-commands.mjs
10710 var import_data21 = __toESM(require_data(), 1);
10711 var import_i18n13 = __toESM(require_i18n(), 1);
10712 var import_commands = __toESM(require_commands(), 1);
10713 var import_preferences9 = __toESM(require_preferences(), 1);
10714 var import_notices2 = __toESM(require_notices(), 1);
10715 function useCommands() {
10716 const { isFullscreen } = (0, import_data21.useSelect)((select3) => {
10717 const { get } = select3(import_preferences9.store);
10718 return {
10719 isFullscreen: get("core/edit-post", "fullscreenMode")
10720 };
10721 }, []);
10722 const { toggle } = (0, import_data21.useDispatch)(import_preferences9.store);
10723 const { createInfoNotice } = (0, import_data21.useDispatch)(import_notices2.store);
10724 (0, import_commands.useCommand)({
10725 name: "core/toggle-fullscreen-mode",
10726 label: isFullscreen ? (0, import_i18n13.__)("Exit fullscreen") : (0, import_i18n13.__)("Enter fullscreen"),
10727 icon: fullscreen_default,
10728 category: "command",
10729 callback: ({ close }) => {
10730 toggle("core/edit-post", "fullscreenMode");
10731 close();
10732 createInfoNotice(
10733 isFullscreen ? (0, import_i18n13.__)("Fullscreen off.") : (0, import_i18n13.__)("Fullscreen on."),
10734 {
10735 id: "core/edit-post/toggle-fullscreen-mode/notice",
10736 type: "snackbar",
10737 actions: [
10738 {
10739 label: (0, import_i18n13.__)("Undo"),
10740 onClick: () => {
10741 toggle("core/edit-post", "fullscreenMode");
10742 }
10743 }
10744 ]
10745 }
10746 );
10747 }
10748 });
10749 }
10750
10751 // packages/edit-post/build-module/components/layout/use-should-iframe.mjs
10752 var import_editor15 = __toESM(require_editor(), 1);
10753 var import_data22 = __toESM(require_data(), 1);
10754 var import_blocks2 = __toESM(require_blocks(), 1);
10755 var import_block_editor = __toESM(require_block_editor(), 1);
10756 var isGutenbergPlugin = true ? true : false;
10757 function useShouldIframe() {
10758 return (0, import_data22.useSelect)((select3) => {
10759 const { getCurrentPostType, getDeviceType } = select3(import_editor15.store);
10760 const { getClientIdsWithDescendants, getBlockName } = select3(import_block_editor.store);
10761 const { getBlockType } = select3(import_blocks2.store);
10762 return (
10763 // If the Gutenberg plugin is active, we ALWAYS use the iframe for
10764 // consistency across the post and site editor. We plan on enforcing
10765 // the iframe in the future, so Gutenberg both serves as way for us
10766 // to warn plugin developers and for plugin developers to test their
10767 // blocks easily. Before GB v22.5, we only enforced it for
10768 // block-based themes (classic themes used the same rules as core).
10769 isGutenbergPlugin || // We also still want to iframe all the special
10770 // editor features and modes such as device previews, zoom out, and
10771 // template/pattern editing.
10772 getDeviceType() !== "Desktop" || ["wp_template", "wp_block"].includes(getCurrentPostType()) || unlock2(select3(import_block_editor.store)).isZoomOut() || // Finally, still iframe the editor if all present blocks are v3
10773 // (which means they are marked as iframe-compatible).
10774 [...new Set(getClientIdsWithDescendants().map(getBlockName))].map(getBlockType).filter(Boolean).every((blockType) => blockType.apiVersion >= 3)
10775 );
10776 }, []);
10777 }
10778
10779 // packages/edit-post/build-module/hooks/use-navigate-to-entity-record.mjs
10780 var import_element23 = __toESM(require_element(), 1);
10781 var import_data23 = __toESM(require_data(), 1);
10782 var import_editor16 = __toESM(require_editor(), 1);
10783 var import_core_data6 = __toESM(require_core_data(), 1);
10784 function useNavigateToEntityRecord(initialPostId, initialPostType, defaultRenderingMode) {
10785 const registry = (0, import_data23.useRegistry)();
10786 const [postHistory, dispatch2] = (0, import_element23.useReducer)(
10787 (historyState, { type, post: post2, previousRenderingMode: previousRenderingMode2, selectedBlockClientId }) => {
10788 if (type === "push") {
10789 const updatedHistory = [...historyState];
10790 const currentIndex = updatedHistory.length - 1;
10791 updatedHistory[currentIndex] = {
10792 ...updatedHistory[currentIndex],
10793 selectedBlockClientId
10794 };
10795 return [...updatedHistory, { post: post2, previousRenderingMode: previousRenderingMode2 }];
10796 }
10797 if (type === "pop") {
10798 if (historyState.length > 1) {
10799 return historyState.slice(0, -1);
10800 }
10801 }
10802 return historyState;
10803 },
10804 [
10805 {
10806 post: { postId: initialPostId, postType: initialPostType }
10807 }
10808 ]
10809 );
10810 const { post, previousRenderingMode } = postHistory[postHistory.length - 1];
10811 const { getRenderingMode } = (0, import_data23.useSelect)(import_editor16.store);
10812 const { setRenderingMode } = (0, import_data23.useDispatch)(import_editor16.store);
10813 const { editEntityRecord } = (0, import_data23.useDispatch)(import_core_data6.store);
10814 const onNavigateToEntityRecord = (0, import_element23.useCallback)(
10815 (params) => {
10816 const entityEdits = registry.select(import_core_data6.store).getEntityRecordEdits("postType", post.postType, post.postId);
10817 const externalClientId = entityEdits?.selection?.selectionStart?.clientId ?? null;
10818 dispatch2({
10819 type: "push",
10820 post: { postId: params.postId, postType: params.postType },
10821 // Save the current rendering mode so we can restore it when navigating back.
10822 previousRenderingMode: getRenderingMode(),
10823 selectedBlockClientId: externalClientId
10824 });
10825 setRenderingMode(defaultRenderingMode);
10826 },
10827 [
10828 registry,
10829 post.postType,
10830 post.postId,
10831 getRenderingMode,
10832 setRenderingMode,
10833 defaultRenderingMode
10834 ]
10835 );
10836 const onNavigateToPreviousEntityRecord = (0, import_element23.useCallback)(() => {
10837 if (postHistory.length > 1) {
10838 const previousItem = postHistory[postHistory.length - 2];
10839 if (previousItem.selectedBlockClientId) {
10840 editEntityRecord(
10841 "postType",
10842 previousItem.post.postType,
10843 previousItem.post.postId,
10844 {
10845 selection: {
10846 selectionStart: {
10847 clientId: previousItem.selectedBlockClientId
10848 },
10849 selectionEnd: {
10850 clientId: previousItem.selectedBlockClientId
10851 }
10852 }
10853 },
10854 { undoIgnore: true }
10855 );
10856 }
10857 }
10858 dispatch2({
10859 type: "pop"
10860 });
10861 if (previousRenderingMode) {
10862 setRenderingMode(previousRenderingMode);
10863 }
10864 }, [
10865 setRenderingMode,
10866 previousRenderingMode,
10867 postHistory,
10868 editEntityRecord
10869 ]);
10870 return {
10871 currentPost: post,
10872 onNavigateToEntityRecord,
10873 onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : void 0
10874 };
10875 }
10876
10877 // packages/edit-post/build-module/components/meta-boxes/use-meta-box-initialization.mjs
10878 var import_data24 = __toESM(require_data(), 1);
10879 var import_editor17 = __toESM(require_editor(), 1);
10880 var import_core_data7 = __toESM(require_core_data(), 1);
10881 var import_element24 = __toESM(require_element(), 1);
10882 var useMetaBoxInitialization = (enabled) => {
10883 const {
10884 isEnabledAndEditorReady,
10885 isCollaborationEnabled,
10886 hasIncompatibleMetaBoxes,
10887 hasActiveMetaBoxes
10888 } = (0, import_data24.useSelect)(
10889 (select3) => {
10890 const {
10891 __unstableIsEditorReady,
10892 isCollaborationEnabledForCurrentPost
10893 } = unlock2(select3(import_editor17.store));
10894 return {
10895 isEnabledAndEditorReady: enabled && __unstableIsEditorReady(),
10896 isCollaborationEnabled: isCollaborationEnabledForCurrentPost(),
10897 hasIncompatibleMetaBoxes: enabled ? select3(store).getAllMetaBoxes().some((metaBox) => !metaBox.__rtc_compatible) : false,
10898 hasActiveMetaBoxes: enabled && select3(store).hasMetaBoxes()
10899 };
10900 },
10901 [enabled]
10902 );
10903 const { setCollaborationSupported } = unlock2((0, import_data24.useDispatch)(import_core_data7.store));
10904 const { updateEditorSettings } = (0, import_data24.useDispatch)(import_editor17.store);
10905 const { initializeMetaBoxes: initializeMetaBoxes2 } = (0, import_data24.useDispatch)(store);
10906 (0, import_element24.useEffect)(() => {
10907 if (isEnabledAndEditorReady) {
10908 initializeMetaBoxes2();
10909 if (isCollaborationEnabled && hasIncompatibleMetaBoxes) {
10910 setCollaborationSupported(false);
10911 }
10912 if (hasActiveMetaBoxes) {
10913 updateEditorSettings({ disableVisualRevisions: true });
10914 }
10915 }
10916 }, [
10917 isEnabledAndEditorReady,
10918 initializeMetaBoxes2,
10919 isCollaborationEnabled,
10920 setCollaborationSupported,
10921 hasIncompatibleMetaBoxes,
10922 hasActiveMetaBoxes,
10923 updateEditorSettings
10924 ]);
10925 };
10926
10927 // packages/edit-post/build-module/components/layout/index.mjs
10928 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
10929 var { useCommandContext } = unlock2(import_commands2.privateApis);
10930 var { useDrag } = unlock2(import_components9.privateApis);
10931 var { Editor, FullscreenMode } = unlock2(import_editor18.privateApis);
10932 var { BlockKeyboardShortcuts } = unlock2(import_block_library.privateApis);
10933 var DESIGN_POST_TYPES = [
10934 "wp_template",
10935 "wp_template_part",
10936 "wp_block",
10937 "wp_navigation"
10938 ];
10939 function useEditorStyles(settings) {
10940 const { hasThemeStyleSupport } = (0, import_data25.useSelect)((select3) => {
10941 return {
10942 hasThemeStyleSupport: select3(store).isFeatureActive("themeStyles")
10943 };
10944 }, []);
10945 return (0, import_element25.useMemo)(() => {
10946 const presetStyles = settings.styles?.filter(
10947 (style) => style.__unstableType && style.__unstableType !== "theme"
10948 ) ?? [];
10949 const defaultEditorStyles = [
10950 ...settings?.defaultEditorStyles ?? [],
10951 ...presetStyles
10952 ];
10953 const hasThemeStyles = hasThemeStyleSupport && presetStyles.length !== (settings.styles?.length ?? 0);
10954 if (!settings.disableLayoutStyles && !hasThemeStyles) {
10955 defaultEditorStyles.push({
10956 css: getLayoutStyles({
10957 style: {},
10958 selector: "body",
10959 hasBlockGapSupport: false,
10960 hasFallbackGapSupport: true,
10961 fallbackGapValue: "0.5em"
10962 })
10963 });
10964 }
10965 return hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles;
10966 }, [
10967 settings.defaultEditorStyles,
10968 settings.disableLayoutStyles,
10969 settings.styles,
10970 hasThemeStyleSupport
10971 ]);
10972 }
10973 function MetaBoxesMain({ isLegacy }) {
10974 const [isOpen, openHeight, hasAnyVisible] = (0, import_data25.useSelect)((select3) => {
10975 const { get } = select3(import_preferences10.store);
10976 const { isMetaBoxLocationVisible: isMetaBoxLocationVisible2 } = select3(store);
10977 return [
10978 !!get("core/edit-post", "metaBoxesMainIsOpen"),
10979 get("core/edit-post", "metaBoxesMainOpenHeight"),
10980 isMetaBoxLocationVisible2("normal") || isMetaBoxLocationVisible2("advanced") || isMetaBoxLocationVisible2("side")
10981 ];
10982 }, []);
10983 const { set: setPreference } = (0, import_data25.useDispatch)(import_preferences10.store);
10984 const isShort = (0, import_compose3.useMediaQuery)("(max-height: 549px)");
10985 const [{ min: min2 = 0, max: max2 }, setHeightConstraints] = (0, import_element25.useState)(() => ({}));
10986 const effectSizeConstraints = (0, import_compose3.useRefEffect)((node) => {
10987 const container = node.closest(
10988 ".interface-interface-skeleton__content"
10989 );
10990 if (!container) {
10991 return;
10992 }
10993 const noticeContainer = container.querySelector(
10994 ":scope > .notices-inline-notices-wrapper"
10995 );
10996 const resizeHandle = container.querySelector(
10997 ".edit-post-meta-boxes-main__presenter"
10998 );
10999 const deriveConstraints = () => {
11000 const fullHeight = container.offsetHeight;
11001 let nextMax = fullHeight;
11002 if (noticeContainer) {
11003 nextMax -= noticeContainer.offsetHeight;
11004 }
11005 const nextMin = resizeHandle?.offsetHeight ?? 0;
11006 setHeightConstraints({ min: nextMin, max: nextMax });
11007 };
11008 const observer = new window.ResizeObserver(deriveConstraints);
11009 observer.observe(container);
11010 if (noticeContainer) {
11011 observer.observe(noticeContainer);
11012 }
11013 return () => observer.disconnect();
11014 }, []);
11015 const metaBoxesMainRef = (0, import_element25.useRef)();
11016 const setMainRefs = (0, import_compose3.useMergeRefs)([
11017 metaBoxesMainRef,
11018 effectSizeConstraints
11019 ]);
11020 const separatorRef = (0, import_element25.useRef)();
11021 const separatorHelpId = (0, import_element25.useId)();
11022 const heightRef = (0, import_element25.useRef)();
11023 const getAriaValueNow = (height) => Math.round((height - min2) / (max2 - min2) * 100);
11024 const persistIsOpen = (to = !isOpen) => setPreference("core/edit-post", "metaBoxesMainIsOpen", to);
11025 const applyHeight = (candidateHeight = "auto", isPersistent) => {
11026 let styleHeight;
11027 if (candidateHeight === "auto") {
11028 isPersistent = false;
11029 styleHeight = candidateHeight;
11030 } else {
11031 candidateHeight = Math.min(max2, Math.max(min2, candidateHeight));
11032 heightRef.current = candidateHeight;
11033 styleHeight = `${candidateHeight}px`;
11034 }
11035 if (isPersistent) {
11036 setPreference(
11037 "core/edit-post",
11038 "metaBoxesMainOpenHeight",
11039 candidateHeight
11040 );
11041 } else {
11042 metaBoxesMainRef.current.style.height = styleHeight;
11043 if (!isShort) {
11044 separatorRef.current.ariaValueNow = getAriaValueNow(candidateHeight);
11045 }
11046 }
11047 };
11048 const bindDragGesture = useDrag(
11049 ({ movement, first, last, memo, tap, args }) => {
11050 const pane = metaBoxesMainRef.current;
11051 const [, yMovement] = movement;
11052 if (first) {
11053 pane.classList.add("is-resizing");
11054 let fromHeight = heightRef.current ?? pane.offsetHeight;
11055 if (isOpen) {
11056 if (fromHeight > max2) {
11057 fromHeight = max2;
11058 }
11059 } else {
11060 fromHeight = min2;
11061 }
11062 applyHeight(fromHeight - yMovement);
11063 return { fromHeight };
11064 }
11065 if (!first && !last && !tap) {
11066 applyHeight(memo.fromHeight - yMovement);
11067 return memo;
11068 }
11069 pane.classList.remove("is-resizing");
11070 if (tap) {
11071 const [onTap] = args;
11072 onTap?.();
11073 return;
11074 }
11075 const nextIsOpen = heightRef.current > min2;
11076 persistIsOpen(nextIsOpen);
11077 applyHeight(heightRef.current, nextIsOpen);
11078 },
11079 { keyboardDisplacement: 20, filterTaps: true }
11080 );
11081 if (!hasAnyVisible) {
11082 return;
11083 }
11084 const contents = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11085 "div",
11086 {
11087 className: "edit-post-layout__metaboxes edit-post-meta-boxes-main__liner",
11088 hidden: !isLegacy && !isOpen,
11089 children: [
11090 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MetaBoxes, { location: "normal" }),
11091 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MetaBoxes, { location: "advanced" })
11092 ]
11093 }
11094 );
11095 if (isLegacy) {
11096 return contents;
11097 }
11098 const isAutoHeight = openHeight === void 0;
11099 const usedOpenHeight = isShort ? "auto" : openHeight;
11100 const usedHeight = isOpen ? usedOpenHeight : min2;
11101 const usedAriaValueNow = max2 === void 0 || isAutoHeight ? 50 : getAriaValueNow(usedHeight);
11102 const paneLabel = (0, import_i18n14.__)("Meta Boxes");
11103 const toggle = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11104 "button",
11105 {
11106 "aria-expanded": isOpen,
11107 onClick: ({ detail }) => {
11108 if (isShort || !detail) {
11109 persistIsOpen();
11110 }
11111 },
11112 ...!isShort && bindDragGesture(persistIsOpen),
11113 children: [
11114 paneLabel,
11115 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components9.Icon, { icon: isOpen ? chevron_up_default : chevron_down_default })
11116 ]
11117 }
11118 );
11119 const separator = !isShort && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
11120 /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(tooltip_exports.Root, { children: [
11121 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11122 tooltip_exports.Trigger,
11123 {
11124 render: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11125 "button",
11126 {
11127 ref: separatorRef,
11128 role: "separator",
11129 "aria-valuenow": usedAriaValueNow,
11130 "aria-label": (0, import_i18n14.__)("Drag to resize"),
11131 "aria-describedby": separatorHelpId,
11132 ...bindDragGesture()
11133 }
11134 )
11135 }
11136 ),
11137 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(tooltip_exports.Popup, { children: (0, import_i18n14.__)("Drag to resize") })
11138 ] }),
11139 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(VisuallyHidden, { id: separatorHelpId, children: (0, import_i18n14.__)(
11140 "Use up and down arrow keys to resize the meta box pane."
11141 ) })
11142 ] });
11143 return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11144 navigable_region_default,
11145 {
11146 ariaLabel: paneLabel,
11147 ref: setMainRefs,
11148 className: clsx_default(
11149 "edit-post-meta-boxes-main",
11150 !isShort && "is-resizable"
11151 ),
11152 style: { height: usedHeight },
11153 children: [
11154 /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "edit-post-meta-boxes-main__presenter", children: [
11155 toggle,
11156 separator
11157 ] }),
11158 contents
11159 ]
11160 }
11161 );
11162 }
11163 function Layout({
11164 postId: initialPostId,
11165 postType: initialPostType,
11166 settings,
11167 initialEdits
11168 }) {
11169 useCommands();
11170 const shouldIframe = useShouldIframe();
11171 const { createErrorNotice } = (0, import_data25.useDispatch)(import_notices3.store);
11172 const {
11173 currentPost: { postId: currentPostId, postType: currentPostType },
11174 onNavigateToEntityRecord,
11175 onNavigateToPreviousEntityRecord
11176 } = useNavigateToEntityRecord(
11177 initialPostId,
11178 initialPostType,
11179 "post-only"
11180 );
11181 const isEditingTemplate2 = currentPostType === "wp_template";
11182 const {
11183 mode,
11184 isFullscreenActive,
11185 hasResolvedMode,
11186 hasActiveMetaboxes,
11187 hasBlockSelected,
11188 showIconLabels,
11189 isDistractionFree,
11190 showMetaBoxes,
11191 isWelcomeGuideVisible,
11192 templateId,
11193 isDevicePreview
11194 } = (0, import_data25.useSelect)(
11195 (select3) => {
11196 const { get } = select3(import_preferences10.store);
11197 const { isFeatureActive: isFeatureActive2, hasMetaBoxes: hasMetaBoxes2 } = select3(store);
11198 const { canUser, getPostType, getTemplateId } = unlock2(
11199 select3(import_core_data8.store)
11200 );
11201 const supportsTemplateMode = settings.supportsTemplateMode;
11202 const isViewable = getPostType(currentPostType)?.viewable ?? false;
11203 const canViewTemplate = canUser("read", {
11204 kind: "postType",
11205 name: "wp_template"
11206 });
11207 const { getBlockSelectionStart, isZoomOut } = unlock2(
11208 select3(import_block_editor2.store)
11209 );
11210 const { getEditorMode: getEditorMode2, getDefaultRenderingMode, getDeviceType } = unlock2(select3(import_editor18.store));
11211 const isNotDesignPostType = !DESIGN_POST_TYPES.includes(currentPostType);
11212 const isDirectlyEditingPattern = currentPostType === "wp_block" && !onNavigateToPreviousEntityRecord;
11213 const _templateId = getTemplateId(currentPostType, currentPostId);
11214 const defaultMode = getDefaultRenderingMode(currentPostType);
11215 return {
11216 mode: getEditorMode2(),
11217 isFullscreenActive: isFeatureActive2("fullscreenMode"),
11218 hasActiveMetaboxes: hasMetaBoxes2(),
11219 hasResolvedMode: defaultMode === "template-locked" ? !!_templateId : defaultMode !== void 0,
11220 hasBlockSelected: !!getBlockSelectionStart(),
11221 showIconLabels: get("core", "showIconLabels"),
11222 isDistractionFree: get("core", "distractionFree"),
11223 showMetaBoxes: isNotDesignPostType && !isZoomOut() || isDirectlyEditingPattern,
11224 isWelcomeGuideVisible: isFeatureActive2("welcomeGuide"),
11225 templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate2 ? _templateId : null,
11226 isDevicePreview: getDeviceType() !== "Desktop"
11227 };
11228 },
11229 [
11230 currentPostType,
11231 currentPostId,
11232 isEditingTemplate2,
11233 settings.supportsTemplateMode,
11234 onNavigateToPreviousEntityRecord
11235 ]
11236 );
11237 useMetaBoxInitialization(hasActiveMetaboxes && hasResolvedMode);
11238 const commandContext = hasBlockSelected ? "block-selection-edit" : "entity-edit";
11239 useCommandContext(commandContext);
11240 const styles = useEditorStyles(settings);
11241 const editorSettings = (0, import_element25.useMemo)(
11242 () => ({
11243 ...settings,
11244 styles,
11245 onNavigateToEntityRecord,
11246 onNavigateToPreviousEntityRecord
11247 }),
11248 [
11249 settings,
11250 styles,
11251 onNavigateToEntityRecord,
11252 onNavigateToPreviousEntityRecord
11253 ]
11254 );
11255 if (showIconLabels) {
11256 document.body.classList.add("show-icon-labels");
11257 } else {
11258 document.body.classList.remove("show-icon-labels");
11259 }
11260 const navigateRegionsProps = (0, import_components9.__unstableUseNavigateRegions)();
11261 const className = clsx_default("edit-post-layout", "is-mode-" + mode, {
11262 "has-metaboxes": hasActiveMetaboxes
11263 });
11264 function onPluginAreaError(name) {
11265 createErrorNotice(
11266 (0, import_i18n14.sprintf)(
11267 /* translators: %s: plugin name */
11268 (0, import_i18n14.__)(
11269 'The "%s" plugin has encountered an error and cannot be rendered.'
11270 ),
11271 name
11272 )
11273 );
11274 }
11275 const { createSuccessNotice } = (0, import_data25.useDispatch)(import_notices3.store);
11276 const onActionPerformed = (0, import_element25.useCallback)(
11277 (actionId, items) => {
11278 switch (actionId) {
11279 case "move-to-trash":
11280 {
11281 document.location.href = (0, import_url5.addQueryArgs)("edit.php", {
11282 trashed: 1,
11283 post_type: items[0].type,
11284 ids: items[0].id
11285 });
11286 }
11287 break;
11288 case "duplicate-post":
11289 {
11290 const newItem = items[0];
11291 const title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered;
11292 createSuccessNotice(
11293 (0, import_i18n14.sprintf)(
11294 // translators: %s: Title of the created post or template, e.g: "Hello world".
11295 (0, import_i18n14.__)('"%s" successfully created.'),
11296 (0, import_html_entities.decodeEntities)(title) || (0, import_i18n14.__)("(no title)")
11297 ),
11298 {
11299 type: "snackbar",
11300 id: "duplicate-post-action",
11301 actions: [
11302 {
11303 label: (0, import_i18n14.__)("Edit"),
11304 onClick: () => {
11305 const postId = newItem.id;
11306 document.location.href = (0, import_url5.addQueryArgs)("post.php", {
11307 post: postId,
11308 action: "edit"
11309 });
11310 }
11311 }
11312 ]
11313 }
11314 );
11315 }
11316 break;
11317 }
11318 },
11319 [createSuccessNotice]
11320 );
11321 const initialPost = (0, import_element25.useMemo)(() => {
11322 return {
11323 type: initialPostType,
11324 id: initialPostId
11325 };
11326 }, [initialPostType, initialPostId]);
11327 const backButton = (0, import_compose3.useViewportMatch)("medium") && isFullscreenActive ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(back_button_default, { initialPost }) : null;
11328 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components9.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(tooltip_exports.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_editor18.ErrorBoundary, { canCopyContent: true, children: [
11329 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(WelcomeGuide, { postType: currentPostType }),
11330 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { ...navigateRegionsProps, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11331 Editor,
11332 {
11333 settings: editorSettings,
11334 initialEdits,
11335 postType: currentPostType,
11336 postId: currentPostId,
11337 templateId,
11338 className,
11339 forceIsDirty: hasActiveMetaboxes,
11340 disableIframe: !shouldIframe,
11341 autoFocus: !isWelcomeGuideVisible,
11342 onActionPerformed,
11343 extraSidebarPanels: showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MetaBoxes, { location: "side" }),
11344 extraContent: !isDistractionFree && showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11345 MetaBoxesMain,
11346 {
11347 isLegacy: isDevicePreview
11348 }
11349 ),
11350 children: [
11351 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor18.PostLockedModal, {}),
11352 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(EditorInitialization, {}),
11353 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(FullscreenMode, { isActive: isFullscreenActive }),
11354 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BrowserURL, {}),
11355 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor18.UnsavedChangesWarning, {}),
11356 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor18.AutosaveMonitor, {}),
11357 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor18.LocalAutosaveMonitor, {}),
11358 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(keyboard_shortcuts_default, {}),
11359 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_editor18.EditorKeyboardShortcutsRegister, {}),
11360 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BlockKeyboardShortcuts, {}),
11361 currentPostType === "wp_block" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(InitPatternModal, {}),
11362 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_plugins.PluginArea, { onError: onPluginAreaError }),
11363 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(more_menu_default, {}),
11364 backButton,
11365 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_notices3.SnackbarNotices, { className: "edit-post-layout__snackbar" })
11366 ]
11367 }
11368 ) })
11369 ] }) }) });
11370 }
11371 var layout_default = Layout;
11372
11373 // packages/edit-post/build-module/deprecated.mjs
11374 var import_editor19 = __toESM(require_editor(), 1);
11375 var import_url6 = __toESM(require_url(), 1);
11376 var import_deprecated3 = __toESM(require_deprecated(), 1);
11377 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
11378 var { PluginPostExcerpt } = unlock2(import_editor19.privateApis);
11379 var isSiteEditor = (0, import_url6.getPath)(window.location.href)?.includes(
11380 "site-editor.php"
11381 );
11382 var deprecateSlot = (name) => {
11383 (0, import_deprecated3.default)(`wp.editPost.${name}`, {
11384 since: "6.6",
11385 alternative: `wp.editor.${name}`
11386 });
11387 };
11388 function PluginBlockSettingsMenuItem(props) {
11389 if (isSiteEditor) {
11390 return null;
11391 }
11392 deprecateSlot("PluginBlockSettingsMenuItem");
11393 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_editor19.PluginBlockSettingsMenuItem, { ...props });
11394 }
11395 function PluginDocumentSettingPanel(props) {
11396 if (isSiteEditor) {
11397 return null;
11398 }
11399 deprecateSlot("PluginDocumentSettingPanel");
11400 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_editor19.PluginDocumentSettingPanel, { ...props });
11401 }
11402 function PluginMoreMenuItem(props) {
11403 if (isSiteEditor) {
11404 return null;
11405 }
11406 deprecateSlot("PluginMoreMenuItem");
11407 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_editor19.PluginMoreMenuItem, { ...props });
11408 }
11409 function PluginPrePublishPanel(props) {
11410 if (isSiteEditor) {
11411 return null;
11412 }
11413 deprecateSlot("PluginPrePublishPanel");
11414 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_editor19.PluginPrePublishPanel, { ...props });
11415 }
11416 function PluginPostPublishPanel(props) {
11417 if (isSiteEditor) {
11418 return null;
11419 }
11420 deprecateSlot("PluginPostPublishPanel");
11421 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_editor19.PluginPostPublishPanel, { ...props });
11422 }
11423 function PluginPostStatusInfo(props) {
11424 if (isSiteEditor) {
11425 return null;
11426 }
11427 deprecateSlot("PluginPostStatusInfo");
11428 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_editor19.PluginPostStatusInfo, { ...props });
11429 }
11430 function PluginSidebar(props) {
11431 if (isSiteEditor) {
11432 return null;
11433 }
11434 deprecateSlot("PluginSidebar");
11435 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_editor19.PluginSidebar, { ...props });
11436 }
11437 function PluginSidebarMoreMenuItem(props) {
11438 if (isSiteEditor) {
11439 return null;
11440 }
11441 deprecateSlot("PluginSidebarMoreMenuItem");
11442 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_editor19.PluginSidebarMoreMenuItem, { ...props });
11443 }
11444 function __experimentalPluginPostExcerpt() {
11445 if (isSiteEditor) {
11446 return null;
11447 }
11448 (0, import_deprecated3.default)("wp.editPost.__experimentalPluginPostExcerpt", {
11449 since: "6.6",
11450 hint: "Core and custom panels can be access programmatically using their panel name.",
11451 link: "https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically"
11452 });
11453 return PluginPostExcerpt;
11454 }
11455
11456 // packages/edit-post/build-module/index.mjs
11457 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
11458 var {
11459 BackButton: __experimentalMainDashboardButton,
11460 registerCoreBlockBindingsSources
11461 } = unlock2(import_editor20.privateApis);
11462 var { enablePreloadMultiUse, clearPreloadedData } = unlock2(
11463 import_api_fetch2.default.privateApis
11464 );
11465 function initializeEditor(id, postType, postId, settings, initialEdits) {
11466 const isMediumOrBigger = window.matchMedia("(min-width: 782px)").matches;
11467 const target = document.getElementById(id);
11468 const root = (0, import_element26.createRoot)(target);
11469 (0, import_data26.dispatch)(import_preferences11.store).setDefaults("core/edit-post", {
11470 fullscreenMode: true,
11471 themeStyles: true,
11472 welcomeGuide: true,
11473 welcomeGuideTemplate: true
11474 });
11475 (0, import_data26.dispatch)(import_preferences11.store).setDefaults("core", {
11476 allowRightClickOverrides: true,
11477 editorMode: "visual",
11478 editorTool: "edit",
11479 fixedToolbar: false,
11480 hiddenBlockTypes: [],
11481 inactivePanels: [],
11482 openPanels: ["post-status"],
11483 showBlockBreadcrumbs: true,
11484 showIconLabels: false,
11485 showListViewByDefault: false,
11486 enableChoosePatternModal: true,
11487 isPublishSidebarEnabled: true,
11488 showCollaborationCursor: false,
11489 showCollaborationNotifications: true
11490 });
11491 if (window.__clientSideMediaProcessing) {
11492 (0, import_data26.dispatch)(import_preferences11.store).setDefaults("core/media", {
11493 requireApproval: true,
11494 optimizeOnUpload: true
11495 });
11496 }
11497 (0, import_data26.dispatch)(import_blocks3.store).reapplyBlockTypeFilters();
11498 if (isMediumOrBigger && (0, import_data26.select)(import_preferences11.store).get("core", "showListViewByDefault") && !(0, import_data26.select)(import_preferences11.store).get("core", "distractionFree")) {
11499 (0, import_data26.dispatch)(import_editor20.store).setIsListViewOpened(true);
11500 }
11501 (0, import_block_library2.registerCoreBlocks)();
11502 registerCoreBlockBindingsSources();
11503 (0, import_widgets.registerLegacyWidgetBlock)({ inserter: false });
11504 (0, import_widgets.registerWidgetGroupBlock)({ inserter: false });
11505 if (true) {
11506 (0, import_block_library2.__experimentalRegisterExperimentalCoreBlocks)({
11507 enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks
11508 });
11509 }
11510 const documentMode = document.compatMode === "CSS1Compat" ? "Standards" : "Quirks";
11511 if (documentMode !== "Standards") {
11512 console.warn(
11513 "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."
11514 );
11515 }
11516 const isIphone = window.navigator.userAgent.indexOf("iPhone") !== -1;
11517 if (isIphone) {
11518 window.addEventListener("scroll", (event) => {
11519 const editorScrollContainer = document.getElementsByClassName(
11520 "interface-interface-skeleton__body"
11521 )[0];
11522 if (event.target === document) {
11523 if (window.scrollY > 100) {
11524 editorScrollContainer.scrollTop = editorScrollContainer.scrollTop + window.scrollY;
11525 }
11526 if (document.getElementsByClassName("is-mode-visual")[0]) {
11527 window.scrollTo(0, 0);
11528 }
11529 }
11530 });
11531 }
11532 window.addEventListener("dragover", (e) => e.preventDefault(), false);
11533 window.addEventListener("drop", (e) => e.preventDefault(), false);
11534 enablePreloadMultiUse();
11535 const preloadedResolutions = preloadResolutions(postType, postId);
11536 preloadedResolutions.finally(() => {
11537 clearPreloadedData();
11538 if (postType && postId) {
11539 const post = (0, import_data26.select)(import_core_data9.store).getEntityRecord(
11540 "postType",
11541 postType,
11542 postId
11543 );
11544 if (post) {
11545 (0, import_data26.dispatch)(import_editor20.store).setupEditor(
11546 post,
11547 initialEdits,
11548 settings.template
11549 );
11550 }
11551 }
11552 root.render(
11553 /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_element26.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
11554 layout_default,
11555 {
11556 settings,
11557 postId,
11558 postType,
11559 initialEdits
11560 }
11561 ) })
11562 );
11563 });
11564 return root;
11565 }
11566 async function preloadResolutions(postType, postId) {
11567 const core = (0, import_data26.resolveSelect)(import_core_data9.store);
11568 const coreSelect = (0, import_data26.select)(import_core_data9.store);
11569 try {
11570 await Promise.all([
11571 core.getCurrentUser(),
11572 core.getEntitiesConfig("postType"),
11573 core.getEntitiesConfig("taxonomy"),
11574 core.getEntitiesConfig("root"),
11575 core.getEntityRecords("root", "taxonomy"),
11576 core.getCurrentTheme(),
11577 // Forward-resolver alias of `getCurrentTheme` with its own
11578 // resolution metadata, so it needs a separate kick.
11579 core.getThemeSupports(),
11580 core.getBlockPatternCategories(),
11581 core.__experimentalGetCurrentGlobalStylesId(),
11582 core.__experimentalGetCurrentThemeBaseGlobalStyles(),
11583 core.__experimentalGetCurrentThemeGlobalStylesVariations(),
11584 core.getEntityRecord("root", "__unstableBase"),
11585 core.getEntityRecord("root", "site"),
11586 core.canUser("read", { kind: "root", name: "site" }),
11587 core.canUser("create", { kind: "postType", name: "attachment" }),
11588 core.canUser("create", { kind: "postType", name: "page" }),
11589 core.canUser("create", { kind: "postType", name: "wp_block" }),
11590 core.canUser("create", {
11591 kind: "postType",
11592 name: "wp_template"
11593 }),
11594 // Per-post resolvers. `getPostType` and `getEditedEntityRecord`
11595 // are shorthand/forward-resolver aliases with their own
11596 // resolution metadata, so they need separate kicks.
11597 ...postType && postId ? [
11598 core.getPostType(postType),
11599 core.getEntityRecord("postType", postType, postId),
11600 core.getEditedEntityRecord(
11601 "postType",
11602 postType,
11603 postId
11604 ),
11605 core.getAutosaves(postType, postId),
11606 core.getDefaultTemplateId({ slug: "front-page" }),
11607 core.canUser("create", {
11608 kind: "postType",
11609 name: postType
11610 })
11611 ] : []
11612 ]);
11613 const tasks = [];
11614 const globalStylesId = coreSelect.__experimentalGetCurrentGlobalStylesId();
11615 if (globalStylesId) {
11616 tasks.push(
11617 core.getEntityRecord("root", "globalStyles", globalStylesId),
11618 core.canUser("read", {
11619 kind: "root",
11620 name: "globalStyles",
11621 id: globalStylesId
11622 })
11623 );
11624 }
11625 if (postType && postId) {
11626 const post = coreSelect.getEntityRecord(
11627 "postType",
11628 postType,
11629 postId
11630 );
11631 if (post) {
11632 let slug = "page" === postType ? "page" : "single-" + postType;
11633 if (post.slug) {
11634 slug += "-" + post.slug;
11635 }
11636 tasks.push(core.getDefaultTemplateId({ slug }));
11637 if (post.author) {
11638 tasks.push(
11639 core.getUser(post.author, {
11640 context: "view",
11641 _fields: "id,name"
11642 })
11643 );
11644 }
11645 }
11646 }
11647 if (tasks.length) {
11648 await Promise.all(tasks);
11649 }
11650 } catch {
11651 }
11652 }
11653 function reinitializeEditor() {
11654 (0, import_deprecated4.default)("wp.editPost.reinitializeEditor", {
11655 since: "6.2",
11656 version: "6.3"
11657 });
11658 }
11659 return __toCommonJS(index_exports);
11660 })();
11661 /*! Bundled license information:
11662
11663 use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
11664 (**
11665 * @license React
11666 * use-sync-external-store-shim.development.js
11667 *
11668 * Copyright (c) Meta Platforms, Inc. and affiliates.
11669 *
11670 * This source code is licensed under the MIT license found in the
11671 * LICENSE file in the root directory of this source tree.
11672 *)
11673
11674 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
11675 (**
11676 * @license React
11677 * use-sync-external-store-shim/with-selector.development.js
11678 *
11679 * Copyright (c) Meta Platforms, Inc. and affiliates.
11680 *
11681 * This source code is licensed under the MIT license found in the
11682 * LICENSE file in the root directory of this source tree.
11683 *)
11684 */
11685 if(wp.editPost&&typeof wp.editPost==='object'){wp.editPost=Object.assign({},wp.editPost);}
11686 //# sourceMappingURL=index.js.map
11687