| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 (function() { 2 var wp; 3 (wp ||= {}).editPost = (() => { 4 var __create = Object.create; 5 var __defProp = Object.defineProperty; 6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 7 var __getOwnPropNames = Object.getOwnPropertyNames; 8 var __getProtoOf = Object.getPrototypeOf; 9 var __hasOwnProp = Object.prototype.hasOwnProperty; 10 var __commonJS = (cb, mod) => function __require() { 11 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 12 }; 13 var __export = (target, all) => { 14 for (var name in all) 15 __defProp(target, name, { get: all[name], enumerable: true }); 16 }; 17 var __copyProps = (to, from, except, desc) => { 18 if (from && typeof from === "object" || typeof from === "function") { 19 for (let key of __getOwnPropNames(from)) 20 if (!__hasOwnProp.call(to, key) && key !== except) 21 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 22 } 23 return to; 24 }; 25 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 26 // If the importer is in node compatibility mode or this is not an ESM 27 // file that has been converted to a CommonJS file using a Babel- 28 // compatible transform (i.e. "__esModule" has not been set), then set 29 // "default" to the CommonJS "module.exports" for node compatibility. 30 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 31 mod 32 )); 33 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 34 35 // package-external:@wordpress/blocks 36 var require_blocks = __commonJS({ 37 "package-external:@wordpress/blocks"(exports, module) { 38 module.exports = window.wp.blocks; 39 } 40 }); 41 42 // package-external:@wordpress/block-library 43 var require_block_library = __commonJS({ 44 "package-external:@wordpress/block-library"(exports, module) { 45 module.exports = window.wp.blockLibrary; 46 } 47 }); 48 49 // package-external:@wordpress/deprecated 50 var require_deprecated = __commonJS({ 51 "package-external:@wordpress/deprecated"(exports, module) { 52 module.exports = window.wp.deprecated; 53 } 54 }); 55 56 // package-external:@wordpress/element 57 var require_element = __commonJS({ 58 "package-external:@wordpress/element"(exports, module) { 59 module.exports = window.wp.element; 60 } 61 }); 62 63 // package-external:@wordpress/data 64 var require_data = __commonJS({ 65 "package-external:@wordpress/data"(exports, module) { 66 module.exports = window.wp.data; 67 } 68 }); 69 70 // package-external:@wordpress/preferences 71 var require_preferences = __commonJS({ 72 "package-external:@wordpress/preferences"(exports, module) { 73 module.exports = window.wp.preferences; 74 } 75 }); 76 77 // package-external:@wordpress/widgets 78 var require_widgets = __commonJS({ 79 "package-external:@wordpress/widgets"(exports, module) { 80 module.exports = window.wp.widgets; 81 } 82 }); 83 84 // package-external:@wordpress/editor 85 var require_editor = __commonJS({ 86 "package-external:@wordpress/editor"(exports, module) { 87 module.exports = window.wp.editor; 88 } 89 }); 90 91 // package-external:@wordpress/core-data 92 var require_core_data = __commonJS({ 93 "package-external:@wordpress/core-data"(exports, module) { 94 module.exports = window.wp.coreData; 95 } 96 }); 97 98 // package-external:@wordpress/api-fetch 99 var require_api_fetch = __commonJS({ 100 "package-external:@wordpress/api-fetch"(exports, module) { 101 module.exports = window.wp.apiFetch; 102 } 103 }); 104 105 // package-external:@wordpress/i18n 106 var require_i18n = __commonJS({ 107 "package-external:@wordpress/i18n"(exports, module) { 108 module.exports = window.wp.i18n; 109 } 110 }); 111 112 // vendor-external:react 113 var require_react = __commonJS({ 114 "vendor-external:react"(exports, module) { 115 module.exports = window.React; 116 } 117 }); 118 119 // vendor-external:react/jsx-runtime 120 var require_jsx_runtime = __commonJS({ 121 "vendor-external:react/jsx-runtime"(exports, module) { 122 module.exports = window.ReactJSXRuntime; 123 } 124 }); 125 126 // vendor-external:react-dom 127 var require_react_dom = __commonJS({ 128 "vendor-external:react-dom"(exports, module) { 129 module.exports = window.ReactDOM; 130 } 131 }); 132 133 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js 134 var require_use_sync_external_store_shim_development = __commonJS({ 135 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { 136 "use strict"; 137 (function() { 138 function is(x, y) { 139 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 140 } 141 function useSyncExternalStore$2(subscribe, getSnapshot) { 142 didWarnOld18Alpha || void 0 === React47.startTransition || (didWarnOld18Alpha = true, console.error( 143 "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." 144 )); 145 var value = getSnapshot(); 146 if (!didWarnUncachedGetSnapshot) { 147 var cachedValue = getSnapshot(); 148 objectIs(value, cachedValue) || (console.error( 149 "The result of getSnapshot should be cached to avoid an infinite loop" 150 ), didWarnUncachedGetSnapshot = true); 151 } 152 cachedValue = useState16({ 153 inst: { value, getSnapshot } 154 }); 155 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 156 useLayoutEffect3( 157 function() { 158 inst.value = value; 159 inst.getSnapshot = getSnapshot; 160 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 161 }, 162 [subscribe, value, getSnapshot] 163 ); 164 useEffect18( 165 function() { 166 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 167 return subscribe(function() { 168 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 169 }); 170 }, 171 [subscribe] 172 ); 173 useDebugValue2(value); 174 return value; 175 } 176 function checkIfSnapshotChanged(inst) { 177 var latestGetSnapshot = inst.getSnapshot; 178 inst = inst.value; 179 try { 180 var nextValue = latestGetSnapshot(); 181 return !objectIs(inst, nextValue); 182 } catch (error) { 183 return true; 184 } 185 } 186 function useSyncExternalStore$1(subscribe, getSnapshot) { 187 return getSnapshot(); 188 } 189 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 190 var React47 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState16 = React47.useState, useEffect18 = React47.useEffect, useLayoutEffect3 = React47.useLayoutEffect, useDebugValue2 = React47.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; 191 exports.useSyncExternalStore = void 0 !== React47.useSyncExternalStore ? React47.useSyncExternalStore : shim; 192 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 193 })(); 194 } 195 }); 196 197 // node_modules/use-sync-external-store/shim/index.js 198 var require_shim = __commonJS({ 199 "node_modules/use-sync-external-store/shim/index.js"(exports, module) { 200 "use strict"; 201 if (false) { 202 module.exports = null; 203 } else { 204 module.exports = require_use_sync_external_store_shim_development(); 205 } 206 } 207 }); 208 209 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js 210 var require_with_selector_development = __commonJS({ 211 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { 212 "use strict"; 213 (function() { 214 function is(x, y) { 215 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 216 } 217 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 218 var React47 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef23 = React47.useRef, useEffect18 = React47.useEffect, useMemo16 = React47.useMemo, useDebugValue2 = React47.useDebugValue; 219 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { 220 var instRef = useRef23(null); 221 if (null === instRef.current) { 222 var inst = { hasValue: false, value: null }; 223 instRef.current = inst; 224 } else inst = instRef.current; 225 instRef = useMemo16( 226 function() { 227 function memoizedSelector(nextSnapshot) { 228 if (!hasMemo) { 229 hasMemo = true; 230 memoizedSnapshot = nextSnapshot; 231 nextSnapshot = selector(nextSnapshot); 232 if (void 0 !== isEqual && inst.hasValue) { 233 var currentSelection = inst.value; 234 if (isEqual(currentSelection, nextSnapshot)) 235 return memoizedSelection = currentSelection; 236 } 237 return memoizedSelection = nextSnapshot; 238 } 239 currentSelection = memoizedSelection; 240 if (objectIs(memoizedSnapshot, nextSnapshot)) 241 return currentSelection; 242 var nextSelection = selector(nextSnapshot); 243 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) 244 return memoizedSnapshot = nextSnapshot, currentSelection; 245 memoizedSnapshot = nextSnapshot; 246 return memoizedSelection = nextSelection; 247 } 248 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; 249 return [ 250 function() { 251 return memoizedSelector(getSnapshot()); 252 }, 253 null === maybeGetServerSnapshot ? void 0 : function() { 254 return memoizedSelector(maybeGetServerSnapshot()); 255 } 256 ]; 257 }, 258 [getSnapshot, getServerSnapshot, selector, isEqual] 259 ); 260 var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]); 261 useEffect18( 262 function() { 263 inst.hasValue = true; 264 inst.value = value; 265 }, 266 [value] 267 ); 268 useDebugValue2(value); 269 return value; 270 }; 271 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 272 })(); 273 } 274 }); 275 276 // node_modules/use-sync-external-store/shim/with-selector.js 277 var require_with_selector = __commonJS({ 278 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { 279 "use strict"; 280 if (false) { 281 module.exports = null; 282 } else { 283 module.exports = require_with_selector_development(); 284 } 285 } 286 }); 287 288 // package-external:@wordpress/primitives 289 var require_primitives = __commonJS({ 290 "package-external:@wordpress/primitives"(exports, module) { 291 module.exports = window.wp.primitives; 292 } 293 }); 294 295 // package-external:@wordpress/compose 296 var require_compose = __commonJS({ 297 "package-external:@wordpress/compose"(exports, module) { 298 module.exports = window.wp.compose; 299 } 300 }); 301 302 // package-external:@wordpress/theme 303 var require_theme = __commonJS({ 304 "package-external:@wordpress/theme"(exports, module) { 305 module.exports = window.wp.theme; 306 } 307 }); 308 309 // package-external:@wordpress/private-apis 310 var require_private_apis = __commonJS({ 311 "package-external:@wordpress/private-apis"(exports, module) { 312 module.exports = window.wp.privateApis; 313 } 314 }); 315 316 // package-external:@wordpress/components 317 var require_components = __commonJS({ 318 "package-external:@wordpress/components"(exports, module) { 319 module.exports = window.wp.components; 320 } 321 }); 322 323 // package-external:@wordpress/block-editor 324 var require_block_editor = __commonJS({ 325 "package-external:@wordpress/block-editor"(exports, module) { 326 module.exports = window.wp.blockEditor; 327 } 328 }); 329 330 // package-external:@wordpress/style-engine 331 var require_style_engine = __commonJS({ 332 "package-external:@wordpress/style-engine"(exports, module) { 333 module.exports = window.wp.styleEngine; 334 } 335 }); 336 337 // package-external:@wordpress/plugins 338 var require_plugins = __commonJS({ 339 "package-external:@wordpress/plugins"(exports, module) { 340 module.exports = window.wp.plugins; 341 } 342 }); 343 344 // package-external:@wordpress/notices 345 var require_notices = __commonJS({ 346 "package-external:@wordpress/notices"(exports, module) { 347 module.exports = window.wp.notices; 348 } 349 }); 350 351 // package-external:@wordpress/commands 352 var require_commands = __commonJS({ 353 "package-external:@wordpress/commands"(exports, module) { 354 module.exports = window.wp.commands; 355 } 356 }); 357 358 // package-external:@wordpress/url 359 var require_url = __commonJS({ 360 "package-external:@wordpress/url"(exports, module) { 361 module.exports = window.wp.url; 362 } 363 }); 364 365 // package-external:@wordpress/html-entities 366 var require_html_entities = __commonJS({ 367 "package-external:@wordpress/html-entities"(exports, module) { 368 module.exports = window.wp.htmlEntities; 369 } 370 }); 371 372 // package-external:@wordpress/keyboard-shortcuts 373 var require_keyboard_shortcuts = __commonJS({ 374 "package-external:@wordpress/keyboard-shortcuts"(exports, module) { 375 module.exports = window.wp.keyboardShortcuts; 376 } 377 }); 378 379 // package-external:@wordpress/hooks 380 var require_hooks = __commonJS({ 381 "package-external:@wordpress/hooks"(exports, module) { 382 module.exports = window.wp.hooks; 383 } 384 }); 385 386 // package-external:@wordpress/keycodes 387 var require_keycodes = __commonJS({ 388 "package-external:@wordpress/keycodes"(exports, module) { 389 module.exports = window.wp.keycodes; 390 } 391 }); 392 393 // packages/edit-post/build-module/index.mjs 394 var index_exports = {}; 395 __export(index_exports, { 396 PluginBlockSettingsMenuItem: () => PluginBlockSettingsMenuItem, 397 PluginDocumentSettingPanel: () => PluginDocumentSettingPanel, 398 PluginMoreMenuItem: () => PluginMoreMenuItem, 399 PluginPostPublishPanel: () => PluginPostPublishPanel, 400 PluginPostStatusInfo: () => PluginPostStatusInfo, 401 PluginPrePublishPanel: () => PluginPrePublishPanel, 402 PluginSidebar: () => PluginSidebar, 403 PluginSidebarMoreMenuItem: () => PluginSidebarMoreMenuItem, 404 __experimentalFullscreenModeClose: () => fullscreen_mode_close_default, 405 __experimentalMainDashboardButton: () => __experimentalMainDashboardButton, 406 __experimentalPluginPostExcerpt: () => __experimentalPluginPostExcerpt, 407 initializeEditor: () => initializeEditor, 408 reinitializeEditor: () => reinitializeEditor, 409 store: () => store 410 }); 411 var import_blocks2 = __toESM(require_blocks(), 1); 412 var import_block_library2 = __toESM(require_block_library(), 1); 413 var import_deprecated4 = __toESM(require_deprecated(), 1); 414 var import_element30 = __toESM(require_element(), 1); 415 var import_data26 = __toESM(require_data(), 1); 416 var import_preferences11 = __toESM(require_preferences(), 1); 417 var import_widgets = __toESM(require_widgets(), 1); 418 var import_editor20 = __toESM(require_editor(), 1); 419 var import_core_data10 = __toESM(require_core_data(), 1); 420 var import_api_fetch2 = __toESM(require_api_fetch(), 1); 421 422 // node_modules/clsx/dist/clsx.mjs 423 function r(e) { 424 var t, f, n = ""; 425 if ("string" == typeof e || "number" == typeof e) n += e; 426 else if ("object" == typeof e) if (Array.isArray(e)) { 427 var o = e.length; 428 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 429 } else for (f in e) e[f] && (n && (n += " "), n += f); 430 return n; 431 } 432 function clsx() { 433 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 434 return n; 435 } 436 var clsx_default = clsx; 437 438 // node_modules/@base-ui/utils/safeReact.mjs 439 var React = __toESM(require_react(), 1); 440 var SafeReact = { 441 ...React 442 }; 443 444 // node_modules/@base-ui/utils/useRefWithInit.mjs 445 var React2 = __toESM(require_react(), 1); 446 var UNINITIALIZED = {}; 447 function useRefWithInit(init, initArg) { 448 const ref = React2.useRef(UNINITIALIZED); 449 if (ref.current === UNINITIALIZED) { 450 ref.current = init(initArg); 451 } 452 return ref; 453 } 454 455 // node_modules/@base-ui/utils/useStableCallback.mjs 456 var useInsertionEffect = SafeReact.useInsertionEffect; 457 var useSafeInsertionEffect = ( 458 // React 17 doesn't have useInsertionEffect. 459 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 460 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() 461 ); 462 function useStableCallback(callback) { 463 const stable = useRefWithInit(createStableCallback).current; 464 stable.next = callback; 465 useSafeInsertionEffect(stable.effect); 466 return stable.trampoline; 467 } 468 function createStableCallback() { 469 const stable = { 470 next: void 0, 471 callback: assertNotCalled, 472 trampoline: (...args) => stable.callback?.(...args), 473 effect: () => { 474 stable.callback = stable.next; 475 } 476 }; 477 return stable; 478 } 479 function assertNotCalled() { 480 if (true) { 481 throw ( 482 /* minify-error-disabled */ 483 new Error("Base UI: Cannot call an event handler while rendering.") 484 ); 485 } 486 } 487 488 // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs 489 var React3 = __toESM(require_react(), 1); 490 var noop = () => { 491 }; 492 var useIsoLayoutEffect = typeof document !== "undefined" ? React3.useLayoutEffect : noop; 493 494 // node_modules/@base-ui/utils/warn.mjs 495 var set; 496 if (true) { 497 set = /* @__PURE__ */ new Set(); 498 } 499 function warn(...messages) { 500 if (true) { 501 const messageKey = messages.join(" "); 502 if (!set.has(messageKey)) { 503 set.add(messageKey); 504 console.warn(`Base UI: $messageKey}`); 505 } 506 } 507 } 508 509 // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs 510 var React4 = __toESM(require_react(), 1); 511 var DirectionContext = /* @__PURE__ */ React4.createContext(void 0); 512 if (true) DirectionContext.displayName = "DirectionContext"; 513 function useDirection() { 514 const context = React4.useContext(DirectionContext); 515 return context?.direction ?? "ltr"; 516 } 517 518 // node_modules/@base-ui/react/internals/useRenderElement.mjs 519 var React7 = __toESM(require_react(), 1); 520 521 // node_modules/@base-ui/utils/useMergedRefs.mjs 522 function useMergedRefs(a, b, c, d) { 523 const forkRef = useRefWithInit(createForkRef).current; 524 if (didChange(forkRef, a, b, c, d)) { 525 update(forkRef, [a, b, c, d]); 526 } 527 return forkRef.callback; 528 } 529 function useMergedRefsN(refs) { 530 const forkRef = useRefWithInit(createForkRef).current; 531 if (didChangeN(forkRef, refs)) { 532 update(forkRef, refs); 533 } 534 return forkRef.callback; 535 } 536 function createForkRef() { 537 return { 538 callback: null, 539 cleanup: null, 540 refs: [] 541 }; 542 } 543 function didChange(forkRef, a, b, c, d) { 544 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; 545 } 546 function didChangeN(forkRef, newRefs) { 547 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 548 } 549 function update(forkRef, refs) { 550 forkRef.refs = refs; 551 if (refs.every((ref) => ref == null)) { 552 forkRef.callback = null; 553 return; 554 } 555 forkRef.callback = (instance) => { 556 if (forkRef.cleanup) { 557 forkRef.cleanup(); 558 forkRef.cleanup = null; 559 } 560 if (instance != null) { 561 const cleanupCallbacks = Array(refs.length).fill(null); 562 for (let i = 0; i < refs.length; i += 1) { 563 const ref = refs[i]; 564 if (ref == null) { 565 continue; 566 } 567 switch (typeof ref) { 568 case "function": { 569 const refCleanup = ref(instance); 570 if (typeof refCleanup === "function") { 571 cleanupCallbacks[i] = refCleanup; 572 } 573 break; 574 } 575 case "object": { 576 ref.current = instance; 577 break; 578 } 579 default: 580 } 581 } 582 forkRef.cleanup = () => { 583 for (let i = 0; i < refs.length; i += 1) { 584 const ref = refs[i]; 585 if (ref == null) { 586 continue; 587 } 588 switch (typeof ref) { 589 case "function": { 590 const cleanupCallback = cleanupCallbacks[i]; 591 if (typeof cleanupCallback === "function") { 592 cleanupCallback(); 593 } else { 594 ref(null); 595 } 596 break; 597 } 598 case "object": { 599 ref.current = null; 600 break; 601 } 602 default: 603 } 604 } 605 }; 606 } 607 }; 608 } 609 610 // node_modules/@base-ui/utils/getReactElementRef.mjs 611 var React6 = __toESM(require_react(), 1); 612 613 // node_modules/@base-ui/utils/reactVersion.mjs 614 var React5 = __toESM(require_react(), 1); 615 var majorVersion = parseInt(React5.version, 10); 616 function isReactVersionAtLeast(reactVersionToCheck) { 617 return majorVersion >= reactVersionToCheck; 618 } 619 620 // node_modules/@base-ui/utils/getReactElementRef.mjs 621 function getReactElementRef(element) { 622 if (!/* @__PURE__ */ React6.isValidElement(element)) { 623 return null; 624 } 625 const reactElement = element; 626 const propsWithRef = reactElement.props; 627 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 628 } 629 630 // node_modules/@base-ui/utils/mergeObjects.mjs 631 function mergeObjects(a, b) { 632 if (a && !b) { 633 return a; 634 } 635 if (!a && b) { 636 return b; 637 } 638 if (a || b) { 639 return { 640 ...a, 641 ...b 642 }; 643 } 644 return void 0; 645 } 646 647 // node_modules/@base-ui/utils/empty.mjs 648 function NOOP() { 649 } 650 var EMPTY_ARRAY = Object.freeze([]); 651 var EMPTY_OBJECT = Object.freeze({}); 652 653 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 654 function getStateAttributesProps(state, customMapping) { 655 const props = {}; 656 for (const key in state) { 657 const value = state[key]; 658 if (customMapping?.hasOwnProperty(key)) { 659 const customProps = customMapping[key](value); 660 if (customProps != null) { 661 Object.assign(props, customProps); 662 } 663 continue; 664 } 665 if (value === true) { 666 props[`data-$key.toLowerCase()}`] = ""; 667 } else if (value) { 668 props[`data-$key.toLowerCase()}`] = value.toString(); 669 } 670 } 671 return props; 672 } 673 674 // node_modules/@base-ui/react/utils/resolveClassName.mjs 675 function resolveClassName(className, state) { 676 return typeof className === "function" ? className(state) : className; 677 } 678 679 // node_modules/@base-ui/react/utils/resolveStyle.mjs 680 function resolveStyle(style, state) { 681 return typeof style === "function" ? style(state) : style; 682 } 683 684 // node_modules/@base-ui/react/merge-props/mergeProps.mjs 685 var EMPTY_PROPS = {}; 686 function mergeProps(a, b, c, d, e) { 687 if (!c && !d && !e && !a) { 688 return createInitialMergedProps(b); 689 } 690 let merged = createInitialMergedProps(a); 691 if (b) { 692 merged = mergeInto(merged, b); 693 } 694 if (c) { 695 merged = mergeInto(merged, c); 696 } 697 if (d) { 698 merged = mergeInto(merged, d); 699 } 700 if (e) { 701 merged = mergeInto(merged, e); 702 } 703 return merged; 704 } 705 function mergePropsN(props) { 706 if (props.length === 0) { 707 return EMPTY_PROPS; 708 } 709 if (props.length === 1) { 710 return createInitialMergedProps(props[0]); 711 } 712 let merged = createInitialMergedProps(props[0]); 713 for (let i = 1; i < props.length; i += 1) { 714 merged = mergeInto(merged, props[i]); 715 } 716 return merged; 717 } 718 function createInitialMergedProps(inputProps) { 719 if (isPropsGetter(inputProps)) { 720 return { 721 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 722 }; 723 } 724 return copyInitialProps(inputProps); 725 } 726 function mergeInto(merged, inputProps) { 727 if (isPropsGetter(inputProps)) { 728 return resolvePropsGetter(inputProps, merged); 729 } 730 return mutablyMergeInto(merged, inputProps); 731 } 732 function copyInitialProps(inputProps) { 733 const copiedProps = { 734 ...inputProps 735 }; 736 for (const propName in copiedProps) { 737 const propValue = copiedProps[propName]; 738 if (isEventHandler(propName, propValue)) { 739 copiedProps[propName] = wrapEventHandler(propValue); 740 } 741 } 742 return copiedProps; 743 } 744 function mutablyMergeInto(mergedProps, externalProps) { 745 if (!externalProps) { 746 return mergedProps; 747 } 748 for (const propName in externalProps) { 749 const externalPropValue = externalProps[propName]; 750 switch (propName) { 751 case "style": { 752 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 753 break; 754 } 755 case "className": { 756 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 757 break; 758 } 759 default: { 760 if (isEventHandler(propName, externalPropValue)) { 761 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 762 } else { 763 mergedProps[propName] = externalPropValue; 764 } 765 } 766 } 767 } 768 return mergedProps; 769 } 770 function isEventHandler(key, value) { 771 const code0 = key.charCodeAt(0); 772 const code1 = key.charCodeAt(1); 773 const code2 = key.charCodeAt(2); 774 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 775 } 776 function isPropsGetter(inputProps) { 777 return typeof inputProps === "function"; 778 } 779 function resolvePropsGetter(inputProps, previousProps) { 780 if (isPropsGetter(inputProps)) { 781 return inputProps(previousProps); 782 } 783 return inputProps ?? EMPTY_PROPS; 784 } 785 function mergeEventHandlers(ourHandler, theirHandler) { 786 if (!theirHandler) { 787 return ourHandler; 788 } 789 if (!ourHandler) { 790 return wrapEventHandler(theirHandler); 791 } 792 return (...args) => { 793 const event = args[0]; 794 if (isSyntheticEvent(event)) { 795 const baseUIEvent = event; 796 makeEventPreventable(baseUIEvent); 797 const result2 = theirHandler(...args); 798 if (!baseUIEvent.baseUIHandlerPrevented) { 799 ourHandler?.(...args); 800 } 801 return result2; 802 } 803 const result = theirHandler(...args); 804 ourHandler?.(...args); 805 return result; 806 }; 807 } 808 function wrapEventHandler(handler) { 809 if (!handler) { 810 return handler; 811 } 812 return (...args) => { 813 const event = args[0]; 814 if (isSyntheticEvent(event)) { 815 makeEventPreventable(event); 816 } 817 return handler(...args); 818 }; 819 } 820 function makeEventPreventable(event) { 821 event.preventBaseUIHandler = () => { 822 event.baseUIHandlerPrevented = true; 823 }; 824 return event; 825 } 826 function mergeClassNames(ourClassName, theirClassName) { 827 if (theirClassName) { 828 if (ourClassName) { 829 return theirClassName + " " + ourClassName; 830 } 831 return theirClassName; 832 } 833 return ourClassName; 834 } 835 function isSyntheticEvent(event) { 836 return event != null && typeof event === "object" && "nativeEvent" in event; 837 } 838 839 // node_modules/@base-ui/react/internals/useRenderElement.mjs 840 var import_react = __toESM(require_react(), 1); 841 function useRenderElement(element, componentProps, params = {}) { 842 const renderProp = componentProps.render; 843 const outProps = useRenderElementProps(componentProps, params); 844 if (params.enabled === false) { 845 return null; 846 } 847 const state = params.state ?? EMPTY_OBJECT; 848 return evaluateRenderProp(element, renderProp, outProps, state); 849 } 850 function useRenderElementProps(componentProps, params = {}) { 851 const { 852 className: classNameProp, 853 style: styleProp, 854 render: renderProp 855 } = componentProps; 856 const { 857 state = EMPTY_OBJECT, 858 ref, 859 props, 860 stateAttributesMapping: stateAttributesMapping3, 861 enabled = true 862 } = params; 863 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 864 const style = enabled ? resolveStyle(styleProp, state) : void 0; 865 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT; 866 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 867 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 868 if (typeof document !== "undefined") { 869 if (!enabled) { 870 useMergedRefs(null, null); 871 } else if (Array.isArray(ref)) { 872 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 873 } else { 874 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 875 } 876 } 877 if (!enabled) { 878 return EMPTY_OBJECT; 879 } 880 if (className !== void 0) { 881 outProps.className = mergeClassNames(outProps.className, className); 882 } 883 if (style !== void 0) { 884 outProps.style = mergeObjects(outProps.style, style); 885 } 886 return outProps; 887 } 888 function resolveRenderFunctionProps(props) { 889 if (Array.isArray(props)) { 890 return mergePropsN(props); 891 } 892 return mergeProps(void 0, props); 893 } 894 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 895 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 896 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 897 function evaluateRenderProp(element, render, props, state) { 898 if (render) { 899 if (typeof render === "function") { 900 if (true) { 901 warnIfRenderPropLooksLikeComponent(render); 902 } 903 return render(props, state); 904 } 905 const mergedProps = mergeProps(props, render.props); 906 mergedProps.ref = props.ref; 907 let newElement = render; 908 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 909 const children = React7.Children.toArray(render); 910 newElement = children[0]; 911 } 912 if (true) { 913 if (!/* @__PURE__ */ React7.isValidElement(newElement)) { 914 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")); 915 } 916 } 917 return /* @__PURE__ */ React7.cloneElement(newElement, mergedProps); 918 } 919 if (element) { 920 if (typeof element === "string") { 921 return renderTag(element, props); 922 } 923 } 924 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 925 } 926 function warnIfRenderPropLooksLikeComponent(renderFn) { 927 const functionName = renderFn.name; 928 if (functionName.length === 0) { 929 return; 930 } 931 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 932 return; 933 } 934 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 935 return; 936 } 937 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"); 938 } 939 function renderTag(Tag, props) { 940 if (Tag === "button") { 941 return /* @__PURE__ */ (0, import_react.createElement)("button", { 942 type: "button", 943 ...props, 944 key: props.key 945 }); 946 } 947 if (Tag === "img") { 948 return /* @__PURE__ */ (0, import_react.createElement)("img", { 949 alt: "", 950 ...props, 951 key: props.key 952 }); 953 } 954 return /* @__PURE__ */ React7.createElement(Tag, props); 955 } 956 957 // node_modules/@base-ui/utils/useId.mjs 958 var React8 = __toESM(require_react(), 1); 959 var globalId = 0; 960 function useGlobalId(idOverride, prefix = "mui") { 961 const [defaultId, setDefaultId] = React8.useState(idOverride); 962 const id = idOverride || defaultId; 963 React8.useEffect(() => { 964 if (defaultId == null) { 965 globalId += 1; 966 setDefaultId(`$prefix}-$globalId}`); 967 } 968 }, [defaultId, prefix]); 969 return id; 970 } 971 var maybeReactUseId = SafeReact.useId; 972 function useId(idOverride, prefix) { 973 if (maybeReactUseId !== void 0) { 974 const reactId = maybeReactUseId(); 975 return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId); 976 } 977 return useGlobalId(idOverride, prefix); 978 } 979 980 // node_modules/@base-ui/react/internals/useBaseUiId.mjs 981 function useBaseUiId(idOverride) { 982 return useId(idOverride, "base-ui"); 983 } 984 985 // node_modules/@base-ui/react/internals/reason-parts.mjs 986 var reason_parts_exports = {}; 987 __export(reason_parts_exports, { 988 cancelOpen: () => cancelOpen, 989 chipRemovePress: () => chipRemovePress, 990 clearPress: () => clearPress, 991 closePress: () => closePress, 992 closeWatcher: () => closeWatcher, 993 decrementPress: () => decrementPress, 994 disabled: () => disabled, 995 drag: () => drag, 996 escapeKey: () => escapeKey, 997 focusOut: () => focusOut, 998 imperativeAction: () => imperativeAction, 999 incrementPress: () => incrementPress, 1000 initial: () => initial, 1001 inputBlur: () => inputBlur, 1002 inputChange: () => inputChange, 1003 inputClear: () => inputClear, 1004 inputPaste: () => inputPaste, 1005 inputPress: () => inputPress, 1006 itemPress: () => itemPress, 1007 keyboard: () => keyboard, 1008 linkPress: () => linkPress, 1009 listNavigation: () => listNavigation, 1010 missing: () => missing, 1011 none: () => none, 1012 outsidePress: () => outsidePress, 1013 pointer: () => pointer, 1014 scrub: () => scrub, 1015 siblingOpen: () => siblingOpen, 1016 swipe: () => swipe, 1017 trackPress: () => trackPress, 1018 triggerFocus: () => triggerFocus, 1019 triggerHover: () => triggerHover, 1020 triggerPress: () => triggerPress, 1021 wheel: () => wheel, 1022 windowResize: () => windowResize 1023 }); 1024 var none = "none"; 1025 var triggerPress = "trigger-press"; 1026 var triggerHover = "trigger-hover"; 1027 var triggerFocus = "trigger-focus"; 1028 var outsidePress = "outside-press"; 1029 var itemPress = "item-press"; 1030 var closePress = "close-press"; 1031 var linkPress = "link-press"; 1032 var clearPress = "clear-press"; 1033 var chipRemovePress = "chip-remove-press"; 1034 var trackPress = "track-press"; 1035 var incrementPress = "increment-press"; 1036 var decrementPress = "decrement-press"; 1037 var inputChange = "input-change"; 1038 var inputClear = "input-clear"; 1039 var inputBlur = "input-blur"; 1040 var inputPaste = "input-paste"; 1041 var inputPress = "input-press"; 1042 var focusOut = "focus-out"; 1043 var escapeKey = "escape-key"; 1044 var closeWatcher = "close-watcher"; 1045 var listNavigation = "list-navigation"; 1046 var keyboard = "keyboard"; 1047 var pointer = "pointer"; 1048 var drag = "drag"; 1049 var wheel = "wheel"; 1050 var scrub = "scrub"; 1051 var cancelOpen = "cancel-open"; 1052 var siblingOpen = "sibling-open"; 1053 var disabled = "disabled"; 1054 var missing = "missing"; 1055 var initial = "initial"; 1056 var imperativeAction = "imperative-action"; 1057 var swipe = "swipe"; 1058 var windowResize = "window-resize"; 1059 1060 // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs 1061 function createChangeEventDetails(reason, event, trigger, customProperties) { 1062 let canceled = false; 1063 let allowPropagation = false; 1064 const custom = customProperties ?? EMPTY_OBJECT; 1065 const details = { 1066 reason, 1067 event: event ?? new Event("base-ui"), 1068 cancel() { 1069 canceled = true; 1070 }, 1071 allowPropagation() { 1072 allowPropagation = true; 1073 }, 1074 get isCanceled() { 1075 return canceled; 1076 }, 1077 get isPropagationAllowed() { 1078 return allowPropagation; 1079 }, 1080 trigger, 1081 ...custom 1082 }; 1083 return details; 1084 } 1085 1086 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 1087 var React10 = __toESM(require_react(), 1); 1088 1089 // node_modules/@base-ui/utils/useOnMount.mjs 1090 var React9 = __toESM(require_react(), 1); 1091 var EMPTY = []; 1092 function useOnMount(fn) { 1093 React9.useEffect(fn, EMPTY); 1094 } 1095 1096 // node_modules/@base-ui/utils/useAnimationFrame.mjs 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/internals/useTransitionStatus.mjs 1185 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { 1186 const [transitionStatus, setTransitionStatus] = React10.useState(open && enableIdleState ? "idle" : void 0); 1187 const [mounted, setMounted] = React10.useState(open); 1188 if (open && !mounted) { 1189 setMounted(true); 1190 setTransitionStatus("starting"); 1191 } 1192 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { 1193 setTransitionStatus("ending"); 1194 } 1195 if (!open && !mounted && transitionStatus === "ending") { 1196 setTransitionStatus(void 0); 1197 } 1198 useIsoLayoutEffect(() => { 1199 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { 1200 const frame = AnimationFrame.request(() => { 1201 setTransitionStatus("ending"); 1202 }); 1203 return () => { 1204 AnimationFrame.cancel(frame); 1205 }; 1206 } 1207 return void 0; 1208 }, [open, mounted, transitionStatus, deferEndingState]); 1209 useIsoLayoutEffect(() => { 1210 if (!open || enableIdleState) { 1211 return void 0; 1212 } 1213 const frame = AnimationFrame.request(() => { 1214 setTransitionStatus(void 0); 1215 }); 1216 return () => { 1217 AnimationFrame.cancel(frame); 1218 }; 1219 }, [enableIdleState, open]); 1220 useIsoLayoutEffect(() => { 1221 if (!open || !enableIdleState) { 1222 return void 0; 1223 } 1224 if (open && mounted && transitionStatus !== "idle") { 1225 setTransitionStatus("starting"); 1226 } 1227 const frame = AnimationFrame.request(() => { 1228 setTransitionStatus("idle"); 1229 }); 1230 return () => { 1231 AnimationFrame.cancel(frame); 1232 }; 1233 }, [enableIdleState, open, mounted, transitionStatus]); 1234 return { 1235 mounted, 1236 setMounted, 1237 transitionStatus 1238 }; 1239 } 1240 1241 // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs 1242 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { 1243 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; 1244 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; 1245 return TransitionStatusDataAttributes2; 1246 })({}); 1247 var STARTING_HOOK = { 1248 [TransitionStatusDataAttributes.startingStyle]: "" 1249 }; 1250 var ENDING_HOOK = { 1251 [TransitionStatusDataAttributes.endingStyle]: "" 1252 }; 1253 var transitionStatusMapping = { 1254 transitionStatus(value) { 1255 if (value === "starting") { 1256 return STARTING_HOOK; 1257 } 1258 if (value === "ending") { 1259 return ENDING_HOOK; 1260 } 1261 return null; 1262 } 1263 }; 1264 1265 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 1266 function hasWindow() { 1267 return typeof window !== "undefined"; 1268 } 1269 function getNodeName(node) { 1270 if (isNode(node)) { 1271 return (node.nodeName || "").toLowerCase(); 1272 } 1273 return "#document"; 1274 } 1275 function getWindow(node) { 1276 var _node$ownerDocument; 1277 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 1278 } 1279 function getDocumentElement(node) { 1280 var _ref; 1281 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 1282 } 1283 function isNode(value) { 1284 if (!hasWindow()) { 1285 return false; 1286 } 1287 return value instanceof Node || value instanceof getWindow(value).Node; 1288 } 1289 function isElement(value) { 1290 if (!hasWindow()) { 1291 return false; 1292 } 1293 return value instanceof Element || value instanceof getWindow(value).Element; 1294 } 1295 function isHTMLElement(value) { 1296 if (!hasWindow()) { 1297 return false; 1298 } 1299 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 1300 } 1301 function isShadowRoot(value) { 1302 if (!hasWindow() || typeof ShadowRoot === "undefined") { 1303 return false; 1304 } 1305 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 1306 } 1307 function isOverflowElement(element) { 1308 const { 1309 overflow, 1310 overflowX, 1311 overflowY, 1312 display 1313 } = getComputedStyle2(element); 1314 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 1315 } 1316 function isTableElement(element) { 1317 return /^(table|td|th)$/.test(getNodeName(element)); 1318 } 1319 function isTopLayer(element) { 1320 try { 1321 if (element.matches(":popover-open")) { 1322 return true; 1323 } 1324 } catch (_e) { 1325 } 1326 try { 1327 return element.matches(":modal"); 1328 } catch (_e) { 1329 return false; 1330 } 1331 } 1332 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 1333 var containRe = /paint|layout|strict|content/; 1334 var isNotNone = (value) => !!value && value !== "none"; 1335 var isWebKitValue; 1336 function isContainingBlock(elementOrCss) { 1337 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 1338 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 || ""); 1339 } 1340 function getContainingBlock(element) { 1341 let currentNode = getParentNode(element); 1342 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 1343 if (isContainingBlock(currentNode)) { 1344 return currentNode; 1345 } else if (isTopLayer(currentNode)) { 1346 return null; 1347 } 1348 currentNode = getParentNode(currentNode); 1349 } 1350 return null; 1351 } 1352 function isWebKit() { 1353 if (isWebKitValue == null) { 1354 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 1355 } 1356 return isWebKitValue; 1357 } 1358 function isLastTraversableNode(node) { 1359 return /^(html|body|#document)$/.test(getNodeName(node)); 1360 } 1361 function getComputedStyle2(element) { 1362 return getWindow(element).getComputedStyle(element); 1363 } 1364 function getNodeScroll(element) { 1365 if (isElement(element)) { 1366 return { 1367 scrollLeft: element.scrollLeft, 1368 scrollTop: element.scrollTop 1369 }; 1370 } 1371 return { 1372 scrollLeft: element.scrollX, 1373 scrollTop: element.scrollY 1374 }; 1375 } 1376 function getParentNode(node) { 1377 if (getNodeName(node) === "html") { 1378 return node; 1379 } 1380 const result = ( 1381 // Step into the shadow DOM of the parent of a slotted node. 1382 node.assignedSlot || // DOM Element detected. 1383 node.parentNode || // ShadowRoot detected. 1384 isShadowRoot(node) && node.host || // Fallback. 1385 getDocumentElement(node) 1386 ); 1387 return isShadowRoot(result) ? result.host : result; 1388 } 1389 function getNearestOverflowAncestor(node) { 1390 const parentNode = getParentNode(node); 1391 if (isLastTraversableNode(parentNode)) { 1392 return node.ownerDocument ? node.ownerDocument.body : node.body; 1393 } 1394 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 1395 return parentNode; 1396 } 1397 return getNearestOverflowAncestor(parentNode); 1398 } 1399 function getOverflowAncestors(node, list, traverseIframes) { 1400 var _node$ownerDocument2; 1401 if (list === void 0) { 1402 list = []; 1403 } 1404 if (traverseIframes === void 0) { 1405 traverseIframes = true; 1406 } 1407 const scrollableAncestor = getNearestOverflowAncestor(node); 1408 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 1409 const win = getWindow(scrollableAncestor); 1410 if (isBody) { 1411 const frameElement = getFrameElement(win); 1412 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 1413 } else { 1414 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 1415 } 1416 } 1417 function getFrameElement(win) { 1418 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 1419 } 1420 1421 // node_modules/@base-ui/utils/addEventListener.mjs 1422 function addEventListener(target, type, listener, options) { 1423 target.addEventListener(type, listener, options); 1424 return () => { 1425 target.removeEventListener(type, listener, options); 1426 }; 1427 } 1428 1429 // node_modules/@base-ui/utils/useValueAsRef.mjs 1430 function useValueAsRef(value) { 1431 const latest = useRefWithInit(createLatestRef, value).current; 1432 latest.next = value; 1433 useIsoLayoutEffect(latest.effect); 1434 return latest; 1435 } 1436 function createLatestRef(value) { 1437 const latest = { 1438 current: value, 1439 next: value, 1440 effect: () => { 1441 latest.current = latest.next; 1442 } 1443 }; 1444 return latest; 1445 } 1446 1447 // node_modules/@base-ui/utils/owner.mjs 1448 function ownerDocument(node) { 1449 return node?.ownerDocument || document; 1450 } 1451 1452 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 1453 var React11 = __toESM(require_react(), 1); 1454 1455 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 1456 var ReactDOM = __toESM(require_react_dom(), 1); 1457 1458 // node_modules/@base-ui/react/utils/resolveRef.mjs 1459 function resolveRef(maybeRef) { 1460 if (maybeRef == null) { 1461 return maybeRef; 1462 } 1463 return "current" in maybeRef ? maybeRef.current : maybeRef; 1464 } 1465 1466 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 1467 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { 1468 const frame = useAnimationFrame(); 1469 return useStableCallback((fnToExecute, signal = null) => { 1470 frame.cancel(); 1471 const element = resolveRef(elementOrRef); 1472 if (element == null) { 1473 return; 1474 } 1475 const resolvedElement = element; 1476 const done = () => { 1477 ReactDOM.flushSync(fnToExecute); 1478 }; 1479 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 1480 fnToExecute(); 1481 return; 1482 } 1483 function exec() { 1484 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { 1485 if (!signal?.aborted) { 1486 done(); 1487 } 1488 }).catch(() => { 1489 if (treatAbortedAsFinished) { 1490 if (!signal?.aborted) { 1491 done(); 1492 } 1493 return; 1494 } 1495 const currentAnimations = resolvedElement.getAnimations(); 1496 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 1497 exec(); 1498 } 1499 }); 1500 } 1501 if (waitForStartingStyleRemoved) { 1502 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; 1503 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1504 frame.request(exec); 1505 return; 1506 } 1507 const attributeObserver = new MutationObserver(() => { 1508 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1509 attributeObserver.disconnect(); 1510 exec(); 1511 } 1512 }); 1513 attributeObserver.observe(resolvedElement, { 1514 attributes: true, 1515 attributeFilter: [startingStyleAttribute] 1516 }); 1517 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 1518 once: true 1519 }); 1520 return; 1521 } 1522 frame.request(exec); 1523 }); 1524 } 1525 1526 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 1527 function useOpenChangeComplete(parameters) { 1528 const { 1529 enabled = true, 1530 open, 1531 ref, 1532 onComplete: onCompleteParam 1533 } = parameters; 1534 const onComplete = useStableCallback(onCompleteParam); 1535 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); 1536 React11.useEffect(() => { 1537 if (!enabled) { 1538 return void 0; 1539 } 1540 const abortController = new AbortController(); 1541 runOnceAnimationsFinish(onComplete, abortController.signal); 1542 return () => { 1543 abortController.abort(); 1544 }; 1545 }, [enabled, open, onComplete, runOnceAnimationsFinish]); 1546 } 1547 1548 // node_modules/@base-ui/utils/useOnFirstRender.mjs 1549 var React12 = __toESM(require_react(), 1); 1550 function useOnFirstRender(fn) { 1551 const ref = React12.useRef(true); 1552 if (ref.current) { 1553 ref.current = false; 1554 fn(); 1555 } 1556 } 1557 1558 // node_modules/@base-ui/utils/platform/parts.mjs 1559 var parts_exports = {}; 1560 __export(parts_exports, { 1561 engine: () => engine_exports, 1562 env: () => env_exports, 1563 os: () => os_exports, 1564 screenReader: () => screen_reader_exports 1565 }); 1566 1567 // node_modules/@base-ui/utils/platform/os.mjs 1568 var os_exports = {}; 1569 __export(os_exports, { 1570 android: () => android, 1571 apple: () => apple, 1572 ios: () => ios, 1573 linux: () => linux, 1574 mac: () => mac, 1575 windows: () => windows 1576 }); 1577 1578 // node_modules/@base-ui/utils/platform/shared.mjs 1579 function readRawData() { 1580 if (typeof navigator === "undefined") { 1581 return { 1582 userAgent: "", 1583 platform: "", 1584 maxTouchPoints: 0 1585 }; 1586 } 1587 if (true) { 1588 const uaData = navigator.userAgentData; 1589 if (uaData && Array.isArray(uaData.brands)) { 1590 return { 1591 userAgent: uaData.brands.map(({ 1592 brand, 1593 version: version2 1594 }) => `$brand}/$version2}`).join(" "), 1595 platform: uaData.platform ?? navigator.platform ?? "", 1596 maxTouchPoints: navigator.maxTouchPoints ?? 0 1597 }; 1598 } 1599 } 1600 return { 1601 userAgent: navigator.userAgent, 1602 platform: navigator.platform ?? "", 1603 maxTouchPoints: navigator.maxTouchPoints ?? 0 1604 }; 1605 } 1606 var { 1607 userAgent, 1608 platform, 1609 maxTouchPoints 1610 } = readRawData(); 1611 var lowerUserAgent = userAgent.toLowerCase(); 1612 var lowerPlatform = platform.toLowerCase(); 1613 1614 // node_modules/@base-ui/utils/platform/os.mjs 1615 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; 1616 var ANDROID_STRING = "android"; 1617 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); 1618 var mac = !ios && lowerPlatform.startsWith("mac"); 1619 var windows = lowerPlatform.startsWith("win"); 1620 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); 1621 var apple = mac || ios; 1622 1623 // node_modules/@base-ui/utils/platform/engine.mjs 1624 var engine_exports = {}; 1625 __export(engine_exports, { 1626 blink: () => blink, 1627 gecko: () => gecko, 1628 webkit: () => webkit 1629 }); 1630 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); 1631 var gecko = !webkit && lowerUserAgent.includes("firefox"); 1632 var blink = !webkit && lowerUserAgent.includes("chrom"); 1633 1634 // node_modules/@base-ui/utils/platform/screen-reader.mjs 1635 var screen_reader_exports = {}; 1636 __export(screen_reader_exports, { 1637 voiceOver: () => voiceOver 1638 }); 1639 var voiceOver = apple; 1640 1641 // node_modules/@base-ui/utils/platform/env.mjs 1642 var env_exports = {}; 1643 __export(env_exports, { 1644 jsdom: () => jsdom 1645 }); 1646 var jsdom = /jsdom|happydom/.test(lowerUserAgent); 1647 1648 // node_modules/@base-ui/utils/useTimeout.mjs 1649 var EMPTY3 = 0; 1650 var Timeout = class _Timeout { 1651 static create() { 1652 return new _Timeout(); 1653 } 1654 currentId = EMPTY3; 1655 /** 1656 * Executes `fn` after `delay`, clearing any previously scheduled call. 1657 */ 1658 start(delay, fn) { 1659 this.clear(); 1660 this.currentId = setTimeout(() => { 1661 this.currentId = EMPTY3; 1662 fn(); 1663 }, delay); 1664 } 1665 isStarted() { 1666 return this.currentId !== EMPTY3; 1667 } 1668 clear = () => { 1669 if (this.currentId !== EMPTY3) { 1670 clearTimeout(this.currentId); 1671 this.currentId = EMPTY3; 1672 } 1673 }; 1674 disposeEffect = () => { 1675 return this.clear; 1676 }; 1677 }; 1678 function useTimeout() { 1679 const timeout = useRefWithInit(Timeout.create).current; 1680 useOnMount(timeout.disposeEffect); 1681 return timeout; 1682 } 1683 1684 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 1685 var React13 = __toESM(require_react(), 1); 1686 1687 // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs 1688 function isReactEvent(event) { 1689 return "nativeEvent" in event; 1690 } 1691 function isMouseLikePointerType(pointerType, strict) { 1692 const values = ["mouse", "pen"]; 1693 if (!strict) { 1694 values.push("", void 0); 1695 } 1696 return values.includes(pointerType); 1697 } 1698 function isClickLikeEvent(event) { 1699 const type = event.type; 1700 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 1701 } 1702 1703 // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs 1704 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 1705 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 1706 1707 // node_modules/@base-ui/react/internals/shadowDom.mjs 1708 function activeElement(doc) { 1709 let element = doc.activeElement; 1710 while (element?.shadowRoot?.activeElement != null) { 1711 element = element.shadowRoot.activeElement; 1712 } 1713 return element; 1714 } 1715 function contains(parent, child) { 1716 if (!parent || !child) { 1717 return false; 1718 } 1719 const rootNode = child.getRootNode?.(); 1720 if (parent.contains(child)) { 1721 return true; 1722 } 1723 if (rootNode && isShadowRoot(rootNode)) { 1724 let next = child; 1725 while (next) { 1726 if (parent === next) { 1727 return true; 1728 } 1729 next = next.parentNode || next.host; 1730 } 1731 } 1732 return false; 1733 } 1734 function getTarget(event) { 1735 if ("composedPath" in event) { 1736 return event.composedPath()[0]; 1737 } 1738 return event.target; 1739 } 1740 1741 // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs 1742 function isTargetInsideEnabledTrigger(target, triggerElements) { 1743 if (!isElement(target)) { 1744 return false; 1745 } 1746 const targetElement = target; 1747 if (triggerElements.hasElement(targetElement)) { 1748 return !targetElement.hasAttribute("data-trigger-disabled"); 1749 } 1750 for (const [, trigger] of triggerElements.entries()) { 1751 if (contains(trigger, targetElement)) { 1752 return !trigger.hasAttribute("data-trigger-disabled"); 1753 } 1754 } 1755 return false; 1756 } 1757 function isEventTargetWithin(event, node) { 1758 if (node == null) { 1759 return false; 1760 } 1761 if ("composedPath" in event) { 1762 return event.composedPath().includes(node); 1763 } 1764 const eventAgain = event; 1765 return eventAgain.target != null && node.contains(eventAgain.target); 1766 } 1767 function isRootElement(element) { 1768 return element.matches("html,body"); 1769 } 1770 function isTypeableElement(element) { 1771 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 1772 } 1773 function isInteractiveElement(element) { 1774 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 1775 } 1776 function matchesFocusVisible(element) { 1777 if (!element || parts_exports.env.jsdom) { 1778 return true; 1779 } 1780 try { 1781 return element.matches(":focus-visible"); 1782 } catch (_e) { 1783 return true; 1784 } 1785 } 1786 1787 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs 1788 function resolveValue(value, pointerType) { 1789 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 1790 return 0; 1791 } 1792 if (typeof value === "function") { 1793 return value(); 1794 } 1795 return value; 1796 } 1797 function getDelay(value, prop, pointerType) { 1798 const result = resolveValue(value, pointerType); 1799 if (typeof result === "number") { 1800 return result; 1801 } 1802 return result?.[prop]; 1803 } 1804 function getRestMs(value) { 1805 if (typeof value === "function") { 1806 return value(); 1807 } 1808 return value; 1809 } 1810 function isClickLikeOpenEvent(openEventType, interactedInside) { 1811 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 1812 } 1813 function isHoverOpenEvent(openEventType) { 1814 return openEventType?.includes("mouse") && openEventType !== "mousedown"; 1815 } 1816 1817 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 1818 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 1819 var FloatingDelayGroupContext = /* @__PURE__ */ React13.createContext({ 1820 hasProvider: false, 1821 timeoutMs: 0, 1822 delayRef: { 1823 current: 0 1824 }, 1825 initialDelayRef: { 1826 current: 0 1827 }, 1828 timeout: new Timeout(), 1829 currentIdRef: { 1830 current: null 1831 }, 1832 currentContextRef: { 1833 current: null 1834 } 1835 }); 1836 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 1837 function resetDelayRef(delayRef, initialDelayRef) { 1838 delayRef.current = initialDelayRef.current; 1839 } 1840 function FloatingDelayGroup(props) { 1841 const { 1842 children, 1843 delay, 1844 timeoutMs = 0 1845 } = props; 1846 const delayRef = React13.useRef(delay); 1847 const initialDelayRef = React13.useRef(delay); 1848 const currentIdRef = React13.useRef(null); 1849 const currentContextRef = React13.useRef(null); 1850 const timeout = useTimeout(); 1851 useIsoLayoutEffect(() => { 1852 initialDelayRef.current = delay; 1853 if (!currentIdRef.current) { 1854 delayRef.current = delay; 1855 return; 1856 } 1857 delayRef.current = { 1858 open: getDelay(delayRef.current, "open"), 1859 close: getDelay(delay, "close") 1860 }; 1861 }, [delay, currentIdRef, delayRef, initialDelayRef]); 1862 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { 1863 value: React13.useMemo(() => ({ 1864 hasProvider: true, 1865 delayRef, 1866 initialDelayRef, 1867 currentIdRef, 1868 timeoutMs, 1869 currentContextRef, 1870 timeout 1871 }), [timeoutMs, timeout]), 1872 children 1873 }); 1874 } 1875 function useDelayGroup(context, options = { 1876 open: false 1877 }) { 1878 const { 1879 open 1880 } = options; 1881 const store2 = "rootStore" in context ? context.rootStore : context; 1882 const floatingId = store2.useState("floatingId"); 1883 const groupContext = React13.useContext(FloatingDelayGroupContext); 1884 const { 1885 currentIdRef, 1886 delayRef, 1887 timeoutMs, 1888 initialDelayRef, 1889 currentContextRef, 1890 hasProvider, 1891 timeout 1892 } = groupContext; 1893 const [isInstantPhase, setIsInstantPhase] = React13.useState(false); 1894 const openRef = React13.useRef(open); 1895 const isUnmountedRef = React13.useRef(false); 1896 useIsoLayoutEffect(() => { 1897 openRef.current = open; 1898 }, [open]); 1899 useIsoLayoutEffect(() => { 1900 return () => { 1901 isUnmountedRef.current = true; 1902 }; 1903 }, []); 1904 useIsoLayoutEffect(() => { 1905 function unset() { 1906 if (!isUnmountedRef.current) { 1907 setIsInstantPhase(false); 1908 } 1909 currentContextRef.current?.setIsInstantPhase(false); 1910 currentIdRef.current = null; 1911 currentContextRef.current = null; 1912 delayRef.current = initialDelayRef.current; 1913 timeout.clear(); 1914 } 1915 if (!currentIdRef.current) { 1916 return void 0; 1917 } 1918 if (!open && currentIdRef.current === floatingId) { 1919 setIsInstantPhase(false); 1920 if (timeoutMs) { 1921 const closingId = floatingId; 1922 timeout.start(timeoutMs, () => { 1923 if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 1924 return; 1925 } 1926 unset(); 1927 }); 1928 return () => { 1929 if (openRef.current || currentIdRef.current !== closingId) { 1930 timeout.clear(); 1931 } 1932 }; 1933 } 1934 unset(); 1935 } 1936 return void 0; 1937 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]); 1938 useIsoLayoutEffect(() => { 1939 if (!open) { 1940 return; 1941 } 1942 const prevContext = currentContextRef.current; 1943 const prevId = currentIdRef.current; 1944 timeout.clear(); 1945 currentContextRef.current = { 1946 onOpenChange: store2.setOpen, 1947 setIsInstantPhase 1948 }; 1949 currentIdRef.current = floatingId; 1950 delayRef.current = { 1951 open: 0, 1952 close: getDelay(initialDelayRef.current, "close") 1953 }; 1954 if (prevId !== null && prevId !== floatingId) { 1955 setIsInstantPhase(true); 1956 prevContext?.setIsInstantPhase(true); 1957 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 1958 } else { 1959 setIsInstantPhase(false); 1960 prevContext?.setIsInstantPhase(false); 1961 } 1962 }, [open, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); 1963 useIsoLayoutEffect(() => { 1964 return () => { 1965 if (currentIdRef.current === floatingId) { 1966 currentContextRef.current = null; 1967 if (!openRef.current) { 1968 return; 1969 } 1970 currentIdRef.current = null; 1971 resetDelayRef(delayRef, initialDelayRef); 1972 timeout.clear(); 1973 } 1974 }; 1975 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); 1976 return React13.useMemo(() => ({ 1977 hasProvider, 1978 delayRef, 1979 isInstantPhase 1980 }), [hasProvider, delayRef, isInstantPhase]); 1981 } 1982 1983 // node_modules/@base-ui/utils/mergeCleanups.mjs 1984 function mergeCleanups(...cleanups) { 1985 return () => { 1986 for (let i = 0; i < cleanups.length; i += 1) { 1987 const cleanup = cleanups[i]; 1988 if (cleanup) { 1989 cleanup(); 1990 } 1991 } 1992 }; 1993 } 1994 1995 // node_modules/@base-ui/react/utils/FocusGuard.mjs 1996 var React14 = __toESM(require_react(), 1); 1997 1998 // node_modules/@base-ui/utils/visuallyHidden.mjs 1999 var visuallyHiddenBase = { 2000 clipPath: "inset(50%)", 2001 overflow: "hidden", 2002 whiteSpace: "nowrap", 2003 border: 0, 2004 padding: 0, 2005 width: 1, 2006 height: 1, 2007 margin: -1 2008 }; 2009 var visuallyHidden = { 2010 ...visuallyHiddenBase, 2011 position: "fixed", 2012 top: 0, 2013 left: 0 2014 }; 2015 var visuallyHiddenInput = { 2016 ...visuallyHiddenBase, 2017 position: "absolute" 2018 }; 2019 2020 // node_modules/@base-ui/react/utils/FocusGuard.mjs 2021 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 2022 var FocusGuard = /* @__PURE__ */ React14.forwardRef(function FocusGuard2(props, ref) { 2023 const [role, setRole] = React14.useState(); 2024 useIsoLayoutEffect(() => { 2025 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { 2026 setRole("button"); 2027 } 2028 }, []); 2029 const restProps = { 2030 tabIndex: 0, 2031 // Role is only for VoiceOver 2032 role 2033 }; 2034 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { 2035 ...props, 2036 ref, 2037 style: visuallyHidden, 2038 "aria-hidden": role ? void 0 : true, 2039 ...restProps, 2040 "data-base-ui-focus-guard": "" 2041 }); 2042 }); 2043 if (true) FocusGuard.displayName = "FocusGuard"; 2044 2045 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 2046 var sides = ["top", "right", "bottom", "left"]; 2047 var min = Math.min; 2048 var max = Math.max; 2049 var round = Math.round; 2050 var floor = Math.floor; 2051 var createCoords = (v) => ({ 2052 x: v, 2053 y: v 2054 }); 2055 var oppositeSideMap = { 2056 left: "right", 2057 right: "left", 2058 bottom: "top", 2059 top: "bottom" 2060 }; 2061 function clamp(start, value, end) { 2062 return max(start, min(value, end)); 2063 } 2064 function evaluate(value, param) { 2065 return typeof value === "function" ? value(param) : value; 2066 } 2067 function getSide(placement) { 2068 return placement.split("-")[0]; 2069 } 2070 function getAlignment(placement) { 2071 return placement.split("-")[1]; 2072 } 2073 function getOppositeAxis(axis) { 2074 return axis === "x" ? "y" : "x"; 2075 } 2076 function getAxisLength(axis) { 2077 return axis === "y" ? "height" : "width"; 2078 } 2079 function getSideAxis(placement) { 2080 const firstChar = placement[0]; 2081 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 2082 } 2083 function getAlignmentAxis(placement) { 2084 return getOppositeAxis(getSideAxis(placement)); 2085 } 2086 function getAlignmentSides(placement, rects, rtl) { 2087 if (rtl === void 0) { 2088 rtl = false; 2089 } 2090 const alignment = getAlignment(placement); 2091 const alignmentAxis = getAlignmentAxis(placement); 2092 const length = getAxisLength(alignmentAxis); 2093 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 2094 if (rects.reference[length] > rects.floating[length]) { 2095 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 2096 } 2097 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 2098 } 2099 function getExpandedPlacements(placement) { 2100 const oppositePlacement = getOppositePlacement(placement); 2101 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 2102 } 2103 function getOppositeAlignmentPlacement(placement) { 2104 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 2105 } 2106 var lrPlacement = ["left", "right"]; 2107 var rlPlacement = ["right", "left"]; 2108 var tbPlacement = ["top", "bottom"]; 2109 var btPlacement = ["bottom", "top"]; 2110 function getSideList(side, isStart, rtl) { 2111 switch (side) { 2112 case "top": 2113 case "bottom": 2114 if (rtl) return isStart ? rlPlacement : lrPlacement; 2115 return isStart ? lrPlacement : rlPlacement; 2116 case "left": 2117 case "right": 2118 return isStart ? tbPlacement : btPlacement; 2119 default: 2120 return []; 2121 } 2122 } 2123 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 2124 const alignment = getAlignment(placement); 2125 let list = getSideList(getSide(placement), direction === "start", rtl); 2126 if (alignment) { 2127 list = list.map((side) => side + "-" + alignment); 2128 if (flipAlignment) { 2129 list = list.concat(list.map(getOppositeAlignmentPlacement)); 2130 } 2131 } 2132 return list; 2133 } 2134 function getOppositePlacement(placement) { 2135 const side = getSide(placement); 2136 return oppositeSideMap[side] + placement.slice(side.length); 2137 } 2138 function expandPaddingObject(padding) { 2139 return { 2140 top: 0, 2141 right: 0, 2142 bottom: 0, 2143 left: 0, 2144 ...padding 2145 }; 2146 } 2147 function getPaddingObject(padding) { 2148 return typeof padding !== "number" ? expandPaddingObject(padding) : { 2149 top: padding, 2150 right: padding, 2151 bottom: padding, 2152 left: padding 2153 }; 2154 } 2155 function rectToClientRect(rect) { 2156 const { 2157 x, 2158 y, 2159 width, 2160 height 2161 } = rect; 2162 return { 2163 width, 2164 height, 2165 top: y, 2166 left: x, 2167 right: x + width, 2168 bottom: y + height, 2169 x, 2170 y 2171 }; 2172 } 2173 2174 // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs 2175 function isHiddenByStyles(styles) { 2176 return styles.visibility === "hidden" || styles.visibility === "collapse"; 2177 } 2178 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 2179 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 2180 return false; 2181 } 2182 if (typeof element.checkVisibility === "function") { 2183 return element.checkVisibility(); 2184 } 2185 return styles.display !== "none" && styles.display !== "contents"; 2186 } 2187 2188 // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs 2189 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 2190 function getParentElement(element) { 2191 const assignedSlot = element.assignedSlot; 2192 if (assignedSlot) { 2193 return assignedSlot; 2194 } 2195 if (element.parentElement) { 2196 return element.parentElement; 2197 } 2198 const rootNode = element.getRootNode(); 2199 return isShadowRoot(rootNode) ? rootNode.host : null; 2200 } 2201 function getDetailsSummary(details) { 2202 for (const child of Array.from(details.children)) { 2203 if (getNodeName(child) === "summary") { 2204 return child; 2205 } 2206 } 2207 return null; 2208 } 2209 function isWithinOpenDetailsSummary(element, details) { 2210 const summary = getDetailsSummary(details); 2211 return !!summary && (element === summary || contains(summary, element)); 2212 } 2213 function isFocusableCandidate(element) { 2214 const nodeName = element ? getNodeName(element) : ""; 2215 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"); 2216 } 2217 function isFocusableElement(element) { 2218 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 2219 return false; 2220 } 2221 for (let current = element; current; current = getParentElement(current)) { 2222 const isAncestor = current !== element; 2223 const isSlot = getNodeName(current) === "slot"; 2224 if (current.hasAttribute("inert")) { 2225 return false; 2226 } 2227 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 2228 return false; 2229 } 2230 } 2231 return true; 2232 } 2233 function isVisibleInTabbableTree(element, isAncestor) { 2234 const styles = getComputedStyle2(element); 2235 if (!isAncestor) { 2236 return isElementVisible(element, styles); 2237 } 2238 return styles.display !== "none"; 2239 } 2240 function getTabIndex(element) { 2241 const tabIndex = element.tabIndex; 2242 if (tabIndex < 0) { 2243 const nodeName = getNodeName(element); 2244 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 2245 return 0; 2246 } 2247 } 2248 return tabIndex; 2249 } 2250 function getNamedRadioInput(element) { 2251 if (getNodeName(element) !== "input") { 2252 return null; 2253 } 2254 const input = element; 2255 return input.type === "radio" && input.name !== "" ? input : null; 2256 } 2257 function isTabbableRadio(element, candidates) { 2258 const input = getNamedRadioInput(element); 2259 if (!input) { 2260 return true; 2261 } 2262 const checkedRadio = candidates.find((candidate) => { 2263 const radio = getNamedRadioInput(candidate); 2264 return radio?.name === input.name && radio.form === input.form && radio.checked; 2265 }); 2266 if (checkedRadio) { 2267 return checkedRadio === input; 2268 } 2269 return candidates.find((candidate) => { 2270 const radio = getNamedRadioInput(candidate); 2271 return radio?.name === input.name && radio.form === input.form; 2272 }) === input; 2273 } 2274 function getComposedChildren(container) { 2275 if (isHTMLElement(container) && getNodeName(container) === "slot") { 2276 const assignedElements = container.assignedElements({ 2277 flatten: true 2278 }); 2279 if (assignedElements.length > 0) { 2280 return assignedElements; 2281 } 2282 } 2283 if (isHTMLElement(container) && container.shadowRoot) { 2284 return Array.from(container.shadowRoot.children); 2285 } 2286 return Array.from(container.children); 2287 } 2288 function appendCandidates(container, list) { 2289 getComposedChildren(container).forEach((child) => { 2290 if (isFocusableCandidate(child)) { 2291 list.push(child); 2292 } 2293 appendCandidates(child, list); 2294 }); 2295 } 2296 function appendMatchingElements(container, selector, list) { 2297 getComposedChildren(container).forEach((child) => { 2298 if (isHTMLElement(child) && child.matches(selector)) { 2299 list.push(child); 2300 } 2301 appendMatchingElements(child, selector, list); 2302 }); 2303 } 2304 function focusable(container) { 2305 const candidates = []; 2306 appendCandidates(container, candidates); 2307 return candidates.filter(isFocusableElement); 2308 } 2309 function tabbable(container) { 2310 const candidates = focusable(container); 2311 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 2312 } 2313 function getTabbableIn(container, dir) { 2314 const list = tabbable(container); 2315 const len = list.length; 2316 if (len === 0) { 2317 return void 0; 2318 } 2319 const active = activeElement(ownerDocument(container)); 2320 const index2 = list.indexOf(active); 2321 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; 2322 return list[nextIndex]; 2323 } 2324 function getNextTabbable(referenceElement) { 2325 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 2326 } 2327 function getPreviousTabbable(referenceElement) { 2328 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 2329 } 2330 function isOutsideEvent(event, container) { 2331 const containerElement = container || event.currentTarget; 2332 const relatedTarget = event.relatedTarget; 2333 return !relatedTarget || !contains(containerElement, relatedTarget); 2334 } 2335 function disableFocusInside(container) { 2336 const tabbableElements = tabbable(container); 2337 tabbableElements.forEach((element) => { 2338 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 2339 element.setAttribute("tabindex", "-1"); 2340 }); 2341 } 2342 function enableFocusInside(container) { 2343 const elements = []; 2344 appendMatchingElements(container, "[data-tabindex]", elements); 2345 elements.forEach((element) => { 2346 const tabindex = element.dataset.tabindex; 2347 delete element.dataset.tabindex; 2348 if (tabindex) { 2349 element.setAttribute("tabindex", tabindex); 2350 } else { 2351 element.removeAttribute("tabindex"); 2352 } 2353 }); 2354 } 2355 2356 // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs 2357 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 2358 const directChildren = nodes.filter((node) => node.parentId === id); 2359 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 2360 } 2361 2362 // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs 2363 function createAttribute(name) { 2364 return `data-base-ui-$name}`; 2365 } 2366 2367 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 2368 var React15 = __toESM(require_react(), 1); 2369 var ReactDOM2 = __toESM(require_react_dom(), 1); 2370 2371 // node_modules/@base-ui/react/internals/constants.mjs 2372 var DISABLED_TRANSITIONS_STYLE = { 2373 style: { 2374 transition: "none" 2375 } 2376 }; 2377 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 2378 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 2379 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 2380 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 2381 var POPUP_COLLISION_AVOIDANCE = { 2382 fallbackAxisSide: "end" 2383 }; 2384 var ownerVisuallyHidden = { 2385 clipPath: "inset(50%)", 2386 position: "fixed", 2387 top: 0, 2388 left: 0 2389 }; 2390 2391 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 2392 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 2393 var PortalContext = /* @__PURE__ */ React15.createContext(null); 2394 if (true) PortalContext.displayName = "PortalContext"; 2395 var usePortalContext = () => React15.useContext(PortalContext); 2396 var attr = createAttribute("portal"); 2397 function useFloatingPortalNode(props = {}) { 2398 const { 2399 ref, 2400 container: containerProp, 2401 componentProps = EMPTY_OBJECT, 2402 elementProps 2403 } = props; 2404 const uniqueId = useId(); 2405 const portalContext = usePortalContext(); 2406 const parentPortalNode = portalContext?.portalNode; 2407 const [containerElement, setContainerElement] = React15.useState(null); 2408 const [portalNode, setPortalNode] = React15.useState(null); 2409 const setPortalNodeRef = useStableCallback((node) => { 2410 if (node !== null) { 2411 setPortalNode(node); 2412 } 2413 }); 2414 const containerRef = React15.useRef(null); 2415 useIsoLayoutEffect(() => { 2416 if (containerProp === null) { 2417 if (containerRef.current) { 2418 containerRef.current = null; 2419 setPortalNode(null); 2420 setContainerElement(null); 2421 } 2422 return; 2423 } 2424 if (uniqueId == null) { 2425 return; 2426 } 2427 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 2428 if (resolvedContainer == null) { 2429 if (containerRef.current) { 2430 containerRef.current = null; 2431 setPortalNode(null); 2432 setContainerElement(null); 2433 } 2434 return; 2435 } 2436 if (containerRef.current !== resolvedContainer) { 2437 containerRef.current = resolvedContainer; 2438 setPortalNode(null); 2439 setContainerElement(resolvedContainer); 2440 } 2441 }, [containerProp, parentPortalNode, uniqueId]); 2442 const portalElement = useRenderElement("div", componentProps, { 2443 ref: [ref, setPortalNodeRef], 2444 props: [{ 2445 id: uniqueId, 2446 [attr]: "" 2447 }, elementProps] 2448 }); 2449 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 2450 return { 2451 portalNode, 2452 portalSubtree 2453 }; 2454 } 2455 var FloatingPortal = /* @__PURE__ */ React15.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 2456 const { 2457 render, 2458 className, 2459 style, 2460 children, 2461 container, 2462 renderGuards, 2463 ...elementProps 2464 } = componentProps; 2465 const { 2466 portalNode, 2467 portalSubtree 2468 } = useFloatingPortalNode({ 2469 container, 2470 ref: forwardedRef, 2471 componentProps, 2472 elementProps 2473 }); 2474 const beforeOutsideRef = React15.useRef(null); 2475 const afterOutsideRef = React15.useRef(null); 2476 const beforeInsideRef = React15.useRef(null); 2477 const afterInsideRef = React15.useRef(null); 2478 const [focusManagerState, setFocusManagerState] = React15.useState(null); 2479 const focusInsideDisabledRef = React15.useRef(false); 2480 const modal = focusManagerState?.modal; 2481 const open = focusManagerState?.open; 2482 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 2483 React15.useEffect(() => { 2484 if (!portalNode || modal) { 2485 return void 0; 2486 } 2487 function onFocus(event) { 2488 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 2489 if (event.type === "focusin") { 2490 if (focusInsideDisabledRef.current) { 2491 enableFocusInside(portalNode); 2492 focusInsideDisabledRef.current = false; 2493 } 2494 } else { 2495 disableFocusInside(portalNode); 2496 focusInsideDisabledRef.current = true; 2497 } 2498 } 2499 } 2500 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 2501 }, [portalNode, modal]); 2502 useIsoLayoutEffect(() => { 2503 if (!portalNode || open !== true || !focusInsideDisabledRef.current) { 2504 return; 2505 } 2506 enableFocusInside(portalNode); 2507 focusInsideDisabledRef.current = false; 2508 }, [open, portalNode]); 2509 const portalContextValue = React15.useMemo(() => ({ 2510 beforeOutsideRef, 2511 afterOutsideRef, 2512 beforeInsideRef, 2513 afterInsideRef, 2514 portalNode, 2515 setFocusManagerState 2516 }), [portalNode]); 2517 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React15.Fragment, { 2518 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { 2519 value: portalContextValue, 2520 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 2521 "data-type": "outside", 2522 ref: beforeOutsideRef, 2523 onFocus: (event) => { 2524 if (isOutsideEvent(event, portalNode)) { 2525 beforeInsideRef.current?.focus(); 2526 } else { 2527 const domReference = focusManagerState ? focusManagerState.domReference : null; 2528 const prevTabbable = getPreviousTabbable(domReference); 2529 prevTabbable?.focus(); 2530 } 2531 } 2532 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { 2533 "aria-owns": portalNode.id, 2534 style: ownerVisuallyHidden 2535 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 2536 "data-type": "outside", 2537 ref: afterOutsideRef, 2538 onFocus: (event) => { 2539 if (isOutsideEvent(event, portalNode)) { 2540 afterInsideRef.current?.focus(); 2541 } else { 2542 const domReference = focusManagerState ? focusManagerState.domReference : null; 2543 const nextTabbable = getNextTabbable(domReference); 2544 nextTabbable?.focus(); 2545 if (focusManagerState?.closeOnFocusOut) { 2546 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 2547 } 2548 } 2549 } 2550 })] 2551 })] 2552 }); 2553 }); 2554 if (true) FloatingPortal.displayName = "FloatingPortal"; 2555 2556 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 2557 var React16 = __toESM(require_react(), 1); 2558 2559 // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs 2560 function createEventEmitter() { 2561 const map = /* @__PURE__ */ new Map(); 2562 return { 2563 emit(event, data) { 2564 map.get(event)?.forEach((listener) => listener(data)); 2565 }, 2566 on(event, listener) { 2567 if (!map.has(event)) { 2568 map.set(event, /* @__PURE__ */ new Set()); 2569 } 2570 map.get(event).add(listener); 2571 }, 2572 off(event, listener) { 2573 map.get(event)?.delete(listener); 2574 } 2575 }; 2576 } 2577 2578 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 2579 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 2580 var FloatingNodeContext = /* @__PURE__ */ React16.createContext(null); 2581 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 2582 var FloatingTreeContext = /* @__PURE__ */ React16.createContext(null); 2583 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 2584 var useFloatingParentNodeId = () => React16.useContext(FloatingNodeContext)?.id || null; 2585 var useFloatingTree = (externalTree) => { 2586 const contextTree = React16.useContext(FloatingTreeContext); 2587 return externalTree ?? contextTree; 2588 }; 2589 2590 // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs 2591 var React17 = __toESM(require_react(), 1); 2592 function createVirtualElement(domElement, data) { 2593 let offsetX = null; 2594 let offsetY = null; 2595 let isAutoUpdateEvent = false; 2596 return { 2597 contextElement: domElement || void 0, 2598 getBoundingClientRect() { 2599 const domRect = domElement?.getBoundingClientRect() || { 2600 width: 0, 2601 height: 0, 2602 x: 0, 2603 y: 0 2604 }; 2605 const isXAxis = data.axis === "x" || data.axis === "both"; 2606 const isYAxis = data.axis === "y" || data.axis === "both"; 2607 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 2608 let width = domRect.width; 2609 let height = domRect.height; 2610 let x = domRect.x; 2611 let y = domRect.y; 2612 if (offsetX == null && data.x && isXAxis) { 2613 offsetX = domRect.x - data.x; 2614 } 2615 if (offsetY == null && data.y && isYAxis) { 2616 offsetY = domRect.y - data.y; 2617 } 2618 x -= offsetX || 0; 2619 y -= offsetY || 0; 2620 width = 0; 2621 height = 0; 2622 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 2623 width = data.axis === "y" ? domRect.width : 0; 2624 height = data.axis === "x" ? domRect.height : 0; 2625 x = isXAxis && data.x != null ? data.x : x; 2626 y = isYAxis && data.y != null ? data.y : y; 2627 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 2628 height = data.axis === "x" ? domRect.height : height; 2629 width = data.axis === "y" ? domRect.width : width; 2630 } 2631 isAutoUpdateEvent = true; 2632 return { 2633 width, 2634 height, 2635 x, 2636 y, 2637 top: y, 2638 right: x + width, 2639 bottom: y + height, 2640 left: x 2641 }; 2642 } 2643 }; 2644 } 2645 function isMouseBasedEvent(event) { 2646 return event != null && event.clientX != null; 2647 } 2648 function useClientPoint(context, props = {}) { 2649 const { 2650 enabled = true, 2651 axis = "both" 2652 } = props; 2653 const store2 = "rootStore" in context ? context.rootStore : context; 2654 const open = store2.useState("open"); 2655 const floating = store2.useState("floatingElement"); 2656 const domReference = store2.useState("domReferenceElement"); 2657 const dataRef = store2.context.dataRef; 2658 const initialRef = React17.useRef(false); 2659 const cleanupListenerRef = React17.useRef(null); 2660 const [pointerType, setPointerType] = React17.useState(); 2661 const [reactive, setReactive] = React17.useState([]); 2662 const resetReference = useStableCallback((reference2) => { 2663 store2.set("positionReference", reference2); 2664 }); 2665 const setReference = useStableCallback((newX, newY, referenceElement) => { 2666 if (initialRef.current) { 2667 return; 2668 } 2669 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 2670 return; 2671 } 2672 store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 2673 x: newX, 2674 y: newY, 2675 axis, 2676 dataRef, 2677 pointerType 2678 })); 2679 }); 2680 const handleReferenceEnterOrMove = useStableCallback((event) => { 2681 if (!open) { 2682 setReference(event.clientX, event.clientY, event.currentTarget); 2683 } else if (!cleanupListenerRef.current) { 2684 setReference(event.clientX, event.clientY, event.currentTarget); 2685 setReactive([]); 2686 } 2687 }); 2688 const openCheck = isMouseLikePointerType(pointerType) ? floating : open; 2689 React17.useEffect(() => { 2690 if (!enabled) { 2691 resetReference(domReference); 2692 return void 0; 2693 } 2694 if (!openCheck) { 2695 return void 0; 2696 } 2697 function cleanupListener() { 2698 cleanupListenerRef.current?.(); 2699 cleanupListenerRef.current = null; 2700 } 2701 const win = getWindow(floating); 2702 function handleMouseMove(event) { 2703 const target = getTarget(event); 2704 if (!contains(floating, target)) { 2705 setReference(event.clientX, event.clientY); 2706 } else { 2707 cleanupListener(); 2708 } 2709 } 2710 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 2711 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 2712 } else { 2713 resetReference(domReference); 2714 } 2715 return cleanupListener; 2716 }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]); 2717 React17.useEffect(() => () => { 2718 store2.set("positionReference", null); 2719 }, [store2]); 2720 React17.useEffect(() => { 2721 if (enabled && !floating) { 2722 initialRef.current = false; 2723 } 2724 }, [enabled, floating]); 2725 React17.useEffect(() => { 2726 if (!enabled && open) { 2727 initialRef.current = true; 2728 } 2729 }, [enabled, open]); 2730 const reference = React17.useMemo(() => { 2731 function setPointerTypeRef(event) { 2732 setPointerType(event.pointerType); 2733 } 2734 return { 2735 onPointerDown: setPointerTypeRef, 2736 onPointerEnter: setPointerTypeRef, 2737 onMouseMove: handleReferenceEnterOrMove, 2738 onMouseEnter: handleReferenceEnterOrMove 2739 }; 2740 }, [handleReferenceEnterOrMove]); 2741 return React17.useMemo(() => enabled ? { 2742 reference, 2743 trigger: reference 2744 } : {}, [enabled, reference]); 2745 } 2746 2747 // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs 2748 var React18 = __toESM(require_react(), 1); 2749 function alwaysFalse() { 2750 return false; 2751 } 2752 function normalizeProp(normalizable) { 2753 return { 2754 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 2755 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 2756 }; 2757 } 2758 function useDismiss(context, props = {}) { 2759 const { 2760 enabled = true, 2761 escapeKey: escapeKey2 = true, 2762 outsidePress: outsidePressProp = true, 2763 outsidePressEvent = "sloppy", 2764 referencePress = alwaysFalse, 2765 bubbles, 2766 externalTree 2767 } = props; 2768 const store2 = "rootStore" in context ? context.rootStore : context; 2769 const open = store2.useState("open"); 2770 const floatingElement = store2.useState("floatingElement"); 2771 const { 2772 dataRef 2773 } = store2.context; 2774 const tree = useFloatingTree(externalTree); 2775 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 2776 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 2777 const outsidePressEnabled = outsidePress2 !== false; 2778 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 2779 const { 2780 escapeKey: escapeKeyBubbles, 2781 outsidePress: outsidePressBubbles 2782 } = normalizeProp(bubbles); 2783 const pressStartedInsideRef = React18.useRef(false); 2784 const pressStartPreventedRef = React18.useRef(false); 2785 const suppressNextOutsideClickRef = React18.useRef(false); 2786 const isComposingRef = React18.useRef(false); 2787 const currentPointerTypeRef = React18.useRef(""); 2788 const touchStateRef = React18.useRef(null); 2789 const cancelDismissOnEndTimeout = useTimeout(); 2790 const clearInsideReactTreeTimeout = useTimeout(); 2791 const clearInsideReactTree = useStableCallback(() => { 2792 clearInsideReactTreeTimeout.clear(); 2793 dataRef.current.insideReactTree = false; 2794 }); 2795 const hasBlockingChild = useStableCallback((bubbleKey) => { 2796 const nodeId = dataRef.current.floatingContext?.nodeId; 2797 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 2798 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); 2799 }); 2800 const isEventWithinOwnElements = useStableCallback((event) => { 2801 return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement")); 2802 }); 2803 const closeOnReferencePress = useStableCallback((event) => { 2804 if (!referencePress()) { 2805 return; 2806 } 2807 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 2808 }); 2809 const closeOnEscapeKeyDown = useStableCallback((event) => { 2810 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") { 2811 return; 2812 } 2813 if (isComposingRef.current) { 2814 return; 2815 } 2816 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { 2817 return; 2818 } 2819 const native = isReactEvent(event) ? event.nativeEvent : event; 2820 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 2821 store2.setOpen(false, eventDetails); 2822 if (!eventDetails.isCanceled) { 2823 event.preventDefault(); 2824 } 2825 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 2826 event.stopPropagation(); 2827 } 2828 }); 2829 const markInsideReactTree = useStableCallback(() => { 2830 dataRef.current.insideReactTree = true; 2831 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 2832 }); 2833 const markPressStartedInsideReactTree = useStableCallback((event) => { 2834 if (!open || !enabled || event.button !== 0) { 2835 return; 2836 } 2837 const target = getTarget(event.nativeEvent); 2838 if (!contains(store2.select("floatingElement"), target)) { 2839 return; 2840 } 2841 if (!pressStartedInsideRef.current) { 2842 pressStartedInsideRef.current = true; 2843 pressStartPreventedRef.current = false; 2844 } 2845 }); 2846 const markInsidePressStartPrevented = useStableCallback((event) => { 2847 if (!open || !enabled) { 2848 return; 2849 } 2850 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 2851 return; 2852 } 2853 if (pressStartedInsideRef.current) { 2854 pressStartPreventedRef.current = true; 2855 } 2856 }); 2857 React18.useEffect(() => { 2858 if (!open || !enabled) { 2859 return void 0; 2860 } 2861 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 2862 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 2863 const compositionTimeout = new Timeout(); 2864 const preventedPressSuppressionTimeout = new Timeout(); 2865 function handleCompositionStart() { 2866 compositionTimeout.clear(); 2867 isComposingRef.current = true; 2868 } 2869 function handleCompositionEnd() { 2870 compositionTimeout.start( 2871 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 2872 // Only apply to WebKit for the test to remain 0ms. 2873 parts_exports.engine.webkit ? 5 : 0, 2874 () => { 2875 isComposingRef.current = false; 2876 } 2877 ); 2878 } 2879 function suppressImmediateOutsideClickAfterPreventedStart() { 2880 suppressNextOutsideClickRef.current = true; 2881 preventedPressSuppressionTimeout.start(0, () => { 2882 suppressNextOutsideClickRef.current = false; 2883 }); 2884 } 2885 function resetPressStartState() { 2886 pressStartedInsideRef.current = false; 2887 pressStartPreventedRef.current = false; 2888 } 2889 function getOutsidePressEvent() { 2890 const type = currentPointerTypeRef.current; 2891 const computedType = type === "pen" || !type ? "mouse" : type; 2892 const outsidePressEventValue = getOutsidePressEventProp(); 2893 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 2894 if (typeof resolved === "string") { 2895 return resolved; 2896 } 2897 return resolved[computedType]; 2898 } 2899 function shouldIgnoreEvent(event) { 2900 const computedOutsidePressEvent = getOutsidePressEvent(); 2901 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 2902 } 2903 function isEventWithinFloatingTree(event) { 2904 const nodeId = dataRef.current.floatingContext?.nodeId; 2905 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 2906 return isEventWithinOwnElements(event) || targetIsInsideChildren; 2907 } 2908 function closeOnPressOutside(event) { 2909 if (shouldIgnoreEvent(event)) { 2910 if (event.type !== "click" && !isEventWithinOwnElements(event)) { 2911 preventedPressSuppressionTimeout.clear(); 2912 suppressNextOutsideClickRef.current = false; 2913 } 2914 clearInsideReactTree(); 2915 return; 2916 } 2917 if (dataRef.current.insideReactTree) { 2918 clearInsideReactTree(); 2919 return; 2920 } 2921 const target = getTarget(event); 2922 const inertSelector = `[$createAttribute("inert")}]`; 2923 const targetRoot = isElement(target) ? target.getRootNode() : null; 2924 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector)); 2925 const triggers = store2.context.triggerElements; 2926 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 2927 return; 2928 } 2929 let targetRootAncestor = isElement(target) ? target : null; 2930 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 2931 const nextParent = getParentNode(targetRootAncestor); 2932 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 2933 break; 2934 } 2935 targetRootAncestor = nextParent; 2936 } 2937 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 2938 !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the 2939 // element was injected after the floating element rendered. 2940 markers.every((marker) => !contains(targetRootAncestor, marker))) { 2941 return; 2942 } 2943 if (isHTMLElement(target) && !("touches" in event)) { 2944 const lastTraversableNode = isLastTraversableNode(target); 2945 const style = getComputedStyle2(target); 2946 const scrollRe = /auto|scroll/; 2947 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 2948 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 2949 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 2950 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 2951 const isRTL3 = style.direction === "rtl"; 2952 const pressedVerticalScrollbar = canScrollY && (isRTL3 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 2953 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 2954 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 2955 return; 2956 } 2957 } 2958 if (isEventWithinFloatingTree(event)) { 2959 return; 2960 } 2961 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) { 2962 preventedPressSuppressionTimeout.clear(); 2963 suppressNextOutsideClickRef.current = false; 2964 return; 2965 } 2966 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 2967 return; 2968 } 2969 if (hasBlockingChild("__outsidePressBubbles")) { 2970 return; 2971 } 2972 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 2973 clearInsideReactTree(); 2974 } 2975 function handlePointerDown(event) { 2976 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { 2977 return; 2978 } 2979 closeOnPressOutside(event); 2980 } 2981 function handleTouchStart(event) { 2982 if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { 2983 return; 2984 } 2985 const touch = event.touches[0]; 2986 if (touch) { 2987 touchStateRef.current = { 2988 startTime: Date.now(), 2989 startX: touch.clientX, 2990 startY: touch.clientY, 2991 dismissOnTouchEnd: false, 2992 dismissOnMouseDown: true 2993 }; 2994 cancelDismissOnEndTimeout.start(1e3, () => { 2995 if (touchStateRef.current) { 2996 touchStateRef.current.dismissOnTouchEnd = false; 2997 touchStateRef.current.dismissOnMouseDown = false; 2998 } 2999 }); 3000 } 3001 } 3002 function addTargetEventListenerOnce(event, listener) { 3003 const target = getTarget(event); 3004 if (!target) { 3005 return; 3006 } 3007 const unsubscribe2 = addEventListener(target, event.type, () => { 3008 listener(event); 3009 unsubscribe2(); 3010 }); 3011 } 3012 function handleTouchStartCapture(event) { 3013 currentPointerTypeRef.current = "touch"; 3014 addTargetEventListenerOnce(event, handleTouchStart); 3015 } 3016 function closeOnPressOutsideCapture(event) { 3017 cancelDismissOnEndTimeout.clear(); 3018 if (event.type === "pointerdown") { 3019 currentPointerTypeRef.current = event.pointerType; 3020 } 3021 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 3022 return; 3023 } 3024 addTargetEventListenerOnce(event, (targetEvent) => { 3025 if (targetEvent.type === "pointerdown") { 3026 handlePointerDown(targetEvent); 3027 } else { 3028 closeOnPressOutside(targetEvent); 3029 } 3030 }); 3031 } 3032 function handlePressEndCapture(event) { 3033 if (!pressStartedInsideRef.current) { 3034 return; 3035 } 3036 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 3037 resetPressStartState(); 3038 if (getOutsidePressEvent() !== "intentional") { 3039 return; 3040 } 3041 if (event.type === "pointercancel") { 3042 if (pressStartedInsideDefaultPrevented) { 3043 suppressImmediateOutsideClickAfterPreventedStart(); 3044 } 3045 return; 3046 } 3047 if (isEventWithinFloatingTree(event)) { 3048 return; 3049 } 3050 if (pressStartedInsideDefaultPrevented) { 3051 suppressImmediateOutsideClickAfterPreventedStart(); 3052 return; 3053 } 3054 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 3055 return; 3056 } 3057 preventedPressSuppressionTimeout.clear(); 3058 suppressNextOutsideClickRef.current = true; 3059 clearInsideReactTree(); 3060 } 3061 function handleTouchMove(event) { 3062 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 3063 return; 3064 } 3065 const touch = event.touches[0]; 3066 if (!touch) { 3067 return; 3068 } 3069 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 3070 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 3071 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 3072 if (distance > 5) { 3073 touchStateRef.current.dismissOnTouchEnd = true; 3074 } 3075 if (distance > 10) { 3076 closeOnPressOutside(event); 3077 cancelDismissOnEndTimeout.clear(); 3078 touchStateRef.current = null; 3079 } 3080 } 3081 function handleTouchMoveCapture(event) { 3082 addTargetEventListenerOnce(event, handleTouchMove); 3083 } 3084 function handleTouchEnd(event) { 3085 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 3086 return; 3087 } 3088 if (touchStateRef.current.dismissOnTouchEnd) { 3089 closeOnPressOutside(event); 3090 } 3091 cancelDismissOnEndTimeout.clear(); 3092 touchStateRef.current = null; 3093 } 3094 function handleTouchEndCapture(event) { 3095 addTargetEventListenerOnce(event, handleTouchEnd); 3096 } 3097 const doc = ownerDocument(floatingElement); 3098 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))); 3099 return () => { 3100 unsubscribe(); 3101 compositionTimeout.clear(); 3102 preventedPressSuppressionTimeout.clear(); 3103 resetPressStartState(); 3104 suppressNextOutsideClickRef.current = false; 3105 }; 3106 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout]); 3107 React18.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]); 3108 const reference = React18.useMemo(() => ({ 3109 onKeyDown: closeOnEscapeKeyDown, 3110 onPointerDown: closeOnReferencePress, 3111 onClick: closeOnReferencePress 3112 }), [closeOnEscapeKeyDown, closeOnReferencePress]); 3113 const floating = React18.useMemo(() => ({ 3114 onKeyDown: closeOnEscapeKeyDown, 3115 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 3116 // `onPointerDown`, such as with <NumberField.ScrubArea>. 3117 // See https://github.com/mui/base-ui/pull/3379 3118 onPointerDown: markInsidePressStartPrevented, 3119 onMouseDown: markInsidePressStartPrevented, 3120 onClickCapture: markInsideReactTree, 3121 onMouseDownCapture(event) { 3122 markInsideReactTree(); 3123 markPressStartedInsideReactTree(event); 3124 }, 3125 onPointerDownCapture(event) { 3126 markInsideReactTree(); 3127 markPressStartedInsideReactTree(event); 3128 }, 3129 onMouseUpCapture: markInsideReactTree, 3130 onTouchEndCapture: markInsideReactTree, 3131 onTouchMoveCapture: markInsideReactTree 3132 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 3133 return React18.useMemo(() => enabled ? { 3134 reference, 3135 floating, 3136 trigger: reference 3137 } : {}, [enabled, reference, floating]); 3138 } 3139 3140 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 3141 var React25 = __toESM(require_react(), 1); 3142 3143 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs 3144 function computeCoordsFromPlacement(_ref, placement, rtl) { 3145 let { 3146 reference, 3147 floating 3148 } = _ref; 3149 const sideAxis = getSideAxis(placement); 3150 const alignmentAxis = getAlignmentAxis(placement); 3151 const alignLength = getAxisLength(alignmentAxis); 3152 const side = getSide(placement); 3153 const isVertical = sideAxis === "y"; 3154 const commonX = reference.x + reference.width / 2 - floating.width / 2; 3155 const commonY = reference.y + reference.height / 2 - floating.height / 2; 3156 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 3157 let coords; 3158 switch (side) { 3159 case "top": 3160 coords = { 3161 x: commonX, 3162 y: reference.y - floating.height 3163 }; 3164 break; 3165 case "bottom": 3166 coords = { 3167 x: commonX, 3168 y: reference.y + reference.height 3169 }; 3170 break; 3171 case "right": 3172 coords = { 3173 x: reference.x + reference.width, 3174 y: commonY 3175 }; 3176 break; 3177 case "left": 3178 coords = { 3179 x: reference.x - floating.width, 3180 y: commonY 3181 }; 3182 break; 3183 default: 3184 coords = { 3185 x: reference.x, 3186 y: reference.y 3187 }; 3188 } 3189 switch (getAlignment(placement)) { 3190 case "start": 3191 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 3192 break; 3193 case "end": 3194 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 3195 break; 3196 } 3197 return coords; 3198 } 3199 async function detectOverflow(state, options) { 3200 var _await$platform$isEle; 3201 if (options === void 0) { 3202 options = {}; 3203 } 3204 const { 3205 x, 3206 y, 3207 platform: platform3, 3208 rects, 3209 elements, 3210 strategy 3211 } = state; 3212 const { 3213 boundary = "clippingAncestors", 3214 rootBoundary = "viewport", 3215 elementContext = "floating", 3216 altBoundary = false, 3217 padding = 0 3218 } = evaluate(options, state); 3219 const paddingObject = getPaddingObject(padding); 3220 const altContext = elementContext === "floating" ? "reference" : "floating"; 3221 const element = elements[altBoundary ? altContext : elementContext]; 3222 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 3223 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)), 3224 boundary, 3225 rootBoundary, 3226 strategy 3227 })); 3228 const rect = elementContext === "floating" ? { 3229 x, 3230 y, 3231 width: rects.floating.width, 3232 height: rects.floating.height 3233 } : rects.reference; 3234 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); 3235 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 3236 x: 1, 3237 y: 1 3238 } : { 3239 x: 1, 3240 y: 1 3241 }; 3242 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 3243 elements, 3244 rect, 3245 offsetParent, 3246 strategy 3247 }) : rect); 3248 return { 3249 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 3250 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 3251 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 3252 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 3253 }; 3254 } 3255 var MAX_RESET_COUNT = 50; 3256 var computePosition = async (reference, floating, config) => { 3257 const { 3258 placement = "bottom", 3259 strategy = "absolute", 3260 middleware = [], 3261 platform: platform3 3262 } = config; 3263 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 3264 ...platform3, 3265 detectOverflow 3266 }; 3267 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 3268 let rects = await platform3.getElementRects({ 3269 reference, 3270 floating, 3271 strategy 3272 }); 3273 let { 3274 x, 3275 y 3276 } = computeCoordsFromPlacement(rects, placement, rtl); 3277 let statefulPlacement = placement; 3278 let resetCount = 0; 3279 const middlewareData = {}; 3280 for (let i = 0; i < middleware.length; i++) { 3281 const currentMiddleware = middleware[i]; 3282 if (!currentMiddleware) { 3283 continue; 3284 } 3285 const { 3286 name, 3287 fn 3288 } = currentMiddleware; 3289 const { 3290 x: nextX, 3291 y: nextY, 3292 data, 3293 reset 3294 } = await fn({ 3295 x, 3296 y, 3297 initialPlacement: placement, 3298 placement: statefulPlacement, 3299 strategy, 3300 middlewareData, 3301 rects, 3302 platform: platformWithDetectOverflow, 3303 elements: { 3304 reference, 3305 floating 3306 } 3307 }); 3308 x = nextX != null ? nextX : x; 3309 y = nextY != null ? nextY : y; 3310 middlewareData[name] = { 3311 ...middlewareData[name], 3312 ...data 3313 }; 3314 if (reset && resetCount < MAX_RESET_COUNT) { 3315 resetCount++; 3316 if (typeof reset === "object") { 3317 if (reset.placement) { 3318 statefulPlacement = reset.placement; 3319 } 3320 if (reset.rects) { 3321 rects = reset.rects === true ? await platform3.getElementRects({ 3322 reference, 3323 floating, 3324 strategy 3325 }) : reset.rects; 3326 } 3327 ({ 3328 x, 3329 y 3330 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 3331 } 3332 i = -1; 3333 } 3334 } 3335 return { 3336 x, 3337 y, 3338 placement: statefulPlacement, 3339 strategy, 3340 middlewareData 3341 }; 3342 }; 3343 var flip = function(options) { 3344 if (options === void 0) { 3345 options = {}; 3346 } 3347 return { 3348 name: "flip", 3349 options, 3350 async fn(state) { 3351 var _middlewareData$arrow, _middlewareData$flip; 3352 const { 3353 placement, 3354 middlewareData, 3355 rects, 3356 initialPlacement, 3357 platform: platform3, 3358 elements 3359 } = state; 3360 const { 3361 mainAxis: checkMainAxis = true, 3362 crossAxis: checkCrossAxis = true, 3363 fallbackPlacements: specifiedFallbackPlacements, 3364 fallbackStrategy = "bestFit", 3365 fallbackAxisSideDirection = "none", 3366 flipAlignment = true, 3367 ...detectOverflowOptions 3368 } = evaluate(options, state); 3369 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 3370 return {}; 3371 } 3372 const side = getSide(placement); 3373 const initialSideAxis = getSideAxis(initialPlacement); 3374 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 3375 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 3376 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 3377 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 3378 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 3379 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 3380 } 3381 const placements2 = [initialPlacement, ...fallbackPlacements]; 3382 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3383 const overflows = []; 3384 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 3385 if (checkMainAxis) { 3386 overflows.push(overflow[side]); 3387 } 3388 if (checkCrossAxis) { 3389 const sides2 = getAlignmentSides(placement, rects, rtl); 3390 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 3391 } 3392 overflowsData = [...overflowsData, { 3393 placement, 3394 overflows 3395 }]; 3396 if (!overflows.every((side2) => side2 <= 0)) { 3397 var _middlewareData$flip2, _overflowsData$filter; 3398 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 3399 const nextPlacement = placements2[nextIndex]; 3400 if (nextPlacement) { 3401 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 3402 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 3403 // overflows the main axis. 3404 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { 3405 return { 3406 data: { 3407 index: nextIndex, 3408 overflows: overflowsData 3409 }, 3410 reset: { 3411 placement: nextPlacement 3412 } 3413 }; 3414 } 3415 } 3416 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; 3417 if (!resetPlacement) { 3418 switch (fallbackStrategy) { 3419 case "bestFit": { 3420 var _overflowsData$filter2; 3421 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { 3422 if (hasFallbackAxisSideDirection) { 3423 const currentSideAxis = getSideAxis(d.placement); 3424 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 3425 // reading directions favoring greater width. 3426 currentSideAxis === "y"; 3427 } 3428 return true; 3429 }).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]; 3430 if (placement2) { 3431 resetPlacement = placement2; 3432 } 3433 break; 3434 } 3435 case "initialPlacement": 3436 resetPlacement = initialPlacement; 3437 break; 3438 } 3439 } 3440 if (placement !== resetPlacement) { 3441 return { 3442 reset: { 3443 placement: resetPlacement 3444 } 3445 }; 3446 } 3447 } 3448 return {}; 3449 } 3450 }; 3451 }; 3452 function getSideOffsets(overflow, rect) { 3453 return { 3454 top: overflow.top - rect.height, 3455 right: overflow.right - rect.width, 3456 bottom: overflow.bottom - rect.height, 3457 left: overflow.left - rect.width 3458 }; 3459 } 3460 function isAnySideFullyClipped(overflow) { 3461 return sides.some((side) => overflow[side] >= 0); 3462 } 3463 var hide = function(options) { 3464 if (options === void 0) { 3465 options = {}; 3466 } 3467 return { 3468 name: "hide", 3469 options, 3470 async fn(state) { 3471 const { 3472 rects, 3473 platform: platform3 3474 } = state; 3475 const { 3476 strategy = "referenceHidden", 3477 ...detectOverflowOptions 3478 } = evaluate(options, state); 3479 switch (strategy) { 3480 case "referenceHidden": { 3481 const overflow = await platform3.detectOverflow(state, { 3482 ...detectOverflowOptions, 3483 elementContext: "reference" 3484 }); 3485 const offsets = getSideOffsets(overflow, rects.reference); 3486 return { 3487 data: { 3488 referenceHiddenOffsets: offsets, 3489 referenceHidden: isAnySideFullyClipped(offsets) 3490 } 3491 }; 3492 } 3493 case "escaped": { 3494 const overflow = await platform3.detectOverflow(state, { 3495 ...detectOverflowOptions, 3496 altBoundary: true 3497 }); 3498 const offsets = getSideOffsets(overflow, rects.floating); 3499 return { 3500 data: { 3501 escapedOffsets: offsets, 3502 escaped: isAnySideFullyClipped(offsets) 3503 } 3504 }; 3505 } 3506 default: { 3507 return {}; 3508 } 3509 } 3510 } 3511 }; 3512 }; 3513 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 3514 async function convertValueToCoords(state, options) { 3515 const { 3516 placement, 3517 platform: platform3, 3518 elements 3519 } = state; 3520 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 3521 const side = getSide(placement); 3522 const alignment = getAlignment(placement); 3523 const isVertical = getSideAxis(placement) === "y"; 3524 const mainAxisMulti = originSides.has(side) ? -1 : 1; 3525 const crossAxisMulti = rtl && isVertical ? -1 : 1; 3526 const rawValue = evaluate(options, state); 3527 let { 3528 mainAxis, 3529 crossAxis, 3530 alignmentAxis 3531 } = typeof rawValue === "number" ? { 3532 mainAxis: rawValue, 3533 crossAxis: 0, 3534 alignmentAxis: null 3535 } : { 3536 mainAxis: rawValue.mainAxis || 0, 3537 crossAxis: rawValue.crossAxis || 0, 3538 alignmentAxis: rawValue.alignmentAxis 3539 }; 3540 if (alignment && typeof alignmentAxis === "number") { 3541 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 3542 } 3543 return isVertical ? { 3544 x: crossAxis * crossAxisMulti, 3545 y: mainAxis * mainAxisMulti 3546 } : { 3547 x: mainAxis * mainAxisMulti, 3548 y: crossAxis * crossAxisMulti 3549 }; 3550 } 3551 var offset = function(options) { 3552 if (options === void 0) { 3553 options = 0; 3554 } 3555 return { 3556 name: "offset", 3557 options, 3558 async fn(state) { 3559 var _middlewareData$offse, _middlewareData$arrow; 3560 const { 3561 x, 3562 y, 3563 placement, 3564 middlewareData 3565 } = state; 3566 const diffCoords = await convertValueToCoords(state, options); 3567 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 3568 return {}; 3569 } 3570 return { 3571 x: x + diffCoords.x, 3572 y: y + diffCoords.y, 3573 data: { 3574 ...diffCoords, 3575 placement 3576 } 3577 }; 3578 } 3579 }; 3580 }; 3581 var shift = function(options) { 3582 if (options === void 0) { 3583 options = {}; 3584 } 3585 return { 3586 name: "shift", 3587 options, 3588 async fn(state) { 3589 const { 3590 x, 3591 y, 3592 placement, 3593 platform: platform3 3594 } = state; 3595 const { 3596 mainAxis: checkMainAxis = true, 3597 crossAxis: checkCrossAxis = false, 3598 limiter = { 3599 fn: (_ref) => { 3600 let { 3601 x: x2, 3602 y: y2 3603 } = _ref; 3604 return { 3605 x: x2, 3606 y: y2 3607 }; 3608 } 3609 }, 3610 ...detectOverflowOptions 3611 } = evaluate(options, state); 3612 const coords = { 3613 x, 3614 y 3615 }; 3616 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3617 const crossAxis = getSideAxis(getSide(placement)); 3618 const mainAxis = getOppositeAxis(crossAxis); 3619 let mainAxisCoord = coords[mainAxis]; 3620 let crossAxisCoord = coords[crossAxis]; 3621 if (checkMainAxis) { 3622 const minSide = mainAxis === "y" ? "top" : "left"; 3623 const maxSide = mainAxis === "y" ? "bottom" : "right"; 3624 const min2 = mainAxisCoord + overflow[minSide]; 3625 const max2 = mainAxisCoord - overflow[maxSide]; 3626 mainAxisCoord = clamp(min2, mainAxisCoord, max2); 3627 } 3628 if (checkCrossAxis) { 3629 const minSide = crossAxis === "y" ? "top" : "left"; 3630 const maxSide = crossAxis === "y" ? "bottom" : "right"; 3631 const min2 = crossAxisCoord + overflow[minSide]; 3632 const max2 = crossAxisCoord - overflow[maxSide]; 3633 crossAxisCoord = clamp(min2, crossAxisCoord, max2); 3634 } 3635 const limitedCoords = limiter.fn({ 3636 ...state, 3637 [mainAxis]: mainAxisCoord, 3638 [crossAxis]: crossAxisCoord 3639 }); 3640 return { 3641 ...limitedCoords, 3642 data: { 3643 x: limitedCoords.x - x, 3644 y: limitedCoords.y - y, 3645 enabled: { 3646 [mainAxis]: checkMainAxis, 3647 [crossAxis]: checkCrossAxis 3648 } 3649 } 3650 }; 3651 } 3652 }; 3653 }; 3654 var limitShift = function(options) { 3655 if (options === void 0) { 3656 options = {}; 3657 } 3658 return { 3659 options, 3660 fn(state) { 3661 const { 3662 x, 3663 y, 3664 placement, 3665 rects, 3666 middlewareData 3667 } = state; 3668 const { 3669 offset: offset4 = 0, 3670 mainAxis: checkMainAxis = true, 3671 crossAxis: checkCrossAxis = true 3672 } = evaluate(options, state); 3673 const coords = { 3674 x, 3675 y 3676 }; 3677 const crossAxis = getSideAxis(placement); 3678 const mainAxis = getOppositeAxis(crossAxis); 3679 let mainAxisCoord = coords[mainAxis]; 3680 let crossAxisCoord = coords[crossAxis]; 3681 const rawOffset = evaluate(offset4, state); 3682 const computedOffset = typeof rawOffset === "number" ? { 3683 mainAxis: rawOffset, 3684 crossAxis: 0 3685 } : { 3686 mainAxis: 0, 3687 crossAxis: 0, 3688 ...rawOffset 3689 }; 3690 if (checkMainAxis) { 3691 const len = mainAxis === "y" ? "height" : "width"; 3692 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 3693 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 3694 if (mainAxisCoord < limitMin) { 3695 mainAxisCoord = limitMin; 3696 } else if (mainAxisCoord > limitMax) { 3697 mainAxisCoord = limitMax; 3698 } 3699 } 3700 if (checkCrossAxis) { 3701 var _middlewareData$offse, _middlewareData$offse2; 3702 const len = mainAxis === "y" ? "width" : "height"; 3703 const isOriginSide = originSides.has(getSide(placement)); 3704 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); 3705 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); 3706 if (crossAxisCoord < limitMin) { 3707 crossAxisCoord = limitMin; 3708 } else if (crossAxisCoord > limitMax) { 3709 crossAxisCoord = limitMax; 3710 } 3711 } 3712 return { 3713 [mainAxis]: mainAxisCoord, 3714 [crossAxis]: crossAxisCoord 3715 }; 3716 } 3717 }; 3718 }; 3719 var size = function(options) { 3720 if (options === void 0) { 3721 options = {}; 3722 } 3723 return { 3724 name: "size", 3725 options, 3726 async fn(state) { 3727 var _state$middlewareData, _state$middlewareData2; 3728 const { 3729 placement, 3730 rects, 3731 platform: platform3, 3732 elements 3733 } = state; 3734 const { 3735 apply = () => { 3736 }, 3737 ...detectOverflowOptions 3738 } = evaluate(options, state); 3739 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3740 const side = getSide(placement); 3741 const alignment = getAlignment(placement); 3742 const isYAxis = getSideAxis(placement) === "y"; 3743 const { 3744 width, 3745 height 3746 } = rects.floating; 3747 let heightSide; 3748 let widthSide; 3749 if (side === "top" || side === "bottom") { 3750 heightSide = side; 3751 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; 3752 } else { 3753 widthSide = side; 3754 heightSide = alignment === "end" ? "top" : "bottom"; 3755 } 3756 const maximumClippingHeight = height - overflow.top - overflow.bottom; 3757 const maximumClippingWidth = width - overflow.left - overflow.right; 3758 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 3759 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 3760 const noShift = !state.middlewareData.shift; 3761 let availableHeight = overflowAvailableHeight; 3762 let availableWidth = overflowAvailableWidth; 3763 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { 3764 availableWidth = maximumClippingWidth; 3765 } 3766 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { 3767 availableHeight = maximumClippingHeight; 3768 } 3769 if (noShift && !alignment) { 3770 const xMin = max(overflow.left, 0); 3771 const xMax = max(overflow.right, 0); 3772 const yMin = max(overflow.top, 0); 3773 const yMax = max(overflow.bottom, 0); 3774 if (isYAxis) { 3775 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); 3776 } else { 3777 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); 3778 } 3779 } 3780 await apply({ 3781 ...state, 3782 availableWidth, 3783 availableHeight 3784 }); 3785 const nextDimensions = await platform3.getDimensions(elements.floating); 3786 if (width !== nextDimensions.width || height !== nextDimensions.height) { 3787 return { 3788 reset: { 3789 rects: true 3790 } 3791 }; 3792 } 3793 return {}; 3794 } 3795 }; 3796 }; 3797 3798 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 3799 function getCssDimensions(element) { 3800 const css = getComputedStyle2(element); 3801 let width = parseFloat(css.width) || 0; 3802 let height = parseFloat(css.height) || 0; 3803 const hasOffset = isHTMLElement(element); 3804 const offsetWidth = hasOffset ? element.offsetWidth : width; 3805 const offsetHeight = hasOffset ? element.offsetHeight : height; 3806 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 3807 if (shouldFallback) { 3808 width = offsetWidth; 3809 height = offsetHeight; 3810 } 3811 return { 3812 width, 3813 height, 3814 $: shouldFallback 3815 }; 3816 } 3817 function unwrapElement(element) { 3818 return !isElement(element) ? element.contextElement : element; 3819 } 3820 function getScale(element) { 3821 const domElement = unwrapElement(element); 3822 if (!isHTMLElement(domElement)) { 3823 return createCoords(1); 3824 } 3825 const rect = domElement.getBoundingClientRect(); 3826 const { 3827 width, 3828 height, 3829 $ 3830 } = getCssDimensions(domElement); 3831 let x = ($ ? round(rect.width) : rect.width) / width; 3832 let y = ($ ? round(rect.height) : rect.height) / height; 3833 if (!x || !Number.isFinite(x)) { 3834 x = 1; 3835 } 3836 if (!y || !Number.isFinite(y)) { 3837 y = 1; 3838 } 3839 return { 3840 x, 3841 y 3842 }; 3843 } 3844 var noOffsets = /* @__PURE__ */ createCoords(0); 3845 function getVisualOffsets(element) { 3846 const win = getWindow(element); 3847 if (!isWebKit() || !win.visualViewport) { 3848 return noOffsets; 3849 } 3850 return { 3851 x: win.visualViewport.offsetLeft, 3852 y: win.visualViewport.offsetTop 3853 }; 3854 } 3855 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 3856 if (isFixed === void 0) { 3857 isFixed = false; 3858 } 3859 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 3860 return false; 3861 } 3862 return isFixed; 3863 } 3864 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 3865 if (includeScale === void 0) { 3866 includeScale = false; 3867 } 3868 if (isFixedStrategy === void 0) { 3869 isFixedStrategy = false; 3870 } 3871 const clientRect = element.getBoundingClientRect(); 3872 const domElement = unwrapElement(element); 3873 let scale = createCoords(1); 3874 if (includeScale) { 3875 if (offsetParent) { 3876 if (isElement(offsetParent)) { 3877 scale = getScale(offsetParent); 3878 } 3879 } else { 3880 scale = getScale(element); 3881 } 3882 } 3883 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 3884 let x = (clientRect.left + visualOffsets.x) / scale.x; 3885 let y = (clientRect.top + visualOffsets.y) / scale.y; 3886 let width = clientRect.width / scale.x; 3887 let height = clientRect.height / scale.y; 3888 if (domElement) { 3889 const win = getWindow(domElement); 3890 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 3891 let currentWin = win; 3892 let currentIFrame = getFrameElement(currentWin); 3893 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 3894 const iframeScale = getScale(currentIFrame); 3895 const iframeRect = currentIFrame.getBoundingClientRect(); 3896 const css = getComputedStyle2(currentIFrame); 3897 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 3898 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 3899 x *= iframeScale.x; 3900 y *= iframeScale.y; 3901 width *= iframeScale.x; 3902 height *= iframeScale.y; 3903 x += left; 3904 y += top; 3905 currentWin = getWindow(currentIFrame); 3906 currentIFrame = getFrameElement(currentWin); 3907 } 3908 } 3909 return rectToClientRect({ 3910 width, 3911 height, 3912 x, 3913 y 3914 }); 3915 } 3916 function getWindowScrollBarX(element, rect) { 3917 const leftScroll = getNodeScroll(element).scrollLeft; 3918 if (!rect) { 3919 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 3920 } 3921 return rect.left + leftScroll; 3922 } 3923 function getHTMLOffset(documentElement, scroll) { 3924 const htmlRect = documentElement.getBoundingClientRect(); 3925 const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 3926 const y = htmlRect.top + scroll.scrollTop; 3927 return { 3928 x, 3929 y 3930 }; 3931 } 3932 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 3933 let { 3934 elements, 3935 rect, 3936 offsetParent, 3937 strategy 3938 } = _ref; 3939 const isFixed = strategy === "fixed"; 3940 const documentElement = getDocumentElement(offsetParent); 3941 const topLayer = elements ? isTopLayer(elements.floating) : false; 3942 if (offsetParent === documentElement || topLayer && isFixed) { 3943 return rect; 3944 } 3945 let scroll = { 3946 scrollLeft: 0, 3947 scrollTop: 0 3948 }; 3949 let scale = createCoords(1); 3950 const offsets = createCoords(0); 3951 const isOffsetParentAnElement = isHTMLElement(offsetParent); 3952 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 3953 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 3954 scroll = getNodeScroll(offsetParent); 3955 } 3956 if (isOffsetParentAnElement) { 3957 const offsetRect = getBoundingClientRect(offsetParent); 3958 scale = getScale(offsetParent); 3959 offsets.x = offsetRect.x + offsetParent.clientLeft; 3960 offsets.y = offsetRect.y + offsetParent.clientTop; 3961 } 3962 } 3963 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 3964 return { 3965 width: rect.width * scale.x, 3966 height: rect.height * scale.y, 3967 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 3968 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 3969 }; 3970 } 3971 function getClientRects(element) { 3972 return Array.from(element.getClientRects()); 3973 } 3974 function getDocumentRect(element) { 3975 const html = getDocumentElement(element); 3976 const scroll = getNodeScroll(element); 3977 const body = element.ownerDocument.body; 3978 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 3979 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 3980 let x = -scroll.scrollLeft + getWindowScrollBarX(element); 3981 const y = -scroll.scrollTop; 3982 if (getComputedStyle2(body).direction === "rtl") { 3983 x += max(html.clientWidth, body.clientWidth) - width; 3984 } 3985 return { 3986 width, 3987 height, 3988 x, 3989 y 3990 }; 3991 } 3992 var SCROLLBAR_MAX = 25; 3993 function getViewportRect(element, strategy) { 3994 const win = getWindow(element); 3995 const html = getDocumentElement(element); 3996 const visualViewport = win.visualViewport; 3997 let width = html.clientWidth; 3998 let height = html.clientHeight; 3999 let x = 0; 4000 let y = 0; 4001 if (visualViewport) { 4002 width = visualViewport.width; 4003 height = visualViewport.height; 4004 const visualViewportBased = isWebKit(); 4005 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 4006 x = visualViewport.offsetLeft; 4007 y = visualViewport.offsetTop; 4008 } 4009 } 4010 const windowScrollbarX = getWindowScrollBarX(html); 4011 if (windowScrollbarX <= 0) { 4012 const doc = html.ownerDocument; 4013 const body = doc.body; 4014 const bodyStyles = getComputedStyle(body); 4015 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 4016 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 4017 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { 4018 width -= clippingStableScrollbarWidth; 4019 } 4020 } else if (windowScrollbarX <= SCROLLBAR_MAX) { 4021 width += windowScrollbarX; 4022 } 4023 return { 4024 width, 4025 height, 4026 x, 4027 y 4028 }; 4029 } 4030 function getInnerBoundingClientRect(element, strategy) { 4031 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 4032 const top = clientRect.top + element.clientTop; 4033 const left = clientRect.left + element.clientLeft; 4034 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 4035 const width = element.clientWidth * scale.x; 4036 const height = element.clientHeight * scale.y; 4037 const x = left * scale.x; 4038 const y = top * scale.y; 4039 return { 4040 width, 4041 height, 4042 x, 4043 y 4044 }; 4045 } 4046 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 4047 let rect; 4048 if (clippingAncestor === "viewport") { 4049 rect = getViewportRect(element, strategy); 4050 } else if (clippingAncestor === "document") { 4051 rect = getDocumentRect(getDocumentElement(element)); 4052 } else if (isElement(clippingAncestor)) { 4053 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 4054 } else { 4055 const visualOffsets = getVisualOffsets(element); 4056 rect = { 4057 x: clippingAncestor.x - visualOffsets.x, 4058 y: clippingAncestor.y - visualOffsets.y, 4059 width: clippingAncestor.width, 4060 height: clippingAncestor.height 4061 }; 4062 } 4063 return rectToClientRect(rect); 4064 } 4065 function hasFixedPositionAncestor(element, stopNode) { 4066 const parentNode = getParentNode(element); 4067 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 4068 return false; 4069 } 4070 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 4071 } 4072 function getClippingElementAncestors(element, cache) { 4073 const cachedResult = cache.get(element); 4074 if (cachedResult) { 4075 return cachedResult; 4076 } 4077 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 4078 let currentContainingBlockComputedStyle = null; 4079 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 4080 let currentNode = elementIsFixed ? getParentNode(element) : element; 4081 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 4082 const computedStyle = getComputedStyle2(currentNode); 4083 const currentNodeIsContaining = isContainingBlock(currentNode); 4084 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 4085 currentContainingBlockComputedStyle = null; 4086 } 4087 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 4088 if (shouldDropCurrentNode) { 4089 result = result.filter((ancestor) => ancestor !== currentNode); 4090 } else { 4091 currentContainingBlockComputedStyle = computedStyle; 4092 } 4093 currentNode = getParentNode(currentNode); 4094 } 4095 cache.set(element, result); 4096 return result; 4097 } 4098 function getClippingRect(_ref) { 4099 let { 4100 element, 4101 boundary, 4102 rootBoundary, 4103 strategy 4104 } = _ref; 4105 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 4106 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 4107 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 4108 let top = firstRect.top; 4109 let right = firstRect.right; 4110 let bottom = firstRect.bottom; 4111 let left = firstRect.left; 4112 for (let i = 1; i < clippingAncestors.length; i++) { 4113 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); 4114 top = max(rect.top, top); 4115 right = min(rect.right, right); 4116 bottom = min(rect.bottom, bottom); 4117 left = max(rect.left, left); 4118 } 4119 return { 4120 width: right - left, 4121 height: bottom - top, 4122 x: left, 4123 y: top 4124 }; 4125 } 4126 function getDimensions(element) { 4127 const { 4128 width, 4129 height 4130 } = getCssDimensions(element); 4131 return { 4132 width, 4133 height 4134 }; 4135 } 4136 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 4137 const isOffsetParentAnElement = isHTMLElement(offsetParent); 4138 const documentElement = getDocumentElement(offsetParent); 4139 const isFixed = strategy === "fixed"; 4140 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 4141 let scroll = { 4142 scrollLeft: 0, 4143 scrollTop: 0 4144 }; 4145 const offsets = createCoords(0); 4146 function setLeftRTLScrollbarOffset() { 4147 offsets.x = getWindowScrollBarX(documentElement); 4148 } 4149 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 4150 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 4151 scroll = getNodeScroll(offsetParent); 4152 } 4153 if (isOffsetParentAnElement) { 4154 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 4155 offsets.x = offsetRect.x + offsetParent.clientLeft; 4156 offsets.y = offsetRect.y + offsetParent.clientTop; 4157 } else if (documentElement) { 4158 setLeftRTLScrollbarOffset(); 4159 } 4160 } 4161 if (isFixed && !isOffsetParentAnElement && documentElement) { 4162 setLeftRTLScrollbarOffset(); 4163 } 4164 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 4165 const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 4166 const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 4167 return { 4168 x, 4169 y, 4170 width: rect.width, 4171 height: rect.height 4172 }; 4173 } 4174 function isStaticPositioned(element) { 4175 return getComputedStyle2(element).position === "static"; 4176 } 4177 function getTrueOffsetParent(element, polyfill) { 4178 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 4179 return null; 4180 } 4181 if (polyfill) { 4182 return polyfill(element); 4183 } 4184 let rawOffsetParent = element.offsetParent; 4185 if (getDocumentElement(element) === rawOffsetParent) { 4186 rawOffsetParent = rawOffsetParent.ownerDocument.body; 4187 } 4188 return rawOffsetParent; 4189 } 4190 function getOffsetParent(element, polyfill) { 4191 const win = getWindow(element); 4192 if (isTopLayer(element)) { 4193 return win; 4194 } 4195 if (!isHTMLElement(element)) { 4196 let svgOffsetParent = getParentNode(element); 4197 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 4198 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 4199 return svgOffsetParent; 4200 } 4201 svgOffsetParent = getParentNode(svgOffsetParent); 4202 } 4203 return win; 4204 } 4205 let offsetParent = getTrueOffsetParent(element, polyfill); 4206 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 4207 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 4208 } 4209 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 4210 return win; 4211 } 4212 return offsetParent || getContainingBlock(element) || win; 4213 } 4214 var getElementRects = async function(data) { 4215 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 4216 const getDimensionsFn = this.getDimensions; 4217 const floatingDimensions = await getDimensionsFn(data.floating); 4218 return { 4219 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 4220 floating: { 4221 x: 0, 4222 y: 0, 4223 width: floatingDimensions.width, 4224 height: floatingDimensions.height 4225 } 4226 }; 4227 }; 4228 function isRTL(element) { 4229 return getComputedStyle2(element).direction === "rtl"; 4230 } 4231 var platform2 = { 4232 convertOffsetParentRelativeRectToViewportRelativeRect, 4233 getDocumentElement, 4234 getClippingRect, 4235 getOffsetParent, 4236 getElementRects, 4237 getClientRects, 4238 getDimensions, 4239 getScale, 4240 isElement, 4241 isRTL 4242 }; 4243 function rectsAreEqual(a, b) { 4244 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; 4245 } 4246 function observeMove(element, onMove) { 4247 let io = null; 4248 let timeoutId; 4249 const root = getDocumentElement(element); 4250 function cleanup() { 4251 var _io; 4252 clearTimeout(timeoutId); 4253 (_io = io) == null || _io.disconnect(); 4254 io = null; 4255 } 4256 function refresh(skip, threshold) { 4257 if (skip === void 0) { 4258 skip = false; 4259 } 4260 if (threshold === void 0) { 4261 threshold = 1; 4262 } 4263 cleanup(); 4264 const elementRectForRootMargin = element.getBoundingClientRect(); 4265 const { 4266 left, 4267 top, 4268 width, 4269 height 4270 } = elementRectForRootMargin; 4271 if (!skip) { 4272 onMove(); 4273 } 4274 if (!width || !height) { 4275 return; 4276 } 4277 const insetTop = floor(top); 4278 const insetRight = floor(root.clientWidth - (left + width)); 4279 const insetBottom = floor(root.clientHeight - (top + height)); 4280 const insetLeft = floor(left); 4281 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 4282 const options = { 4283 rootMargin, 4284 threshold: max(0, min(1, threshold)) || 1 4285 }; 4286 let isFirstUpdate = true; 4287 function handleObserve(entries) { 4288 const ratio = entries[0].intersectionRatio; 4289 if (ratio !== threshold) { 4290 if (!isFirstUpdate) { 4291 return refresh(); 4292 } 4293 if (!ratio) { 4294 timeoutId = setTimeout(() => { 4295 refresh(false, 1e-7); 4296 }, 1e3); 4297 } else { 4298 refresh(false, ratio); 4299 } 4300 } 4301 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 4302 refresh(); 4303 } 4304 isFirstUpdate = false; 4305 } 4306 try { 4307 io = new IntersectionObserver(handleObserve, { 4308 ...options, 4309 // Handle <iframe>s 4310 root: root.ownerDocument 4311 }); 4312 } catch (_e) { 4313 io = new IntersectionObserver(handleObserve, options); 4314 } 4315 io.observe(element); 4316 } 4317 refresh(true); 4318 return cleanup; 4319 } 4320 function autoUpdate(reference, floating, update2, options) { 4321 if (options === void 0) { 4322 options = {}; 4323 } 4324 const { 4325 ancestorScroll = true, 4326 ancestorResize = true, 4327 elementResize = typeof ResizeObserver === "function", 4328 layoutShift = typeof IntersectionObserver === "function", 4329 animationFrame = false 4330 } = options; 4331 const referenceEl = unwrapElement(reference); 4332 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 4333 ancestors.forEach((ancestor) => { 4334 ancestorScroll && ancestor.addEventListener("scroll", update2, { 4335 passive: true 4336 }); 4337 ancestorResize && ancestor.addEventListener("resize", update2); 4338 }); 4339 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null; 4340 let reobserveFrame = -1; 4341 let resizeObserver = null; 4342 if (elementResize) { 4343 resizeObserver = new ResizeObserver((_ref) => { 4344 let [firstEntry] = _ref; 4345 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 4346 resizeObserver.unobserve(floating); 4347 cancelAnimationFrame(reobserveFrame); 4348 reobserveFrame = requestAnimationFrame(() => { 4349 var _resizeObserver; 4350 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 4351 }); 4352 } 4353 update2(); 4354 }); 4355 if (referenceEl && !animationFrame) { 4356 resizeObserver.observe(referenceEl); 4357 } 4358 if (floating) { 4359 resizeObserver.observe(floating); 4360 } 4361 } 4362 let frameId; 4363 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 4364 if (animationFrame) { 4365 frameLoop(); 4366 } 4367 function frameLoop() { 4368 const nextRefRect = getBoundingClientRect(reference); 4369 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 4370 update2(); 4371 } 4372 prevRefRect = nextRefRect; 4373 frameId = requestAnimationFrame(frameLoop); 4374 } 4375 update2(); 4376 return () => { 4377 var _resizeObserver2; 4378 ancestors.forEach((ancestor) => { 4379 ancestorScroll && ancestor.removeEventListener("scroll", update2); 4380 ancestorResize && ancestor.removeEventListener("resize", update2); 4381 }); 4382 cleanupIo == null || cleanupIo(); 4383 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 4384 resizeObserver = null; 4385 if (animationFrame) { 4386 cancelAnimationFrame(frameId); 4387 } 4388 }; 4389 } 4390 var offset2 = offset; 4391 var shift2 = shift; 4392 var flip2 = flip; 4393 var size2 = size; 4394 var hide2 = hide; 4395 var limitShift2 = limitShift; 4396 var computePosition2 = (reference, floating, options) => { 4397 const cache = /* @__PURE__ */ new Map(); 4398 const mergedOptions = { 4399 platform: platform2, 4400 ...options 4401 }; 4402 const platformWithCache = { 4403 ...mergedOptions.platform, 4404 _c: cache 4405 }; 4406 return computePosition(reference, floating, { 4407 ...mergedOptions, 4408 platform: platformWithCache 4409 }); 4410 }; 4411 4412 // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 4413 var React19 = __toESM(require_react(), 1); 4414 var import_react2 = __toESM(require_react(), 1); 4415 var ReactDOM3 = __toESM(require_react_dom(), 1); 4416 var isClient = typeof document !== "undefined"; 4417 var noop2 = function noop3() { 4418 }; 4419 var index = isClient ? import_react2.useLayoutEffect : noop2; 4420 function deepEqual(a, b) { 4421 if (a === b) { 4422 return true; 4423 } 4424 if (typeof a !== typeof b) { 4425 return false; 4426 } 4427 if (typeof a === "function" && a.toString() === b.toString()) { 4428 return true; 4429 } 4430 let length; 4431 let i; 4432 let keys; 4433 if (a && b && typeof a === "object") { 4434 if (Array.isArray(a)) { 4435 length = a.length; 4436 if (length !== b.length) return false; 4437 for (i = length; i-- !== 0; ) { 4438 if (!deepEqual(a[i], b[i])) { 4439 return false; 4440 } 4441 } 4442 return true; 4443 } 4444 keys = Object.keys(a); 4445 length = keys.length; 4446 if (length !== Object.keys(b).length) { 4447 return false; 4448 } 4449 for (i = length; i-- !== 0; ) { 4450 if (!{}.hasOwnProperty.call(b, keys[i])) { 4451 return false; 4452 } 4453 } 4454 for (i = length; i-- !== 0; ) { 4455 const key = keys[i]; 4456 if (key === "_owner" && a.$$typeof) { 4457 continue; 4458 } 4459 if (!deepEqual(a[key], b[key])) { 4460 return false; 4461 } 4462 } 4463 return true; 4464 } 4465 return a !== a && b !== b; 4466 } 4467 function getDPR(element) { 4468 if (typeof window === "undefined") { 4469 return 1; 4470 } 4471 const win = element.ownerDocument.defaultView || window; 4472 return win.devicePixelRatio || 1; 4473 } 4474 function roundByDPR(element, value) { 4475 const dpr = getDPR(element); 4476 return Math.round(value * dpr) / dpr; 4477 } 4478 function useLatestRef(value) { 4479 const ref = React19.useRef(value); 4480 index(() => { 4481 ref.current = value; 4482 }); 4483 return ref; 4484 } 4485 function useFloating(options) { 4486 if (options === void 0) { 4487 options = {}; 4488 } 4489 const { 4490 placement = "bottom", 4491 strategy = "absolute", 4492 middleware = [], 4493 platform: platform3, 4494 elements: { 4495 reference: externalReference, 4496 floating: externalFloating 4497 } = {}, 4498 transform = true, 4499 whileElementsMounted, 4500 open 4501 } = options; 4502 const [data, setData] = React19.useState({ 4503 x: 0, 4504 y: 0, 4505 strategy, 4506 placement, 4507 middlewareData: {}, 4508 isPositioned: false 4509 }); 4510 const [latestMiddleware, setLatestMiddleware] = React19.useState(middleware); 4511 if (!deepEqual(latestMiddleware, middleware)) { 4512 setLatestMiddleware(middleware); 4513 } 4514 const [_reference, _setReference] = React19.useState(null); 4515 const [_floating, _setFloating] = React19.useState(null); 4516 const setReference = React19.useCallback((node) => { 4517 if (node !== referenceRef.current) { 4518 referenceRef.current = node; 4519 _setReference(node); 4520 } 4521 }, []); 4522 const setFloating = React19.useCallback((node) => { 4523 if (node !== floatingRef.current) { 4524 floatingRef.current = node; 4525 _setFloating(node); 4526 } 4527 }, []); 4528 const referenceEl = externalReference || _reference; 4529 const floatingEl = externalFloating || _floating; 4530 const referenceRef = React19.useRef(null); 4531 const floatingRef = React19.useRef(null); 4532 const dataRef = React19.useRef(data); 4533 const hasWhileElementsMounted = whileElementsMounted != null; 4534 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 4535 const platformRef = useLatestRef(platform3); 4536 const openRef = useLatestRef(open); 4537 const update2 = React19.useCallback(() => { 4538 if (!referenceRef.current || !floatingRef.current) { 4539 return; 4540 } 4541 const config = { 4542 placement, 4543 strategy, 4544 middleware: latestMiddleware 4545 }; 4546 if (platformRef.current) { 4547 config.platform = platformRef.current; 4548 } 4549 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { 4550 const fullData = { 4551 ...data2, 4552 // The floating element's position may be recomputed while it's closed 4553 // but still mounted (such as when transitioning out). To ensure 4554 // `isPositioned` will be `false` initially on the next open, avoid 4555 // setting it to `true` when `open === false` (must be specified). 4556 isPositioned: openRef.current !== false 4557 }; 4558 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 4559 dataRef.current = fullData; 4560 ReactDOM3.flushSync(() => { 4561 setData(fullData); 4562 }); 4563 } 4564 }); 4565 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 4566 index(() => { 4567 if (open === false && dataRef.current.isPositioned) { 4568 dataRef.current.isPositioned = false; 4569 setData((data2) => ({ 4570 ...data2, 4571 isPositioned: false 4572 })); 4573 } 4574 }, [open]); 4575 const isMountedRef = React19.useRef(false); 4576 index(() => { 4577 isMountedRef.current = true; 4578 return () => { 4579 isMountedRef.current = false; 4580 }; 4581 }, []); 4582 index(() => { 4583 if (referenceEl) referenceRef.current = referenceEl; 4584 if (floatingEl) floatingRef.current = floatingEl; 4585 if (referenceEl && floatingEl) { 4586 if (whileElementsMountedRef.current) { 4587 return whileElementsMountedRef.current(referenceEl, floatingEl, update2); 4588 } 4589 update2(); 4590 } 4591 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); 4592 const refs = React19.useMemo(() => ({ 4593 reference: referenceRef, 4594 floating: floatingRef, 4595 setReference, 4596 setFloating 4597 }), [setReference, setFloating]); 4598 const elements = React19.useMemo(() => ({ 4599 reference: referenceEl, 4600 floating: floatingEl 4601 }), [referenceEl, floatingEl]); 4602 const floatingStyles = React19.useMemo(() => { 4603 const initialStyles = { 4604 position: strategy, 4605 left: 0, 4606 top: 0 4607 }; 4608 if (!elements.floating) { 4609 return initialStyles; 4610 } 4611 const x = roundByDPR(elements.floating, data.x); 4612 const y = roundByDPR(elements.floating, data.y); 4613 if (transform) { 4614 return { 4615 ...initialStyles, 4616 transform: "translate(" + x + "px, " + y + "px)", 4617 ...getDPR(elements.floating) >= 1.5 && { 4618 willChange: "transform" 4619 } 4620 }; 4621 } 4622 return { 4623 position: strategy, 4624 left: x, 4625 top: y 4626 }; 4627 }, [strategy, transform, elements.floating, data.x, data.y]); 4628 return React19.useMemo(() => ({ 4629 ...data, 4630 update: update2, 4631 refs, 4632 elements, 4633 floatingStyles 4634 }), [data, update2, refs, elements, floatingStyles]); 4635 } 4636 var offset3 = (options, deps) => { 4637 const result = offset2(options); 4638 return { 4639 name: result.name, 4640 fn: result.fn, 4641 options: [options, deps] 4642 }; 4643 }; 4644 var shift3 = (options, deps) => { 4645 const result = shift2(options); 4646 return { 4647 name: result.name, 4648 fn: result.fn, 4649 options: [options, deps] 4650 }; 4651 }; 4652 var limitShift3 = (options, deps) => { 4653 const result = limitShift2(options); 4654 return { 4655 fn: result.fn, 4656 options: [options, deps] 4657 }; 4658 }; 4659 var flip3 = (options, deps) => { 4660 const result = flip2(options); 4661 return { 4662 name: result.name, 4663 fn: result.fn, 4664 options: [options, deps] 4665 }; 4666 }; 4667 var size3 = (options, deps) => { 4668 const result = size2(options); 4669 return { 4670 name: result.name, 4671 fn: result.fn, 4672 options: [options, deps] 4673 }; 4674 }; 4675 var hide3 = (options, deps) => { 4676 const result = hide2(options); 4677 return { 4678 name: result.name, 4679 fn: result.fn, 4680 options: [options, deps] 4681 }; 4682 }; 4683 4684 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 4685 var React24 = __toESM(require_react(), 1); 4686 var ReactDOM4 = __toESM(require_react_dom(), 1); 4687 4688 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 4689 var React23 = __toESM(require_react(), 1); 4690 4691 // node_modules/@base-ui/utils/store/createSelector.mjs 4692 var createSelector = (a, b, c, d, e, f, ...other) => { 4693 if (other.length > 0) { 4694 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1)); 4695 } 4696 let selector; 4697 if (a && b && c && d && e && f) { 4698 selector = (state, a1, a2, a3) => { 4699 const va = a(state, a1, a2, a3); 4700 const vb = b(state, a1, a2, a3); 4701 const vc = c(state, a1, a2, a3); 4702 const vd = d(state, a1, a2, a3); 4703 const ve = e(state, a1, a2, a3); 4704 return f(va, vb, vc, vd, ve, a1, a2, a3); 4705 }; 4706 } else if (a && b && c && d && e) { 4707 selector = (state, a1, a2, a3) => { 4708 const va = a(state, a1, a2, a3); 4709 const vb = b(state, a1, a2, a3); 4710 const vc = c(state, a1, a2, a3); 4711 const vd = d(state, a1, a2, a3); 4712 return e(va, vb, vc, vd, a1, a2, a3); 4713 }; 4714 } else if (a && b && c && d) { 4715 selector = (state, a1, a2, a3) => { 4716 const va = a(state, a1, a2, a3); 4717 const vb = b(state, a1, a2, a3); 4718 const vc = c(state, a1, a2, a3); 4719 return d(va, vb, vc, a1, a2, a3); 4720 }; 4721 } else if (a && b && c) { 4722 selector = (state, a1, a2, a3) => { 4723 const va = a(state, a1, a2, a3); 4724 const vb = b(state, a1, a2, a3); 4725 return c(va, vb, a1, a2, a3); 4726 }; 4727 } else if (a && b) { 4728 selector = (state, a1, a2, a3) => { 4729 const va = a(state, a1, a2, a3); 4730 return b(va, a1, a2, a3); 4731 }; 4732 } else if (a) { 4733 selector = a; 4734 } else { 4735 throw ( 4736 /* minify-error-disabled */ 4737 new Error("Missing arguments") 4738 ); 4739 } 4740 return selector; 4741 }; 4742 4743 // node_modules/@base-ui/utils/store/useStore.mjs 4744 var React21 = __toESM(require_react(), 1); 4745 var import_shim = __toESM(require_shim(), 1); 4746 var import_with_selector = __toESM(require_with_selector(), 1); 4747 4748 // node_modules/@base-ui/utils/fastHooks.mjs 4749 var React20 = __toESM(require_react(), 1); 4750 var hooks = []; 4751 var currentInstance = void 0; 4752 function getInstance() { 4753 return currentInstance; 4754 } 4755 function register(hook) { 4756 hooks.push(hook); 4757 } 4758 function fastComponent(fn) { 4759 const FastComponent = (props, forwardedRef) => { 4760 const instance = useRefWithInit(createInstance).current; 4761 let result; 4762 try { 4763 currentInstance = instance; 4764 for (const hook of hooks) { 4765 hook.before(instance); 4766 } 4767 result = fn(props, forwardedRef); 4768 for (const hook of hooks) { 4769 hook.after(instance); 4770 } 4771 instance.didInitialize = true; 4772 } finally { 4773 currentInstance = void 0; 4774 } 4775 return result; 4776 }; 4777 FastComponent.displayName = fn.displayName || fn.name; 4778 return FastComponent; 4779 } 4780 function fastComponentRef(fn) { 4781 return /* @__PURE__ */ React20.forwardRef(fastComponent(fn)); 4782 } 4783 function createInstance() { 4784 return { 4785 didInitialize: false 4786 }; 4787 } 4788 4789 // node_modules/@base-ui/utils/store/useStore.mjs 4790 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 4791 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 4792 function useStore(store2, selector, a1, a2, a3) { 4793 return useStoreImplementation(store2, selector, a1, a2, a3); 4794 } 4795 function useStoreR19(store2, selector, a1, a2, a3) { 4796 const getSelection = React21.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]); 4797 return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection); 4798 } 4799 register({ 4800 before(instance) { 4801 instance.syncIndex = 0; 4802 if (!instance.didInitialize) { 4803 instance.syncTick = 1; 4804 instance.syncHooks = []; 4805 instance.didChangeStore = true; 4806 instance.getSnapshot = () => { 4807 let didChange2 = false; 4808 for (let i = 0; i < instance.syncHooks.length; i += 1) { 4809 const hook = instance.syncHooks[i]; 4810 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 4811 if (!Object.is(hook.value, value)) { 4812 didChange2 = true; 4813 hook.value = value; 4814 } 4815 } 4816 if (didChange2) { 4817 instance.syncTick += 1; 4818 } 4819 return instance.syncTick; 4820 }; 4821 } 4822 }, 4823 after(instance) { 4824 if (instance.syncHooks.length > 0) { 4825 if (instance.didChangeStore) { 4826 instance.didChangeStore = false; 4827 instance.subscribe = (onStoreChange) => { 4828 const stores = /* @__PURE__ */ new Set(); 4829 for (const hook of instance.syncHooks) { 4830 stores.add(hook.store); 4831 } 4832 const unsubscribes = []; 4833 for (const store2 of stores) { 4834 unsubscribes.push(store2.subscribe(onStoreChange)); 4835 } 4836 return () => { 4837 for (const unsubscribe of unsubscribes) { 4838 unsubscribe(); 4839 } 4840 }; 4841 }; 4842 } 4843 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 4844 } 4845 } 4846 }); 4847 function useStoreFast(store2, selector, a1, a2, a3) { 4848 const instance = getInstance(); 4849 if (!instance) { 4850 return useStoreR19(store2, selector, a1, a2, a3); 4851 } 4852 const index2 = instance.syncIndex; 4853 instance.syncIndex += 1; 4854 let hook; 4855 if (!instance.didInitialize) { 4856 hook = { 4857 store: store2, 4858 selector, 4859 a1, 4860 a2, 4861 a3, 4862 value: selector(store2.getSnapshot(), a1, a2, a3) 4863 }; 4864 instance.syncHooks.push(hook); 4865 } else { 4866 hook = instance.syncHooks[index2]; 4867 if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { 4868 if (hook.store !== store2) { 4869 instance.didChangeStore = true; 4870 } 4871 hook.store = store2; 4872 hook.selector = selector; 4873 hook.a1 = a1; 4874 hook.a2 = a2; 4875 hook.a3 = a3; 4876 hook.value = selector(store2.getSnapshot(), a1, a2, a3); 4877 } 4878 } 4879 return hook.value; 4880 } 4881 function useStoreLegacy(store2, selector, a1, a2, a3) { 4882 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3)); 4883 } 4884 4885 // node_modules/@base-ui/utils/store/Store.mjs 4886 var Store = class { 4887 /** 4888 * The current state of the store. 4889 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 4890 * 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). 4891 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 4892 * 4893 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 4894 */ 4895 // Internal state to handle recursive `setState()` calls 4896 constructor(state) { 4897 this.state = state; 4898 this.listeners = /* @__PURE__ */ new Set(); 4899 this.updateTick = 0; 4900 } 4901 /** 4902 * Registers a listener that will be called whenever the store's state changes. 4903 * 4904 * @param fn The listener function to be called on state changes. 4905 * @returns A function to unsubscribe the listener. 4906 */ 4907 subscribe = (fn) => { 4908 this.listeners.add(fn); 4909 return () => { 4910 this.listeners.delete(fn); 4911 }; 4912 }; 4913 /** 4914 * Returns the current state of the store. 4915 */ 4916 getSnapshot = () => { 4917 return this.state; 4918 }; 4919 /** 4920 * Updates the entire store's state and notifies all registered listeners. 4921 * 4922 * @param newState The new state to set for the store. 4923 */ 4924 setState(newState) { 4925 if (this.state === newState) { 4926 return; 4927 } 4928 this.state = newState; 4929 this.updateTick += 1; 4930 const currentTick = this.updateTick; 4931 for (const listener of this.listeners) { 4932 if (currentTick !== this.updateTick) { 4933 return; 4934 } 4935 listener(newState); 4936 } 4937 } 4938 /** 4939 * Merges the provided changes into the current state and notifies listeners if there are changes. 4940 * 4941 * @param changes An object containing the changes to apply to the current state. 4942 */ 4943 update(changes) { 4944 for (const key in changes) { 4945 if (!Object.is(this.state[key], changes[key])) { 4946 this.setState({ 4947 ...this.state, 4948 ...changes 4949 }); 4950 return; 4951 } 4952 } 4953 } 4954 /** 4955 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 4956 * 4957 * @param key The key in the store's state to update. 4958 * @param value The new value to set for the specified key. 4959 */ 4960 set(key, value) { 4961 if (!Object.is(this.state[key], value)) { 4962 this.setState({ 4963 ...this.state, 4964 [key]: value 4965 }); 4966 } 4967 } 4968 /** 4969 * Gives the state a new reference and updates all registered listeners. 4970 */ 4971 notifyAll() { 4972 const newState = { 4973 ...this.state 4974 }; 4975 this.setState(newState); 4976 } 4977 use(selector, a1, a2, a3) { 4978 return useStore(this, selector, a1, a2, a3); 4979 } 4980 }; 4981 4982 // node_modules/@base-ui/utils/store/ReactStore.mjs 4983 var React22 = __toESM(require_react(), 1); 4984 var ReactStore = class extends Store { 4985 /** 4986 * Creates a new ReactStore instance. 4987 * 4988 * @param state Initial state of the store. 4989 * @param context Non-reactive context values. 4990 * @param selectors Optional selectors for use with `useState`. 4991 */ 4992 constructor(state, context = {}, selectors3) { 4993 super(state); 4994 this.context = context; 4995 this.selectors = selectors3; 4996 } 4997 /** 4998 * Non-reactive values such as refs, callbacks, etc. 4999 */ 5000 /** 5001 * Synchronizes a single external value into the store. 5002 * 5003 * Note that the while the value in `state` is updated immediately, the value returned 5004 * by `useState` is updated before the next render (similarly to React's `useState`). 5005 */ 5006 useSyncedValue(key, value) { 5007 React22.useDebugValue(key); 5008 const store2 = this; 5009 useIsoLayoutEffect(() => { 5010 if (store2.state[key] !== value) { 5011 store2.set(key, value); 5012 } 5013 }, [store2, key, value]); 5014 } 5015 /** 5016 * Synchronizes a single external value into the store and 5017 * cleans it up (sets to `undefined`) on unmount. 5018 * 5019 * Note that the while the value in `state` is updated immediately, the value returned 5020 * by `useState` is updated before the next render (similarly to React's `useState`). 5021 */ 5022 useSyncedValueWithCleanup(key, value) { 5023 const store2 = this; 5024 useIsoLayoutEffect(() => { 5025 if (store2.state[key] !== value) { 5026 store2.set(key, value); 5027 } 5028 return () => { 5029 store2.set(key, void 0); 5030 }; 5031 }, [store2, key, value]); 5032 } 5033 /** 5034 * Synchronizes multiple external values into the store. 5035 * 5036 * Note that the while the values in `state` are updated immediately, the values returned 5037 * by `useState` are updated before the next render (similarly to React's `useState`). 5038 */ 5039 useSyncedValues(statePart) { 5040 const store2 = this; 5041 if (true) { 5042 React22.useDebugValue(statePart, (p) => Object.keys(p)); 5043 const keys = React22.useRef(Object.keys(statePart)).current; 5044 const nextKeys = Object.keys(statePart); 5045 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { 5046 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 5047 } 5048 } 5049 const dependencies = Object.values(statePart); 5050 useIsoLayoutEffect(() => { 5051 store2.update(statePart); 5052 }, [store2, ...dependencies]); 5053 } 5054 /** 5055 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 5056 * is non-undefined, the store's state at `key` is updated to match `controlled`. 5057 */ 5058 useControlledProp(key, controlled) { 5059 React22.useDebugValue(key); 5060 const store2 = this; 5061 const isControlled = controlled !== void 0; 5062 useIsoLayoutEffect(() => { 5063 if (isControlled && !Object.is(store2.state[key], controlled)) { 5064 store2.setState({ 5065 ...store2.state, 5066 [key]: controlled 5067 }); 5068 } 5069 }, [store2, key, controlled, isControlled]); 5070 if (true) { 5071 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 5072 if (!cache.has(key)) { 5073 cache.set(key, isControlled); 5074 } 5075 const previouslyControlled = cache.get(key); 5076 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 5077 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).`); 5078 } 5079 } 5080 } 5081 /** Gets the current value from the store using a selector with the provided key. 5082 * 5083 * @param key Key of the selector to use. 5084 */ 5085 select(key, a1, a2, a3) { 5086 const selector = this.selectors[key]; 5087 return selector(this.state, a1, a2, a3); 5088 } 5089 /** 5090 * Returns a value from the store's state using a selector function. 5091 * Used to subscribe to specific parts of the state. 5092 * This methods causes a rerender whenever the selected state changes. 5093 * 5094 * @param key Key of the selector to use. 5095 */ 5096 useState(key, a1, a2, a3) { 5097 React22.useDebugValue(key); 5098 return useStore(this, this.selectors[key], a1, a2, a3); 5099 } 5100 /** 5101 * Wraps a function with `useStableCallback` to ensure it has a stable reference 5102 * and assigns it to the context. 5103 * 5104 * @param key Key of the event callback. Must be a function in the context. 5105 * @param fn Function to assign. 5106 */ 5107 useContextCallback(key, fn) { 5108 React22.useDebugValue(key); 5109 const stableFunction = useStableCallback(fn ?? NOOP); 5110 this.context[key] = stableFunction; 5111 } 5112 /** 5113 * Returns a stable setter function for a specific key in the store's state. 5114 * It's commonly used to pass as a ref callback to React elements. 5115 * 5116 * @param key Key of the state to set. 5117 */ 5118 useStateSetter(key) { 5119 const ref = React22.useRef(void 0); 5120 if (ref.current === void 0) { 5121 ref.current = (value) => { 5122 this.set(key, value); 5123 }; 5124 } 5125 return ref.current; 5126 } 5127 /** 5128 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 5129 * 5130 * @param key Key of the selector to observe. 5131 * @param listener Listener function called when the selector result changes. 5132 */ 5133 observe(selector, listener) { 5134 let selectFn; 5135 if (typeof selector === "function") { 5136 selectFn = selector; 5137 } else { 5138 selectFn = this.selectors[selector]; 5139 } 5140 let prevValue = selectFn(this.state); 5141 listener(prevValue, prevValue, this); 5142 return this.subscribe((nextState) => { 5143 const nextValue = selectFn(nextState); 5144 if (!Object.is(prevValue, nextValue)) { 5145 const oldValue = prevValue; 5146 prevValue = nextValue; 5147 listener(nextValue, oldValue, this); 5148 } 5149 }); 5150 } 5151 }; 5152 5153 // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs 5154 var selectors = { 5155 open: createSelector((state) => state.open), 5156 transitionStatus: createSelector((state) => state.transitionStatus), 5157 domReferenceElement: createSelector((state) => state.domReferenceElement), 5158 referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement), 5159 floatingElement: createSelector((state) => state.floatingElement), 5160 floatingId: createSelector((state) => state.floatingId) 5161 }; 5162 var FloatingRootStore = class extends ReactStore { 5163 constructor(options) { 5164 const { 5165 syncOnly, 5166 nested, 5167 onOpenChange, 5168 triggerElements, 5169 ...initialState 5170 } = options; 5171 super({ 5172 ...initialState, 5173 positionReference: initialState.referenceElement, 5174 domReferenceElement: initialState.referenceElement 5175 }, { 5176 onOpenChange, 5177 dataRef: { 5178 current: {} 5179 }, 5180 events: createEventEmitter(), 5181 nested, 5182 triggerElements 5183 }, selectors); 5184 this.syncOnly = syncOnly; 5185 } 5186 /** 5187 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 5188 */ 5189 syncOpenEvent = (newOpen, event) => { 5190 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 5191 // click events to upgrade a hover-open. 5192 event != null && isClickLikeEvent(event)) { 5193 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 5194 } 5195 }; 5196 /** 5197 * Runs the root-owned side effects for an open state change. 5198 */ 5199 dispatchOpenChange = (newOpen, eventDetails) => { 5200 this.syncOpenEvent(newOpen, eventDetails.event); 5201 const details = { 5202 open: newOpen, 5203 reason: eventDetails.reason, 5204 nativeEvent: eventDetails.event, 5205 nested: this.context.nested, 5206 triggerElement: eventDetails.trigger 5207 }; 5208 this.context.events.emit("openchange", details); 5209 }; 5210 /** 5211 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 5212 * 5213 * @param newOpen The new open state. 5214 * @param eventDetails Details about the event that triggered the open state change. 5215 */ 5216 setOpen = (newOpen, eventDetails) => { 5217 if (this.syncOnly) { 5218 this.context.onOpenChange?.(newOpen, eventDetails); 5219 return; 5220 } 5221 this.dispatchOpenChange(newOpen, eventDetails); 5222 this.context.onOpenChange?.(newOpen, eventDetails); 5223 }; 5224 }; 5225 5226 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 5227 function useSyncedFloatingRootContext(options) { 5228 const { 5229 popupStore, 5230 treatPopupAsFloatingElement = false, 5231 floatingRootContext: floatingRootContextProp, 5232 floatingId, 5233 nested, 5234 onOpenChange 5235 } = options; 5236 const open = popupStore.useState("open"); 5237 const referenceElement = popupStore.useState("activeTriggerElement"); 5238 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 5239 const triggerElements = popupStore.context.triggerElements; 5240 const handleOpenChange = onOpenChange; 5241 const internalStoreRef = React23.useRef(null); 5242 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { 5243 internalStoreRef.current = new FloatingRootStore({ 5244 open, 5245 transitionStatus: void 0, 5246 referenceElement, 5247 floatingElement, 5248 triggerElements, 5249 onOpenChange: handleOpenChange, 5250 floatingId, 5251 syncOnly: true, 5252 nested 5253 }); 5254 } 5255 const store2 = floatingRootContextProp ?? internalStoreRef.current; 5256 popupStore.useSyncedValue("floatingId", floatingId); 5257 useIsoLayoutEffect(() => { 5258 const valuesToSync = { 5259 open, 5260 floatingId, 5261 referenceElement, 5262 floatingElement 5263 }; 5264 if (isElement(referenceElement)) { 5265 valuesToSync.domReferenceElement = referenceElement; 5266 } 5267 if (store2.state.positionReference === store2.state.referenceElement) { 5268 valuesToSync.positionReference = referenceElement; 5269 } 5270 store2.update(valuesToSync); 5271 }, [open, floatingId, referenceElement, floatingElement, store2]); 5272 store2.context.onOpenChange = handleOpenChange; 5273 store2.context.nested = nested; 5274 return store2; 5275 } 5276 5277 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 5278 var FOCUSABLE_POPUP_PROPS = { 5279 tabIndex: -1, 5280 [FOCUSABLE_ATTRIBUTE]: "" 5281 }; 5282 function usePopupStore(externalStore, createStore, treatPopupAsFloatingElement = false) { 5283 const floatingId = useId(); 5284 const nested = useFloatingParentNodeId() != null; 5285 const internalStoreRef = React24.useRef(null); 5286 if (externalStore === void 0 && internalStoreRef.current === null) { 5287 internalStoreRef.current = createStore(floatingId, nested); 5288 } 5289 const store2 = externalStore ?? internalStoreRef.current; 5290 useSyncedFloatingRootContext({ 5291 popupStore: store2, 5292 treatPopupAsFloatingElement, 5293 floatingRootContext: store2.state.floatingRootContext, 5294 floatingId, 5295 nested, 5296 onOpenChange: store2.setOpen 5297 }); 5298 return { 5299 store: store2, 5300 internalStore: internalStoreRef.current 5301 }; 5302 } 5303 function useTriggerRegistration(id, store2) { 5304 const registeredElementIdRef = React24.useRef(null); 5305 const registeredElementRef = React24.useRef(null); 5306 return React24.useCallback((element) => { 5307 if (id === void 0) { 5308 return; 5309 } 5310 let shouldSyncTriggerCount = false; 5311 if (registeredElementIdRef.current !== null) { 5312 const registeredId = registeredElementIdRef.current; 5313 const registeredElement = registeredElementRef.current; 5314 const currentElement = store2.context.triggerElements.getById(registeredId); 5315 if (registeredElement && currentElement === registeredElement) { 5316 store2.context.triggerElements.delete(registeredId); 5317 shouldSyncTriggerCount = true; 5318 } 5319 registeredElementIdRef.current = null; 5320 registeredElementRef.current = null; 5321 } 5322 if (element !== null) { 5323 registeredElementIdRef.current = id; 5324 registeredElementRef.current = element; 5325 store2.context.triggerElements.add(id, element); 5326 shouldSyncTriggerCount = true; 5327 } 5328 if (shouldSyncTriggerCount) { 5329 const triggerCount = store2.context.triggerElements.size; 5330 if (store2.select("open") && store2.state.triggerCount !== triggerCount) { 5331 store2.set("triggerCount", triggerCount); 5332 } 5333 } 5334 }, [store2, id]); 5335 } 5336 function setPopupOpenState(state, open, trigger, preventUnmountOnClose = false) { 5337 if (open) { 5338 state.preventUnmountingOnClose = false; 5339 } else if (preventUnmountOnClose) { 5340 state.preventUnmountingOnClose = true; 5341 } 5342 const triggerId = trigger?.id ?? null; 5343 if (triggerId || open) { 5344 state.activeTriggerId = triggerId; 5345 state.activeTriggerElement = trigger ?? null; 5346 } 5347 } 5348 function attachPreventUnmountOnClose(eventDetails) { 5349 let preventUnmountOnClose = false; 5350 eventDetails.preventUnmountOnClose = () => { 5351 preventUnmountOnClose = true; 5352 }; 5353 return () => preventUnmountOnClose; 5354 } 5355 function applyPopupOpenChange(store2, nextOpen, eventDetails, options = {}) { 5356 const reason = eventDetails.reason; 5357 const isHover = reason === reason_parts_exports.triggerHover; 5358 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 5359 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 5360 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); 5361 store2.context.onOpenChange?.(nextOpen, eventDetails); 5362 if (eventDetails.isCanceled) { 5363 return; 5364 } 5365 options.onBeforeDispatch?.(); 5366 store2.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 5367 const changeState = () => { 5368 const updatedState = { 5369 ...options.extraState, 5370 open: nextOpen 5371 }; 5372 if (isFocusOpen) { 5373 updatedState.instantType = "focus"; 5374 } else if (isDismissClose) { 5375 updatedState.instantType = "dismiss"; 5376 } else if (isHover) { 5377 updatedState.instantType = void 0; 5378 } 5379 setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); 5380 store2.update(updatedState); 5381 }; 5382 if (isHover) { 5383 ReactDOM4.flushSync(changeState); 5384 } else { 5385 changeState(); 5386 } 5387 } 5388 function useInitialOpenSync(store2, openProp, defaultOpen, defaultTriggerId) { 5389 useOnFirstRender(() => { 5390 if (openProp === void 0 && store2.state.open === false && defaultOpen) { 5391 store2.state = { 5392 ...store2.state, 5393 open: true, 5394 activeTriggerId: defaultTriggerId, 5395 preventUnmountingOnClose: false 5396 }; 5397 } 5398 }); 5399 } 5400 function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) { 5401 const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId); 5402 const baseRegisterTrigger = useTriggerRegistration(triggerId, store2); 5403 const registerTrigger = useStableCallback((element) => { 5404 baseRegisterTrigger(element); 5405 if (!element) { 5406 return; 5407 } 5408 const open = store2.select("open"); 5409 const activeTriggerId = store2.select("activeTriggerId"); 5410 if (activeTriggerId === triggerId) { 5411 store2.update({ 5412 activeTriggerElement: element, 5413 ...open ? stateUpdates : null 5414 }); 5415 return; 5416 } 5417 if (activeTriggerId == null && open) { 5418 store2.update({ 5419 activeTriggerId: triggerId, 5420 activeTriggerElement: element, 5421 ...stateUpdates 5422 }); 5423 } 5424 }); 5425 useIsoLayoutEffect(() => { 5426 if (isMountedByThisTrigger) { 5427 store2.update({ 5428 activeTriggerElement: triggerElementRef.current, 5429 ...stateUpdates 5430 }); 5431 } 5432 }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]); 5433 return { 5434 registerTrigger, 5435 isMountedByThisTrigger 5436 }; 5437 } 5438 function useImplicitActiveTrigger(store2, options = {}) { 5439 const { 5440 closeOnActiveTriggerUnmount = false 5441 } = options; 5442 const open = store2.useState("open"); 5443 const reactiveTriggerCount = store2.useState("triggerCount"); 5444 useIsoLayoutEffect(() => { 5445 if (!open) { 5446 if (store2.state.triggerCount !== 0) { 5447 store2.set("triggerCount", 0); 5448 } 5449 return; 5450 } 5451 const triggerCount = store2.context.triggerElements.size; 5452 const stateUpdates = {}; 5453 if (store2.state.triggerCount !== triggerCount) { 5454 stateUpdates.triggerCount = triggerCount; 5455 } 5456 const activeTriggerId = store2.select("activeTriggerId"); 5457 let lostActiveTriggerId = null; 5458 if (activeTriggerId) { 5459 const activeTriggerElement = store2.context.triggerElements.getById(activeTriggerId); 5460 if (!activeTriggerElement) { 5461 lostActiveTriggerId = activeTriggerId; 5462 } else if (activeTriggerElement !== store2.state.activeTriggerElement) { 5463 stateUpdates.activeTriggerElement = activeTriggerElement; 5464 } 5465 } 5466 if (!lostActiveTriggerId && !activeTriggerId && triggerCount === 1) { 5467 const iteratorResult = store2.context.triggerElements.entries().next(); 5468 if (!iteratorResult.done) { 5469 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 5470 stateUpdates.activeTriggerId = implicitTriggerId; 5471 stateUpdates.activeTriggerElement = implicitTriggerElement; 5472 } 5473 } 5474 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { 5475 store2.update(stateUpdates); 5476 } 5477 if (lostActiveTriggerId) { 5478 if (closeOnActiveTriggerUnmount) { 5479 queueMicrotask(() => { 5480 if (store2.select("open") && store2.select("activeTriggerId") === lostActiveTriggerId && !store2.context.triggerElements.getById(lostActiveTriggerId)) { 5481 const eventDetails = createChangeEventDetails(reason_parts_exports.none); 5482 store2.setOpen(false, eventDetails); 5483 if (!eventDetails.isCanceled) { 5484 store2.update({ 5485 activeTriggerId: null, 5486 activeTriggerElement: null 5487 }); 5488 } 5489 } 5490 }); 5491 } 5492 } 5493 }, [open, store2, reactiveTriggerCount, closeOnActiveTriggerUnmount]); 5494 } 5495 function useOpenStateTransitions(open, store2, onUnmount) { 5496 const { 5497 mounted, 5498 setMounted, 5499 transitionStatus 5500 } = useTransitionStatus(open); 5501 const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose"); 5502 const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose; 5503 store2.useSyncedValues({ 5504 mounted, 5505 transitionStatus, 5506 preventUnmountingOnClose: syncedPreventUnmountingOnClose 5507 }); 5508 const forceUnmount = useStableCallback(() => { 5509 setMounted(false); 5510 store2.update({ 5511 activeTriggerId: null, 5512 activeTriggerElement: null, 5513 mounted: false, 5514 preventUnmountingOnClose: false 5515 }); 5516 onUnmount?.(); 5517 store2.context.onOpenChangeComplete?.(false); 5518 }); 5519 useOpenChangeComplete({ 5520 enabled: mounted && !open && !syncedPreventUnmountingOnClose, 5521 open, 5522 ref: store2.context.popupRef, 5523 onComplete() { 5524 if (!open) { 5525 forceUnmount(); 5526 } 5527 } 5528 }); 5529 return { 5530 forceUnmount, 5531 transitionStatus 5532 }; 5533 } 5534 function usePopupInteractionProps(store2, statePart) { 5535 store2.useSyncedValues(statePart); 5536 useIsoLayoutEffect(() => () => { 5537 store2.update({ 5538 activeTriggerProps: EMPTY_OBJECT, 5539 inactiveTriggerProps: EMPTY_OBJECT, 5540 popupProps: EMPTY_OBJECT 5541 }); 5542 }, [store2]); 5543 } 5544 5545 // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs 5546 var PopupTriggerMap = class { 5547 constructor() { 5548 this.elementsSet = /* @__PURE__ */ new Set(); 5549 this.idMap = /* @__PURE__ */ new Map(); 5550 } 5551 /** 5552 * Adds a trigger element with the given ID. 5553 * 5554 * Note: The provided element is assumed to not be registered under multiple IDs. 5555 */ 5556 add(id, element) { 5557 const existingElement = this.idMap.get(id); 5558 if (existingElement === element) { 5559 return; 5560 } 5561 if (existingElement !== void 0) { 5562 this.elementsSet.delete(existingElement); 5563 } 5564 this.elementsSet.add(element); 5565 this.idMap.set(id, element); 5566 if (true) { 5567 if (this.elementsSet.size !== this.idMap.size) { 5568 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 5569 } 5570 } 5571 } 5572 /** 5573 * Removes the trigger element with the given ID. 5574 */ 5575 delete(id) { 5576 const element = this.idMap.get(id); 5577 if (element) { 5578 this.elementsSet.delete(element); 5579 this.idMap.delete(id); 5580 } 5581 } 5582 /** 5583 * Whether the given element is registered as a trigger. 5584 */ 5585 hasElement(element) { 5586 return this.elementsSet.has(element); 5587 } 5588 /** 5589 * Whether there is a registered trigger element matching the given predicate. 5590 */ 5591 hasMatchingElement(predicate) { 5592 for (const element of this.elementsSet) { 5593 if (predicate(element)) { 5594 return true; 5595 } 5596 } 5597 return false; 5598 } 5599 /** 5600 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 5601 */ 5602 getById(id) { 5603 return this.idMap.get(id); 5604 } 5605 /** 5606 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 5607 */ 5608 entries() { 5609 return this.idMap.entries(); 5610 } 5611 /** 5612 * Returns an iterable of all registered trigger elements. 5613 */ 5614 elements() { 5615 return this.elementsSet.values(); 5616 } 5617 /** 5618 * Returns the number of registered trigger elements. 5619 */ 5620 get size() { 5621 return this.idMap.size; 5622 } 5623 }; 5624 5625 // node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs 5626 function getEmptyRootContext() { 5627 return new FloatingRootStore({ 5628 open: false, 5629 transitionStatus: void 0, 5630 floatingElement: null, 5631 referenceElement: null, 5632 triggerElements: new PopupTriggerMap(), 5633 floatingId: void 0, 5634 syncOnly: false, 5635 nested: false, 5636 onOpenChange: void 0 5637 }); 5638 } 5639 5640 // node_modules/@base-ui/react/utils/popups/store.mjs 5641 function createInitialPopupStoreState() { 5642 return { 5643 open: false, 5644 openProp: void 0, 5645 mounted: false, 5646 transitionStatus: void 0, 5647 floatingRootContext: getEmptyRootContext(), 5648 floatingId: void 0, 5649 triggerCount: 0, 5650 preventUnmountingOnClose: false, 5651 payload: void 0, 5652 activeTriggerId: null, 5653 activeTriggerElement: null, 5654 triggerIdProp: void 0, 5655 popupElement: null, 5656 positionerElement: null, 5657 activeTriggerProps: EMPTY_OBJECT, 5658 inactiveTriggerProps: EMPTY_OBJECT, 5659 popupProps: EMPTY_OBJECT 5660 }; 5661 } 5662 function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) { 5663 return new FloatingRootStore({ 5664 open: false, 5665 transitionStatus: void 0, 5666 floatingElement: null, 5667 referenceElement: null, 5668 triggerElements, 5669 floatingId, 5670 syncOnly: true, 5671 nested, 5672 onOpenChange: void 0 5673 }); 5674 } 5675 var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId); 5676 var openSelector = createSelector((state) => state.openProp ?? state.open); 5677 var popupIdSelector = createSelector((state) => { 5678 const popupId = state.popupElement?.id ?? state.floatingId; 5679 return popupId || void 0; 5680 }); 5681 function triggerOwnsOpenPopup(state, triggerId) { 5682 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; 5683 } 5684 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { 5685 if (triggerOwnsOpenPopup(state, triggerId)) { 5686 return true; 5687 } 5688 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; 5689 } 5690 var popupStoreSelectors = { 5691 open: openSelector, 5692 mounted: createSelector((state) => state.mounted), 5693 transitionStatus: createSelector((state) => state.transitionStatus), 5694 floatingRootContext: createSelector((state) => state.floatingRootContext), 5695 triggerCount: createSelector((state) => state.triggerCount), 5696 preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose), 5697 payload: createSelector((state) => state.payload), 5698 activeTriggerId: activeTriggerIdSelector, 5699 activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null), 5700 popupId: popupIdSelector, 5701 /** 5702 * Whether the trigger with the given ID was used to open the popup. 5703 */ 5704 isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId), 5705 /** 5706 * Whether the popup is open and was activated by a trigger with the given ID. 5707 */ 5708 isOpenedByTrigger: createSelector((state, triggerId) => triggerOwnsOpenPopup(state, triggerId)), 5709 /** 5710 * Whether the popup is mounted and was activated by a trigger with the given ID. 5711 */ 5712 isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted), 5713 triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps), 5714 /** 5715 * Popup id for the trigger that currently owns the open popup. 5716 */ 5717 triggerPopupId: createSelector((state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0), 5718 popupProps: createSelector((state) => state.popupProps), 5719 popupElement: createSelector((state) => state.popupElement), 5720 positionerElement: createSelector((state) => state.positionerElement) 5721 }; 5722 5723 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs 5724 function useFloatingRootContext(options) { 5725 const { 5726 open = false, 5727 onOpenChange, 5728 elements = {} 5729 } = options; 5730 const floatingId = useId(); 5731 const nested = useFloatingParentNodeId() != null; 5732 if (true) { 5733 const optionDomReference = elements.reference; 5734 if (optionDomReference && !isElement(optionDomReference)) { 5735 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); 5736 } 5737 } 5738 const store2 = useRefWithInit(() => new FloatingRootStore({ 5739 open, 5740 transitionStatus: void 0, 5741 onOpenChange, 5742 referenceElement: elements.reference ?? null, 5743 floatingElement: elements.floating ?? null, 5744 triggerElements: new PopupTriggerMap(), 5745 floatingId, 5746 syncOnly: false, 5747 nested 5748 })).current; 5749 useIsoLayoutEffect(() => { 5750 const valuesToSync = { 5751 open, 5752 floatingId 5753 }; 5754 if (elements.reference !== void 0) { 5755 valuesToSync.referenceElement = elements.reference; 5756 valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null; 5757 } 5758 if (elements.floating !== void 0) { 5759 valuesToSync.floatingElement = elements.floating; 5760 } 5761 store2.update(valuesToSync); 5762 }, [open, floatingId, elements.reference, elements.floating, store2]); 5763 store2.context.onOpenChange = onOpenChange; 5764 store2.context.nested = nested; 5765 return store2; 5766 } 5767 5768 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 5769 function useFloating2(options = {}) { 5770 const { 5771 nodeId, 5772 externalTree 5773 } = options; 5774 const internalStore = useFloatingRootContext(options); 5775 const store2 = options.rootContext || internalStore; 5776 const referenceElement = store2.useState("referenceElement"); 5777 const floatingElement = store2.useState("floatingElement"); 5778 const domReferenceElement = store2.useState("domReferenceElement"); 5779 const open = store2.useState("open"); 5780 const floatingId = store2.useState("floatingId"); 5781 const [positionReference, setPositionReferenceRaw] = React25.useState(null); 5782 const [localDomReference, setLocalDomReference] = React25.useState(void 0); 5783 const [localFloatingElement, setLocalFloatingElement] = React25.useState(void 0); 5784 const domReferenceRef = React25.useRef(null); 5785 const tree = useFloatingTree(externalTree); 5786 const storeElements = React25.useMemo(() => ({ 5787 reference: referenceElement, 5788 floating: floatingElement, 5789 domReference: domReferenceElement 5790 }), [referenceElement, floatingElement, domReferenceElement]); 5791 const position = useFloating({ 5792 ...options, 5793 elements: { 5794 ...storeElements, 5795 ...positionReference && { 5796 reference: positionReference 5797 } 5798 } 5799 }); 5800 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; 5801 const syncedFloatingElement = localFloatingElement === void 0 ? store2.state.floatingElement : localFloatingElement; 5802 store2.useSyncedValue("referenceElement", localDomReference ?? null); 5803 store2.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); 5804 store2.useSyncedValue("floatingElement", syncedFloatingElement); 5805 const setPositionReference = React25.useCallback((node) => { 5806 const computedPositionReference = isElement(node) ? { 5807 getBoundingClientRect: () => node.getBoundingClientRect(), 5808 getClientRects: () => node.getClientRects(), 5809 contextElement: node 5810 } : node; 5811 setPositionReferenceRaw(computedPositionReference); 5812 position.refs.setReference(computedPositionReference); 5813 }, [position.refs]); 5814 const setReference = React25.useCallback((node) => { 5815 if (isElement(node) || node === null) { 5816 domReferenceRef.current = node; 5817 setLocalDomReference(node); 5818 } 5819 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to 5820 // `null` to support `positionReference` + an unstable `reference` 5821 // callback ref. 5822 node !== null && !isElement(node)) { 5823 position.refs.setReference(node); 5824 } 5825 }, [position.refs, setLocalDomReference]); 5826 const setFloating = React25.useCallback((node) => { 5827 setLocalFloatingElement(node); 5828 position.refs.setFloating(node); 5829 }, [position.refs]); 5830 const refs = React25.useMemo(() => ({ 5831 ...position.refs, 5832 setReference, 5833 setFloating, 5834 setPositionReference, 5835 domReference: domReferenceRef 5836 }), [position.refs, setReference, setFloating, setPositionReference]); 5837 const elements = React25.useMemo(() => ({ 5838 ...position.elements, 5839 domReference: domReferenceElement 5840 }), [position.elements, domReferenceElement]); 5841 const context = React25.useMemo(() => ({ 5842 ...position, 5843 dataRef: store2.context.dataRef, 5844 open, 5845 onOpenChange: store2.setOpen, 5846 events: store2.context.events, 5847 floatingId, 5848 refs, 5849 elements, 5850 nodeId, 5851 rootStore: store2 5852 }), [position, refs, elements, nodeId, store2, open, floatingId]); 5853 useIsoLayoutEffect(() => { 5854 if (domReferenceElement) { 5855 domReferenceRef.current = domReferenceElement; 5856 } 5857 }, [domReferenceElement]); 5858 useIsoLayoutEffect(() => { 5859 store2.context.dataRef.current.floatingContext = context; 5860 const node = tree?.nodesRef.current.find((n) => n.id === nodeId); 5861 if (node) { 5862 node.context = context; 5863 } 5864 }); 5865 return React25.useMemo(() => ({ 5866 ...position, 5867 context, 5868 refs, 5869 elements, 5870 rootStore: store2 5871 }), [position, refs, elements, context, store2]); 5872 } 5873 5874 // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs 5875 var React26 = __toESM(require_react(), 1); 5876 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; 5877 function useFocus(context, props = {}) { 5878 const { 5879 enabled = true, 5880 delay 5881 } = props; 5882 const store2 = "rootStore" in context ? context.rootStore : context; 5883 const { 5884 events, 5885 dataRef 5886 } = store2.context; 5887 const blockFocusRef = React26.useRef(false); 5888 const blockedReferenceRef = React26.useRef(null); 5889 const keyboardModalityRef = React26.useRef(true); 5890 const timeout = useTimeout(); 5891 React26.useEffect(() => { 5892 const domReference = store2.select("domReferenceElement"); 5893 if (!enabled) { 5894 return void 0; 5895 } 5896 const win = getWindow(domReference); 5897 function onBlur() { 5898 const currentDomReference = store2.select("domReferenceElement"); 5899 if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 5900 blockFocusRef.current = true; 5901 } 5902 } 5903 function onKeyDown() { 5904 keyboardModalityRef.current = true; 5905 } 5906 function onPointerDown() { 5907 keyboardModalityRef.current = false; 5908 } 5909 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 5910 }, [store2, enabled]); 5911 React26.useEffect(() => { 5912 if (!enabled) { 5913 return void 0; 5914 } 5915 function onOpenChangeLocal(details) { 5916 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 5917 const referenceElement = store2.select("domReferenceElement"); 5918 if (isElement(referenceElement)) { 5919 blockedReferenceRef.current = referenceElement; 5920 blockFocusRef.current = true; 5921 } 5922 } 5923 } 5924 events.on("openchange", onOpenChangeLocal); 5925 return () => { 5926 events.off("openchange", onOpenChangeLocal); 5927 }; 5928 }, [events, enabled, store2]); 5929 const reference = React26.useMemo(() => { 5930 function resetBlockedFocus() { 5931 blockFocusRef.current = false; 5932 blockedReferenceRef.current = null; 5933 } 5934 return { 5935 onMouseLeave() { 5936 resetBlockedFocus(); 5937 }, 5938 onFocus(event) { 5939 const focusTarget = event.currentTarget; 5940 if (blockFocusRef.current) { 5941 if (blockedReferenceRef.current === focusTarget) { 5942 return; 5943 } 5944 resetBlockedFocus(); 5945 } 5946 const target = getTarget(event.nativeEvent); 5947 if (isElement(target)) { 5948 if (isMacSafari && !event.relatedTarget) { 5949 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 5950 return; 5951 } 5952 } else if (!matchesFocusVisible(target)) { 5953 return; 5954 } 5955 } 5956 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements); 5957 const { 5958 nativeEvent, 5959 currentTarget 5960 } = event; 5961 const delayValue = typeof delay === "function" ? delay() : delay; 5962 if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { 5963 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 5964 return; 5965 } 5966 timeout.start(delayValue, () => { 5967 if (blockFocusRef.current) { 5968 return; 5969 } 5970 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 5971 }); 5972 }, 5973 onBlur(event) { 5974 resetBlockedFocus(); 5975 const relatedTarget = event.relatedTarget; 5976 const nativeEvent = event.nativeEvent; 5977 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 5978 timeout.start(0, () => { 5979 const domReference = store2.select("domReferenceElement"); 5980 const activeEl = activeElement(ownerDocument(domReference)); 5981 if (!relatedTarget && activeEl === domReference) { 5982 return; 5983 } 5984 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 5985 return; 5986 } 5987 const nextFocusedElement = relatedTarget ?? activeEl; 5988 if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) { 5989 return; 5990 } 5991 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 5992 }); 5993 } 5994 }; 5995 }, [dataRef, delay, store2, timeout]); 5996 return React26.useMemo(() => enabled ? { 5997 reference, 5998 trigger: reference 5999 } : {}, [enabled, reference]); 6000 } 6001 6002 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 6003 var React27 = __toESM(require_react(), 1); 6004 6005 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs 6006 var HoverInteraction = class _HoverInteraction { 6007 constructor() { 6008 this.pointerType = void 0; 6009 this.interactedInside = false; 6010 this.handler = void 0; 6011 this.blockMouseMove = true; 6012 this.performedPointerEventsMutation = false; 6013 this.pointerEventsScopeElement = null; 6014 this.pointerEventsReferenceElement = null; 6015 this.pointerEventsFloatingElement = null; 6016 this.restTimeoutPending = false; 6017 this.openChangeTimeout = new Timeout(); 6018 this.restTimeout = new Timeout(); 6019 this.handleCloseOptions = void 0; 6020 } 6021 static create() { 6022 return new _HoverInteraction(); 6023 } 6024 dispose = () => { 6025 this.openChangeTimeout.clear(); 6026 this.restTimeout.clear(); 6027 }; 6028 disposeEffect = () => { 6029 return this.dispose; 6030 }; 6031 }; 6032 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 6033 function clearSafePolygonPointerEventsMutation(instance) { 6034 if (!instance.performedPointerEventsMutation) { 6035 return; 6036 } 6037 const scopeElement = instance.pointerEventsScopeElement; 6038 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 6039 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 6040 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 6041 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 6042 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 6043 } 6044 instance.performedPointerEventsMutation = false; 6045 instance.pointerEventsScopeElement = null; 6046 instance.pointerEventsReferenceElement = null; 6047 instance.pointerEventsFloatingElement = null; 6048 } 6049 function applySafePolygonPointerEventsMutation(instance, options) { 6050 const { 6051 scopeElement, 6052 referenceElement, 6053 floatingElement 6054 } = options; 6055 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 6056 if (existingOwner && existingOwner !== instance) { 6057 clearSafePolygonPointerEventsMutation(existingOwner); 6058 } 6059 clearSafePolygonPointerEventsMutation(instance); 6060 instance.performedPointerEventsMutation = true; 6061 instance.pointerEventsScopeElement = scopeElement; 6062 instance.pointerEventsReferenceElement = referenceElement; 6063 instance.pointerEventsFloatingElement = floatingElement; 6064 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 6065 scopeElement.style.pointerEvents = "none"; 6066 referenceElement.style.pointerEvents = "auto"; 6067 floatingElement.style.pointerEvents = "auto"; 6068 } 6069 function useHoverInteractionSharedState(store2) { 6070 const data = store2.context.dataRef.current; 6071 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; 6072 if (!data.hoverInteractionState) { 6073 data.hoverInteractionState = instance; 6074 } 6075 useOnMount(data.hoverInteractionState.disposeEffect); 6076 return data.hoverInteractionState; 6077 } 6078 6079 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 6080 function useHoverFloatingInteraction(context, parameters = {}) { 6081 const { 6082 enabled = true, 6083 closeDelay: closeDelayProp = 0, 6084 nodeId: nodeIdProp 6085 } = parameters; 6086 const store2 = "rootStore" in context ? context.rootStore : context; 6087 const open = store2.useState("open"); 6088 const floatingElement = store2.useState("floatingElement"); 6089 const domReferenceElement = store2.useState("domReferenceElement"); 6090 const { 6091 dataRef 6092 } = store2.context; 6093 const tree = useFloatingTree(); 6094 const parentId = useFloatingParentNodeId(); 6095 const instance = useHoverInteractionSharedState(store2); 6096 const childClosedTimeout = useTimeout(); 6097 const isClickLikeOpenEvent2 = useStableCallback(() => { 6098 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 6099 }); 6100 const isHoverOpen = useStableCallback(() => { 6101 return isHoverOpenEvent(dataRef.current.openEvent?.type); 6102 }); 6103 const clearPointerEvents = useStableCallback(() => { 6104 clearSafePolygonPointerEventsMutation(instance); 6105 }); 6106 useIsoLayoutEffect(() => { 6107 if (!open) { 6108 instance.pointerType = void 0; 6109 instance.restTimeoutPending = false; 6110 instance.interactedInside = false; 6111 clearPointerEvents(); 6112 } 6113 }, [open, instance, clearPointerEvents]); 6114 React27.useEffect(() => { 6115 return clearPointerEvents; 6116 }, [clearPointerEvents]); 6117 useIsoLayoutEffect(() => { 6118 if (!enabled) { 6119 return void 0; 6120 } 6121 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 6122 const ref = domReferenceElement; 6123 const floatingEl = floatingElement; 6124 const doc = ownerDocument(floatingElement); 6125 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 6126 if (parentFloating) { 6127 parentFloating.style.pointerEvents = ""; 6128 } 6129 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; 6130 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; 6131 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; 6132 applySafePolygonPointerEventsMutation(instance, { 6133 scopeElement, 6134 referenceElement: ref, 6135 floatingElement: floatingEl 6136 }); 6137 return () => { 6138 clearPointerEvents(); 6139 }; 6140 } 6141 return void 0; 6142 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 6143 React27.useEffect(() => { 6144 if (!enabled) { 6145 return void 0; 6146 } 6147 function hasParentChildren() { 6148 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); 6149 } 6150 function closeWithDelay(event) { 6151 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 6152 const close = () => { 6153 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6154 tree?.events.emit("floating.closed", event); 6155 }; 6156 if (closeDelay) { 6157 instance.openChangeTimeout.start(closeDelay, close); 6158 } else { 6159 instance.openChangeTimeout.clear(); 6160 close(); 6161 } 6162 } 6163 function handleInteractInside(event) { 6164 const target = getTarget(event); 6165 if (!isInteractiveElement(target)) { 6166 instance.interactedInside = false; 6167 return; 6168 } 6169 instance.interactedInside = target?.closest("[aria-haspopup]") != null; 6170 } 6171 function onFloatingMouseEnter() { 6172 instance.openChangeTimeout.clear(); 6173 childClosedTimeout.clear(); 6174 tree?.events.off("floating.closed", onNodeClosed); 6175 clearPointerEvents(); 6176 } 6177 function onFloatingMouseLeave(event) { 6178 if (hasParentChildren() && tree) { 6179 tree.events.on("floating.closed", onNodeClosed); 6180 return; 6181 } 6182 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { 6183 return; 6184 } 6185 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 6186 const relatedTarget = event.relatedTarget; 6187 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 6188 if (isMovingIntoDescendantFloating) { 6189 return; 6190 } 6191 if (instance.handler) { 6192 instance.handler(event); 6193 return; 6194 } 6195 clearPointerEvents(); 6196 if (isHoverOpen() && !isClickLikeOpenEvent2()) { 6197 closeWithDelay(event); 6198 } 6199 } 6200 function onNodeClosed(event) { 6201 if (!tree || !parentId || hasParentChildren()) { 6202 return; 6203 } 6204 childClosedTimeout.start(0, () => { 6205 tree.events.off("floating.closed", onNodeClosed); 6206 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6207 tree.events.emit("floating.closed", event); 6208 }); 6209 } 6210 const floating = floatingElement; 6211 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 6212 tree?.events.off("floating.closed", onNodeClosed); 6213 }); 6214 }, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); 6215 } 6216 6217 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs 6218 var React28 = __toESM(require_react(), 1); 6219 var ReactDOM5 = __toESM(require_react_dom(), 1); 6220 var EMPTY_REF = { 6221 current: null 6222 }; 6223 function useHoverReferenceInteraction(context, props = {}) { 6224 const { 6225 enabled = true, 6226 delay = 0, 6227 handleClose = null, 6228 mouseOnly = false, 6229 restMs = 0, 6230 move = true, 6231 triggerElementRef = EMPTY_REF, 6232 externalTree, 6233 isActiveTrigger = true, 6234 getHandleCloseContext, 6235 isClosing, 6236 shouldOpen: shouldOpenProp 6237 } = props; 6238 const store2 = "rootStore" in context ? context.rootStore : context; 6239 const { 6240 dataRef, 6241 events 6242 } = store2.context; 6243 const tree = useFloatingTree(externalTree); 6244 const instance = useHoverInteractionSharedState(store2); 6245 const isHoverCloseActiveRef = React28.useRef(false); 6246 const handleCloseRef = useValueAsRef(handleClose); 6247 const delayRef = useValueAsRef(delay); 6248 const restMsRef = useValueAsRef(restMs); 6249 const enabledRef = useValueAsRef(enabled); 6250 const shouldOpenRef = useValueAsRef(shouldOpenProp); 6251 const isClosingRef = useValueAsRef(isClosing); 6252 const isClickLikeOpenEvent2 = useStableCallback(() => { 6253 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 6254 }); 6255 const checkShouldOpen = useStableCallback(() => { 6256 return shouldOpenRef.current?.() !== false; 6257 }); 6258 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 6259 const allTriggers = store2.context.triggerElements; 6260 if (allTriggers.hasElement(currentTarget)) { 6261 return !currentDomReference || !contains(currentDomReference, currentTarget); 6262 } 6263 if (!isElement(target)) { 6264 return false; 6265 } 6266 const targetElement = target; 6267 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 6268 }); 6269 const cleanupMouseMoveHandler = useStableCallback(() => { 6270 if (!instance.handler) { 6271 return; 6272 } 6273 const doc = ownerDocument(store2.select("domReferenceElement")); 6274 doc.removeEventListener("mousemove", instance.handler); 6275 instance.handler = void 0; 6276 }); 6277 const clearPointerEvents = useStableCallback(() => { 6278 clearSafePolygonPointerEventsMutation(instance); 6279 }); 6280 if (isActiveTrigger) { 6281 instance.handleCloseOptions = handleCloseRef.current?.__options; 6282 } 6283 React28.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 6284 React28.useEffect(() => { 6285 if (!enabled) { 6286 return void 0; 6287 } 6288 function onOpenChangeLocal(details) { 6289 if (!details.open) { 6290 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 6291 cleanupMouseMoveHandler(); 6292 instance.openChangeTimeout.clear(); 6293 instance.restTimeout.clear(); 6294 instance.blockMouseMove = true; 6295 instance.restTimeoutPending = false; 6296 } else { 6297 isHoverCloseActiveRef.current = false; 6298 } 6299 } 6300 events.on("openchange", onOpenChangeLocal); 6301 return () => { 6302 events.off("openchange", onOpenChangeLocal); 6303 }; 6304 }, [enabled, events, instance, cleanupMouseMoveHandler]); 6305 React28.useEffect(() => { 6306 if (!enabled) { 6307 return void 0; 6308 } 6309 function closeWithDelay(event, runElseBranch = true) { 6310 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 6311 if (closeDelay) { 6312 instance.openChangeTimeout.start(closeDelay, () => { 6313 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6314 tree?.events.emit("floating.closed", event); 6315 }); 6316 } else if (runElseBranch) { 6317 instance.openChangeTimeout.clear(); 6318 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6319 tree?.events.emit("floating.closed", event); 6320 } 6321 } 6322 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null); 6323 if (!isElement(trigger)) { 6324 return void 0; 6325 } 6326 function onMouseEnter(event) { 6327 instance.openChangeTimeout.clear(); 6328 instance.blockMouseMove = false; 6329 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 6330 return; 6331 } 6332 const restMsValue = getRestMs(restMsRef.current); 6333 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 6334 const eventTarget = getTarget(event); 6335 const currentTarget = event.currentTarget ?? null; 6336 const currentDomReference = store2.select("domReferenceElement"); 6337 let triggerNode = currentTarget; 6338 if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) { 6339 for (const triggerElement of store2.context.triggerElements.elements()) { 6340 if (contains(triggerElement, eventTarget)) { 6341 triggerNode = triggerElement; 6342 break; 6343 } 6344 } 6345 } 6346 if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 6347 triggerNode = currentDomReference; 6348 } 6349 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 6350 const isOpen = store2.select("open"); 6351 const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending"; 6352 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; 6353 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 6354 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 6355 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 6356 const shouldOpen = !isOpen || isOverInactive; 6357 if (shouldOpenImmediately) { 6358 if (checkShouldOpen()) { 6359 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6360 } 6361 return; 6362 } 6363 if (isRestOnlyDelay) { 6364 return; 6365 } 6366 if (openDelay) { 6367 instance.openChangeTimeout.start(openDelay, () => { 6368 if (shouldOpen && checkShouldOpen()) { 6369 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6370 } 6371 }); 6372 } else if (shouldOpen) { 6373 if (checkShouldOpen()) { 6374 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6375 } 6376 } 6377 } 6378 function onMouseLeave(event) { 6379 if (isClickLikeOpenEvent2()) { 6380 clearPointerEvents(); 6381 return; 6382 } 6383 cleanupMouseMoveHandler(); 6384 const domReferenceElement = store2.select("domReferenceElement"); 6385 const doc = ownerDocument(domReferenceElement); 6386 instance.restTimeout.clear(); 6387 instance.restTimeoutPending = false; 6388 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 6389 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { 6390 return; 6391 } 6392 if (handleCloseRef.current && handleCloseContextBase) { 6393 if (!store2.select("open")) { 6394 instance.openChangeTimeout.clear(); 6395 } 6396 const currentTrigger = triggerElementRef.current; 6397 instance.handler = handleCloseRef.current({ 6398 ...handleCloseContextBase, 6399 tree, 6400 x: event.clientX, 6401 y: event.clientY, 6402 onClose() { 6403 clearPointerEvents(); 6404 cleanupMouseMoveHandler(); 6405 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) { 6406 closeWithDelay(event, true); 6407 } 6408 } 6409 }); 6410 doc.addEventListener("mousemove", instance.handler); 6411 instance.handler(event); 6412 return; 6413 } 6414 const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true; 6415 if (shouldClose) { 6416 closeWithDelay(event); 6417 } 6418 } 6419 if (move) { 6420 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 6421 once: true 6422 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 6423 } 6424 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 6425 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen]); 6426 return React28.useMemo(() => { 6427 if (!enabled) { 6428 return void 0; 6429 } 6430 function setPointerRef(event) { 6431 instance.pointerType = event.pointerType; 6432 } 6433 return { 6434 onPointerDown: setPointerRef, 6435 onPointerEnter: setPointerRef, 6436 onMouseMove(event) { 6437 const { 6438 nativeEvent 6439 } = event; 6440 const trigger = event.currentTarget; 6441 const currentDomReference = store2.select("domReferenceElement"); 6442 const currentOpen = store2.select("open"); 6443 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 6444 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 6445 return; 6446 } 6447 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 6448 const floatingElement = store2.select("floatingElement"); 6449 if (floatingElement) { 6450 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 6451 applySafePolygonPointerEventsMutation(instance, { 6452 scopeElement, 6453 referenceElement: trigger, 6454 floatingElement 6455 }); 6456 } 6457 } 6458 const restMsValue = getRestMs(restMsRef.current); 6459 if (currentOpen && !isOverInactive || restMsValue === 0) { 6460 return; 6461 } 6462 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 6463 return; 6464 } 6465 instance.restTimeout.clear(); 6466 function handleMouseMove() { 6467 instance.restTimeoutPending = false; 6468 if (isClickLikeOpenEvent2()) { 6469 return; 6470 } 6471 const latestOpen = store2.select("open"); 6472 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { 6473 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 6474 } 6475 } 6476 if (instance.pointerType === "touch") { 6477 ReactDOM5.flushSync(() => { 6478 handleMouseMove(); 6479 }); 6480 } else if (isOverInactive && currentOpen) { 6481 handleMouseMove(); 6482 } else { 6483 instance.restTimeoutPending = true; 6484 instance.restTimeout.start(restMsValue, handleMouseMove); 6485 } 6486 } 6487 }; 6488 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]); 6489 } 6490 6491 // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs 6492 var CURSOR_SPEED_THRESHOLD = 0.1; 6493 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 6494 var POLYGON_BUFFER = 0.5; 6495 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 6496 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 6497 } 6498 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { 6499 let isInsideValue = false; 6500 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { 6501 isInsideValue = !isInsideValue; 6502 } 6503 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { 6504 isInsideValue = !isInsideValue; 6505 } 6506 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 6507 isInsideValue = !isInsideValue; 6508 } 6509 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 6510 isInsideValue = !isInsideValue; 6511 } 6512 return isInsideValue; 6513 } 6514 function isInsideRect(pointX, pointY, rect) { 6515 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 6516 } 6517 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { 6518 const minX = Math.min(x1, x2); 6519 const maxX = Math.max(x1, x2); 6520 const minY = Math.min(y1, y2); 6521 const maxY = Math.max(y1, y2); 6522 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 6523 } 6524 function safePolygon(options = {}) { 6525 const { 6526 blockPointerEvents = false 6527 } = options; 6528 const timeout = new Timeout(); 6529 const fn = ({ 6530 x, 6531 y, 6532 placement, 6533 elements, 6534 onClose, 6535 nodeId, 6536 tree 6537 }) => { 6538 const side = placement?.split("-")[0]; 6539 let hasLanded = false; 6540 let lastX = null; 6541 let lastY = null; 6542 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 6543 function isCursorMovingSlowly(nextX, nextY) { 6544 const currentTime = performance.now(); 6545 const elapsedTime = currentTime - lastCursorTime; 6546 if (lastX === null || lastY === null || elapsedTime === 0) { 6547 lastX = nextX; 6548 lastY = nextY; 6549 lastCursorTime = currentTime; 6550 return false; 6551 } 6552 const deltaX = nextX - lastX; 6553 const deltaY = nextY - lastY; 6554 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 6555 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 6556 lastX = nextX; 6557 lastY = nextY; 6558 lastCursorTime = currentTime; 6559 return distanceSquared < thresholdSquared; 6560 } 6561 function close() { 6562 timeout.clear(); 6563 onClose(); 6564 } 6565 return function onMouseMove(event) { 6566 timeout.clear(); 6567 const domReference = elements.domReference; 6568 const floating = elements.floating; 6569 if (!domReference || !floating || side == null || x == null || y == null) { 6570 return void 0; 6571 } 6572 const { 6573 clientX, 6574 clientY 6575 } = event; 6576 const target = getTarget(event); 6577 const isLeave = event.type === "mouseleave"; 6578 const isOverFloatingEl = contains(floating, target); 6579 const isOverReferenceEl = contains(domReference, target); 6580 if (isOverFloatingEl) { 6581 hasLanded = true; 6582 if (!isLeave) { 6583 return void 0; 6584 } 6585 } 6586 if (isOverReferenceEl) { 6587 hasLanded = false; 6588 if (!isLeave) { 6589 hasLanded = true; 6590 return void 0; 6591 } 6592 } 6593 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 6594 return void 0; 6595 } 6596 function hasOpenChildNode() { 6597 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 6598 } 6599 function closeIfNoOpenChild() { 6600 if (!hasOpenChildNode()) { 6601 close(); 6602 } 6603 } 6604 if (hasOpenChildNode()) { 6605 return void 0; 6606 } 6607 const refRect = domReference.getBoundingClientRect(); 6608 const rect = floating.getBoundingClientRect(); 6609 const cursorLeaveFromRight = x > rect.right - rect.width / 2; 6610 const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; 6611 const isFloatingWider = rect.width > refRect.width; 6612 const isFloatingTaller = rect.height > refRect.height; 6613 const left = (isFloatingWider ? refRect : rect).left; 6614 const right = (isFloatingWider ? refRect : rect).right; 6615 const top = (isFloatingTaller ? refRect : rect).top; 6616 const bottom = (isFloatingTaller ? refRect : rect).bottom; 6617 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) { 6618 closeIfNoOpenChild(); 6619 return void 0; 6620 } 6621 let isInsideTroughRect = false; 6622 switch (side) { 6623 case "top": 6624 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 6625 break; 6626 case "bottom": 6627 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 6628 break; 6629 case "left": 6630 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 6631 break; 6632 case "right": 6633 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 6634 break; 6635 default: 6636 } 6637 if (isInsideTroughRect) { 6638 return void 0; 6639 } 6640 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 6641 closeIfNoOpenChild(); 6642 return void 0; 6643 } 6644 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 6645 closeIfNoOpenChild(); 6646 return void 0; 6647 } 6648 let isInsidePolygon = false; 6649 switch (side) { 6650 case "top": { 6651 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6652 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6653 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6654 const cursorPointY = y + POLYGON_BUFFER + 1; 6655 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 6656 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 6657 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 6658 break; 6659 } 6660 case "bottom": { 6661 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6662 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6663 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6664 const cursorPointY = y - POLYGON_BUFFER; 6665 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 6666 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 6667 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 6668 break; 6669 } 6670 case "left": { 6671 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6672 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6673 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6674 const cursorPointX = x + POLYGON_BUFFER + 1; 6675 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 6676 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 6677 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 6678 break; 6679 } 6680 case "right": { 6681 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6682 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6683 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6684 const cursorPointX = x - POLYGON_BUFFER; 6685 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 6686 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 6687 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 6688 break; 6689 } 6690 default: 6691 } 6692 if (!isInsidePolygon) { 6693 closeIfNoOpenChild(); 6694 } else if (!hasLanded) { 6695 timeout.start(40, closeIfNoOpenChild); 6696 } 6697 return void 0; 6698 }; 6699 }; 6700 fn.__options = { 6701 ...options, 6702 blockPointerEvents 6703 }; 6704 return fn; 6705 } 6706 6707 // node_modules/@base-ui/react/utils/popupStateMapping.mjs 6708 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) { 6709 CommonPopupDataAttributes2["open"] = "data-open"; 6710 CommonPopupDataAttributes2["closed"] = "data-closed"; 6711 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 6712 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 6713 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden"; 6714 CommonPopupDataAttributes2["side"] = "data-side"; 6715 CommonPopupDataAttributes2["align"] = "data-align"; 6716 return CommonPopupDataAttributes2; 6717 })({}); 6718 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) { 6719 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open"; 6720 CommonTriggerDataAttributes2["pressed"] = "data-pressed"; 6721 return CommonTriggerDataAttributes2; 6722 })({}); 6723 var TRIGGER_HOOK = { 6724 [CommonTriggerDataAttributes.popupOpen]: "" 6725 }; 6726 var PRESSABLE_TRIGGER_HOOK = { 6727 [CommonTriggerDataAttributes.popupOpen]: "", 6728 [CommonTriggerDataAttributes.pressed]: "" 6729 }; 6730 var POPUP_OPEN_HOOK = { 6731 [CommonPopupDataAttributes.open]: "" 6732 }; 6733 var POPUP_CLOSED_HOOK = { 6734 [CommonPopupDataAttributes.closed]: "" 6735 }; 6736 var ANCHOR_HIDDEN_HOOK = { 6737 [CommonPopupDataAttributes.anchorHidden]: "" 6738 }; 6739 var triggerOpenStateMapping = { 6740 open(value) { 6741 if (value) { 6742 return TRIGGER_HOOK; 6743 } 6744 return null; 6745 } 6746 }; 6747 var popupStateMapping = { 6748 open(value) { 6749 if (value) { 6750 return POPUP_OPEN_HOOK; 6751 } 6752 return POPUP_CLOSED_HOOK; 6753 }, 6754 anchorHidden(value) { 6755 if (value) { 6756 return ANCHOR_HIDDEN_HOOK; 6757 } 6758 return null; 6759 } 6760 }; 6761 6762 // node_modules/@base-ui/utils/inertValue.mjs 6763 function inertValue(value) { 6764 if (isReactVersionAtLeast(19)) { 6765 return value; 6766 } 6767 return value ? "true" : void 0; 6768 } 6769 6770 // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs 6771 var React29 = __toESM(require_react(), 1); 6772 6773 // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs 6774 var baseArrow = (options) => ({ 6775 name: "arrow", 6776 options, 6777 async fn(state) { 6778 const { 6779 x, 6780 y, 6781 placement, 6782 rects, 6783 platform: platform3, 6784 elements, 6785 middlewareData 6786 } = state; 6787 const { 6788 element, 6789 padding = 0, 6790 offsetParent = "real" 6791 } = evaluate(options, state) || {}; 6792 if (element == null) { 6793 return {}; 6794 } 6795 const paddingObject = getPaddingObject(padding); 6796 const coords = { 6797 x, 6798 y 6799 }; 6800 const axis = getAlignmentAxis(placement); 6801 const length = getAxisLength(axis); 6802 const arrowDimensions = await platform3.getDimensions(element); 6803 const isYAxis = axis === "y"; 6804 const minProp = isYAxis ? "top" : "left"; 6805 const maxProp = isYAxis ? "bottom" : "right"; 6806 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 6807 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 6808 const startDiff = coords[axis] - rects.reference[axis]; 6809 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; 6810 let clientSize = elements.floating[clientProp] || rects.floating[length]; 6811 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { 6812 clientSize = elements.floating[clientProp] || rects.floating[length]; 6813 } 6814 const centerToReference = endDiff / 2 - startDiff / 2; 6815 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 6816 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 6817 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 6818 const min2 = minPadding; 6819 const max2 = clientSize - arrowDimensions[length] - maxPadding; 6820 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 6821 const offset4 = clamp(min2, center, max2); 6822 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 6823 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; 6824 return { 6825 [axis]: coords[axis] + alignmentOffset, 6826 data: { 6827 [axis]: offset4, 6828 centerOffset: center - offset4 - alignmentOffset, 6829 ...shouldAddOffset && { 6830 alignmentOffset 6831 } 6832 }, 6833 reset: shouldAddOffset 6834 }; 6835 } 6836 }); 6837 var arrow4 = (options, deps) => ({ 6838 ...baseArrow(options), 6839 options: [options, deps] 6840 }); 6841 6842 // node_modules/@base-ui/react/utils/hideMiddleware.mjs 6843 var nativeHideFn = hide3().fn; 6844 var hide4 = { 6845 name: "hide", 6846 async fn(state) { 6847 const { 6848 width, 6849 height, 6850 x, 6851 y 6852 } = state.rects.reference; 6853 const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0; 6854 const nativeHideResult = await nativeHideFn(state); 6855 return { 6856 data: { 6857 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden 6858 } 6859 }; 6860 } 6861 }; 6862 6863 // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs 6864 var DEFAULT_SIDES = { 6865 sideX: "left", 6866 sideY: "top" 6867 }; 6868 var adaptiveOrigin = { 6869 name: "adaptiveOrigin", 6870 async fn(state) { 6871 const { 6872 x: rawX, 6873 y: rawY, 6874 rects: { 6875 floating: floatRect 6876 }, 6877 elements: { 6878 floating 6879 }, 6880 platform: platform3, 6881 strategy, 6882 placement 6883 } = state; 6884 const win = getWindow(floating); 6885 const styles = win.getComputedStyle(floating); 6886 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 6887 if (!hasTransition) { 6888 return { 6889 x: rawX, 6890 y: rawY, 6891 data: DEFAULT_SIDES 6892 }; 6893 } 6894 const offsetParent = await platform3.getOffsetParent?.(floating); 6895 let offsetDimensions = { 6896 width: 0, 6897 height: 0 6898 }; 6899 if (strategy === "fixed" && win?.visualViewport) { 6900 offsetDimensions = { 6901 width: win.visualViewport.width, 6902 height: win.visualViewport.height 6903 }; 6904 } else if (offsetParent === win) { 6905 const doc = ownerDocument(floating); 6906 offsetDimensions = { 6907 width: doc.documentElement.clientWidth, 6908 height: doc.documentElement.clientHeight 6909 }; 6910 } else if (await platform3.isElement?.(offsetParent)) { 6911 offsetDimensions = await platform3.getDimensions(offsetParent); 6912 } 6913 const currentSide = getSide(placement); 6914 let x = rawX; 6915 let y = rawY; 6916 if (currentSide === "left") { 6917 x = offsetDimensions.width - (rawX + floatRect.width); 6918 } 6919 if (currentSide === "top") { 6920 y = offsetDimensions.height - (rawY + floatRect.height); 6921 } 6922 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 6923 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 6924 return { 6925 x, 6926 y, 6927 data: { 6928 sideX, 6929 sideY 6930 } 6931 }; 6932 } 6933 }; 6934 6935 // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs 6936 function getLogicalSide(sideParam, renderedSide, isRtl) { 6937 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 6938 const logicalRight = isRtl ? "inline-start" : "inline-end"; 6939 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 6940 return { 6941 top: "top", 6942 right: isLogicalSideParam ? logicalRight : "right", 6943 bottom: "bottom", 6944 left: isLogicalSideParam ? logicalLeft : "left" 6945 }[renderedSide]; 6946 } 6947 function getOffsetData(state, sideParam, isRtl) { 6948 const { 6949 rects, 6950 placement 6951 } = state; 6952 const data = { 6953 side: getLogicalSide(sideParam, getSide(placement), isRtl), 6954 align: getAlignment(placement) || "center", 6955 anchor: { 6956 width: rects.reference.width, 6957 height: rects.reference.height 6958 }, 6959 positioner: { 6960 width: rects.floating.width, 6961 height: rects.floating.height 6962 } 6963 }; 6964 return data; 6965 } 6966 function useAnchorPositioning(params) { 6967 const { 6968 // Public parameters 6969 anchor, 6970 positionMethod = "absolute", 6971 side: sideParam = "bottom", 6972 sideOffset = 0, 6973 align = "center", 6974 alignOffset = 0, 6975 collisionBoundary, 6976 collisionPadding: collisionPaddingParam = 5, 6977 sticky = false, 6978 arrowPadding = 5, 6979 disableAnchorTracking = false, 6980 inline: inlineMiddleware, 6981 // Private parameters 6982 keepMounted = false, 6983 floatingRootContext, 6984 mounted, 6985 collisionAvoidance, 6986 shiftCrossAxis = false, 6987 nodeId, 6988 adaptiveOrigin: adaptiveOrigin2, 6989 lazyFlip = false, 6990 externalTree 6991 } = params; 6992 const [mountSide, setMountSide] = React29.useState(null); 6993 if (!mounted && mountSide !== null) { 6994 setMountSide(null); 6995 } 6996 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 6997 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 6998 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 6999 const anchorFn = typeof anchor === "function" ? anchor : void 0; 7000 const anchorFnCallback = useStableCallback(anchorFn); 7001 const anchorDep = anchorFn ? anchorFnCallback : anchor; 7002 const anchorValueRef = useValueAsRef(anchor); 7003 const mountedRef = useValueAsRef(mounted); 7004 const direction = useDirection(); 7005 const isRtl = direction === "rtl"; 7006 const side = mountSide || { 7007 top: "top", 7008 right: "right", 7009 bottom: "bottom", 7010 left: "left", 7011 "inline-end": isRtl ? "left" : "right", 7012 "inline-start": isRtl ? "right" : "left" 7013 }[sideParam]; 7014 const placement = align === "center" ? side : `$side}-$align}`; 7015 let collisionPadding = collisionPaddingParam; 7016 const bias = 1; 7017 const biasTop = sideParam === "bottom" ? bias : 0; 7018 const biasBottom = sideParam === "top" ? bias : 0; 7019 const biasLeft = sideParam === "right" ? bias : 0; 7020 const biasRight = sideParam === "left" ? bias : 0; 7021 if (typeof collisionPadding === "number") { 7022 collisionPadding = { 7023 top: collisionPadding + biasTop, 7024 right: collisionPadding + biasRight, 7025 bottom: collisionPadding + biasBottom, 7026 left: collisionPadding + biasLeft 7027 }; 7028 } else if (collisionPadding) { 7029 collisionPadding = { 7030 top: (collisionPadding.top || 0) + biasTop, 7031 right: (collisionPadding.right || 0) + biasRight, 7032 bottom: (collisionPadding.bottom || 0) + biasBottom, 7033 left: (collisionPadding.left || 0) + biasLeft 7034 }; 7035 } 7036 const commonCollisionProps = { 7037 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 7038 padding: collisionPadding 7039 }; 7040 const arrowRef = React29.useRef(null); 7041 const sideOffsetRef = useValueAsRef(sideOffset); 7042 const alignOffsetRef = useValueAsRef(alignOffset); 7043 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 7044 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 7045 const middleware = []; 7046 if (inlineMiddleware) { 7047 middleware.push(inlineMiddleware); 7048 } 7049 middleware.push(offset3((state) => { 7050 const data = getOffsetData(state, sideParam, isRtl); 7051 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 7052 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 7053 return { 7054 mainAxis: sideAxis, 7055 crossAxis: alignAxis, 7056 alignmentAxis: alignAxis 7057 }; 7058 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); 7059 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 7060 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 7061 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 7062 ...commonCollisionProps, 7063 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 7064 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 7065 padding: { 7066 top: collisionPadding.top + bias, 7067 right: collisionPadding.right + bias, 7068 bottom: collisionPadding.bottom + bias, 7069 left: collisionPadding.left + bias 7070 }, 7071 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 7072 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 7073 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 7074 }); 7075 const shiftMiddleware = shiftDisabled ? null : shift3((data) => { 7076 const html = ownerDocument(data.elements.floating).documentElement; 7077 return { 7078 ...commonCollisionProps, 7079 // Use the Layout Viewport to avoid shifting around when pinch-zooming 7080 // for context menus. 7081 rootBoundary: shiftCrossAxis ? { 7082 x: 0, 7083 y: 0, 7084 width: html.clientWidth, 7085 height: html.clientHeight 7086 } : void 0, 7087 mainAxis: collisionAvoidanceAlign !== "none", 7088 crossAxis: crossAxisShiftEnabled, 7089 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 7090 if (!arrowRef.current) { 7091 return {}; 7092 } 7093 const { 7094 width, 7095 height 7096 } = arrowRef.current.getBoundingClientRect(); 7097 const sideAxis = getSideAxis(getSide(limitData.placement)); 7098 const arrowSize = sideAxis === "y" ? width : height; 7099 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 7100 return { 7101 offset: arrowSize / 2 + offsetAmount / 2 7102 }; 7103 }) 7104 }; 7105 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]); 7106 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { 7107 middleware.push(shiftMiddleware, flipMiddleware); 7108 } else { 7109 middleware.push(flipMiddleware, shiftMiddleware); 7110 } 7111 middleware.push(size3({ 7112 ...commonCollisionProps, 7113 apply({ 7114 elements: { 7115 floating 7116 }, 7117 availableWidth, 7118 availableHeight, 7119 rects 7120 }) { 7121 if (!mountedRef.current) { 7122 return; 7123 } 7124 const floatingStyle = floating.style; 7125 floatingStyle.setProperty("--available-width", `$availableWidth}px`); 7126 floatingStyle.setProperty("--available-height", `$availableHeight}px`); 7127 const dpr = getWindow(floating).devicePixelRatio || 1; 7128 const { 7129 x: x2, 7130 y: y2, 7131 width, 7132 height 7133 } = rects.reference; 7134 const anchorWidth = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr; 7135 const anchorHeight = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr; 7136 floatingStyle.setProperty("--anchor-width", `$anchorWidth}px`); 7137 floatingStyle.setProperty("--anchor-height", `$anchorHeight}px`); 7138 } 7139 }), arrow4((state) => ({ 7140 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 7141 // we'll create a fake element. 7142 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), 7143 padding: arrowPadding, 7144 offsetParent: "floating" 7145 }), [arrowPadding]), { 7146 name: "transformOrigin", 7147 fn(state) { 7148 const { 7149 elements: elements2, 7150 middlewareData: middlewareData2, 7151 placement: renderedPlacement2, 7152 rects, 7153 y: y2 7154 } = state; 7155 const currentRenderedSide = getSide(renderedPlacement2); 7156 const currentRenderedAxis = getSideAxis(currentRenderedSide); 7157 const arrowEl = arrowRef.current; 7158 const arrowX = middlewareData2.arrow?.x || 0; 7159 const arrowY = middlewareData2.arrow?.y || 0; 7160 const arrowWidth = arrowEl?.clientWidth || 0; 7161 const arrowHeight = arrowEl?.clientHeight || 0; 7162 const transformX = arrowX + arrowWidth / 2; 7163 const transformY = arrowY + arrowHeight / 2; 7164 const shiftY = Math.abs(middlewareData2.shift?.y || 0); 7165 const halfAnchorHeight = rects.reference.height / 2; 7166 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; 7167 const isOverlappingAnchor = shiftY > sideOffsetValue; 7168 const adjacentTransformOrigin = { 7169 top: `$transformX}px calc(100% + $sideOffsetValue}px)`, 7170 bottom: `$transformX}px ${-sideOffsetValue}px`, 7171 left: `calc(100% + $sideOffsetValue}px) $transformY}px`, 7172 right: `${-sideOffsetValue}px $transformY}px` 7173 }[currentRenderedSide]; 7174 const overlapTransformOrigin = `$transformX}px $rects.reference.y + halfAnchorHeight - y2}px`; 7175 elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin); 7176 return {}; 7177 } 7178 }, hide4, adaptiveOrigin2); 7179 useIsoLayoutEffect(() => { 7180 if (!mounted && floatingRootContext) { 7181 floatingRootContext.update({ 7182 referenceElement: null, 7183 floatingElement: null, 7184 domReferenceElement: null, 7185 positionReference: null 7186 }); 7187 } 7188 }, [mounted, floatingRootContext]); 7189 const autoUpdateOptions = React29.useMemo(() => ({ 7190 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 7191 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 7192 }), [disableAnchorTracking]); 7193 const { 7194 refs, 7195 elements, 7196 x, 7197 y, 7198 middlewareData, 7199 update: update2, 7200 placement: renderedPlacement, 7201 context, 7202 isPositioned, 7203 floatingStyles: originalFloatingStyles 7204 } = useFloating2({ 7205 rootContext: floatingRootContext, 7206 open: keepMounted ? mounted : void 0, 7207 placement, 7208 middleware, 7209 strategy: positionMethod, 7210 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 7211 nodeId, 7212 externalTree 7213 }); 7214 const { 7215 sideX, 7216 sideY 7217 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 7218 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 7219 const floatingStyles = React29.useMemo(() => { 7220 const base = adaptiveOrigin2 ? { 7221 position: resolvedPosition, 7222 [sideX]: x, 7223 [sideY]: y 7224 } : { 7225 position: resolvedPosition, 7226 ...originalFloatingStyles 7227 }; 7228 if (!isPositioned) { 7229 base.opacity = 0; 7230 } 7231 return base; 7232 }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]); 7233 const registeredPositionReferenceRef = React29.useRef(null); 7234 useIsoLayoutEffect(() => { 7235 if (!mounted) { 7236 return; 7237 } 7238 const anchorValue = anchorValueRef.current; 7239 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 7240 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 7241 const finalAnchor = unwrappedElement || null; 7242 if (finalAnchor !== registeredPositionReferenceRef.current) { 7243 refs.setPositionReference(finalAnchor); 7244 registeredPositionReferenceRef.current = finalAnchor; 7245 } 7246 }, [mounted, refs, anchorDep, anchorValueRef]); 7247 React29.useEffect(() => { 7248 if (!mounted) { 7249 return; 7250 } 7251 const anchorValue = anchorValueRef.current; 7252 if (typeof anchorValue === "function") { 7253 return; 7254 } 7255 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 7256 refs.setPositionReference(anchorValue.current); 7257 registeredPositionReferenceRef.current = anchorValue.current; 7258 } 7259 }, [mounted, refs, anchorDep, anchorValueRef]); 7260 React29.useEffect(() => { 7261 if (keepMounted && mounted && elements.reference && elements.floating) { 7262 return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions); 7263 } 7264 return void 0; 7265 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); 7266 const renderedSide = getSide(renderedPlacement); 7267 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 7268 const renderedAlign = getAlignment(renderedPlacement) || "center"; 7269 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden); 7270 useIsoLayoutEffect(() => { 7271 if (lazyFlip && mounted && isPositioned) { 7272 setMountSide(renderedSide); 7273 } 7274 }, [lazyFlip, mounted, isPositioned, renderedSide]); 7275 const arrowStyles = React29.useMemo(() => ({ 7276 position: "absolute", 7277 top: middlewareData.arrow?.y, 7278 left: middlewareData.arrow?.x 7279 }), [middlewareData.arrow]); 7280 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 7281 return React29.useMemo(() => ({ 7282 positionerStyles: floatingStyles, 7283 arrowStyles, 7284 arrowRef, 7285 arrowUncentered, 7286 side: logicalRenderedSide, 7287 align: renderedAlign, 7288 physicalSide: renderedSide, 7289 anchorHidden, 7290 refs, 7291 context, 7292 isPositioned, 7293 update: update2 7294 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]); 7295 } 7296 function isRef(param) { 7297 return param != null && "current" in param; 7298 } 7299 7300 // node_modules/@base-ui/react/utils/getDisabledMountTransitionStyles.mjs 7301 function getDisabledMountTransitionStyles(transitionStatus) { 7302 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; 7303 } 7304 7305 // node_modules/@base-ui/react/utils/usePositioner.mjs 7306 function usePositioner(componentProps, state, { 7307 styles, 7308 transitionStatus, 7309 props, 7310 refs, 7311 hidden, 7312 inert = false 7313 }) { 7314 const style = { 7315 ...styles 7316 }; 7317 if (inert) { 7318 style.pointerEvents = "none"; 7319 } 7320 return useRenderElement("div", componentProps, { 7321 state, 7322 ref: refs, 7323 props: [{ 7324 role: "presentation", 7325 hidden, 7326 style 7327 }, getDisabledMountTransitionStyles(transitionStatus), props], 7328 stateAttributesMapping: popupStateMapping 7329 }); 7330 } 7331 7332 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 7333 var React32 = __toESM(require_react(), 1); 7334 var ReactDOM6 = __toESM(require_react_dom(), 1); 7335 7336 // node_modules/@base-ui/utils/usePreviousValue.mjs 7337 var React30 = __toESM(require_react(), 1); 7338 function usePreviousValue(value) { 7339 const [state, setState] = React30.useState({ 7340 current: value, 7341 previous: null 7342 }); 7343 if (value !== state.current) { 7344 setState({ 7345 current: value, 7346 previous: state.current 7347 }); 7348 } 7349 return state.previous; 7350 } 7351 7352 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 7353 var React31 = __toESM(require_react(), 1); 7354 7355 // node_modules/@base-ui/react/utils/getCssDimensions.mjs 7356 function getCssDimensions2(element) { 7357 const css = getComputedStyle2(element); 7358 let width = parseFloat(css.width) || 0; 7359 let height = parseFloat(css.height) || 0; 7360 const hasOffset = isHTMLElement(element); 7361 const offsetWidth = hasOffset ? element.offsetWidth : width; 7362 const offsetHeight = hasOffset ? element.offsetHeight : height; 7363 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 7364 if (shouldFallback) { 7365 width = offsetWidth; 7366 height = offsetHeight; 7367 } 7368 return { 7369 width, 7370 height 7371 }; 7372 } 7373 7374 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 7375 function usePopupAutoResize(parameters) { 7376 const { 7377 popupElement, 7378 positionerElement, 7379 content, 7380 mounted, 7381 onMeasureLayout: onMeasureLayoutParam, 7382 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 7383 side, 7384 direction 7385 } = parameters; 7386 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false); 7387 const animationFrame = useAnimationFrame(); 7388 const committedDimensionsRef = React31.useRef(null); 7389 const isInitialRenderRef = React31.useRef(true); 7390 const restoreAnchoringStylesRef = React31.useRef(NOOP); 7391 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 7392 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 7393 const anchoringStyles = React31.useMemo(() => { 7394 let isOriginSide = side === "top"; 7395 let isPhysicalLeft = side === "left"; 7396 if (direction === "rtl") { 7397 isOriginSide = isOriginSide || side === "inline-end"; 7398 isPhysicalLeft = isPhysicalLeft || side === "inline-end"; 7399 } else { 7400 isOriginSide = isOriginSide || side === "inline-start"; 7401 isPhysicalLeft = isPhysicalLeft || side === "inline-start"; 7402 } 7403 return isOriginSide ? { 7404 position: "absolute", 7405 [side === "top" ? "bottom" : "top"]: "0", 7406 [isPhysicalLeft ? "right" : "left"]: "0" 7407 } : EMPTY_OBJECT; 7408 }, [side, direction]); 7409 useIsoLayoutEffect(() => { 7410 if (!mounted) { 7411 restoreAnchoringStylesRef.current = NOOP; 7412 isInitialRenderRef.current = true; 7413 committedDimensionsRef.current = null; 7414 return void 0; 7415 } 7416 if (!popupElement || !positionerElement) { 7417 return void 0; 7418 } 7419 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); 7420 setPopupCssSize(popupElement, "auto"); 7421 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 7422 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 7423 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 7424 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 7425 "--available-width": "max-content", 7426 "--available-height": "max-content" 7427 }); 7428 function restoreMeasurementOverrides() { 7429 restorePopupPosition(); 7430 restorePopupTransform(); 7431 restorePositionerAvailableSize(); 7432 } 7433 function restoreMeasurementOverridesIncludingScale() { 7434 restoreMeasurementOverrides(); 7435 restorePopupScale(); 7436 } 7437 onMeasureLayout?.(); 7438 if (isInitialRenderRef.current || committedDimensionsRef.current === null) { 7439 setPositionerCssSize(positionerElement, "max-content"); 7440 const dimensions = getCssDimensions2(popupElement); 7441 committedDimensionsRef.current = dimensions; 7442 setPositionerCssSize(positionerElement, dimensions); 7443 restoreMeasurementOverridesIncludingScale(); 7444 onMeasureLayoutComplete?.(null, dimensions); 7445 isInitialRenderRef.current = false; 7446 return () => { 7447 restoreAnchoringStylesRef.current(); 7448 restoreAnchoringStylesRef.current = NOOP; 7449 }; 7450 } 7451 setPositionerCssSize(positionerElement, "max-content"); 7452 const previousDimensions = committedDimensionsRef.current; 7453 const newDimensions = getCssDimensions2(popupElement); 7454 committedDimensionsRef.current = newDimensions; 7455 setPopupCssSize(popupElement, previousDimensions); 7456 restoreMeasurementOverridesIncludingScale(); 7457 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 7458 setPositionerCssSize(positionerElement, newDimensions); 7459 const abortController = new AbortController(); 7460 animationFrame.request(() => { 7461 setPopupCssSize(popupElement, newDimensions); 7462 runOnceAnimationsFinish(() => { 7463 popupElement.style.setProperty("--popup-width", "auto"); 7464 popupElement.style.setProperty("--popup-height", "auto"); 7465 }, abortController.signal); 7466 }); 7467 return () => { 7468 abortController.abort(); 7469 animationFrame.cancel(); 7470 restoreAnchoringStylesRef.current(); 7471 restoreAnchoringStylesRef.current = NOOP; 7472 }; 7473 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 7474 } 7475 function overrideElementStyle(element, property, value) { 7476 const originalValue = element.style.getPropertyValue(property); 7477 element.style.setProperty(property, value); 7478 return () => { 7479 element.style.setProperty(property, originalValue); 7480 }; 7481 } 7482 function applyElementStyles(element, styles) { 7483 const restorers = []; 7484 for (const [key, value] of Object.entries(styles)) { 7485 restorers.push(overrideElementStyle(element, key, value)); 7486 } 7487 return restorers.length ? () => { 7488 restorers.forEach((restore) => restore()); 7489 } : NOOP; 7490 } 7491 function setPopupCssSize(popupElement, size4) { 7492 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 7493 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 7494 popupElement.style.setProperty("--popup-width", width); 7495 popupElement.style.setProperty("--popup-height", height); 7496 } 7497 function setPositionerCssSize(positionerElement, size4) { 7498 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 7499 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 7500 positionerElement.style.setProperty("--positioner-width", width); 7501 positionerElement.style.setProperty("--positioner-height", height); 7502 } 7503 7504 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 7505 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 7506 function usePopupViewport(parameters) { 7507 const { 7508 store: store2, 7509 side, 7510 cssVars, 7511 children 7512 } = parameters; 7513 const direction = useDirection(); 7514 const activeTrigger = store2.useState("activeTriggerElement"); 7515 const activeTriggerId = store2.useState("activeTriggerId"); 7516 const open = store2.useState("open"); 7517 const payload = store2.useState("payload"); 7518 const mounted = store2.useState("mounted"); 7519 const popupElement = store2.useState("popupElement"); 7520 const positionerElement = store2.useState("positionerElement"); 7521 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null); 7522 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 7523 const capturedNodeRef = React32.useRef(null); 7524 const [previousContentNode, setPreviousContentNode] = React32.useState(null); 7525 const [newTriggerOffset, setNewTriggerOffset] = React32.useState(null); 7526 const currentContainerRef = React32.useRef(null); 7527 const previousContainerRef = React32.useRef(null); 7528 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false); 7529 const cleanupFrame = useAnimationFrame(); 7530 const [previousContentDimensions, setPreviousContentDimensions] = React32.useState(null); 7531 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React32.useState(false); 7532 useIsoLayoutEffect(() => { 7533 store2.set("hasViewport", true); 7534 return () => { 7535 store2.set("hasViewport", false); 7536 }; 7537 }, [store2]); 7538 const handleMeasureLayout = useStableCallback(() => { 7539 currentContainerRef.current?.style.setProperty("animation", "none"); 7540 currentContainerRef.current?.style.setProperty("transition", "none"); 7541 previousContainerRef.current?.style.setProperty("display", "none"); 7542 }); 7543 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 7544 currentContainerRef.current?.style.removeProperty("animation"); 7545 currentContainerRef.current?.style.removeProperty("transition"); 7546 previousContainerRef.current?.style.removeProperty("display"); 7547 if (previousDimensions) { 7548 setPreviousContentDimensions(previousDimensions); 7549 } 7550 }); 7551 const lastHandledTriggerRef = React32.useRef(null); 7552 useIsoLayoutEffect(() => { 7553 if (!open || !mounted) { 7554 lastHandledTriggerRef.current = null; 7555 } 7556 }, [open, mounted]); 7557 useIsoLayoutEffect(() => { 7558 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 7559 setPreviousContentNode(capturedNodeRef.current); 7560 setShowStartingStyleAttribute(true); 7561 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 7562 setNewTriggerOffset(offset4); 7563 cleanupFrame.request(() => { 7564 ReactDOM6.flushSync(() => { 7565 setShowStartingStyleAttribute(false); 7566 }); 7567 onAnimationsFinished(() => { 7568 setPreviousContentNode(null); 7569 setPreviousContentDimensions(null); 7570 capturedNodeRef.current = null; 7571 }); 7572 }); 7573 lastHandledTriggerRef.current = activeTrigger; 7574 } 7575 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]); 7576 useIsoLayoutEffect(() => { 7577 const source = currentContainerRef.current; 7578 if (!source) { 7579 return; 7580 } 7581 const wrapper = ownerDocument(source).createElement("div"); 7582 for (const child of Array.from(source.childNodes)) { 7583 wrapper.appendChild(child.cloneNode(true)); 7584 } 7585 capturedNodeRef.current = wrapper; 7586 }); 7587 const isTransitioning = previousContentNode != null; 7588 let childrenToRender; 7589 if (!isTransitioning) { 7590 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7591 "data-current": true, 7592 ref: currentContainerRef, 7593 children 7594 }, currentContentKey); 7595 } else { 7596 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(React32.Fragment, { 7597 children: [/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7598 "data-previous": true, 7599 inert: inertValue(true), 7600 ref: previousContainerRef, 7601 style: { 7602 ...previousContentDimensions ? { 7603 [cssVars.popupWidth]: `$previousContentDimensions.width}px`, 7604 [cssVars.popupHeight]: `$previousContentDimensions.height}px` 7605 } : null, 7606 position: "absolute" 7607 }, 7608 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 7609 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7610 "data-current": true, 7611 ref: currentContainerRef, 7612 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 7613 children 7614 }, currentContentKey)] 7615 }); 7616 } 7617 useIsoLayoutEffect(() => { 7618 const container = previousContainerRef.current; 7619 if (!container || !previousContentNode) { 7620 return; 7621 } 7622 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 7623 }, [previousContentNode]); 7624 usePopupAutoResize({ 7625 popupElement, 7626 positionerElement, 7627 mounted, 7628 content: payload, 7629 onMeasureLayout: handleMeasureLayout, 7630 onMeasureLayoutComplete: handleMeasureLayoutComplete, 7631 side, 7632 direction 7633 }); 7634 const state = { 7635 activationDirection: getActivationDirection(newTriggerOffset), 7636 transitioning: isTransitioning 7637 }; 7638 return { 7639 children: childrenToRender, 7640 state 7641 }; 7642 } 7643 function getActivationDirection(offset4) { 7644 if (!offset4) { 7645 return void 0; 7646 } 7647 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 7648 } 7649 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 7650 if (value > tolerance) { 7651 return positiveLabel; 7652 } 7653 if (value < -tolerance) { 7654 return negativeLabel; 7655 } 7656 return ""; 7657 } 7658 function calculateRelativePosition(from, to) { 7659 const fromRect = from.getBoundingClientRect(); 7660 const toRect = to.getBoundingClientRect(); 7661 const fromCenter = { 7662 x: fromRect.left + fromRect.width / 2, 7663 y: fromRect.top + fromRect.height / 2 7664 }; 7665 const toCenter = { 7666 x: toRect.left + toRect.width / 2, 7667 y: toRect.top + toRect.height / 2 7668 }; 7669 return { 7670 horizontal: toCenter.x - fromCenter.x, 7671 vertical: toCenter.y - fromCenter.y 7672 }; 7673 } 7674 function usePopupContentKey(activeTriggerId, payload) { 7675 const [contentKey, setContentKey] = React32.useState(0); 7676 const previousActiveTriggerIdRef = React32.useRef(activeTriggerId); 7677 const previousPayloadRef = React32.useRef(payload); 7678 const pendingPayloadUpdateRef = React32.useRef(false); 7679 useIsoLayoutEffect(() => { 7680 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 7681 const previousPayload = previousPayloadRef.current; 7682 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 7683 const payloadChanged = payload !== previousPayload; 7684 if (triggerIdChanged) { 7685 setContentKey((value) => value + 1); 7686 pendingPayloadUpdateRef.current = !payloadChanged; 7687 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 7688 setContentKey((value) => value + 1); 7689 pendingPayloadUpdateRef.current = false; 7690 } 7691 previousActiveTriggerIdRef.current = activeTriggerId; 7692 previousPayloadRef.current = payload; 7693 }, [activeTriggerId, payload]); 7694 return `$activeTriggerId ?? "current"}-$contentKey}`; 7695 } 7696 7697 // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs 7698 var React33 = __toESM(require_react(), 1); 7699 var ReactDOM7 = __toESM(require_react_dom(), 1); 7700 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 7701 var FloatingPortalLite = /* @__PURE__ */ React33.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 7702 const { 7703 children, 7704 container, 7705 className, 7706 render, 7707 style, 7708 ...elementProps 7709 } = componentProps; 7710 const { 7711 portalNode, 7712 portalSubtree 7713 } = useFloatingPortalNode({ 7714 container, 7715 ref: forwardedRef, 7716 componentProps, 7717 elementProps 7718 }); 7719 if (!portalSubtree && !portalNode) { 7720 return null; 7721 } 7722 return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React33.Fragment, { 7723 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] 7724 }); 7725 }); 7726 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 7727 7728 // node_modules/@base-ui/react/tooltip/index.parts.mjs 7729 var index_parts_exports = {}; 7730 __export(index_parts_exports, { 7731 Arrow: () => TooltipArrow, 7732 Handle: () => TooltipHandle, 7733 Popup: () => TooltipPopup, 7734 Portal: () => TooltipPortal, 7735 Positioner: () => TooltipPositioner, 7736 Provider: () => TooltipProvider, 7737 Root: () => TooltipRoot, 7738 Trigger: () => TooltipTrigger, 7739 Viewport: () => TooltipViewport, 7740 createHandle: () => createTooltipHandle 7741 }); 7742 7743 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 7744 var React36 = __toESM(require_react(), 1); 7745 7746 // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs 7747 var React34 = __toESM(require_react(), 1); 7748 var TooltipRootContext = /* @__PURE__ */ React34.createContext(void 0); 7749 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 7750 function useTooltipRootContext(optional) { 7751 const context = React34.useContext(TooltipRootContext); 7752 if (context === void 0 && !optional) { 7753 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 7754 } 7755 return context; 7756 } 7757 7758 // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs 7759 var React35 = __toESM(require_react(), 1); 7760 var selectors2 = { 7761 ...popupStoreSelectors, 7762 disabled: createSelector((state) => state.disabled), 7763 instantType: createSelector((state) => state.instantType), 7764 isInstantPhase: createSelector((state) => state.isInstantPhase), 7765 trackCursorAxis: createSelector((state) => state.trackCursorAxis), 7766 disableHoverablePopup: createSelector((state) => state.disableHoverablePopup), 7767 lastOpenChangeReason: createSelector((state) => state.openChangeReason), 7768 closeOnClick: createSelector((state) => state.closeOnClick), 7769 closeDelay: createSelector((state) => state.closeDelay), 7770 hasViewport: createSelector((state) => state.hasViewport) 7771 }; 7772 var TooltipStore = class _TooltipStore extends ReactStore { 7773 constructor(initialState, floatingId, nested = false) { 7774 const triggerElements = new PopupTriggerMap(); 7775 const state = { 7776 ...createInitialState(), 7777 ...initialState 7778 }; 7779 state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested); 7780 super(state, { 7781 popupRef: /* @__PURE__ */ React35.createRef(), 7782 onOpenChange: void 0, 7783 onOpenChangeComplete: void 0, 7784 triggerElements 7785 }, selectors2); 7786 } 7787 setOpen = (nextOpen, eventDetails) => { 7788 applyPopupOpenChange(this, nextOpen, eventDetails, { 7789 extraState: { 7790 openChangeReason: eventDetails.reason 7791 } 7792 }); 7793 }; 7794 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. 7795 cancelPendingOpen(event) { 7796 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); 7797 } 7798 static useStore(externalStore, initialState) { 7799 const store2 = usePopupStore(externalStore, (floatingId, nested) => new _TooltipStore(initialState, floatingId, nested)).store; 7800 return store2; 7801 } 7802 }; 7803 function createInitialState() { 7804 return { 7805 ...createInitialPopupStoreState(), 7806 disabled: false, 7807 instantType: void 0, 7808 isInstantPhase: false, 7809 trackCursorAxis: "none", 7810 disableHoverablePopup: false, 7811 openChangeReason: null, 7812 closeOnClick: true, 7813 closeDelay: 0, 7814 hasViewport: false 7815 }; 7816 } 7817 7818 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 7819 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 7820 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 7821 const { 7822 disabled: disabled2 = false, 7823 defaultOpen = false, 7824 open: openProp, 7825 disableHoverablePopup = false, 7826 trackCursorAxis = "none", 7827 actionsRef, 7828 onOpenChange, 7829 onOpenChangeComplete, 7830 handle, 7831 triggerId: triggerIdProp, 7832 defaultTriggerId: defaultTriggerIdProp = null, 7833 children 7834 } = props; 7835 const store2 = TooltipStore.useStore(handle?.store, { 7836 open: defaultOpen, 7837 openProp, 7838 activeTriggerId: defaultTriggerIdProp, 7839 triggerIdProp 7840 }); 7841 useInitialOpenSync(store2, openProp, defaultOpen, defaultTriggerIdProp); 7842 store2.useControlledProp("openProp", openProp); 7843 store2.useControlledProp("triggerIdProp", triggerIdProp); 7844 store2.useContextCallback("onOpenChange", onOpenChange); 7845 store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 7846 const openState = store2.useState("open"); 7847 const open = !disabled2 && openState; 7848 const activeTriggerId = store2.useState("activeTriggerId"); 7849 const mounted = store2.useState("mounted"); 7850 const payload = store2.useState("payload"); 7851 store2.useSyncedValues({ 7852 trackCursorAxis, 7853 disableHoverablePopup 7854 }); 7855 store2.useSyncedValue("disabled", disabled2); 7856 useImplicitActiveTrigger(store2, { 7857 closeOnActiveTriggerUnmount: true 7858 }); 7859 const { 7860 forceUnmount, 7861 transitionStatus 7862 } = useOpenStateTransitions(open, store2); 7863 const isInstantPhase = store2.useState("isInstantPhase"); 7864 const instantType = store2.useState("instantType"); 7865 const lastOpenChangeReason = store2.useState("lastOpenChangeReason"); 7866 const previousInstantTypeRef = React36.useRef(null); 7867 useIsoLayoutEffect(() => { 7868 if (openState && disabled2) { 7869 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 7870 } 7871 }, [openState, disabled2, store2]); 7872 useIsoLayoutEffect(() => { 7873 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 7874 if (instantType !== "delay") { 7875 previousInstantTypeRef.current = instantType; 7876 } 7877 store2.set("instantType", "delay"); 7878 } else if (previousInstantTypeRef.current !== null) { 7879 store2.set("instantType", previousInstantTypeRef.current); 7880 previousInstantTypeRef.current = null; 7881 } 7882 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]); 7883 useIsoLayoutEffect(() => { 7884 if (open) { 7885 if (activeTriggerId == null) { 7886 store2.set("payload", void 0); 7887 } 7888 } 7889 }, [store2, activeTriggerId, open]); 7890 const handleImperativeClose = React36.useCallback(() => { 7891 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 7892 }, [store2]); 7893 React36.useImperativeHandle(actionsRef, () => ({ 7894 unmount: forceUnmount, 7895 close: handleImperativeClose 7896 }), [forceUnmount, handleImperativeClose]); 7897 const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none"; 7898 return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(TooltipRootContext.Provider, { 7899 value: store2, 7900 children: [shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipInteractions, { 7901 store: store2, 7902 disabled: disabled2, 7903 trackCursorAxis 7904 }), typeof children === "function" ? children({ 7905 payload 7906 }) : children] 7907 }); 7908 }); 7909 if (true) TooltipRoot.displayName = "TooltipRoot"; 7910 function TooltipInteractions({ 7911 store: store2, 7912 disabled: disabled2, 7913 trackCursorAxis 7914 }) { 7915 const floatingRootContext = store2.useState("floatingRootContext"); 7916 const dismiss = useDismiss(floatingRootContext, { 7917 enabled: !disabled2, 7918 referencePress: () => store2.select("closeOnClick") 7919 }); 7920 const clientPoint = useClientPoint(floatingRootContext, { 7921 enabled: !disabled2 && trackCursorAxis !== "none", 7922 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 7923 }); 7924 const activeTriggerProps = React36.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); 7925 const inactiveTriggerProps = React36.useMemo(() => mergeProps(clientPoint.trigger, dismiss.trigger), [clientPoint.trigger, dismiss.trigger]); 7926 const popupProps = React36.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [clientPoint.floating, dismiss.floating]); 7927 usePopupInteractionProps(store2, { 7928 activeTriggerProps, 7929 inactiveTriggerProps, 7930 popupProps 7931 }); 7932 return null; 7933 } 7934 7935 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 7936 var React38 = __toESM(require_react(), 1); 7937 7938 // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs 7939 var React37 = __toESM(require_react(), 1); 7940 var TooltipProviderContext = /* @__PURE__ */ React37.createContext(void 0); 7941 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 7942 function useTooltipProviderContext() { 7943 return React37.useContext(TooltipProviderContext); 7944 } 7945 7946 // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs 7947 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) { 7948 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen"; 7949 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled"; 7950 return TooltipTriggerDataAttributes2; 7951 })({}); 7952 7953 // node_modules/@base-ui/react/tooltip/utils/constants.mjs 7954 var OPEN_DELAY = 600; 7955 7956 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 7957 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; 7958 function getTargetElement(event) { 7959 if ("composedPath" in event) { 7960 const path = event.composedPath(); 7961 for (let i = 0; i < path.length; i += 1) { 7962 const element = path[i]; 7963 if (isElement(element)) { 7964 return element; 7965 } 7966 } 7967 } 7968 const target = event.target; 7969 if (isElement(target)) { 7970 return target; 7971 } 7972 return null; 7973 } 7974 function closestEnabledTooltipTrigger(element) { 7975 let current = element; 7976 while (current) { 7977 if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) { 7978 return current; 7979 } 7980 const parentElement = current.parentElement; 7981 if (parentElement) { 7982 current = parentElement; 7983 continue; 7984 } 7985 const root = current.getRootNode(); 7986 current = "host" in root && isElement(root.host) ? root.host : null; 7987 } 7988 return null; 7989 } 7990 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 7991 const { 7992 render, 7993 className, 7994 style, 7995 handle, 7996 payload, 7997 disabled: disabledProp, 7998 delay, 7999 closeOnClick = true, 8000 closeDelay, 8001 id: idProp, 8002 ...elementProps 8003 } = componentProps; 8004 const rootContext = useTooltipRootContext(true); 8005 const store2 = handle?.store ?? rootContext; 8006 if (!store2) { 8007 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)); 8008 } 8009 const thisTriggerId = useBaseUiId(idProp); 8010 const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId); 8011 const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId); 8012 const floatingRootContext = store2.useState("floatingRootContext"); 8013 const triggerElementRef = React38.useRef(null); 8014 const delayWithDefault = delay ?? OPEN_DELAY; 8015 const closeDelayWithDefault = closeDelay ?? 0; 8016 const { 8017 registerTrigger, 8018 isMountedByThisTrigger 8019 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, { 8020 payload, 8021 closeOnClick, 8022 closeDelay: closeDelayWithDefault 8023 }); 8024 const providerContext = useTooltipProviderContext(); 8025 const { 8026 delayRef, 8027 isInstantPhase, 8028 hasProvider 8029 } = useDelayGroup(floatingRootContext, { 8030 open: isOpenedByThisTrigger 8031 }); 8032 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); 8033 store2.useSyncedValue("isInstantPhase", isInstantPhase); 8034 const rootDisabled = store2.useState("disabled"); 8035 const disabled2 = disabledProp ?? rootDisabled; 8036 const disabledRef = useValueAsRef(disabled2); 8037 const trackCursorAxis = store2.useState("trackCursorAxis"); 8038 const disableHoverablePopup = store2.useState("disableHoverablePopup"); 8039 const isNestedTriggerHoveredRef = React38.useRef(false); 8040 const nestedTriggerOpenTimeout = useTimeout(); 8041 const pointerTypeRef = React38.useRef(void 0); 8042 function getOpenDelay() { 8043 const providerDelay = providerContext?.delay; 8044 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0; 8045 let computedOpenDelay = delayWithDefault; 8046 if (hasProvider) { 8047 if (groupOpenValue !== 0) { 8048 computedOpenDelay = delay ?? providerDelay ?? delayWithDefault; 8049 } else { 8050 computedOpenDelay = 0; 8051 } 8052 } 8053 return computedOpenDelay; 8054 } 8055 function isEnabledNestedTriggerTarget(target) { 8056 const triggerEl = triggerElementRef.current; 8057 if (!triggerEl || !target) { 8058 return false; 8059 } 8060 const nearestTrigger = closestEnabledTooltipTrigger(target); 8061 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); 8062 } 8063 function detectNestedTriggerHover(target) { 8064 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); 8065 isNestedTriggerHoveredRef.current = nestedTriggerHovered; 8066 if (nestedTriggerHovered) { 8067 hoverInteraction.openChangeTimeout.clear(); 8068 hoverInteraction.restTimeout.clear(); 8069 hoverInteraction.restTimeoutPending = false; 8070 nestedTriggerOpenTimeout.clear(); 8071 } 8072 return nestedTriggerHovered; 8073 } 8074 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 8075 enabled: !disabled2, 8076 mouseOnly: true, 8077 move: false, 8078 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 8079 restMs: getOpenDelay, 8080 delay() { 8081 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0; 8082 let computedCloseDelay = closeDelayWithDefault; 8083 if (closeDelay == null && hasProvider) { 8084 computedCloseDelay = closeValue; 8085 } 8086 return { 8087 close: computedCloseDelay 8088 }; 8089 }, 8090 triggerElementRef, 8091 isActiveTrigger: isTriggerActive, 8092 isClosing: () => store2.select("transitionStatus") === "ending", 8093 shouldOpen() { 8094 return !isNestedTriggerHoveredRef.current; 8095 } 8096 }); 8097 const focusProps = useFocus(floatingRootContext, { 8098 enabled: !disabled2 8099 }).reference; 8100 const handleNestedTriggerHover = (event) => { 8101 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; 8102 const target = getTargetElement(event); 8103 const nestedTriggerHovered = detectNestedTriggerHover(target); 8104 const triggerEl = triggerElementRef.current; 8105 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); 8106 if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { 8107 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8108 return; 8109 } 8110 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. 8111 isMouseLikePointerType(pointerTypeRef.current)) { 8112 const open = () => { 8113 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) { 8114 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); 8115 } 8116 }; 8117 const openDelay = getOpenDelay(); 8118 if (openDelay === 0) { 8119 nestedTriggerOpenTimeout.clear(); 8120 open(); 8121 } else { 8122 nestedTriggerOpenTimeout.start(openDelay, open); 8123 } 8124 } 8125 }; 8126 const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger); 8127 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; 8128 const state = { 8129 open: isOpenedByThisTrigger 8130 }; 8131 const element = useRenderElement("button", componentProps, { 8132 state, 8133 ref: [forwardedRef, registerTrigger, triggerElementRef], 8134 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { 8135 onMouseOver(event) { 8136 handleNestedTriggerHover(event.nativeEvent); 8137 }, 8138 onFocus(event) { 8139 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { 8140 event.preventBaseUIHandler(); 8141 } 8142 }, 8143 onMouseLeave() { 8144 isNestedTriggerHoveredRef.current = false; 8145 nestedTriggerOpenTimeout.clear(); 8146 pointerTypeRef.current = void 0; 8147 }, 8148 onPointerEnter(event) { 8149 pointerTypeRef.current = event.pointerType; 8150 }, 8151 onPointerDown(event) { 8152 pointerTypeRef.current = event.pointerType; 8153 store2.set("closeOnClick", closeOnClick); 8154 if (closeOnClick && !store2.select("open")) { 8155 store2.cancelPendingOpen(event.nativeEvent); 8156 } 8157 }, 8158 onClick(event) { 8159 if (closeOnClick && !store2.select("open")) { 8160 store2.cancelPendingOpen(event.nativeEvent); 8161 } 8162 }, 8163 id: thisTriggerId, 8164 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0, 8165 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" 8166 }, elementProps], 8167 stateAttributesMapping: triggerOpenStateMapping 8168 }); 8169 return element; 8170 }); 8171 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 8172 8173 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 8174 var React40 = __toESM(require_react(), 1); 8175 8176 // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs 8177 var React39 = __toESM(require_react(), 1); 8178 var TooltipPortalContext = /* @__PURE__ */ React39.createContext(void 0); 8179 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 8180 function useTooltipPortalContext() { 8181 const value = React39.useContext(TooltipPortalContext); 8182 if (value === void 0) { 8183 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 8184 } 8185 return value; 8186 } 8187 8188 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 8189 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 8190 var TooltipPortal = /* @__PURE__ */ React40.forwardRef(function TooltipPortal2(props, forwardedRef) { 8191 const { 8192 keepMounted = false, 8193 ...portalProps 8194 } = props; 8195 const store2 = useTooltipRootContext(); 8196 const mounted = store2.useState("mounted"); 8197 const shouldRender = mounted || keepMounted; 8198 if (!shouldRender) { 8199 return null; 8200 } 8201 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipPortalContext.Provider, { 8202 value: keepMounted, 8203 children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FloatingPortalLite, { 8204 ref: forwardedRef, 8205 ...portalProps 8206 }) 8207 }); 8208 }); 8209 if (true) TooltipPortal.displayName = "TooltipPortal"; 8210 8211 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 8212 var React42 = __toESM(require_react(), 1); 8213 8214 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs 8215 var React41 = __toESM(require_react(), 1); 8216 var TooltipPositionerContext = /* @__PURE__ */ React41.createContext(void 0); 8217 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 8218 function useTooltipPositionerContext() { 8219 const context = React41.useContext(TooltipPositionerContext); 8220 if (context === void 0) { 8221 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 8222 } 8223 return context; 8224 } 8225 8226 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 8227 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 8228 var TooltipPositioner = /* @__PURE__ */ React42.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 8229 const { 8230 render, 8231 className, 8232 anchor, 8233 positionMethod = "absolute", 8234 side = "top", 8235 align = "center", 8236 sideOffset = 0, 8237 alignOffset = 0, 8238 collisionBoundary = "clipping-ancestors", 8239 collisionPadding = 5, 8240 arrowPadding = 5, 8241 sticky = false, 8242 disableAnchorTracking = false, 8243 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 8244 style, 8245 ...elementProps 8246 } = componentProps; 8247 const store2 = useTooltipRootContext(); 8248 const keepMounted = useTooltipPortalContext(); 8249 const open = store2.useState("open"); 8250 const mounted = store2.useState("mounted"); 8251 const trackCursorAxis = store2.useState("trackCursorAxis"); 8252 const disableHoverablePopup = store2.useState("disableHoverablePopup"); 8253 const floatingRootContext = store2.useState("floatingRootContext"); 8254 const instantType = store2.useState("instantType"); 8255 const transitionStatus = store2.useState("transitionStatus"); 8256 const hasViewport = store2.useState("hasViewport"); 8257 const positioning = useAnchorPositioning({ 8258 anchor, 8259 positionMethod, 8260 floatingRootContext, 8261 mounted, 8262 side, 8263 sideOffset, 8264 align, 8265 alignOffset, 8266 collisionBoundary, 8267 collisionPadding, 8268 sticky, 8269 arrowPadding, 8270 disableAnchorTracking, 8271 keepMounted, 8272 collisionAvoidance, 8273 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0 8274 }); 8275 const state = React42.useMemo(() => ({ 8276 open, 8277 side: positioning.side, 8278 align: positioning.align, 8279 anchorHidden: positioning.anchorHidden, 8280 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 8281 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 8282 const element = usePositioner(componentProps, state, { 8283 styles: positioning.positionerStyles, 8284 transitionStatus, 8285 props: elementProps, 8286 refs: [forwardedRef, store2.useStateSetter("positionerElement")], 8287 hidden: !mounted, 8288 inert: !open || trackCursorAxis === "both" || disableHoverablePopup 8289 }); 8290 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPositionerContext.Provider, { 8291 value: positioning, 8292 children: element 8293 }); 8294 }); 8295 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 8296 8297 // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs 8298 var React43 = __toESM(require_react(), 1); 8299 var stateAttributesMapping = { 8300 ...popupStateMapping, 8301 ...transitionStatusMapping 8302 }; 8303 var TooltipPopup = /* @__PURE__ */ React43.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 8304 const { 8305 render, 8306 className, 8307 style, 8308 ...elementProps 8309 } = componentProps; 8310 const store2 = useTooltipRootContext(); 8311 const { 8312 side, 8313 align 8314 } = useTooltipPositionerContext(); 8315 const open = store2.useState("open"); 8316 const instantType = store2.useState("instantType"); 8317 const transitionStatus = store2.useState("transitionStatus"); 8318 const popupProps = store2.useState("popupProps"); 8319 const floatingContext = store2.useState("floatingRootContext"); 8320 const disabled2 = store2.useState("disabled"); 8321 const closeDelay = store2.useState("closeDelay"); 8322 useOpenChangeComplete({ 8323 open, 8324 ref: store2.context.popupRef, 8325 onComplete() { 8326 if (open) { 8327 store2.context.onOpenChangeComplete?.(true); 8328 } 8329 } 8330 }); 8331 useHoverFloatingInteraction(floatingContext, { 8332 enabled: !disabled2, 8333 closeDelay 8334 }); 8335 const setPopupElement = store2.useStateSetter("popupElement"); 8336 const state = { 8337 open, 8338 side, 8339 align, 8340 instant: instantType, 8341 transitionStatus 8342 }; 8343 const element = useRenderElement("div", componentProps, { 8344 state, 8345 ref: [forwardedRef, store2.context.popupRef, setPopupElement], 8346 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 8347 stateAttributesMapping 8348 }); 8349 return element; 8350 }); 8351 if (true) TooltipPopup.displayName = "TooltipPopup"; 8352 8353 // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs 8354 var React44 = __toESM(require_react(), 1); 8355 var TooltipArrow = /* @__PURE__ */ React44.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 8356 const { 8357 render, 8358 className, 8359 style, 8360 ...elementProps 8361 } = componentProps; 8362 const store2 = useTooltipRootContext(); 8363 const { 8364 arrowRef, 8365 side, 8366 align, 8367 arrowUncentered, 8368 arrowStyles 8369 } = useTooltipPositionerContext(); 8370 const open = store2.useState("open"); 8371 const instantType = store2.useState("instantType"); 8372 const state = { 8373 open, 8374 side, 8375 align, 8376 uncentered: arrowUncentered, 8377 instant: instantType 8378 }; 8379 const element = useRenderElement("div", componentProps, { 8380 state, 8381 ref: [forwardedRef, arrowRef], 8382 props: [{ 8383 style: arrowStyles, 8384 "aria-hidden": true 8385 }, elementProps], 8386 stateAttributesMapping: popupStateMapping 8387 }); 8388 return element; 8389 }); 8390 if (true) TooltipArrow.displayName = "TooltipArrow"; 8391 8392 // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs 8393 var React45 = __toESM(require_react(), 1); 8394 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 8395 var TooltipProvider = function TooltipProvider2(props) { 8396 const { 8397 delay, 8398 closeDelay, 8399 timeout = 400 8400 } = props; 8401 const contextValue = React45.useMemo(() => ({ 8402 delay, 8403 closeDelay 8404 }), [delay, closeDelay]); 8405 const delayValue = React45.useMemo(() => ({ 8406 open: delay, 8407 close: closeDelay 8408 }), [delay, closeDelay]); 8409 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipProviderContext.Provider, { 8410 value: contextValue, 8411 children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FloatingDelayGroup, { 8412 delay: delayValue, 8413 timeoutMs: timeout, 8414 children: props.children 8415 }) 8416 }); 8417 }; 8418 if (true) TooltipProvider.displayName = "TooltipProvider"; 8419 8420 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 8421 var React46 = __toESM(require_react(), 1); 8422 8423 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewportCssVars.mjs 8424 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) { 8425 TooltipViewportCssVars2["popupWidth"] = "--popup-width"; 8426 TooltipViewportCssVars2["popupHeight"] = "--popup-height"; 8427 return TooltipViewportCssVars2; 8428 })({}); 8429 8430 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 8431 var stateAttributesMapping2 = { 8432 activationDirection: (value) => value ? { 8433 "data-activation-direction": value 8434 } : null 8435 }; 8436 var TooltipViewport = /* @__PURE__ */ React46.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 8437 const { 8438 render, 8439 className, 8440 style, 8441 children, 8442 ...elementProps 8443 } = componentProps; 8444 const store2 = useTooltipRootContext(); 8445 const positioner = useTooltipPositionerContext(); 8446 const instantType = store2.useState("instantType"); 8447 const { 8448 children: childrenToRender, 8449 state: viewportState 8450 } = usePopupViewport({ 8451 store: store2, 8452 side: positioner.side, 8453 cssVars: TooltipViewportCssVars, 8454 children 8455 }); 8456 const state = { 8457 activationDirection: viewportState.activationDirection, 8458 transitioning: viewportState.transitioning, 8459 instant: instantType 8460 }; 8461 return useRenderElement("div", componentProps, { 8462 state, 8463 ref: forwardedRef, 8464 props: [elementProps, { 8465 children: childrenToRender 8466 }], 8467 stateAttributesMapping: stateAttributesMapping2 8468 }); 8469 }); 8470 if (true) TooltipViewport.displayName = "TooltipViewport"; 8471 8472 // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs 8473 var TooltipHandle = class { 8474 /** 8475 * Internal store holding the tooltip state. 8476 * @internal 8477 */ 8478 constructor() { 8479 this.store = new TooltipStore(); 8480 } 8481 /** 8482 * Opens the tooltip and associates it with the trigger with the given ID. 8483 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop. 8484 * 8485 * This method should only be called in an event handler or an effect (not during rendering). 8486 * 8487 * @param triggerId ID of the trigger to associate with the tooltip. 8488 */ 8489 open(triggerId) { 8490 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; 8491 if (triggerId && !triggerElement) { 8492 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "$triggerId}".` : formatErrorMessage_default(81, triggerId)); 8493 } 8494 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 8495 } 8496 /** 8497 * Closes the tooltip. 8498 */ 8499 close() { 8500 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); 8501 } 8502 /** 8503 * Indicates whether the tooltip is currently open. 8504 */ 8505 get isOpen() { 8506 return this.store.select("open"); 8507 } 8508 }; 8509 function createTooltipHandle() { 8510 return new TooltipHandle(); 8511 } 8512 8513 // node_modules/@base-ui/react/use-render/useRender.mjs 8514 function useRender(params) { 8515 return useRenderElement(params.defaultTagName ?? "div", params, params); 8516 } 8517 8518 // packages/icons/build-module/library/chevron-down.mjs 8519 var import_primitives = __toESM(require_primitives(), 1); 8520 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 8521 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); 8522 8523 // packages/icons/build-module/library/chevron-left.mjs 8524 var import_primitives2 = __toESM(require_primitives(), 1); 8525 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 8526 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives2.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); 8527 8528 // packages/icons/build-module/library/chevron-right.mjs 8529 var import_primitives3 = __toESM(require_primitives(), 1); 8530 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 8531 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives3.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); 8532 8533 // packages/icons/build-module/library/chevron-up.mjs 8534 var import_primitives4 = __toESM(require_primitives(), 1); 8535 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 8536 var chevron_up_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); 8537 8538 // packages/icons/build-module/library/fullscreen.mjs 8539 var import_primitives5 = __toESM(require_primitives(), 1); 8540 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 8541 var fullscreen_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives5.Path, { d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" }) }); 8542 8543 // packages/ui/build-module/utils/render-slot-with-children.mjs 8544 var import_element10 = __toESM(require_element(), 1); 8545 function renderSlotWithChildren(slot, defaultSlot, children) { 8546 return (0, import_element10.cloneElement)(slot ?? defaultSlot, { children }); 8547 } 8548 8549 // packages/ui/build-module/utils/theme-provider.mjs 8550 var theme = __toESM(require_theme(), 1); 8551 8552 // packages/ui/build-module/lock-unlock.mjs 8553 var import_private_apis = __toESM(require_private_apis(), 1); 8554 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 8555 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 8556 "@wordpress/ui" 8557 ); 8558 8559 // packages/ui/build-module/utils/theme-provider.mjs 8560 function getThemeProvider() { 8561 const themePackage = theme; 8562 if (themePackage.ThemeProvider) { 8563 return themePackage.ThemeProvider; 8564 } 8565 if (!themePackage.privateApis) { 8566 throw new Error( 8567 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." 8568 ); 8569 } 8570 return unlock( 8571 themePackage.privateApis 8572 ).ThemeProvider; 8573 } 8574 var ThemeProvider = getThemeProvider(); 8575 8576 // packages/ui/build-module/stack/stack.mjs 8577 var import_element11 = __toESM(require_element(), 1); 8578 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 8579 function getRuntime() { 8580 const globalScope = globalThis; 8581 if (globalScope.__wpStyleRuntime) { 8582 return globalScope.__wpStyleRuntime; 8583 } 8584 globalScope.__wpStyleRuntime = { 8585 documents: /* @__PURE__ */ new Map(), 8586 styles: /* @__PURE__ */ new Map(), 8587 injectedStyles: /* @__PURE__ */ new WeakMap() 8588 }; 8589 if (typeof document !== "undefined") { 8590 registerDocument(document); 8591 } 8592 return globalScope.__wpStyleRuntime; 8593 } 8594 function documentContainsStyleHash(targetDocument, hash) { 8595 if (!targetDocument.head) { 8596 return false; 8597 } 8598 for (const style of targetDocument.head.querySelectorAll( 8599 `style[$STYLE_HASH_ATTRIBUTE}]` 8600 )) { 8601 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 8602 return true; 8603 } 8604 } 8605 return false; 8606 } 8607 function injectStyle(targetDocument, hash, css) { 8608 if (!targetDocument.head) { 8609 return; 8610 } 8611 const runtime = getRuntime(); 8612 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8613 if (!injectedStyles) { 8614 injectedStyles = /* @__PURE__ */ new Set(); 8615 runtime.injectedStyles.set(targetDocument, injectedStyles); 8616 } 8617 if (injectedStyles.has(hash)) { 8618 return; 8619 } 8620 if (documentContainsStyleHash(targetDocument, hash)) { 8621 injectedStyles.add(hash); 8622 return; 8623 } 8624 const style = targetDocument.createElement("style"); 8625 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 8626 style.appendChild(targetDocument.createTextNode(css)); 8627 targetDocument.head.appendChild(style); 8628 injectedStyles.add(hash); 8629 } 8630 function registerDocument(targetDocument) { 8631 const runtime = getRuntime(); 8632 runtime.documents.set( 8633 targetDocument, 8634 (runtime.documents.get(targetDocument) ?? 0) + 1 8635 ); 8636 for (const [hash, css] of runtime.styles) { 8637 injectStyle(targetDocument, hash, css); 8638 } 8639 return () => { 8640 const count = runtime.documents.get(targetDocument); 8641 if (count === void 0) { 8642 return; 8643 } 8644 if (count <= 1) { 8645 runtime.documents.delete(targetDocument); 8646 return; 8647 } 8648 runtime.documents.set(targetDocument, count - 1); 8649 }; 8650 } 8651 function registerStyle(hash, css) { 8652 const runtime = getRuntime(); 8653 runtime.styles.set(hash, css); 8654 for (const targetDocument of runtime.documents.keys()) { 8655 injectStyle(targetDocument, hash, css); 8656 } 8657 } 8658 if (typeof process === "undefined" || true) { 8659 registerStyle("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); 8660 } 8661 var style_default = { "stack": "_19ce0419607e1896__stack" }; 8662 var gapTokens = { 8663 xs: "var(--wpds-dimension-gap-xs, 4px)", 8664 sm: "var(--wpds-dimension-gap-sm, 8px)", 8665 md: "var(--wpds-dimension-gap-md, 12px)", 8666 lg: "var(--wpds-dimension-gap-lg, 16px)", 8667 xl: "var(--wpds-dimension-gap-xl, 24px)", 8668 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 8669 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 8670 }; 8671 var Stack = (0, import_element11.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { 8672 const style = { 8673 gap: gap && gapTokens[gap], 8674 alignItems: align, 8675 justifyContent: justify, 8676 flexDirection: direction, 8677 flexWrap: wrap 8678 }; 8679 const element = useRender({ 8680 render, 8681 ref, 8682 props: mergeProps(props, { style, className: style_default.stack }) 8683 }); 8684 return element; 8685 }); 8686 8687 // packages/ui/build-module/tooltip/index.mjs 8688 var tooltip_exports = {}; 8689 __export(tooltip_exports, { 8690 Popup: () => Popup, 8691 Portal: () => Portal, 8692 Positioner: () => Positioner, 8693 Provider: () => Provider, 8694 Root: () => Root, 8695 Trigger: () => Trigger 8696 }); 8697 8698 // packages/ui/build-module/tooltip/popup.mjs 8699 var import_element14 = __toESM(require_element(), 1); 8700 8701 // packages/ui/build-module/tooltip/portal.mjs 8702 var import_element12 = __toESM(require_element(), 1); 8703 8704 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 8705 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 8706 function getRuntime2() { 8707 const globalScope = globalThis; 8708 if (globalScope.__wpStyleRuntime) { 8709 return globalScope.__wpStyleRuntime; 8710 } 8711 globalScope.__wpStyleRuntime = { 8712 documents: /* @__PURE__ */ new Map(), 8713 styles: /* @__PURE__ */ new Map(), 8714 injectedStyles: /* @__PURE__ */ new WeakMap() 8715 }; 8716 if (typeof document !== "undefined") { 8717 registerDocument2(document); 8718 } 8719 return globalScope.__wpStyleRuntime; 8720 } 8721 function documentContainsStyleHash2(targetDocument, hash) { 8722 if (!targetDocument.head) { 8723 return false; 8724 } 8725 for (const style of targetDocument.head.querySelectorAll( 8726 `style[$STYLE_HASH_ATTRIBUTE2}]` 8727 )) { 8728 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 8729 return true; 8730 } 8731 } 8732 return false; 8733 } 8734 function injectStyle2(targetDocument, hash, css) { 8735 if (!targetDocument.head) { 8736 return; 8737 } 8738 const runtime = getRuntime2(); 8739 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8740 if (!injectedStyles) { 8741 injectedStyles = /* @__PURE__ */ new Set(); 8742 runtime.injectedStyles.set(targetDocument, injectedStyles); 8743 } 8744 if (injectedStyles.has(hash)) { 8745 return; 8746 } 8747 if (documentContainsStyleHash2(targetDocument, hash)) { 8748 injectedStyles.add(hash); 8749 return; 8750 } 8751 const style = targetDocument.createElement("style"); 8752 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 8753 style.appendChild(targetDocument.createTextNode(css)); 8754 targetDocument.head.appendChild(style); 8755 injectedStyles.add(hash); 8756 } 8757 function registerDocument2(targetDocument) { 8758 const runtime = getRuntime2(); 8759 runtime.documents.set( 8760 targetDocument, 8761 (runtime.documents.get(targetDocument) ?? 0) + 1 8762 ); 8763 for (const [hash, css] of runtime.styles) { 8764 injectStyle2(targetDocument, hash, css); 8765 } 8766 return () => { 8767 const count = runtime.documents.get(targetDocument); 8768 if (count === void 0) { 8769 return; 8770 } 8771 if (count <= 1) { 8772 runtime.documents.delete(targetDocument); 8773 return; 8774 } 8775 runtime.documents.set(targetDocument, count - 1); 8776 }; 8777 } 8778 function registerStyle2(hash, css) { 8779 const runtime = getRuntime2(); 8780 runtime.styles.set(hash, css); 8781 for (const targetDocument of runtime.documents.keys()) { 8782 injectStyle2(targetDocument, hash, css); 8783 } 8784 } 8785 if (typeof process === "undefined" || true) { 8786 registerStyle2("be37f31c1e", "._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}}"); 8787 } 8788 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 8789 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 8790 function resolveOwnerDocument() { 8791 return typeof document === "undefined" ? null : document; 8792 } 8793 function isInWordPressEnvironment() { 8794 let topWp; 8795 try { 8796 topWp = window.top?.wp; 8797 } catch { 8798 } 8799 const wp = topWp ?? window.wp; 8800 return typeof wp?.components === "object" && wp.components !== null; 8801 } 8802 var cachedSlot = null; 8803 function ensureSlotIsAccessible(element) { 8804 element.setAttribute("aria-hidden", "false"); 8805 return element; 8806 } 8807 function createSlot(ownerDocument2) { 8808 const element = ownerDocument2.createElement("div"); 8809 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 8810 if (wp_compat_overlay_slot_default.slot) { 8811 element.classList.add(wp_compat_overlay_slot_default.slot); 8812 } 8813 ownerDocument2.body.appendChild(element); 8814 return element; 8815 } 8816 function getWpCompatOverlaySlot() { 8817 if (typeof window === "undefined") { 8818 return void 0; 8819 } 8820 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 8821 return void 0; 8822 } 8823 const ownerDocument2 = resolveOwnerDocument(); 8824 if (!ownerDocument2 || !ownerDocument2.body) { 8825 return void 0; 8826 } 8827 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 8828 return ensureSlotIsAccessible(cachedSlot); 8829 } 8830 const existing = ownerDocument2.querySelector( 8831 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 8832 ); 8833 if (existing instanceof HTMLDivElement) { 8834 cachedSlot = ensureSlotIsAccessible(existing); 8835 return cachedSlot; 8836 } 8837 if (cachedSlot?.isConnected) { 8838 cachedSlot.remove(); 8839 } 8840 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); 8841 return cachedSlot; 8842 } 8843 8844 // packages/ui/build-module/tooltip/portal.mjs 8845 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 8846 var Portal = (0, import_element12.forwardRef)( 8847 function TooltipPortal3({ container, ...restProps }, ref) { 8848 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( 8849 index_parts_exports.Portal, 8850 { 8851 container: container ?? getWpCompatOverlaySlot(), 8852 ...restProps, 8853 ref 8854 } 8855 ); 8856 } 8857 ); 8858 8859 // packages/ui/build-module/tooltip/positioner.mjs 8860 var import_element13 = __toESM(require_element(), 1); 8861 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 8862 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 8863 function getRuntime3() { 8864 const globalScope = globalThis; 8865 if (globalScope.__wpStyleRuntime) { 8866 return globalScope.__wpStyleRuntime; 8867 } 8868 globalScope.__wpStyleRuntime = { 8869 documents: /* @__PURE__ */ new Map(), 8870 styles: /* @__PURE__ */ new Map(), 8871 injectedStyles: /* @__PURE__ */ new WeakMap() 8872 }; 8873 if (typeof document !== "undefined") { 8874 registerDocument3(document); 8875 } 8876 return globalScope.__wpStyleRuntime; 8877 } 8878 function documentContainsStyleHash3(targetDocument, hash) { 8879 if (!targetDocument.head) { 8880 return false; 8881 } 8882 for (const style of targetDocument.head.querySelectorAll( 8883 `style[$STYLE_HASH_ATTRIBUTE3}]` 8884 )) { 8885 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 8886 return true; 8887 } 8888 } 8889 return false; 8890 } 8891 function injectStyle3(targetDocument, hash, css) { 8892 if (!targetDocument.head) { 8893 return; 8894 } 8895 const runtime = getRuntime3(); 8896 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8897 if (!injectedStyles) { 8898 injectedStyles = /* @__PURE__ */ new Set(); 8899 runtime.injectedStyles.set(targetDocument, injectedStyles); 8900 } 8901 if (injectedStyles.has(hash)) { 8902 return; 8903 } 8904 if (documentContainsStyleHash3(targetDocument, hash)) { 8905 injectedStyles.add(hash); 8906 return; 8907 } 8908 const style = targetDocument.createElement("style"); 8909 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 8910 style.appendChild(targetDocument.createTextNode(css)); 8911 targetDocument.head.appendChild(style); 8912 injectedStyles.add(hash); 8913 } 8914 function registerDocument3(targetDocument) { 8915 const runtime = getRuntime3(); 8916 runtime.documents.set( 8917 targetDocument, 8918 (runtime.documents.get(targetDocument) ?? 0) + 1 8919 ); 8920 for (const [hash, css] of runtime.styles) { 8921 injectStyle3(targetDocument, hash, css); 8922 } 8923 return () => { 8924 const count = runtime.documents.get(targetDocument); 8925 if (count === void 0) { 8926 return; 8927 } 8928 if (count <= 1) { 8929 runtime.documents.delete(targetDocument); 8930 return; 8931 } 8932 runtime.documents.set(targetDocument, count - 1); 8933 }; 8934 } 8935 function registerStyle3(hash, css) { 8936 const runtime = getRuntime3(); 8937 runtime.styles.set(hash, css); 8938 for (const targetDocument of runtime.documents.keys()) { 8939 injectStyle3(targetDocument, hash, css); 8940 } 8941 } 8942 if (typeof process === "undefined" || true) { 8943 registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 8944 } 8945 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 8946 if (typeof process === "undefined" || true) { 8947 registerStyle3("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); 8948 } 8949 var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 8950 var Positioner = (0, import_element13.forwardRef)( 8951 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 8952 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 8953 index_parts_exports.Positioner, 8954 { 8955 ref, 8956 align, 8957 side, 8958 sideOffset, 8959 ...props, 8960 className: clsx_default( 8961 resets_default["box-sizing"], 8962 style_default2.positioner, 8963 className 8964 ) 8965 } 8966 ); 8967 } 8968 ); 8969 8970 // packages/ui/build-module/tooltip/popup.mjs 8971 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 8972 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 8973 function getRuntime4() { 8974 const globalScope = globalThis; 8975 if (globalScope.__wpStyleRuntime) { 8976 return globalScope.__wpStyleRuntime; 8977 } 8978 globalScope.__wpStyleRuntime = { 8979 documents: /* @__PURE__ */ new Map(), 8980 styles: /* @__PURE__ */ new Map(), 8981 injectedStyles: /* @__PURE__ */ new WeakMap() 8982 }; 8983 if (typeof document !== "undefined") { 8984 registerDocument4(document); 8985 } 8986 return globalScope.__wpStyleRuntime; 8987 } 8988 function documentContainsStyleHash4(targetDocument, hash) { 8989 if (!targetDocument.head) { 8990 return false; 8991 } 8992 for (const style of targetDocument.head.querySelectorAll( 8993 `style[$STYLE_HASH_ATTRIBUTE4}]` 8994 )) { 8995 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 8996 return true; 8997 } 8998 } 8999 return false; 9000 } 9001 function injectStyle4(targetDocument, hash, css) { 9002 if (!targetDocument.head) { 9003 return; 9004 } 9005 const runtime = getRuntime4(); 9006 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9007 if (!injectedStyles) { 9008 injectedStyles = /* @__PURE__ */ new Set(); 9009 runtime.injectedStyles.set(targetDocument, injectedStyles); 9010 } 9011 if (injectedStyles.has(hash)) { 9012 return; 9013 } 9014 if (documentContainsStyleHash4(targetDocument, hash)) { 9015 injectedStyles.add(hash); 9016 return; 9017 } 9018 const style = targetDocument.createElement("style"); 9019 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 9020 style.appendChild(targetDocument.createTextNode(css)); 9021 targetDocument.head.appendChild(style); 9022 injectedStyles.add(hash); 9023 } 9024 function registerDocument4(targetDocument) { 9025 const runtime = getRuntime4(); 9026 runtime.documents.set( 9027 targetDocument, 9028 (runtime.documents.get(targetDocument) ?? 0) + 1 9029 ); 9030 for (const [hash, css] of runtime.styles) { 9031 injectStyle4(targetDocument, hash, css); 9032 } 9033 return () => { 9034 const count = runtime.documents.get(targetDocument); 9035 if (count === void 0) { 9036 return; 9037 } 9038 if (count <= 1) { 9039 runtime.documents.delete(targetDocument); 9040 return; 9041 } 9042 runtime.documents.set(targetDocument, count - 1); 9043 }; 9044 } 9045 function registerStyle4(hash, css) { 9046 const runtime = getRuntime4(); 9047 runtime.styles.set(hash, css); 9048 for (const targetDocument of runtime.documents.keys()) { 9049 injectStyle4(targetDocument, hash, css); 9050 } 9051 } 9052 if (typeof process === "undefined" || true) { 9053 registerStyle4("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); 9054 } 9055 var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 9056 var POPUP_COLOR = { background: "#1e1e1e" }; 9057 var Popup = (0, import_element14.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 9058 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 9059 index_parts_exports.Popup, 9060 { 9061 ref, 9062 className: clsx_default(style_default3.popup, className), 9063 ...props, 9064 children 9065 } 9066 ) }); 9067 const positionedPopup = renderSlotWithChildren( 9068 positioner, 9069 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Positioner, {}), 9070 popupContent 9071 ); 9072 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Portal, {}), positionedPopup); 9073 }); 9074 9075 // packages/ui/build-module/tooltip/trigger.mjs 9076 var import_element15 = __toESM(require_element(), 1); 9077 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 9078 var Trigger = (0, import_element15.forwardRef)( 9079 function TooltipTrigger3(props, ref) { 9080 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(index_parts_exports.Trigger, { ref, ...props }); 9081 } 9082 ); 9083 9084 // packages/ui/build-module/tooltip/root.mjs 9085 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 9086 function Root(props) { 9087 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(index_parts_exports.Root, { ...props }); 9088 } 9089 9090 // packages/ui/build-module/tooltip/provider.mjs 9091 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 9092 function Provider({ ...props }) { 9093 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(index_parts_exports.Provider, { ...props }); 9094 } 9095 9096 // packages/ui/build-module/visually-hidden/visually-hidden.mjs 9097 var import_element16 = __toESM(require_element(), 1); 9098 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 9099 function getRuntime5() { 9100 const globalScope = globalThis; 9101 if (globalScope.__wpStyleRuntime) { 9102 return globalScope.__wpStyleRuntime; 9103 } 9104 globalScope.__wpStyleRuntime = { 9105 documents: /* @__PURE__ */ new Map(), 9106 styles: /* @__PURE__ */ new Map(), 9107 injectedStyles: /* @__PURE__ */ new WeakMap() 9108 }; 9109 if (typeof document !== "undefined") { 9110 registerDocument5(document); 9111 } 9112 return globalScope.__wpStyleRuntime; 9113 } 9114 function documentContainsStyleHash5(targetDocument, hash) { 9115 if (!targetDocument.head) { 9116 return false; 9117 } 9118 for (const style of targetDocument.head.querySelectorAll( 9119 `style[$STYLE_HASH_ATTRIBUTE5}]` 9120 )) { 9121 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 9122 return true; 9123 } 9124 } 9125 return false; 9126 } 9127 function injectStyle5(targetDocument, hash, css) { 9128 if (!targetDocument.head) { 9129 return; 9130 } 9131 const runtime = getRuntime5(); 9132 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9133 if (!injectedStyles) { 9134 injectedStyles = /* @__PURE__ */ new Set(); 9135 runtime.injectedStyles.set(targetDocument, injectedStyles); 9136 } 9137 if (injectedStyles.has(hash)) { 9138 return; 9139 } 9140 if (documentContainsStyleHash5(targetDocument, hash)) { 9141 injectedStyles.add(hash); 9142 return; 9143 } 9144 const style = targetDocument.createElement("style"); 9145 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 9146 style.appendChild(targetDocument.createTextNode(css)); 9147 targetDocument.head.appendChild(style); 9148 injectedStyles.add(hash); 9149 } 9150 function registerDocument5(targetDocument) { 9151 const runtime = getRuntime5(); 9152 runtime.documents.set( 9153 targetDocument, 9154 (runtime.documents.get(targetDocument) ?? 0) + 1 9155 ); 9156 for (const [hash, css] of runtime.styles) { 9157 injectStyle5(targetDocument, hash, css); 9158 } 9159 return () => { 9160 const count = runtime.documents.get(targetDocument); 9161 if (count === void 0) { 9162 return; 9163 } 9164 if (count <= 1) { 9165 runtime.documents.delete(targetDocument); 9166 return; 9167 } 9168 runtime.documents.set(targetDocument, count - 1); 9169 }; 9170 } 9171 function registerStyle5(hash, css) { 9172 const runtime = getRuntime5(); 9173 runtime.styles.set(hash, css); 9174 for (const targetDocument of runtime.documents.keys()) { 9175 injectStyle5(targetDocument, hash, css); 9176 } 9177 } 9178 if (typeof process === "undefined" || true) { 9179 registerStyle5("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}"); 9180 } 9181 var style_default4 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; 9182 var VisuallyHidden = (0, import_element16.forwardRef)( 9183 function VisuallyHidden2({ render, ...restProps }, ref) { 9184 const element = useRender({ 9185 render, 9186 ref, 9187 props: mergeProps( 9188 { className: style_default4["visually-hidden"] }, 9189 restProps, 9190 { 9191 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. 9192 "data-visually-hidden": "" 9193 } 9194 ) 9195 }); 9196 return element; 9197 } 9198 ); 9199 9200 // packages/admin-ui/build-module/navigable-region/index.mjs 9201 var import_element17 = __toESM(require_element(), 1); 9202 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 9203 var NavigableRegion = (0, import_element17.forwardRef)( 9204 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 9205 return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( 9206 Tag, 9207 { 9208 ref, 9209 className: clsx_default("admin-ui-navigable-region", className), 9210 "aria-label": ariaLabel, 9211 role: "region", 9212 tabIndex: "-1", 9213 ...props, 9214 children 9215 } 9216 ); 9217 } 9218 ); 9219 NavigableRegion.displayName = "NavigableRegion"; 9220 var navigable_region_default = NavigableRegion; 9221 9222 // packages/admin-ui/build-module/admin-theme-colors/index.mjs 9223 var DEFAULT_THEME_COLORS = { 9224 primary: "#3858e9", 9225 background: "#222524" 9226 }; 9227 var ADMIN_THEME_COLORS = /* @__PURE__ */ new Map([ 9228 ["modern", DEFAULT_THEME_COLORS], 9229 ["fresh", { primary: "#3858e9", background: "#25292b" }], 9230 ["midnight", { primary: "#cf4339", background: "#3d4042" }], 9231 ["coffee", { primary: "#916745", background: "#5b534d" }], 9232 ["ocean", { primary: "#567958", background: "#5f787f" }], 9233 ["blue", { primary: "#437aa8", background: "#3876a8" }], 9234 ["ectoplasm", { primary: "#646c3e", background: "#4f386e" }], 9235 ["sunrise", { primary: "#ad631e", background: "#cc4541" }], 9236 ["light", { primary: "#007cba", background: "#eaeeed" }] 9237 ]); 9238 function getAdminThemeColors() { 9239 const scheme = document.body.className.match(/admin-color-([\w-]+)/)?.[1] ?? "modern"; 9240 return ADMIN_THEME_COLORS.get(scheme) ?? DEFAULT_THEME_COLORS; 9241 } 9242 9243 // packages/edit-post/build-module/components/layout/index.mjs 9244 var import_editor18 = __toESM(require_editor(), 1); 9245 var import_data25 = __toESM(require_data(), 1); 9246 var import_block_editor2 = __toESM(require_block_editor(), 1); 9247 9248 // packages/global-styles-engine/build-module/utils/common.mjs 9249 var import_style_engine = __toESM(require_style_engine(), 1); 9250 var ROOT_BLOCK_SELECTOR = "body"; 9251 var ROOT_CSS_PROPERTIES_SELECTOR = ":root"; 9252 9253 // packages/global-styles-engine/build-module/core/render.mjs 9254 var import_blocks = __toESM(require_blocks(), 1); 9255 var import_style_engine2 = __toESM(require_style_engine(), 1); 9256 var import_data = __toESM(require_data(), 1); 9257 9258 // packages/global-styles-engine/build-module/utils/spacing.mjs 9259 function getSpacingPresetCssVar(value) { 9260 if (!value) { 9261 return; 9262 } 9263 const slug = value.match(/var:preset\|spacing\|(.+)/); 9264 if (!slug) { 9265 return value; 9266 } 9267 return `var(--wp--preset--spacing--$slug[1]})`; 9268 } 9269 9270 // packages/global-styles-engine/build-module/utils/gap.mjs 9271 function getGapBoxControlValueFromStyle(blockGapValue) { 9272 if (!blockGapValue) { 9273 return null; 9274 } 9275 const isValueString = typeof blockGapValue === "string"; 9276 return { 9277 top: isValueString ? blockGapValue : blockGapValue?.top, 9278 left: isValueString ? blockGapValue : blockGapValue?.left 9279 }; 9280 } 9281 function getGapCSSValue(blockGapValue, defaultValue = "0") { 9282 const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue); 9283 if (!blockGapBoxControlValue) { 9284 return null; 9285 } 9286 const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue; 9287 const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue; 9288 return row === column ? row : `$row} $column}`; 9289 } 9290 9291 // packages/global-styles-engine/build-module/utils/layout.mjs 9292 var LAYOUT_DEFINITIONS = { 9293 default: { 9294 name: "default", 9295 slug: "flow", 9296 className: "is-layout-flow", 9297 baseStyles: [ 9298 { 9299 selector: " > .alignleft", 9300 rules: { 9301 float: "left", 9302 "margin-inline-start": "0", 9303 "margin-inline-end": "2em" 9304 } 9305 }, 9306 { 9307 selector: " > .alignright", 9308 rules: { 9309 float: "right", 9310 "margin-inline-start": "2em", 9311 "margin-inline-end": "0" 9312 } 9313 }, 9314 { 9315 selector: " > .aligncenter", 9316 rules: { 9317 "margin-left": "auto !important", 9318 "margin-right": "auto !important" 9319 } 9320 } 9321 ], 9322 spacingStyles: [ 9323 { 9324 selector: " > :first-child", 9325 rules: { 9326 "margin-block-start": "0" 9327 } 9328 }, 9329 { 9330 selector: " > :last-child", 9331 rules: { 9332 "margin-block-end": "0" 9333 } 9334 }, 9335 { 9336 selector: " > *", 9337 rules: { 9338 "margin-block-start": null, 9339 "margin-block-end": "0" 9340 } 9341 } 9342 ] 9343 }, 9344 constrained: { 9345 name: "constrained", 9346 slug: "constrained", 9347 className: "is-layout-constrained", 9348 baseStyles: [ 9349 { 9350 selector: " > .alignleft", 9351 rules: { 9352 float: "left", 9353 "margin-inline-start": "0", 9354 "margin-inline-end": "2em" 9355 } 9356 }, 9357 { 9358 selector: " > .alignright", 9359 rules: { 9360 float: "right", 9361 "margin-inline-start": "2em", 9362 "margin-inline-end": "0" 9363 } 9364 }, 9365 { 9366 selector: " > .aligncenter", 9367 rules: { 9368 "margin-left": "auto !important", 9369 "margin-right": "auto !important" 9370 } 9371 }, 9372 { 9373 selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))", 9374 rules: { 9375 "max-width": "var(--wp--style--global--content-size)", 9376 "margin-left": "auto !important", 9377 "margin-right": "auto !important" 9378 } 9379 }, 9380 { 9381 selector: " > .alignwide", 9382 rules: { 9383 "max-width": "var(--wp--style--global--wide-size)" 9384 } 9385 } 9386 ], 9387 spacingStyles: [ 9388 { 9389 selector: " > :first-child", 9390 rules: { 9391 "margin-block-start": "0" 9392 } 9393 }, 9394 { 9395 selector: " > :last-child", 9396 rules: { 9397 "margin-block-end": "0" 9398 } 9399 }, 9400 { 9401 selector: " > *", 9402 rules: { 9403 "margin-block-start": null, 9404 "margin-block-end": "0" 9405 } 9406 } 9407 ] 9408 }, 9409 flex: { 9410 name: "flex", 9411 slug: "flex", 9412 className: "is-layout-flex", 9413 displayMode: "flex", 9414 baseStyles: [ 9415 { 9416 selector: "", 9417 rules: { 9418 "flex-wrap": "wrap", 9419 "align-items": "center" 9420 } 9421 }, 9422 { 9423 selector: " > :is(*, div)", 9424 // :is(*, div) instead of just * increases the specificity by 001. 9425 rules: { 9426 margin: "0" 9427 } 9428 } 9429 ], 9430 spacingStyles: [ 9431 { 9432 selector: "", 9433 rules: { 9434 gap: null 9435 } 9436 } 9437 ] 9438 }, 9439 grid: { 9440 name: "grid", 9441 slug: "grid", 9442 className: "is-layout-grid", 9443 displayMode: "grid", 9444 baseStyles: [ 9445 { 9446 selector: " > :is(*, div)", 9447 // :is(*, div) instead of just * increases the specificity by 001. 9448 rules: { 9449 margin: "0" 9450 } 9451 } 9452 ], 9453 spacingStyles: [ 9454 { 9455 selector: "", 9456 rules: { 9457 gap: null 9458 } 9459 } 9460 ] 9461 } 9462 }; 9463 9464 // packages/global-styles-engine/build-module/core/render.mjs 9465 function getLayoutStyles({ 9466 layoutDefinitions = LAYOUT_DEFINITIONS, 9467 style, 9468 selector, 9469 hasBlockGapSupport, 9470 hasFallbackGapSupport, 9471 fallbackGapValue 9472 }) { 9473 let ruleset = ""; 9474 let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : ""; 9475 if (hasFallbackGapSupport) { 9476 if (selector === ROOT_BLOCK_SELECTOR) { 9477 gapValue = !gapValue ? "0.5em" : gapValue; 9478 } else if (!hasBlockGapSupport && fallbackGapValue) { 9479 gapValue = fallbackGapValue; 9480 } 9481 } 9482 if (gapValue && layoutDefinitions) { 9483 Object.values(layoutDefinitions).forEach( 9484 ({ className, name, spacingStyles }) => { 9485 if (!hasBlockGapSupport && "flex" !== name && "grid" !== name) { 9486 return; 9487 } 9488 if (spacingStyles?.length) { 9489 spacingStyles.forEach((spacingStyle) => { 9490 const declarations = []; 9491 if (spacingStyle.rules) { 9492 Object.entries(spacingStyle.rules).forEach( 9493 ([cssProperty, cssValue]) => { 9494 declarations.push( 9495 `$cssProperty}: $cssValue ? cssValue : gapValue}` 9496 ); 9497 } 9498 ); 9499 } 9500 if (declarations.length) { 9501 let combinedSelector = ""; 9502 if (!hasBlockGapSupport) { 9503 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.$className}$spacingStyle?.selector || ""})` : `:where($selector}.$className}$spacingStyle?.selector || ""})`; 9504 } else { 9505 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.$className})$spacingStyle?.selector || ""}` : `:root :where($selector}-$className})$spacingStyle?.selector || ""}`; 9506 } 9507 ruleset += `$combinedSelector} { $declarations.join( 9508 "; " 9509 )}; }`; 9510 } 9511 }); 9512 } 9513 } 9514 ); 9515 if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) { 9516 ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: $gapValue}; }`; 9517 } 9518 } 9519 if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) { 9520 const validDisplayModes = ["block", "flex", "grid"]; 9521 Object.values(layoutDefinitions).forEach( 9522 ({ className, displayMode, baseStyles }) => { 9523 if (displayMode && validDisplayModes.includes(displayMode)) { 9524 ruleset += `$selector} .$className} { display:$displayMode}; }`; 9525 } 9526 if (baseStyles?.length) { 9527 baseStyles.forEach((baseStyle) => { 9528 const declarations = []; 9529 if (baseStyle.rules) { 9530 Object.entries(baseStyle.rules).forEach( 9531 ([cssProperty, cssValue]) => { 9532 declarations.push( 9533 `$cssProperty}: $cssValue}` 9534 ); 9535 } 9536 ); 9537 } 9538 if (declarations.length) { 9539 const combinedSelector = `.$className}$baseStyle?.selector || ""}`; 9540 ruleset += `$combinedSelector} { $declarations.join( 9541 "; " 9542 )}; }`; 9543 } 9544 }); 9545 } 9546 } 9547 ); 9548 } 9549 return ruleset; 9550 } 9551 9552 // packages/edit-post/build-module/components/layout/index.mjs 9553 var import_plugins = __toESM(require_plugins(), 1); 9554 var import_i18n14 = __toESM(require_i18n(), 1); 9555 var import_element29 = __toESM(require_element(), 1); 9556 var import_notices3 = __toESM(require_notices(), 1); 9557 var import_preferences10 = __toESM(require_preferences(), 1); 9558 var import_commands2 = __toESM(require_commands(), 1); 9559 var import_block_library = __toESM(require_block_library(), 1); 9560 var import_url6 = __toESM(require_url(), 1); 9561 var import_html_entities = __toESM(require_html_entities(), 1); 9562 var import_core_data9 = __toESM(require_core_data(), 1); 9563 var import_components9 = __toESM(require_components(), 1); 9564 var import_compose2 = __toESM(require_compose(), 1); 9565 var import_theme = __toESM(require_theme(), 1); 9566 9567 // packages/edit-post/build-module/components/back-button/index.mjs 9568 var import_editor2 = __toESM(require_editor(), 1); 9569 var import_components2 = __toESM(require_components(), 1); 9570 9571 // packages/edit-post/build-module/components/back-button/fullscreen-mode-close.mjs 9572 var import_data2 = __toESM(require_data(), 1); 9573 var import_components = __toESM(require_components(), 1); 9574 var import_i18n = __toESM(require_i18n(), 1); 9575 var import_url = __toESM(require_url(), 1); 9576 var import_editor = __toESM(require_editor(), 1); 9577 var import_core_data = __toESM(require_core_data(), 1); 9578 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 9579 function FullscreenModeClose({ showTooltip, icon, href, initialPost }) { 9580 const postType = (0, import_data2.useSelect)( 9581 (select3) => { 9582 const { getCurrentPostType } = select3(import_editor.store); 9583 const { getPostType } = select3(import_core_data.store); 9584 return getPostType(initialPost?.type || getCurrentPostType()); 9585 }, 9586 [initialPost?.type] 9587 ); 9588 if (!postType) { 9589 return null; 9590 } 9591 const buttonHref = href ?? (0, import_url.addQueryArgs)("edit.php", { 9592 post_type: postType.slug 9593 }); 9594 const buttonLabel = postType?.labels?.view_items ?? (0, import_i18n.__)("Back"); 9595 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( 9596 import_components.Button, 9597 { 9598 size: "compact", 9599 href: buttonHref, 9600 label: buttonLabel, 9601 showTooltip, 9602 tooltipPosition: "bottom", 9603 icon: icon ?? ((0, import_i18n.isRTL)() ? chevron_right_default : chevron_left_default) 9604 } 9605 ); 9606 } 9607 var fullscreen_mode_close_default = FullscreenModeClose; 9608 9609 // packages/edit-post/build-module/lock-unlock.mjs 9610 var import_private_apis2 = __toESM(require_private_apis(), 1); 9611 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 9612 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 9613 "@wordpress/edit-post" 9614 ); 9615 9616 // packages/edit-post/build-module/components/back-button/index.mjs 9617 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 9618 var { BackButton: BackButtonFill } = unlock2(import_editor2.privateApis); 9619 var slideX = { 9620 hidden: { x: "-100%" }, 9621 distractionFreeInactive: { x: 0 }, 9622 hover: { x: 0, transition: { type: "tween", delay: 0.2 } } 9623 }; 9624 function BackButton({ initialPost }) { 9625 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(BackButtonFill, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 9626 import_components2.__unstableMotion.div, 9627 { 9628 variants: slideX, 9629 transition: { type: "tween", delay: 0.8 }, 9630 children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 9631 fullscreen_mode_close_default, 9632 { 9633 showTooltip: true, 9634 initialPost 9635 } 9636 ) 9637 } 9638 ) }); 9639 } 9640 var back_button_default = BackButton; 9641 9642 // packages/edit-post/build-module/components/editor-initialization/listener-hooks.mjs 9643 var import_data3 = __toESM(require_data(), 1); 9644 var import_element18 = __toESM(require_element(), 1); 9645 var import_editor3 = __toESM(require_editor(), 1); 9646 var import_core_data2 = __toESM(require_core_data(), 1); 9647 9648 // packages/edit-post/build-module/store/constants.mjs 9649 var STORE_NAME = "core/edit-post"; 9650 var VIEW_AS_LINK_SELECTOR = "#wp-admin-bar-view a"; 9651 var VIEW_AS_PREVIEW_LINK_SELECTOR = "#wp-admin-bar-preview a"; 9652 9653 // packages/edit-post/build-module/components/editor-initialization/listener-hooks.mjs 9654 var useUpdatePostLinkListener = () => { 9655 const { isViewable, newPermalink } = (0, import_data3.useSelect)((select3) => { 9656 const { getPostType } = select3(import_core_data2.store); 9657 const { getCurrentPost, getEditedPostAttribute } = select3(import_editor3.store); 9658 const postType = getPostType(getEditedPostAttribute("type")); 9659 return { 9660 isViewable: postType?.viewable, 9661 newPermalink: getCurrentPost().link 9662 }; 9663 }, []); 9664 const nodeToUpdateRef = (0, import_element18.useRef)(); 9665 (0, import_element18.useEffect)(() => { 9666 nodeToUpdateRef.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR); 9667 }, []); 9668 (0, import_element18.useEffect)(() => { 9669 if (!newPermalink || !nodeToUpdateRef.current) { 9670 return; 9671 } 9672 if (!isViewable) { 9673 nodeToUpdateRef.current.style.display = "none"; 9674 return; 9675 } 9676 nodeToUpdateRef.current.style.display = ""; 9677 nodeToUpdateRef.current.setAttribute("href", newPermalink); 9678 }, [newPermalink, isViewable]); 9679 }; 9680 9681 // packages/edit-post/build-module/components/editor-initialization/index.mjs 9682 function EditorInitialization() { 9683 useUpdatePostLinkListener(); 9684 return null; 9685 } 9686 9687 // packages/edit-post/build-module/components/keyboard-shortcuts/index.mjs 9688 var import_element19 = __toESM(require_element(), 1); 9689 var import_data7 = __toESM(require_data(), 1); 9690 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); 9691 var import_i18n3 = __toESM(require_i18n(), 1); 9692 9693 // packages/edit-post/build-module/store/index.mjs 9694 var import_data6 = __toESM(require_data(), 1); 9695 9696 // packages/edit-post/build-module/store/reducer.mjs 9697 var import_data4 = __toESM(require_data(), 1); 9698 function isSavingMetaBoxes(state = false, action) { 9699 switch (action.type) { 9700 case "REQUEST_META_BOX_UPDATES": 9701 return true; 9702 case "META_BOX_UPDATES_SUCCESS": 9703 case "META_BOX_UPDATES_FAILURE": 9704 return false; 9705 default: 9706 return state; 9707 } 9708 } 9709 function mergeMetaboxes(metaboxes = [], newMetaboxes) { 9710 const mergedMetaboxes = [...metaboxes]; 9711 for (const metabox of newMetaboxes) { 9712 const existing = mergedMetaboxes.findIndex( 9713 (box) => box.id === metabox.id 9714 ); 9715 if (existing !== -1) { 9716 mergedMetaboxes[existing] = { 9717 ...mergedMetaboxes[existing], 9718 ...metabox 9719 }; 9720 } else { 9721 mergedMetaboxes.push(metabox); 9722 } 9723 } 9724 return mergedMetaboxes; 9725 } 9726 function metaBoxLocations(state = {}, action) { 9727 switch (action.type) { 9728 case "SET_META_BOXES_PER_LOCATIONS": { 9729 const newState = { ...state }; 9730 for (const [location, metaboxes] of Object.entries( 9731 action.metaBoxesPerLocation 9732 )) { 9733 newState[location] = mergeMetaboxes( 9734 newState[location], 9735 metaboxes 9736 ); 9737 } 9738 return newState; 9739 } 9740 } 9741 return state; 9742 } 9743 function metaBoxesInitialized(state = false, action) { 9744 switch (action.type) { 9745 case "META_BOXES_INITIALIZED": 9746 return true; 9747 } 9748 return state; 9749 } 9750 var metaBoxes = (0, import_data4.combineReducers)({ 9751 isSaving: isSavingMetaBoxes, 9752 locations: metaBoxLocations, 9753 initialized: metaBoxesInitialized 9754 }); 9755 var reducer_default = (0, import_data4.combineReducers)({ 9756 metaBoxes 9757 }); 9758 9759 // packages/edit-post/build-module/store/actions.mjs 9760 var actions_exports = {}; 9761 __export(actions_exports, { 9762 __experimentalSetPreviewDeviceType: () => __experimentalSetPreviewDeviceType, 9763 __unstableCreateTemplate: () => __unstableCreateTemplate, 9764 closeGeneralSidebar: () => closeGeneralSidebar, 9765 closeModal: () => closeModal, 9766 closePublishSidebar: () => closePublishSidebar, 9767 hideBlockTypes: () => hideBlockTypes, 9768 initializeMetaBoxes: () => initializeMetaBoxes, 9769 metaBoxUpdatesFailure: () => metaBoxUpdatesFailure, 9770 metaBoxUpdatesSuccess: () => metaBoxUpdatesSuccess, 9771 openGeneralSidebar: () => openGeneralSidebar, 9772 openModal: () => openModal, 9773 openPublishSidebar: () => openPublishSidebar, 9774 removeEditorPanel: () => removeEditorPanel, 9775 requestMetaBoxUpdates: () => requestMetaBoxUpdates, 9776 setAvailableMetaBoxesPerLocation: () => setAvailableMetaBoxesPerLocation, 9777 setIsEditingTemplate: () => setIsEditingTemplate, 9778 setIsInserterOpened: () => setIsInserterOpened, 9779 setIsListViewOpened: () => setIsListViewOpened, 9780 showBlockTypes: () => showBlockTypes, 9781 switchEditorMode: () => switchEditorMode, 9782 toggleDistractionFree: () => toggleDistractionFree, 9783 toggleEditorPanelEnabled: () => toggleEditorPanelEnabled, 9784 toggleEditorPanelOpened: () => toggleEditorPanelOpened, 9785 toggleFeature: () => toggleFeature, 9786 toggleFullscreenMode: () => toggleFullscreenMode, 9787 togglePinnedPluginItem: () => togglePinnedPluginItem, 9788 togglePublishSidebar: () => togglePublishSidebar, 9789 updatePreferredStyleVariations: () => updatePreferredStyleVariations 9790 }); 9791 var import_api_fetch = __toESM(require_api_fetch(), 1); 9792 var import_preferences = __toESM(require_preferences(), 1); 9793 var import_editor4 = __toESM(require_editor(), 1); 9794 var import_deprecated = __toESM(require_deprecated(), 1); 9795 var import_hooks = __toESM(require_hooks(), 1); 9796 var import_core_data3 = __toESM(require_core_data(), 1); 9797 var import_notices = __toESM(require_notices(), 1); 9798 var import_i18n2 = __toESM(require_i18n(), 1); 9799 9800 // packages/edit-post/build-module/utils/meta-boxes.mjs 9801 var getMetaBoxContainer = (location) => { 9802 const area = document.querySelector( 9803 `.edit-post-meta-boxes-area.is-$location} .metabox-location-$location}` 9804 ); 9805 if (area) { 9806 return area; 9807 } 9808 return document.querySelector("#metaboxes .metabox-location-" + location); 9809 }; 9810 9811 // packages/edit-post/build-module/store/actions.mjs 9812 var { interfaceStore } = unlock2(import_editor4.privateApis); 9813 var openGeneralSidebar = (name) => ({ registry }) => { 9814 registry.dispatch(interfaceStore).enableComplementaryArea("core", name); 9815 }; 9816 var closeGeneralSidebar = () => ({ registry }) => registry.dispatch(interfaceStore).disableComplementaryArea("core"); 9817 var openModal = (name) => ({ registry }) => { 9818 (0, import_deprecated.default)("select( 'core/edit-post' ).openModal( name )", { 9819 since: "6.3", 9820 alternative: "select( 'core/interface').openModal( name )" 9821 }); 9822 return registry.dispatch(interfaceStore).openModal(name); 9823 }; 9824 var closeModal = () => ({ registry }) => { 9825 (0, import_deprecated.default)("select( 'core/edit-post' ).closeModal()", { 9826 since: "6.3", 9827 alternative: "select( 'core/interface').closeModal()" 9828 }); 9829 return registry.dispatch(interfaceStore).closeModal(); 9830 }; 9831 var openPublishSidebar = () => ({ registry }) => { 9832 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).openPublishSidebar", { 9833 since: "6.6", 9834 alternative: "dispatch( 'core/editor').openPublishSidebar" 9835 }); 9836 registry.dispatch(import_editor4.store).openPublishSidebar(); 9837 }; 9838 var closePublishSidebar = () => ({ registry }) => { 9839 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).closePublishSidebar", { 9840 since: "6.6", 9841 alternative: "dispatch( 'core/editor').closePublishSidebar" 9842 }); 9843 registry.dispatch(import_editor4.store).closePublishSidebar(); 9844 }; 9845 var togglePublishSidebar = () => ({ registry }) => { 9846 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).togglePublishSidebar", { 9847 since: "6.6", 9848 alternative: "dispatch( 'core/editor').togglePublishSidebar" 9849 }); 9850 registry.dispatch(import_editor4.store).togglePublishSidebar(); 9851 }; 9852 var toggleEditorPanelEnabled = (panelName) => ({ registry }) => { 9853 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled", { 9854 since: "6.5", 9855 alternative: "dispatch( 'core/editor').toggleEditorPanelEnabled" 9856 }); 9857 registry.dispatch(import_editor4.store).toggleEditorPanelEnabled(panelName); 9858 }; 9859 var toggleEditorPanelOpened = (panelName) => ({ registry }) => { 9860 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleEditorPanelOpened", { 9861 since: "6.5", 9862 alternative: "dispatch( 'core/editor').toggleEditorPanelOpened" 9863 }); 9864 registry.dispatch(import_editor4.store).toggleEditorPanelOpened(panelName); 9865 }; 9866 var removeEditorPanel = (panelName) => ({ registry }) => { 9867 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).removeEditorPanel", { 9868 since: "6.5", 9869 alternative: "dispatch( 'core/editor').removeEditorPanel" 9870 }); 9871 registry.dispatch(import_editor4.store).removeEditorPanel(panelName); 9872 }; 9873 var toggleFeature = (feature) => ({ registry }) => registry.dispatch(import_preferences.store).toggle("core/edit-post", feature); 9874 var switchEditorMode = (mode) => ({ registry }) => { 9875 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).switchEditorMode", { 9876 since: "6.6", 9877 alternative: "dispatch( 'core/editor').switchEditorMode" 9878 }); 9879 registry.dispatch(import_editor4.store).switchEditorMode(mode); 9880 }; 9881 var togglePinnedPluginItem = (pluginName) => ({ registry }) => { 9882 const isPinned = registry.select(interfaceStore).isItemPinned("core", pluginName); 9883 registry.dispatch(interfaceStore)[isPinned ? "unpinItem" : "pinItem"]("core", pluginName); 9884 }; 9885 function updatePreferredStyleVariations() { 9886 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).updatePreferredStyleVariations", { 9887 since: "6.6", 9888 hint: "Preferred Style Variations are not supported anymore." 9889 }); 9890 return { type: "NOTHING" }; 9891 } 9892 var showBlockTypes = (blockNames) => ({ registry }) => { 9893 unlock2(registry.dispatch(import_editor4.store)).showBlockTypes(blockNames); 9894 }; 9895 var hideBlockTypes = (blockNames) => ({ registry }) => { 9896 unlock2(registry.dispatch(import_editor4.store)).hideBlockTypes(blockNames); 9897 }; 9898 function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) { 9899 return { 9900 type: "SET_META_BOXES_PER_LOCATIONS", 9901 metaBoxesPerLocation 9902 }; 9903 } 9904 var requestMetaBoxUpdates = () => async ({ registry, select: select3, dispatch: dispatch2 }) => { 9905 dispatch2({ 9906 type: "REQUEST_META_BOX_UPDATES" 9907 }); 9908 if (window.tinyMCE) { 9909 window.tinyMCE.triggerSave(); 9910 } 9911 const baseFormData = new window.FormData( 9912 document.querySelector(".metabox-base-form") 9913 ); 9914 const postId = baseFormData.get("post_ID"); 9915 const postType = baseFormData.get("post_type"); 9916 const post = registry.select(import_core_data3.store).getEditedEntityRecord("postType", postType, postId); 9917 const additionalData = [ 9918 post.comment_status ? ["comment_status", post.comment_status] : false, 9919 post.ping_status ? ["ping_status", post.ping_status] : false, 9920 post.sticky ? ["sticky", post.sticky] : false, 9921 post.author ? ["post_author", post.author] : false 9922 ].filter(Boolean); 9923 const activeMetaBoxLocations = select3.getActiveMetaBoxLocations(); 9924 const formDataToMerge = [ 9925 baseFormData, 9926 ...activeMetaBoxLocations.map( 9927 (location) => new window.FormData(getMetaBoxContainer(location)) 9928 ) 9929 ]; 9930 const formData = formDataToMerge.reduce((memo, currentFormData) => { 9931 for (const [key, value] of currentFormData) { 9932 memo.append(key, value); 9933 } 9934 return memo; 9935 }, new window.FormData()); 9936 additionalData.forEach( 9937 ([key, value]) => formData.append(key, value) 9938 ); 9939 try { 9940 await (0, import_api_fetch.default)({ 9941 url: window._wpMetaBoxUrl, 9942 method: "POST", 9943 body: formData, 9944 parse: false 9945 }); 9946 dispatch2.metaBoxUpdatesSuccess(); 9947 } catch { 9948 dispatch2.metaBoxUpdatesFailure(); 9949 } 9950 }; 9951 function metaBoxUpdatesSuccess() { 9952 return { 9953 type: "META_BOX_UPDATES_SUCCESS" 9954 }; 9955 } 9956 function metaBoxUpdatesFailure() { 9957 return { 9958 type: "META_BOX_UPDATES_FAILURE" 9959 }; 9960 } 9961 var __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => { 9962 (0, import_deprecated.default)( 9963 "dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType", 9964 { 9965 since: "6.5", 9966 version: "6.7", 9967 hint: "registry.dispatch( editorStore ).setDeviceType" 9968 } 9969 ); 9970 registry.dispatch(import_editor4.store).setDeviceType(deviceType); 9971 }; 9972 var setIsInserterOpened = (value) => ({ registry }) => { 9973 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsInserterOpened", { 9974 since: "6.5", 9975 alternative: "dispatch( 'core/editor').setIsInserterOpened" 9976 }); 9977 registry.dispatch(import_editor4.store).setIsInserterOpened(value); 9978 }; 9979 var setIsListViewOpened = (isOpen) => ({ registry }) => { 9980 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsListViewOpened", { 9981 since: "6.5", 9982 alternative: "dispatch( 'core/editor').setIsListViewOpened" 9983 }); 9984 registry.dispatch(import_editor4.store).setIsListViewOpened(isOpen); 9985 }; 9986 function setIsEditingTemplate() { 9987 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).setIsEditingTemplate", { 9988 since: "6.5", 9989 alternative: "dispatch( 'core/editor').setRenderingMode" 9990 }); 9991 return { type: "NOTHING" }; 9992 } 9993 function __unstableCreateTemplate() { 9994 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).__unstableCreateTemplate", { 9995 since: "6.5" 9996 }); 9997 return { type: "NOTHING" }; 9998 } 9999 var metaBoxesInitialized2 = false; 10000 var initializeMetaBoxes = () => ({ registry, select: select3, dispatch: dispatch2 }) => { 10001 const isEditorReady = registry.select(import_editor4.store).__unstableIsEditorReady(); 10002 if (!isEditorReady) { 10003 return; 10004 } 10005 if (metaBoxesInitialized2) { 10006 return; 10007 } 10008 const postType = registry.select(import_editor4.store).getCurrentPostType(); 10009 if (window.postboxes.page !== postType) { 10010 window.postboxes.add_postbox_toggles(postType); 10011 } 10012 metaBoxesInitialized2 = true; 10013 (0, import_hooks.addAction)( 10014 "editor.savePost", 10015 "core/edit-post/save-metaboxes", 10016 async (post, options) => { 10017 if (!options.isAutosave && select3.hasMetaBoxes()) { 10018 await dispatch2.requestMetaBoxUpdates(); 10019 } 10020 } 10021 ); 10022 dispatch2({ 10023 type: "META_BOXES_INITIALIZED" 10024 }); 10025 }; 10026 var toggleDistractionFree = () => ({ registry }) => { 10027 (0, import_deprecated.default)("dispatch( 'core/edit-post' ).toggleDistractionFree", { 10028 since: "6.6", 10029 alternative: "dispatch( 'core/editor').toggleDistractionFree" 10030 }); 10031 registry.dispatch(import_editor4.store).toggleDistractionFree(); 10032 }; 10033 var toggleFullscreenMode = () => ({ registry }) => { 10034 const isFullscreen = registry.select(import_preferences.store).get("core/edit-post", "fullscreenMode"); 10035 registry.dispatch(import_preferences.store).toggle("core/edit-post", "fullscreenMode"); 10036 registry.dispatch(import_notices.store).createInfoNotice( 10037 isFullscreen ? (0, import_i18n2.__)("Fullscreen mode deactivated.") : (0, import_i18n2.__)("Fullscreen mode activated."), 10038 { 10039 id: "core/edit-post/toggle-fullscreen-mode/notice", 10040 type: "snackbar", 10041 actions: [ 10042 { 10043 label: (0, import_i18n2.__)("Undo"), 10044 onClick: () => { 10045 registry.dispatch(import_preferences.store).toggle( 10046 "core/edit-post", 10047 "fullscreenMode" 10048 ); 10049 } 10050 } 10051 ] 10052 } 10053 ); 10054 }; 10055 10056 // packages/edit-post/build-module/store/selectors.mjs 10057 var selectors_exports = {}; 10058 __export(selectors_exports, { 10059 __experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint, 10060 __experimentalGetPreviewDeviceType: () => __experimentalGetPreviewDeviceType, 10061 areMetaBoxesInitialized: () => areMetaBoxesInitialized, 10062 getActiveGeneralSidebarName: () => getActiveGeneralSidebarName, 10063 getActiveMetaBoxLocations: () => getActiveMetaBoxLocations, 10064 getAllMetaBoxes: () => getAllMetaBoxes, 10065 getEditedPostTemplate: () => getEditedPostTemplate, 10066 getEditorMode: () => getEditorMode, 10067 getHiddenBlockTypes: () => getHiddenBlockTypes, 10068 getMetaBoxesPerLocation: () => getMetaBoxesPerLocation, 10069 getPreference: () => getPreference, 10070 getPreferences: () => getPreferences, 10071 hasMetaBoxes: () => hasMetaBoxes, 10072 isEditingTemplate: () => isEditingTemplate, 10073 isEditorPanelEnabled: () => isEditorPanelEnabled, 10074 isEditorPanelOpened: () => isEditorPanelOpened, 10075 isEditorPanelRemoved: () => isEditorPanelRemoved, 10076 isEditorSidebarOpened: () => isEditorSidebarOpened, 10077 isFeatureActive: () => isFeatureActive, 10078 isInserterOpened: () => isInserterOpened, 10079 isListViewOpened: () => isListViewOpened, 10080 isMetaBoxLocationActive: () => isMetaBoxLocationActive, 10081 isMetaBoxLocationVisible: () => isMetaBoxLocationVisible, 10082 isModalActive: () => isModalActive, 10083 isPluginItemPinned: () => isPluginItemPinned, 10084 isPluginSidebarOpened: () => isPluginSidebarOpened, 10085 isPublishSidebarOpened: () => isPublishSidebarOpened, 10086 isSavingMetaBoxes: () => isSavingMetaBoxes2 10087 }); 10088 var import_data5 = __toESM(require_data(), 1); 10089 var import_preferences2 = __toESM(require_preferences(), 1); 10090 var import_core_data4 = __toESM(require_core_data(), 1); 10091 var import_editor5 = __toESM(require_editor(), 1); 10092 var import_deprecated2 = __toESM(require_deprecated(), 1); 10093 var { interfaceStore: interfaceStore2 } = unlock2(import_editor5.privateApis); 10094 var EMPTY_ARRAY2 = []; 10095 var EMPTY_OBJECT2 = {}; 10096 var getEditorMode = (0, import_data5.createRegistrySelector)( 10097 (select3) => () => select3(import_preferences2.store).get("core", "editorMode") ?? "visual" 10098 ); 10099 var isEditorSidebarOpened = (0, import_data5.createRegistrySelector)( 10100 (select3) => () => { 10101 const activeGeneralSidebar = select3(interfaceStore2).getActiveComplementaryArea("core"); 10102 return ["edit-post/document", "edit-post/block"].includes( 10103 activeGeneralSidebar 10104 ); 10105 } 10106 ); 10107 var isPluginSidebarOpened = (0, import_data5.createRegistrySelector)( 10108 (select3) => () => { 10109 const activeGeneralSidebar = select3(interfaceStore2).getActiveComplementaryArea("core"); 10110 return !!activeGeneralSidebar && !["edit-post/document", "edit-post/block"].includes( 10111 activeGeneralSidebar 10112 ); 10113 } 10114 ); 10115 var getActiveGeneralSidebarName = (0, import_data5.createRegistrySelector)( 10116 (select3) => () => { 10117 return select3(interfaceStore2).getActiveComplementaryArea("core"); 10118 } 10119 ); 10120 function convertPanelsToOldFormat(inactivePanels, openPanels) { 10121 const panelsWithEnabledState = inactivePanels?.reduce( 10122 (accumulatedPanels, panelName) => ({ 10123 ...accumulatedPanels, 10124 [panelName]: { 10125 enabled: false 10126 } 10127 }), 10128 {} 10129 ); 10130 const panels = openPanels?.reduce((accumulatedPanels, panelName) => { 10131 const currentPanelState = accumulatedPanels?.[panelName]; 10132 return { 10133 ...accumulatedPanels, 10134 [panelName]: { 10135 ...currentPanelState, 10136 opened: true 10137 } 10138 }; 10139 }, panelsWithEnabledState ?? {}); 10140 return panels ?? panelsWithEnabledState ?? EMPTY_OBJECT2; 10141 } 10142 var getPreferences = (0, import_data5.createRegistrySelector)((select3) => () => { 10143 (0, import_deprecated2.default)(`select( 'core/edit-post' ).getPreferences`, { 10144 since: "6.0", 10145 alternative: `select( 'core/preferences' ).get` 10146 }); 10147 const corePreferences = ["editorMode", "hiddenBlockTypes"].reduce( 10148 (accumulatedPrefs, preferenceKey) => { 10149 const value = select3(import_preferences2.store).get( 10150 "core", 10151 preferenceKey 10152 ); 10153 return { 10154 ...accumulatedPrefs, 10155 [preferenceKey]: value 10156 }; 10157 }, 10158 {} 10159 ); 10160 const inactivePanels = select3(import_preferences2.store).get( 10161 "core", 10162 "inactivePanels" 10163 ); 10164 const openPanels = select3(import_preferences2.store).get("core", "openPanels"); 10165 const panels = convertPanelsToOldFormat(inactivePanels, openPanels); 10166 return { 10167 ...corePreferences, 10168 panels 10169 }; 10170 }); 10171 function getPreference(state, preferenceKey, defaultValue) { 10172 (0, import_deprecated2.default)(`select( 'core/edit-post' ).getPreference`, { 10173 since: "6.0", 10174 alternative: `select( 'core/preferences' ).get` 10175 }); 10176 const preferences = getPreferences(state); 10177 const value = preferences[preferenceKey]; 10178 return value === void 0 ? defaultValue : value; 10179 } 10180 var getHiddenBlockTypes = (0, import_data5.createRegistrySelector)((select3) => () => { 10181 return select3(import_preferences2.store).get("core", "hiddenBlockTypes") ?? EMPTY_ARRAY2; 10182 }); 10183 var isPublishSidebarOpened = (0, import_data5.createRegistrySelector)( 10184 (select3) => () => { 10185 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isPublishSidebarOpened`, { 10186 since: "6.6", 10187 alternative: `select( 'core/editor' ).isPublishSidebarOpened` 10188 }); 10189 return select3(import_editor5.store).isPublishSidebarOpened(); 10190 } 10191 ); 10192 var isEditorPanelRemoved = (0, import_data5.createRegistrySelector)( 10193 (select3) => (state, panelName) => { 10194 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelRemoved`, { 10195 since: "6.5", 10196 alternative: `select( 'core/editor' ).isEditorPanelRemoved` 10197 }); 10198 return select3(import_editor5.store).isEditorPanelRemoved(panelName); 10199 } 10200 ); 10201 var isEditorPanelEnabled = (0, import_data5.createRegistrySelector)( 10202 (select3) => (state, panelName) => { 10203 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelEnabled`, { 10204 since: "6.5", 10205 alternative: `select( 'core/editor' ).isEditorPanelEnabled` 10206 }); 10207 return select3(import_editor5.store).isEditorPanelEnabled(panelName); 10208 } 10209 ); 10210 var isEditorPanelOpened = (0, import_data5.createRegistrySelector)( 10211 (select3) => (state, panelName) => { 10212 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditorPanelOpened`, { 10213 since: "6.5", 10214 alternative: `select( 'core/editor' ).isEditorPanelOpened` 10215 }); 10216 return select3(import_editor5.store).isEditorPanelOpened(panelName); 10217 } 10218 ); 10219 var isModalActive = (0, import_data5.createRegistrySelector)( 10220 (select3) => (state, modalName) => { 10221 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isModalActive`, { 10222 since: "6.3", 10223 alternative: `select( 'core/interface' ).isModalActive` 10224 }); 10225 return !!select3(interfaceStore2).isModalActive(modalName); 10226 } 10227 ); 10228 var isFeatureActive = (0, import_data5.createRegistrySelector)( 10229 (select3) => (state, feature) => { 10230 return !!select3(import_preferences2.store).get("core/edit-post", feature); 10231 } 10232 ); 10233 var isPluginItemPinned = (0, import_data5.createRegistrySelector)( 10234 (select3) => (state, pluginName) => { 10235 return select3(interfaceStore2).isItemPinned("core", pluginName); 10236 } 10237 ); 10238 var getActiveMetaBoxLocations = (0, import_data5.createSelector)( 10239 (state) => { 10240 return Object.keys(state.metaBoxes.locations).filter( 10241 (location) => isMetaBoxLocationActive(state, location) 10242 ); 10243 }, 10244 (state) => [state.metaBoxes.locations] 10245 ); 10246 var isMetaBoxLocationVisible = (0, import_data5.createRegistrySelector)( 10247 (select3) => (state, location) => { 10248 return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({ id }) => { 10249 return select3(import_editor5.store).isEditorPanelEnabled( 10250 `meta-box-$id}` 10251 ); 10252 }); 10253 } 10254 ); 10255 function isMetaBoxLocationActive(state, location) { 10256 const metaBoxes2 = getMetaBoxesPerLocation(state, location); 10257 return !!metaBoxes2 && metaBoxes2.length !== 0; 10258 } 10259 function getMetaBoxesPerLocation(state, location) { 10260 return state.metaBoxes.locations[location]; 10261 } 10262 var getAllMetaBoxes = (0, import_data5.createSelector)( 10263 (state) => { 10264 return Object.values(state.metaBoxes.locations).flat(); 10265 }, 10266 (state) => [state.metaBoxes.locations] 10267 ); 10268 function hasMetaBoxes(state) { 10269 return getActiveMetaBoxLocations(state).length > 0; 10270 } 10271 function isSavingMetaBoxes2(state) { 10272 return state.metaBoxes.isSaving; 10273 } 10274 var __experimentalGetPreviewDeviceType = (0, import_data5.createRegistrySelector)( 10275 (select3) => () => { 10276 (0, import_deprecated2.default)( 10277 `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, 10278 { 10279 since: "6.5", 10280 version: "6.7", 10281 alternative: `select( 'core/editor' ).getDeviceType` 10282 } 10283 ); 10284 return select3(import_editor5.store).getDeviceType(); 10285 } 10286 ); 10287 var isInserterOpened = (0, import_data5.createRegistrySelector)((select3) => () => { 10288 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isInserterOpened`, { 10289 since: "6.5", 10290 alternative: `select( 'core/editor' ).isInserterOpened` 10291 }); 10292 return select3(import_editor5.store).isInserterOpened(); 10293 }); 10294 var __experimentalGetInsertionPoint = (0, import_data5.createRegistrySelector)( 10295 (select3) => () => { 10296 (0, import_deprecated2.default)( 10297 `select( 'core/edit-post' ).__experimentalGetInsertionPoint`, 10298 { 10299 since: "6.5", 10300 version: "6.7" 10301 } 10302 ); 10303 return unlock2(select3(import_editor5.store)).getInserter(); 10304 } 10305 ); 10306 var isListViewOpened = (0, import_data5.createRegistrySelector)((select3) => () => { 10307 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isListViewOpened`, { 10308 since: "6.5", 10309 alternative: `select( 'core/editor' ).isListViewOpened` 10310 }); 10311 return select3(import_editor5.store).isListViewOpened(); 10312 }); 10313 var isEditingTemplate = (0, import_data5.createRegistrySelector)((select3) => () => { 10314 (0, import_deprecated2.default)(`select( 'core/edit-post' ).isEditingTemplate`, { 10315 since: "6.5", 10316 alternative: `select( 'core/editor' ).getRenderingMode` 10317 }); 10318 return select3(import_editor5.store).getCurrentPostType() === "wp_template"; 10319 }); 10320 function areMetaBoxesInitialized(state) { 10321 return state.metaBoxes.initialized; 10322 } 10323 var getEditedPostTemplate = (0, import_data5.createRegistrySelector)( 10324 (select3) => () => { 10325 const { id: postId, type: postType } = select3(import_editor5.store).getCurrentPost(); 10326 const templateId = unlock2(select3(import_core_data4.store)).getTemplateId( 10327 postType, 10328 postId 10329 ); 10330 if (!templateId) { 10331 return void 0; 10332 } 10333 return select3(import_core_data4.store).getEditedEntityRecord( 10334 "postType", 10335 "wp_template", 10336 templateId 10337 ); 10338 } 10339 ); 10340 10341 // packages/edit-post/build-module/store/index.mjs 10342 var store = (0, import_data6.createReduxStore)(STORE_NAME, { 10343 reducer: reducer_default, 10344 actions: actions_exports, 10345 selectors: selectors_exports 10346 }); 10347 (0, import_data6.register)(store); 10348 10349 // packages/edit-post/build-module/components/keyboard-shortcuts/index.mjs 10350 function KeyboardShortcuts() { 10351 const { toggleFullscreenMode: toggleFullscreenMode2 } = (0, import_data7.useDispatch)(store); 10352 const { registerShortcut } = (0, import_data7.useDispatch)(import_keyboard_shortcuts.store); 10353 (0, import_element19.useEffect)(() => { 10354 registerShortcut({ 10355 name: "core/edit-post/toggle-fullscreen", 10356 category: "global", 10357 description: (0, import_i18n3.__)("Enable or disable fullscreen mode."), 10358 keyCombination: { 10359 modifier: "secondary", 10360 character: "f" 10361 } 10362 }); 10363 }, []); 10364 (0, import_keyboard_shortcuts.useShortcut)("core/edit-post/toggle-fullscreen", () => { 10365 toggleFullscreenMode2(); 10366 }); 10367 return null; 10368 } 10369 var keyboard_shortcuts_default = KeyboardShortcuts; 10370 10371 // packages/edit-post/build-module/components/init-pattern-modal/index.mjs 10372 var import_data8 = __toESM(require_data(), 1); 10373 var import_i18n4 = __toESM(require_i18n(), 1); 10374 var import_components3 = __toESM(require_components(), 1); 10375 var import_element20 = __toESM(require_element(), 1); 10376 var import_editor6 = __toESM(require_editor(), 1); 10377 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 10378 function InitPatternModal() { 10379 const { editPost } = (0, import_data8.useDispatch)(import_editor6.store); 10380 const { isCleanNewPost } = (0, import_data8.useSelect)(import_editor6.store); 10381 const [syncType, setSyncType] = (0, import_element20.useState)(void 0); 10382 const [title, setTitle] = (0, import_element20.useState)(""); 10383 const [isModalOpen, setIsModalOpen] = (0, import_element20.useState)(() => isCleanNewPost()); 10384 if (!isModalOpen) { 10385 return null; 10386 } 10387 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 10388 import_components3.Modal, 10389 { 10390 title: (0, import_i18n4.__)("Create pattern"), 10391 onRequestClose: () => { 10392 setIsModalOpen(false); 10393 }, 10394 overlayClassName: "patterns-create-modal", 10395 children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 10396 "form", 10397 { 10398 onSubmit: (event) => { 10399 event.preventDefault(); 10400 setIsModalOpen(false); 10401 editPost({ 10402 title, 10403 meta: { 10404 wp_pattern_sync_status: syncType 10405 } 10406 }); 10407 }, 10408 children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 10409 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 10410 import_components3.TextControl, 10411 { 10412 label: (0, import_i18n4.__)("Name"), 10413 value: title, 10414 onChange: setTitle, 10415 placeholder: (0, import_i18n4.__)("My pattern"), 10416 className: "patterns-create-modal__name-input" 10417 } 10418 ), 10419 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 10420 import_components3.ToggleControl, 10421 { 10422 label: (0, import_i18n4._x)("Synced", "pattern (singular)"), 10423 help: (0, import_i18n4.__)( 10424 "Sync this pattern across multiple locations." 10425 ), 10426 checked: !syncType, 10427 onChange: () => { 10428 setSyncType(!syncType ? "unsynced" : void 0); 10429 } 10430 } 10431 ), 10432 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Stack, { justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 10433 import_components3.Button, 10434 { 10435 __next40pxDefaultSize: true, 10436 variant: "primary", 10437 type: "submit", 10438 disabled: !title, 10439 accessibleWhenDisabled: true, 10440 children: (0, import_i18n4.__)("Create") 10441 } 10442 ) }) 10443 ] }) 10444 } 10445 ) 10446 } 10447 ); 10448 } 10449 10450 // packages/edit-post/build-module/components/browser-url/index.mjs 10451 var import_element22 = __toESM(require_element(), 1); 10452 var import_data10 = __toESM(require_data(), 1); 10453 var import_url3 = __toESM(require_url(), 1); 10454 var import_editor8 = __toESM(require_editor(), 1); 10455 10456 // packages/edit-post/build-module/components/browser-url/use-classic-revision-redirect.mjs 10457 var import_data9 = __toESM(require_data(), 1); 10458 var import_core_data5 = __toESM(require_core_data(), 1); 10459 var import_editor7 = __toESM(require_editor(), 1); 10460 var import_element21 = __toESM(require_element(), 1); 10461 var import_url2 = __toESM(require_url(), 1); 10462 function useClassicRevisionRedirect() { 10463 const registry = (0, import_data9.useRegistry)(); 10464 const { disableVisualRevisions, currentRevisionId, postType, postId } = (0, import_data9.useSelect)((select3) => { 10465 const editor = select3(import_editor7.store); 10466 return { 10467 disableVisualRevisions: !!editor.getEditorSettings().disableVisualRevisions, 10468 currentRevisionId: unlock2(editor).getCurrentRevisionId(), 10469 postType: editor.getCurrentPostType(), 10470 postId: editor.getCurrentPostId() 10471 }; 10472 }, []); 10473 const hasClassicRevisionScreen = ![ 10474 "wp_template", 10475 "wp_template_part" 10476 ].includes(postType); 10477 (0, import_element21.useEffect)(() => { 10478 if (!disableVisualRevisions || !hasClassicRevisionScreen || !currentRevisionId || !postType || !postId) { 10479 return; 10480 } 10481 let cancelled = false; 10482 registry.resolveSelect(import_core_data5.store).getRevision("postType", postType, postId, currentRevisionId, { 10483 context: "edit", 10484 _fields: "id" 10485 }).then((revision) => { 10486 if (cancelled || !revision) { 10487 return; 10488 } 10489 const editor = registry.select(import_editor7.store); 10490 const isStillSelected = !!editor.getEditorSettings().disableVisualRevisions && editor.getCurrentPostType() === postType && String(editor.getCurrentPostId()) === String(postId) && unlock2(editor).getCurrentRevisionId() === currentRevisionId; 10491 if (!isStillSelected) { 10492 return; 10493 } 10494 window.location.replace( 10495 (0, import_url2.addQueryArgs)("revision.php", { 10496 revision: currentRevisionId 10497 }) 10498 ); 10499 }); 10500 return () => { 10501 cancelled = true; 10502 }; 10503 }, [ 10504 disableVisualRevisions, 10505 hasClassicRevisionScreen, 10506 currentRevisionId, 10507 postType, 10508 postId, 10509 registry 10510 ]); 10511 } 10512 10513 // packages/edit-post/build-module/components/browser-url/index.mjs 10514 var URL_WRITE_DEBOUNCE_MS = 300; 10515 function getPostEditURL(postId, revisionId) { 10516 const args = { post: postId, action: "edit" }; 10517 if (revisionId) { 10518 args.revision = revisionId; 10519 } 10520 return (0, import_url3.addQueryArgs)("post.php", args); 10521 } 10522 function BrowserURL() { 10523 useClassicRevisionRedirect(); 10524 const [initialRevisionId] = (0, import_element22.useState)(() => { 10525 const revision = Number( 10526 (0, import_url3.getQueryArg)(window.location.href, "revision") 10527 ); 10528 return Number.isInteger(revision) && revision > 0 ? revision : null; 10529 }); 10530 const hasHandledInitialRevisionRef = (0, import_element22.useRef)(false); 10531 const { postId, postStatus, currentRevisionId } = (0, import_data10.useSelect)((select3) => { 10532 const { getCurrentPost } = select3(import_editor8.store); 10533 const { getCurrentRevisionId } = unlock2(select3(import_editor8.store)); 10534 const post = getCurrentPost(); 10535 let { id, status, type } = post; 10536 const isTemplate = ["wp_template", "wp_template_part"].includes( 10537 type 10538 ); 10539 if (isTemplate) { 10540 id = post.wp_id; 10541 } 10542 return { 10543 postId: id, 10544 postStatus: status, 10545 // `post.php` rejects templates because `show_ui` is false. Adding 10546 // their revision ID to this URL would create a dead link. 10547 currentRevisionId: isTemplate ? null : getCurrentRevisionId() 10548 }; 10549 }, []); 10550 const { openRevision } = unlock2((0, import_data10.useDispatch)(import_editor8.store)); 10551 const lastURLWriteTimeRef = (0, import_element22.useRef)(null); 10552 const lastPostIdRef = (0, import_element22.useRef)(null); 10553 (0, import_element22.useEffect)(() => { 10554 if (!postId) { 10555 return; 10556 } 10557 if (initialRevisionId && !hasHandledInitialRevisionRef.current) { 10558 hasHandledInitialRevisionRef.current = true; 10559 openRevision(initialRevisionId); 10560 return; 10561 } 10562 if (postStatus === "auto-draft") { 10563 return; 10564 } 10565 const previousPostId = lastPostIdRef.current; 10566 lastPostIdRef.current = postId; 10567 const url = getPostEditURL(postId, currentRevisionId); 10568 const write = () => { 10569 lastURLWriteTimeRef.current = Date.now(); 10570 try { 10571 window.history.replaceState( 10572 { id: postId }, 10573 "Post " + postId, 10574 url 10575 ); 10576 } catch { 10577 } 10578 }; 10579 if (previousPostId !== null && previousPostId !== postId) { 10580 write(); 10581 return; 10582 } 10583 if (lastURLWriteTimeRef.current === null) { 10584 write(); 10585 return; 10586 } 10587 if (Date.now() - lastURLWriteTimeRef.current >= URL_WRITE_DEBOUNCE_MS) { 10588 write(); 10589 return; 10590 } 10591 const timeoutId = setTimeout(write, URL_WRITE_DEBOUNCE_MS); 10592 return () => clearTimeout(timeoutId); 10593 }, [ 10594 postId, 10595 postStatus, 10596 currentRevisionId, 10597 initialRevisionId, 10598 openRevision 10599 ]); 10600 return null; 10601 } 10602 10603 // packages/edit-post/build-module/components/meta-boxes/index.mjs 10604 var import_data13 = __toESM(require_data(), 1); 10605 10606 // packages/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.mjs 10607 var import_element23 = __toESM(require_element(), 1); 10608 var import_components4 = __toESM(require_components(), 1); 10609 var import_data11 = __toESM(require_data(), 1); 10610 var import_block_editor = __toESM(require_block_editor(), 1); 10611 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 10612 var { useNativeUndo } = unlock2(import_block_editor.privateApis); 10613 function MetaBoxesArea({ location }) { 10614 const container = (0, import_element23.useRef)(null); 10615 const formRef = (0, import_element23.useRef)(null); 10616 (0, import_element23.useEffect)(() => { 10617 formRef.current = document.querySelector( 10618 ".metabox-location-" + location 10619 ); 10620 if (formRef.current) { 10621 container.current.appendChild(formRef.current); 10622 } 10623 return () => { 10624 if (formRef.current) { 10625 document.querySelector("#metaboxes").appendChild(formRef.current); 10626 } 10627 }; 10628 }, [location]); 10629 const isSaving = (0, import_data11.useSelect)((select3) => { 10630 return select3(store).isSavingMetaBoxes(); 10631 }, []); 10632 const classes = clsx_default("edit-post-meta-boxes-area", `is-$location}`, { 10633 "is-loading": isSaving 10634 }); 10635 const nativeUndoRef = useNativeUndo(); 10636 return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: classes, ref: nativeUndoRef, children: [ 10637 isSaving && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components4.Spinner, { className: "edit-post-meta-boxes-area__spinner" }), 10638 /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( 10639 "div", 10640 { 10641 className: "edit-post-meta-boxes-area__container", 10642 ref: container 10643 } 10644 ), 10645 /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "edit-post-meta-boxes-area__clear" }) 10646 ] }); 10647 } 10648 var meta_boxes_area_default = MetaBoxesArea; 10649 10650 // packages/edit-post/build-module/components/meta-boxes/meta-box-visibility.mjs 10651 var import_element24 = __toESM(require_element(), 1); 10652 var import_data12 = __toESM(require_data(), 1); 10653 var import_editor9 = __toESM(require_editor(), 1); 10654 function MetaBoxVisibility({ id }) { 10655 const isVisible = (0, import_data12.useSelect)( 10656 (select3) => { 10657 return select3(import_editor9.store).isEditorPanelEnabled( 10658 `meta-box-$id}` 10659 ); 10660 }, 10661 [id] 10662 ); 10663 (0, import_element24.useEffect)(() => { 10664 const element = document.getElementById(id); 10665 if (!element) { 10666 return; 10667 } 10668 if (isVisible) { 10669 element.classList.remove("is-hidden"); 10670 } else { 10671 element.classList.add("is-hidden"); 10672 } 10673 }, [id, isVisible]); 10674 return null; 10675 } 10676 10677 // packages/edit-post/build-module/components/meta-boxes/index.mjs 10678 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 10679 function MetaBoxes({ location }) { 10680 const metaBoxes2 = (0, import_data13.useSelect)( 10681 (select3) => select3(store).getMetaBoxesPerLocation(location), 10682 [location] 10683 ); 10684 return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [ 10685 (metaBoxes2 ?? []).map(({ id }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MetaBoxVisibility, { id }, id)), 10686 /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(meta_boxes_area_default, { location }) 10687 ] }); 10688 } 10689 10690 // packages/edit-post/build-module/components/more-menu/index.mjs 10691 var import_i18n10 = __toESM(require_i18n(), 1); 10692 var import_compose = __toESM(require_compose(), 1); 10693 var import_editor15 = __toESM(require_editor(), 1); 10694 var import_keycodes = __toESM(require_keycodes(), 1); 10695 var import_preferences8 = __toESM(require_preferences(), 1); 10696 10697 // packages/edit-post/build-module/components/more-menu/manage-patterns-menu-item.mjs 10698 var import_components5 = __toESM(require_components(), 1); 10699 var import_core_data6 = __toESM(require_core_data(), 1); 10700 var import_data14 = __toESM(require_data(), 1); 10701 var import_i18n5 = __toESM(require_i18n(), 1); 10702 var import_url4 = __toESM(require_url(), 1); 10703 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 10704 function ManagePatternsMenuItem() { 10705 const url = (0, import_data14.useSelect)((select3) => { 10706 const { canUser } = select3(import_core_data6.store); 10707 const defaultUrl = (0, import_url4.addQueryArgs)("edit.php", { 10708 post_type: "wp_block" 10709 }); 10710 const patternsUrl = (0, import_url4.addQueryArgs)("site-editor.php", { 10711 p: "/pattern" 10712 }); 10713 return canUser("create", { 10714 kind: "postType", 10715 name: "wp_template" 10716 }) ? patternsUrl : defaultUrl; 10717 }, []); 10718 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components5.MenuItem, { role: "menuitem", href: url, children: (0, import_i18n5.__)("Manage patterns") }); 10719 } 10720 var manage_patterns_menu_item_default = ManagePatternsMenuItem; 10721 10722 // packages/edit-post/build-module/components/more-menu/welcome-guide-menu-item.mjs 10723 var import_data15 = __toESM(require_data(), 1); 10724 var import_preferences3 = __toESM(require_preferences(), 1); 10725 var import_i18n6 = __toESM(require_i18n(), 1); 10726 var import_editor10 = __toESM(require_editor(), 1); 10727 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 10728 function WelcomeGuideMenuItem() { 10729 const isEditingTemplate2 = (0, import_data15.useSelect)( 10730 (select3) => select3(import_editor10.store).getCurrentPostType() === "wp_template", 10731 [] 10732 ); 10733 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( 10734 import_preferences3.PreferenceToggleMenuItem, 10735 { 10736 scope: "core/edit-post", 10737 name: isEditingTemplate2 ? "welcomeGuideTemplate" : "welcomeGuide", 10738 label: (0, import_i18n6.__)("Welcome Guide") 10739 } 10740 ); 10741 } 10742 10743 // packages/edit-post/build-module/components/preferences-modal/index.mjs 10744 var import_i18n9 = __toESM(require_i18n(), 1); 10745 var import_preferences7 = __toESM(require_preferences(), 1); 10746 var import_editor14 = __toESM(require_editor(), 1); 10747 10748 // packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.mjs 10749 var import_i18n8 = __toESM(require_i18n(), 1); 10750 var import_data18 = __toESM(require_data(), 1); 10751 var import_editor13 = __toESM(require_editor(), 1); 10752 var import_preferences6 = __toESM(require_preferences(), 1); 10753 10754 // packages/edit-post/build-module/components/preferences-modal/enable-custom-fields.mjs 10755 var import_element25 = __toESM(require_element(), 1); 10756 var import_i18n7 = __toESM(require_i18n(), 1); 10757 var import_components6 = __toESM(require_components(), 1); 10758 var import_data16 = __toESM(require_data(), 1); 10759 var import_editor11 = __toESM(require_editor(), 1); 10760 var import_preferences4 = __toESM(require_preferences(), 1); 10761 var import_url5 = __toESM(require_url(), 1); 10762 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 10763 var { PreferenceBaseOption } = unlock2(import_preferences4.privateApis); 10764 function submitCustomFieldsForm() { 10765 const customFieldsForm = document.getElementById( 10766 "toggle-custom-fields-form" 10767 ); 10768 customFieldsForm.querySelector('[name="_wp_http_referer"]').setAttribute("value", (0, import_url5.getPathAndQueryString)(window.location.href)); 10769 customFieldsForm.submit(); 10770 } 10771 function CustomFieldsConfirmation({ willEnable }) { 10772 const [isReloading, setIsReloading] = (0, import_element25.useState)(false); 10773 return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [ 10774 /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "edit-post-preferences-modal__custom-fields-confirmation-message", children: (0, import_i18n7.__)( 10775 "A page reload is required for this change. Make sure your content is saved before reloading." 10776 ) }), 10777 /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( 10778 import_components6.Button, 10779 { 10780 __next40pxDefaultSize: true, 10781 variant: "secondary", 10782 isBusy: isReloading, 10783 accessibleWhenDisabled: true, 10784 disabled: isReloading, 10785 onClick: () => { 10786 setIsReloading(true); 10787 submitCustomFieldsForm(); 10788 }, 10789 children: willEnable ? (0, import_i18n7.__)("Show & Reload Page") : (0, import_i18n7.__)("Hide & Reload Page") 10790 } 10791 ) 10792 ] }); 10793 } 10794 function EnableCustomFieldsOption({ label }) { 10795 const areCustomFieldsEnabled = (0, import_data16.useSelect)((select3) => { 10796 return !!select3(import_editor11.store).getEditorSettings().enableCustomFields; 10797 }, []); 10798 const [isChecked, setIsChecked] = (0, import_element25.useState)(areCustomFieldsEnabled); 10799 return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( 10800 PreferenceBaseOption, 10801 { 10802 label, 10803 isChecked, 10804 onChange: setIsChecked, 10805 children: isChecked !== areCustomFieldsEnabled && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CustomFieldsConfirmation, { willEnable: isChecked }) 10806 } 10807 ); 10808 } 10809 10810 // packages/edit-post/build-module/components/preferences-modal/enable-panel.mjs 10811 var import_data17 = __toESM(require_data(), 1); 10812 var import_editor12 = __toESM(require_editor(), 1); 10813 var import_preferences5 = __toESM(require_preferences(), 1); 10814 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 10815 var { PreferenceBaseOption: PreferenceBaseOption2 } = unlock2(import_preferences5.privateApis); 10816 function EnablePanelOption(props) { 10817 const { toggleEditorPanelEnabled: toggleEditorPanelEnabled2 } = (0, import_data17.useDispatch)(import_editor12.store); 10818 const { isChecked, isRemoved } = (0, import_data17.useSelect)( 10819 (select3) => { 10820 const { isEditorPanelEnabled: isEditorPanelEnabled2, isEditorPanelRemoved: isEditorPanelRemoved2 } = select3(import_editor12.store); 10821 return { 10822 isChecked: isEditorPanelEnabled2(props.panelName), 10823 isRemoved: isEditorPanelRemoved2(props.panelName) 10824 }; 10825 }, 10826 [props.panelName] 10827 ); 10828 if (isRemoved) { 10829 return null; 10830 } 10831 return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 10832 PreferenceBaseOption2, 10833 { 10834 isChecked, 10835 onChange: () => toggleEditorPanelEnabled2(props.panelName), 10836 ...props 10837 } 10838 ); 10839 } 10840 10841 // packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.mjs 10842 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 10843 var { PreferencesModalSection } = unlock2(import_preferences6.privateApis); 10844 function MetaBoxesSection(sectionProps) { 10845 const { areCustomFieldsRegistered, metaBoxes: metaBoxes2 } = (0, import_data18.useSelect)((select3) => { 10846 const { getEditorSettings } = select3(import_editor13.store); 10847 const { getAllMetaBoxes: getAllMetaBoxes2 } = select3(store); 10848 return { 10849 areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== void 0, 10850 metaBoxes: getAllMetaBoxes2() 10851 }; 10852 }, []); 10853 const thirdPartyMetaBoxes = metaBoxes2.filter( 10854 ({ id }) => id !== "postcustom" 10855 ); 10856 if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) { 10857 return null; 10858 } 10859 return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(PreferencesModalSection, { ...sectionProps, children: [ 10860 areCustomFieldsRegistered && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EnableCustomFieldsOption, { label: (0, import_i18n8.__)("Custom fields") }), 10861 thirdPartyMetaBoxes.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 10862 EnablePanelOption, 10863 { 10864 label: title, 10865 panelName: `meta-box-$id}` 10866 }, 10867 id 10868 )) 10869 ] }); 10870 } 10871 10872 // packages/edit-post/build-module/components/preferences-modal/index.mjs 10873 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 10874 var { PreferenceToggleControl } = unlock2(import_preferences7.privateApis); 10875 var { PreferencesModal } = unlock2(import_editor14.privateApis); 10876 function EditPostPreferencesModal() { 10877 const extraSections = { 10878 general: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MetaBoxesSection, { title: (0, import_i18n9.__)("Advanced") }), 10879 appearance: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 10880 PreferenceToggleControl, 10881 { 10882 scope: "core/edit-post", 10883 featureName: "themeStyles", 10884 help: (0, import_i18n9.__)("Make the editor look like your theme."), 10885 label: (0, import_i18n9.__)("Use theme styles") 10886 } 10887 ) 10888 }; 10889 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PreferencesModal, { extraSections }); 10890 } 10891 10892 // packages/edit-post/build-module/components/more-menu/index.mjs 10893 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 10894 var { ToolsMoreMenuGroup, ViewMoreMenuGroup } = unlock2(import_editor15.privateApis); 10895 var MoreMenu = () => { 10896 const isLargeViewport = (0, import_compose.useViewportMatch)("large"); 10897 return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [ 10898 isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ViewMoreMenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( 10899 import_preferences8.PreferenceToggleMenuItem, 10900 { 10901 scope: "core/edit-post", 10902 name: "fullscreenMode", 10903 label: (0, import_i18n10.__)("Fullscreen mode"), 10904 info: (0, import_i18n10.__)("Show and hide the admin user interface"), 10905 messageActivated: (0, import_i18n10.__)("Fullscreen mode activated."), 10906 messageDeactivated: (0, import_i18n10.__)( 10907 "Fullscreen mode deactivated." 10908 ), 10909 shortcut: import_keycodes.displayShortcut.secondary("f") 10910 } 10911 ) }), 10912 /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(ToolsMoreMenuGroup, { children: [ 10913 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(manage_patterns_menu_item_default, {}), 10914 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(WelcomeGuideMenuItem, {}) 10915 ] }), 10916 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EditPostPreferencesModal, {}) 10917 ] }); 10918 }; 10919 var more_menu_default = MoreMenu; 10920 10921 // packages/edit-post/build-module/components/welcome-guide/index.mjs 10922 var import_data21 = __toESM(require_data(), 1); 10923 10924 // packages/edit-post/build-module/components/welcome-guide/default.mjs 10925 var import_data19 = __toESM(require_data(), 1); 10926 var import_components7 = __toESM(require_components(), 1); 10927 var import_i18n11 = __toESM(require_i18n(), 1); 10928 var import_element26 = __toESM(require_element(), 1); 10929 10930 // packages/edit-post/build-module/components/welcome-guide/image.mjs 10931 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 10932 function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { 10933 return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("picture", { className: "edit-post-welcome-guide__image", children: [ 10934 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 10935 "source", 10936 { 10937 srcSet: nonAnimatedSrc, 10938 media: "(prefers-reduced-motion: reduce)" 10939 } 10940 ), 10941 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" }) 10942 ] }); 10943 } 10944 10945 // packages/edit-post/build-module/components/welcome-guide/default.mjs 10946 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 10947 function WelcomeGuideDefault() { 10948 const { toggleFeature: toggleFeature2 } = (0, import_data19.useDispatch)(store); 10949 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 10950 import_components7.Guide, 10951 { 10952 className: "edit-post-welcome-guide", 10953 contentLabel: (0, import_i18n11.__)("Welcome to the editor"), 10954 finishButtonText: (0, import_i18n11.__)("Get started"), 10955 onFinish: () => toggleFeature2("welcomeGuide"), 10956 pages: [ 10957 { 10958 image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 10959 WelcomeGuideImage, 10960 { 10961 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", 10962 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" 10963 } 10964 ), 10965 content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [ 10966 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Welcome to the editor") }), 10967 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n11.__)( 10968 "In the WordPress editor, each paragraph, image, or video is presented as a distinct \u201Cblock\u201D of content." 10969 ) }) 10970 ] }) 10971 }, 10972 { 10973 image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 10974 WelcomeGuideImage, 10975 { 10976 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", 10977 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" 10978 } 10979 ), 10980 content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [ 10981 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Customize each block") }), 10982 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n11.__)( 10983 "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." 10984 ) }) 10985 ] }) 10986 }, 10987 { 10988 image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 10989 WelcomeGuideImage, 10990 { 10991 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", 10992 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" 10993 } 10994 ), 10995 content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [ 10996 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Explore all blocks") }), 10997 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element26.createInterpolateElement)( 10998 (0, import_i18n11.__)( 10999 "All of the blocks available to you live in the block library. You\u2019ll find it wherever you see the <InserterIconImage /> icon." 11000 ), 11001 { 11002 InserterIconImage: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 11003 "img", 11004 { 11005 alt: (0, import_i18n11.__)("inserter"), 11006 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" 11007 } 11008 ) 11009 } 11010 ) }) 11011 ] }) 11012 }, 11013 { 11014 image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 11015 WelcomeGuideImage, 11016 { 11017 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 11018 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 11019 } 11020 ), 11021 content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [ 11022 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Learn more") }), 11023 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element26.createInterpolateElement)( 11024 (0, import_i18n11.__)( 11025 "New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>" 11026 ), 11027 { 11028 a: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 11029 import_components7.ExternalLink, 11030 { 11031 href: (0, import_i18n11.__)( 11032 "https://wordpress.org/documentation/article/wordpress-block-editor/" 11033 ) 11034 } 11035 ) 11036 } 11037 ) }) 11038 ] }) 11039 } 11040 ] 11041 } 11042 ); 11043 } 11044 11045 // packages/edit-post/build-module/components/welcome-guide/template.mjs 11046 var import_data20 = __toESM(require_data(), 1); 11047 var import_components8 = __toESM(require_components(), 1); 11048 var import_i18n12 = __toESM(require_i18n(), 1); 11049 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 11050 function WelcomeGuideTemplate() { 11051 const { toggleFeature: toggleFeature2 } = (0, import_data20.useDispatch)(store); 11052 return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 11053 import_components8.Guide, 11054 { 11055 className: "edit-template-welcome-guide", 11056 contentLabel: (0, import_i18n12.__)("Welcome to the template editor"), 11057 finishButtonText: (0, import_i18n12.__)("Get started"), 11058 onFinish: () => toggleFeature2("welcomeGuideTemplate"), 11059 pages: [ 11060 { 11061 image: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 11062 WelcomeGuideImage, 11063 { 11064 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg", 11065 animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif" 11066 } 11067 ), 11068 content: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [ 11069 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n12.__)("Welcome to the template editor") }), 11070 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n12.__)( 11071 "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." 11072 ) }) 11073 ] }) 11074 } 11075 ] 11076 } 11077 ); 11078 } 11079 11080 // packages/edit-post/build-module/components/welcome-guide/index.mjs 11081 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 11082 function WelcomeGuide({ postType }) { 11083 const { isActive, isEditingTemplate: isEditingTemplate2 } = (0, import_data21.useSelect)( 11084 (select3) => { 11085 const { isFeatureActive: isFeatureActive2 } = select3(store); 11086 const _isEditingTemplate = postType === "wp_template"; 11087 const feature = _isEditingTemplate ? "welcomeGuideTemplate" : "welcomeGuide"; 11088 return { 11089 isActive: isFeatureActive2(feature), 11090 isEditingTemplate: _isEditingTemplate 11091 }; 11092 }, 11093 [postType] 11094 ); 11095 if (!isActive) { 11096 return null; 11097 } 11098 return isEditingTemplate2 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WelcomeGuideTemplate, {}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WelcomeGuideDefault, {}); 11099 } 11100 11101 // packages/edit-post/build-module/commands/use-commands.mjs 11102 var import_data22 = __toESM(require_data(), 1); 11103 var import_i18n13 = __toESM(require_i18n(), 1); 11104 var import_commands = __toESM(require_commands(), 1); 11105 var import_preferences9 = __toESM(require_preferences(), 1); 11106 var import_notices2 = __toESM(require_notices(), 1); 11107 function useCommands() { 11108 const { isFullscreen } = (0, import_data22.useSelect)((select3) => { 11109 const { get } = select3(import_preferences9.store); 11110 return { 11111 isFullscreen: get("core/edit-post", "fullscreenMode") 11112 }; 11113 }, []); 11114 const { toggle } = (0, import_data22.useDispatch)(import_preferences9.store); 11115 const { createInfoNotice } = (0, import_data22.useDispatch)(import_notices2.store); 11116 (0, import_commands.useCommand)({ 11117 name: "core/toggle-fullscreen-mode", 11118 label: isFullscreen ? (0, import_i18n13.__)("Exit fullscreen") : (0, import_i18n13.__)("Enter fullscreen"), 11119 icon: fullscreen_default, 11120 category: "command", 11121 callback: ({ close }) => { 11122 toggle("core/edit-post", "fullscreenMode"); 11123 close(); 11124 createInfoNotice( 11125 isFullscreen ? (0, import_i18n13.__)("Fullscreen off.") : (0, import_i18n13.__)("Fullscreen on."), 11126 { 11127 id: "core/edit-post/toggle-fullscreen-mode/notice", 11128 type: "snackbar", 11129 actions: [ 11130 { 11131 label: (0, import_i18n13.__)("Undo"), 11132 onClick: () => { 11133 toggle("core/edit-post", "fullscreenMode"); 11134 } 11135 } 11136 ] 11137 } 11138 ); 11139 } 11140 }); 11141 } 11142 11143 // packages/edit-post/build-module/hooks/use-navigate-to-entity-record.mjs 11144 var import_element27 = __toESM(require_element(), 1); 11145 var import_data23 = __toESM(require_data(), 1); 11146 var import_editor16 = __toESM(require_editor(), 1); 11147 var import_core_data7 = __toESM(require_core_data(), 1); 11148 function useNavigateToEntityRecord(initialPostId, initialPostType, defaultRenderingMode) { 11149 const registry = (0, import_data23.useRegistry)(); 11150 const [postHistory, dispatch2] = (0, import_element27.useReducer)( 11151 (historyState, { type, post: post2, previousRenderingMode: previousRenderingMode2, selectedBlockClientId }) => { 11152 if (type === "push") { 11153 const updatedHistory = [...historyState]; 11154 const currentIndex = updatedHistory.length - 1; 11155 updatedHistory[currentIndex] = { 11156 ...updatedHistory[currentIndex], 11157 selectedBlockClientId 11158 }; 11159 return [...updatedHistory, { post: post2, previousRenderingMode: previousRenderingMode2 }]; 11160 } 11161 if (type === "pop") { 11162 if (historyState.length > 1) { 11163 return historyState.slice(0, -1); 11164 } 11165 } 11166 return historyState; 11167 }, 11168 [ 11169 { 11170 post: { postId: initialPostId, postType: initialPostType } 11171 } 11172 ] 11173 ); 11174 const { post, previousRenderingMode } = postHistory[postHistory.length - 1]; 11175 const { getRenderingMode } = (0, import_data23.useSelect)(import_editor16.store); 11176 const { setRenderingMode } = (0, import_data23.useDispatch)(import_editor16.store); 11177 const { editEntityRecord } = (0, import_data23.useDispatch)(import_core_data7.store); 11178 const onNavigateToEntityRecord = (0, import_element27.useCallback)( 11179 (params) => { 11180 const entityEdits = registry.select(import_core_data7.store).getEntityRecordEdits("postType", post.postType, post.postId); 11181 const externalClientId = entityEdits?.selection?.selectionStart?.clientId ?? null; 11182 dispatch2({ 11183 type: "push", 11184 post: { postId: params.postId, postType: params.postType }, 11185 // Save the current rendering mode so we can restore it when navigating back. 11186 previousRenderingMode: getRenderingMode(), 11187 selectedBlockClientId: externalClientId 11188 }); 11189 setRenderingMode(defaultRenderingMode); 11190 }, 11191 [ 11192 registry, 11193 post.postType, 11194 post.postId, 11195 getRenderingMode, 11196 setRenderingMode, 11197 defaultRenderingMode 11198 ] 11199 ); 11200 const onNavigateToPreviousEntityRecord = (0, import_element27.useCallback)(() => { 11201 if (postHistory.length > 1) { 11202 const previousItem = postHistory[postHistory.length - 2]; 11203 if (previousItem.selectedBlockClientId) { 11204 editEntityRecord( 11205 "postType", 11206 previousItem.post.postType, 11207 previousItem.post.postId, 11208 { 11209 selection: { 11210 selectionStart: { 11211 clientId: previousItem.selectedBlockClientId 11212 }, 11213 selectionEnd: { 11214 clientId: previousItem.selectedBlockClientId 11215 } 11216 } 11217 }, 11218 { undoIgnore: true } 11219 ); 11220 } 11221 } 11222 dispatch2({ 11223 type: "pop" 11224 }); 11225 if (previousRenderingMode) { 11226 setRenderingMode(previousRenderingMode); 11227 } 11228 }, [ 11229 setRenderingMode, 11230 previousRenderingMode, 11231 postHistory, 11232 editEntityRecord 11233 ]); 11234 return { 11235 currentPost: post, 11236 onNavigateToEntityRecord, 11237 onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : void 0 11238 }; 11239 } 11240 11241 // packages/edit-post/build-module/components/meta-boxes/use-meta-box-initialization.mjs 11242 var import_data24 = __toESM(require_data(), 1); 11243 var import_editor17 = __toESM(require_editor(), 1); 11244 var import_core_data8 = __toESM(require_core_data(), 1); 11245 var import_element28 = __toESM(require_element(), 1); 11246 var useMetaBoxInitialization = (enabled) => { 11247 const { 11248 isEnabledAndEditorReady, 11249 isCollaborationEnabled, 11250 hasIncompatibleMetaBoxes, 11251 hasActiveMetaBoxes 11252 } = (0, import_data24.useSelect)( 11253 (select3) => { 11254 const { 11255 __unstableIsEditorReady, 11256 isCollaborationEnabledForCurrentPost 11257 } = unlock2(select3(import_editor17.store)); 11258 return { 11259 isEnabledAndEditorReady: enabled && __unstableIsEditorReady(), 11260 isCollaborationEnabled: isCollaborationEnabledForCurrentPost(), 11261 hasIncompatibleMetaBoxes: enabled ? select3(store).getAllMetaBoxes().some((metaBox) => !metaBox.__rtc_compatible) : false, 11262 hasActiveMetaBoxes: enabled && select3(store).hasMetaBoxes() 11263 }; 11264 }, 11265 [enabled] 11266 ); 11267 const { setCollaborationSupported } = unlock2((0, import_data24.useDispatch)(import_core_data8.store)); 11268 const { updateEditorSettings } = (0, import_data24.useDispatch)(import_editor17.store); 11269 const { initializeMetaBoxes: initializeMetaBoxes2 } = (0, import_data24.useDispatch)(store); 11270 (0, import_element28.useEffect)(() => { 11271 if (isEnabledAndEditorReady) { 11272 initializeMetaBoxes2(); 11273 if (isCollaborationEnabled && hasIncompatibleMetaBoxes) { 11274 setCollaborationSupported(false); 11275 } 11276 if (hasActiveMetaBoxes) { 11277 updateEditorSettings({ disableVisualRevisions: true }); 11278 } 11279 } 11280 }, [ 11281 isEnabledAndEditorReady, 11282 initializeMetaBoxes2, 11283 isCollaborationEnabled, 11284 setCollaborationSupported, 11285 hasIncompatibleMetaBoxes, 11286 hasActiveMetaBoxes, 11287 updateEditorSettings 11288 ]); 11289 }; 11290 11291 // packages/edit-post/build-module/components/layout/index.mjs 11292 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 11293 var { useCommandContext } = unlock2(import_commands2.privateApis); 11294 var { useDrag } = unlock2(import_components9.privateApis); 11295 var { Editor, FullscreenMode, UploadProgressSnackbar } = unlock2(import_editor18.privateApis); 11296 var { BlockKeyboardShortcuts } = unlock2(import_block_library.privateApis); 11297 var DESIGN_POST_TYPES = [ 11298 "wp_template", 11299 "wp_template_part", 11300 "wp_block", 11301 "wp_navigation" 11302 ]; 11303 function useEditorStyles(settings) { 11304 const { hasThemeStyleSupport } = (0, import_data25.useSelect)((select3) => { 11305 return { 11306 hasThemeStyleSupport: select3(store).isFeatureActive("themeStyles") 11307 }; 11308 }, []); 11309 return (0, import_element29.useMemo)(() => { 11310 const presetStyles = settings.styles?.filter( 11311 (style) => style.__unstableType && style.__unstableType !== "theme" 11312 ) ?? []; 11313 const defaultEditorStyles = [ 11314 ...settings?.defaultEditorStyles ?? [], 11315 ...presetStyles 11316 ]; 11317 const hasThemeStyles = hasThemeStyleSupport && presetStyles.length !== (settings.styles?.length ?? 0); 11318 if (!settings.disableLayoutStyles && !hasThemeStyles) { 11319 defaultEditorStyles.push({ 11320 css: getLayoutStyles({ 11321 style: {}, 11322 selector: "body", 11323 hasBlockGapSupport: false, 11324 hasFallbackGapSupport: true, 11325 fallbackGapValue: "0.5em" 11326 }) 11327 }); 11328 } 11329 return hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles; 11330 }, [ 11331 settings.defaultEditorStyles, 11332 settings.disableLayoutStyles, 11333 settings.styles, 11334 hasThemeStyleSupport 11335 ]); 11336 } 11337 function MetaBoxesMain() { 11338 const [isOpen, openHeight, hasAnyVisible] = (0, import_data25.useSelect)((select3) => { 11339 const { get } = select3(import_preferences10.store); 11340 const { isMetaBoxLocationVisible: isMetaBoxLocationVisible2 } = select3(store); 11341 return [ 11342 !!get("core/edit-post", "metaBoxesMainIsOpen"), 11343 get("core/edit-post", "metaBoxesMainOpenHeight"), 11344 isMetaBoxLocationVisible2("normal") || isMetaBoxLocationVisible2("advanced") || isMetaBoxLocationVisible2("side") 11345 ]; 11346 }, []); 11347 const { set: setPreference } = (0, import_data25.useDispatch)(import_preferences10.store); 11348 const isShort = (0, import_compose2.useMediaQuery)("(max-height: 549px)"); 11349 const [{ min: min2 = 0, max: max2 }, setHeightConstraints] = (0, import_element29.useState)(() => ({})); 11350 const effectSizeConstraints = (0, import_compose2.useRefEffect)((node) => { 11351 const container = node.closest( 11352 ".interface-interface-skeleton__content" 11353 ); 11354 if (!container) { 11355 return; 11356 } 11357 const noticeContainer = container.querySelector(".editor-notices"); 11358 const resizeHandle = container.querySelector( 11359 ".edit-post-meta-boxes-main__presenter" 11360 ); 11361 const deriveConstraints = () => { 11362 const fullHeight = container.offsetHeight; 11363 let nextMax = fullHeight; 11364 if (noticeContainer) { 11365 nextMax -= noticeContainer.offsetHeight; 11366 } 11367 const nextMin = resizeHandle?.offsetHeight ?? 0; 11368 setHeightConstraints({ min: nextMin, max: nextMax }); 11369 }; 11370 const observer = new window.ResizeObserver(deriveConstraints); 11371 observer.observe(container); 11372 if (noticeContainer) { 11373 observer.observe(noticeContainer); 11374 } 11375 return () => observer.disconnect(); 11376 }, []); 11377 const metaBoxesMainRef = (0, import_element29.useRef)(); 11378 const setMainRefs = (0, import_compose2.useMergeRefs)([ 11379 metaBoxesMainRef, 11380 effectSizeConstraints 11381 ]); 11382 const separatorRef = (0, import_element29.useRef)(); 11383 const separatorHelpId = (0, import_element29.useId)(); 11384 const heightRef = (0, import_element29.useRef)(); 11385 const getAriaValueNow = (height) => Math.round((height - min2) / (max2 - min2) * 100); 11386 const persistIsOpen = (to = !isOpen) => setPreference("core/edit-post", "metaBoxesMainIsOpen", to); 11387 const applyHeight = (candidateHeight = "auto", isPersistent) => { 11388 let styleHeight; 11389 if (candidateHeight === "auto") { 11390 isPersistent = false; 11391 styleHeight = candidateHeight; 11392 } else { 11393 candidateHeight = Math.min(max2, Math.max(min2, candidateHeight)); 11394 heightRef.current = candidateHeight; 11395 styleHeight = `$candidateHeight}px`; 11396 } 11397 if (isPersistent) { 11398 setPreference( 11399 "core/edit-post", 11400 "metaBoxesMainOpenHeight", 11401 candidateHeight 11402 ); 11403 } else { 11404 metaBoxesMainRef.current.style.height = styleHeight; 11405 if (!isShort) { 11406 separatorRef.current.ariaValueNow = getAriaValueNow(candidateHeight); 11407 } 11408 } 11409 }; 11410 const bindDragGesture = useDrag( 11411 ({ movement, first, last, memo, tap, args }) => { 11412 const pane = metaBoxesMainRef.current; 11413 const [, yMovement] = movement; 11414 if (first) { 11415 pane.classList.add("is-resizing"); 11416 let fromHeight = heightRef.current ?? pane.offsetHeight; 11417 if (isOpen) { 11418 if (fromHeight > max2) { 11419 fromHeight = max2; 11420 } 11421 } else { 11422 fromHeight = min2; 11423 } 11424 applyHeight(fromHeight - yMovement); 11425 return { fromHeight }; 11426 } 11427 if (!first && !last && !tap) { 11428 applyHeight(memo.fromHeight - yMovement); 11429 return memo; 11430 } 11431 pane.classList.remove("is-resizing"); 11432 if (tap) { 11433 const [onTap] = args; 11434 onTap?.(); 11435 return; 11436 } 11437 const nextIsOpen = heightRef.current > min2; 11438 persistIsOpen(nextIsOpen); 11439 applyHeight(heightRef.current, nextIsOpen); 11440 }, 11441 { keyboardDisplacement: 20, filterTaps: true } 11442 ); 11443 if (!hasAnyVisible) { 11444 return; 11445 } 11446 const contents = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)( 11447 "div", 11448 { 11449 className: "edit-post-layout__metaboxes edit-post-meta-boxes-main__liner", 11450 hidden: !isOpen, 11451 children: [ 11452 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxes, { location: "normal" }), 11453 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxes, { location: "advanced" }) 11454 ] 11455 } 11456 ); 11457 const isAutoHeight = openHeight === void 0; 11458 const usedOpenHeight = isShort ? "auto" : openHeight; 11459 const usedHeight = isOpen ? usedOpenHeight : min2; 11460 const usedAriaValueNow = max2 === void 0 || isAutoHeight ? 50 : getAriaValueNow(usedHeight); 11461 const paneLabel = (0, import_i18n14.__)("Meta Boxes"); 11462 const toggle = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)( 11463 "button", 11464 { 11465 "aria-expanded": isOpen, 11466 onClick: ({ detail }) => { 11467 if (isShort || !detail) { 11468 persistIsOpen(); 11469 } 11470 }, 11471 ...!isShort && bindDragGesture(persistIsOpen), 11472 children: [ 11473 paneLabel, 11474 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components9.Icon, { icon: isOpen ? chevron_up_default : chevron_down_default }) 11475 ] 11476 } 11477 ); 11478 const separator = !isShort && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [ 11479 /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(tooltip_exports.Root, { children: [ 11480 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( 11481 tooltip_exports.Trigger, 11482 { 11483 render: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( 11484 "button", 11485 { 11486 ref: separatorRef, 11487 role: "separator", 11488 "aria-valuenow": usedAriaValueNow, 11489 "aria-label": (0, import_i18n14.__)("Drag to resize"), 11490 "aria-describedby": separatorHelpId, 11491 ...bindDragGesture() 11492 } 11493 ) 11494 } 11495 ), 11496 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(tooltip_exports.Popup, { children: (0, import_i18n14.__)("Drag to resize") }) 11497 ] }), 11498 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(VisuallyHidden, { id: separatorHelpId, children: (0, import_i18n14.__)( 11499 "Use up and down arrow keys to resize the meta box pane." 11500 ) }) 11501 ] }); 11502 return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)( 11503 navigable_region_default, 11504 { 11505 ariaLabel: paneLabel, 11506 ref: setMainRefs, 11507 className: clsx_default( 11508 "edit-post-meta-boxes-main", 11509 !isShort && "is-resizable" 11510 ), 11511 style: { height: usedHeight }, 11512 children: [ 11513 /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "edit-post-meta-boxes-main__presenter", children: [ 11514 toggle, 11515 separator 11516 ] }), 11517 contents 11518 ] 11519 } 11520 ); 11521 } 11522 function Layout({ 11523 postId: initialPostId, 11524 postType: initialPostType, 11525 settings, 11526 initialEdits 11527 }) { 11528 useCommands(); 11529 const { createErrorNotice } = (0, import_data25.useDispatch)(import_notices3.store); 11530 const { 11531 currentPost: { postId: currentPostId, postType: currentPostType }, 11532 onNavigateToEntityRecord, 11533 onNavigateToPreviousEntityRecord 11534 } = useNavigateToEntityRecord( 11535 initialPostId, 11536 initialPostType, 11537 "post-only" 11538 ); 11539 const isEditingTemplate2 = currentPostType === "wp_template"; 11540 const { 11541 mode, 11542 isFullscreenActive, 11543 hasResolvedMode, 11544 hasActiveMetaboxes, 11545 hasBlockSelected, 11546 showIconLabels, 11547 isDistractionFree, 11548 showMetaBoxes, 11549 isWelcomeGuideVisible, 11550 templateId 11551 } = (0, import_data25.useSelect)( 11552 (select3) => { 11553 const { get } = select3(import_preferences10.store); 11554 const { isFeatureActive: isFeatureActive2, hasMetaBoxes: hasMetaBoxes2 } = select3(store); 11555 const { canUser, getPostType, getTemplateId } = unlock2( 11556 select3(import_core_data9.store) 11557 ); 11558 const supportsTemplateMode = settings.supportsTemplateMode; 11559 const isViewable = getPostType(currentPostType)?.viewable ?? false; 11560 const canViewTemplate = canUser("read", { 11561 kind: "postType", 11562 name: "wp_template" 11563 }); 11564 const { getBlockSelectionStart, isZoomOut } = unlock2( 11565 select3(import_block_editor2.store) 11566 ); 11567 const { getEditorMode: getEditorMode2, getDefaultRenderingMode } = unlock2( 11568 select3(import_editor18.store) 11569 ); 11570 const isNotDesignPostType = !DESIGN_POST_TYPES.includes(currentPostType); 11571 const isDirectlyEditingPattern = currentPostType === "wp_block" && !onNavigateToPreviousEntityRecord; 11572 const _templateId = getTemplateId(currentPostType, currentPostId); 11573 const defaultMode = getDefaultRenderingMode(currentPostType); 11574 return { 11575 mode: getEditorMode2(), 11576 isFullscreenActive: isFeatureActive2("fullscreenMode"), 11577 hasActiveMetaboxes: hasMetaBoxes2(), 11578 hasResolvedMode: defaultMode === "template-locked" ? !!_templateId : defaultMode !== void 0, 11579 hasBlockSelected: !!getBlockSelectionStart(), 11580 showIconLabels: get("core", "showIconLabels"), 11581 isDistractionFree: get("core", "distractionFree"), 11582 showMetaBoxes: isNotDesignPostType && !isZoomOut() || isDirectlyEditingPattern, 11583 isWelcomeGuideVisible: isFeatureActive2("welcomeGuide"), 11584 templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate2 ? _templateId : null 11585 }; 11586 }, 11587 [ 11588 currentPostType, 11589 currentPostId, 11590 isEditingTemplate2, 11591 settings.supportsTemplateMode, 11592 onNavigateToPreviousEntityRecord 11593 ] 11594 ); 11595 useMetaBoxInitialization(hasActiveMetaboxes && hasResolvedMode); 11596 const commandContext = hasBlockSelected ? "block-selection-edit" : "entity-edit"; 11597 useCommandContext(commandContext); 11598 const styles = useEditorStyles(settings); 11599 const editorSettings = (0, import_element29.useMemo)( 11600 () => ({ 11601 ...settings, 11602 styles, 11603 onNavigateToEntityRecord, 11604 onNavigateToPreviousEntityRecord 11605 }), 11606 [ 11607 settings, 11608 styles, 11609 onNavigateToEntityRecord, 11610 onNavigateToPreviousEntityRecord 11611 ] 11612 ); 11613 if (showIconLabels) { 11614 document.body.classList.add("show-icon-labels"); 11615 } else { 11616 document.body.classList.remove("show-icon-labels"); 11617 } 11618 const navigateRegionsProps = (0, import_components9.__unstableUseNavigateRegions)(); 11619 const className = clsx_default("edit-post-layout", "is-mode-" + mode, { 11620 "has-metaboxes": hasActiveMetaboxes 11621 }); 11622 function onPluginAreaError(name) { 11623 createErrorNotice( 11624 (0, import_i18n14.sprintf)( 11625 /* translators: %s: plugin name */ 11626 (0, import_i18n14.__)( 11627 'The "%s" plugin has encountered an error and cannot be rendered.' 11628 ), 11629 name 11630 ) 11631 ); 11632 } 11633 const { createSuccessNotice } = (0, import_data25.useDispatch)(import_notices3.store); 11634 const onActionPerformed = (0, import_element29.useCallback)( 11635 (actionId, items) => { 11636 switch (actionId) { 11637 case "move-to-trash": 11638 { 11639 document.location.href = (0, import_url6.addQueryArgs)("edit.php", { 11640 trashed: 1, 11641 post_type: items[0].type, 11642 ids: items[0].id 11643 }); 11644 } 11645 break; 11646 case "duplicate-post": 11647 { 11648 const newItem = items[0]; 11649 const title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered; 11650 createSuccessNotice( 11651 (0, import_i18n14.sprintf)( 11652 // translators: %s: Title of the created post or template, e.g: "Hello world". 11653 (0, import_i18n14.__)('"%s" successfully created.'), 11654 (0, import_html_entities.decodeEntities)(title) || (0, import_i18n14.__)("(no title)") 11655 ), 11656 { 11657 type: "snackbar", 11658 id: "duplicate-post-action", 11659 actions: [ 11660 { 11661 label: (0, import_i18n14.__)("Edit"), 11662 onClick: () => { 11663 const postId = newItem.id; 11664 document.location.href = (0, import_url6.addQueryArgs)("post.php", { 11665 post: postId, 11666 action: "edit" 11667 }); 11668 } 11669 } 11670 ] 11671 } 11672 ); 11673 } 11674 break; 11675 } 11676 }, 11677 [createSuccessNotice] 11678 ); 11679 const initialPost = (0, import_element29.useMemo)(() => { 11680 return { 11681 type: initialPostType, 11682 id: initialPostId 11683 }; 11684 }, [initialPostType, initialPostId]); 11685 const backButton = (0, import_compose2.useViewportMatch)("medium") && isFullscreenActive ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(back_button_default, { initialPost }) : null; 11686 const adminPrimary = (0, import_element29.useMemo)(() => getAdminThemeColors().primary, []); 11687 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components9.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(tooltip_exports.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_theme.ThemeProvider, { isRoot: true, color: { primary: adminPrimary }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_editor18.ErrorBoundary, { canCopyContent: true, children: [ 11688 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WelcomeGuide, { postType: currentPostType }), 11689 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { ...navigateRegionsProps, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)( 11690 Editor, 11691 { 11692 settings: editorSettings, 11693 initialEdits, 11694 postType: currentPostType, 11695 postId: currentPostId, 11696 templateId, 11697 className, 11698 forceIsDirty: hasActiveMetaboxes, 11699 autoFocus: !isWelcomeGuideVisible, 11700 onActionPerformed, 11701 extraSidebarPanels: showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxes, { location: "side" }), 11702 extraContent: !isDistractionFree && showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxesMain, {}), 11703 children: [ 11704 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor18.PostLockedModal, {}), 11705 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(EditorInitialization, {}), 11706 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( 11707 FullscreenMode, 11708 { 11709 isActive: isFullscreenActive 11710 } 11711 ), 11712 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BrowserURL, {}), 11713 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor18.UnsavedChangesWarning, {}), 11714 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor18.AutosaveMonitor, {}), 11715 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor18.LocalAutosaveMonitor, {}), 11716 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(keyboard_shortcuts_default, {}), 11717 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor18.EditorKeyboardShortcutsRegister, {}), 11718 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BlockKeyboardShortcuts, {}), 11719 currentPostType === "wp_block" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(InitPatternModal, {}), 11720 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_plugins.PluginArea, { onError: onPluginAreaError }), 11721 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(more_menu_default, {}), 11722 backButton, 11723 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_notices3.SnackbarNotices, { className: "edit-post-layout__snackbar" }), 11724 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UploadProgressSnackbar, {}) 11725 ] 11726 } 11727 ) }) 11728 ] }) }) }) }); 11729 } 11730 var layout_default = Layout; 11731 11732 // packages/edit-post/build-module/deprecated.mjs 11733 var import_editor19 = __toESM(require_editor(), 1); 11734 var import_url7 = __toESM(require_url(), 1); 11735 var import_deprecated3 = __toESM(require_deprecated(), 1); 11736 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 11737 var { PluginPostExcerpt } = unlock2(import_editor19.privateApis); 11738 var isSiteEditor = (0, import_url7.getPath)(window.location.href)?.includes( 11739 "site-editor.php" 11740 ); 11741 var deprecateSlot = (name) => { 11742 (0, import_deprecated3.default)(`wp.editPost.$name}`, { 11743 since: "6.6", 11744 alternative: `wp.editor.$name}` 11745 }); 11746 }; 11747 function PluginBlockSettingsMenuItem(props) { 11748 if (isSiteEditor) { 11749 return null; 11750 } 11751 deprecateSlot("PluginBlockSettingsMenuItem"); 11752 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor19.PluginBlockSettingsMenuItem, { ...props }); 11753 } 11754 function PluginDocumentSettingPanel(props) { 11755 if (isSiteEditor) { 11756 return null; 11757 } 11758 deprecateSlot("PluginDocumentSettingPanel"); 11759 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor19.PluginDocumentSettingPanel, { ...props }); 11760 } 11761 function PluginMoreMenuItem(props) { 11762 if (isSiteEditor) { 11763 return null; 11764 } 11765 deprecateSlot("PluginMoreMenuItem"); 11766 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor19.PluginMoreMenuItem, { ...props }); 11767 } 11768 function PluginPrePublishPanel(props) { 11769 if (isSiteEditor) { 11770 return null; 11771 } 11772 deprecateSlot("PluginPrePublishPanel"); 11773 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor19.PluginPrePublishPanel, { ...props }); 11774 } 11775 function PluginPostPublishPanel(props) { 11776 if (isSiteEditor) { 11777 return null; 11778 } 11779 deprecateSlot("PluginPostPublishPanel"); 11780 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor19.PluginPostPublishPanel, { ...props }); 11781 } 11782 function PluginPostStatusInfo(props) { 11783 if (isSiteEditor) { 11784 return null; 11785 } 11786 deprecateSlot("PluginPostStatusInfo"); 11787 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor19.PluginPostStatusInfo, { ...props }); 11788 } 11789 function PluginSidebar(props) { 11790 if (isSiteEditor) { 11791 return null; 11792 } 11793 deprecateSlot("PluginSidebar"); 11794 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor19.PluginSidebar, { ...props }); 11795 } 11796 function PluginSidebarMoreMenuItem(props) { 11797 if (isSiteEditor) { 11798 return null; 11799 } 11800 deprecateSlot("PluginSidebarMoreMenuItem"); 11801 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor19.PluginSidebarMoreMenuItem, { ...props }); 11802 } 11803 function __experimentalPluginPostExcerpt() { 11804 if (isSiteEditor) { 11805 return null; 11806 } 11807 (0, import_deprecated3.default)("wp.editPost.__experimentalPluginPostExcerpt", { 11808 since: "6.6", 11809 hint: "Core and custom panels can be access programmatically using their panel name.", 11810 link: "https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically" 11811 }); 11812 return PluginPostExcerpt; 11813 } 11814 11815 // packages/edit-post/build-module/index.mjs 11816 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 11817 var { 11818 BackButton: __experimentalMainDashboardButton, 11819 registerCoreBlockBindingsSources 11820 } = unlock2(import_editor20.privateApis); 11821 var { enablePreloadMultiUse, clearPreloadedData } = unlock2( 11822 import_api_fetch2.default.privateApis 11823 ); 11824 function initializeEditor(id, postType, postId, settings, initialEdits) { 11825 const isMediumOrBigger = window.matchMedia("(min-width: 782px)").matches; 11826 const target = document.getElementById(id); 11827 const root = (0, import_element30.createRoot)(target); 11828 (0, import_data26.dispatch)(import_preferences11.store).setDefaults("core/edit-post", { 11829 fullscreenMode: true, 11830 themeStyles: true, 11831 welcomeGuide: true, 11832 welcomeGuideTemplate: true 11833 }); 11834 (0, import_data26.dispatch)(import_preferences11.store).setDefaults("core", { 11835 allowRightClickOverrides: true, 11836 editorMode: "visual", 11837 editorTool: "edit", 11838 fixedToolbar: false, 11839 hiddenBlockTypes: [], 11840 inactivePanels: [], 11841 openPanels: ["post-status"], 11842 showBlockBreadcrumbs: true, 11843 showIconLabels: false, 11844 showListViewByDefault: false, 11845 enableChoosePatternModal: true, 11846 isPublishSidebarEnabled: true, 11847 showCollaborationCursor: false, 11848 showCollaborationJoinNotifications: true, 11849 showCollaborationLeaveNotifications: true, 11850 showCollaborationPostSaveNotifications: true 11851 }); 11852 if (window.__clientSideMediaProcessing) { 11853 (0, import_data26.dispatch)(import_preferences11.store).setDefaults("core/media", { 11854 requireApproval: true, 11855 optimizeOnUpload: true 11856 }); 11857 } 11858 (0, import_data26.dispatch)(import_blocks2.store).reapplyBlockTypeFilters(); 11859 if (isMediumOrBigger && (0, import_data26.select)(import_preferences11.store).get("core", "showListViewByDefault") && !(0, import_data26.select)(import_preferences11.store).get("core", "distractionFree")) { 11860 (0, import_data26.dispatch)(import_editor20.store).setIsListViewOpened(true); 11861 } 11862 (0, import_block_library2.registerCoreBlocks)(); 11863 registerCoreBlockBindingsSources(); 11864 (0, import_widgets.registerLegacyWidgetBlock)({ inserter: false }); 11865 (0, import_widgets.registerWidgetGroupBlock)({ inserter: false }); 11866 if (false) { 11867 (0, import_block_library2.__experimentalRegisterExperimentalCoreBlocks)({ 11868 enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks 11869 }); 11870 } 11871 const documentMode = document.compatMode === "CSS1Compat" ? "Standards" : "Quirks"; 11872 if (documentMode !== "Standards") { 11873 console.warn( 11874 "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." 11875 ); 11876 } 11877 window.addEventListener("dragover", (e) => e.preventDefault(), false); 11878 window.addEventListener("drop", (e) => e.preventDefault(), false); 11879 enablePreloadMultiUse(); 11880 const preloadedResolutions = preloadResolutions(postType, postId); 11881 preloadedResolutions.finally(() => { 11882 clearPreloadedData(); 11883 if (postType && postId) { 11884 const post = (0, import_data26.select)(import_core_data10.store).getEntityRecord( 11885 "postType", 11886 postType, 11887 postId 11888 ); 11889 if (post) { 11890 (0, import_data26.dispatch)(import_editor20.store).setupEditor( 11891 post, 11892 initialEdits, 11893 settings.template 11894 ); 11895 } 11896 } 11897 root.render( 11898 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_element30.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( 11899 layout_default, 11900 { 11901 settings, 11902 postId, 11903 postType, 11904 initialEdits 11905 } 11906 ) }) 11907 ); 11908 }); 11909 return root; 11910 } 11911 async function preloadResolutions(postType, postId) { 11912 const core = (0, import_data26.resolveSelect)(import_core_data10.store); 11913 const coreSelect = (0, import_data26.select)(import_core_data10.store); 11914 try { 11915 await Promise.all([ 11916 core.getCurrentUser(), 11917 core.getEntitiesConfig("postType"), 11918 core.getEntitiesConfig("taxonomy"), 11919 core.getEntitiesConfig("root"), 11920 core.getEntityRecords("root", "taxonomy"), 11921 core.getCurrentTheme(), 11922 // Forward-resolver alias of `getCurrentTheme` with its own 11923 // resolution metadata, so it needs a separate kick. 11924 core.getThemeSupports(), 11925 core.getBlockPatternCategories(), 11926 core.__experimentalGetCurrentGlobalStylesId(), 11927 core.__experimentalGetCurrentThemeBaseGlobalStyles(), 11928 core.__experimentalGetCurrentThemeGlobalStylesVariations(), 11929 core.getEntityRecord("root", "__unstableBase"), 11930 core.getEntityRecord("root", "site"), 11931 core.canUser("read", { kind: "root", name: "site" }), 11932 core.canUser("create", { kind: "postType", name: "attachment" }), 11933 core.canUser("create", { kind: "postType", name: "page" }), 11934 core.canUser("create", { kind: "postType", name: "wp_block" }), 11935 core.canUser("create", { 11936 kind: "postType", 11937 name: "wp_template" 11938 }), 11939 // The DataForm-based inspector requests the entity form config 11940 // when the document sidebar mounts. The args must match the 11941 // `useViewConfig` call in `@wordpress/views` exactly for the 11942 // resolution (and its preload entry) to be shared. 11943 ...postType && window?.__experimentalDataFormInspector ? [ 11944 unlock2(core).getViewConfig("postType", postType, { 11945 fields: "form" 11946 }) 11947 ] : [], 11948 // Per-post resolvers. `getPostType` and `getEditedEntityRecord` 11949 // are shorthand/forward-resolver aliases with their own 11950 // resolution metadata, so they need separate kicks. 11951 ...postType && postId ? [ 11952 core.getPostType(postType), 11953 core.getEntityRecord("postType", postType, postId), 11954 core.getEditedEntityRecord( 11955 "postType", 11956 postType, 11957 postId 11958 ), 11959 core.getAutosaves(postType, postId), 11960 core.getDefaultTemplateId({ slug: "front-page" }), 11961 core.canUser("create", { 11962 kind: "postType", 11963 name: postType 11964 }) 11965 ] : [] 11966 ]); 11967 const tasks = []; 11968 const globalStylesId = coreSelect.__experimentalGetCurrentGlobalStylesId(); 11969 if (globalStylesId) { 11970 tasks.push( 11971 core.getEntityRecord("root", "globalStyles", globalStylesId), 11972 core.canUser("read", { 11973 kind: "root", 11974 name: "globalStyles", 11975 id: globalStylesId 11976 }) 11977 ); 11978 } 11979 if (postType && postId) { 11980 const post = coreSelect.getEntityRecord( 11981 "postType", 11982 postType, 11983 postId 11984 ); 11985 if (post) { 11986 let slug = "page" === postType ? "page" : "single-" + postType; 11987 if (post.slug) { 11988 slug += "-" + post.slug; 11989 } 11990 tasks.push(core.getDefaultTemplateId({ slug })); 11991 if (post.author) { 11992 tasks.push( 11993 core.getUser(post.author, { 11994 context: "view", 11995 _fields: "id,name" 11996 }) 11997 ); 11998 } 11999 } 12000 } 12001 if (tasks.length) { 12002 await Promise.all(tasks); 12003 } 12004 } catch { 12005 } 12006 } 12007 function reinitializeEditor() { 12008 (0, import_deprecated4.default)("wp.editPost.reinitializeEditor", { 12009 since: "6.2", 12010 version: "6.3" 12011 }); 12012 } 12013 return __toCommonJS(index_exports); 12014 })(); 12015 /*! Bundled license information: 12016 12017 use-sync-external-store/cjs/use-sync-external-store-shim.development.js: 12018 (** 12019 * @license React 12020 * use-sync-external-store-shim.development.js 12021 * 12022 * Copyright (c) Meta Platforms, Inc. and affiliates. 12023 * 12024 * This source code is licensed under the MIT license found in the 12025 * LICENSE file in the root directory of this source tree. 12026 *) 12027 12028 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: 12029 (** 12030 * @license React 12031 * use-sync-external-store-shim/with-selector.development.js 12032 * 12033 * Copyright (c) Meta Platforms, Inc. and affiliates. 12034 * 12035 * This source code is licensed under the MIT license found in the 12036 * LICENSE file in the root directory of this source tree. 12037 *) 12038 */ 12039 (window.wp ||= {}).editPost = wp.editPost; 12040 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sun Aug 23 08:20:23 2026 | Cross-referenced by PHPXref |