| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 var __create = Object.create; 2 var __defProp = Object.defineProperty; 3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 4 var __getOwnPropNames = Object.getOwnPropertyNames; 5 var __getProtoOf = Object.getPrototypeOf; 6 var __hasOwnProp = Object.prototype.hasOwnProperty; 7 var __commonJS = (cb, mod) => function __require() { 8 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 9 }; 10 var __export = (target, all) => { 11 for (var name in all) 12 __defProp(target, name, { get: all[name], enumerable: true }); 13 }; 14 var __copyProps = (to, from, except, desc) => { 15 if (from && typeof from === "object" || typeof from === "function") { 16 for (let key of __getOwnPropNames(from)) 17 if (!__hasOwnProp.call(to, key) && key !== except) 18 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 19 } 20 return to; 21 }; 22 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 23 // If the importer is in node compatibility mode or this is not an ESM 24 // file that has been converted to a CommonJS file using a Babel- 25 // compatible transform (i.e. "__esModule" has not been set), then set 26 // "default" to the CommonJS "module.exports" for node compatibility. 27 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 28 mod 29 )); 30 31 // package-external:@wordpress/element 32 var require_element = __commonJS({ 33 "package-external:@wordpress/element"(exports, module) { 34 module.exports = window.wp.element; 35 } 36 }); 37 38 // package-external:@wordpress/data 39 var require_data = __commonJS({ 40 "package-external:@wordpress/data"(exports, module) { 41 module.exports = window.wp.data; 42 } 43 }); 44 45 // package-external:@wordpress/i18n 46 var require_i18n = __commonJS({ 47 "package-external:@wordpress/i18n"(exports, module) { 48 module.exports = window.wp.i18n; 49 } 50 }); 51 52 // vendor-external:react 53 var require_react = __commonJS({ 54 "vendor-external:react"(exports, module) { 55 module.exports = window.React; 56 } 57 }); 58 59 // vendor-external:react/jsx-runtime 60 var require_jsx_runtime = __commonJS({ 61 "vendor-external:react/jsx-runtime"(exports, module) { 62 module.exports = window.ReactJSXRuntime; 63 } 64 }); 65 66 // vendor-external:react-dom 67 var require_react_dom = __commonJS({ 68 "vendor-external:react-dom"(exports, module) { 69 module.exports = window.ReactDOM; 70 } 71 }); 72 73 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js 74 var require_use_sync_external_store_shim_development = __commonJS({ 75 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { 76 "use strict"; 77 (function() { 78 function is(x, y) { 79 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 80 } 81 function useSyncExternalStore$2(subscribe, getSnapshot) { 82 didWarnOld18Alpha || void 0 === React47.startTransition || (didWarnOld18Alpha = true, console.error( 83 "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." 84 )); 85 var value = getSnapshot(); 86 if (!didWarnUncachedGetSnapshot) { 87 var cachedValue = getSnapshot(); 88 objectIs(value, cachedValue) || (console.error( 89 "The result of getSnapshot should be cached to avoid an infinite loop" 90 ), didWarnUncachedGetSnapshot = true); 91 } 92 cachedValue = useState19({ 93 inst: { value, getSnapshot } 94 }); 95 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 96 useLayoutEffect3( 97 function() { 98 inst.value = value; 99 inst.getSnapshot = getSnapshot; 100 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 101 }, 102 [subscribe, value, getSnapshot] 103 ); 104 useEffect18( 105 function() { 106 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 107 return subscribe(function() { 108 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 109 }); 110 }, 111 [subscribe] 112 ); 113 useDebugValue2(value); 114 return value; 115 } 116 function checkIfSnapshotChanged(inst) { 117 var latestGetSnapshot = inst.getSnapshot; 118 inst = inst.value; 119 try { 120 var nextValue = latestGetSnapshot(); 121 return !objectIs(inst, nextValue); 122 } catch (error) { 123 return true; 124 } 125 } 126 function useSyncExternalStore$1(subscribe, getSnapshot) { 127 return getSnapshot(); 128 } 129 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 130 var React47 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState19 = 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; 131 exports.useSyncExternalStore = void 0 !== React47.useSyncExternalStore ? React47.useSyncExternalStore : shim; 132 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 133 })(); 134 } 135 }); 136 137 // node_modules/use-sync-external-store/shim/index.js 138 var require_shim = __commonJS({ 139 "node_modules/use-sync-external-store/shim/index.js"(exports, module) { 140 "use strict"; 141 if (false) { 142 module.exports = null; 143 } else { 144 module.exports = require_use_sync_external_store_shim_development(); 145 } 146 } 147 }); 148 149 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js 150 var require_with_selector_development = __commonJS({ 151 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { 152 "use strict"; 153 (function() { 154 function is(x, y) { 155 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 156 } 157 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 158 var React47 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef22 = React47.useRef, useEffect18 = React47.useEffect, useMemo19 = React47.useMemo, useDebugValue2 = React47.useDebugValue; 159 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { 160 var instRef = useRef22(null); 161 if (null === instRef.current) { 162 var inst = { hasValue: false, value: null }; 163 instRef.current = inst; 164 } else inst = instRef.current; 165 instRef = useMemo19( 166 function() { 167 function memoizedSelector(nextSnapshot) { 168 if (!hasMemo) { 169 hasMemo = true; 170 memoizedSnapshot = nextSnapshot; 171 nextSnapshot = selector(nextSnapshot); 172 if (void 0 !== isEqual && inst.hasValue) { 173 var currentSelection = inst.value; 174 if (isEqual(currentSelection, nextSnapshot)) 175 return memoizedSelection = currentSelection; 176 } 177 return memoizedSelection = nextSnapshot; 178 } 179 currentSelection = memoizedSelection; 180 if (objectIs(memoizedSnapshot, nextSnapshot)) 181 return currentSelection; 182 var nextSelection = selector(nextSnapshot); 183 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) 184 return memoizedSnapshot = nextSnapshot, currentSelection; 185 memoizedSnapshot = nextSnapshot; 186 return memoizedSelection = nextSelection; 187 } 188 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; 189 return [ 190 function() { 191 return memoizedSelector(getSnapshot()); 192 }, 193 null === maybeGetServerSnapshot ? void 0 : function() { 194 return memoizedSelector(maybeGetServerSnapshot()); 195 } 196 ]; 197 }, 198 [getSnapshot, getServerSnapshot, selector, isEqual] 199 ); 200 var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]); 201 useEffect18( 202 function() { 203 inst.hasValue = true; 204 inst.value = value; 205 }, 206 [value] 207 ); 208 useDebugValue2(value); 209 return value; 210 }; 211 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 212 })(); 213 } 214 }); 215 216 // node_modules/use-sync-external-store/shim/with-selector.js 217 var require_with_selector = __commonJS({ 218 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { 219 "use strict"; 220 if (false) { 221 module.exports = null; 222 } else { 223 module.exports = require_with_selector_development(); 224 } 225 } 226 }); 227 228 // package-external:@wordpress/primitives 229 var require_primitives = __commonJS({ 230 "package-external:@wordpress/primitives"(exports, module) { 231 module.exports = window.wp.primitives; 232 } 233 }); 234 235 // package-external:@wordpress/compose 236 var require_compose = __commonJS({ 237 "package-external:@wordpress/compose"(exports, module) { 238 module.exports = window.wp.compose; 239 } 240 }); 241 242 // package-external:@wordpress/theme 243 var require_theme = __commonJS({ 244 "package-external:@wordpress/theme"(exports, module) { 245 module.exports = window.wp.theme; 246 } 247 }); 248 249 // package-external:@wordpress/private-apis 250 var require_private_apis = __commonJS({ 251 "package-external:@wordpress/private-apis"(exports, module) { 252 module.exports = window.wp.privateApis; 253 } 254 }); 255 256 // package-external:@wordpress/components 257 var require_components = __commonJS({ 258 "package-external:@wordpress/components"(exports, module) { 259 module.exports = window.wp.components; 260 } 261 }); 262 263 // package-external:@wordpress/core-data 264 var require_core_data = __commonJS({ 265 "package-external:@wordpress/core-data"(exports, module) { 266 module.exports = window.wp.coreData; 267 } 268 }); 269 270 // package-external:@wordpress/notices 271 var require_notices = __commonJS({ 272 "package-external:@wordpress/notices"(exports, module) { 273 module.exports = window.wp.notices; 274 } 275 }); 276 277 // package-external:@wordpress/keycodes 278 var require_keycodes = __commonJS({ 279 "package-external:@wordpress/keycodes"(exports, module) { 280 module.exports = window.wp.keycodes; 281 } 282 }); 283 284 // package-external:@wordpress/editor 285 var require_editor = __commonJS({ 286 "package-external:@wordpress/editor"(exports, module) { 287 module.exports = window.wp.editor; 288 } 289 }); 290 291 // package-external:@wordpress/keyboard-shortcuts 292 var require_keyboard_shortcuts = __commonJS({ 293 "package-external:@wordpress/keyboard-shortcuts"(exports, module) { 294 module.exports = window.wp.keyboardShortcuts; 295 } 296 }); 297 298 // package-external:@wordpress/html-entities 299 var require_html_entities = __commonJS({ 300 "package-external:@wordpress/html-entities"(exports, module) { 301 module.exports = window.wp.htmlEntities; 302 } 303 }); 304 305 // packages/boot/build-module/components/app/index.mjs 306 var import_element32 = __toESM(require_element(), 1); 307 var import_data10 = __toESM(require_data(), 1); 308 309 // packages/boot/build-module/components/app/router.mjs 310 var import_i18n10 = __toESM(require_i18n(), 1); 311 var import_element30 = __toESM(require_element(), 1); 312 313 // node_modules/clsx/dist/clsx.mjs 314 function r(e) { 315 var t, f, n = ""; 316 if ("string" == typeof e || "number" == typeof e) n += e; 317 else if ("object" == typeof e) if (Array.isArray(e)) { 318 var o = e.length; 319 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 320 } else for (f in e) e[f] && (n && (n += " "), n += f); 321 return n; 322 } 323 function clsx() { 324 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 325 return n; 326 } 327 var clsx_default = clsx; 328 329 // node_modules/@base-ui/utils/safeReact.mjs 330 var React = __toESM(require_react(), 1); 331 var SafeReact = { 332 ...React 333 }; 334 335 // node_modules/@base-ui/utils/useRefWithInit.mjs 336 var React2 = __toESM(require_react(), 1); 337 var UNINITIALIZED = {}; 338 function useRefWithInit(init2, initArg) { 339 const ref = React2.useRef(UNINITIALIZED); 340 if (ref.current === UNINITIALIZED) { 341 ref.current = init2(initArg); 342 } 343 return ref; 344 } 345 346 // node_modules/@base-ui/utils/useStableCallback.mjs 347 var useInsertionEffect = SafeReact.useInsertionEffect; 348 var useSafeInsertionEffect = ( 349 // React 17 doesn't have useInsertionEffect. 350 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 351 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() 352 ); 353 function useStableCallback(callback) { 354 const stable = useRefWithInit(createStableCallback).current; 355 stable.next = callback; 356 useSafeInsertionEffect(stable.effect); 357 return stable.trampoline; 358 } 359 function createStableCallback() { 360 const stable = { 361 next: void 0, 362 callback: assertNotCalled, 363 trampoline: (...args) => stable.callback?.(...args), 364 effect: () => { 365 stable.callback = stable.next; 366 } 367 }; 368 return stable; 369 } 370 function assertNotCalled() { 371 if (true) { 372 throw ( 373 /* minify-error-disabled */ 374 new Error("Base UI: Cannot call an event handler while rendering.") 375 ); 376 } 377 } 378 379 // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs 380 var React3 = __toESM(require_react(), 1); 381 var noop = () => { 382 }; 383 var useIsoLayoutEffect = typeof document !== "undefined" ? React3.useLayoutEffect : noop; 384 385 // node_modules/@base-ui/utils/warn.mjs 386 var set; 387 if (true) { 388 set = /* @__PURE__ */ new Set(); 389 } 390 function warn(...messages) { 391 if (true) { 392 const messageKey = messages.join(" "); 393 if (!set.has(messageKey)) { 394 set.add(messageKey); 395 console.warn(`Base UI: $messageKey}`); 396 } 397 } 398 } 399 400 // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs 401 var React4 = __toESM(require_react(), 1); 402 var DirectionContext = /* @__PURE__ */ React4.createContext(void 0); 403 if (true) DirectionContext.displayName = "DirectionContext"; 404 function useDirection() { 405 const context = React4.useContext(DirectionContext); 406 return context?.direction ?? "ltr"; 407 } 408 409 // node_modules/@base-ui/react/internals/useRenderElement.mjs 410 var React7 = __toESM(require_react(), 1); 411 412 // node_modules/@base-ui/utils/useMergedRefs.mjs 413 function useMergedRefs(a, b, c, d) { 414 const forkRef = useRefWithInit(createForkRef).current; 415 if (didChange(forkRef, a, b, c, d)) { 416 update(forkRef, [a, b, c, d]); 417 } 418 return forkRef.callback; 419 } 420 function useMergedRefsN(refs) { 421 const forkRef = useRefWithInit(createForkRef).current; 422 if (didChangeN(forkRef, refs)) { 423 update(forkRef, refs); 424 } 425 return forkRef.callback; 426 } 427 function createForkRef() { 428 return { 429 callback: null, 430 cleanup: null, 431 refs: [] 432 }; 433 } 434 function didChange(forkRef, a, b, c, d) { 435 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; 436 } 437 function didChangeN(forkRef, newRefs) { 438 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 439 } 440 function update(forkRef, refs) { 441 forkRef.refs = refs; 442 if (refs.every((ref) => ref == null)) { 443 forkRef.callback = null; 444 return; 445 } 446 forkRef.callback = (instance) => { 447 if (forkRef.cleanup) { 448 forkRef.cleanup(); 449 forkRef.cleanup = null; 450 } 451 if (instance != null) { 452 const cleanupCallbacks = Array(refs.length).fill(null); 453 for (let i = 0; i < refs.length; i += 1) { 454 const ref = refs[i]; 455 if (ref == null) { 456 continue; 457 } 458 switch (typeof ref) { 459 case "function": { 460 const refCleanup = ref(instance); 461 if (typeof refCleanup === "function") { 462 cleanupCallbacks[i] = refCleanup; 463 } 464 break; 465 } 466 case "object": { 467 ref.current = instance; 468 break; 469 } 470 default: 471 } 472 } 473 forkRef.cleanup = () => { 474 for (let i = 0; i < refs.length; i += 1) { 475 const ref = refs[i]; 476 if (ref == null) { 477 continue; 478 } 479 switch (typeof ref) { 480 case "function": { 481 const cleanupCallback = cleanupCallbacks[i]; 482 if (typeof cleanupCallback === "function") { 483 cleanupCallback(); 484 } else { 485 ref(null); 486 } 487 break; 488 } 489 case "object": { 490 ref.current = null; 491 break; 492 } 493 default: 494 } 495 } 496 }; 497 } 498 }; 499 } 500 501 // node_modules/@base-ui/utils/getReactElementRef.mjs 502 var React6 = __toESM(require_react(), 1); 503 504 // node_modules/@base-ui/utils/reactVersion.mjs 505 var React5 = __toESM(require_react(), 1); 506 var majorVersion = parseInt(React5.version, 10); 507 function isReactVersionAtLeast(reactVersionToCheck) { 508 return majorVersion >= reactVersionToCheck; 509 } 510 511 // node_modules/@base-ui/utils/getReactElementRef.mjs 512 function getReactElementRef(element) { 513 if (!/* @__PURE__ */ React6.isValidElement(element)) { 514 return null; 515 } 516 const reactElement = element; 517 const propsWithRef = reactElement.props; 518 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 519 } 520 521 // node_modules/@base-ui/utils/mergeObjects.mjs 522 function mergeObjects(a, b) { 523 if (a && !b) { 524 return a; 525 } 526 if (!a && b) { 527 return b; 528 } 529 if (a || b) { 530 return { 531 ...a, 532 ...b 533 }; 534 } 535 return void 0; 536 } 537 538 // node_modules/@base-ui/utils/empty.mjs 539 function NOOP() { 540 } 541 var EMPTY_ARRAY = Object.freeze([]); 542 var EMPTY_OBJECT = Object.freeze({}); 543 544 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 545 function getStateAttributesProps(state, customMapping) { 546 const props = {}; 547 for (const key in state) { 548 const value = state[key]; 549 if (customMapping?.hasOwnProperty(key)) { 550 const customProps = customMapping[key](value); 551 if (customProps != null) { 552 Object.assign(props, customProps); 553 } 554 continue; 555 } 556 if (value === true) { 557 props[`data-$key.toLowerCase()}`] = ""; 558 } else if (value) { 559 props[`data-$key.toLowerCase()}`] = value.toString(); 560 } 561 } 562 return props; 563 } 564 565 // node_modules/@base-ui/react/utils/resolveClassName.mjs 566 function resolveClassName(className, state) { 567 return typeof className === "function" ? className(state) : className; 568 } 569 570 // node_modules/@base-ui/react/utils/resolveStyle.mjs 571 function resolveStyle(style, state) { 572 return typeof style === "function" ? style(state) : style; 573 } 574 575 // node_modules/@base-ui/react/merge-props/mergeProps.mjs 576 var EMPTY_PROPS = {}; 577 function mergeProps(a, b, c, d, e) { 578 if (!c && !d && !e && !a) { 579 return createInitialMergedProps(b); 580 } 581 let merged = createInitialMergedProps(a); 582 if (b) { 583 merged = mergeInto(merged, b); 584 } 585 if (c) { 586 merged = mergeInto(merged, c); 587 } 588 if (d) { 589 merged = mergeInto(merged, d); 590 } 591 if (e) { 592 merged = mergeInto(merged, e); 593 } 594 return merged; 595 } 596 function mergePropsN(props) { 597 if (props.length === 0) { 598 return EMPTY_PROPS; 599 } 600 if (props.length === 1) { 601 return createInitialMergedProps(props[0]); 602 } 603 let merged = createInitialMergedProps(props[0]); 604 for (let i = 1; i < props.length; i += 1) { 605 merged = mergeInto(merged, props[i]); 606 } 607 return merged; 608 } 609 function createInitialMergedProps(inputProps) { 610 if (isPropsGetter(inputProps)) { 611 return { 612 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 613 }; 614 } 615 return copyInitialProps(inputProps); 616 } 617 function mergeInto(merged, inputProps) { 618 if (isPropsGetter(inputProps)) { 619 return resolvePropsGetter(inputProps, merged); 620 } 621 return mutablyMergeInto(merged, inputProps); 622 } 623 function copyInitialProps(inputProps) { 624 const copiedProps = { 625 ...inputProps 626 }; 627 for (const propName in copiedProps) { 628 const propValue = copiedProps[propName]; 629 if (isEventHandler(propName, propValue)) { 630 copiedProps[propName] = wrapEventHandler(propValue); 631 } 632 } 633 return copiedProps; 634 } 635 function mutablyMergeInto(mergedProps, externalProps) { 636 if (!externalProps) { 637 return mergedProps; 638 } 639 for (const propName in externalProps) { 640 const externalPropValue = externalProps[propName]; 641 switch (propName) { 642 case "style": { 643 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 644 break; 645 } 646 case "className": { 647 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 648 break; 649 } 650 default: { 651 if (isEventHandler(propName, externalPropValue)) { 652 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 653 } else { 654 mergedProps[propName] = externalPropValue; 655 } 656 } 657 } 658 } 659 return mergedProps; 660 } 661 function isEventHandler(key, value) { 662 const code0 = key.charCodeAt(0); 663 const code1 = key.charCodeAt(1); 664 const code2 = key.charCodeAt(2); 665 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 666 } 667 function isPropsGetter(inputProps) { 668 return typeof inputProps === "function"; 669 } 670 function resolvePropsGetter(inputProps, previousProps) { 671 if (isPropsGetter(inputProps)) { 672 return inputProps(previousProps); 673 } 674 return inputProps ?? EMPTY_PROPS; 675 } 676 function mergeEventHandlers(ourHandler, theirHandler) { 677 if (!theirHandler) { 678 return ourHandler; 679 } 680 if (!ourHandler) { 681 return wrapEventHandler(theirHandler); 682 } 683 return (...args) => { 684 const event = args[0]; 685 if (isSyntheticEvent(event)) { 686 const baseUIEvent = event; 687 makeEventPreventable(baseUIEvent); 688 const result2 = theirHandler(...args); 689 if (!baseUIEvent.baseUIHandlerPrevented) { 690 ourHandler?.(...args); 691 } 692 return result2; 693 } 694 const result = theirHandler(...args); 695 ourHandler?.(...args); 696 return result; 697 }; 698 } 699 function wrapEventHandler(handler) { 700 if (!handler) { 701 return handler; 702 } 703 return (...args) => { 704 const event = args[0]; 705 if (isSyntheticEvent(event)) { 706 makeEventPreventable(event); 707 } 708 return handler(...args); 709 }; 710 } 711 function makeEventPreventable(event) { 712 event.preventBaseUIHandler = () => { 713 event.baseUIHandlerPrevented = true; 714 }; 715 return event; 716 } 717 function mergeClassNames(ourClassName, theirClassName) { 718 if (theirClassName) { 719 if (ourClassName) { 720 return theirClassName + " " + ourClassName; 721 } 722 return theirClassName; 723 } 724 return ourClassName; 725 } 726 function isSyntheticEvent(event) { 727 return event != null && typeof event === "object" && "nativeEvent" in event; 728 } 729 730 // node_modules/@base-ui/react/internals/useRenderElement.mjs 731 var import_react = __toESM(require_react(), 1); 732 function useRenderElement(element, componentProps, params = {}) { 733 const renderProp = componentProps.render; 734 const outProps = useRenderElementProps(componentProps, params); 735 if (params.enabled === false) { 736 return null; 737 } 738 const state = params.state ?? EMPTY_OBJECT; 739 return evaluateRenderProp(element, renderProp, outProps, state); 740 } 741 function useRenderElementProps(componentProps, params = {}) { 742 const { 743 className: classNameProp, 744 style: styleProp, 745 render: renderProp 746 } = componentProps; 747 const { 748 state = EMPTY_OBJECT, 749 ref, 750 props, 751 stateAttributesMapping: stateAttributesMapping3, 752 enabled = true 753 } = params; 754 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 755 const style = enabled ? resolveStyle(styleProp, state) : void 0; 756 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT; 757 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 758 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 759 if (typeof document !== "undefined") { 760 if (!enabled) { 761 useMergedRefs(null, null); 762 } else if (Array.isArray(ref)) { 763 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 764 } else { 765 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 766 } 767 } 768 if (!enabled) { 769 return EMPTY_OBJECT; 770 } 771 if (className !== void 0) { 772 outProps.className = mergeClassNames(outProps.className, className); 773 } 774 if (style !== void 0) { 775 outProps.style = mergeObjects(outProps.style, style); 776 } 777 return outProps; 778 } 779 function resolveRenderFunctionProps(props) { 780 if (Array.isArray(props)) { 781 return mergePropsN(props); 782 } 783 return mergeProps(void 0, props); 784 } 785 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 786 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 787 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 788 function evaluateRenderProp(element, render, props, state) { 789 if (render) { 790 if (typeof render === "function") { 791 if (true) { 792 warnIfRenderPropLooksLikeComponent(render); 793 } 794 return render(props, state); 795 } 796 const mergedProps = mergeProps(props, render.props); 797 mergedProps.ref = props.ref; 798 let newElement = render; 799 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 800 const children = React7.Children.toArray(render); 801 newElement = children[0]; 802 } 803 if (true) { 804 if (!/* @__PURE__ */ React7.isValidElement(newElement)) { 805 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")); 806 } 807 } 808 return /* @__PURE__ */ React7.cloneElement(newElement, mergedProps); 809 } 810 if (element) { 811 if (typeof element === "string") { 812 return renderTag(element, props); 813 } 814 } 815 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 816 } 817 function warnIfRenderPropLooksLikeComponent(renderFn) { 818 const functionName = renderFn.name; 819 if (functionName.length === 0) { 820 return; 821 } 822 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 823 return; 824 } 825 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 826 return; 827 } 828 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"); 829 } 830 function renderTag(Tag, props) { 831 if (Tag === "button") { 832 return /* @__PURE__ */ (0, import_react.createElement)("button", { 833 type: "button", 834 ...props, 835 key: props.key 836 }); 837 } 838 if (Tag === "img") { 839 return /* @__PURE__ */ (0, import_react.createElement)("img", { 840 alt: "", 841 ...props, 842 key: props.key 843 }); 844 } 845 return /* @__PURE__ */ React7.createElement(Tag, props); 846 } 847 848 // node_modules/@base-ui/utils/useId.mjs 849 var React8 = __toESM(require_react(), 1); 850 var globalId = 0; 851 function useGlobalId(idOverride, prefix = "mui") { 852 const [defaultId, setDefaultId] = React8.useState(idOverride); 853 const id = idOverride || defaultId; 854 React8.useEffect(() => { 855 if (defaultId == null) { 856 globalId += 1; 857 setDefaultId(`$prefix}-$globalId}`); 858 } 859 }, [defaultId, prefix]); 860 return id; 861 } 862 var maybeReactUseId = SafeReact.useId; 863 function useId(idOverride, prefix) { 864 if (maybeReactUseId !== void 0) { 865 const reactId = maybeReactUseId(); 866 return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId); 867 } 868 return useGlobalId(idOverride, prefix); 869 } 870 871 // node_modules/@base-ui/react/internals/useBaseUiId.mjs 872 function useBaseUiId(idOverride) { 873 return useId(idOverride, "base-ui"); 874 } 875 876 // node_modules/@base-ui/react/internals/reason-parts.mjs 877 var reason_parts_exports = {}; 878 __export(reason_parts_exports, { 879 cancelOpen: () => cancelOpen, 880 chipRemovePress: () => chipRemovePress, 881 clearPress: () => clearPress, 882 closePress: () => closePress, 883 closeWatcher: () => closeWatcher, 884 decrementPress: () => decrementPress, 885 disabled: () => disabled, 886 drag: () => drag, 887 escapeKey: () => escapeKey, 888 focusOut: () => focusOut, 889 imperativeAction: () => imperativeAction, 890 incrementPress: () => incrementPress, 891 initial: () => initial, 892 inputBlur: () => inputBlur, 893 inputChange: () => inputChange, 894 inputClear: () => inputClear, 895 inputPaste: () => inputPaste, 896 inputPress: () => inputPress, 897 itemPress: () => itemPress, 898 keyboard: () => keyboard, 899 linkPress: () => linkPress, 900 listNavigation: () => listNavigation, 901 missing: () => missing, 902 none: () => none, 903 outsidePress: () => outsidePress, 904 pointer: () => pointer, 905 scrub: () => scrub, 906 siblingOpen: () => siblingOpen, 907 swipe: () => swipe, 908 trackPress: () => trackPress, 909 triggerFocus: () => triggerFocus, 910 triggerHover: () => triggerHover, 911 triggerPress: () => triggerPress, 912 wheel: () => wheel, 913 windowResize: () => windowResize 914 }); 915 var none = "none"; 916 var triggerPress = "trigger-press"; 917 var triggerHover = "trigger-hover"; 918 var triggerFocus = "trigger-focus"; 919 var outsidePress = "outside-press"; 920 var itemPress = "item-press"; 921 var closePress = "close-press"; 922 var linkPress = "link-press"; 923 var clearPress = "clear-press"; 924 var chipRemovePress = "chip-remove-press"; 925 var trackPress = "track-press"; 926 var incrementPress = "increment-press"; 927 var decrementPress = "decrement-press"; 928 var inputChange = "input-change"; 929 var inputClear = "input-clear"; 930 var inputBlur = "input-blur"; 931 var inputPaste = "input-paste"; 932 var inputPress = "input-press"; 933 var focusOut = "focus-out"; 934 var escapeKey = "escape-key"; 935 var closeWatcher = "close-watcher"; 936 var listNavigation = "list-navigation"; 937 var keyboard = "keyboard"; 938 var pointer = "pointer"; 939 var drag = "drag"; 940 var wheel = "wheel"; 941 var scrub = "scrub"; 942 var cancelOpen = "cancel-open"; 943 var siblingOpen = "sibling-open"; 944 var disabled = "disabled"; 945 var missing = "missing"; 946 var initial = "initial"; 947 var imperativeAction = "imperative-action"; 948 var swipe = "swipe"; 949 var windowResize = "window-resize"; 950 951 // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs 952 function createChangeEventDetails(reason, event, trigger, customProperties) { 953 let canceled = false; 954 let allowPropagation = false; 955 const custom = customProperties ?? EMPTY_OBJECT; 956 const details = { 957 reason, 958 event: event ?? new Event("base-ui"), 959 cancel() { 960 canceled = true; 961 }, 962 allowPropagation() { 963 allowPropagation = true; 964 }, 965 get isCanceled() { 966 return canceled; 967 }, 968 get isPropagationAllowed() { 969 return allowPropagation; 970 }, 971 trigger, 972 ...custom 973 }; 974 return details; 975 } 976 977 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 978 var React10 = __toESM(require_react(), 1); 979 980 // node_modules/@base-ui/utils/useOnMount.mjs 981 var React9 = __toESM(require_react(), 1); 982 var EMPTY = []; 983 function useOnMount(fn) { 984 React9.useEffect(fn, EMPTY); 985 } 986 987 // node_modules/@base-ui/utils/useAnimationFrame.mjs 988 var EMPTY2 = null; 989 var LAST_RAF = globalThis.requestAnimationFrame; 990 var Scheduler = class { 991 /* This implementation uses an array as a backing data-structure for frame callbacks. 992 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it 993 * never calls the native `cancelAnimationFrame` if there are no frames left. This can 994 * be much more efficient if there is a call pattern that alterns as 995 * "request-cancel-request-cancel-…". 996 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation 997 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ 998 callbacks = []; 999 callbacksCount = 0; 1000 nextId = 1; 1001 startId = 1; 1002 isScheduled = false; 1003 tick = (timestamp) => { 1004 this.isScheduled = false; 1005 const currentCallbacks = this.callbacks; 1006 const currentCallbacksCount = this.callbacksCount; 1007 this.callbacks = []; 1008 this.callbacksCount = 0; 1009 this.startId = this.nextId; 1010 if (currentCallbacksCount > 0) { 1011 for (let i = 0; i < currentCallbacks.length; i += 1) { 1012 currentCallbacks[i]?.(timestamp); 1013 } 1014 } 1015 }; 1016 request(fn) { 1017 const id = this.nextId; 1018 this.nextId += 1; 1019 this.callbacks.push(fn); 1020 this.callbacksCount += 1; 1021 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); 1022 if (!this.isScheduled || didRAFChange) { 1023 requestAnimationFrame(this.tick); 1024 this.isScheduled = true; 1025 } 1026 return id; 1027 } 1028 cancel(id) { 1029 const index2 = id - this.startId; 1030 if (index2 < 0 || index2 >= this.callbacks.length) { 1031 return; 1032 } 1033 this.callbacks[index2] = null; 1034 this.callbacksCount -= 1; 1035 } 1036 }; 1037 var scheduler = new Scheduler(); 1038 var AnimationFrame = class _AnimationFrame { 1039 static create() { 1040 return new _AnimationFrame(); 1041 } 1042 static request(fn) { 1043 return scheduler.request(fn); 1044 } 1045 static cancel(id) { 1046 return scheduler.cancel(id); 1047 } 1048 currentId = EMPTY2; 1049 /** 1050 * Executes `fn` after `delay`, clearing any previously scheduled call. 1051 */ 1052 request(fn) { 1053 this.cancel(); 1054 this.currentId = scheduler.request(() => { 1055 this.currentId = EMPTY2; 1056 fn(); 1057 }); 1058 } 1059 cancel = () => { 1060 if (this.currentId !== EMPTY2) { 1061 scheduler.cancel(this.currentId); 1062 this.currentId = EMPTY2; 1063 } 1064 }; 1065 disposeEffect = () => { 1066 return this.cancel; 1067 }; 1068 }; 1069 function useAnimationFrame() { 1070 const timeout = useRefWithInit(AnimationFrame.create).current; 1071 useOnMount(timeout.disposeEffect); 1072 return timeout; 1073 } 1074 1075 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 1076 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { 1077 const [transitionStatus, setTransitionStatus] = React10.useState(open && enableIdleState ? "idle" : void 0); 1078 const [mounted, setMounted] = React10.useState(open); 1079 if (open && !mounted) { 1080 setMounted(true); 1081 setTransitionStatus("starting"); 1082 } 1083 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { 1084 setTransitionStatus("ending"); 1085 } 1086 if (!open && !mounted && transitionStatus === "ending") { 1087 setTransitionStatus(void 0); 1088 } 1089 useIsoLayoutEffect(() => { 1090 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { 1091 const frame = AnimationFrame.request(() => { 1092 setTransitionStatus("ending"); 1093 }); 1094 return () => { 1095 AnimationFrame.cancel(frame); 1096 }; 1097 } 1098 return void 0; 1099 }, [open, mounted, transitionStatus, deferEndingState]); 1100 useIsoLayoutEffect(() => { 1101 if (!open || enableIdleState) { 1102 return void 0; 1103 } 1104 const frame = AnimationFrame.request(() => { 1105 setTransitionStatus(void 0); 1106 }); 1107 return () => { 1108 AnimationFrame.cancel(frame); 1109 }; 1110 }, [enableIdleState, open]); 1111 useIsoLayoutEffect(() => { 1112 if (!open || !enableIdleState) { 1113 return void 0; 1114 } 1115 if (open && mounted && transitionStatus !== "idle") { 1116 setTransitionStatus("starting"); 1117 } 1118 const frame = AnimationFrame.request(() => { 1119 setTransitionStatus("idle"); 1120 }); 1121 return () => { 1122 AnimationFrame.cancel(frame); 1123 }; 1124 }, [enableIdleState, open, mounted, transitionStatus]); 1125 return { 1126 mounted, 1127 setMounted, 1128 transitionStatus 1129 }; 1130 } 1131 1132 // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs 1133 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { 1134 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; 1135 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; 1136 return TransitionStatusDataAttributes2; 1137 })({}); 1138 var STARTING_HOOK = { 1139 [TransitionStatusDataAttributes.startingStyle]: "" 1140 }; 1141 var ENDING_HOOK = { 1142 [TransitionStatusDataAttributes.endingStyle]: "" 1143 }; 1144 var transitionStatusMapping = { 1145 transitionStatus(value) { 1146 if (value === "starting") { 1147 return STARTING_HOOK; 1148 } 1149 if (value === "ending") { 1150 return ENDING_HOOK; 1151 } 1152 return null; 1153 } 1154 }; 1155 1156 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 1157 function hasWindow() { 1158 return typeof window !== "undefined"; 1159 } 1160 function getNodeName(node) { 1161 if (isNode(node)) { 1162 return (node.nodeName || "").toLowerCase(); 1163 } 1164 return "#document"; 1165 } 1166 function getWindow(node) { 1167 var _node$ownerDocument; 1168 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 1169 } 1170 function getDocumentElement(node) { 1171 var _ref; 1172 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 1173 } 1174 function isNode(value) { 1175 if (!hasWindow()) { 1176 return false; 1177 } 1178 return value instanceof Node || value instanceof getWindow(value).Node; 1179 } 1180 function isElement(value) { 1181 if (!hasWindow()) { 1182 return false; 1183 } 1184 return value instanceof Element || value instanceof getWindow(value).Element; 1185 } 1186 function isHTMLElement(value) { 1187 if (!hasWindow()) { 1188 return false; 1189 } 1190 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 1191 } 1192 function isShadowRoot(value) { 1193 if (!hasWindow() || typeof ShadowRoot === "undefined") { 1194 return false; 1195 } 1196 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 1197 } 1198 function isOverflowElement(element) { 1199 const { 1200 overflow, 1201 overflowX, 1202 overflowY, 1203 display 1204 } = getComputedStyle2(element); 1205 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 1206 } 1207 function isTableElement(element) { 1208 return /^(table|td|th)$/.test(getNodeName(element)); 1209 } 1210 function isTopLayer(element) { 1211 try { 1212 if (element.matches(":popover-open")) { 1213 return true; 1214 } 1215 } catch (_e) { 1216 } 1217 try { 1218 return element.matches(":modal"); 1219 } catch (_e) { 1220 return false; 1221 } 1222 } 1223 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 1224 var containRe = /paint|layout|strict|content/; 1225 var isNotNone = (value) => !!value && value !== "none"; 1226 var isWebKitValue; 1227 function isContainingBlock(elementOrCss) { 1228 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 1229 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 || ""); 1230 } 1231 function getContainingBlock(element) { 1232 let currentNode = getParentNode(element); 1233 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 1234 if (isContainingBlock(currentNode)) { 1235 return currentNode; 1236 } else if (isTopLayer(currentNode)) { 1237 return null; 1238 } 1239 currentNode = getParentNode(currentNode); 1240 } 1241 return null; 1242 } 1243 function isWebKit() { 1244 if (isWebKitValue == null) { 1245 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 1246 } 1247 return isWebKitValue; 1248 } 1249 function isLastTraversableNode(node) { 1250 return /^(html|body|#document)$/.test(getNodeName(node)); 1251 } 1252 function getComputedStyle2(element) { 1253 return getWindow(element).getComputedStyle(element); 1254 } 1255 function getNodeScroll(element) { 1256 if (isElement(element)) { 1257 return { 1258 scrollLeft: element.scrollLeft, 1259 scrollTop: element.scrollTop 1260 }; 1261 } 1262 return { 1263 scrollLeft: element.scrollX, 1264 scrollTop: element.scrollY 1265 }; 1266 } 1267 function getParentNode(node) { 1268 if (getNodeName(node) === "html") { 1269 return node; 1270 } 1271 const result = ( 1272 // Step into the shadow DOM of the parent of a slotted node. 1273 node.assignedSlot || // DOM Element detected. 1274 node.parentNode || // ShadowRoot detected. 1275 isShadowRoot(node) && node.host || // Fallback. 1276 getDocumentElement(node) 1277 ); 1278 return isShadowRoot(result) ? result.host : result; 1279 } 1280 function getNearestOverflowAncestor(node) { 1281 const parentNode = getParentNode(node); 1282 if (isLastTraversableNode(parentNode)) { 1283 return node.ownerDocument ? node.ownerDocument.body : node.body; 1284 } 1285 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 1286 return parentNode; 1287 } 1288 return getNearestOverflowAncestor(parentNode); 1289 } 1290 function getOverflowAncestors(node, list, traverseIframes) { 1291 var _node$ownerDocument2; 1292 if (list === void 0) { 1293 list = []; 1294 } 1295 if (traverseIframes === void 0) { 1296 traverseIframes = true; 1297 } 1298 const scrollableAncestor = getNearestOverflowAncestor(node); 1299 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 1300 const win = getWindow(scrollableAncestor); 1301 if (isBody) { 1302 const frameElement = getFrameElement(win); 1303 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 1304 } else { 1305 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 1306 } 1307 } 1308 function getFrameElement(win) { 1309 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 1310 } 1311 1312 // node_modules/@base-ui/utils/addEventListener.mjs 1313 function addEventListener(target, type, listener, options) { 1314 target.addEventListener(type, listener, options); 1315 return () => { 1316 target.removeEventListener(type, listener, options); 1317 }; 1318 } 1319 1320 // node_modules/@base-ui/utils/useValueAsRef.mjs 1321 function useValueAsRef(value) { 1322 const latest = useRefWithInit(createLatestRef, value).current; 1323 latest.next = value; 1324 useIsoLayoutEffect(latest.effect); 1325 return latest; 1326 } 1327 function createLatestRef(value) { 1328 const latest = { 1329 current: value, 1330 next: value, 1331 effect: () => { 1332 latest.current = latest.next; 1333 } 1334 }; 1335 return latest; 1336 } 1337 1338 // node_modules/@base-ui/utils/owner.mjs 1339 function ownerDocument(node) { 1340 return node?.ownerDocument || document; 1341 } 1342 1343 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 1344 var React11 = __toESM(require_react(), 1); 1345 1346 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 1347 var ReactDOM = __toESM(require_react_dom(), 1); 1348 1349 // node_modules/@base-ui/react/utils/resolveRef.mjs 1350 function resolveRef(maybeRef) { 1351 if (maybeRef == null) { 1352 return maybeRef; 1353 } 1354 return "current" in maybeRef ? maybeRef.current : maybeRef; 1355 } 1356 1357 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 1358 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { 1359 const frame = useAnimationFrame(); 1360 return useStableCallback((fnToExecute, signal = null) => { 1361 frame.cancel(); 1362 const element = resolveRef(elementOrRef); 1363 if (element == null) { 1364 return; 1365 } 1366 const resolvedElement = element; 1367 const done = () => { 1368 ReactDOM.flushSync(fnToExecute); 1369 }; 1370 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 1371 fnToExecute(); 1372 return; 1373 } 1374 function exec() { 1375 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { 1376 if (!signal?.aborted) { 1377 done(); 1378 } 1379 }).catch(() => { 1380 if (treatAbortedAsFinished) { 1381 if (!signal?.aborted) { 1382 done(); 1383 } 1384 return; 1385 } 1386 const currentAnimations = resolvedElement.getAnimations(); 1387 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 1388 exec(); 1389 } 1390 }); 1391 } 1392 if (waitForStartingStyleRemoved) { 1393 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; 1394 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1395 frame.request(exec); 1396 return; 1397 } 1398 const attributeObserver = new MutationObserver(() => { 1399 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1400 attributeObserver.disconnect(); 1401 exec(); 1402 } 1403 }); 1404 attributeObserver.observe(resolvedElement, { 1405 attributes: true, 1406 attributeFilter: [startingStyleAttribute] 1407 }); 1408 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 1409 once: true 1410 }); 1411 return; 1412 } 1413 frame.request(exec); 1414 }); 1415 } 1416 1417 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 1418 function useOpenChangeComplete(parameters) { 1419 const { 1420 enabled = true, 1421 open, 1422 ref, 1423 onComplete: onCompleteParam 1424 } = parameters; 1425 const onComplete = useStableCallback(onCompleteParam); 1426 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); 1427 React11.useEffect(() => { 1428 if (!enabled) { 1429 return void 0; 1430 } 1431 const abortController = new AbortController(); 1432 runOnceAnimationsFinish(onComplete, abortController.signal); 1433 return () => { 1434 abortController.abort(); 1435 }; 1436 }, [enabled, open, onComplete, runOnceAnimationsFinish]); 1437 } 1438 1439 // node_modules/@base-ui/utils/useOnFirstRender.mjs 1440 var React12 = __toESM(require_react(), 1); 1441 function useOnFirstRender(fn) { 1442 const ref = React12.useRef(true); 1443 if (ref.current) { 1444 ref.current = false; 1445 fn(); 1446 } 1447 } 1448 1449 // node_modules/@base-ui/utils/platform/parts.mjs 1450 var parts_exports = {}; 1451 __export(parts_exports, { 1452 engine: () => engine_exports, 1453 env: () => env_exports, 1454 os: () => os_exports, 1455 screenReader: () => screen_reader_exports 1456 }); 1457 1458 // node_modules/@base-ui/utils/platform/os.mjs 1459 var os_exports = {}; 1460 __export(os_exports, { 1461 android: () => android, 1462 apple: () => apple, 1463 ios: () => ios, 1464 linux: () => linux, 1465 mac: () => mac, 1466 windows: () => windows 1467 }); 1468 1469 // node_modules/@base-ui/utils/platform/shared.mjs 1470 function readRawData() { 1471 if (typeof navigator === "undefined") { 1472 return { 1473 userAgent: "", 1474 platform: "", 1475 maxTouchPoints: 0 1476 }; 1477 } 1478 if (true) { 1479 const uaData = navigator.userAgentData; 1480 if (uaData && Array.isArray(uaData.brands)) { 1481 return { 1482 userAgent: uaData.brands.map(({ 1483 brand, 1484 version: version2 1485 }) => `$brand}/$version2}`).join(" "), 1486 platform: uaData.platform ?? navigator.platform ?? "", 1487 maxTouchPoints: navigator.maxTouchPoints ?? 0 1488 }; 1489 } 1490 } 1491 return { 1492 userAgent: navigator.userAgent, 1493 platform: navigator.platform ?? "", 1494 maxTouchPoints: navigator.maxTouchPoints ?? 0 1495 }; 1496 } 1497 var { 1498 userAgent, 1499 platform, 1500 maxTouchPoints 1501 } = readRawData(); 1502 var lowerUserAgent = userAgent.toLowerCase(); 1503 var lowerPlatform = platform.toLowerCase(); 1504 1505 // node_modules/@base-ui/utils/platform/os.mjs 1506 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; 1507 var ANDROID_STRING = "android"; 1508 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); 1509 var mac = !ios && lowerPlatform.startsWith("mac"); 1510 var windows = lowerPlatform.startsWith("win"); 1511 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); 1512 var apple = mac || ios; 1513 1514 // node_modules/@base-ui/utils/platform/engine.mjs 1515 var engine_exports = {}; 1516 __export(engine_exports, { 1517 blink: () => blink, 1518 gecko: () => gecko, 1519 webkit: () => webkit 1520 }); 1521 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); 1522 var gecko = !webkit && lowerUserAgent.includes("firefox"); 1523 var blink = !webkit && lowerUserAgent.includes("chrom"); 1524 1525 // node_modules/@base-ui/utils/platform/screen-reader.mjs 1526 var screen_reader_exports = {}; 1527 __export(screen_reader_exports, { 1528 voiceOver: () => voiceOver 1529 }); 1530 var voiceOver = apple; 1531 1532 // node_modules/@base-ui/utils/platform/env.mjs 1533 var env_exports = {}; 1534 __export(env_exports, { 1535 jsdom: () => jsdom 1536 }); 1537 var jsdom = /jsdom|happydom/.test(lowerUserAgent); 1538 1539 // node_modules/@base-ui/utils/useTimeout.mjs 1540 var EMPTY3 = 0; 1541 var Timeout = class _Timeout { 1542 static create() { 1543 return new _Timeout(); 1544 } 1545 currentId = EMPTY3; 1546 /** 1547 * Executes `fn` after `delay`, clearing any previously scheduled call. 1548 */ 1549 start(delay, fn) { 1550 this.clear(); 1551 this.currentId = setTimeout(() => { 1552 this.currentId = EMPTY3; 1553 fn(); 1554 }, delay); 1555 } 1556 isStarted() { 1557 return this.currentId !== EMPTY3; 1558 } 1559 clear = () => { 1560 if (this.currentId !== EMPTY3) { 1561 clearTimeout(this.currentId); 1562 this.currentId = EMPTY3; 1563 } 1564 }; 1565 disposeEffect = () => { 1566 return this.clear; 1567 }; 1568 }; 1569 function useTimeout() { 1570 const timeout = useRefWithInit(Timeout.create).current; 1571 useOnMount(timeout.disposeEffect); 1572 return timeout; 1573 } 1574 1575 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 1576 var React13 = __toESM(require_react(), 1); 1577 1578 // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs 1579 function isReactEvent(event) { 1580 return "nativeEvent" in event; 1581 } 1582 function isMouseLikePointerType(pointerType, strict) { 1583 const values = ["mouse", "pen"]; 1584 if (!strict) { 1585 values.push("", void 0); 1586 } 1587 return values.includes(pointerType); 1588 } 1589 function isClickLikeEvent(event) { 1590 const type = event.type; 1591 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 1592 } 1593 1594 // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs 1595 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 1596 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 1597 1598 // node_modules/@base-ui/react/internals/shadowDom.mjs 1599 function activeElement(doc) { 1600 let element = doc.activeElement; 1601 while (element?.shadowRoot?.activeElement != null) { 1602 element = element.shadowRoot.activeElement; 1603 } 1604 return element; 1605 } 1606 function contains(parent, child) { 1607 if (!parent || !child) { 1608 return false; 1609 } 1610 const rootNode = child.getRootNode?.(); 1611 if (parent.contains(child)) { 1612 return true; 1613 } 1614 if (rootNode && isShadowRoot(rootNode)) { 1615 let next = child; 1616 while (next) { 1617 if (parent === next) { 1618 return true; 1619 } 1620 next = next.parentNode || next.host; 1621 } 1622 } 1623 return false; 1624 } 1625 function getTarget(event) { 1626 if ("composedPath" in event) { 1627 return event.composedPath()[0]; 1628 } 1629 return event.target; 1630 } 1631 1632 // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs 1633 function isTargetInsideEnabledTrigger(target, triggerElements) { 1634 if (!isElement(target)) { 1635 return false; 1636 } 1637 const targetElement = target; 1638 if (triggerElements.hasElement(targetElement)) { 1639 return !targetElement.hasAttribute("data-trigger-disabled"); 1640 } 1641 for (const [, trigger] of triggerElements.entries()) { 1642 if (contains(trigger, targetElement)) { 1643 return !trigger.hasAttribute("data-trigger-disabled"); 1644 } 1645 } 1646 return false; 1647 } 1648 function isEventTargetWithin(event, node) { 1649 if (node == null) { 1650 return false; 1651 } 1652 if ("composedPath" in event) { 1653 return event.composedPath().includes(node); 1654 } 1655 const eventAgain = event; 1656 return eventAgain.target != null && node.contains(eventAgain.target); 1657 } 1658 function isRootElement(element) { 1659 return element.matches("html,body"); 1660 } 1661 function isTypeableElement(element) { 1662 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 1663 } 1664 function isInteractiveElement(element) { 1665 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 1666 } 1667 function matchesFocusVisible(element) { 1668 if (!element || parts_exports.env.jsdom) { 1669 return true; 1670 } 1671 try { 1672 return element.matches(":focus-visible"); 1673 } catch (_e) { 1674 return true; 1675 } 1676 } 1677 1678 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs 1679 function resolveValue(value, pointerType) { 1680 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 1681 return 0; 1682 } 1683 if (typeof value === "function") { 1684 return value(); 1685 } 1686 return value; 1687 } 1688 function getDelay(value, prop, pointerType) { 1689 const result = resolveValue(value, pointerType); 1690 if (typeof result === "number") { 1691 return result; 1692 } 1693 return result?.[prop]; 1694 } 1695 function getRestMs(value) { 1696 if (typeof value === "function") { 1697 return value(); 1698 } 1699 return value; 1700 } 1701 function isClickLikeOpenEvent(openEventType, interactedInside) { 1702 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 1703 } 1704 function isHoverOpenEvent(openEventType) { 1705 return openEventType?.includes("mouse") && openEventType !== "mousedown"; 1706 } 1707 1708 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 1709 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 1710 var FloatingDelayGroupContext = /* @__PURE__ */ React13.createContext({ 1711 hasProvider: false, 1712 timeoutMs: 0, 1713 delayRef: { 1714 current: 0 1715 }, 1716 initialDelayRef: { 1717 current: 0 1718 }, 1719 timeout: new Timeout(), 1720 currentIdRef: { 1721 current: null 1722 }, 1723 currentContextRef: { 1724 current: null 1725 } 1726 }); 1727 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 1728 function resetDelayRef(delayRef, initialDelayRef) { 1729 delayRef.current = initialDelayRef.current; 1730 } 1731 function FloatingDelayGroup(props) { 1732 const { 1733 children, 1734 delay, 1735 timeoutMs = 0 1736 } = props; 1737 const delayRef = React13.useRef(delay); 1738 const initialDelayRef = React13.useRef(delay); 1739 const currentIdRef = React13.useRef(null); 1740 const currentContextRef = React13.useRef(null); 1741 const timeout = useTimeout(); 1742 useIsoLayoutEffect(() => { 1743 initialDelayRef.current = delay; 1744 if (!currentIdRef.current) { 1745 delayRef.current = delay; 1746 return; 1747 } 1748 delayRef.current = { 1749 open: getDelay(delayRef.current, "open"), 1750 close: getDelay(delay, "close") 1751 }; 1752 }, [delay, currentIdRef, delayRef, initialDelayRef]); 1753 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { 1754 value: React13.useMemo(() => ({ 1755 hasProvider: true, 1756 delayRef, 1757 initialDelayRef, 1758 currentIdRef, 1759 timeoutMs, 1760 currentContextRef, 1761 timeout 1762 }), [timeoutMs, timeout]), 1763 children 1764 }); 1765 } 1766 function useDelayGroup(context, options = { 1767 open: false 1768 }) { 1769 const { 1770 open 1771 } = options; 1772 const store2 = "rootStore" in context ? context.rootStore : context; 1773 const floatingId = store2.useState("floatingId"); 1774 const groupContext = React13.useContext(FloatingDelayGroupContext); 1775 const { 1776 currentIdRef, 1777 delayRef, 1778 timeoutMs, 1779 initialDelayRef, 1780 currentContextRef, 1781 hasProvider, 1782 timeout 1783 } = groupContext; 1784 const [isInstantPhase, setIsInstantPhase] = React13.useState(false); 1785 const openRef = React13.useRef(open); 1786 const isUnmountedRef = React13.useRef(false); 1787 useIsoLayoutEffect(() => { 1788 openRef.current = open; 1789 }, [open]); 1790 useIsoLayoutEffect(() => { 1791 return () => { 1792 isUnmountedRef.current = true; 1793 }; 1794 }, []); 1795 useIsoLayoutEffect(() => { 1796 function unset() { 1797 if (!isUnmountedRef.current) { 1798 setIsInstantPhase(false); 1799 } 1800 currentContextRef.current?.setIsInstantPhase(false); 1801 currentIdRef.current = null; 1802 currentContextRef.current = null; 1803 delayRef.current = initialDelayRef.current; 1804 timeout.clear(); 1805 } 1806 if (!currentIdRef.current) { 1807 return void 0; 1808 } 1809 if (!open && currentIdRef.current === floatingId) { 1810 setIsInstantPhase(false); 1811 if (timeoutMs) { 1812 const closingId = floatingId; 1813 timeout.start(timeoutMs, () => { 1814 if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 1815 return; 1816 } 1817 unset(); 1818 }); 1819 return () => { 1820 if (openRef.current || currentIdRef.current !== closingId) { 1821 timeout.clear(); 1822 } 1823 }; 1824 } 1825 unset(); 1826 } 1827 return void 0; 1828 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]); 1829 useIsoLayoutEffect(() => { 1830 if (!open) { 1831 return; 1832 } 1833 const prevContext = currentContextRef.current; 1834 const prevId = currentIdRef.current; 1835 timeout.clear(); 1836 currentContextRef.current = { 1837 onOpenChange: store2.setOpen, 1838 setIsInstantPhase 1839 }; 1840 currentIdRef.current = floatingId; 1841 delayRef.current = { 1842 open: 0, 1843 close: getDelay(initialDelayRef.current, "close") 1844 }; 1845 if (prevId !== null && prevId !== floatingId) { 1846 setIsInstantPhase(true); 1847 prevContext?.setIsInstantPhase(true); 1848 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 1849 } else { 1850 setIsInstantPhase(false); 1851 prevContext?.setIsInstantPhase(false); 1852 } 1853 }, [open, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); 1854 useIsoLayoutEffect(() => { 1855 return () => { 1856 if (currentIdRef.current === floatingId) { 1857 currentContextRef.current = null; 1858 if (!openRef.current) { 1859 return; 1860 } 1861 currentIdRef.current = null; 1862 resetDelayRef(delayRef, initialDelayRef); 1863 timeout.clear(); 1864 } 1865 }; 1866 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); 1867 return React13.useMemo(() => ({ 1868 hasProvider, 1869 delayRef, 1870 isInstantPhase 1871 }), [hasProvider, delayRef, isInstantPhase]); 1872 } 1873 1874 // node_modules/@base-ui/utils/mergeCleanups.mjs 1875 function mergeCleanups(...cleanups) { 1876 return () => { 1877 for (let i = 0; i < cleanups.length; i += 1) { 1878 const cleanup = cleanups[i]; 1879 if (cleanup) { 1880 cleanup(); 1881 } 1882 } 1883 }; 1884 } 1885 1886 // node_modules/@base-ui/react/utils/FocusGuard.mjs 1887 var React14 = __toESM(require_react(), 1); 1888 1889 // node_modules/@base-ui/utils/visuallyHidden.mjs 1890 var visuallyHiddenBase = { 1891 clipPath: "inset(50%)", 1892 overflow: "hidden", 1893 whiteSpace: "nowrap", 1894 border: 0, 1895 padding: 0, 1896 width: 1, 1897 height: 1, 1898 margin: -1 1899 }; 1900 var visuallyHidden = { 1901 ...visuallyHiddenBase, 1902 position: "fixed", 1903 top: 0, 1904 left: 0 1905 }; 1906 var visuallyHiddenInput = { 1907 ...visuallyHiddenBase, 1908 position: "absolute" 1909 }; 1910 1911 // node_modules/@base-ui/react/utils/FocusGuard.mjs 1912 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 1913 var FocusGuard = /* @__PURE__ */ React14.forwardRef(function FocusGuard2(props, ref) { 1914 const [role, setRole] = React14.useState(); 1915 useIsoLayoutEffect(() => { 1916 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { 1917 setRole("button"); 1918 } 1919 }, []); 1920 const restProps = { 1921 tabIndex: 0, 1922 // Role is only for VoiceOver 1923 role 1924 }; 1925 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { 1926 ...props, 1927 ref, 1928 style: visuallyHidden, 1929 "aria-hidden": role ? void 0 : true, 1930 ...restProps, 1931 "data-base-ui-focus-guard": "" 1932 }); 1933 }); 1934 if (true) FocusGuard.displayName = "FocusGuard"; 1935 1936 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 1937 var sides = ["top", "right", "bottom", "left"]; 1938 var min = Math.min; 1939 var max = Math.max; 1940 var round = Math.round; 1941 var floor = Math.floor; 1942 var createCoords = (v) => ({ 1943 x: v, 1944 y: v 1945 }); 1946 var oppositeSideMap = { 1947 left: "right", 1948 right: "left", 1949 bottom: "top", 1950 top: "bottom" 1951 }; 1952 function clamp(start, value, end) { 1953 return max(start, min(value, end)); 1954 } 1955 function evaluate(value, param) { 1956 return typeof value === "function" ? value(param) : value; 1957 } 1958 function getSide(placement) { 1959 return placement.split("-")[0]; 1960 } 1961 function getAlignment(placement) { 1962 return placement.split("-")[1]; 1963 } 1964 function getOppositeAxis(axis) { 1965 return axis === "x" ? "y" : "x"; 1966 } 1967 function getAxisLength(axis) { 1968 return axis === "y" ? "height" : "width"; 1969 } 1970 function getSideAxis(placement) { 1971 const firstChar = placement[0]; 1972 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 1973 } 1974 function getAlignmentAxis(placement) { 1975 return getOppositeAxis(getSideAxis(placement)); 1976 } 1977 function getAlignmentSides(placement, rects, rtl) { 1978 if (rtl === void 0) { 1979 rtl = false; 1980 } 1981 const alignment = getAlignment(placement); 1982 const alignmentAxis = getAlignmentAxis(placement); 1983 const length = getAxisLength(alignmentAxis); 1984 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 1985 if (rects.reference[length] > rects.floating[length]) { 1986 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 1987 } 1988 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 1989 } 1990 function getExpandedPlacements(placement) { 1991 const oppositePlacement = getOppositePlacement(placement); 1992 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 1993 } 1994 function getOppositeAlignmentPlacement(placement) { 1995 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 1996 } 1997 var lrPlacement = ["left", "right"]; 1998 var rlPlacement = ["right", "left"]; 1999 var tbPlacement = ["top", "bottom"]; 2000 var btPlacement = ["bottom", "top"]; 2001 function getSideList(side, isStart, rtl) { 2002 switch (side) { 2003 case "top": 2004 case "bottom": 2005 if (rtl) return isStart ? rlPlacement : lrPlacement; 2006 return isStart ? lrPlacement : rlPlacement; 2007 case "left": 2008 case "right": 2009 return isStart ? tbPlacement : btPlacement; 2010 default: 2011 return []; 2012 } 2013 } 2014 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 2015 const alignment = getAlignment(placement); 2016 let list = getSideList(getSide(placement), direction === "start", rtl); 2017 if (alignment) { 2018 list = list.map((side) => side + "-" + alignment); 2019 if (flipAlignment) { 2020 list = list.concat(list.map(getOppositeAlignmentPlacement)); 2021 } 2022 } 2023 return list; 2024 } 2025 function getOppositePlacement(placement) { 2026 const side = getSide(placement); 2027 return oppositeSideMap[side] + placement.slice(side.length); 2028 } 2029 function expandPaddingObject(padding) { 2030 return { 2031 top: 0, 2032 right: 0, 2033 bottom: 0, 2034 left: 0, 2035 ...padding 2036 }; 2037 } 2038 function getPaddingObject(padding) { 2039 return typeof padding !== "number" ? expandPaddingObject(padding) : { 2040 top: padding, 2041 right: padding, 2042 bottom: padding, 2043 left: padding 2044 }; 2045 } 2046 function rectToClientRect(rect) { 2047 const { 2048 x, 2049 y, 2050 width, 2051 height 2052 } = rect; 2053 return { 2054 width, 2055 height, 2056 top: y, 2057 left: x, 2058 right: x + width, 2059 bottom: y + height, 2060 x, 2061 y 2062 }; 2063 } 2064 2065 // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs 2066 function isHiddenByStyles(styles) { 2067 return styles.visibility === "hidden" || styles.visibility === "collapse"; 2068 } 2069 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 2070 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 2071 return false; 2072 } 2073 if (typeof element.checkVisibility === "function") { 2074 return element.checkVisibility(); 2075 } 2076 return styles.display !== "none" && styles.display !== "contents"; 2077 } 2078 2079 // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs 2080 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 2081 function getParentElement(element) { 2082 const assignedSlot = element.assignedSlot; 2083 if (assignedSlot) { 2084 return assignedSlot; 2085 } 2086 if (element.parentElement) { 2087 return element.parentElement; 2088 } 2089 const rootNode = element.getRootNode(); 2090 return isShadowRoot(rootNode) ? rootNode.host : null; 2091 } 2092 function getDetailsSummary(details) { 2093 for (const child of Array.from(details.children)) { 2094 if (getNodeName(child) === "summary") { 2095 return child; 2096 } 2097 } 2098 return null; 2099 } 2100 function isWithinOpenDetailsSummary(element, details) { 2101 const summary = getDetailsSummary(details); 2102 return !!summary && (element === summary || contains(summary, element)); 2103 } 2104 function isFocusableCandidate(element) { 2105 const nodeName = element ? getNodeName(element) : ""; 2106 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"); 2107 } 2108 function isFocusableElement(element) { 2109 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 2110 return false; 2111 } 2112 for (let current = element; current; current = getParentElement(current)) { 2113 const isAncestor = current !== element; 2114 const isSlot = getNodeName(current) === "slot"; 2115 if (current.hasAttribute("inert")) { 2116 return false; 2117 } 2118 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 2119 return false; 2120 } 2121 } 2122 return true; 2123 } 2124 function isVisibleInTabbableTree(element, isAncestor) { 2125 const styles = getComputedStyle2(element); 2126 if (!isAncestor) { 2127 return isElementVisible(element, styles); 2128 } 2129 return styles.display !== "none"; 2130 } 2131 function getTabIndex(element) { 2132 const tabIndex = element.tabIndex; 2133 if (tabIndex < 0) { 2134 const nodeName = getNodeName(element); 2135 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 2136 return 0; 2137 } 2138 } 2139 return tabIndex; 2140 } 2141 function getNamedRadioInput(element) { 2142 if (getNodeName(element) !== "input") { 2143 return null; 2144 } 2145 const input = element; 2146 return input.type === "radio" && input.name !== "" ? input : null; 2147 } 2148 function isTabbableRadio(element, candidates) { 2149 const input = getNamedRadioInput(element); 2150 if (!input) { 2151 return true; 2152 } 2153 const checkedRadio = candidates.find((candidate) => { 2154 const radio = getNamedRadioInput(candidate); 2155 return radio?.name === input.name && radio.form === input.form && radio.checked; 2156 }); 2157 if (checkedRadio) { 2158 return checkedRadio === input; 2159 } 2160 return candidates.find((candidate) => { 2161 const radio = getNamedRadioInput(candidate); 2162 return radio?.name === input.name && radio.form === input.form; 2163 }) === input; 2164 } 2165 function getComposedChildren(container) { 2166 if (isHTMLElement(container) && getNodeName(container) === "slot") { 2167 const assignedElements = container.assignedElements({ 2168 flatten: true 2169 }); 2170 if (assignedElements.length > 0) { 2171 return assignedElements; 2172 } 2173 } 2174 if (isHTMLElement(container) && container.shadowRoot) { 2175 return Array.from(container.shadowRoot.children); 2176 } 2177 return Array.from(container.children); 2178 } 2179 function appendCandidates(container, list) { 2180 getComposedChildren(container).forEach((child) => { 2181 if (isFocusableCandidate(child)) { 2182 list.push(child); 2183 } 2184 appendCandidates(child, list); 2185 }); 2186 } 2187 function appendMatchingElements(container, selector, list) { 2188 getComposedChildren(container).forEach((child) => { 2189 if (isHTMLElement(child) && child.matches(selector)) { 2190 list.push(child); 2191 } 2192 appendMatchingElements(child, selector, list); 2193 }); 2194 } 2195 function focusable(container) { 2196 const candidates = []; 2197 appendCandidates(container, candidates); 2198 return candidates.filter(isFocusableElement); 2199 } 2200 function tabbable(container) { 2201 const candidates = focusable(container); 2202 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 2203 } 2204 function getTabbableIn(container, dir) { 2205 const list = tabbable(container); 2206 const len = list.length; 2207 if (len === 0) { 2208 return void 0; 2209 } 2210 const active = activeElement(ownerDocument(container)); 2211 const index2 = list.indexOf(active); 2212 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; 2213 return list[nextIndex]; 2214 } 2215 function getNextTabbable(referenceElement) { 2216 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 2217 } 2218 function getPreviousTabbable(referenceElement) { 2219 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 2220 } 2221 function isOutsideEvent(event, container) { 2222 const containerElement = container || event.currentTarget; 2223 const relatedTarget = event.relatedTarget; 2224 return !relatedTarget || !contains(containerElement, relatedTarget); 2225 } 2226 function disableFocusInside(container) { 2227 const tabbableElements = tabbable(container); 2228 tabbableElements.forEach((element) => { 2229 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 2230 element.setAttribute("tabindex", "-1"); 2231 }); 2232 } 2233 function enableFocusInside(container) { 2234 const elements = []; 2235 appendMatchingElements(container, "[data-tabindex]", elements); 2236 elements.forEach((element) => { 2237 const tabindex = element.dataset.tabindex; 2238 delete element.dataset.tabindex; 2239 if (tabindex) { 2240 element.setAttribute("tabindex", tabindex); 2241 } else { 2242 element.removeAttribute("tabindex"); 2243 } 2244 }); 2245 } 2246 2247 // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs 2248 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 2249 const directChildren = nodes.filter((node) => node.parentId === id); 2250 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 2251 } 2252 2253 // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs 2254 function createAttribute(name) { 2255 return `data-base-ui-$name}`; 2256 } 2257 2258 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 2259 var React15 = __toESM(require_react(), 1); 2260 var ReactDOM2 = __toESM(require_react_dom(), 1); 2261 2262 // node_modules/@base-ui/react/internals/constants.mjs 2263 var DISABLED_TRANSITIONS_STYLE = { 2264 style: { 2265 transition: "none" 2266 } 2267 }; 2268 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 2269 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 2270 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 2271 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 2272 var POPUP_COLLISION_AVOIDANCE = { 2273 fallbackAxisSide: "end" 2274 }; 2275 var ownerVisuallyHidden = { 2276 clipPath: "inset(50%)", 2277 position: "fixed", 2278 top: 0, 2279 left: 0 2280 }; 2281 2282 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 2283 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 2284 var PortalContext = /* @__PURE__ */ React15.createContext(null); 2285 if (true) PortalContext.displayName = "PortalContext"; 2286 var usePortalContext = () => React15.useContext(PortalContext); 2287 var attr = createAttribute("portal"); 2288 function useFloatingPortalNode(props = {}) { 2289 const { 2290 ref, 2291 container: containerProp, 2292 componentProps = EMPTY_OBJECT, 2293 elementProps 2294 } = props; 2295 const uniqueId = useId(); 2296 const portalContext = usePortalContext(); 2297 const parentPortalNode = portalContext?.portalNode; 2298 const [containerElement, setContainerElement] = React15.useState(null); 2299 const [portalNode, setPortalNode] = React15.useState(null); 2300 const setPortalNodeRef = useStableCallback((node) => { 2301 if (node !== null) { 2302 setPortalNode(node); 2303 } 2304 }); 2305 const containerRef = React15.useRef(null); 2306 useIsoLayoutEffect(() => { 2307 if (containerProp === null) { 2308 if (containerRef.current) { 2309 containerRef.current = null; 2310 setPortalNode(null); 2311 setContainerElement(null); 2312 } 2313 return; 2314 } 2315 if (uniqueId == null) { 2316 return; 2317 } 2318 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 2319 if (resolvedContainer == null) { 2320 if (containerRef.current) { 2321 containerRef.current = null; 2322 setPortalNode(null); 2323 setContainerElement(null); 2324 } 2325 return; 2326 } 2327 if (containerRef.current !== resolvedContainer) { 2328 containerRef.current = resolvedContainer; 2329 setPortalNode(null); 2330 setContainerElement(resolvedContainer); 2331 } 2332 }, [containerProp, parentPortalNode, uniqueId]); 2333 const portalElement = useRenderElement("div", componentProps, { 2334 ref: [ref, setPortalNodeRef], 2335 props: [{ 2336 id: uniqueId, 2337 [attr]: "" 2338 }, elementProps] 2339 }); 2340 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 2341 return { 2342 portalNode, 2343 portalSubtree 2344 }; 2345 } 2346 var FloatingPortal = /* @__PURE__ */ React15.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 2347 const { 2348 render, 2349 className, 2350 style, 2351 children, 2352 container, 2353 renderGuards, 2354 ...elementProps 2355 } = componentProps; 2356 const { 2357 portalNode, 2358 portalSubtree 2359 } = useFloatingPortalNode({ 2360 container, 2361 ref: forwardedRef, 2362 componentProps, 2363 elementProps 2364 }); 2365 const beforeOutsideRef = React15.useRef(null); 2366 const afterOutsideRef = React15.useRef(null); 2367 const beforeInsideRef = React15.useRef(null); 2368 const afterInsideRef = React15.useRef(null); 2369 const [focusManagerState, setFocusManagerState] = React15.useState(null); 2370 const focusInsideDisabledRef = React15.useRef(false); 2371 const modal = focusManagerState?.modal; 2372 const open = focusManagerState?.open; 2373 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 2374 React15.useEffect(() => { 2375 if (!portalNode || modal) { 2376 return void 0; 2377 } 2378 function onFocus(event) { 2379 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 2380 if (event.type === "focusin") { 2381 if (focusInsideDisabledRef.current) { 2382 enableFocusInside(portalNode); 2383 focusInsideDisabledRef.current = false; 2384 } 2385 } else { 2386 disableFocusInside(portalNode); 2387 focusInsideDisabledRef.current = true; 2388 } 2389 } 2390 } 2391 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 2392 }, [portalNode, modal]); 2393 useIsoLayoutEffect(() => { 2394 if (!portalNode || open !== true || !focusInsideDisabledRef.current) { 2395 return; 2396 } 2397 enableFocusInside(portalNode); 2398 focusInsideDisabledRef.current = false; 2399 }, [open, portalNode]); 2400 const portalContextValue = React15.useMemo(() => ({ 2401 beforeOutsideRef, 2402 afterOutsideRef, 2403 beforeInsideRef, 2404 afterInsideRef, 2405 portalNode, 2406 setFocusManagerState 2407 }), [portalNode]); 2408 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React15.Fragment, { 2409 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { 2410 value: portalContextValue, 2411 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 2412 "data-type": "outside", 2413 ref: beforeOutsideRef, 2414 onFocus: (event) => { 2415 if (isOutsideEvent(event, portalNode)) { 2416 beforeInsideRef.current?.focus(); 2417 } else { 2418 const domReference = focusManagerState ? focusManagerState.domReference : null; 2419 const prevTabbable = getPreviousTabbable(domReference); 2420 prevTabbable?.focus(); 2421 } 2422 } 2423 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { 2424 "aria-owns": portalNode.id, 2425 style: ownerVisuallyHidden 2426 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 2427 "data-type": "outside", 2428 ref: afterOutsideRef, 2429 onFocus: (event) => { 2430 if (isOutsideEvent(event, portalNode)) { 2431 afterInsideRef.current?.focus(); 2432 } else { 2433 const domReference = focusManagerState ? focusManagerState.domReference : null; 2434 const nextTabbable = getNextTabbable(domReference); 2435 nextTabbable?.focus(); 2436 if (focusManagerState?.closeOnFocusOut) { 2437 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 2438 } 2439 } 2440 } 2441 })] 2442 })] 2443 }); 2444 }); 2445 if (true) FloatingPortal.displayName = "FloatingPortal"; 2446 2447 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 2448 var React16 = __toESM(require_react(), 1); 2449 2450 // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs 2451 function createEventEmitter() { 2452 const map = /* @__PURE__ */ new Map(); 2453 return { 2454 emit(event, data) { 2455 map.get(event)?.forEach((listener) => listener(data)); 2456 }, 2457 on(event, listener) { 2458 if (!map.has(event)) { 2459 map.set(event, /* @__PURE__ */ new Set()); 2460 } 2461 map.get(event).add(listener); 2462 }, 2463 off(event, listener) { 2464 map.get(event)?.delete(listener); 2465 } 2466 }; 2467 } 2468 2469 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 2470 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 2471 var FloatingNodeContext = /* @__PURE__ */ React16.createContext(null); 2472 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 2473 var FloatingTreeContext = /* @__PURE__ */ React16.createContext(null); 2474 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 2475 var useFloatingParentNodeId = () => React16.useContext(FloatingNodeContext)?.id || null; 2476 var useFloatingTree = (externalTree) => { 2477 const contextTree = React16.useContext(FloatingTreeContext); 2478 return externalTree ?? contextTree; 2479 }; 2480 2481 // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs 2482 var React17 = __toESM(require_react(), 1); 2483 function createVirtualElement(domElement, data) { 2484 let offsetX = null; 2485 let offsetY = null; 2486 let isAutoUpdateEvent = false; 2487 return { 2488 contextElement: domElement || void 0, 2489 getBoundingClientRect() { 2490 const domRect = domElement?.getBoundingClientRect() || { 2491 width: 0, 2492 height: 0, 2493 x: 0, 2494 y: 0 2495 }; 2496 const isXAxis = data.axis === "x" || data.axis === "both"; 2497 const isYAxis = data.axis === "y" || data.axis === "both"; 2498 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 2499 let width = domRect.width; 2500 let height = domRect.height; 2501 let x = domRect.x; 2502 let y = domRect.y; 2503 if (offsetX == null && data.x && isXAxis) { 2504 offsetX = domRect.x - data.x; 2505 } 2506 if (offsetY == null && data.y && isYAxis) { 2507 offsetY = domRect.y - data.y; 2508 } 2509 x -= offsetX || 0; 2510 y -= offsetY || 0; 2511 width = 0; 2512 height = 0; 2513 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 2514 width = data.axis === "y" ? domRect.width : 0; 2515 height = data.axis === "x" ? domRect.height : 0; 2516 x = isXAxis && data.x != null ? data.x : x; 2517 y = isYAxis && data.y != null ? data.y : y; 2518 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 2519 height = data.axis === "x" ? domRect.height : height; 2520 width = data.axis === "y" ? domRect.width : width; 2521 } 2522 isAutoUpdateEvent = true; 2523 return { 2524 width, 2525 height, 2526 x, 2527 y, 2528 top: y, 2529 right: x + width, 2530 bottom: y + height, 2531 left: x 2532 }; 2533 } 2534 }; 2535 } 2536 function isMouseBasedEvent(event) { 2537 return event != null && event.clientX != null; 2538 } 2539 function useClientPoint(context, props = {}) { 2540 const { 2541 enabled = true, 2542 axis = "both" 2543 } = props; 2544 const store2 = "rootStore" in context ? context.rootStore : context; 2545 const open = store2.useState("open"); 2546 const floating = store2.useState("floatingElement"); 2547 const domReference = store2.useState("domReferenceElement"); 2548 const dataRef = store2.context.dataRef; 2549 const initialRef = React17.useRef(false); 2550 const cleanupListenerRef = React17.useRef(null); 2551 const [pointerType, setPointerType] = React17.useState(); 2552 const [reactive, setReactive] = React17.useState([]); 2553 const resetReference = useStableCallback((reference2) => { 2554 store2.set("positionReference", reference2); 2555 }); 2556 const setReference = useStableCallback((newX, newY, referenceElement) => { 2557 if (initialRef.current) { 2558 return; 2559 } 2560 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 2561 return; 2562 } 2563 store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 2564 x: newX, 2565 y: newY, 2566 axis, 2567 dataRef, 2568 pointerType 2569 })); 2570 }); 2571 const handleReferenceEnterOrMove = useStableCallback((event) => { 2572 if (!open) { 2573 setReference(event.clientX, event.clientY, event.currentTarget); 2574 } else if (!cleanupListenerRef.current) { 2575 setReference(event.clientX, event.clientY, event.currentTarget); 2576 setReactive([]); 2577 } 2578 }); 2579 const openCheck = isMouseLikePointerType(pointerType) ? floating : open; 2580 React17.useEffect(() => { 2581 if (!enabled) { 2582 resetReference(domReference); 2583 return void 0; 2584 } 2585 if (!openCheck) { 2586 return void 0; 2587 } 2588 function cleanupListener() { 2589 cleanupListenerRef.current?.(); 2590 cleanupListenerRef.current = null; 2591 } 2592 const win = getWindow(floating); 2593 function handleMouseMove(event) { 2594 const target = getTarget(event); 2595 if (!contains(floating, target)) { 2596 setReference(event.clientX, event.clientY); 2597 } else { 2598 cleanupListener(); 2599 } 2600 } 2601 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 2602 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 2603 } else { 2604 resetReference(domReference); 2605 } 2606 return cleanupListener; 2607 }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]); 2608 React17.useEffect(() => () => { 2609 store2.set("positionReference", null); 2610 }, [store2]); 2611 React17.useEffect(() => { 2612 if (enabled && !floating) { 2613 initialRef.current = false; 2614 } 2615 }, [enabled, floating]); 2616 React17.useEffect(() => { 2617 if (!enabled && open) { 2618 initialRef.current = true; 2619 } 2620 }, [enabled, open]); 2621 const reference = React17.useMemo(() => { 2622 function setPointerTypeRef(event) { 2623 setPointerType(event.pointerType); 2624 } 2625 return { 2626 onPointerDown: setPointerTypeRef, 2627 onPointerEnter: setPointerTypeRef, 2628 onMouseMove: handleReferenceEnterOrMove, 2629 onMouseEnter: handleReferenceEnterOrMove 2630 }; 2631 }, [handleReferenceEnterOrMove]); 2632 return React17.useMemo(() => enabled ? { 2633 reference, 2634 trigger: reference 2635 } : {}, [enabled, reference]); 2636 } 2637 2638 // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs 2639 var React18 = __toESM(require_react(), 1); 2640 function alwaysFalse() { 2641 return false; 2642 } 2643 function normalizeProp(normalizable) { 2644 return { 2645 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 2646 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 2647 }; 2648 } 2649 function useDismiss(context, props = {}) { 2650 const { 2651 enabled = true, 2652 escapeKey: escapeKey2 = true, 2653 outsidePress: outsidePressProp = true, 2654 outsidePressEvent = "sloppy", 2655 referencePress = alwaysFalse, 2656 bubbles, 2657 externalTree 2658 } = props; 2659 const store2 = "rootStore" in context ? context.rootStore : context; 2660 const open = store2.useState("open"); 2661 const floatingElement = store2.useState("floatingElement"); 2662 const { 2663 dataRef 2664 } = store2.context; 2665 const tree = useFloatingTree(externalTree); 2666 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 2667 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 2668 const outsidePressEnabled = outsidePress2 !== false; 2669 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 2670 const { 2671 escapeKey: escapeKeyBubbles, 2672 outsidePress: outsidePressBubbles 2673 } = normalizeProp(bubbles); 2674 const pressStartedInsideRef = React18.useRef(false); 2675 const pressStartPreventedRef = React18.useRef(false); 2676 const suppressNextOutsideClickRef = React18.useRef(false); 2677 const isComposingRef = React18.useRef(false); 2678 const currentPointerTypeRef = React18.useRef(""); 2679 const touchStateRef = React18.useRef(null); 2680 const cancelDismissOnEndTimeout = useTimeout(); 2681 const clearInsideReactTreeTimeout = useTimeout(); 2682 const clearInsideReactTree = useStableCallback(() => { 2683 clearInsideReactTreeTimeout.clear(); 2684 dataRef.current.insideReactTree = false; 2685 }); 2686 const hasBlockingChild = useStableCallback((bubbleKey) => { 2687 const nodeId = dataRef.current.floatingContext?.nodeId; 2688 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 2689 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); 2690 }); 2691 const isEventWithinOwnElements = useStableCallback((event) => { 2692 return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement")); 2693 }); 2694 const closeOnReferencePress = useStableCallback((event) => { 2695 if (!referencePress()) { 2696 return; 2697 } 2698 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 2699 }); 2700 const closeOnEscapeKeyDown = useStableCallback((event) => { 2701 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") { 2702 return; 2703 } 2704 if (isComposingRef.current) { 2705 return; 2706 } 2707 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { 2708 return; 2709 } 2710 const native = isReactEvent(event) ? event.nativeEvent : event; 2711 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 2712 store2.setOpen(false, eventDetails); 2713 if (!eventDetails.isCanceled) { 2714 event.preventDefault(); 2715 } 2716 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 2717 event.stopPropagation(); 2718 } 2719 }); 2720 const markInsideReactTree = useStableCallback(() => { 2721 dataRef.current.insideReactTree = true; 2722 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 2723 }); 2724 const markPressStartedInsideReactTree = useStableCallback((event) => { 2725 if (!open || !enabled || event.button !== 0) { 2726 return; 2727 } 2728 const target = getTarget(event.nativeEvent); 2729 if (!contains(store2.select("floatingElement"), target)) { 2730 return; 2731 } 2732 if (!pressStartedInsideRef.current) { 2733 pressStartedInsideRef.current = true; 2734 pressStartPreventedRef.current = false; 2735 } 2736 }); 2737 const markInsidePressStartPrevented = useStableCallback((event) => { 2738 if (!open || !enabled) { 2739 return; 2740 } 2741 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 2742 return; 2743 } 2744 if (pressStartedInsideRef.current) { 2745 pressStartPreventedRef.current = true; 2746 } 2747 }); 2748 React18.useEffect(() => { 2749 if (!open || !enabled) { 2750 return void 0; 2751 } 2752 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 2753 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 2754 const compositionTimeout = new Timeout(); 2755 const preventedPressSuppressionTimeout = new Timeout(); 2756 function handleCompositionStart() { 2757 compositionTimeout.clear(); 2758 isComposingRef.current = true; 2759 } 2760 function handleCompositionEnd() { 2761 compositionTimeout.start( 2762 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 2763 // Only apply to WebKit for the test to remain 0ms. 2764 parts_exports.engine.webkit ? 5 : 0, 2765 () => { 2766 isComposingRef.current = false; 2767 } 2768 ); 2769 } 2770 function suppressImmediateOutsideClickAfterPreventedStart() { 2771 suppressNextOutsideClickRef.current = true; 2772 preventedPressSuppressionTimeout.start(0, () => { 2773 suppressNextOutsideClickRef.current = false; 2774 }); 2775 } 2776 function resetPressStartState() { 2777 pressStartedInsideRef.current = false; 2778 pressStartPreventedRef.current = false; 2779 } 2780 function getOutsidePressEvent() { 2781 const type = currentPointerTypeRef.current; 2782 const computedType = type === "pen" || !type ? "mouse" : type; 2783 const outsidePressEventValue = getOutsidePressEventProp(); 2784 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 2785 if (typeof resolved === "string") { 2786 return resolved; 2787 } 2788 return resolved[computedType]; 2789 } 2790 function shouldIgnoreEvent(event) { 2791 const computedOutsidePressEvent = getOutsidePressEvent(); 2792 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 2793 } 2794 function isEventWithinFloatingTree(event) { 2795 const nodeId = dataRef.current.floatingContext?.nodeId; 2796 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 2797 return isEventWithinOwnElements(event) || targetIsInsideChildren; 2798 } 2799 function closeOnPressOutside(event) { 2800 if (shouldIgnoreEvent(event)) { 2801 if (event.type !== "click" && !isEventWithinOwnElements(event)) { 2802 preventedPressSuppressionTimeout.clear(); 2803 suppressNextOutsideClickRef.current = false; 2804 } 2805 clearInsideReactTree(); 2806 return; 2807 } 2808 if (dataRef.current.insideReactTree) { 2809 clearInsideReactTree(); 2810 return; 2811 } 2812 const target = getTarget(event); 2813 const inertSelector = `[$createAttribute("inert")}]`; 2814 const targetRoot = isElement(target) ? target.getRootNode() : null; 2815 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector)); 2816 const triggers = store2.context.triggerElements; 2817 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 2818 return; 2819 } 2820 let targetRootAncestor = isElement(target) ? target : null; 2821 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 2822 const nextParent = getParentNode(targetRootAncestor); 2823 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 2824 break; 2825 } 2826 targetRootAncestor = nextParent; 2827 } 2828 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 2829 !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the 2830 // element was injected after the floating element rendered. 2831 markers.every((marker) => !contains(targetRootAncestor, marker))) { 2832 return; 2833 } 2834 if (isHTMLElement(target) && !("touches" in event)) { 2835 const lastTraversableNode = isLastTraversableNode(target); 2836 const style = getComputedStyle2(target); 2837 const scrollRe = /auto|scroll/; 2838 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 2839 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 2840 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 2841 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 2842 const isRTL6 = style.direction === "rtl"; 2843 const pressedVerticalScrollbar = canScrollY && (isRTL6 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 2844 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 2845 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 2846 return; 2847 } 2848 } 2849 if (isEventWithinFloatingTree(event)) { 2850 return; 2851 } 2852 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) { 2853 preventedPressSuppressionTimeout.clear(); 2854 suppressNextOutsideClickRef.current = false; 2855 return; 2856 } 2857 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 2858 return; 2859 } 2860 if (hasBlockingChild("__outsidePressBubbles")) { 2861 return; 2862 } 2863 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 2864 clearInsideReactTree(); 2865 } 2866 function handlePointerDown(event) { 2867 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { 2868 return; 2869 } 2870 closeOnPressOutside(event); 2871 } 2872 function handleTouchStart(event) { 2873 if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { 2874 return; 2875 } 2876 const touch = event.touches[0]; 2877 if (touch) { 2878 touchStateRef.current = { 2879 startTime: Date.now(), 2880 startX: touch.clientX, 2881 startY: touch.clientY, 2882 dismissOnTouchEnd: false, 2883 dismissOnMouseDown: true 2884 }; 2885 cancelDismissOnEndTimeout.start(1e3, () => { 2886 if (touchStateRef.current) { 2887 touchStateRef.current.dismissOnTouchEnd = false; 2888 touchStateRef.current.dismissOnMouseDown = false; 2889 } 2890 }); 2891 } 2892 } 2893 function addTargetEventListenerOnce(event, listener) { 2894 const target = getTarget(event); 2895 if (!target) { 2896 return; 2897 } 2898 const unsubscribe2 = addEventListener(target, event.type, () => { 2899 listener(event); 2900 unsubscribe2(); 2901 }); 2902 } 2903 function handleTouchStartCapture(event) { 2904 currentPointerTypeRef.current = "touch"; 2905 addTargetEventListenerOnce(event, handleTouchStart); 2906 } 2907 function closeOnPressOutsideCapture(event) { 2908 cancelDismissOnEndTimeout.clear(); 2909 if (event.type === "pointerdown") { 2910 currentPointerTypeRef.current = event.pointerType; 2911 } 2912 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 2913 return; 2914 } 2915 addTargetEventListenerOnce(event, (targetEvent) => { 2916 if (targetEvent.type === "pointerdown") { 2917 handlePointerDown(targetEvent); 2918 } else { 2919 closeOnPressOutside(targetEvent); 2920 } 2921 }); 2922 } 2923 function handlePressEndCapture(event) { 2924 if (!pressStartedInsideRef.current) { 2925 return; 2926 } 2927 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 2928 resetPressStartState(); 2929 if (getOutsidePressEvent() !== "intentional") { 2930 return; 2931 } 2932 if (event.type === "pointercancel") { 2933 if (pressStartedInsideDefaultPrevented) { 2934 suppressImmediateOutsideClickAfterPreventedStart(); 2935 } 2936 return; 2937 } 2938 if (isEventWithinFloatingTree(event)) { 2939 return; 2940 } 2941 if (pressStartedInsideDefaultPrevented) { 2942 suppressImmediateOutsideClickAfterPreventedStart(); 2943 return; 2944 } 2945 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 2946 return; 2947 } 2948 preventedPressSuppressionTimeout.clear(); 2949 suppressNextOutsideClickRef.current = true; 2950 clearInsideReactTree(); 2951 } 2952 function handleTouchMove(event) { 2953 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 2954 return; 2955 } 2956 const touch = event.touches[0]; 2957 if (!touch) { 2958 return; 2959 } 2960 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 2961 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 2962 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 2963 if (distance > 5) { 2964 touchStateRef.current.dismissOnTouchEnd = true; 2965 } 2966 if (distance > 10) { 2967 closeOnPressOutside(event); 2968 cancelDismissOnEndTimeout.clear(); 2969 touchStateRef.current = null; 2970 } 2971 } 2972 function handleTouchMoveCapture(event) { 2973 addTargetEventListenerOnce(event, handleTouchMove); 2974 } 2975 function handleTouchEnd(event) { 2976 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 2977 return; 2978 } 2979 if (touchStateRef.current.dismissOnTouchEnd) { 2980 closeOnPressOutside(event); 2981 } 2982 cancelDismissOnEndTimeout.clear(); 2983 touchStateRef.current = null; 2984 } 2985 function handleTouchEndCapture(event) { 2986 addTargetEventListenerOnce(event, handleTouchEnd); 2987 } 2988 const doc = ownerDocument(floatingElement); 2989 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))); 2990 return () => { 2991 unsubscribe(); 2992 compositionTimeout.clear(); 2993 preventedPressSuppressionTimeout.clear(); 2994 resetPressStartState(); 2995 suppressNextOutsideClickRef.current = false; 2996 }; 2997 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout]); 2998 React18.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]); 2999 const reference = React18.useMemo(() => ({ 3000 onKeyDown: closeOnEscapeKeyDown, 3001 onPointerDown: closeOnReferencePress, 3002 onClick: closeOnReferencePress 3003 }), [closeOnEscapeKeyDown, closeOnReferencePress]); 3004 const floating = React18.useMemo(() => ({ 3005 onKeyDown: closeOnEscapeKeyDown, 3006 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 3007 // `onPointerDown`, such as with <NumberField.ScrubArea>. 3008 // See https://github.com/mui/base-ui/pull/3379 3009 onPointerDown: markInsidePressStartPrevented, 3010 onMouseDown: markInsidePressStartPrevented, 3011 onClickCapture: markInsideReactTree, 3012 onMouseDownCapture(event) { 3013 markInsideReactTree(); 3014 markPressStartedInsideReactTree(event); 3015 }, 3016 onPointerDownCapture(event) { 3017 markInsideReactTree(); 3018 markPressStartedInsideReactTree(event); 3019 }, 3020 onMouseUpCapture: markInsideReactTree, 3021 onTouchEndCapture: markInsideReactTree, 3022 onTouchMoveCapture: markInsideReactTree 3023 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 3024 return React18.useMemo(() => enabled ? { 3025 reference, 3026 floating, 3027 trigger: reference 3028 } : {}, [enabled, reference, floating]); 3029 } 3030 3031 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 3032 var React25 = __toESM(require_react(), 1); 3033 3034 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs 3035 function computeCoordsFromPlacement(_ref, placement, rtl) { 3036 let { 3037 reference, 3038 floating 3039 } = _ref; 3040 const sideAxis = getSideAxis(placement); 3041 const alignmentAxis = getAlignmentAxis(placement); 3042 const alignLength = getAxisLength(alignmentAxis); 3043 const side = getSide(placement); 3044 const isVertical = sideAxis === "y"; 3045 const commonX = reference.x + reference.width / 2 - floating.width / 2; 3046 const commonY = reference.y + reference.height / 2 - floating.height / 2; 3047 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 3048 let coords; 3049 switch (side) { 3050 case "top": 3051 coords = { 3052 x: commonX, 3053 y: reference.y - floating.height 3054 }; 3055 break; 3056 case "bottom": 3057 coords = { 3058 x: commonX, 3059 y: reference.y + reference.height 3060 }; 3061 break; 3062 case "right": 3063 coords = { 3064 x: reference.x + reference.width, 3065 y: commonY 3066 }; 3067 break; 3068 case "left": 3069 coords = { 3070 x: reference.x - floating.width, 3071 y: commonY 3072 }; 3073 break; 3074 default: 3075 coords = { 3076 x: reference.x, 3077 y: reference.y 3078 }; 3079 } 3080 switch (getAlignment(placement)) { 3081 case "start": 3082 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 3083 break; 3084 case "end": 3085 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 3086 break; 3087 } 3088 return coords; 3089 } 3090 async function detectOverflow(state, options) { 3091 var _await$platform$isEle; 3092 if (options === void 0) { 3093 options = {}; 3094 } 3095 const { 3096 x, 3097 y, 3098 platform: platform3, 3099 rects, 3100 elements, 3101 strategy 3102 } = state; 3103 const { 3104 boundary = "clippingAncestors", 3105 rootBoundary = "viewport", 3106 elementContext = "floating", 3107 altBoundary = false, 3108 padding = 0 3109 } = evaluate(options, state); 3110 const paddingObject = getPaddingObject(padding); 3111 const altContext = elementContext === "floating" ? "reference" : "floating"; 3112 const element = elements[altBoundary ? altContext : elementContext]; 3113 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 3114 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)), 3115 boundary, 3116 rootBoundary, 3117 strategy 3118 })); 3119 const rect = elementContext === "floating" ? { 3120 x, 3121 y, 3122 width: rects.floating.width, 3123 height: rects.floating.height 3124 } : rects.reference; 3125 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); 3126 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 3127 x: 1, 3128 y: 1 3129 } : { 3130 x: 1, 3131 y: 1 3132 }; 3133 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 3134 elements, 3135 rect, 3136 offsetParent, 3137 strategy 3138 }) : rect); 3139 return { 3140 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 3141 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 3142 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 3143 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 3144 }; 3145 } 3146 var MAX_RESET_COUNT = 50; 3147 var computePosition = async (reference, floating, config) => { 3148 const { 3149 placement = "bottom", 3150 strategy = "absolute", 3151 middleware = [], 3152 platform: platform3 3153 } = config; 3154 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 3155 ...platform3, 3156 detectOverflow 3157 }; 3158 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 3159 let rects = await platform3.getElementRects({ 3160 reference, 3161 floating, 3162 strategy 3163 }); 3164 let { 3165 x, 3166 y 3167 } = computeCoordsFromPlacement(rects, placement, rtl); 3168 let statefulPlacement = placement; 3169 let resetCount = 0; 3170 const middlewareData = {}; 3171 for (let i = 0; i < middleware.length; i++) { 3172 const currentMiddleware = middleware[i]; 3173 if (!currentMiddleware) { 3174 continue; 3175 } 3176 const { 3177 name, 3178 fn 3179 } = currentMiddleware; 3180 const { 3181 x: nextX, 3182 y: nextY, 3183 data, 3184 reset 3185 } = await fn({ 3186 x, 3187 y, 3188 initialPlacement: placement, 3189 placement: statefulPlacement, 3190 strategy, 3191 middlewareData, 3192 rects, 3193 platform: platformWithDetectOverflow, 3194 elements: { 3195 reference, 3196 floating 3197 } 3198 }); 3199 x = nextX != null ? nextX : x; 3200 y = nextY != null ? nextY : y; 3201 middlewareData[name] = { 3202 ...middlewareData[name], 3203 ...data 3204 }; 3205 if (reset && resetCount < MAX_RESET_COUNT) { 3206 resetCount++; 3207 if (typeof reset === "object") { 3208 if (reset.placement) { 3209 statefulPlacement = reset.placement; 3210 } 3211 if (reset.rects) { 3212 rects = reset.rects === true ? await platform3.getElementRects({ 3213 reference, 3214 floating, 3215 strategy 3216 }) : reset.rects; 3217 } 3218 ({ 3219 x, 3220 y 3221 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 3222 } 3223 i = -1; 3224 } 3225 } 3226 return { 3227 x, 3228 y, 3229 placement: statefulPlacement, 3230 strategy, 3231 middlewareData 3232 }; 3233 }; 3234 var flip = function(options) { 3235 if (options === void 0) { 3236 options = {}; 3237 } 3238 return { 3239 name: "flip", 3240 options, 3241 async fn(state) { 3242 var _middlewareData$arrow, _middlewareData$flip; 3243 const { 3244 placement, 3245 middlewareData, 3246 rects, 3247 initialPlacement, 3248 platform: platform3, 3249 elements 3250 } = state; 3251 const { 3252 mainAxis: checkMainAxis = true, 3253 crossAxis: checkCrossAxis = true, 3254 fallbackPlacements: specifiedFallbackPlacements, 3255 fallbackStrategy = "bestFit", 3256 fallbackAxisSideDirection = "none", 3257 flipAlignment = true, 3258 ...detectOverflowOptions 3259 } = evaluate(options, state); 3260 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 3261 return {}; 3262 } 3263 const side = getSide(placement); 3264 const initialSideAxis = getSideAxis(initialPlacement); 3265 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 3266 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 3267 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 3268 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 3269 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 3270 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 3271 } 3272 const placements2 = [initialPlacement, ...fallbackPlacements]; 3273 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3274 const overflows = []; 3275 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 3276 if (checkMainAxis) { 3277 overflows.push(overflow[side]); 3278 } 3279 if (checkCrossAxis) { 3280 const sides2 = getAlignmentSides(placement, rects, rtl); 3281 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 3282 } 3283 overflowsData = [...overflowsData, { 3284 placement, 3285 overflows 3286 }]; 3287 if (!overflows.every((side2) => side2 <= 0)) { 3288 var _middlewareData$flip2, _overflowsData$filter; 3289 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 3290 const nextPlacement = placements2[nextIndex]; 3291 if (nextPlacement) { 3292 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 3293 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 3294 // overflows the main axis. 3295 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { 3296 return { 3297 data: { 3298 index: nextIndex, 3299 overflows: overflowsData 3300 }, 3301 reset: { 3302 placement: nextPlacement 3303 } 3304 }; 3305 } 3306 } 3307 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; 3308 if (!resetPlacement) { 3309 switch (fallbackStrategy) { 3310 case "bestFit": { 3311 var _overflowsData$filter2; 3312 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { 3313 if (hasFallbackAxisSideDirection) { 3314 const currentSideAxis = getSideAxis(d.placement); 3315 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 3316 // reading directions favoring greater width. 3317 currentSideAxis === "y"; 3318 } 3319 return true; 3320 }).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]; 3321 if (placement2) { 3322 resetPlacement = placement2; 3323 } 3324 break; 3325 } 3326 case "initialPlacement": 3327 resetPlacement = initialPlacement; 3328 break; 3329 } 3330 } 3331 if (placement !== resetPlacement) { 3332 return { 3333 reset: { 3334 placement: resetPlacement 3335 } 3336 }; 3337 } 3338 } 3339 return {}; 3340 } 3341 }; 3342 }; 3343 function getSideOffsets(overflow, rect) { 3344 return { 3345 top: overflow.top - rect.height, 3346 right: overflow.right - rect.width, 3347 bottom: overflow.bottom - rect.height, 3348 left: overflow.left - rect.width 3349 }; 3350 } 3351 function isAnySideFullyClipped(overflow) { 3352 return sides.some((side) => overflow[side] >= 0); 3353 } 3354 var hide = function(options) { 3355 if (options === void 0) { 3356 options = {}; 3357 } 3358 return { 3359 name: "hide", 3360 options, 3361 async fn(state) { 3362 const { 3363 rects, 3364 platform: platform3 3365 } = state; 3366 const { 3367 strategy = "referenceHidden", 3368 ...detectOverflowOptions 3369 } = evaluate(options, state); 3370 switch (strategy) { 3371 case "referenceHidden": { 3372 const overflow = await platform3.detectOverflow(state, { 3373 ...detectOverflowOptions, 3374 elementContext: "reference" 3375 }); 3376 const offsets = getSideOffsets(overflow, rects.reference); 3377 return { 3378 data: { 3379 referenceHiddenOffsets: offsets, 3380 referenceHidden: isAnySideFullyClipped(offsets) 3381 } 3382 }; 3383 } 3384 case "escaped": { 3385 const overflow = await platform3.detectOverflow(state, { 3386 ...detectOverflowOptions, 3387 altBoundary: true 3388 }); 3389 const offsets = getSideOffsets(overflow, rects.floating); 3390 return { 3391 data: { 3392 escapedOffsets: offsets, 3393 escaped: isAnySideFullyClipped(offsets) 3394 } 3395 }; 3396 } 3397 default: { 3398 return {}; 3399 } 3400 } 3401 } 3402 }; 3403 }; 3404 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 3405 async function convertValueToCoords(state, options) { 3406 const { 3407 placement, 3408 platform: platform3, 3409 elements 3410 } = state; 3411 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 3412 const side = getSide(placement); 3413 const alignment = getAlignment(placement); 3414 const isVertical = getSideAxis(placement) === "y"; 3415 const mainAxisMulti = originSides.has(side) ? -1 : 1; 3416 const crossAxisMulti = rtl && isVertical ? -1 : 1; 3417 const rawValue = evaluate(options, state); 3418 let { 3419 mainAxis, 3420 crossAxis, 3421 alignmentAxis 3422 } = typeof rawValue === "number" ? { 3423 mainAxis: rawValue, 3424 crossAxis: 0, 3425 alignmentAxis: null 3426 } : { 3427 mainAxis: rawValue.mainAxis || 0, 3428 crossAxis: rawValue.crossAxis || 0, 3429 alignmentAxis: rawValue.alignmentAxis 3430 }; 3431 if (alignment && typeof alignmentAxis === "number") { 3432 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 3433 } 3434 return isVertical ? { 3435 x: crossAxis * crossAxisMulti, 3436 y: mainAxis * mainAxisMulti 3437 } : { 3438 x: mainAxis * mainAxisMulti, 3439 y: crossAxis * crossAxisMulti 3440 }; 3441 } 3442 var offset = function(options) { 3443 if (options === void 0) { 3444 options = 0; 3445 } 3446 return { 3447 name: "offset", 3448 options, 3449 async fn(state) { 3450 var _middlewareData$offse, _middlewareData$arrow; 3451 const { 3452 x, 3453 y, 3454 placement, 3455 middlewareData 3456 } = state; 3457 const diffCoords = await convertValueToCoords(state, options); 3458 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 3459 return {}; 3460 } 3461 return { 3462 x: x + diffCoords.x, 3463 y: y + diffCoords.y, 3464 data: { 3465 ...diffCoords, 3466 placement 3467 } 3468 }; 3469 } 3470 }; 3471 }; 3472 var shift = function(options) { 3473 if (options === void 0) { 3474 options = {}; 3475 } 3476 return { 3477 name: "shift", 3478 options, 3479 async fn(state) { 3480 const { 3481 x, 3482 y, 3483 placement, 3484 platform: platform3 3485 } = state; 3486 const { 3487 mainAxis: checkMainAxis = true, 3488 crossAxis: checkCrossAxis = false, 3489 limiter = { 3490 fn: (_ref) => { 3491 let { 3492 x: x2, 3493 y: y2 3494 } = _ref; 3495 return { 3496 x: x2, 3497 y: y2 3498 }; 3499 } 3500 }, 3501 ...detectOverflowOptions 3502 } = evaluate(options, state); 3503 const coords = { 3504 x, 3505 y 3506 }; 3507 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3508 const crossAxis = getSideAxis(getSide(placement)); 3509 const mainAxis = getOppositeAxis(crossAxis); 3510 let mainAxisCoord = coords[mainAxis]; 3511 let crossAxisCoord = coords[crossAxis]; 3512 if (checkMainAxis) { 3513 const minSide = mainAxis === "y" ? "top" : "left"; 3514 const maxSide = mainAxis === "y" ? "bottom" : "right"; 3515 const min2 = mainAxisCoord + overflow[minSide]; 3516 const max2 = mainAxisCoord - overflow[maxSide]; 3517 mainAxisCoord = clamp(min2, mainAxisCoord, max2); 3518 } 3519 if (checkCrossAxis) { 3520 const minSide = crossAxis === "y" ? "top" : "left"; 3521 const maxSide = crossAxis === "y" ? "bottom" : "right"; 3522 const min2 = crossAxisCoord + overflow[minSide]; 3523 const max2 = crossAxisCoord - overflow[maxSide]; 3524 crossAxisCoord = clamp(min2, crossAxisCoord, max2); 3525 } 3526 const limitedCoords = limiter.fn({ 3527 ...state, 3528 [mainAxis]: mainAxisCoord, 3529 [crossAxis]: crossAxisCoord 3530 }); 3531 return { 3532 ...limitedCoords, 3533 data: { 3534 x: limitedCoords.x - x, 3535 y: limitedCoords.y - y, 3536 enabled: { 3537 [mainAxis]: checkMainAxis, 3538 [crossAxis]: checkCrossAxis 3539 } 3540 } 3541 }; 3542 } 3543 }; 3544 }; 3545 var limitShift = function(options) { 3546 if (options === void 0) { 3547 options = {}; 3548 } 3549 return { 3550 options, 3551 fn(state) { 3552 const { 3553 x, 3554 y, 3555 placement, 3556 rects, 3557 middlewareData 3558 } = state; 3559 const { 3560 offset: offset4 = 0, 3561 mainAxis: checkMainAxis = true, 3562 crossAxis: checkCrossAxis = true 3563 } = evaluate(options, state); 3564 const coords = { 3565 x, 3566 y 3567 }; 3568 const crossAxis = getSideAxis(placement); 3569 const mainAxis = getOppositeAxis(crossAxis); 3570 let mainAxisCoord = coords[mainAxis]; 3571 let crossAxisCoord = coords[crossAxis]; 3572 const rawOffset = evaluate(offset4, state); 3573 const computedOffset = typeof rawOffset === "number" ? { 3574 mainAxis: rawOffset, 3575 crossAxis: 0 3576 } : { 3577 mainAxis: 0, 3578 crossAxis: 0, 3579 ...rawOffset 3580 }; 3581 if (checkMainAxis) { 3582 const len = mainAxis === "y" ? "height" : "width"; 3583 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 3584 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 3585 if (mainAxisCoord < limitMin) { 3586 mainAxisCoord = limitMin; 3587 } else if (mainAxisCoord > limitMax) { 3588 mainAxisCoord = limitMax; 3589 } 3590 } 3591 if (checkCrossAxis) { 3592 var _middlewareData$offse, _middlewareData$offse2; 3593 const len = mainAxis === "y" ? "width" : "height"; 3594 const isOriginSide = originSides.has(getSide(placement)); 3595 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); 3596 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); 3597 if (crossAxisCoord < limitMin) { 3598 crossAxisCoord = limitMin; 3599 } else if (crossAxisCoord > limitMax) { 3600 crossAxisCoord = limitMax; 3601 } 3602 } 3603 return { 3604 [mainAxis]: mainAxisCoord, 3605 [crossAxis]: crossAxisCoord 3606 }; 3607 } 3608 }; 3609 }; 3610 var size = function(options) { 3611 if (options === void 0) { 3612 options = {}; 3613 } 3614 return { 3615 name: "size", 3616 options, 3617 async fn(state) { 3618 var _state$middlewareData, _state$middlewareData2; 3619 const { 3620 placement, 3621 rects, 3622 platform: platform3, 3623 elements 3624 } = state; 3625 const { 3626 apply = () => { 3627 }, 3628 ...detectOverflowOptions 3629 } = evaluate(options, state); 3630 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3631 const side = getSide(placement); 3632 const alignment = getAlignment(placement); 3633 const isYAxis = getSideAxis(placement) === "y"; 3634 const { 3635 width, 3636 height 3637 } = rects.floating; 3638 let heightSide; 3639 let widthSide; 3640 if (side === "top" || side === "bottom") { 3641 heightSide = side; 3642 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; 3643 } else { 3644 widthSide = side; 3645 heightSide = alignment === "end" ? "top" : "bottom"; 3646 } 3647 const maximumClippingHeight = height - overflow.top - overflow.bottom; 3648 const maximumClippingWidth = width - overflow.left - overflow.right; 3649 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 3650 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 3651 const noShift = !state.middlewareData.shift; 3652 let availableHeight = overflowAvailableHeight; 3653 let availableWidth = overflowAvailableWidth; 3654 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { 3655 availableWidth = maximumClippingWidth; 3656 } 3657 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { 3658 availableHeight = maximumClippingHeight; 3659 } 3660 if (noShift && !alignment) { 3661 const xMin = max(overflow.left, 0); 3662 const xMax = max(overflow.right, 0); 3663 const yMin = max(overflow.top, 0); 3664 const yMax = max(overflow.bottom, 0); 3665 if (isYAxis) { 3666 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); 3667 } else { 3668 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); 3669 } 3670 } 3671 await apply({ 3672 ...state, 3673 availableWidth, 3674 availableHeight 3675 }); 3676 const nextDimensions = await platform3.getDimensions(elements.floating); 3677 if (width !== nextDimensions.width || height !== nextDimensions.height) { 3678 return { 3679 reset: { 3680 rects: true 3681 } 3682 }; 3683 } 3684 return {}; 3685 } 3686 }; 3687 }; 3688 3689 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 3690 function getCssDimensions(element) { 3691 const css = getComputedStyle2(element); 3692 let width = parseFloat(css.width) || 0; 3693 let height = parseFloat(css.height) || 0; 3694 const hasOffset = isHTMLElement(element); 3695 const offsetWidth = hasOffset ? element.offsetWidth : width; 3696 const offsetHeight = hasOffset ? element.offsetHeight : height; 3697 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 3698 if (shouldFallback) { 3699 width = offsetWidth; 3700 height = offsetHeight; 3701 } 3702 return { 3703 width, 3704 height, 3705 $: shouldFallback 3706 }; 3707 } 3708 function unwrapElement(element) { 3709 return !isElement(element) ? element.contextElement : element; 3710 } 3711 function getScale(element) { 3712 const domElement = unwrapElement(element); 3713 if (!isHTMLElement(domElement)) { 3714 return createCoords(1); 3715 } 3716 const rect = domElement.getBoundingClientRect(); 3717 const { 3718 width, 3719 height, 3720 $ 3721 } = getCssDimensions(domElement); 3722 let x = ($ ? round(rect.width) : rect.width) / width; 3723 let y = ($ ? round(rect.height) : rect.height) / height; 3724 if (!x || !Number.isFinite(x)) { 3725 x = 1; 3726 } 3727 if (!y || !Number.isFinite(y)) { 3728 y = 1; 3729 } 3730 return { 3731 x, 3732 y 3733 }; 3734 } 3735 var noOffsets = /* @__PURE__ */ createCoords(0); 3736 function getVisualOffsets(element) { 3737 const win = getWindow(element); 3738 if (!isWebKit() || !win.visualViewport) { 3739 return noOffsets; 3740 } 3741 return { 3742 x: win.visualViewport.offsetLeft, 3743 y: win.visualViewport.offsetTop 3744 }; 3745 } 3746 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 3747 if (isFixed === void 0) { 3748 isFixed = false; 3749 } 3750 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 3751 return false; 3752 } 3753 return isFixed; 3754 } 3755 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 3756 if (includeScale === void 0) { 3757 includeScale = false; 3758 } 3759 if (isFixedStrategy === void 0) { 3760 isFixedStrategy = false; 3761 } 3762 const clientRect = element.getBoundingClientRect(); 3763 const domElement = unwrapElement(element); 3764 let scale = createCoords(1); 3765 if (includeScale) { 3766 if (offsetParent) { 3767 if (isElement(offsetParent)) { 3768 scale = getScale(offsetParent); 3769 } 3770 } else { 3771 scale = getScale(element); 3772 } 3773 } 3774 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 3775 let x = (clientRect.left + visualOffsets.x) / scale.x; 3776 let y = (clientRect.top + visualOffsets.y) / scale.y; 3777 let width = clientRect.width / scale.x; 3778 let height = clientRect.height / scale.y; 3779 if (domElement) { 3780 const win = getWindow(domElement); 3781 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 3782 let currentWin = win; 3783 let currentIFrame = getFrameElement(currentWin); 3784 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 3785 const iframeScale = getScale(currentIFrame); 3786 const iframeRect = currentIFrame.getBoundingClientRect(); 3787 const css = getComputedStyle2(currentIFrame); 3788 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 3789 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 3790 x *= iframeScale.x; 3791 y *= iframeScale.y; 3792 width *= iframeScale.x; 3793 height *= iframeScale.y; 3794 x += left; 3795 y += top; 3796 currentWin = getWindow(currentIFrame); 3797 currentIFrame = getFrameElement(currentWin); 3798 } 3799 } 3800 return rectToClientRect({ 3801 width, 3802 height, 3803 x, 3804 y 3805 }); 3806 } 3807 function getWindowScrollBarX(element, rect) { 3808 const leftScroll = getNodeScroll(element).scrollLeft; 3809 if (!rect) { 3810 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 3811 } 3812 return rect.left + leftScroll; 3813 } 3814 function getHTMLOffset(documentElement, scroll) { 3815 const htmlRect = documentElement.getBoundingClientRect(); 3816 const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 3817 const y = htmlRect.top + scroll.scrollTop; 3818 return { 3819 x, 3820 y 3821 }; 3822 } 3823 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 3824 let { 3825 elements, 3826 rect, 3827 offsetParent, 3828 strategy 3829 } = _ref; 3830 const isFixed = strategy === "fixed"; 3831 const documentElement = getDocumentElement(offsetParent); 3832 const topLayer = elements ? isTopLayer(elements.floating) : false; 3833 if (offsetParent === documentElement || topLayer && isFixed) { 3834 return rect; 3835 } 3836 let scroll = { 3837 scrollLeft: 0, 3838 scrollTop: 0 3839 }; 3840 let scale = createCoords(1); 3841 const offsets = createCoords(0); 3842 const isOffsetParentAnElement = isHTMLElement(offsetParent); 3843 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 3844 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 3845 scroll = getNodeScroll(offsetParent); 3846 } 3847 if (isOffsetParentAnElement) { 3848 const offsetRect = getBoundingClientRect(offsetParent); 3849 scale = getScale(offsetParent); 3850 offsets.x = offsetRect.x + offsetParent.clientLeft; 3851 offsets.y = offsetRect.y + offsetParent.clientTop; 3852 } 3853 } 3854 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 3855 return { 3856 width: rect.width * scale.x, 3857 height: rect.height * scale.y, 3858 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 3859 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 3860 }; 3861 } 3862 function getClientRects(element) { 3863 return Array.from(element.getClientRects()); 3864 } 3865 function getDocumentRect(element) { 3866 const html = getDocumentElement(element); 3867 const scroll = getNodeScroll(element); 3868 const body = element.ownerDocument.body; 3869 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 3870 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 3871 let x = -scroll.scrollLeft + getWindowScrollBarX(element); 3872 const y = -scroll.scrollTop; 3873 if (getComputedStyle2(body).direction === "rtl") { 3874 x += max(html.clientWidth, body.clientWidth) - width; 3875 } 3876 return { 3877 width, 3878 height, 3879 x, 3880 y 3881 }; 3882 } 3883 var SCROLLBAR_MAX = 25; 3884 function getViewportRect(element, strategy) { 3885 const win = getWindow(element); 3886 const html = getDocumentElement(element); 3887 const visualViewport = win.visualViewport; 3888 let width = html.clientWidth; 3889 let height = html.clientHeight; 3890 let x = 0; 3891 let y = 0; 3892 if (visualViewport) { 3893 width = visualViewport.width; 3894 height = visualViewport.height; 3895 const visualViewportBased = isWebKit(); 3896 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 3897 x = visualViewport.offsetLeft; 3898 y = visualViewport.offsetTop; 3899 } 3900 } 3901 const windowScrollbarX = getWindowScrollBarX(html); 3902 if (windowScrollbarX <= 0) { 3903 const doc = html.ownerDocument; 3904 const body = doc.body; 3905 const bodyStyles = getComputedStyle(body); 3906 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 3907 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 3908 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { 3909 width -= clippingStableScrollbarWidth; 3910 } 3911 } else if (windowScrollbarX <= SCROLLBAR_MAX) { 3912 width += windowScrollbarX; 3913 } 3914 return { 3915 width, 3916 height, 3917 x, 3918 y 3919 }; 3920 } 3921 function getInnerBoundingClientRect(element, strategy) { 3922 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 3923 const top = clientRect.top + element.clientTop; 3924 const left = clientRect.left + element.clientLeft; 3925 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 3926 const width = element.clientWidth * scale.x; 3927 const height = element.clientHeight * scale.y; 3928 const x = left * scale.x; 3929 const y = top * scale.y; 3930 return { 3931 width, 3932 height, 3933 x, 3934 y 3935 }; 3936 } 3937 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 3938 let rect; 3939 if (clippingAncestor === "viewport") { 3940 rect = getViewportRect(element, strategy); 3941 } else if (clippingAncestor === "document") { 3942 rect = getDocumentRect(getDocumentElement(element)); 3943 } else if (isElement(clippingAncestor)) { 3944 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 3945 } else { 3946 const visualOffsets = getVisualOffsets(element); 3947 rect = { 3948 x: clippingAncestor.x - visualOffsets.x, 3949 y: clippingAncestor.y - visualOffsets.y, 3950 width: clippingAncestor.width, 3951 height: clippingAncestor.height 3952 }; 3953 } 3954 return rectToClientRect(rect); 3955 } 3956 function hasFixedPositionAncestor(element, stopNode) { 3957 const parentNode = getParentNode(element); 3958 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 3959 return false; 3960 } 3961 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 3962 } 3963 function getClippingElementAncestors(element, cache) { 3964 const cachedResult = cache.get(element); 3965 if (cachedResult) { 3966 return cachedResult; 3967 } 3968 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 3969 let currentContainingBlockComputedStyle = null; 3970 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 3971 let currentNode = elementIsFixed ? getParentNode(element) : element; 3972 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 3973 const computedStyle = getComputedStyle2(currentNode); 3974 const currentNodeIsContaining = isContainingBlock(currentNode); 3975 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 3976 currentContainingBlockComputedStyle = null; 3977 } 3978 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 3979 if (shouldDropCurrentNode) { 3980 result = result.filter((ancestor) => ancestor !== currentNode); 3981 } else { 3982 currentContainingBlockComputedStyle = computedStyle; 3983 } 3984 currentNode = getParentNode(currentNode); 3985 } 3986 cache.set(element, result); 3987 return result; 3988 } 3989 function getClippingRect(_ref) { 3990 let { 3991 element, 3992 boundary, 3993 rootBoundary, 3994 strategy 3995 } = _ref; 3996 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 3997 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 3998 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 3999 let top = firstRect.top; 4000 let right = firstRect.right; 4001 let bottom = firstRect.bottom; 4002 let left = firstRect.left; 4003 for (let i = 1; i < clippingAncestors.length; i++) { 4004 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); 4005 top = max(rect.top, top); 4006 right = min(rect.right, right); 4007 bottom = min(rect.bottom, bottom); 4008 left = max(rect.left, left); 4009 } 4010 return { 4011 width: right - left, 4012 height: bottom - top, 4013 x: left, 4014 y: top 4015 }; 4016 } 4017 function getDimensions(element) { 4018 const { 4019 width, 4020 height 4021 } = getCssDimensions(element); 4022 return { 4023 width, 4024 height 4025 }; 4026 } 4027 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 4028 const isOffsetParentAnElement = isHTMLElement(offsetParent); 4029 const documentElement = getDocumentElement(offsetParent); 4030 const isFixed = strategy === "fixed"; 4031 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 4032 let scroll = { 4033 scrollLeft: 0, 4034 scrollTop: 0 4035 }; 4036 const offsets = createCoords(0); 4037 function setLeftRTLScrollbarOffset() { 4038 offsets.x = getWindowScrollBarX(documentElement); 4039 } 4040 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 4041 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 4042 scroll = getNodeScroll(offsetParent); 4043 } 4044 if (isOffsetParentAnElement) { 4045 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 4046 offsets.x = offsetRect.x + offsetParent.clientLeft; 4047 offsets.y = offsetRect.y + offsetParent.clientTop; 4048 } else if (documentElement) { 4049 setLeftRTLScrollbarOffset(); 4050 } 4051 } 4052 if (isFixed && !isOffsetParentAnElement && documentElement) { 4053 setLeftRTLScrollbarOffset(); 4054 } 4055 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 4056 const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 4057 const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 4058 return { 4059 x, 4060 y, 4061 width: rect.width, 4062 height: rect.height 4063 }; 4064 } 4065 function isStaticPositioned(element) { 4066 return getComputedStyle2(element).position === "static"; 4067 } 4068 function getTrueOffsetParent(element, polyfill) { 4069 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 4070 return null; 4071 } 4072 if (polyfill) { 4073 return polyfill(element); 4074 } 4075 let rawOffsetParent = element.offsetParent; 4076 if (getDocumentElement(element) === rawOffsetParent) { 4077 rawOffsetParent = rawOffsetParent.ownerDocument.body; 4078 } 4079 return rawOffsetParent; 4080 } 4081 function getOffsetParent(element, polyfill) { 4082 const win = getWindow(element); 4083 if (isTopLayer(element)) { 4084 return win; 4085 } 4086 if (!isHTMLElement(element)) { 4087 let svgOffsetParent = getParentNode(element); 4088 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 4089 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 4090 return svgOffsetParent; 4091 } 4092 svgOffsetParent = getParentNode(svgOffsetParent); 4093 } 4094 return win; 4095 } 4096 let offsetParent = getTrueOffsetParent(element, polyfill); 4097 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 4098 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 4099 } 4100 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 4101 return win; 4102 } 4103 return offsetParent || getContainingBlock(element) || win; 4104 } 4105 var getElementRects = async function(data) { 4106 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 4107 const getDimensionsFn = this.getDimensions; 4108 const floatingDimensions = await getDimensionsFn(data.floating); 4109 return { 4110 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 4111 floating: { 4112 x: 0, 4113 y: 0, 4114 width: floatingDimensions.width, 4115 height: floatingDimensions.height 4116 } 4117 }; 4118 }; 4119 function isRTL(element) { 4120 return getComputedStyle2(element).direction === "rtl"; 4121 } 4122 var platform2 = { 4123 convertOffsetParentRelativeRectToViewportRelativeRect, 4124 getDocumentElement, 4125 getClippingRect, 4126 getOffsetParent, 4127 getElementRects, 4128 getClientRects, 4129 getDimensions, 4130 getScale, 4131 isElement, 4132 isRTL 4133 }; 4134 function rectsAreEqual(a, b) { 4135 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; 4136 } 4137 function observeMove(element, onMove) { 4138 let io = null; 4139 let timeoutId; 4140 const root = getDocumentElement(element); 4141 function cleanup() { 4142 var _io; 4143 clearTimeout(timeoutId); 4144 (_io = io) == null || _io.disconnect(); 4145 io = null; 4146 } 4147 function refresh(skip, threshold) { 4148 if (skip === void 0) { 4149 skip = false; 4150 } 4151 if (threshold === void 0) { 4152 threshold = 1; 4153 } 4154 cleanup(); 4155 const elementRectForRootMargin = element.getBoundingClientRect(); 4156 const { 4157 left, 4158 top, 4159 width, 4160 height 4161 } = elementRectForRootMargin; 4162 if (!skip) { 4163 onMove(); 4164 } 4165 if (!width || !height) { 4166 return; 4167 } 4168 const insetTop = floor(top); 4169 const insetRight = floor(root.clientWidth - (left + width)); 4170 const insetBottom = floor(root.clientHeight - (top + height)); 4171 const insetLeft = floor(left); 4172 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 4173 const options = { 4174 rootMargin, 4175 threshold: max(0, min(1, threshold)) || 1 4176 }; 4177 let isFirstUpdate = true; 4178 function handleObserve(entries) { 4179 const ratio = entries[0].intersectionRatio; 4180 if (ratio !== threshold) { 4181 if (!isFirstUpdate) { 4182 return refresh(); 4183 } 4184 if (!ratio) { 4185 timeoutId = setTimeout(() => { 4186 refresh(false, 1e-7); 4187 }, 1e3); 4188 } else { 4189 refresh(false, ratio); 4190 } 4191 } 4192 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 4193 refresh(); 4194 } 4195 isFirstUpdate = false; 4196 } 4197 try { 4198 io = new IntersectionObserver(handleObserve, { 4199 ...options, 4200 // Handle <iframe>s 4201 root: root.ownerDocument 4202 }); 4203 } catch (_e) { 4204 io = new IntersectionObserver(handleObserve, options); 4205 } 4206 io.observe(element); 4207 } 4208 refresh(true); 4209 return cleanup; 4210 } 4211 function autoUpdate(reference, floating, update2, options) { 4212 if (options === void 0) { 4213 options = {}; 4214 } 4215 const { 4216 ancestorScroll = true, 4217 ancestorResize = true, 4218 elementResize = typeof ResizeObserver === "function", 4219 layoutShift = typeof IntersectionObserver === "function", 4220 animationFrame = false 4221 } = options; 4222 const referenceEl = unwrapElement(reference); 4223 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 4224 ancestors.forEach((ancestor) => { 4225 ancestorScroll && ancestor.addEventListener("scroll", update2, { 4226 passive: true 4227 }); 4228 ancestorResize && ancestor.addEventListener("resize", update2); 4229 }); 4230 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null; 4231 let reobserveFrame = -1; 4232 let resizeObserver = null; 4233 if (elementResize) { 4234 resizeObserver = new ResizeObserver((_ref) => { 4235 let [firstEntry] = _ref; 4236 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 4237 resizeObserver.unobserve(floating); 4238 cancelAnimationFrame(reobserveFrame); 4239 reobserveFrame = requestAnimationFrame(() => { 4240 var _resizeObserver; 4241 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 4242 }); 4243 } 4244 update2(); 4245 }); 4246 if (referenceEl && !animationFrame) { 4247 resizeObserver.observe(referenceEl); 4248 } 4249 if (floating) { 4250 resizeObserver.observe(floating); 4251 } 4252 } 4253 let frameId; 4254 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 4255 if (animationFrame) { 4256 frameLoop(); 4257 } 4258 function frameLoop() { 4259 const nextRefRect = getBoundingClientRect(reference); 4260 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 4261 update2(); 4262 } 4263 prevRefRect = nextRefRect; 4264 frameId = requestAnimationFrame(frameLoop); 4265 } 4266 update2(); 4267 return () => { 4268 var _resizeObserver2; 4269 ancestors.forEach((ancestor) => { 4270 ancestorScroll && ancestor.removeEventListener("scroll", update2); 4271 ancestorResize && ancestor.removeEventListener("resize", update2); 4272 }); 4273 cleanupIo == null || cleanupIo(); 4274 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 4275 resizeObserver = null; 4276 if (animationFrame) { 4277 cancelAnimationFrame(frameId); 4278 } 4279 }; 4280 } 4281 var offset2 = offset; 4282 var shift2 = shift; 4283 var flip2 = flip; 4284 var size2 = size; 4285 var hide2 = hide; 4286 var limitShift2 = limitShift; 4287 var computePosition2 = (reference, floating, options) => { 4288 const cache = /* @__PURE__ */ new Map(); 4289 const mergedOptions = { 4290 platform: platform2, 4291 ...options 4292 }; 4293 const platformWithCache = { 4294 ...mergedOptions.platform, 4295 _c: cache 4296 }; 4297 return computePosition(reference, floating, { 4298 ...mergedOptions, 4299 platform: platformWithCache 4300 }); 4301 }; 4302 4303 // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 4304 var React19 = __toESM(require_react(), 1); 4305 var import_react2 = __toESM(require_react(), 1); 4306 var ReactDOM3 = __toESM(require_react_dom(), 1); 4307 var isClient = typeof document !== "undefined"; 4308 var noop2 = function noop3() { 4309 }; 4310 var index = isClient ? import_react2.useLayoutEffect : noop2; 4311 function deepEqual(a, b) { 4312 if (a === b) { 4313 return true; 4314 } 4315 if (typeof a !== typeof b) { 4316 return false; 4317 } 4318 if (typeof a === "function" && a.toString() === b.toString()) { 4319 return true; 4320 } 4321 let length; 4322 let i; 4323 let keys; 4324 if (a && b && typeof a === "object") { 4325 if (Array.isArray(a)) { 4326 length = a.length; 4327 if (length !== b.length) return false; 4328 for (i = length; i-- !== 0; ) { 4329 if (!deepEqual(a[i], b[i])) { 4330 return false; 4331 } 4332 } 4333 return true; 4334 } 4335 keys = Object.keys(a); 4336 length = keys.length; 4337 if (length !== Object.keys(b).length) { 4338 return false; 4339 } 4340 for (i = length; i-- !== 0; ) { 4341 if (!{}.hasOwnProperty.call(b, keys[i])) { 4342 return false; 4343 } 4344 } 4345 for (i = length; i-- !== 0; ) { 4346 const key = keys[i]; 4347 if (key === "_owner" && a.$$typeof) { 4348 continue; 4349 } 4350 if (!deepEqual(a[key], b[key])) { 4351 return false; 4352 } 4353 } 4354 return true; 4355 } 4356 return a !== a && b !== b; 4357 } 4358 function getDPR(element) { 4359 if (typeof window === "undefined") { 4360 return 1; 4361 } 4362 const win = element.ownerDocument.defaultView || window; 4363 return win.devicePixelRatio || 1; 4364 } 4365 function roundByDPR(element, value) { 4366 const dpr = getDPR(element); 4367 return Math.round(value * dpr) / dpr; 4368 } 4369 function useLatestRef(value) { 4370 const ref = React19.useRef(value); 4371 index(() => { 4372 ref.current = value; 4373 }); 4374 return ref; 4375 } 4376 function useFloating(options) { 4377 if (options === void 0) { 4378 options = {}; 4379 } 4380 const { 4381 placement = "bottom", 4382 strategy = "absolute", 4383 middleware = [], 4384 platform: platform3, 4385 elements: { 4386 reference: externalReference, 4387 floating: externalFloating 4388 } = {}, 4389 transform = true, 4390 whileElementsMounted, 4391 open 4392 } = options; 4393 const [data, setData] = React19.useState({ 4394 x: 0, 4395 y: 0, 4396 strategy, 4397 placement, 4398 middlewareData: {}, 4399 isPositioned: false 4400 }); 4401 const [latestMiddleware, setLatestMiddleware] = React19.useState(middleware); 4402 if (!deepEqual(latestMiddleware, middleware)) { 4403 setLatestMiddleware(middleware); 4404 } 4405 const [_reference, _setReference] = React19.useState(null); 4406 const [_floating, _setFloating] = React19.useState(null); 4407 const setReference = React19.useCallback((node) => { 4408 if (node !== referenceRef.current) { 4409 referenceRef.current = node; 4410 _setReference(node); 4411 } 4412 }, []); 4413 const setFloating = React19.useCallback((node) => { 4414 if (node !== floatingRef.current) { 4415 floatingRef.current = node; 4416 _setFloating(node); 4417 } 4418 }, []); 4419 const referenceEl = externalReference || _reference; 4420 const floatingEl = externalFloating || _floating; 4421 const referenceRef = React19.useRef(null); 4422 const floatingRef = React19.useRef(null); 4423 const dataRef = React19.useRef(data); 4424 const hasWhileElementsMounted = whileElementsMounted != null; 4425 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 4426 const platformRef = useLatestRef(platform3); 4427 const openRef = useLatestRef(open); 4428 const update2 = React19.useCallback(() => { 4429 if (!referenceRef.current || !floatingRef.current) { 4430 return; 4431 } 4432 const config = { 4433 placement, 4434 strategy, 4435 middleware: latestMiddleware 4436 }; 4437 if (platformRef.current) { 4438 config.platform = platformRef.current; 4439 } 4440 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { 4441 const fullData = { 4442 ...data2, 4443 // The floating element's position may be recomputed while it's closed 4444 // but still mounted (such as when transitioning out). To ensure 4445 // `isPositioned` will be `false` initially on the next open, avoid 4446 // setting it to `true` when `open === false` (must be specified). 4447 isPositioned: openRef.current !== false 4448 }; 4449 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 4450 dataRef.current = fullData; 4451 ReactDOM3.flushSync(() => { 4452 setData(fullData); 4453 }); 4454 } 4455 }); 4456 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 4457 index(() => { 4458 if (open === false && dataRef.current.isPositioned) { 4459 dataRef.current.isPositioned = false; 4460 setData((data2) => ({ 4461 ...data2, 4462 isPositioned: false 4463 })); 4464 } 4465 }, [open]); 4466 const isMountedRef = React19.useRef(false); 4467 index(() => { 4468 isMountedRef.current = true; 4469 return () => { 4470 isMountedRef.current = false; 4471 }; 4472 }, []); 4473 index(() => { 4474 if (referenceEl) referenceRef.current = referenceEl; 4475 if (floatingEl) floatingRef.current = floatingEl; 4476 if (referenceEl && floatingEl) { 4477 if (whileElementsMountedRef.current) { 4478 return whileElementsMountedRef.current(referenceEl, floatingEl, update2); 4479 } 4480 update2(); 4481 } 4482 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); 4483 const refs = React19.useMemo(() => ({ 4484 reference: referenceRef, 4485 floating: floatingRef, 4486 setReference, 4487 setFloating 4488 }), [setReference, setFloating]); 4489 const elements = React19.useMemo(() => ({ 4490 reference: referenceEl, 4491 floating: floatingEl 4492 }), [referenceEl, floatingEl]); 4493 const floatingStyles = React19.useMemo(() => { 4494 const initialStyles = { 4495 position: strategy, 4496 left: 0, 4497 top: 0 4498 }; 4499 if (!elements.floating) { 4500 return initialStyles; 4501 } 4502 const x = roundByDPR(elements.floating, data.x); 4503 const y = roundByDPR(elements.floating, data.y); 4504 if (transform) { 4505 return { 4506 ...initialStyles, 4507 transform: "translate(" + x + "px, " + y + "px)", 4508 ...getDPR(elements.floating) >= 1.5 && { 4509 willChange: "transform" 4510 } 4511 }; 4512 } 4513 return { 4514 position: strategy, 4515 left: x, 4516 top: y 4517 }; 4518 }, [strategy, transform, elements.floating, data.x, data.y]); 4519 return React19.useMemo(() => ({ 4520 ...data, 4521 update: update2, 4522 refs, 4523 elements, 4524 floatingStyles 4525 }), [data, update2, refs, elements, floatingStyles]); 4526 } 4527 var offset3 = (options, deps) => { 4528 const result = offset2(options); 4529 return { 4530 name: result.name, 4531 fn: result.fn, 4532 options: [options, deps] 4533 }; 4534 }; 4535 var shift3 = (options, deps) => { 4536 const result = shift2(options); 4537 return { 4538 name: result.name, 4539 fn: result.fn, 4540 options: [options, deps] 4541 }; 4542 }; 4543 var limitShift3 = (options, deps) => { 4544 const result = limitShift2(options); 4545 return { 4546 fn: result.fn, 4547 options: [options, deps] 4548 }; 4549 }; 4550 var flip3 = (options, deps) => { 4551 const result = flip2(options); 4552 return { 4553 name: result.name, 4554 fn: result.fn, 4555 options: [options, deps] 4556 }; 4557 }; 4558 var size3 = (options, deps) => { 4559 const result = size2(options); 4560 return { 4561 name: result.name, 4562 fn: result.fn, 4563 options: [options, deps] 4564 }; 4565 }; 4566 var hide3 = (options, deps) => { 4567 const result = hide2(options); 4568 return { 4569 name: result.name, 4570 fn: result.fn, 4571 options: [options, deps] 4572 }; 4573 }; 4574 4575 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 4576 var React24 = __toESM(require_react(), 1); 4577 var ReactDOM4 = __toESM(require_react_dom(), 1); 4578 4579 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 4580 var React23 = __toESM(require_react(), 1); 4581 4582 // node_modules/@base-ui/utils/store/createSelector.mjs 4583 var createSelector = (a, b, c, d, e, f, ...other) => { 4584 if (other.length > 0) { 4585 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1)); 4586 } 4587 let selector; 4588 if (a && b && c && d && e && f) { 4589 selector = (state, a1, a2, a3) => { 4590 const va = a(state, a1, a2, a3); 4591 const vb = b(state, a1, a2, a3); 4592 const vc = c(state, a1, a2, a3); 4593 const vd = d(state, a1, a2, a3); 4594 const ve = e(state, a1, a2, a3); 4595 return f(va, vb, vc, vd, ve, a1, a2, a3); 4596 }; 4597 } else if (a && b && c && d && e) { 4598 selector = (state, a1, a2, a3) => { 4599 const va = a(state, a1, a2, a3); 4600 const vb = b(state, a1, a2, a3); 4601 const vc = c(state, a1, a2, a3); 4602 const vd = d(state, a1, a2, a3); 4603 return e(va, vb, vc, vd, a1, a2, a3); 4604 }; 4605 } else if (a && b && c && d) { 4606 selector = (state, a1, a2, a3) => { 4607 const va = a(state, a1, a2, a3); 4608 const vb = b(state, a1, a2, a3); 4609 const vc = c(state, a1, a2, a3); 4610 return d(va, vb, vc, a1, a2, a3); 4611 }; 4612 } else if (a && b && c) { 4613 selector = (state, a1, a2, a3) => { 4614 const va = a(state, a1, a2, a3); 4615 const vb = b(state, a1, a2, a3); 4616 return c(va, vb, a1, a2, a3); 4617 }; 4618 } else if (a && b) { 4619 selector = (state, a1, a2, a3) => { 4620 const va = a(state, a1, a2, a3); 4621 return b(va, a1, a2, a3); 4622 }; 4623 } else if (a) { 4624 selector = a; 4625 } else { 4626 throw ( 4627 /* minify-error-disabled */ 4628 new Error("Missing arguments") 4629 ); 4630 } 4631 return selector; 4632 }; 4633 4634 // node_modules/@base-ui/utils/store/useStore.mjs 4635 var React21 = __toESM(require_react(), 1); 4636 var import_shim = __toESM(require_shim(), 1); 4637 var import_with_selector = __toESM(require_with_selector(), 1); 4638 4639 // node_modules/@base-ui/utils/fastHooks.mjs 4640 var React20 = __toESM(require_react(), 1); 4641 var hooks = []; 4642 var currentInstance = void 0; 4643 function getInstance() { 4644 return currentInstance; 4645 } 4646 function register(hook) { 4647 hooks.push(hook); 4648 } 4649 function fastComponent(fn) { 4650 const FastComponent = (props, forwardedRef) => { 4651 const instance = useRefWithInit(createInstance).current; 4652 let result; 4653 try { 4654 currentInstance = instance; 4655 for (const hook of hooks) { 4656 hook.before(instance); 4657 } 4658 result = fn(props, forwardedRef); 4659 for (const hook of hooks) { 4660 hook.after(instance); 4661 } 4662 instance.didInitialize = true; 4663 } finally { 4664 currentInstance = void 0; 4665 } 4666 return result; 4667 }; 4668 FastComponent.displayName = fn.displayName || fn.name; 4669 return FastComponent; 4670 } 4671 function fastComponentRef(fn) { 4672 return /* @__PURE__ */ React20.forwardRef(fastComponent(fn)); 4673 } 4674 function createInstance() { 4675 return { 4676 didInitialize: false 4677 }; 4678 } 4679 4680 // node_modules/@base-ui/utils/store/useStore.mjs 4681 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 4682 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 4683 function useStore(store2, selector, a1, a2, a3) { 4684 return useStoreImplementation(store2, selector, a1, a2, a3); 4685 } 4686 function useStoreR19(store2, selector, a1, a2, a3) { 4687 const getSelection = React21.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]); 4688 return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection); 4689 } 4690 register({ 4691 before(instance) { 4692 instance.syncIndex = 0; 4693 if (!instance.didInitialize) { 4694 instance.syncTick = 1; 4695 instance.syncHooks = []; 4696 instance.didChangeStore = true; 4697 instance.getSnapshot = () => { 4698 let didChange2 = false; 4699 for (let i = 0; i < instance.syncHooks.length; i += 1) { 4700 const hook = instance.syncHooks[i]; 4701 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 4702 if (!Object.is(hook.value, value)) { 4703 didChange2 = true; 4704 hook.value = value; 4705 } 4706 } 4707 if (didChange2) { 4708 instance.syncTick += 1; 4709 } 4710 return instance.syncTick; 4711 }; 4712 } 4713 }, 4714 after(instance) { 4715 if (instance.syncHooks.length > 0) { 4716 if (instance.didChangeStore) { 4717 instance.didChangeStore = false; 4718 instance.subscribe = (onStoreChange) => { 4719 const stores = /* @__PURE__ */ new Set(); 4720 for (const hook of instance.syncHooks) { 4721 stores.add(hook.store); 4722 } 4723 const unsubscribes = []; 4724 for (const store2 of stores) { 4725 unsubscribes.push(store2.subscribe(onStoreChange)); 4726 } 4727 return () => { 4728 for (const unsubscribe of unsubscribes) { 4729 unsubscribe(); 4730 } 4731 }; 4732 }; 4733 } 4734 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 4735 } 4736 } 4737 }); 4738 function useStoreFast(store2, selector, a1, a2, a3) { 4739 const instance = getInstance(); 4740 if (!instance) { 4741 return useStoreR19(store2, selector, a1, a2, a3); 4742 } 4743 const index2 = instance.syncIndex; 4744 instance.syncIndex += 1; 4745 let hook; 4746 if (!instance.didInitialize) { 4747 hook = { 4748 store: store2, 4749 selector, 4750 a1, 4751 a2, 4752 a3, 4753 value: selector(store2.getSnapshot(), a1, a2, a3) 4754 }; 4755 instance.syncHooks.push(hook); 4756 } else { 4757 hook = instance.syncHooks[index2]; 4758 if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { 4759 if (hook.store !== store2) { 4760 instance.didChangeStore = true; 4761 } 4762 hook.store = store2; 4763 hook.selector = selector; 4764 hook.a1 = a1; 4765 hook.a2 = a2; 4766 hook.a3 = a3; 4767 hook.value = selector(store2.getSnapshot(), a1, a2, a3); 4768 } 4769 } 4770 return hook.value; 4771 } 4772 function useStoreLegacy(store2, selector, a1, a2, a3) { 4773 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3)); 4774 } 4775 4776 // node_modules/@base-ui/utils/store/Store.mjs 4777 var Store = class { 4778 /** 4779 * The current state of the store. 4780 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 4781 * 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). 4782 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 4783 * 4784 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 4785 */ 4786 // Internal state to handle recursive `setState()` calls 4787 constructor(state) { 4788 this.state = state; 4789 this.listeners = /* @__PURE__ */ new Set(); 4790 this.updateTick = 0; 4791 } 4792 /** 4793 * Registers a listener that will be called whenever the store's state changes. 4794 * 4795 * @param fn The listener function to be called on state changes. 4796 * @returns A function to unsubscribe the listener. 4797 */ 4798 subscribe = (fn) => { 4799 this.listeners.add(fn); 4800 return () => { 4801 this.listeners.delete(fn); 4802 }; 4803 }; 4804 /** 4805 * Returns the current state of the store. 4806 */ 4807 getSnapshot = () => { 4808 return this.state; 4809 }; 4810 /** 4811 * Updates the entire store's state and notifies all registered listeners. 4812 * 4813 * @param newState The new state to set for the store. 4814 */ 4815 setState(newState) { 4816 if (this.state === newState) { 4817 return; 4818 } 4819 this.state = newState; 4820 this.updateTick += 1; 4821 const currentTick = this.updateTick; 4822 for (const listener of this.listeners) { 4823 if (currentTick !== this.updateTick) { 4824 return; 4825 } 4826 listener(newState); 4827 } 4828 } 4829 /** 4830 * Merges the provided changes into the current state and notifies listeners if there are changes. 4831 * 4832 * @param changes An object containing the changes to apply to the current state. 4833 */ 4834 update(changes) { 4835 for (const key in changes) { 4836 if (!Object.is(this.state[key], changes[key])) { 4837 this.setState({ 4838 ...this.state, 4839 ...changes 4840 }); 4841 return; 4842 } 4843 } 4844 } 4845 /** 4846 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 4847 * 4848 * @param key The key in the store's state to update. 4849 * @param value The new value to set for the specified key. 4850 */ 4851 set(key, value) { 4852 if (!Object.is(this.state[key], value)) { 4853 this.setState({ 4854 ...this.state, 4855 [key]: value 4856 }); 4857 } 4858 } 4859 /** 4860 * Gives the state a new reference and updates all registered listeners. 4861 */ 4862 notifyAll() { 4863 const newState = { 4864 ...this.state 4865 }; 4866 this.setState(newState); 4867 } 4868 use(selector, a1, a2, a3) { 4869 return useStore(this, selector, a1, a2, a3); 4870 } 4871 }; 4872 4873 // node_modules/@base-ui/utils/store/ReactStore.mjs 4874 var React22 = __toESM(require_react(), 1); 4875 var ReactStore = class extends Store { 4876 /** 4877 * Creates a new ReactStore instance. 4878 * 4879 * @param state Initial state of the store. 4880 * @param context Non-reactive context values. 4881 * @param selectors Optional selectors for use with `useState`. 4882 */ 4883 constructor(state, context = {}, selectors3) { 4884 super(state); 4885 this.context = context; 4886 this.selectors = selectors3; 4887 } 4888 /** 4889 * Non-reactive values such as refs, callbacks, etc. 4890 */ 4891 /** 4892 * Synchronizes a single external value into the store. 4893 * 4894 * Note that the while the value in `state` is updated immediately, the value returned 4895 * by `useState` is updated before the next render (similarly to React's `useState`). 4896 */ 4897 useSyncedValue(key, value) { 4898 React22.useDebugValue(key); 4899 const store2 = this; 4900 useIsoLayoutEffect(() => { 4901 if (store2.state[key] !== value) { 4902 store2.set(key, value); 4903 } 4904 }, [store2, key, value]); 4905 } 4906 /** 4907 * Synchronizes a single external value into the store and 4908 * cleans it up (sets to `undefined`) on unmount. 4909 * 4910 * Note that the while the value in `state` is updated immediately, the value returned 4911 * by `useState` is updated before the next render (similarly to React's `useState`). 4912 */ 4913 useSyncedValueWithCleanup(key, value) { 4914 const store2 = this; 4915 useIsoLayoutEffect(() => { 4916 if (store2.state[key] !== value) { 4917 store2.set(key, value); 4918 } 4919 return () => { 4920 store2.set(key, void 0); 4921 }; 4922 }, [store2, key, value]); 4923 } 4924 /** 4925 * Synchronizes multiple external values into the store. 4926 * 4927 * Note that the while the values in `state` are updated immediately, the values returned 4928 * by `useState` are updated before the next render (similarly to React's `useState`). 4929 */ 4930 useSyncedValues(statePart) { 4931 const store2 = this; 4932 if (true) { 4933 React22.useDebugValue(statePart, (p) => Object.keys(p)); 4934 const keys = React22.useRef(Object.keys(statePart)).current; 4935 const nextKeys = Object.keys(statePart); 4936 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { 4937 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 4938 } 4939 } 4940 const dependencies = Object.values(statePart); 4941 useIsoLayoutEffect(() => { 4942 store2.update(statePart); 4943 }, [store2, ...dependencies]); 4944 } 4945 /** 4946 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 4947 * is non-undefined, the store's state at `key` is updated to match `controlled`. 4948 */ 4949 useControlledProp(key, controlled) { 4950 React22.useDebugValue(key); 4951 const store2 = this; 4952 const isControlled = controlled !== void 0; 4953 useIsoLayoutEffect(() => { 4954 if (isControlled && !Object.is(store2.state[key], controlled)) { 4955 store2.setState({ 4956 ...store2.state, 4957 [key]: controlled 4958 }); 4959 } 4960 }, [store2, key, controlled, isControlled]); 4961 if (true) { 4962 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 4963 if (!cache.has(key)) { 4964 cache.set(key, isControlled); 4965 } 4966 const previouslyControlled = cache.get(key); 4967 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 4968 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).`); 4969 } 4970 } 4971 } 4972 /** Gets the current value from the store using a selector with the provided key. 4973 * 4974 * @param key Key of the selector to use. 4975 */ 4976 select(key, a1, a2, a3) { 4977 const selector = this.selectors[key]; 4978 return selector(this.state, a1, a2, a3); 4979 } 4980 /** 4981 * Returns a value from the store's state using a selector function. 4982 * Used to subscribe to specific parts of the state. 4983 * This methods causes a rerender whenever the selected state changes. 4984 * 4985 * @param key Key of the selector to use. 4986 */ 4987 useState(key, a1, a2, a3) { 4988 React22.useDebugValue(key); 4989 return useStore(this, this.selectors[key], a1, a2, a3); 4990 } 4991 /** 4992 * Wraps a function with `useStableCallback` to ensure it has a stable reference 4993 * and assigns it to the context. 4994 * 4995 * @param key Key of the event callback. Must be a function in the context. 4996 * @param fn Function to assign. 4997 */ 4998 useContextCallback(key, fn) { 4999 React22.useDebugValue(key); 5000 const stableFunction = useStableCallback(fn ?? NOOP); 5001 this.context[key] = stableFunction; 5002 } 5003 /** 5004 * Returns a stable setter function for a specific key in the store's state. 5005 * It's commonly used to pass as a ref callback to React elements. 5006 * 5007 * @param key Key of the state to set. 5008 */ 5009 useStateSetter(key) { 5010 const ref = React22.useRef(void 0); 5011 if (ref.current === void 0) { 5012 ref.current = (value) => { 5013 this.set(key, value); 5014 }; 5015 } 5016 return ref.current; 5017 } 5018 /** 5019 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 5020 * 5021 * @param key Key of the selector to observe. 5022 * @param listener Listener function called when the selector result changes. 5023 */ 5024 observe(selector, listener) { 5025 let selectFn; 5026 if (typeof selector === "function") { 5027 selectFn = selector; 5028 } else { 5029 selectFn = this.selectors[selector]; 5030 } 5031 let prevValue = selectFn(this.state); 5032 listener(prevValue, prevValue, this); 5033 return this.subscribe((nextState) => { 5034 const nextValue = selectFn(nextState); 5035 if (!Object.is(prevValue, nextValue)) { 5036 const oldValue = prevValue; 5037 prevValue = nextValue; 5038 listener(nextValue, oldValue, this); 5039 } 5040 }); 5041 } 5042 }; 5043 5044 // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs 5045 var selectors = { 5046 open: createSelector((state) => state.open), 5047 transitionStatus: createSelector((state) => state.transitionStatus), 5048 domReferenceElement: createSelector((state) => state.domReferenceElement), 5049 referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement), 5050 floatingElement: createSelector((state) => state.floatingElement), 5051 floatingId: createSelector((state) => state.floatingId) 5052 }; 5053 var FloatingRootStore = class extends ReactStore { 5054 constructor(options) { 5055 const { 5056 syncOnly, 5057 nested, 5058 onOpenChange, 5059 triggerElements, 5060 ...initialState2 5061 } = options; 5062 super({ 5063 ...initialState2, 5064 positionReference: initialState2.referenceElement, 5065 domReferenceElement: initialState2.referenceElement 5066 }, { 5067 onOpenChange, 5068 dataRef: { 5069 current: {} 5070 }, 5071 events: createEventEmitter(), 5072 nested, 5073 triggerElements 5074 }, selectors); 5075 this.syncOnly = syncOnly; 5076 } 5077 /** 5078 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 5079 */ 5080 syncOpenEvent = (newOpen, event) => { 5081 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 5082 // click events to upgrade a hover-open. 5083 event != null && isClickLikeEvent(event)) { 5084 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 5085 } 5086 }; 5087 /** 5088 * Runs the root-owned side effects for an open state change. 5089 */ 5090 dispatchOpenChange = (newOpen, eventDetails) => { 5091 this.syncOpenEvent(newOpen, eventDetails.event); 5092 const details = { 5093 open: newOpen, 5094 reason: eventDetails.reason, 5095 nativeEvent: eventDetails.event, 5096 nested: this.context.nested, 5097 triggerElement: eventDetails.trigger 5098 }; 5099 this.context.events.emit("openchange", details); 5100 }; 5101 /** 5102 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 5103 * 5104 * @param newOpen The new open state. 5105 * @param eventDetails Details about the event that triggered the open state change. 5106 */ 5107 setOpen = (newOpen, eventDetails) => { 5108 if (this.syncOnly) { 5109 this.context.onOpenChange?.(newOpen, eventDetails); 5110 return; 5111 } 5112 this.dispatchOpenChange(newOpen, eventDetails); 5113 this.context.onOpenChange?.(newOpen, eventDetails); 5114 }; 5115 }; 5116 5117 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 5118 function useSyncedFloatingRootContext(options) { 5119 const { 5120 popupStore, 5121 treatPopupAsFloatingElement = false, 5122 floatingRootContext: floatingRootContextProp, 5123 floatingId, 5124 nested, 5125 onOpenChange 5126 } = options; 5127 const open = popupStore.useState("open"); 5128 const referenceElement = popupStore.useState("activeTriggerElement"); 5129 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 5130 const triggerElements = popupStore.context.triggerElements; 5131 const handleOpenChange = onOpenChange; 5132 const internalStoreRef = React23.useRef(null); 5133 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { 5134 internalStoreRef.current = new FloatingRootStore({ 5135 open, 5136 transitionStatus: void 0, 5137 referenceElement, 5138 floatingElement, 5139 triggerElements, 5140 onOpenChange: handleOpenChange, 5141 floatingId, 5142 syncOnly: true, 5143 nested 5144 }); 5145 } 5146 const store2 = floatingRootContextProp ?? internalStoreRef.current; 5147 popupStore.useSyncedValue("floatingId", floatingId); 5148 useIsoLayoutEffect(() => { 5149 const valuesToSync = { 5150 open, 5151 floatingId, 5152 referenceElement, 5153 floatingElement 5154 }; 5155 if (isElement(referenceElement)) { 5156 valuesToSync.domReferenceElement = referenceElement; 5157 } 5158 if (store2.state.positionReference === store2.state.referenceElement) { 5159 valuesToSync.positionReference = referenceElement; 5160 } 5161 store2.update(valuesToSync); 5162 }, [open, floatingId, referenceElement, floatingElement, store2]); 5163 store2.context.onOpenChange = handleOpenChange; 5164 store2.context.nested = nested; 5165 return store2; 5166 } 5167 5168 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 5169 var FOCUSABLE_POPUP_PROPS = { 5170 tabIndex: -1, 5171 [FOCUSABLE_ATTRIBUTE]: "" 5172 }; 5173 function usePopupStore(externalStore, createStore, treatPopupAsFloatingElement = false) { 5174 const floatingId = useId(); 5175 const nested = useFloatingParentNodeId() != null; 5176 const internalStoreRef = React24.useRef(null); 5177 if (externalStore === void 0 && internalStoreRef.current === null) { 5178 internalStoreRef.current = createStore(floatingId, nested); 5179 } 5180 const store2 = externalStore ?? internalStoreRef.current; 5181 useSyncedFloatingRootContext({ 5182 popupStore: store2, 5183 treatPopupAsFloatingElement, 5184 floatingRootContext: store2.state.floatingRootContext, 5185 floatingId, 5186 nested, 5187 onOpenChange: store2.setOpen 5188 }); 5189 return { 5190 store: store2, 5191 internalStore: internalStoreRef.current 5192 }; 5193 } 5194 function useTriggerRegistration(id, store2) { 5195 const registeredElementIdRef = React24.useRef(null); 5196 const registeredElementRef = React24.useRef(null); 5197 return React24.useCallback((element) => { 5198 if (id === void 0) { 5199 return; 5200 } 5201 let shouldSyncTriggerCount = false; 5202 if (registeredElementIdRef.current !== null) { 5203 const registeredId = registeredElementIdRef.current; 5204 const registeredElement = registeredElementRef.current; 5205 const currentElement = store2.context.triggerElements.getById(registeredId); 5206 if (registeredElement && currentElement === registeredElement) { 5207 store2.context.triggerElements.delete(registeredId); 5208 shouldSyncTriggerCount = true; 5209 } 5210 registeredElementIdRef.current = null; 5211 registeredElementRef.current = null; 5212 } 5213 if (element !== null) { 5214 registeredElementIdRef.current = id; 5215 registeredElementRef.current = element; 5216 store2.context.triggerElements.add(id, element); 5217 shouldSyncTriggerCount = true; 5218 } 5219 if (shouldSyncTriggerCount) { 5220 const triggerCount = store2.context.triggerElements.size; 5221 if (store2.select("open") && store2.state.triggerCount !== triggerCount) { 5222 store2.set("triggerCount", triggerCount); 5223 } 5224 } 5225 }, [store2, id]); 5226 } 5227 function setPopupOpenState(state, open, trigger, preventUnmountOnClose = false) { 5228 if (open) { 5229 state.preventUnmountingOnClose = false; 5230 } else if (preventUnmountOnClose) { 5231 state.preventUnmountingOnClose = true; 5232 } 5233 const triggerId = trigger?.id ?? null; 5234 if (triggerId || open) { 5235 state.activeTriggerId = triggerId; 5236 state.activeTriggerElement = trigger ?? null; 5237 } 5238 } 5239 function attachPreventUnmountOnClose(eventDetails) { 5240 let preventUnmountOnClose = false; 5241 eventDetails.preventUnmountOnClose = () => { 5242 preventUnmountOnClose = true; 5243 }; 5244 return () => preventUnmountOnClose; 5245 } 5246 function applyPopupOpenChange(store2, nextOpen, eventDetails, options = {}) { 5247 const reason = eventDetails.reason; 5248 const isHover = reason === reason_parts_exports.triggerHover; 5249 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 5250 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 5251 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); 5252 store2.context.onOpenChange?.(nextOpen, eventDetails); 5253 if (eventDetails.isCanceled) { 5254 return; 5255 } 5256 options.onBeforeDispatch?.(); 5257 store2.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 5258 const changeState = () => { 5259 const updatedState = { 5260 ...options.extraState, 5261 open: nextOpen 5262 }; 5263 if (isFocusOpen) { 5264 updatedState.instantType = "focus"; 5265 } else if (isDismissClose) { 5266 updatedState.instantType = "dismiss"; 5267 } else if (isHover) { 5268 updatedState.instantType = void 0; 5269 } 5270 setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); 5271 store2.update(updatedState); 5272 }; 5273 if (isHover) { 5274 ReactDOM4.flushSync(changeState); 5275 } else { 5276 changeState(); 5277 } 5278 } 5279 function useInitialOpenSync(store2, openProp, defaultOpen, defaultTriggerId) { 5280 useOnFirstRender(() => { 5281 if (openProp === void 0 && store2.state.open === false && defaultOpen) { 5282 store2.state = { 5283 ...store2.state, 5284 open: true, 5285 activeTriggerId: defaultTriggerId, 5286 preventUnmountingOnClose: false 5287 }; 5288 } 5289 }); 5290 } 5291 function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) { 5292 const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId); 5293 const baseRegisterTrigger = useTriggerRegistration(triggerId, store2); 5294 const registerTrigger = useStableCallback((element) => { 5295 baseRegisterTrigger(element); 5296 if (!element) { 5297 return; 5298 } 5299 const open = store2.select("open"); 5300 const activeTriggerId = store2.select("activeTriggerId"); 5301 if (activeTriggerId === triggerId) { 5302 store2.update({ 5303 activeTriggerElement: element, 5304 ...open ? stateUpdates : null 5305 }); 5306 return; 5307 } 5308 if (activeTriggerId == null && open) { 5309 store2.update({ 5310 activeTriggerId: triggerId, 5311 activeTriggerElement: element, 5312 ...stateUpdates 5313 }); 5314 } 5315 }); 5316 useIsoLayoutEffect(() => { 5317 if (isMountedByThisTrigger) { 5318 store2.update({ 5319 activeTriggerElement: triggerElementRef.current, 5320 ...stateUpdates 5321 }); 5322 } 5323 }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]); 5324 return { 5325 registerTrigger, 5326 isMountedByThisTrigger 5327 }; 5328 } 5329 function useImplicitActiveTrigger(store2, options = {}) { 5330 const { 5331 closeOnActiveTriggerUnmount = false 5332 } = options; 5333 const open = store2.useState("open"); 5334 const reactiveTriggerCount = store2.useState("triggerCount"); 5335 useIsoLayoutEffect(() => { 5336 if (!open) { 5337 if (store2.state.triggerCount !== 0) { 5338 store2.set("triggerCount", 0); 5339 } 5340 return; 5341 } 5342 const triggerCount = store2.context.triggerElements.size; 5343 const stateUpdates = {}; 5344 if (store2.state.triggerCount !== triggerCount) { 5345 stateUpdates.triggerCount = triggerCount; 5346 } 5347 const activeTriggerId = store2.select("activeTriggerId"); 5348 let lostActiveTriggerId = null; 5349 if (activeTriggerId) { 5350 const activeTriggerElement = store2.context.triggerElements.getById(activeTriggerId); 5351 if (!activeTriggerElement) { 5352 lostActiveTriggerId = activeTriggerId; 5353 } else if (activeTriggerElement !== store2.state.activeTriggerElement) { 5354 stateUpdates.activeTriggerElement = activeTriggerElement; 5355 } 5356 } 5357 if (!lostActiveTriggerId && !activeTriggerId && triggerCount === 1) { 5358 const iteratorResult = store2.context.triggerElements.entries().next(); 5359 if (!iteratorResult.done) { 5360 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 5361 stateUpdates.activeTriggerId = implicitTriggerId; 5362 stateUpdates.activeTriggerElement = implicitTriggerElement; 5363 } 5364 } 5365 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { 5366 store2.update(stateUpdates); 5367 } 5368 if (lostActiveTriggerId) { 5369 if (closeOnActiveTriggerUnmount) { 5370 queueMicrotask(() => { 5371 if (store2.select("open") && store2.select("activeTriggerId") === lostActiveTriggerId && !store2.context.triggerElements.getById(lostActiveTriggerId)) { 5372 const eventDetails = createChangeEventDetails(reason_parts_exports.none); 5373 store2.setOpen(false, eventDetails); 5374 if (!eventDetails.isCanceled) { 5375 store2.update({ 5376 activeTriggerId: null, 5377 activeTriggerElement: null 5378 }); 5379 } 5380 } 5381 }); 5382 } 5383 } 5384 }, [open, store2, reactiveTriggerCount, closeOnActiveTriggerUnmount]); 5385 } 5386 function useOpenStateTransitions(open, store2, onUnmount) { 5387 const { 5388 mounted, 5389 setMounted, 5390 transitionStatus 5391 } = useTransitionStatus(open); 5392 const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose"); 5393 const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose; 5394 store2.useSyncedValues({ 5395 mounted, 5396 transitionStatus, 5397 preventUnmountingOnClose: syncedPreventUnmountingOnClose 5398 }); 5399 const forceUnmount = useStableCallback(() => { 5400 setMounted(false); 5401 store2.update({ 5402 activeTriggerId: null, 5403 activeTriggerElement: null, 5404 mounted: false, 5405 preventUnmountingOnClose: false 5406 }); 5407 onUnmount?.(); 5408 store2.context.onOpenChangeComplete?.(false); 5409 }); 5410 useOpenChangeComplete({ 5411 enabled: mounted && !open && !syncedPreventUnmountingOnClose, 5412 open, 5413 ref: store2.context.popupRef, 5414 onComplete() { 5415 if (!open) { 5416 forceUnmount(); 5417 } 5418 } 5419 }); 5420 return { 5421 forceUnmount, 5422 transitionStatus 5423 }; 5424 } 5425 function usePopupInteractionProps(store2, statePart) { 5426 store2.useSyncedValues(statePart); 5427 useIsoLayoutEffect(() => () => { 5428 store2.update({ 5429 activeTriggerProps: EMPTY_OBJECT, 5430 inactiveTriggerProps: EMPTY_OBJECT, 5431 popupProps: EMPTY_OBJECT 5432 }); 5433 }, [store2]); 5434 } 5435 5436 // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs 5437 var PopupTriggerMap = class { 5438 constructor() { 5439 this.elementsSet = /* @__PURE__ */ new Set(); 5440 this.idMap = /* @__PURE__ */ new Map(); 5441 } 5442 /** 5443 * Adds a trigger element with the given ID. 5444 * 5445 * Note: The provided element is assumed to not be registered under multiple IDs. 5446 */ 5447 add(id, element) { 5448 const existingElement = this.idMap.get(id); 5449 if (existingElement === element) { 5450 return; 5451 } 5452 if (existingElement !== void 0) { 5453 this.elementsSet.delete(existingElement); 5454 } 5455 this.elementsSet.add(element); 5456 this.idMap.set(id, element); 5457 if (true) { 5458 if (this.elementsSet.size !== this.idMap.size) { 5459 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 5460 } 5461 } 5462 } 5463 /** 5464 * Removes the trigger element with the given ID. 5465 */ 5466 delete(id) { 5467 const element = this.idMap.get(id); 5468 if (element) { 5469 this.elementsSet.delete(element); 5470 this.idMap.delete(id); 5471 } 5472 } 5473 /** 5474 * Whether the given element is registered as a trigger. 5475 */ 5476 hasElement(element) { 5477 return this.elementsSet.has(element); 5478 } 5479 /** 5480 * Whether there is a registered trigger element matching the given predicate. 5481 */ 5482 hasMatchingElement(predicate) { 5483 for (const element of this.elementsSet) { 5484 if (predicate(element)) { 5485 return true; 5486 } 5487 } 5488 return false; 5489 } 5490 /** 5491 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 5492 */ 5493 getById(id) { 5494 return this.idMap.get(id); 5495 } 5496 /** 5497 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 5498 */ 5499 entries() { 5500 return this.idMap.entries(); 5501 } 5502 /** 5503 * Returns an iterable of all registered trigger elements. 5504 */ 5505 elements() { 5506 return this.elementsSet.values(); 5507 } 5508 /** 5509 * Returns the number of registered trigger elements. 5510 */ 5511 get size() { 5512 return this.idMap.size; 5513 } 5514 }; 5515 5516 // node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs 5517 function getEmptyRootContext() { 5518 return new FloatingRootStore({ 5519 open: false, 5520 transitionStatus: void 0, 5521 floatingElement: null, 5522 referenceElement: null, 5523 triggerElements: new PopupTriggerMap(), 5524 floatingId: void 0, 5525 syncOnly: false, 5526 nested: false, 5527 onOpenChange: void 0 5528 }); 5529 } 5530 5531 // node_modules/@base-ui/react/utils/popups/store.mjs 5532 function createInitialPopupStoreState() { 5533 return { 5534 open: false, 5535 openProp: void 0, 5536 mounted: false, 5537 transitionStatus: void 0, 5538 floatingRootContext: getEmptyRootContext(), 5539 floatingId: void 0, 5540 triggerCount: 0, 5541 preventUnmountingOnClose: false, 5542 payload: void 0, 5543 activeTriggerId: null, 5544 activeTriggerElement: null, 5545 triggerIdProp: void 0, 5546 popupElement: null, 5547 positionerElement: null, 5548 activeTriggerProps: EMPTY_OBJECT, 5549 inactiveTriggerProps: EMPTY_OBJECT, 5550 popupProps: EMPTY_OBJECT 5551 }; 5552 } 5553 function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) { 5554 return new FloatingRootStore({ 5555 open: false, 5556 transitionStatus: void 0, 5557 floatingElement: null, 5558 referenceElement: null, 5559 triggerElements, 5560 floatingId, 5561 syncOnly: true, 5562 nested, 5563 onOpenChange: void 0 5564 }); 5565 } 5566 var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId); 5567 var openSelector = createSelector((state) => state.openProp ?? state.open); 5568 var popupIdSelector = createSelector((state) => { 5569 const popupId = state.popupElement?.id ?? state.floatingId; 5570 return popupId || void 0; 5571 }); 5572 function triggerOwnsOpenPopup(state, triggerId) { 5573 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; 5574 } 5575 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { 5576 if (triggerOwnsOpenPopup(state, triggerId)) { 5577 return true; 5578 } 5579 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; 5580 } 5581 var popupStoreSelectors = { 5582 open: openSelector, 5583 mounted: createSelector((state) => state.mounted), 5584 transitionStatus: createSelector((state) => state.transitionStatus), 5585 floatingRootContext: createSelector((state) => state.floatingRootContext), 5586 triggerCount: createSelector((state) => state.triggerCount), 5587 preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose), 5588 payload: createSelector((state) => state.payload), 5589 activeTriggerId: activeTriggerIdSelector, 5590 activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null), 5591 popupId: popupIdSelector, 5592 /** 5593 * Whether the trigger with the given ID was used to open the popup. 5594 */ 5595 isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId), 5596 /** 5597 * Whether the popup is open and was activated by a trigger with the given ID. 5598 */ 5599 isOpenedByTrigger: createSelector((state, triggerId) => triggerOwnsOpenPopup(state, triggerId)), 5600 /** 5601 * Whether the popup is mounted and was activated by a trigger with the given ID. 5602 */ 5603 isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted), 5604 triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps), 5605 /** 5606 * Popup id for the trigger that currently owns the open popup. 5607 */ 5608 triggerPopupId: createSelector((state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0), 5609 popupProps: createSelector((state) => state.popupProps), 5610 popupElement: createSelector((state) => state.popupElement), 5611 positionerElement: createSelector((state) => state.positionerElement) 5612 }; 5613 5614 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs 5615 function useFloatingRootContext(options) { 5616 const { 5617 open = false, 5618 onOpenChange, 5619 elements = {} 5620 } = options; 5621 const floatingId = useId(); 5622 const nested = useFloatingParentNodeId() != null; 5623 if (true) { 5624 const optionDomReference = elements.reference; 5625 if (optionDomReference && !isElement(optionDomReference)) { 5626 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); 5627 } 5628 } 5629 const store2 = useRefWithInit(() => new FloatingRootStore({ 5630 open, 5631 transitionStatus: void 0, 5632 onOpenChange, 5633 referenceElement: elements.reference ?? null, 5634 floatingElement: elements.floating ?? null, 5635 triggerElements: new PopupTriggerMap(), 5636 floatingId, 5637 syncOnly: false, 5638 nested 5639 })).current; 5640 useIsoLayoutEffect(() => { 5641 const valuesToSync = { 5642 open, 5643 floatingId 5644 }; 5645 if (elements.reference !== void 0) { 5646 valuesToSync.referenceElement = elements.reference; 5647 valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null; 5648 } 5649 if (elements.floating !== void 0) { 5650 valuesToSync.floatingElement = elements.floating; 5651 } 5652 store2.update(valuesToSync); 5653 }, [open, floatingId, elements.reference, elements.floating, store2]); 5654 store2.context.onOpenChange = onOpenChange; 5655 store2.context.nested = nested; 5656 return store2; 5657 } 5658 5659 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 5660 function useFloating2(options = {}) { 5661 const { 5662 nodeId, 5663 externalTree 5664 } = options; 5665 const internalStore = useFloatingRootContext(options); 5666 const store2 = options.rootContext || internalStore; 5667 const referenceElement = store2.useState("referenceElement"); 5668 const floatingElement = store2.useState("floatingElement"); 5669 const domReferenceElement = store2.useState("domReferenceElement"); 5670 const open = store2.useState("open"); 5671 const floatingId = store2.useState("floatingId"); 5672 const [positionReference, setPositionReferenceRaw] = React25.useState(null); 5673 const [localDomReference, setLocalDomReference] = React25.useState(void 0); 5674 const [localFloatingElement, setLocalFloatingElement] = React25.useState(void 0); 5675 const domReferenceRef = React25.useRef(null); 5676 const tree = useFloatingTree(externalTree); 5677 const storeElements = React25.useMemo(() => ({ 5678 reference: referenceElement, 5679 floating: floatingElement, 5680 domReference: domReferenceElement 5681 }), [referenceElement, floatingElement, domReferenceElement]); 5682 const position = useFloating({ 5683 ...options, 5684 elements: { 5685 ...storeElements, 5686 ...positionReference && { 5687 reference: positionReference 5688 } 5689 } 5690 }); 5691 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; 5692 const syncedFloatingElement = localFloatingElement === void 0 ? store2.state.floatingElement : localFloatingElement; 5693 store2.useSyncedValue("referenceElement", localDomReference ?? null); 5694 store2.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); 5695 store2.useSyncedValue("floatingElement", syncedFloatingElement); 5696 const setPositionReference = React25.useCallback((node) => { 5697 const computedPositionReference = isElement(node) ? { 5698 getBoundingClientRect: () => node.getBoundingClientRect(), 5699 getClientRects: () => node.getClientRects(), 5700 contextElement: node 5701 } : node; 5702 setPositionReferenceRaw(computedPositionReference); 5703 position.refs.setReference(computedPositionReference); 5704 }, [position.refs]); 5705 const setReference = React25.useCallback((node) => { 5706 if (isElement(node) || node === null) { 5707 domReferenceRef.current = node; 5708 setLocalDomReference(node); 5709 } 5710 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to 5711 // `null` to support `positionReference` + an unstable `reference` 5712 // callback ref. 5713 node !== null && !isElement(node)) { 5714 position.refs.setReference(node); 5715 } 5716 }, [position.refs, setLocalDomReference]); 5717 const setFloating = React25.useCallback((node) => { 5718 setLocalFloatingElement(node); 5719 position.refs.setFloating(node); 5720 }, [position.refs]); 5721 const refs = React25.useMemo(() => ({ 5722 ...position.refs, 5723 setReference, 5724 setFloating, 5725 setPositionReference, 5726 domReference: domReferenceRef 5727 }), [position.refs, setReference, setFloating, setPositionReference]); 5728 const elements = React25.useMemo(() => ({ 5729 ...position.elements, 5730 domReference: domReferenceElement 5731 }), [position.elements, domReferenceElement]); 5732 const context = React25.useMemo(() => ({ 5733 ...position, 5734 dataRef: store2.context.dataRef, 5735 open, 5736 onOpenChange: store2.setOpen, 5737 events: store2.context.events, 5738 floatingId, 5739 refs, 5740 elements, 5741 nodeId, 5742 rootStore: store2 5743 }), [position, refs, elements, nodeId, store2, open, floatingId]); 5744 useIsoLayoutEffect(() => { 5745 if (domReferenceElement) { 5746 domReferenceRef.current = domReferenceElement; 5747 } 5748 }, [domReferenceElement]); 5749 useIsoLayoutEffect(() => { 5750 store2.context.dataRef.current.floatingContext = context; 5751 const node = tree?.nodesRef.current.find((n) => n.id === nodeId); 5752 if (node) { 5753 node.context = context; 5754 } 5755 }); 5756 return React25.useMemo(() => ({ 5757 ...position, 5758 context, 5759 refs, 5760 elements, 5761 rootStore: store2 5762 }), [position, refs, elements, context, store2]); 5763 } 5764 5765 // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs 5766 var React26 = __toESM(require_react(), 1); 5767 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; 5768 function useFocus(context, props = {}) { 5769 const { 5770 enabled = true, 5771 delay 5772 } = props; 5773 const store2 = "rootStore" in context ? context.rootStore : context; 5774 const { 5775 events, 5776 dataRef 5777 } = store2.context; 5778 const blockFocusRef = React26.useRef(false); 5779 const blockedReferenceRef = React26.useRef(null); 5780 const keyboardModalityRef = React26.useRef(true); 5781 const timeout = useTimeout(); 5782 React26.useEffect(() => { 5783 const domReference = store2.select("domReferenceElement"); 5784 if (!enabled) { 5785 return void 0; 5786 } 5787 const win = getWindow(domReference); 5788 function onBlur() { 5789 const currentDomReference = store2.select("domReferenceElement"); 5790 if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 5791 blockFocusRef.current = true; 5792 } 5793 } 5794 function onKeyDown() { 5795 keyboardModalityRef.current = true; 5796 } 5797 function onPointerDown() { 5798 keyboardModalityRef.current = false; 5799 } 5800 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 5801 }, [store2, enabled]); 5802 React26.useEffect(() => { 5803 if (!enabled) { 5804 return void 0; 5805 } 5806 function onOpenChangeLocal(details) { 5807 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 5808 const referenceElement = store2.select("domReferenceElement"); 5809 if (isElement(referenceElement)) { 5810 blockedReferenceRef.current = referenceElement; 5811 blockFocusRef.current = true; 5812 } 5813 } 5814 } 5815 events.on("openchange", onOpenChangeLocal); 5816 return () => { 5817 events.off("openchange", onOpenChangeLocal); 5818 }; 5819 }, [events, enabled, store2]); 5820 const reference = React26.useMemo(() => { 5821 function resetBlockedFocus() { 5822 blockFocusRef.current = false; 5823 blockedReferenceRef.current = null; 5824 } 5825 return { 5826 onMouseLeave() { 5827 resetBlockedFocus(); 5828 }, 5829 onFocus(event) { 5830 const focusTarget = event.currentTarget; 5831 if (blockFocusRef.current) { 5832 if (blockedReferenceRef.current === focusTarget) { 5833 return; 5834 } 5835 resetBlockedFocus(); 5836 } 5837 const target = getTarget(event.nativeEvent); 5838 if (isElement(target)) { 5839 if (isMacSafari && !event.relatedTarget) { 5840 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 5841 return; 5842 } 5843 } else if (!matchesFocusVisible(target)) { 5844 return; 5845 } 5846 } 5847 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements); 5848 const { 5849 nativeEvent, 5850 currentTarget 5851 } = event; 5852 const delayValue = typeof delay === "function" ? delay() : delay; 5853 if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { 5854 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 5855 return; 5856 } 5857 timeout.start(delayValue, () => { 5858 if (blockFocusRef.current) { 5859 return; 5860 } 5861 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 5862 }); 5863 }, 5864 onBlur(event) { 5865 resetBlockedFocus(); 5866 const relatedTarget = event.relatedTarget; 5867 const nativeEvent = event.nativeEvent; 5868 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 5869 timeout.start(0, () => { 5870 const domReference = store2.select("domReferenceElement"); 5871 const activeEl = activeElement(ownerDocument(domReference)); 5872 if (!relatedTarget && activeEl === domReference) { 5873 return; 5874 } 5875 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 5876 return; 5877 } 5878 const nextFocusedElement = relatedTarget ?? activeEl; 5879 if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) { 5880 return; 5881 } 5882 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 5883 }); 5884 } 5885 }; 5886 }, [dataRef, delay, store2, timeout]); 5887 return React26.useMemo(() => enabled ? { 5888 reference, 5889 trigger: reference 5890 } : {}, [enabled, reference]); 5891 } 5892 5893 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 5894 var React27 = __toESM(require_react(), 1); 5895 5896 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs 5897 var HoverInteraction = class _HoverInteraction { 5898 constructor() { 5899 this.pointerType = void 0; 5900 this.interactedInside = false; 5901 this.handler = void 0; 5902 this.blockMouseMove = true; 5903 this.performedPointerEventsMutation = false; 5904 this.pointerEventsScopeElement = null; 5905 this.pointerEventsReferenceElement = null; 5906 this.pointerEventsFloatingElement = null; 5907 this.restTimeoutPending = false; 5908 this.openChangeTimeout = new Timeout(); 5909 this.restTimeout = new Timeout(); 5910 this.handleCloseOptions = void 0; 5911 } 5912 static create() { 5913 return new _HoverInteraction(); 5914 } 5915 dispose = () => { 5916 this.openChangeTimeout.clear(); 5917 this.restTimeout.clear(); 5918 }; 5919 disposeEffect = () => { 5920 return this.dispose; 5921 }; 5922 }; 5923 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 5924 function clearSafePolygonPointerEventsMutation(instance) { 5925 if (!instance.performedPointerEventsMutation) { 5926 return; 5927 } 5928 const scopeElement = instance.pointerEventsScopeElement; 5929 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 5930 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 5931 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 5932 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 5933 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 5934 } 5935 instance.performedPointerEventsMutation = false; 5936 instance.pointerEventsScopeElement = null; 5937 instance.pointerEventsReferenceElement = null; 5938 instance.pointerEventsFloatingElement = null; 5939 } 5940 function applySafePolygonPointerEventsMutation(instance, options) { 5941 const { 5942 scopeElement, 5943 referenceElement, 5944 floatingElement 5945 } = options; 5946 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 5947 if (existingOwner && existingOwner !== instance) { 5948 clearSafePolygonPointerEventsMutation(existingOwner); 5949 } 5950 clearSafePolygonPointerEventsMutation(instance); 5951 instance.performedPointerEventsMutation = true; 5952 instance.pointerEventsScopeElement = scopeElement; 5953 instance.pointerEventsReferenceElement = referenceElement; 5954 instance.pointerEventsFloatingElement = floatingElement; 5955 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 5956 scopeElement.style.pointerEvents = "none"; 5957 referenceElement.style.pointerEvents = "auto"; 5958 floatingElement.style.pointerEvents = "auto"; 5959 } 5960 function useHoverInteractionSharedState(store2) { 5961 const data = store2.context.dataRef.current; 5962 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; 5963 if (!data.hoverInteractionState) { 5964 data.hoverInteractionState = instance; 5965 } 5966 useOnMount(data.hoverInteractionState.disposeEffect); 5967 return data.hoverInteractionState; 5968 } 5969 5970 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 5971 function useHoverFloatingInteraction(context, parameters = {}) { 5972 const { 5973 enabled = true, 5974 closeDelay: closeDelayProp = 0, 5975 nodeId: nodeIdProp 5976 } = parameters; 5977 const store2 = "rootStore" in context ? context.rootStore : context; 5978 const open = store2.useState("open"); 5979 const floatingElement = store2.useState("floatingElement"); 5980 const domReferenceElement = store2.useState("domReferenceElement"); 5981 const { 5982 dataRef 5983 } = store2.context; 5984 const tree = useFloatingTree(); 5985 const parentId = useFloatingParentNodeId(); 5986 const instance = useHoverInteractionSharedState(store2); 5987 const childClosedTimeout = useTimeout(); 5988 const isClickLikeOpenEvent2 = useStableCallback(() => { 5989 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 5990 }); 5991 const isHoverOpen = useStableCallback(() => { 5992 return isHoverOpenEvent(dataRef.current.openEvent?.type); 5993 }); 5994 const clearPointerEvents = useStableCallback(() => { 5995 clearSafePolygonPointerEventsMutation(instance); 5996 }); 5997 useIsoLayoutEffect(() => { 5998 if (!open) { 5999 instance.pointerType = void 0; 6000 instance.restTimeoutPending = false; 6001 instance.interactedInside = false; 6002 clearPointerEvents(); 6003 } 6004 }, [open, instance, clearPointerEvents]); 6005 React27.useEffect(() => { 6006 return clearPointerEvents; 6007 }, [clearPointerEvents]); 6008 useIsoLayoutEffect(() => { 6009 if (!enabled) { 6010 return void 0; 6011 } 6012 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 6013 const ref = domReferenceElement; 6014 const floatingEl = floatingElement; 6015 const doc = ownerDocument(floatingElement); 6016 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 6017 if (parentFloating) { 6018 parentFloating.style.pointerEvents = ""; 6019 } 6020 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; 6021 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; 6022 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; 6023 applySafePolygonPointerEventsMutation(instance, { 6024 scopeElement, 6025 referenceElement: ref, 6026 floatingElement: floatingEl 6027 }); 6028 return () => { 6029 clearPointerEvents(); 6030 }; 6031 } 6032 return void 0; 6033 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 6034 React27.useEffect(() => { 6035 if (!enabled) { 6036 return void 0; 6037 } 6038 function hasParentChildren() { 6039 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); 6040 } 6041 function closeWithDelay(event) { 6042 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 6043 const close = () => { 6044 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6045 tree?.events.emit("floating.closed", event); 6046 }; 6047 if (closeDelay) { 6048 instance.openChangeTimeout.start(closeDelay, close); 6049 } else { 6050 instance.openChangeTimeout.clear(); 6051 close(); 6052 } 6053 } 6054 function handleInteractInside(event) { 6055 const target = getTarget(event); 6056 if (!isInteractiveElement(target)) { 6057 instance.interactedInside = false; 6058 return; 6059 } 6060 instance.interactedInside = target?.closest("[aria-haspopup]") != null; 6061 } 6062 function onFloatingMouseEnter() { 6063 instance.openChangeTimeout.clear(); 6064 childClosedTimeout.clear(); 6065 tree?.events.off("floating.closed", onNodeClosed); 6066 clearPointerEvents(); 6067 } 6068 function onFloatingMouseLeave(event) { 6069 if (hasParentChildren() && tree) { 6070 tree.events.on("floating.closed", onNodeClosed); 6071 return; 6072 } 6073 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { 6074 return; 6075 } 6076 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 6077 const relatedTarget = event.relatedTarget; 6078 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 6079 if (isMovingIntoDescendantFloating) { 6080 return; 6081 } 6082 if (instance.handler) { 6083 instance.handler(event); 6084 return; 6085 } 6086 clearPointerEvents(); 6087 if (isHoverOpen() && !isClickLikeOpenEvent2()) { 6088 closeWithDelay(event); 6089 } 6090 } 6091 function onNodeClosed(event) { 6092 if (!tree || !parentId || hasParentChildren()) { 6093 return; 6094 } 6095 childClosedTimeout.start(0, () => { 6096 tree.events.off("floating.closed", onNodeClosed); 6097 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6098 tree.events.emit("floating.closed", event); 6099 }); 6100 } 6101 const floating = floatingElement; 6102 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 6103 tree?.events.off("floating.closed", onNodeClosed); 6104 }); 6105 }, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); 6106 } 6107 6108 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs 6109 var React28 = __toESM(require_react(), 1); 6110 var ReactDOM5 = __toESM(require_react_dom(), 1); 6111 var EMPTY_REF = { 6112 current: null 6113 }; 6114 function useHoverReferenceInteraction(context, props = {}) { 6115 const { 6116 enabled = true, 6117 delay = 0, 6118 handleClose = null, 6119 mouseOnly = false, 6120 restMs = 0, 6121 move = true, 6122 triggerElementRef = EMPTY_REF, 6123 externalTree, 6124 isActiveTrigger = true, 6125 getHandleCloseContext, 6126 isClosing, 6127 shouldOpen: shouldOpenProp 6128 } = props; 6129 const store2 = "rootStore" in context ? context.rootStore : context; 6130 const { 6131 dataRef, 6132 events 6133 } = store2.context; 6134 const tree = useFloatingTree(externalTree); 6135 const instance = useHoverInteractionSharedState(store2); 6136 const isHoverCloseActiveRef = React28.useRef(false); 6137 const handleCloseRef = useValueAsRef(handleClose); 6138 const delayRef = useValueAsRef(delay); 6139 const restMsRef = useValueAsRef(restMs); 6140 const enabledRef = useValueAsRef(enabled); 6141 const shouldOpenRef = useValueAsRef(shouldOpenProp); 6142 const isClosingRef = useValueAsRef(isClosing); 6143 const isClickLikeOpenEvent2 = useStableCallback(() => { 6144 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 6145 }); 6146 const checkShouldOpen = useStableCallback(() => { 6147 return shouldOpenRef.current?.() !== false; 6148 }); 6149 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 6150 const allTriggers = store2.context.triggerElements; 6151 if (allTriggers.hasElement(currentTarget)) { 6152 return !currentDomReference || !contains(currentDomReference, currentTarget); 6153 } 6154 if (!isElement(target)) { 6155 return false; 6156 } 6157 const targetElement = target; 6158 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 6159 }); 6160 const cleanupMouseMoveHandler = useStableCallback(() => { 6161 if (!instance.handler) { 6162 return; 6163 } 6164 const doc = ownerDocument(store2.select("domReferenceElement")); 6165 doc.removeEventListener("mousemove", instance.handler); 6166 instance.handler = void 0; 6167 }); 6168 const clearPointerEvents = useStableCallback(() => { 6169 clearSafePolygonPointerEventsMutation(instance); 6170 }); 6171 if (isActiveTrigger) { 6172 instance.handleCloseOptions = handleCloseRef.current?.__options; 6173 } 6174 React28.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 6175 React28.useEffect(() => { 6176 if (!enabled) { 6177 return void 0; 6178 } 6179 function onOpenChangeLocal(details) { 6180 if (!details.open) { 6181 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 6182 cleanupMouseMoveHandler(); 6183 instance.openChangeTimeout.clear(); 6184 instance.restTimeout.clear(); 6185 instance.blockMouseMove = true; 6186 instance.restTimeoutPending = false; 6187 } else { 6188 isHoverCloseActiveRef.current = false; 6189 } 6190 } 6191 events.on("openchange", onOpenChangeLocal); 6192 return () => { 6193 events.off("openchange", onOpenChangeLocal); 6194 }; 6195 }, [enabled, events, instance, cleanupMouseMoveHandler]); 6196 React28.useEffect(() => { 6197 if (!enabled) { 6198 return void 0; 6199 } 6200 function closeWithDelay(event, runElseBranch = true) { 6201 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 6202 if (closeDelay) { 6203 instance.openChangeTimeout.start(closeDelay, () => { 6204 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6205 tree?.events.emit("floating.closed", event); 6206 }); 6207 } else if (runElseBranch) { 6208 instance.openChangeTimeout.clear(); 6209 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6210 tree?.events.emit("floating.closed", event); 6211 } 6212 } 6213 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null); 6214 if (!isElement(trigger)) { 6215 return void 0; 6216 } 6217 function onMouseEnter(event) { 6218 instance.openChangeTimeout.clear(); 6219 instance.blockMouseMove = false; 6220 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 6221 return; 6222 } 6223 const restMsValue = getRestMs(restMsRef.current); 6224 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 6225 const eventTarget = getTarget(event); 6226 const currentTarget = event.currentTarget ?? null; 6227 const currentDomReference = store2.select("domReferenceElement"); 6228 let triggerNode = currentTarget; 6229 if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) { 6230 for (const triggerElement of store2.context.triggerElements.elements()) { 6231 if (contains(triggerElement, eventTarget)) { 6232 triggerNode = triggerElement; 6233 break; 6234 } 6235 } 6236 } 6237 if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 6238 triggerNode = currentDomReference; 6239 } 6240 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 6241 const isOpen = store2.select("open"); 6242 const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending"; 6243 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; 6244 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 6245 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 6246 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 6247 const shouldOpen = !isOpen || isOverInactive; 6248 if (shouldOpenImmediately) { 6249 if (checkShouldOpen()) { 6250 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6251 } 6252 return; 6253 } 6254 if (isRestOnlyDelay) { 6255 return; 6256 } 6257 if (openDelay) { 6258 instance.openChangeTimeout.start(openDelay, () => { 6259 if (shouldOpen && checkShouldOpen()) { 6260 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6261 } 6262 }); 6263 } else if (shouldOpen) { 6264 if (checkShouldOpen()) { 6265 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6266 } 6267 } 6268 } 6269 function onMouseLeave(event) { 6270 if (isClickLikeOpenEvent2()) { 6271 clearPointerEvents(); 6272 return; 6273 } 6274 cleanupMouseMoveHandler(); 6275 const domReferenceElement = store2.select("domReferenceElement"); 6276 const doc = ownerDocument(domReferenceElement); 6277 instance.restTimeout.clear(); 6278 instance.restTimeoutPending = false; 6279 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 6280 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { 6281 return; 6282 } 6283 if (handleCloseRef.current && handleCloseContextBase) { 6284 if (!store2.select("open")) { 6285 instance.openChangeTimeout.clear(); 6286 } 6287 const currentTrigger = triggerElementRef.current; 6288 instance.handler = handleCloseRef.current({ 6289 ...handleCloseContextBase, 6290 tree, 6291 x: event.clientX, 6292 y: event.clientY, 6293 onClose() { 6294 clearPointerEvents(); 6295 cleanupMouseMoveHandler(); 6296 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) { 6297 closeWithDelay(event, true); 6298 } 6299 } 6300 }); 6301 doc.addEventListener("mousemove", instance.handler); 6302 instance.handler(event); 6303 return; 6304 } 6305 const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true; 6306 if (shouldClose) { 6307 closeWithDelay(event); 6308 } 6309 } 6310 if (move) { 6311 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 6312 once: true 6313 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 6314 } 6315 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 6316 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen]); 6317 return React28.useMemo(() => { 6318 if (!enabled) { 6319 return void 0; 6320 } 6321 function setPointerRef(event) { 6322 instance.pointerType = event.pointerType; 6323 } 6324 return { 6325 onPointerDown: setPointerRef, 6326 onPointerEnter: setPointerRef, 6327 onMouseMove(event) { 6328 const { 6329 nativeEvent 6330 } = event; 6331 const trigger = event.currentTarget; 6332 const currentDomReference = store2.select("domReferenceElement"); 6333 const currentOpen = store2.select("open"); 6334 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 6335 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 6336 return; 6337 } 6338 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 6339 const floatingElement = store2.select("floatingElement"); 6340 if (floatingElement) { 6341 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 6342 applySafePolygonPointerEventsMutation(instance, { 6343 scopeElement, 6344 referenceElement: trigger, 6345 floatingElement 6346 }); 6347 } 6348 } 6349 const restMsValue = getRestMs(restMsRef.current); 6350 if (currentOpen && !isOverInactive || restMsValue === 0) { 6351 return; 6352 } 6353 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 6354 return; 6355 } 6356 instance.restTimeout.clear(); 6357 function handleMouseMove() { 6358 instance.restTimeoutPending = false; 6359 if (isClickLikeOpenEvent2()) { 6360 return; 6361 } 6362 const latestOpen = store2.select("open"); 6363 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { 6364 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 6365 } 6366 } 6367 if (instance.pointerType === "touch") { 6368 ReactDOM5.flushSync(() => { 6369 handleMouseMove(); 6370 }); 6371 } else if (isOverInactive && currentOpen) { 6372 handleMouseMove(); 6373 } else { 6374 instance.restTimeoutPending = true; 6375 instance.restTimeout.start(restMsValue, handleMouseMove); 6376 } 6377 } 6378 }; 6379 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]); 6380 } 6381 6382 // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs 6383 var CURSOR_SPEED_THRESHOLD = 0.1; 6384 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 6385 var POLYGON_BUFFER = 0.5; 6386 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 6387 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 6388 } 6389 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { 6390 let isInsideValue = false; 6391 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { 6392 isInsideValue = !isInsideValue; 6393 } 6394 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { 6395 isInsideValue = !isInsideValue; 6396 } 6397 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 6398 isInsideValue = !isInsideValue; 6399 } 6400 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 6401 isInsideValue = !isInsideValue; 6402 } 6403 return isInsideValue; 6404 } 6405 function isInsideRect(pointX, pointY, rect) { 6406 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 6407 } 6408 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { 6409 const minX = Math.min(x1, x2); 6410 const maxX = Math.max(x1, x2); 6411 const minY = Math.min(y1, y2); 6412 const maxY = Math.max(y1, y2); 6413 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 6414 } 6415 function safePolygon(options = {}) { 6416 const { 6417 blockPointerEvents = false 6418 } = options; 6419 const timeout = new Timeout(); 6420 const fn = ({ 6421 x, 6422 y, 6423 placement, 6424 elements, 6425 onClose, 6426 nodeId, 6427 tree 6428 }) => { 6429 const side = placement?.split("-")[0]; 6430 let hasLanded = false; 6431 let lastX = null; 6432 let lastY = null; 6433 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 6434 function isCursorMovingSlowly(nextX, nextY) { 6435 const currentTime = performance.now(); 6436 const elapsedTime = currentTime - lastCursorTime; 6437 if (lastX === null || lastY === null || elapsedTime === 0) { 6438 lastX = nextX; 6439 lastY = nextY; 6440 lastCursorTime = currentTime; 6441 return false; 6442 } 6443 const deltaX = nextX - lastX; 6444 const deltaY = nextY - lastY; 6445 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 6446 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 6447 lastX = nextX; 6448 lastY = nextY; 6449 lastCursorTime = currentTime; 6450 return distanceSquared < thresholdSquared; 6451 } 6452 function close() { 6453 timeout.clear(); 6454 onClose(); 6455 } 6456 return function onMouseMove(event) { 6457 timeout.clear(); 6458 const domReference = elements.domReference; 6459 const floating = elements.floating; 6460 if (!domReference || !floating || side == null || x == null || y == null) { 6461 return void 0; 6462 } 6463 const { 6464 clientX, 6465 clientY 6466 } = event; 6467 const target = getTarget(event); 6468 const isLeave = event.type === "mouseleave"; 6469 const isOverFloatingEl = contains(floating, target); 6470 const isOverReferenceEl = contains(domReference, target); 6471 if (isOverFloatingEl) { 6472 hasLanded = true; 6473 if (!isLeave) { 6474 return void 0; 6475 } 6476 } 6477 if (isOverReferenceEl) { 6478 hasLanded = false; 6479 if (!isLeave) { 6480 hasLanded = true; 6481 return void 0; 6482 } 6483 } 6484 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 6485 return void 0; 6486 } 6487 function hasOpenChildNode() { 6488 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 6489 } 6490 function closeIfNoOpenChild() { 6491 if (!hasOpenChildNode()) { 6492 close(); 6493 } 6494 } 6495 if (hasOpenChildNode()) { 6496 return void 0; 6497 } 6498 const refRect = domReference.getBoundingClientRect(); 6499 const rect = floating.getBoundingClientRect(); 6500 const cursorLeaveFromRight = x > rect.right - rect.width / 2; 6501 const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; 6502 const isFloatingWider = rect.width > refRect.width; 6503 const isFloatingTaller = rect.height > refRect.height; 6504 const left = (isFloatingWider ? refRect : rect).left; 6505 const right = (isFloatingWider ? refRect : rect).right; 6506 const top = (isFloatingTaller ? refRect : rect).top; 6507 const bottom = (isFloatingTaller ? refRect : rect).bottom; 6508 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) { 6509 closeIfNoOpenChild(); 6510 return void 0; 6511 } 6512 let isInsideTroughRect = false; 6513 switch (side) { 6514 case "top": 6515 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 6516 break; 6517 case "bottom": 6518 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 6519 break; 6520 case "left": 6521 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 6522 break; 6523 case "right": 6524 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 6525 break; 6526 default: 6527 } 6528 if (isInsideTroughRect) { 6529 return void 0; 6530 } 6531 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 6532 closeIfNoOpenChild(); 6533 return void 0; 6534 } 6535 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 6536 closeIfNoOpenChild(); 6537 return void 0; 6538 } 6539 let isInsidePolygon = false; 6540 switch (side) { 6541 case "top": { 6542 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6543 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6544 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6545 const cursorPointY = y + POLYGON_BUFFER + 1; 6546 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 6547 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 6548 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 6549 break; 6550 } 6551 case "bottom": { 6552 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6553 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6554 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6555 const cursorPointY = y - POLYGON_BUFFER; 6556 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 6557 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 6558 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 6559 break; 6560 } 6561 case "left": { 6562 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6563 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6564 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6565 const cursorPointX = x + POLYGON_BUFFER + 1; 6566 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 6567 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 6568 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 6569 break; 6570 } 6571 case "right": { 6572 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6573 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6574 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6575 const cursorPointX = x - POLYGON_BUFFER; 6576 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 6577 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 6578 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 6579 break; 6580 } 6581 default: 6582 } 6583 if (!isInsidePolygon) { 6584 closeIfNoOpenChild(); 6585 } else if (!hasLanded) { 6586 timeout.start(40, closeIfNoOpenChild); 6587 } 6588 return void 0; 6589 }; 6590 }; 6591 fn.__options = { 6592 ...options, 6593 blockPointerEvents 6594 }; 6595 return fn; 6596 } 6597 6598 // node_modules/@base-ui/react/utils/popupStateMapping.mjs 6599 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) { 6600 CommonPopupDataAttributes2["open"] = "data-open"; 6601 CommonPopupDataAttributes2["closed"] = "data-closed"; 6602 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 6603 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 6604 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden"; 6605 CommonPopupDataAttributes2["side"] = "data-side"; 6606 CommonPopupDataAttributes2["align"] = "data-align"; 6607 return CommonPopupDataAttributes2; 6608 })({}); 6609 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) { 6610 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open"; 6611 CommonTriggerDataAttributes2["pressed"] = "data-pressed"; 6612 return CommonTriggerDataAttributes2; 6613 })({}); 6614 var TRIGGER_HOOK = { 6615 [CommonTriggerDataAttributes.popupOpen]: "" 6616 }; 6617 var PRESSABLE_TRIGGER_HOOK = { 6618 [CommonTriggerDataAttributes.popupOpen]: "", 6619 [CommonTriggerDataAttributes.pressed]: "" 6620 }; 6621 var POPUP_OPEN_HOOK = { 6622 [CommonPopupDataAttributes.open]: "" 6623 }; 6624 var POPUP_CLOSED_HOOK = { 6625 [CommonPopupDataAttributes.closed]: "" 6626 }; 6627 var ANCHOR_HIDDEN_HOOK = { 6628 [CommonPopupDataAttributes.anchorHidden]: "" 6629 }; 6630 var triggerOpenStateMapping = { 6631 open(value) { 6632 if (value) { 6633 return TRIGGER_HOOK; 6634 } 6635 return null; 6636 } 6637 }; 6638 var popupStateMapping = { 6639 open(value) { 6640 if (value) { 6641 return POPUP_OPEN_HOOK; 6642 } 6643 return POPUP_CLOSED_HOOK; 6644 }, 6645 anchorHidden(value) { 6646 if (value) { 6647 return ANCHOR_HIDDEN_HOOK; 6648 } 6649 return null; 6650 } 6651 }; 6652 6653 // node_modules/@base-ui/utils/inertValue.mjs 6654 function inertValue(value) { 6655 if (isReactVersionAtLeast(19)) { 6656 return value; 6657 } 6658 return value ? "true" : void 0; 6659 } 6660 6661 // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs 6662 var React29 = __toESM(require_react(), 1); 6663 6664 // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs 6665 var baseArrow = (options) => ({ 6666 name: "arrow", 6667 options, 6668 async fn(state) { 6669 const { 6670 x, 6671 y, 6672 placement, 6673 rects, 6674 platform: platform3, 6675 elements, 6676 middlewareData 6677 } = state; 6678 const { 6679 element, 6680 padding = 0, 6681 offsetParent = "real" 6682 } = evaluate(options, state) || {}; 6683 if (element == null) { 6684 return {}; 6685 } 6686 const paddingObject = getPaddingObject(padding); 6687 const coords = { 6688 x, 6689 y 6690 }; 6691 const axis = getAlignmentAxis(placement); 6692 const length = getAxisLength(axis); 6693 const arrowDimensions = await platform3.getDimensions(element); 6694 const isYAxis = axis === "y"; 6695 const minProp = isYAxis ? "top" : "left"; 6696 const maxProp = isYAxis ? "bottom" : "right"; 6697 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 6698 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 6699 const startDiff = coords[axis] - rects.reference[axis]; 6700 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; 6701 let clientSize = elements.floating[clientProp] || rects.floating[length]; 6702 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { 6703 clientSize = elements.floating[clientProp] || rects.floating[length]; 6704 } 6705 const centerToReference = endDiff / 2 - startDiff / 2; 6706 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 6707 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 6708 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 6709 const min2 = minPadding; 6710 const max2 = clientSize - arrowDimensions[length] - maxPadding; 6711 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 6712 const offset4 = clamp(min2, center, max2); 6713 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 6714 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; 6715 return { 6716 [axis]: coords[axis] + alignmentOffset, 6717 data: { 6718 [axis]: offset4, 6719 centerOffset: center - offset4 - alignmentOffset, 6720 ...shouldAddOffset && { 6721 alignmentOffset 6722 } 6723 }, 6724 reset: shouldAddOffset 6725 }; 6726 } 6727 }); 6728 var arrow4 = (options, deps) => ({ 6729 ...baseArrow(options), 6730 options: [options, deps] 6731 }); 6732 6733 // node_modules/@base-ui/react/utils/hideMiddleware.mjs 6734 var nativeHideFn = hide3().fn; 6735 var hide4 = { 6736 name: "hide", 6737 async fn(state) { 6738 const { 6739 width, 6740 height, 6741 x, 6742 y 6743 } = state.rects.reference; 6744 const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0; 6745 const nativeHideResult = await nativeHideFn(state); 6746 return { 6747 data: { 6748 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden 6749 } 6750 }; 6751 } 6752 }; 6753 6754 // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs 6755 var DEFAULT_SIDES = { 6756 sideX: "left", 6757 sideY: "top" 6758 }; 6759 var adaptiveOrigin = { 6760 name: "adaptiveOrigin", 6761 async fn(state) { 6762 const { 6763 x: rawX, 6764 y: rawY, 6765 rects: { 6766 floating: floatRect 6767 }, 6768 elements: { 6769 floating 6770 }, 6771 platform: platform3, 6772 strategy, 6773 placement 6774 } = state; 6775 const win = getWindow(floating); 6776 const styles = win.getComputedStyle(floating); 6777 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 6778 if (!hasTransition) { 6779 return { 6780 x: rawX, 6781 y: rawY, 6782 data: DEFAULT_SIDES 6783 }; 6784 } 6785 const offsetParent = await platform3.getOffsetParent?.(floating); 6786 let offsetDimensions = { 6787 width: 0, 6788 height: 0 6789 }; 6790 if (strategy === "fixed" && win?.visualViewport) { 6791 offsetDimensions = { 6792 width: win.visualViewport.width, 6793 height: win.visualViewport.height 6794 }; 6795 } else if (offsetParent === win) { 6796 const doc = ownerDocument(floating); 6797 offsetDimensions = { 6798 width: doc.documentElement.clientWidth, 6799 height: doc.documentElement.clientHeight 6800 }; 6801 } else if (await platform3.isElement?.(offsetParent)) { 6802 offsetDimensions = await platform3.getDimensions(offsetParent); 6803 } 6804 const currentSide = getSide(placement); 6805 let x = rawX; 6806 let y = rawY; 6807 if (currentSide === "left") { 6808 x = offsetDimensions.width - (rawX + floatRect.width); 6809 } 6810 if (currentSide === "top") { 6811 y = offsetDimensions.height - (rawY + floatRect.height); 6812 } 6813 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 6814 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 6815 return { 6816 x, 6817 y, 6818 data: { 6819 sideX, 6820 sideY 6821 } 6822 }; 6823 } 6824 }; 6825 6826 // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs 6827 function getLogicalSide(sideParam, renderedSide, isRtl) { 6828 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 6829 const logicalRight = isRtl ? "inline-start" : "inline-end"; 6830 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 6831 return { 6832 top: "top", 6833 right: isLogicalSideParam ? logicalRight : "right", 6834 bottom: "bottom", 6835 left: isLogicalSideParam ? logicalLeft : "left" 6836 }[renderedSide]; 6837 } 6838 function getOffsetData(state, sideParam, isRtl) { 6839 const { 6840 rects, 6841 placement 6842 } = state; 6843 const data = { 6844 side: getLogicalSide(sideParam, getSide(placement), isRtl), 6845 align: getAlignment(placement) || "center", 6846 anchor: { 6847 width: rects.reference.width, 6848 height: rects.reference.height 6849 }, 6850 positioner: { 6851 width: rects.floating.width, 6852 height: rects.floating.height 6853 } 6854 }; 6855 return data; 6856 } 6857 function useAnchorPositioning(params) { 6858 const { 6859 // Public parameters 6860 anchor, 6861 positionMethod = "absolute", 6862 side: sideParam = "bottom", 6863 sideOffset = 0, 6864 align = "center", 6865 alignOffset = 0, 6866 collisionBoundary, 6867 collisionPadding: collisionPaddingParam = 5, 6868 sticky = false, 6869 arrowPadding = 5, 6870 disableAnchorTracking = false, 6871 inline: inlineMiddleware, 6872 // Private parameters 6873 keepMounted = false, 6874 floatingRootContext, 6875 mounted, 6876 collisionAvoidance, 6877 shiftCrossAxis = false, 6878 nodeId, 6879 adaptiveOrigin: adaptiveOrigin2, 6880 lazyFlip = false, 6881 externalTree 6882 } = params; 6883 const [mountSide, setMountSide] = React29.useState(null); 6884 if (!mounted && mountSide !== null) { 6885 setMountSide(null); 6886 } 6887 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 6888 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 6889 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 6890 const anchorFn = typeof anchor === "function" ? anchor : void 0; 6891 const anchorFnCallback = useStableCallback(anchorFn); 6892 const anchorDep = anchorFn ? anchorFnCallback : anchor; 6893 const anchorValueRef = useValueAsRef(anchor); 6894 const mountedRef = useValueAsRef(mounted); 6895 const direction = useDirection(); 6896 const isRtl = direction === "rtl"; 6897 const side = mountSide || { 6898 top: "top", 6899 right: "right", 6900 bottom: "bottom", 6901 left: "left", 6902 "inline-end": isRtl ? "left" : "right", 6903 "inline-start": isRtl ? "right" : "left" 6904 }[sideParam]; 6905 const placement = align === "center" ? side : `$side}-$align}`; 6906 let collisionPadding = collisionPaddingParam; 6907 const bias = 1; 6908 const biasTop = sideParam === "bottom" ? bias : 0; 6909 const biasBottom = sideParam === "top" ? bias : 0; 6910 const biasLeft = sideParam === "right" ? bias : 0; 6911 const biasRight = sideParam === "left" ? bias : 0; 6912 if (typeof collisionPadding === "number") { 6913 collisionPadding = { 6914 top: collisionPadding + biasTop, 6915 right: collisionPadding + biasRight, 6916 bottom: collisionPadding + biasBottom, 6917 left: collisionPadding + biasLeft 6918 }; 6919 } else if (collisionPadding) { 6920 collisionPadding = { 6921 top: (collisionPadding.top || 0) + biasTop, 6922 right: (collisionPadding.right || 0) + biasRight, 6923 bottom: (collisionPadding.bottom || 0) + biasBottom, 6924 left: (collisionPadding.left || 0) + biasLeft 6925 }; 6926 } 6927 const commonCollisionProps = { 6928 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 6929 padding: collisionPadding 6930 }; 6931 const arrowRef = React29.useRef(null); 6932 const sideOffsetRef = useValueAsRef(sideOffset); 6933 const alignOffsetRef = useValueAsRef(alignOffset); 6934 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 6935 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 6936 const middleware = []; 6937 if (inlineMiddleware) { 6938 middleware.push(inlineMiddleware); 6939 } 6940 middleware.push(offset3((state) => { 6941 const data = getOffsetData(state, sideParam, isRtl); 6942 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 6943 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 6944 return { 6945 mainAxis: sideAxis, 6946 crossAxis: alignAxis, 6947 alignmentAxis: alignAxis 6948 }; 6949 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); 6950 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 6951 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 6952 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 6953 ...commonCollisionProps, 6954 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 6955 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 6956 padding: { 6957 top: collisionPadding.top + bias, 6958 right: collisionPadding.right + bias, 6959 bottom: collisionPadding.bottom + bias, 6960 left: collisionPadding.left + bias 6961 }, 6962 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 6963 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 6964 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 6965 }); 6966 const shiftMiddleware = shiftDisabled ? null : shift3((data) => { 6967 const html = ownerDocument(data.elements.floating).documentElement; 6968 return { 6969 ...commonCollisionProps, 6970 // Use the Layout Viewport to avoid shifting around when pinch-zooming 6971 // for context menus. 6972 rootBoundary: shiftCrossAxis ? { 6973 x: 0, 6974 y: 0, 6975 width: html.clientWidth, 6976 height: html.clientHeight 6977 } : void 0, 6978 mainAxis: collisionAvoidanceAlign !== "none", 6979 crossAxis: crossAxisShiftEnabled, 6980 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 6981 if (!arrowRef.current) { 6982 return {}; 6983 } 6984 const { 6985 width, 6986 height 6987 } = arrowRef.current.getBoundingClientRect(); 6988 const sideAxis = getSideAxis(getSide(limitData.placement)); 6989 const arrowSize = sideAxis === "y" ? width : height; 6990 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 6991 return { 6992 offset: arrowSize / 2 + offsetAmount / 2 6993 }; 6994 }) 6995 }; 6996 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]); 6997 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { 6998 middleware.push(shiftMiddleware, flipMiddleware); 6999 } else { 7000 middleware.push(flipMiddleware, shiftMiddleware); 7001 } 7002 middleware.push(size3({ 7003 ...commonCollisionProps, 7004 apply({ 7005 elements: { 7006 floating 7007 }, 7008 availableWidth, 7009 availableHeight, 7010 rects 7011 }) { 7012 if (!mountedRef.current) { 7013 return; 7014 } 7015 const floatingStyle = floating.style; 7016 floatingStyle.setProperty("--available-width", `$availableWidth}px`); 7017 floatingStyle.setProperty("--available-height", `$availableHeight}px`); 7018 const dpr = getWindow(floating).devicePixelRatio || 1; 7019 const { 7020 x: x2, 7021 y: y2, 7022 width, 7023 height 7024 } = rects.reference; 7025 const anchorWidth = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr; 7026 const anchorHeight = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr; 7027 floatingStyle.setProperty("--anchor-width", `$anchorWidth}px`); 7028 floatingStyle.setProperty("--anchor-height", `$anchorHeight}px`); 7029 } 7030 }), arrow4((state) => ({ 7031 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 7032 // we'll create a fake element. 7033 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), 7034 padding: arrowPadding, 7035 offsetParent: "floating" 7036 }), [arrowPadding]), { 7037 name: "transformOrigin", 7038 fn(state) { 7039 const { 7040 elements: elements2, 7041 middlewareData: middlewareData2, 7042 placement: renderedPlacement2, 7043 rects, 7044 y: y2 7045 } = state; 7046 const currentRenderedSide = getSide(renderedPlacement2); 7047 const currentRenderedAxis = getSideAxis(currentRenderedSide); 7048 const arrowEl = arrowRef.current; 7049 const arrowX = middlewareData2.arrow?.x || 0; 7050 const arrowY = middlewareData2.arrow?.y || 0; 7051 const arrowWidth = arrowEl?.clientWidth || 0; 7052 const arrowHeight = arrowEl?.clientHeight || 0; 7053 const transformX = arrowX + arrowWidth / 2; 7054 const transformY = arrowY + arrowHeight / 2; 7055 const shiftY = Math.abs(middlewareData2.shift?.y || 0); 7056 const halfAnchorHeight = rects.reference.height / 2; 7057 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; 7058 const isOverlappingAnchor = shiftY > sideOffsetValue; 7059 const adjacentTransformOrigin = { 7060 top: `$transformX}px calc(100% + $sideOffsetValue}px)`, 7061 bottom: `$transformX}px ${-sideOffsetValue}px`, 7062 left: `calc(100% + $sideOffsetValue}px) $transformY}px`, 7063 right: `${-sideOffsetValue}px $transformY}px` 7064 }[currentRenderedSide]; 7065 const overlapTransformOrigin = `$transformX}px $rects.reference.y + halfAnchorHeight - y2}px`; 7066 elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin); 7067 return {}; 7068 } 7069 }, hide4, adaptiveOrigin2); 7070 useIsoLayoutEffect(() => { 7071 if (!mounted && floatingRootContext) { 7072 floatingRootContext.update({ 7073 referenceElement: null, 7074 floatingElement: null, 7075 domReferenceElement: null, 7076 positionReference: null 7077 }); 7078 } 7079 }, [mounted, floatingRootContext]); 7080 const autoUpdateOptions = React29.useMemo(() => ({ 7081 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 7082 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 7083 }), [disableAnchorTracking]); 7084 const { 7085 refs, 7086 elements, 7087 x, 7088 y, 7089 middlewareData, 7090 update: update2, 7091 placement: renderedPlacement, 7092 context, 7093 isPositioned, 7094 floatingStyles: originalFloatingStyles 7095 } = useFloating2({ 7096 rootContext: floatingRootContext, 7097 open: keepMounted ? mounted : void 0, 7098 placement, 7099 middleware, 7100 strategy: positionMethod, 7101 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 7102 nodeId, 7103 externalTree 7104 }); 7105 const { 7106 sideX, 7107 sideY 7108 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 7109 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 7110 const floatingStyles = React29.useMemo(() => { 7111 const base = adaptiveOrigin2 ? { 7112 position: resolvedPosition, 7113 [sideX]: x, 7114 [sideY]: y 7115 } : { 7116 position: resolvedPosition, 7117 ...originalFloatingStyles 7118 }; 7119 if (!isPositioned) { 7120 base.opacity = 0; 7121 } 7122 return base; 7123 }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]); 7124 const registeredPositionReferenceRef = React29.useRef(null); 7125 useIsoLayoutEffect(() => { 7126 if (!mounted) { 7127 return; 7128 } 7129 const anchorValue = anchorValueRef.current; 7130 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 7131 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 7132 const finalAnchor = unwrappedElement || null; 7133 if (finalAnchor !== registeredPositionReferenceRef.current) { 7134 refs.setPositionReference(finalAnchor); 7135 registeredPositionReferenceRef.current = finalAnchor; 7136 } 7137 }, [mounted, refs, anchorDep, anchorValueRef]); 7138 React29.useEffect(() => { 7139 if (!mounted) { 7140 return; 7141 } 7142 const anchorValue = anchorValueRef.current; 7143 if (typeof anchorValue === "function") { 7144 return; 7145 } 7146 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 7147 refs.setPositionReference(anchorValue.current); 7148 registeredPositionReferenceRef.current = anchorValue.current; 7149 } 7150 }, [mounted, refs, anchorDep, anchorValueRef]); 7151 React29.useEffect(() => { 7152 if (keepMounted && mounted && elements.reference && elements.floating) { 7153 return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions); 7154 } 7155 return void 0; 7156 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); 7157 const renderedSide = getSide(renderedPlacement); 7158 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 7159 const renderedAlign = getAlignment(renderedPlacement) || "center"; 7160 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden); 7161 useIsoLayoutEffect(() => { 7162 if (lazyFlip && mounted && isPositioned) { 7163 setMountSide(renderedSide); 7164 } 7165 }, [lazyFlip, mounted, isPositioned, renderedSide]); 7166 const arrowStyles = React29.useMemo(() => ({ 7167 position: "absolute", 7168 top: middlewareData.arrow?.y, 7169 left: middlewareData.arrow?.x 7170 }), [middlewareData.arrow]); 7171 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 7172 return React29.useMemo(() => ({ 7173 positionerStyles: floatingStyles, 7174 arrowStyles, 7175 arrowRef, 7176 arrowUncentered, 7177 side: logicalRenderedSide, 7178 align: renderedAlign, 7179 physicalSide: renderedSide, 7180 anchorHidden, 7181 refs, 7182 context, 7183 isPositioned, 7184 update: update2 7185 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]); 7186 } 7187 function isRef(param) { 7188 return param != null && "current" in param; 7189 } 7190 7191 // node_modules/@base-ui/react/utils/getDisabledMountTransitionStyles.mjs 7192 function getDisabledMountTransitionStyles(transitionStatus) { 7193 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; 7194 } 7195 7196 // node_modules/@base-ui/react/utils/usePositioner.mjs 7197 function usePositioner(componentProps, state, { 7198 styles, 7199 transitionStatus, 7200 props, 7201 refs, 7202 hidden, 7203 inert = false 7204 }) { 7205 const style = { 7206 ...styles 7207 }; 7208 if (inert) { 7209 style.pointerEvents = "none"; 7210 } 7211 return useRenderElement("div", componentProps, { 7212 state, 7213 ref: refs, 7214 props: [{ 7215 role: "presentation", 7216 hidden, 7217 style 7218 }, getDisabledMountTransitionStyles(transitionStatus), props], 7219 stateAttributesMapping: popupStateMapping 7220 }); 7221 } 7222 7223 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 7224 var React32 = __toESM(require_react(), 1); 7225 var ReactDOM6 = __toESM(require_react_dom(), 1); 7226 7227 // node_modules/@base-ui/utils/usePreviousValue.mjs 7228 var React30 = __toESM(require_react(), 1); 7229 function usePreviousValue(value) { 7230 const [state, setState] = React30.useState({ 7231 current: value, 7232 previous: null 7233 }); 7234 if (value !== state.current) { 7235 setState({ 7236 current: value, 7237 previous: state.current 7238 }); 7239 } 7240 return state.previous; 7241 } 7242 7243 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 7244 var React31 = __toESM(require_react(), 1); 7245 7246 // node_modules/@base-ui/react/utils/getCssDimensions.mjs 7247 function getCssDimensions2(element) { 7248 const css = getComputedStyle2(element); 7249 let width = parseFloat(css.width) || 0; 7250 let height = parseFloat(css.height) || 0; 7251 const hasOffset = isHTMLElement(element); 7252 const offsetWidth = hasOffset ? element.offsetWidth : width; 7253 const offsetHeight = hasOffset ? element.offsetHeight : height; 7254 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 7255 if (shouldFallback) { 7256 width = offsetWidth; 7257 height = offsetHeight; 7258 } 7259 return { 7260 width, 7261 height 7262 }; 7263 } 7264 7265 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 7266 function usePopupAutoResize(parameters) { 7267 const { 7268 popupElement, 7269 positionerElement, 7270 content, 7271 mounted, 7272 onMeasureLayout: onMeasureLayoutParam, 7273 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 7274 side, 7275 direction 7276 } = parameters; 7277 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false); 7278 const animationFrame = useAnimationFrame(); 7279 const committedDimensionsRef = React31.useRef(null); 7280 const isInitialRenderRef = React31.useRef(true); 7281 const restoreAnchoringStylesRef = React31.useRef(NOOP); 7282 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 7283 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 7284 const anchoringStyles = React31.useMemo(() => { 7285 let isOriginSide = side === "top"; 7286 let isPhysicalLeft = side === "left"; 7287 if (direction === "rtl") { 7288 isOriginSide = isOriginSide || side === "inline-end"; 7289 isPhysicalLeft = isPhysicalLeft || side === "inline-end"; 7290 } else { 7291 isOriginSide = isOriginSide || side === "inline-start"; 7292 isPhysicalLeft = isPhysicalLeft || side === "inline-start"; 7293 } 7294 return isOriginSide ? { 7295 position: "absolute", 7296 [side === "top" ? "bottom" : "top"]: "0", 7297 [isPhysicalLeft ? "right" : "left"]: "0" 7298 } : EMPTY_OBJECT; 7299 }, [side, direction]); 7300 useIsoLayoutEffect(() => { 7301 if (!mounted) { 7302 restoreAnchoringStylesRef.current = NOOP; 7303 isInitialRenderRef.current = true; 7304 committedDimensionsRef.current = null; 7305 return void 0; 7306 } 7307 if (!popupElement || !positionerElement) { 7308 return void 0; 7309 } 7310 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); 7311 setPopupCssSize(popupElement, "auto"); 7312 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 7313 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 7314 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 7315 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 7316 "--available-width": "max-content", 7317 "--available-height": "max-content" 7318 }); 7319 function restoreMeasurementOverrides() { 7320 restorePopupPosition(); 7321 restorePopupTransform(); 7322 restorePositionerAvailableSize(); 7323 } 7324 function restoreMeasurementOverridesIncludingScale() { 7325 restoreMeasurementOverrides(); 7326 restorePopupScale(); 7327 } 7328 onMeasureLayout?.(); 7329 if (isInitialRenderRef.current || committedDimensionsRef.current === null) { 7330 setPositionerCssSize(positionerElement, "max-content"); 7331 const dimensions = getCssDimensions2(popupElement); 7332 committedDimensionsRef.current = dimensions; 7333 setPositionerCssSize(positionerElement, dimensions); 7334 restoreMeasurementOverridesIncludingScale(); 7335 onMeasureLayoutComplete?.(null, dimensions); 7336 isInitialRenderRef.current = false; 7337 return () => { 7338 restoreAnchoringStylesRef.current(); 7339 restoreAnchoringStylesRef.current = NOOP; 7340 }; 7341 } 7342 setPositionerCssSize(positionerElement, "max-content"); 7343 const previousDimensions = committedDimensionsRef.current; 7344 const newDimensions = getCssDimensions2(popupElement); 7345 committedDimensionsRef.current = newDimensions; 7346 setPopupCssSize(popupElement, previousDimensions); 7347 restoreMeasurementOverridesIncludingScale(); 7348 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 7349 setPositionerCssSize(positionerElement, newDimensions); 7350 const abortController = new AbortController(); 7351 animationFrame.request(() => { 7352 setPopupCssSize(popupElement, newDimensions); 7353 runOnceAnimationsFinish(() => { 7354 popupElement.style.setProperty("--popup-width", "auto"); 7355 popupElement.style.setProperty("--popup-height", "auto"); 7356 }, abortController.signal); 7357 }); 7358 return () => { 7359 abortController.abort(); 7360 animationFrame.cancel(); 7361 restoreAnchoringStylesRef.current(); 7362 restoreAnchoringStylesRef.current = NOOP; 7363 }; 7364 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 7365 } 7366 function overrideElementStyle(element, property, value) { 7367 const originalValue = element.style.getPropertyValue(property); 7368 element.style.setProperty(property, value); 7369 return () => { 7370 element.style.setProperty(property, originalValue); 7371 }; 7372 } 7373 function applyElementStyles(element, styles) { 7374 const restorers = []; 7375 for (const [key, value] of Object.entries(styles)) { 7376 restorers.push(overrideElementStyle(element, key, value)); 7377 } 7378 return restorers.length ? () => { 7379 restorers.forEach((restore) => restore()); 7380 } : NOOP; 7381 } 7382 function setPopupCssSize(popupElement, size4) { 7383 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 7384 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 7385 popupElement.style.setProperty("--popup-width", width); 7386 popupElement.style.setProperty("--popup-height", height); 7387 } 7388 function setPositionerCssSize(positionerElement, size4) { 7389 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 7390 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 7391 positionerElement.style.setProperty("--positioner-width", width); 7392 positionerElement.style.setProperty("--positioner-height", height); 7393 } 7394 7395 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 7396 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 7397 function usePopupViewport(parameters) { 7398 const { 7399 store: store2, 7400 side, 7401 cssVars, 7402 children 7403 } = parameters; 7404 const direction = useDirection(); 7405 const activeTrigger = store2.useState("activeTriggerElement"); 7406 const activeTriggerId = store2.useState("activeTriggerId"); 7407 const open = store2.useState("open"); 7408 const payload = store2.useState("payload"); 7409 const mounted = store2.useState("mounted"); 7410 const popupElement = store2.useState("popupElement"); 7411 const positionerElement = store2.useState("positionerElement"); 7412 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null); 7413 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 7414 const capturedNodeRef = React32.useRef(null); 7415 const [previousContentNode, setPreviousContentNode] = React32.useState(null); 7416 const [newTriggerOffset, setNewTriggerOffset] = React32.useState(null); 7417 const currentContainerRef = React32.useRef(null); 7418 const previousContainerRef = React32.useRef(null); 7419 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false); 7420 const cleanupFrame = useAnimationFrame(); 7421 const [previousContentDimensions, setPreviousContentDimensions] = React32.useState(null); 7422 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React32.useState(false); 7423 useIsoLayoutEffect(() => { 7424 store2.set("hasViewport", true); 7425 return () => { 7426 store2.set("hasViewport", false); 7427 }; 7428 }, [store2]); 7429 const handleMeasureLayout = useStableCallback(() => { 7430 currentContainerRef.current?.style.setProperty("animation", "none"); 7431 currentContainerRef.current?.style.setProperty("transition", "none"); 7432 previousContainerRef.current?.style.setProperty("display", "none"); 7433 }); 7434 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 7435 currentContainerRef.current?.style.removeProperty("animation"); 7436 currentContainerRef.current?.style.removeProperty("transition"); 7437 previousContainerRef.current?.style.removeProperty("display"); 7438 if (previousDimensions) { 7439 setPreviousContentDimensions(previousDimensions); 7440 } 7441 }); 7442 const lastHandledTriggerRef = React32.useRef(null); 7443 useIsoLayoutEffect(() => { 7444 if (!open || !mounted) { 7445 lastHandledTriggerRef.current = null; 7446 } 7447 }, [open, mounted]); 7448 useIsoLayoutEffect(() => { 7449 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 7450 setPreviousContentNode(capturedNodeRef.current); 7451 setShowStartingStyleAttribute(true); 7452 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 7453 setNewTriggerOffset(offset4); 7454 cleanupFrame.request(() => { 7455 ReactDOM6.flushSync(() => { 7456 setShowStartingStyleAttribute(false); 7457 }); 7458 onAnimationsFinished(() => { 7459 setPreviousContentNode(null); 7460 setPreviousContentDimensions(null); 7461 capturedNodeRef.current = null; 7462 }); 7463 }); 7464 lastHandledTriggerRef.current = activeTrigger; 7465 } 7466 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]); 7467 useIsoLayoutEffect(() => { 7468 const source = currentContainerRef.current; 7469 if (!source) { 7470 return; 7471 } 7472 const wrapper = ownerDocument(source).createElement("div"); 7473 for (const child of Array.from(source.childNodes)) { 7474 wrapper.appendChild(child.cloneNode(true)); 7475 } 7476 capturedNodeRef.current = wrapper; 7477 }); 7478 const isTransitioning = previousContentNode != null; 7479 let childrenToRender; 7480 if (!isTransitioning) { 7481 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7482 "data-current": true, 7483 ref: currentContainerRef, 7484 children 7485 }, currentContentKey); 7486 } else { 7487 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(React32.Fragment, { 7488 children: [/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7489 "data-previous": true, 7490 inert: inertValue(true), 7491 ref: previousContainerRef, 7492 style: { 7493 ...previousContentDimensions ? { 7494 [cssVars.popupWidth]: `$previousContentDimensions.width}px`, 7495 [cssVars.popupHeight]: `$previousContentDimensions.height}px` 7496 } : null, 7497 position: "absolute" 7498 }, 7499 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 7500 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7501 "data-current": true, 7502 ref: currentContainerRef, 7503 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 7504 children 7505 }, currentContentKey)] 7506 }); 7507 } 7508 useIsoLayoutEffect(() => { 7509 const container = previousContainerRef.current; 7510 if (!container || !previousContentNode) { 7511 return; 7512 } 7513 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 7514 }, [previousContentNode]); 7515 usePopupAutoResize({ 7516 popupElement, 7517 positionerElement, 7518 mounted, 7519 content: payload, 7520 onMeasureLayout: handleMeasureLayout, 7521 onMeasureLayoutComplete: handleMeasureLayoutComplete, 7522 side, 7523 direction 7524 }); 7525 const state = { 7526 activationDirection: getActivationDirection(newTriggerOffset), 7527 transitioning: isTransitioning 7528 }; 7529 return { 7530 children: childrenToRender, 7531 state 7532 }; 7533 } 7534 function getActivationDirection(offset4) { 7535 if (!offset4) { 7536 return void 0; 7537 } 7538 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 7539 } 7540 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 7541 if (value > tolerance) { 7542 return positiveLabel; 7543 } 7544 if (value < -tolerance) { 7545 return negativeLabel; 7546 } 7547 return ""; 7548 } 7549 function calculateRelativePosition(from, to) { 7550 const fromRect = from.getBoundingClientRect(); 7551 const toRect = to.getBoundingClientRect(); 7552 const fromCenter = { 7553 x: fromRect.left + fromRect.width / 2, 7554 y: fromRect.top + fromRect.height / 2 7555 }; 7556 const toCenter = { 7557 x: toRect.left + toRect.width / 2, 7558 y: toRect.top + toRect.height / 2 7559 }; 7560 return { 7561 horizontal: toCenter.x - fromCenter.x, 7562 vertical: toCenter.y - fromCenter.y 7563 }; 7564 } 7565 function usePopupContentKey(activeTriggerId, payload) { 7566 const [contentKey, setContentKey] = React32.useState(0); 7567 const previousActiveTriggerIdRef = React32.useRef(activeTriggerId); 7568 const previousPayloadRef = React32.useRef(payload); 7569 const pendingPayloadUpdateRef = React32.useRef(false); 7570 useIsoLayoutEffect(() => { 7571 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 7572 const previousPayload = previousPayloadRef.current; 7573 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 7574 const payloadChanged = payload !== previousPayload; 7575 if (triggerIdChanged) { 7576 setContentKey((value) => value + 1); 7577 pendingPayloadUpdateRef.current = !payloadChanged; 7578 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 7579 setContentKey((value) => value + 1); 7580 pendingPayloadUpdateRef.current = false; 7581 } 7582 previousActiveTriggerIdRef.current = activeTriggerId; 7583 previousPayloadRef.current = payload; 7584 }, [activeTriggerId, payload]); 7585 return `$activeTriggerId ?? "current"}-$contentKey}`; 7586 } 7587 7588 // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs 7589 var React33 = __toESM(require_react(), 1); 7590 var ReactDOM7 = __toESM(require_react_dom(), 1); 7591 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 7592 var FloatingPortalLite = /* @__PURE__ */ React33.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 7593 const { 7594 children, 7595 container, 7596 className, 7597 render, 7598 style, 7599 ...elementProps 7600 } = componentProps; 7601 const { 7602 portalNode, 7603 portalSubtree 7604 } = useFloatingPortalNode({ 7605 container, 7606 ref: forwardedRef, 7607 componentProps, 7608 elementProps 7609 }); 7610 if (!portalSubtree && !portalNode) { 7611 return null; 7612 } 7613 return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React33.Fragment, { 7614 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] 7615 }); 7616 }); 7617 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 7618 7619 // node_modules/@base-ui/react/tooltip/index.parts.mjs 7620 var index_parts_exports = {}; 7621 __export(index_parts_exports, { 7622 Arrow: () => TooltipArrow, 7623 Handle: () => TooltipHandle, 7624 Popup: () => TooltipPopup, 7625 Portal: () => TooltipPortal, 7626 Positioner: () => TooltipPositioner, 7627 Provider: () => TooltipProvider, 7628 Root: () => TooltipRoot, 7629 Trigger: () => TooltipTrigger, 7630 Viewport: () => TooltipViewport, 7631 createHandle: () => createTooltipHandle 7632 }); 7633 7634 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 7635 var React36 = __toESM(require_react(), 1); 7636 7637 // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs 7638 var React34 = __toESM(require_react(), 1); 7639 var TooltipRootContext = /* @__PURE__ */ React34.createContext(void 0); 7640 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 7641 function useTooltipRootContext(optional) { 7642 const context = React34.useContext(TooltipRootContext); 7643 if (context === void 0 && !optional) { 7644 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 7645 } 7646 return context; 7647 } 7648 7649 // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs 7650 var React35 = __toESM(require_react(), 1); 7651 var selectors2 = { 7652 ...popupStoreSelectors, 7653 disabled: createSelector((state) => state.disabled), 7654 instantType: createSelector((state) => state.instantType), 7655 isInstantPhase: createSelector((state) => state.isInstantPhase), 7656 trackCursorAxis: createSelector((state) => state.trackCursorAxis), 7657 disableHoverablePopup: createSelector((state) => state.disableHoverablePopup), 7658 lastOpenChangeReason: createSelector((state) => state.openChangeReason), 7659 closeOnClick: createSelector((state) => state.closeOnClick), 7660 closeDelay: createSelector((state) => state.closeDelay), 7661 hasViewport: createSelector((state) => state.hasViewport) 7662 }; 7663 var TooltipStore = class _TooltipStore extends ReactStore { 7664 constructor(initialState2, floatingId, nested = false) { 7665 const triggerElements = new PopupTriggerMap(); 7666 const state = { 7667 ...createInitialState(), 7668 ...initialState2 7669 }; 7670 state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested); 7671 super(state, { 7672 popupRef: /* @__PURE__ */ React35.createRef(), 7673 onOpenChange: void 0, 7674 onOpenChangeComplete: void 0, 7675 triggerElements 7676 }, selectors2); 7677 } 7678 setOpen = (nextOpen, eventDetails) => { 7679 applyPopupOpenChange(this, nextOpen, eventDetails, { 7680 extraState: { 7681 openChangeReason: eventDetails.reason 7682 } 7683 }); 7684 }; 7685 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. 7686 cancelPendingOpen(event) { 7687 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); 7688 } 7689 static useStore(externalStore, initialState2) { 7690 const store2 = usePopupStore(externalStore, (floatingId, nested) => new _TooltipStore(initialState2, floatingId, nested)).store; 7691 return store2; 7692 } 7693 }; 7694 function createInitialState() { 7695 return { 7696 ...createInitialPopupStoreState(), 7697 disabled: false, 7698 instantType: void 0, 7699 isInstantPhase: false, 7700 trackCursorAxis: "none", 7701 disableHoverablePopup: false, 7702 openChangeReason: null, 7703 closeOnClick: true, 7704 closeDelay: 0, 7705 hasViewport: false 7706 }; 7707 } 7708 7709 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 7710 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 7711 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 7712 const { 7713 disabled: disabled2 = false, 7714 defaultOpen = false, 7715 open: openProp, 7716 disableHoverablePopup = false, 7717 trackCursorAxis = "none", 7718 actionsRef, 7719 onOpenChange, 7720 onOpenChangeComplete, 7721 handle, 7722 triggerId: triggerIdProp, 7723 defaultTriggerId: defaultTriggerIdProp = null, 7724 children 7725 } = props; 7726 const store2 = TooltipStore.useStore(handle?.store, { 7727 open: defaultOpen, 7728 openProp, 7729 activeTriggerId: defaultTriggerIdProp, 7730 triggerIdProp 7731 }); 7732 useInitialOpenSync(store2, openProp, defaultOpen, defaultTriggerIdProp); 7733 store2.useControlledProp("openProp", openProp); 7734 store2.useControlledProp("triggerIdProp", triggerIdProp); 7735 store2.useContextCallback("onOpenChange", onOpenChange); 7736 store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 7737 const openState = store2.useState("open"); 7738 const open = !disabled2 && openState; 7739 const activeTriggerId = store2.useState("activeTriggerId"); 7740 const mounted = store2.useState("mounted"); 7741 const payload = store2.useState("payload"); 7742 store2.useSyncedValues({ 7743 trackCursorAxis, 7744 disableHoverablePopup 7745 }); 7746 store2.useSyncedValue("disabled", disabled2); 7747 useImplicitActiveTrigger(store2, { 7748 closeOnActiveTriggerUnmount: true 7749 }); 7750 const { 7751 forceUnmount, 7752 transitionStatus 7753 } = useOpenStateTransitions(open, store2); 7754 const isInstantPhase = store2.useState("isInstantPhase"); 7755 const instantType = store2.useState("instantType"); 7756 const lastOpenChangeReason = store2.useState("lastOpenChangeReason"); 7757 const previousInstantTypeRef = React36.useRef(null); 7758 useIsoLayoutEffect(() => { 7759 if (openState && disabled2) { 7760 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 7761 } 7762 }, [openState, disabled2, store2]); 7763 useIsoLayoutEffect(() => { 7764 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 7765 if (instantType !== "delay") { 7766 previousInstantTypeRef.current = instantType; 7767 } 7768 store2.set("instantType", "delay"); 7769 } else if (previousInstantTypeRef.current !== null) { 7770 store2.set("instantType", previousInstantTypeRef.current); 7771 previousInstantTypeRef.current = null; 7772 } 7773 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]); 7774 useIsoLayoutEffect(() => { 7775 if (open) { 7776 if (activeTriggerId == null) { 7777 store2.set("payload", void 0); 7778 } 7779 } 7780 }, [store2, activeTriggerId, open]); 7781 const handleImperativeClose = React36.useCallback(() => { 7782 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 7783 }, [store2]); 7784 React36.useImperativeHandle(actionsRef, () => ({ 7785 unmount: forceUnmount, 7786 close: handleImperativeClose 7787 }), [forceUnmount, handleImperativeClose]); 7788 const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none"; 7789 return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(TooltipRootContext.Provider, { 7790 value: store2, 7791 children: [shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipInteractions, { 7792 store: store2, 7793 disabled: disabled2, 7794 trackCursorAxis 7795 }), typeof children === "function" ? children({ 7796 payload 7797 }) : children] 7798 }); 7799 }); 7800 if (true) TooltipRoot.displayName = "TooltipRoot"; 7801 function TooltipInteractions({ 7802 store: store2, 7803 disabled: disabled2, 7804 trackCursorAxis 7805 }) { 7806 const floatingRootContext = store2.useState("floatingRootContext"); 7807 const dismiss = useDismiss(floatingRootContext, { 7808 enabled: !disabled2, 7809 referencePress: () => store2.select("closeOnClick") 7810 }); 7811 const clientPoint = useClientPoint(floatingRootContext, { 7812 enabled: !disabled2 && trackCursorAxis !== "none", 7813 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 7814 }); 7815 const activeTriggerProps = React36.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); 7816 const inactiveTriggerProps = React36.useMemo(() => mergeProps(clientPoint.trigger, dismiss.trigger), [clientPoint.trigger, dismiss.trigger]); 7817 const popupProps = React36.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [clientPoint.floating, dismiss.floating]); 7818 usePopupInteractionProps(store2, { 7819 activeTriggerProps, 7820 inactiveTriggerProps, 7821 popupProps 7822 }); 7823 return null; 7824 } 7825 7826 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 7827 var React38 = __toESM(require_react(), 1); 7828 7829 // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs 7830 var React37 = __toESM(require_react(), 1); 7831 var TooltipProviderContext = /* @__PURE__ */ React37.createContext(void 0); 7832 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 7833 function useTooltipProviderContext() { 7834 return React37.useContext(TooltipProviderContext); 7835 } 7836 7837 // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs 7838 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) { 7839 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen"; 7840 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled"; 7841 return TooltipTriggerDataAttributes2; 7842 })({}); 7843 7844 // node_modules/@base-ui/react/tooltip/utils/constants.mjs 7845 var OPEN_DELAY = 600; 7846 7847 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 7848 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; 7849 function getTargetElement(event) { 7850 if ("composedPath" in event) { 7851 const path = event.composedPath(); 7852 for (let i = 0; i < path.length; i += 1) { 7853 const element = path[i]; 7854 if (isElement(element)) { 7855 return element; 7856 } 7857 } 7858 } 7859 const target = event.target; 7860 if (isElement(target)) { 7861 return target; 7862 } 7863 return null; 7864 } 7865 function closestEnabledTooltipTrigger(element) { 7866 let current = element; 7867 while (current) { 7868 if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) { 7869 return current; 7870 } 7871 const parentElement = current.parentElement; 7872 if (parentElement) { 7873 current = parentElement; 7874 continue; 7875 } 7876 const root = current.getRootNode(); 7877 current = "host" in root && isElement(root.host) ? root.host : null; 7878 } 7879 return null; 7880 } 7881 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 7882 const { 7883 render, 7884 className, 7885 style, 7886 handle, 7887 payload, 7888 disabled: disabledProp, 7889 delay, 7890 closeOnClick = true, 7891 closeDelay, 7892 id: idProp, 7893 ...elementProps 7894 } = componentProps; 7895 const rootContext = useTooltipRootContext(true); 7896 const store2 = handle?.store ?? rootContext; 7897 if (!store2) { 7898 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)); 7899 } 7900 const thisTriggerId = useBaseUiId(idProp); 7901 const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId); 7902 const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId); 7903 const floatingRootContext = store2.useState("floatingRootContext"); 7904 const triggerElementRef = React38.useRef(null); 7905 const delayWithDefault = delay ?? OPEN_DELAY; 7906 const closeDelayWithDefault = closeDelay ?? 0; 7907 const { 7908 registerTrigger, 7909 isMountedByThisTrigger 7910 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, { 7911 payload, 7912 closeOnClick, 7913 closeDelay: closeDelayWithDefault 7914 }); 7915 const providerContext = useTooltipProviderContext(); 7916 const { 7917 delayRef, 7918 isInstantPhase, 7919 hasProvider 7920 } = useDelayGroup(floatingRootContext, { 7921 open: isOpenedByThisTrigger 7922 }); 7923 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); 7924 store2.useSyncedValue("isInstantPhase", isInstantPhase); 7925 const rootDisabled = store2.useState("disabled"); 7926 const disabled2 = disabledProp ?? rootDisabled; 7927 const disabledRef = useValueAsRef(disabled2); 7928 const trackCursorAxis = store2.useState("trackCursorAxis"); 7929 const disableHoverablePopup = store2.useState("disableHoverablePopup"); 7930 const isNestedTriggerHoveredRef = React38.useRef(false); 7931 const nestedTriggerOpenTimeout = useTimeout(); 7932 const pointerTypeRef = React38.useRef(void 0); 7933 function getOpenDelay() { 7934 const providerDelay = providerContext?.delay; 7935 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0; 7936 let computedOpenDelay = delayWithDefault; 7937 if (hasProvider) { 7938 if (groupOpenValue !== 0) { 7939 computedOpenDelay = delay ?? providerDelay ?? delayWithDefault; 7940 } else { 7941 computedOpenDelay = 0; 7942 } 7943 } 7944 return computedOpenDelay; 7945 } 7946 function isEnabledNestedTriggerTarget(target) { 7947 const triggerEl = triggerElementRef.current; 7948 if (!triggerEl || !target) { 7949 return false; 7950 } 7951 const nearestTrigger = closestEnabledTooltipTrigger(target); 7952 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); 7953 } 7954 function detectNestedTriggerHover(target) { 7955 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); 7956 isNestedTriggerHoveredRef.current = nestedTriggerHovered; 7957 if (nestedTriggerHovered) { 7958 hoverInteraction.openChangeTimeout.clear(); 7959 hoverInteraction.restTimeout.clear(); 7960 hoverInteraction.restTimeoutPending = false; 7961 nestedTriggerOpenTimeout.clear(); 7962 } 7963 return nestedTriggerHovered; 7964 } 7965 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 7966 enabled: !disabled2, 7967 mouseOnly: true, 7968 move: false, 7969 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 7970 restMs: getOpenDelay, 7971 delay() { 7972 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0; 7973 let computedCloseDelay = closeDelayWithDefault; 7974 if (closeDelay == null && hasProvider) { 7975 computedCloseDelay = closeValue; 7976 } 7977 return { 7978 close: computedCloseDelay 7979 }; 7980 }, 7981 triggerElementRef, 7982 isActiveTrigger: isTriggerActive, 7983 isClosing: () => store2.select("transitionStatus") === "ending", 7984 shouldOpen() { 7985 return !isNestedTriggerHoveredRef.current; 7986 } 7987 }); 7988 const focusProps = useFocus(floatingRootContext, { 7989 enabled: !disabled2 7990 }).reference; 7991 const handleNestedTriggerHover = (event) => { 7992 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; 7993 const target = getTargetElement(event); 7994 const nestedTriggerHovered = detectNestedTriggerHover(target); 7995 const triggerEl = triggerElementRef.current; 7996 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); 7997 if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { 7998 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 7999 return; 8000 } 8001 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. 8002 isMouseLikePointerType(pointerTypeRef.current)) { 8003 const open = () => { 8004 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) { 8005 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); 8006 } 8007 }; 8008 const openDelay = getOpenDelay(); 8009 if (openDelay === 0) { 8010 nestedTriggerOpenTimeout.clear(); 8011 open(); 8012 } else { 8013 nestedTriggerOpenTimeout.start(openDelay, open); 8014 } 8015 } 8016 }; 8017 const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger); 8018 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; 8019 const state = { 8020 open: isOpenedByThisTrigger 8021 }; 8022 const element = useRenderElement("button", componentProps, { 8023 state, 8024 ref: [forwardedRef, registerTrigger, triggerElementRef], 8025 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { 8026 onMouseOver(event) { 8027 handleNestedTriggerHover(event.nativeEvent); 8028 }, 8029 onFocus(event) { 8030 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { 8031 event.preventBaseUIHandler(); 8032 } 8033 }, 8034 onMouseLeave() { 8035 isNestedTriggerHoveredRef.current = false; 8036 nestedTriggerOpenTimeout.clear(); 8037 pointerTypeRef.current = void 0; 8038 }, 8039 onPointerEnter(event) { 8040 pointerTypeRef.current = event.pointerType; 8041 }, 8042 onPointerDown(event) { 8043 pointerTypeRef.current = event.pointerType; 8044 store2.set("closeOnClick", closeOnClick); 8045 if (closeOnClick && !store2.select("open")) { 8046 store2.cancelPendingOpen(event.nativeEvent); 8047 } 8048 }, 8049 onClick(event) { 8050 if (closeOnClick && !store2.select("open")) { 8051 store2.cancelPendingOpen(event.nativeEvent); 8052 } 8053 }, 8054 id: thisTriggerId, 8055 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0, 8056 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" 8057 }, elementProps], 8058 stateAttributesMapping: triggerOpenStateMapping 8059 }); 8060 return element; 8061 }); 8062 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 8063 8064 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 8065 var React40 = __toESM(require_react(), 1); 8066 8067 // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs 8068 var React39 = __toESM(require_react(), 1); 8069 var TooltipPortalContext = /* @__PURE__ */ React39.createContext(void 0); 8070 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 8071 function useTooltipPortalContext() { 8072 const value = React39.useContext(TooltipPortalContext); 8073 if (value === void 0) { 8074 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 8075 } 8076 return value; 8077 } 8078 8079 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 8080 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 8081 var TooltipPortal = /* @__PURE__ */ React40.forwardRef(function TooltipPortal2(props, forwardedRef) { 8082 const { 8083 keepMounted = false, 8084 ...portalProps 8085 } = props; 8086 const store2 = useTooltipRootContext(); 8087 const mounted = store2.useState("mounted"); 8088 const shouldRender = mounted || keepMounted; 8089 if (!shouldRender) { 8090 return null; 8091 } 8092 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipPortalContext.Provider, { 8093 value: keepMounted, 8094 children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FloatingPortalLite, { 8095 ref: forwardedRef, 8096 ...portalProps 8097 }) 8098 }); 8099 }); 8100 if (true) TooltipPortal.displayName = "TooltipPortal"; 8101 8102 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 8103 var React42 = __toESM(require_react(), 1); 8104 8105 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs 8106 var React41 = __toESM(require_react(), 1); 8107 var TooltipPositionerContext = /* @__PURE__ */ React41.createContext(void 0); 8108 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 8109 function useTooltipPositionerContext() { 8110 const context = React41.useContext(TooltipPositionerContext); 8111 if (context === void 0) { 8112 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 8113 } 8114 return context; 8115 } 8116 8117 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 8118 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 8119 var TooltipPositioner = /* @__PURE__ */ React42.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 8120 const { 8121 render, 8122 className, 8123 anchor, 8124 positionMethod = "absolute", 8125 side = "top", 8126 align = "center", 8127 sideOffset = 0, 8128 alignOffset = 0, 8129 collisionBoundary = "clipping-ancestors", 8130 collisionPadding = 5, 8131 arrowPadding = 5, 8132 sticky = false, 8133 disableAnchorTracking = false, 8134 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 8135 style, 8136 ...elementProps 8137 } = componentProps; 8138 const store2 = useTooltipRootContext(); 8139 const keepMounted = useTooltipPortalContext(); 8140 const open = store2.useState("open"); 8141 const mounted = store2.useState("mounted"); 8142 const trackCursorAxis = store2.useState("trackCursorAxis"); 8143 const disableHoverablePopup = store2.useState("disableHoverablePopup"); 8144 const floatingRootContext = store2.useState("floatingRootContext"); 8145 const instantType = store2.useState("instantType"); 8146 const transitionStatus = store2.useState("transitionStatus"); 8147 const hasViewport = store2.useState("hasViewport"); 8148 const positioning = useAnchorPositioning({ 8149 anchor, 8150 positionMethod, 8151 floatingRootContext, 8152 mounted, 8153 side, 8154 sideOffset, 8155 align, 8156 alignOffset, 8157 collisionBoundary, 8158 collisionPadding, 8159 sticky, 8160 arrowPadding, 8161 disableAnchorTracking, 8162 keepMounted, 8163 collisionAvoidance, 8164 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0 8165 }); 8166 const state = React42.useMemo(() => ({ 8167 open, 8168 side: positioning.side, 8169 align: positioning.align, 8170 anchorHidden: positioning.anchorHidden, 8171 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 8172 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 8173 const element = usePositioner(componentProps, state, { 8174 styles: positioning.positionerStyles, 8175 transitionStatus, 8176 props: elementProps, 8177 refs: [forwardedRef, store2.useStateSetter("positionerElement")], 8178 hidden: !mounted, 8179 inert: !open || trackCursorAxis === "both" || disableHoverablePopup 8180 }); 8181 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPositionerContext.Provider, { 8182 value: positioning, 8183 children: element 8184 }); 8185 }); 8186 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 8187 8188 // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs 8189 var React43 = __toESM(require_react(), 1); 8190 var stateAttributesMapping = { 8191 ...popupStateMapping, 8192 ...transitionStatusMapping 8193 }; 8194 var TooltipPopup = /* @__PURE__ */ React43.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 8195 const { 8196 render, 8197 className, 8198 style, 8199 ...elementProps 8200 } = componentProps; 8201 const store2 = useTooltipRootContext(); 8202 const { 8203 side, 8204 align 8205 } = useTooltipPositionerContext(); 8206 const open = store2.useState("open"); 8207 const instantType = store2.useState("instantType"); 8208 const transitionStatus = store2.useState("transitionStatus"); 8209 const popupProps = store2.useState("popupProps"); 8210 const floatingContext = store2.useState("floatingRootContext"); 8211 const disabled2 = store2.useState("disabled"); 8212 const closeDelay = store2.useState("closeDelay"); 8213 useOpenChangeComplete({ 8214 open, 8215 ref: store2.context.popupRef, 8216 onComplete() { 8217 if (open) { 8218 store2.context.onOpenChangeComplete?.(true); 8219 } 8220 } 8221 }); 8222 useHoverFloatingInteraction(floatingContext, { 8223 enabled: !disabled2, 8224 closeDelay 8225 }); 8226 const setPopupElement = store2.useStateSetter("popupElement"); 8227 const state = { 8228 open, 8229 side, 8230 align, 8231 instant: instantType, 8232 transitionStatus 8233 }; 8234 const element = useRenderElement("div", componentProps, { 8235 state, 8236 ref: [forwardedRef, store2.context.popupRef, setPopupElement], 8237 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 8238 stateAttributesMapping 8239 }); 8240 return element; 8241 }); 8242 if (true) TooltipPopup.displayName = "TooltipPopup"; 8243 8244 // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs 8245 var React44 = __toESM(require_react(), 1); 8246 var TooltipArrow = /* @__PURE__ */ React44.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 8247 const { 8248 render, 8249 className, 8250 style, 8251 ...elementProps 8252 } = componentProps; 8253 const store2 = useTooltipRootContext(); 8254 const { 8255 arrowRef, 8256 side, 8257 align, 8258 arrowUncentered, 8259 arrowStyles 8260 } = useTooltipPositionerContext(); 8261 const open = store2.useState("open"); 8262 const instantType = store2.useState("instantType"); 8263 const state = { 8264 open, 8265 side, 8266 align, 8267 uncentered: arrowUncentered, 8268 instant: instantType 8269 }; 8270 const element = useRenderElement("div", componentProps, { 8271 state, 8272 ref: [forwardedRef, arrowRef], 8273 props: [{ 8274 style: arrowStyles, 8275 "aria-hidden": true 8276 }, elementProps], 8277 stateAttributesMapping: popupStateMapping 8278 }); 8279 return element; 8280 }); 8281 if (true) TooltipArrow.displayName = "TooltipArrow"; 8282 8283 // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs 8284 var React45 = __toESM(require_react(), 1); 8285 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 8286 var TooltipProvider = function TooltipProvider2(props) { 8287 const { 8288 delay, 8289 closeDelay, 8290 timeout = 400 8291 } = props; 8292 const contextValue = React45.useMemo(() => ({ 8293 delay, 8294 closeDelay 8295 }), [delay, closeDelay]); 8296 const delayValue = React45.useMemo(() => ({ 8297 open: delay, 8298 close: closeDelay 8299 }), [delay, closeDelay]); 8300 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipProviderContext.Provider, { 8301 value: contextValue, 8302 children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FloatingDelayGroup, { 8303 delay: delayValue, 8304 timeoutMs: timeout, 8305 children: props.children 8306 }) 8307 }); 8308 }; 8309 if (true) TooltipProvider.displayName = "TooltipProvider"; 8310 8311 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 8312 var React46 = __toESM(require_react(), 1); 8313 8314 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewportCssVars.mjs 8315 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) { 8316 TooltipViewportCssVars2["popupWidth"] = "--popup-width"; 8317 TooltipViewportCssVars2["popupHeight"] = "--popup-height"; 8318 return TooltipViewportCssVars2; 8319 })({}); 8320 8321 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 8322 var stateAttributesMapping2 = { 8323 activationDirection: (value) => value ? { 8324 "data-activation-direction": value 8325 } : null 8326 }; 8327 var TooltipViewport = /* @__PURE__ */ React46.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 8328 const { 8329 render, 8330 className, 8331 style, 8332 children, 8333 ...elementProps 8334 } = componentProps; 8335 const store2 = useTooltipRootContext(); 8336 const positioner = useTooltipPositionerContext(); 8337 const instantType = store2.useState("instantType"); 8338 const { 8339 children: childrenToRender, 8340 state: viewportState 8341 } = usePopupViewport({ 8342 store: store2, 8343 side: positioner.side, 8344 cssVars: TooltipViewportCssVars, 8345 children 8346 }); 8347 const state = { 8348 activationDirection: viewportState.activationDirection, 8349 transitioning: viewportState.transitioning, 8350 instant: instantType 8351 }; 8352 return useRenderElement("div", componentProps, { 8353 state, 8354 ref: forwardedRef, 8355 props: [elementProps, { 8356 children: childrenToRender 8357 }], 8358 stateAttributesMapping: stateAttributesMapping2 8359 }); 8360 }); 8361 if (true) TooltipViewport.displayName = "TooltipViewport"; 8362 8363 // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs 8364 var TooltipHandle = class { 8365 /** 8366 * Internal store holding the tooltip state. 8367 * @internal 8368 */ 8369 constructor() { 8370 this.store = new TooltipStore(); 8371 } 8372 /** 8373 * Opens the tooltip and associates it with the trigger with the given ID. 8374 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop. 8375 * 8376 * This method should only be called in an event handler or an effect (not during rendering). 8377 * 8378 * @param triggerId ID of the trigger to associate with the tooltip. 8379 */ 8380 open(triggerId) { 8381 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; 8382 if (triggerId && !triggerElement) { 8383 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "$triggerId}".` : formatErrorMessage_default(81, triggerId)); 8384 } 8385 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 8386 } 8387 /** 8388 * Closes the tooltip. 8389 */ 8390 close() { 8391 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); 8392 } 8393 /** 8394 * Indicates whether the tooltip is currently open. 8395 */ 8396 get isOpen() { 8397 return this.store.select("open"); 8398 } 8399 }; 8400 function createTooltipHandle() { 8401 return new TooltipHandle(); 8402 } 8403 8404 // node_modules/@base-ui/react/use-render/useRender.mjs 8405 function useRender(params) { 8406 return useRenderElement(params.defaultTagName ?? "div", params, params); 8407 } 8408 8409 // packages/ui/build-module/text/text.mjs 8410 var import_element10 = __toESM(require_element(), 1); 8411 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 8412 function getRuntime() { 8413 const globalScope = globalThis; 8414 if (globalScope.__wpStyleRuntime) { 8415 return globalScope.__wpStyleRuntime; 8416 } 8417 globalScope.__wpStyleRuntime = { 8418 documents: /* @__PURE__ */ new Map(), 8419 styles: /* @__PURE__ */ new Map(), 8420 injectedStyles: /* @__PURE__ */ new WeakMap() 8421 }; 8422 if (typeof document !== "undefined") { 8423 registerDocument(document); 8424 } 8425 return globalScope.__wpStyleRuntime; 8426 } 8427 function documentContainsStyleHash(targetDocument, hash) { 8428 if (!targetDocument.head) { 8429 return false; 8430 } 8431 for (const style of targetDocument.head.querySelectorAll( 8432 `style[$STYLE_HASH_ATTRIBUTE}]` 8433 )) { 8434 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 8435 return true; 8436 } 8437 } 8438 return false; 8439 } 8440 function injectStyle(targetDocument, hash, css) { 8441 if (!targetDocument.head) { 8442 return; 8443 } 8444 const runtime = getRuntime(); 8445 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8446 if (!injectedStyles) { 8447 injectedStyles = /* @__PURE__ */ new Set(); 8448 runtime.injectedStyles.set(targetDocument, injectedStyles); 8449 } 8450 if (injectedStyles.has(hash)) { 8451 return; 8452 } 8453 if (documentContainsStyleHash(targetDocument, hash)) { 8454 injectedStyles.add(hash); 8455 return; 8456 } 8457 const style = targetDocument.createElement("style"); 8458 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 8459 style.appendChild(targetDocument.createTextNode(css)); 8460 targetDocument.head.appendChild(style); 8461 injectedStyles.add(hash); 8462 } 8463 function registerDocument(targetDocument) { 8464 const runtime = getRuntime(); 8465 runtime.documents.set( 8466 targetDocument, 8467 (runtime.documents.get(targetDocument) ?? 0) + 1 8468 ); 8469 for (const [hash, css] of runtime.styles) { 8470 injectStyle(targetDocument, hash, css); 8471 } 8472 return () => { 8473 const count = runtime.documents.get(targetDocument); 8474 if (count === void 0) { 8475 return; 8476 } 8477 if (count <= 1) { 8478 runtime.documents.delete(targetDocument); 8479 return; 8480 } 8481 runtime.documents.set(targetDocument, count - 1); 8482 }; 8483 } 8484 function registerStyle(hash, css) { 8485 const runtime = getRuntime(); 8486 runtime.styles.set(hash, css); 8487 for (const targetDocument of runtime.documents.keys()) { 8488 injectStyle(targetDocument, hash, css); 8489 } 8490 } 8491 if (typeof process === "undefined" || true) { 8492 registerStyle("a495f9d138", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); 8493 } 8494 var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" }; 8495 if (typeof process === "undefined" || true) { 8496 registerStyle("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); 8497 } 8498 var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" }; 8499 var Text = (0, import_element10.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) { 8500 const element = useRender({ 8501 render, 8502 defaultTagName: "span", 8503 ref, 8504 props: mergeProps(props, { 8505 className: clsx_default( 8506 style_default.text, 8507 global_css_defense_default.heading, 8508 global_css_defense_default.p, 8509 style_default[variant], 8510 className 8511 ) 8512 }) 8513 }); 8514 return element; 8515 }); 8516 8517 // packages/icons/build-module/library/check.mjs 8518 var import_primitives = __toESM(require_primitives(), 1); 8519 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 8520 var check_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: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); 8521 8522 // packages/icons/build-module/library/chevron-down-small.mjs 8523 var import_primitives2 = __toESM(require_primitives(), 1); 8524 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 8525 var chevron_down_small_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: "m15.99 10.889-3.988 3.418-3.988-3.418.976-1.14 3.012 2.582 3.012-2.581.976 1.139Z" }) }); 8526 8527 // packages/icons/build-module/library/chevron-left-small.mjs 8528 var import_primitives3 = __toESM(require_primitives(), 1); 8529 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 8530 var chevron_left_small_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: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); 8531 8532 // packages/icons/build-module/library/chevron-left.mjs 8533 var import_primitives4 = __toESM(require_primitives(), 1); 8534 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 8535 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); 8536 8537 // packages/icons/build-module/library/chevron-right-small.mjs 8538 var import_primitives5 = __toESM(require_primitives(), 1); 8539 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 8540 var chevron_right_small_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: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); 8541 8542 // packages/icons/build-module/library/chevron-right.mjs 8543 var import_primitives6 = __toESM(require_primitives(), 1); 8544 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 8545 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives6.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); 8546 8547 // packages/icons/build-module/library/menu.mjs 8548 var import_primitives7 = __toESM(require_primitives(), 1); 8549 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 8550 var menu_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives7.Path, { d: "M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z" }) }); 8551 8552 // packages/ui/build-module/utils/render-slot-with-children.mjs 8553 var import_element11 = __toESM(require_element(), 1); 8554 function renderSlotWithChildren(slot, defaultSlot, children) { 8555 return (0, import_element11.cloneElement)(slot ?? defaultSlot, { children }); 8556 } 8557 8558 // packages/ui/build-module/utils/theme-provider.mjs 8559 var theme = __toESM(require_theme(), 1); 8560 8561 // packages/ui/build-module/lock-unlock.mjs 8562 var import_private_apis = __toESM(require_private_apis(), 1); 8563 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 8564 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 8565 "@wordpress/ui" 8566 ); 8567 8568 // packages/ui/build-module/utils/theme-provider.mjs 8569 function getThemeProvider() { 8570 const themePackage = theme; 8571 if (themePackage.ThemeProvider) { 8572 return themePackage.ThemeProvider; 8573 } 8574 if (!themePackage.privateApis) { 8575 throw new Error( 8576 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." 8577 ); 8578 } 8579 return unlock( 8580 themePackage.privateApis 8581 ).ThemeProvider; 8582 } 8583 var ThemeProvider = getThemeProvider(); 8584 8585 // packages/ui/build-module/stack/stack.mjs 8586 var import_element12 = __toESM(require_element(), 1); 8587 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 8588 function getRuntime2() { 8589 const globalScope = globalThis; 8590 if (globalScope.__wpStyleRuntime) { 8591 return globalScope.__wpStyleRuntime; 8592 } 8593 globalScope.__wpStyleRuntime = { 8594 documents: /* @__PURE__ */ new Map(), 8595 styles: /* @__PURE__ */ new Map(), 8596 injectedStyles: /* @__PURE__ */ new WeakMap() 8597 }; 8598 if (typeof document !== "undefined") { 8599 registerDocument2(document); 8600 } 8601 return globalScope.__wpStyleRuntime; 8602 } 8603 function documentContainsStyleHash2(targetDocument, hash) { 8604 if (!targetDocument.head) { 8605 return false; 8606 } 8607 for (const style of targetDocument.head.querySelectorAll( 8608 `style[$STYLE_HASH_ATTRIBUTE2}]` 8609 )) { 8610 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 8611 return true; 8612 } 8613 } 8614 return false; 8615 } 8616 function injectStyle2(targetDocument, hash, css) { 8617 if (!targetDocument.head) { 8618 return; 8619 } 8620 const runtime = getRuntime2(); 8621 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8622 if (!injectedStyles) { 8623 injectedStyles = /* @__PURE__ */ new Set(); 8624 runtime.injectedStyles.set(targetDocument, injectedStyles); 8625 } 8626 if (injectedStyles.has(hash)) { 8627 return; 8628 } 8629 if (documentContainsStyleHash2(targetDocument, hash)) { 8630 injectedStyles.add(hash); 8631 return; 8632 } 8633 const style = targetDocument.createElement("style"); 8634 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 8635 style.appendChild(targetDocument.createTextNode(css)); 8636 targetDocument.head.appendChild(style); 8637 injectedStyles.add(hash); 8638 } 8639 function registerDocument2(targetDocument) { 8640 const runtime = getRuntime2(); 8641 runtime.documents.set( 8642 targetDocument, 8643 (runtime.documents.get(targetDocument) ?? 0) + 1 8644 ); 8645 for (const [hash, css] of runtime.styles) { 8646 injectStyle2(targetDocument, hash, css); 8647 } 8648 return () => { 8649 const count = runtime.documents.get(targetDocument); 8650 if (count === void 0) { 8651 return; 8652 } 8653 if (count <= 1) { 8654 runtime.documents.delete(targetDocument); 8655 return; 8656 } 8657 runtime.documents.set(targetDocument, count - 1); 8658 }; 8659 } 8660 function registerStyle2(hash, css) { 8661 const runtime = getRuntime2(); 8662 runtime.styles.set(hash, css); 8663 for (const targetDocument of runtime.documents.keys()) { 8664 injectStyle2(targetDocument, hash, css); 8665 } 8666 } 8667 if (typeof process === "undefined" || true) { 8668 registerStyle2("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); 8669 } 8670 var style_default2 = { "stack": "_19ce0419607e1896__stack" }; 8671 var gapTokens = { 8672 xs: "var(--wpds-dimension-gap-xs, 4px)", 8673 sm: "var(--wpds-dimension-gap-sm, 8px)", 8674 md: "var(--wpds-dimension-gap-md, 12px)", 8675 lg: "var(--wpds-dimension-gap-lg, 16px)", 8676 xl: "var(--wpds-dimension-gap-xl, 24px)", 8677 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 8678 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 8679 }; 8680 var Stack = (0, import_element12.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { 8681 const style = { 8682 gap: gap && gapTokens[gap], 8683 alignItems: align, 8684 justifyContent: justify, 8685 flexDirection: direction, 8686 flexWrap: wrap 8687 }; 8688 const element = useRender({ 8689 render, 8690 ref, 8691 props: mergeProps(props, { style, className: style_default2.stack }) 8692 }); 8693 return element; 8694 }); 8695 8696 // packages/ui/build-module/tooltip/index.mjs 8697 var tooltip_exports = {}; 8698 __export(tooltip_exports, { 8699 Popup: () => Popup, 8700 Portal: () => Portal, 8701 Positioner: () => Positioner, 8702 Provider: () => Provider, 8703 Root: () => Root, 8704 Trigger: () => Trigger 8705 }); 8706 8707 // packages/ui/build-module/tooltip/popup.mjs 8708 var import_element15 = __toESM(require_element(), 1); 8709 8710 // packages/ui/build-module/tooltip/portal.mjs 8711 var import_element13 = __toESM(require_element(), 1); 8712 8713 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 8714 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 8715 function getRuntime3() { 8716 const globalScope = globalThis; 8717 if (globalScope.__wpStyleRuntime) { 8718 return globalScope.__wpStyleRuntime; 8719 } 8720 globalScope.__wpStyleRuntime = { 8721 documents: /* @__PURE__ */ new Map(), 8722 styles: /* @__PURE__ */ new Map(), 8723 injectedStyles: /* @__PURE__ */ new WeakMap() 8724 }; 8725 if (typeof document !== "undefined") { 8726 registerDocument3(document); 8727 } 8728 return globalScope.__wpStyleRuntime; 8729 } 8730 function documentContainsStyleHash3(targetDocument, hash) { 8731 if (!targetDocument.head) { 8732 return false; 8733 } 8734 for (const style of targetDocument.head.querySelectorAll( 8735 `style[$STYLE_HASH_ATTRIBUTE3}]` 8736 )) { 8737 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 8738 return true; 8739 } 8740 } 8741 return false; 8742 } 8743 function injectStyle3(targetDocument, hash, css) { 8744 if (!targetDocument.head) { 8745 return; 8746 } 8747 const runtime = getRuntime3(); 8748 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8749 if (!injectedStyles) { 8750 injectedStyles = /* @__PURE__ */ new Set(); 8751 runtime.injectedStyles.set(targetDocument, injectedStyles); 8752 } 8753 if (injectedStyles.has(hash)) { 8754 return; 8755 } 8756 if (documentContainsStyleHash3(targetDocument, hash)) { 8757 injectedStyles.add(hash); 8758 return; 8759 } 8760 const style = targetDocument.createElement("style"); 8761 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 8762 style.appendChild(targetDocument.createTextNode(css)); 8763 targetDocument.head.appendChild(style); 8764 injectedStyles.add(hash); 8765 } 8766 function registerDocument3(targetDocument) { 8767 const runtime = getRuntime3(); 8768 runtime.documents.set( 8769 targetDocument, 8770 (runtime.documents.get(targetDocument) ?? 0) + 1 8771 ); 8772 for (const [hash, css] of runtime.styles) { 8773 injectStyle3(targetDocument, hash, css); 8774 } 8775 return () => { 8776 const count = runtime.documents.get(targetDocument); 8777 if (count === void 0) { 8778 return; 8779 } 8780 if (count <= 1) { 8781 runtime.documents.delete(targetDocument); 8782 return; 8783 } 8784 runtime.documents.set(targetDocument, count - 1); 8785 }; 8786 } 8787 function registerStyle3(hash, css) { 8788 const runtime = getRuntime3(); 8789 runtime.styles.set(hash, css); 8790 for (const targetDocument of runtime.documents.keys()) { 8791 injectStyle3(targetDocument, hash, css); 8792 } 8793 } 8794 if (typeof process === "undefined" || true) { 8795 registerStyle3("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}}}"); 8796 } 8797 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 8798 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 8799 function resolveOwnerDocument() { 8800 return typeof document === "undefined" ? null : document; 8801 } 8802 function isInWordPressEnvironment() { 8803 let topWp; 8804 try { 8805 topWp = window.top?.wp; 8806 } catch { 8807 } 8808 const wp = topWp ?? window.wp; 8809 return typeof wp?.components === "object" && wp.components !== null; 8810 } 8811 var cachedSlot = null; 8812 function ensureSlotIsAccessible(element) { 8813 element.setAttribute("aria-hidden", "false"); 8814 return element; 8815 } 8816 function createSlot(ownerDocument2) { 8817 const element = ownerDocument2.createElement("div"); 8818 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 8819 if (wp_compat_overlay_slot_default.slot) { 8820 element.classList.add(wp_compat_overlay_slot_default.slot); 8821 } 8822 ownerDocument2.body.appendChild(element); 8823 return element; 8824 } 8825 function getWpCompatOverlaySlot() { 8826 if (typeof window === "undefined") { 8827 return void 0; 8828 } 8829 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 8830 return void 0; 8831 } 8832 const ownerDocument2 = resolveOwnerDocument(); 8833 if (!ownerDocument2 || !ownerDocument2.body) { 8834 return void 0; 8835 } 8836 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 8837 return ensureSlotIsAccessible(cachedSlot); 8838 } 8839 const existing = ownerDocument2.querySelector( 8840 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 8841 ); 8842 if (existing instanceof HTMLDivElement) { 8843 cachedSlot = ensureSlotIsAccessible(existing); 8844 return cachedSlot; 8845 } 8846 if (cachedSlot?.isConnected) { 8847 cachedSlot.remove(); 8848 } 8849 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); 8850 return cachedSlot; 8851 } 8852 8853 // packages/ui/build-module/tooltip/portal.mjs 8854 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 8855 var Portal = (0, import_element13.forwardRef)( 8856 function TooltipPortal3({ container, ...restProps }, ref) { 8857 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 8858 index_parts_exports.Portal, 8859 { 8860 container: container ?? getWpCompatOverlaySlot(), 8861 ...restProps, 8862 ref 8863 } 8864 ); 8865 } 8866 ); 8867 8868 // packages/ui/build-module/tooltip/positioner.mjs 8869 var import_element14 = __toESM(require_element(), 1); 8870 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 8871 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 8872 function getRuntime4() { 8873 const globalScope = globalThis; 8874 if (globalScope.__wpStyleRuntime) { 8875 return globalScope.__wpStyleRuntime; 8876 } 8877 globalScope.__wpStyleRuntime = { 8878 documents: /* @__PURE__ */ new Map(), 8879 styles: /* @__PURE__ */ new Map(), 8880 injectedStyles: /* @__PURE__ */ new WeakMap() 8881 }; 8882 if (typeof document !== "undefined") { 8883 registerDocument4(document); 8884 } 8885 return globalScope.__wpStyleRuntime; 8886 } 8887 function documentContainsStyleHash4(targetDocument, hash) { 8888 if (!targetDocument.head) { 8889 return false; 8890 } 8891 for (const style of targetDocument.head.querySelectorAll( 8892 `style[$STYLE_HASH_ATTRIBUTE4}]` 8893 )) { 8894 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 8895 return true; 8896 } 8897 } 8898 return false; 8899 } 8900 function injectStyle4(targetDocument, hash, css) { 8901 if (!targetDocument.head) { 8902 return; 8903 } 8904 const runtime = getRuntime4(); 8905 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8906 if (!injectedStyles) { 8907 injectedStyles = /* @__PURE__ */ new Set(); 8908 runtime.injectedStyles.set(targetDocument, injectedStyles); 8909 } 8910 if (injectedStyles.has(hash)) { 8911 return; 8912 } 8913 if (documentContainsStyleHash4(targetDocument, hash)) { 8914 injectedStyles.add(hash); 8915 return; 8916 } 8917 const style = targetDocument.createElement("style"); 8918 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 8919 style.appendChild(targetDocument.createTextNode(css)); 8920 targetDocument.head.appendChild(style); 8921 injectedStyles.add(hash); 8922 } 8923 function registerDocument4(targetDocument) { 8924 const runtime = getRuntime4(); 8925 runtime.documents.set( 8926 targetDocument, 8927 (runtime.documents.get(targetDocument) ?? 0) + 1 8928 ); 8929 for (const [hash, css] of runtime.styles) { 8930 injectStyle4(targetDocument, hash, css); 8931 } 8932 return () => { 8933 const count = runtime.documents.get(targetDocument); 8934 if (count === void 0) { 8935 return; 8936 } 8937 if (count <= 1) { 8938 runtime.documents.delete(targetDocument); 8939 return; 8940 } 8941 runtime.documents.set(targetDocument, count - 1); 8942 }; 8943 } 8944 function registerStyle4(hash, css) { 8945 const runtime = getRuntime4(); 8946 runtime.styles.set(hash, css); 8947 for (const targetDocument of runtime.documents.keys()) { 8948 injectStyle4(targetDocument, hash, css); 8949 } 8950 } 8951 if (typeof process === "undefined" || true) { 8952 registerStyle4("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 8953 } 8954 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 8955 if (typeof process === "undefined" || true) { 8956 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}}}}'); 8957 } 8958 var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 8959 var Positioner = (0, import_element14.forwardRef)( 8960 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 8961 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 8962 index_parts_exports.Positioner, 8963 { 8964 ref, 8965 align, 8966 side, 8967 sideOffset, 8968 ...props, 8969 className: clsx_default( 8970 resets_default["box-sizing"], 8971 style_default3.positioner, 8972 className 8973 ) 8974 } 8975 ); 8976 } 8977 ); 8978 8979 // packages/ui/build-module/tooltip/popup.mjs 8980 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 8981 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 8982 function getRuntime5() { 8983 const globalScope = globalThis; 8984 if (globalScope.__wpStyleRuntime) { 8985 return globalScope.__wpStyleRuntime; 8986 } 8987 globalScope.__wpStyleRuntime = { 8988 documents: /* @__PURE__ */ new Map(), 8989 styles: /* @__PURE__ */ new Map(), 8990 injectedStyles: /* @__PURE__ */ new WeakMap() 8991 }; 8992 if (typeof document !== "undefined") { 8993 registerDocument5(document); 8994 } 8995 return globalScope.__wpStyleRuntime; 8996 } 8997 function documentContainsStyleHash5(targetDocument, hash) { 8998 if (!targetDocument.head) { 8999 return false; 9000 } 9001 for (const style of targetDocument.head.querySelectorAll( 9002 `style[$STYLE_HASH_ATTRIBUTE5}]` 9003 )) { 9004 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 9005 return true; 9006 } 9007 } 9008 return false; 9009 } 9010 function injectStyle5(targetDocument, hash, css) { 9011 if (!targetDocument.head) { 9012 return; 9013 } 9014 const runtime = getRuntime5(); 9015 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9016 if (!injectedStyles) { 9017 injectedStyles = /* @__PURE__ */ new Set(); 9018 runtime.injectedStyles.set(targetDocument, injectedStyles); 9019 } 9020 if (injectedStyles.has(hash)) { 9021 return; 9022 } 9023 if (documentContainsStyleHash5(targetDocument, hash)) { 9024 injectedStyles.add(hash); 9025 return; 9026 } 9027 const style = targetDocument.createElement("style"); 9028 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 9029 style.appendChild(targetDocument.createTextNode(css)); 9030 targetDocument.head.appendChild(style); 9031 injectedStyles.add(hash); 9032 } 9033 function registerDocument5(targetDocument) { 9034 const runtime = getRuntime5(); 9035 runtime.documents.set( 9036 targetDocument, 9037 (runtime.documents.get(targetDocument) ?? 0) + 1 9038 ); 9039 for (const [hash, css] of runtime.styles) { 9040 injectStyle5(targetDocument, hash, css); 9041 } 9042 return () => { 9043 const count = runtime.documents.get(targetDocument); 9044 if (count === void 0) { 9045 return; 9046 } 9047 if (count <= 1) { 9048 runtime.documents.delete(targetDocument); 9049 return; 9050 } 9051 runtime.documents.set(targetDocument, count - 1); 9052 }; 9053 } 9054 function registerStyle5(hash, css) { 9055 const runtime = getRuntime5(); 9056 runtime.styles.set(hash, css); 9057 for (const targetDocument of runtime.documents.keys()) { 9058 injectStyle5(targetDocument, hash, css); 9059 } 9060 } 9061 if (typeof process === "undefined" || true) { 9062 registerStyle5("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}}}}'); 9063 } 9064 var style_default4 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 9065 var POPUP_COLOR = { background: "#1e1e1e" }; 9066 var Popup = (0, import_element15.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 9067 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( 9068 index_parts_exports.Popup, 9069 { 9070 ref, 9071 className: clsx_default(style_default4.popup, className), 9072 ...props, 9073 children 9074 } 9075 ) }); 9076 const positionedPopup = renderSlotWithChildren( 9077 positioner, 9078 /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Positioner, {}), 9079 popupContent 9080 ); 9081 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Portal, {}), positionedPopup); 9082 }); 9083 9084 // packages/ui/build-module/tooltip/trigger.mjs 9085 var import_element16 = __toESM(require_element(), 1); 9086 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 9087 var Trigger = (0, import_element16.forwardRef)( 9088 function TooltipTrigger3(props, ref) { 9089 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(index_parts_exports.Trigger, { ref, ...props }); 9090 } 9091 ); 9092 9093 // packages/ui/build-module/tooltip/root.mjs 9094 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 9095 function Root(props) { 9096 return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(index_parts_exports.Root, { ...props }); 9097 } 9098 9099 // packages/ui/build-module/tooltip/provider.mjs 9100 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 9101 function Provider({ ...props }) { 9102 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(index_parts_exports.Provider, { ...props }); 9103 } 9104 9105 // packages/admin-ui/build-module/navigable-region/index.mjs 9106 var import_element17 = __toESM(require_element(), 1); 9107 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 9108 var NavigableRegion = (0, import_element17.forwardRef)( 9109 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 9110 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 9111 Tag, 9112 { 9113 ref, 9114 className: clsx_default("admin-ui-navigable-region", className), 9115 "aria-label": ariaLabel, 9116 role: "region", 9117 tabIndex: "-1", 9118 ...props, 9119 children 9120 } 9121 ); 9122 } 9123 ); 9124 NavigableRegion.displayName = "NavigableRegion"; 9125 var navigable_region_default = NavigableRegion; 9126 9127 // packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs 9128 var import_components = __toESM(require_components(), 1); 9129 var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components.createSlotFill)("SidebarToggle"); 9130 9131 // packages/admin-ui/build-module/page/header.mjs 9132 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 9133 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; 9134 function getRuntime6() { 9135 const globalScope = globalThis; 9136 if (globalScope.__wpStyleRuntime) { 9137 return globalScope.__wpStyleRuntime; 9138 } 9139 globalScope.__wpStyleRuntime = { 9140 documents: /* @__PURE__ */ new Map(), 9141 styles: /* @__PURE__ */ new Map(), 9142 injectedStyles: /* @__PURE__ */ new WeakMap() 9143 }; 9144 if (typeof document !== "undefined") { 9145 registerDocument6(document); 9146 } 9147 return globalScope.__wpStyleRuntime; 9148 } 9149 function documentContainsStyleHash6(targetDocument, hash) { 9150 if (!targetDocument.head) { 9151 return false; 9152 } 9153 for (const style of targetDocument.head.querySelectorAll( 9154 `style[$STYLE_HASH_ATTRIBUTE6}]` 9155 )) { 9156 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { 9157 return true; 9158 } 9159 } 9160 return false; 9161 } 9162 function injectStyle6(targetDocument, hash, css) { 9163 if (!targetDocument.head) { 9164 return; 9165 } 9166 const runtime = getRuntime6(); 9167 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9168 if (!injectedStyles) { 9169 injectedStyles = /* @__PURE__ */ new Set(); 9170 runtime.injectedStyles.set(targetDocument, injectedStyles); 9171 } 9172 if (injectedStyles.has(hash)) { 9173 return; 9174 } 9175 if (documentContainsStyleHash6(targetDocument, hash)) { 9176 injectedStyles.add(hash); 9177 return; 9178 } 9179 const style = targetDocument.createElement("style"); 9180 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); 9181 style.appendChild(targetDocument.createTextNode(css)); 9182 targetDocument.head.appendChild(style); 9183 injectedStyles.add(hash); 9184 } 9185 function registerDocument6(targetDocument) { 9186 const runtime = getRuntime6(); 9187 runtime.documents.set( 9188 targetDocument, 9189 (runtime.documents.get(targetDocument) ?? 0) + 1 9190 ); 9191 for (const [hash, css] of runtime.styles) { 9192 injectStyle6(targetDocument, hash, css); 9193 } 9194 return () => { 9195 const count = runtime.documents.get(targetDocument); 9196 if (count === void 0) { 9197 return; 9198 } 9199 if (count <= 1) { 9200 runtime.documents.delete(targetDocument); 9201 return; 9202 } 9203 runtime.documents.set(targetDocument, count - 1); 9204 }; 9205 } 9206 function registerStyle6(hash, css) { 9207 const runtime = getRuntime6(); 9208 runtime.styles.set(hash, css); 9209 for (const targetDocument of runtime.documents.keys()) { 9210 injectStyle6(targetDocument, hash, css); 9211 } 9212 } 9213 if (typeof process === "undefined" || true) { 9214 registerStyle6("ddd9aab364", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-background-surface-neutral,#fcfcfc);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-background-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:var(--wpds-dimension-size-md,32px)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-foreground-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}"); 9215 } 9216 var style_default5 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" }; 9217 function Header({ 9218 headingLevel = 1, 9219 breadcrumbs, 9220 badges, 9221 visual, 9222 title, 9223 subTitle, 9224 actions, 9225 showSidebarToggle = true 9226 }) { 9227 const HeadingTag = `h$headingLevel}`; 9228 return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Stack, { direction: "column", className: style_default5.header, children: [ 9229 /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)( 9230 Stack, 9231 { 9232 className: style_default5["header-content"], 9233 direction: "row", 9234 gap: "sm", 9235 justify: "space-between", 9236 children: [ 9237 /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", justify: "start", children: [ 9238 showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 9239 SidebarToggleSlot, 9240 { 9241 bubblesVirtually: true, 9242 className: style_default5["sidebar-toggle-slot"] 9243 } 9244 ), 9245 visual && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 9246 "div", 9247 { 9248 className: style_default5["header-visual"], 9249 "aria-hidden": "true", 9250 children: visual 9251 } 9252 ), 9253 title && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 9254 Text, 9255 { 9256 className: style_default5["header-title"], 9257 render: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(HeadingTag, {}), 9258 variant: "heading-lg", 9259 children: title 9260 } 9261 ), 9262 breadcrumbs, 9263 badges 9264 ] }), 9265 actions && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 9266 Stack, 9267 { 9268 align: "center", 9269 className: style_default5["header-actions"], 9270 direction: "row", 9271 gap: "sm", 9272 children: actions 9273 } 9274 ) 9275 ] 9276 } 9277 ), 9278 subTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 9279 Text, 9280 { 9281 render: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", {}), 9282 variant: "body-md", 9283 className: style_default5["header-subtitle"], 9284 children: subTitle 9285 } 9286 ) 9287 ] }); 9288 } 9289 9290 // packages/admin-ui/build-module/page/index.mjs 9291 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 9292 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; 9293 function getRuntime7() { 9294 const globalScope = globalThis; 9295 if (globalScope.__wpStyleRuntime) { 9296 return globalScope.__wpStyleRuntime; 9297 } 9298 globalScope.__wpStyleRuntime = { 9299 documents: /* @__PURE__ */ new Map(), 9300 styles: /* @__PURE__ */ new Map(), 9301 injectedStyles: /* @__PURE__ */ new WeakMap() 9302 }; 9303 if (typeof document !== "undefined") { 9304 registerDocument7(document); 9305 } 9306 return globalScope.__wpStyleRuntime; 9307 } 9308 function documentContainsStyleHash7(targetDocument, hash) { 9309 if (!targetDocument.head) { 9310 return false; 9311 } 9312 for (const style of targetDocument.head.querySelectorAll( 9313 `style[$STYLE_HASH_ATTRIBUTE7}]` 9314 )) { 9315 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { 9316 return true; 9317 } 9318 } 9319 return false; 9320 } 9321 function injectStyle7(targetDocument, hash, css) { 9322 if (!targetDocument.head) { 9323 return; 9324 } 9325 const runtime = getRuntime7(); 9326 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9327 if (!injectedStyles) { 9328 injectedStyles = /* @__PURE__ */ new Set(); 9329 runtime.injectedStyles.set(targetDocument, injectedStyles); 9330 } 9331 if (injectedStyles.has(hash)) { 9332 return; 9333 } 9334 if (documentContainsStyleHash7(targetDocument, hash)) { 9335 injectedStyles.add(hash); 9336 return; 9337 } 9338 const style = targetDocument.createElement("style"); 9339 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); 9340 style.appendChild(targetDocument.createTextNode(css)); 9341 targetDocument.head.appendChild(style); 9342 injectedStyles.add(hash); 9343 } 9344 function registerDocument7(targetDocument) { 9345 const runtime = getRuntime7(); 9346 runtime.documents.set( 9347 targetDocument, 9348 (runtime.documents.get(targetDocument) ?? 0) + 1 9349 ); 9350 for (const [hash, css] of runtime.styles) { 9351 injectStyle7(targetDocument, hash, css); 9352 } 9353 return () => { 9354 const count = runtime.documents.get(targetDocument); 9355 if (count === void 0) { 9356 return; 9357 } 9358 if (count <= 1) { 9359 runtime.documents.delete(targetDocument); 9360 return; 9361 } 9362 runtime.documents.set(targetDocument, count - 1); 9363 }; 9364 } 9365 function registerStyle7(hash, css) { 9366 const runtime = getRuntime7(); 9367 runtime.styles.set(hash, css); 9368 for (const targetDocument of runtime.documents.keys()) { 9369 injectStyle7(targetDocument, hash, css); 9370 } 9371 } 9372 if (typeof process === "undefined" || true) { 9373 registerStyle7("ddd9aab364", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-background-surface-neutral,#fcfcfc);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-background-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:var(--wpds-dimension-size-md,32px)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-foreground-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}"); 9374 } 9375 var style_default6 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" }; 9376 function Page({ 9377 headingLevel, 9378 breadcrumbs, 9379 badges, 9380 visual, 9381 title, 9382 subTitle, 9383 children, 9384 className, 9385 actions, 9386 ariaLabel, 9387 hasPadding = false, 9388 showSidebarToggle = true 9389 }) { 9390 const classes = clsx_default(style_default6.page, className); 9391 const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : ""); 9392 return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(navigable_region_default, { className: classes, ariaLabel: effectiveAriaLabel, children: [ 9393 (title || breadcrumbs || badges || actions || visual) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( 9394 Header, 9395 { 9396 headingLevel, 9397 breadcrumbs, 9398 badges, 9399 visual, 9400 title, 9401 subTitle, 9402 actions, 9403 showSidebarToggle 9404 } 9405 ), 9406 hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( 9407 "div", 9408 { 9409 className: clsx_default( 9410 style_default6.content, 9411 style_default6["has-padding"] 9412 ), 9413 children 9414 } 9415 ) : children 9416 ] }); 9417 } 9418 Page.SidebarToggleFill = SidebarToggleFill; 9419 var page_default = Page; 9420 9421 // packages/admin-ui/build-module/admin-theme-colors/index.mjs 9422 var DEFAULT_THEME_COLORS = { 9423 primary: "#3858e9", 9424 background: "#222524" 9425 }; 9426 var ADMIN_THEME_COLORS = /* @__PURE__ */ new Map([ 9427 ["modern", DEFAULT_THEME_COLORS], 9428 ["fresh", { primary: "#3858e9", background: "#25292b" }], 9429 ["midnight", { primary: "#cf4339", background: "#3d4042" }], 9430 ["coffee", { primary: "#916745", background: "#5b534d" }], 9431 ["ocean", { primary: "#567958", background: "#5f787f" }], 9432 ["blue", { primary: "#437aa8", background: "#3876a8" }], 9433 ["ectoplasm", { primary: "#646c3e", background: "#4f386e" }], 9434 ["sunrise", { primary: "#ad631e", background: "#cc4541" }], 9435 ["light", { primary: "#007cba", background: "#eaeeed" }] 9436 ]); 9437 function getAdminThemeColors() { 9438 const scheme = document.body.className.match(/admin-color-([\w-]+)/)?.[1] ?? "modern"; 9439 return ADMIN_THEME_COLORS.get(scheme) ?? DEFAULT_THEME_COLORS; 9440 } 9441 9442 // packages/boot/build-module/components/app/router.mjs 9443 var import_data9 = __toESM(require_data(), 1); 9444 var import_core_data4 = __toESM(require_core_data(), 1); 9445 import { 9446 privateApis as routePrivateApis5 9447 } from "@wordpress/route"; 9448 9449 // packages/boot/build-module/components/root/index.mjs 9450 var import_notices = __toESM(require_notices(), 1); 9451 var import_compose4 = __toESM(require_compose(), 1); 9452 var import_components13 = __toESM(require_components(), 1); 9453 import { privateApis as routePrivateApis4 } from "@wordpress/route"; 9454 var import_element29 = __toESM(require_element(), 1); 9455 var import_i18n9 = __toESM(require_i18n(), 1); 9456 var import_theme = __toESM(require_theme(), 1); 9457 9458 // packages/boot/build-module/components/sidebar/index.mjs 9459 var import_components9 = __toESM(require_components(), 1); 9460 var import_data7 = __toESM(require_data(), 1); 9461 var import_i18n5 = __toESM(require_i18n(), 1); 9462 9463 // packages/boot/build-module/components/navigation/index.mjs 9464 var import_element21 = __toESM(require_element(), 1); 9465 var import_data4 = __toESM(require_data(), 1); 9466 9467 // packages/boot/build-module/store/index.mjs 9468 var import_data = __toESM(require_data(), 1); 9469 9470 // packages/boot/build-module/store/reducer.mjs 9471 var initialState = { 9472 menuItems: {}, 9473 routes: [], 9474 dashboardLink: void 0 9475 }; 9476 function reducer(state = initialState, action) { 9477 switch (action.type) { 9478 case "REGISTER_MENU_ITEM": 9479 return { 9480 ...state, 9481 menuItems: { 9482 ...state.menuItems, 9483 [action.id]: action.menuItem 9484 } 9485 }; 9486 case "UPDATE_MENU_ITEM": 9487 return { 9488 ...state, 9489 menuItems: { 9490 ...state.menuItems, 9491 [action.id]: { 9492 ...state.menuItems[action.id], 9493 ...action.updates 9494 } 9495 } 9496 }; 9497 case "REGISTER_ROUTE": 9498 return { 9499 ...state, 9500 routes: [...state.routes, action.route] 9501 }; 9502 case "SET_DASHBOARD_LINK": 9503 return { 9504 ...state, 9505 dashboardLink: action.dashboardLink 9506 }; 9507 } 9508 return state; 9509 } 9510 9511 // packages/boot/build-module/store/actions.mjs 9512 var actions_exports = {}; 9513 __export(actions_exports, { 9514 registerMenuItem: () => registerMenuItem, 9515 registerRoute: () => registerRoute, 9516 setDashboardLink: () => setDashboardLink, 9517 updateMenuItem: () => updateMenuItem 9518 }); 9519 function registerMenuItem(id, menuItem) { 9520 return { 9521 type: "REGISTER_MENU_ITEM", 9522 id, 9523 menuItem 9524 }; 9525 } 9526 function updateMenuItem(id, updates) { 9527 return { 9528 type: "UPDATE_MENU_ITEM", 9529 id, 9530 updates 9531 }; 9532 } 9533 function registerRoute(route) { 9534 return { 9535 type: "REGISTER_ROUTE", 9536 route 9537 }; 9538 } 9539 function setDashboardLink(dashboardLink) { 9540 return { 9541 type: "SET_DASHBOARD_LINK", 9542 dashboardLink 9543 }; 9544 } 9545 9546 // packages/boot/build-module/store/selectors.mjs 9547 var selectors_exports = {}; 9548 __export(selectors_exports, { 9549 getDashboardLink: () => getDashboardLink, 9550 getMenuItems: () => getMenuItems, 9551 getRoutes: () => getRoutes 9552 }); 9553 function getMenuItems(state) { 9554 return Object.values(state.menuItems); 9555 } 9556 function getRoutes(state) { 9557 return state.routes; 9558 } 9559 function getDashboardLink(state) { 9560 return state.dashboardLink; 9561 } 9562 9563 // packages/boot/build-module/store/index.mjs 9564 var STORE_NAME = "wordpress/boot"; 9565 var store = (0, import_data.createReduxStore)(STORE_NAME, { 9566 reducer, 9567 actions: actions_exports, 9568 selectors: selectors_exports 9569 }); 9570 (0, import_data.register)(store); 9571 9572 // packages/boot/build-module/components/navigation/navigation-item/index.mjs 9573 var import_components4 = __toESM(require_components(), 1); 9574 9575 // packages/boot/build-module/components/navigation/router-link-item.mjs 9576 var import_element18 = __toESM(require_element(), 1); 9577 var import_components2 = __toESM(require_components(), 1); 9578 import { privateApis as routePrivateApis } from "@wordpress/route"; 9579 9580 // packages/boot/build-module/lock-unlock.mjs 9581 var import_private_apis2 = __toESM(require_private_apis(), 1); 9582 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 9583 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 9584 "@wordpress/boot" 9585 ); 9586 9587 // packages/boot/build-module/components/navigation/router-link-item.mjs 9588 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 9589 var { createLink } = unlock2(routePrivateApis); 9590 function AnchorOnlyItem(props, forwardedRef) { 9591 return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components2.__experimentalItem, { as: "a", ref: forwardedRef, ...props }); 9592 } 9593 var RouterLinkItem = createLink((0, import_element18.forwardRef)(AnchorOnlyItem)); 9594 var router_link_item_default = RouterLinkItem; 9595 9596 // packages/boot/build-module/components/navigation/items.mjs 9597 var import_element19 = __toESM(require_element(), 1); 9598 var import_components3 = __toESM(require_components(), 1); 9599 var import_primitives8 = __toESM(require_primitives(), 1); 9600 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 9601 function isSvg(element) { 9602 return (0, import_element19.isValidElement)(element) && (element.type === import_primitives8.SVG || element.type === "svg"); 9603 } 9604 function wrapIcon(icon, shouldShowPlaceholder = true) { 9605 if (isSvg(icon)) { 9606 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components3.Icon, { icon }); 9607 } 9608 if (typeof icon === "string" && icon.startsWith("dashicons-")) { 9609 const iconKey = icon.replace( 9610 /^dashicons-/, 9611 "" 9612 ); 9613 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 9614 import_components3.Dashicon, 9615 { 9616 style: { padding: "2px" }, 9617 icon: iconKey, 9618 "aria-hidden": "true" 9619 } 9620 ); 9621 } 9622 if (typeof icon === "string" && icon.startsWith("data:")) { 9623 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 9624 "img", 9625 { 9626 src: icon, 9627 alt: "", 9628 "aria-hidden": "true", 9629 style: { 9630 width: "20px", 9631 height: "20px", 9632 display: "block", 9633 padding: "2px" 9634 } 9635 } 9636 ); 9637 } 9638 if (icon) { 9639 return icon; 9640 } 9641 if (shouldShowPlaceholder) { 9642 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 9643 "div", 9644 { 9645 style: { width: "24px", height: "24px" }, 9646 "aria-hidden": "true" 9647 } 9648 ); 9649 } 9650 return null; 9651 } 9652 9653 // packages/boot/build-module/components/navigation/navigation-item/index.mjs 9654 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 9655 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='4e60007e70']")) { 9656 const style = document.createElement("style"); 9657 style.setAttribute("data-wp-hash", "4e60007e70"); 9658 style.appendChild(document.createTextNode(".boot-navigation-item.components-item{align-items:center;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:-apple-system,system-ui,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:var(--wpds-typography-font-weight-default,400);line-height:20px;margin-block-end:4px;margin-inline:12px;min-height:32px;padding-block:0;padding-inline:4px;width:calc(100% - 24px)}.boot-dropdown-item__children .boot-navigation-item.components-item{min-height:24px}.boot-navigation-item.components-item{border-radius:var(--wpds-border-radius-sm,2px)}.boot-navigation-item.components-item.active,.boot-navigation-item.components-item:focus,.boot-navigation-item.components-item:hover,.boot-navigation-item.components-item[aria-current=true]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}.boot-navigation-item.components-item.active{font-weight:var(--wpds-typography-font-weight-emphasis,600)}.boot-navigation-item.components-item svg:last-child{padding:4px}.boot-navigation-item.components-item[aria-current=true]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));font-weight:var(--wpds-typography-font-weight-emphasis,600)}.boot-navigation-item.components-item:focus-visible{transform:translateZ(0)}.boot-navigation-item.components-item.with-suffix{padding-right:16px}")); 9659 document.head.appendChild(style); 9660 } 9661 function NavigationItem({ 9662 className, 9663 icon, 9664 shouldShowPlaceholder = true, 9665 children, 9666 to 9667 }) { 9668 const isExternal = !String( 9669 new URL(to, window.location.origin) 9670 ).startsWith(window.location.origin); 9671 const content = /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_components4.__experimentalHStack, { justify: "flex-start", spacing: 2, style: { flexGrow: "1" }, children: [ 9672 wrapIcon(icon, shouldShowPlaceholder), 9673 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components4.FlexBlock, { children }) 9674 ] }); 9675 if (isExternal) { 9676 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( 9677 import_components4.__experimentalItem, 9678 { 9679 as: "a", 9680 href: to, 9681 className: clsx_default("boot-navigation-item", className), 9682 children: content 9683 } 9684 ); 9685 } 9686 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( 9687 router_link_item_default, 9688 { 9689 to, 9690 className: clsx_default("boot-navigation-item", className), 9691 children: content 9692 } 9693 ); 9694 } 9695 9696 // packages/boot/build-module/components/navigation/drilldown-item/index.mjs 9697 var import_components5 = __toESM(require_components(), 1); 9698 var import_i18n = __toESM(require_i18n(), 1); 9699 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 9700 function DrilldownItem({ 9701 className, 9702 id, 9703 icon, 9704 shouldShowPlaceholder = true, 9705 children, 9706 onNavigate 9707 }) { 9708 const handleClick = (e) => { 9709 e.preventDefault(); 9710 onNavigate({ id, direction: "forward" }); 9711 }; 9712 return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( 9713 import_components5.__experimentalItem, 9714 { 9715 className: clsx_default("boot-navigation-item", className), 9716 onClick: handleClick, 9717 children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)( 9718 import_components5.__experimentalHStack, 9719 { 9720 justify: "flex-start", 9721 spacing: 2, 9722 style: { flexGrow: "1" }, 9723 children: [ 9724 wrapIcon(icon, shouldShowPlaceholder), 9725 /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components5.FlexBlock, { children }), 9726 /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( 9727 import_components5.Icon, 9728 { 9729 icon: (0, import_i18n.isRTL)() ? chevron_left_small_default : chevron_right_small_default 9730 } 9731 ) 9732 ] 9733 } 9734 ) 9735 } 9736 ); 9737 } 9738 9739 // packages/boot/build-module/components/navigation/dropdown-item/index.mjs 9740 var import_components6 = __toESM(require_components(), 1); 9741 var import_compose = __toESM(require_compose(), 1); 9742 var import_data2 = __toESM(require_data(), 1); 9743 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 9744 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='608eff82f3']")) { 9745 const style = document.createElement("style"); 9746 style.setAttribute("data-wp-hash", "608eff82f3"); 9747 style.appendChild(document.createTextNode(".boot-dropdown-item__children{display:flex;flex-direction:column;margin-block-end:2px;margin-block-start:-2px;margin-inline-start:30px;overflow:hidden;padding:2px}.boot-dropdown-item__chevron.is-up{transform:rotate(180deg)}")); 9748 document.head.appendChild(style); 9749 } 9750 var ANIMATION_DURATION = 0.2; 9751 function DropdownItem({ 9752 className, 9753 id, 9754 icon, 9755 children, 9756 isExpanded, 9757 onToggle 9758 }) { 9759 const menuItems = (0, import_data2.useSelect)( 9760 (select) => ( 9761 // @ts-ignore 9762 select(STORE_NAME).getMenuItems() 9763 ), 9764 [] 9765 ); 9766 const items = menuItems.filter((item) => item.parent === id); 9767 const disableMotion = (0, import_compose.useReducedMotion)(); 9768 return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "boot-dropdown-item", children: [ 9769 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 9770 import_components6.__experimentalItem, 9771 { 9772 className: clsx_default("boot-navigation-item", className), 9773 onClick: (e) => { 9774 e.preventDefault(); 9775 e.stopPropagation(); 9776 onToggle(); 9777 }, 9778 onMouseDown: (e) => e.preventDefault(), 9779 children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)( 9780 import_components6.__experimentalHStack, 9781 { 9782 justify: "flex-start", 9783 spacing: 2, 9784 style: { flexGrow: "1" }, 9785 children: [ 9786 wrapIcon(icon, false), 9787 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components6.FlexBlock, { children }), 9788 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 9789 import_components6.Icon, 9790 { 9791 icon: chevron_down_small_default, 9792 className: clsx_default("boot-dropdown-item__chevron", { 9793 "is-up": isExpanded 9794 }) 9795 } 9796 ) 9797 ] 9798 } 9799 ) 9800 } 9801 ), 9802 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components6.__unstableAnimatePresence, { initial: false, children: isExpanded && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 9803 import_components6.__unstableMotion.div, 9804 { 9805 initial: { height: 0 }, 9806 animate: { height: "auto" }, 9807 exit: { height: 0 }, 9808 transition: { 9809 type: "tween", 9810 duration: disableMotion ? 0 : ANIMATION_DURATION, 9811 ease: "easeOut" 9812 }, 9813 className: "boot-dropdown-item__children", 9814 children: items.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 9815 NavigationItem, 9816 { 9817 to: item.to, 9818 shouldShowPlaceholder: false, 9819 children: item.label 9820 }, 9821 index2 9822 )) 9823 } 9824 ) }) 9825 ] }); 9826 } 9827 9828 // packages/boot/build-module/components/navigation/navigation-screen/index.mjs 9829 var import_components7 = __toESM(require_components(), 1); 9830 var import_i18n2 = __toESM(require_i18n(), 1); 9831 var import_compose2 = __toESM(require_compose(), 1); 9832 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 9833 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='db54ac7e93']")) { 9834 const style = document.createElement("style"); 9835 style.setAttribute("data-wp-hash", "db54ac7e93"); 9836 style.appendChild(document.createTextNode(".boot-navigation-screen{padding-block-end:4px}.boot-navigation-screen .components-text{color:var(--wpds-color-foreground-content-neutral,#1e1e1e)}.boot-navigation-screen__title-icon{padding:12px 16px 8px;position:sticky;top:0}.boot-navigation-screen__title{flex-grow:1;overflow-wrap:break-word}.boot-navigation-screen__title.boot-navigation-screen__title,.boot-navigation-screen__title.boot-navigation-screen__title .boot-navigation-screen__title{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);line-height:32px}.boot-navigation-screen__actions{display:flex;flex-shrink:0}")); 9837 document.head.appendChild(style); 9838 } 9839 var ANIMATION_DURATION2 = 0.3; 9840 var slideVariants = { 9841 initial: (direction) => ({ 9842 x: direction === "forward" ? 100 : -100, 9843 opacity: 0 9844 }), 9845 animate: { 9846 x: 0, 9847 opacity: 1 9848 }, 9849 exit: (direction) => ({ 9850 x: direction === "forward" ? 100 : -100, 9851 opacity: 0 9852 }) 9853 }; 9854 function NavigationScreen({ 9855 isRoot, 9856 title, 9857 actions, 9858 content, 9859 description, 9860 animationDirection, 9861 backMenuItem, 9862 backButtonRef, 9863 navigationKey, 9864 onNavigate 9865 }) { 9866 const icon = (0, import_i18n2.isRTL)() ? chevron_right_default : chevron_left_default; 9867 const disableMotion = (0, import_compose2.useReducedMotion)(); 9868 const handleBackClick = (e) => { 9869 e.preventDefault(); 9870 onNavigate({ id: backMenuItem, direction: "backward" }); 9871 }; 9872 return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 9873 "div", 9874 { 9875 className: "boot-navigation-screen", 9876 style: { 9877 overflow: "hidden", 9878 position: "relative", 9879 display: "grid", 9880 gridTemplateColumns: "1fr", 9881 gridTemplateRows: "1fr" 9882 }, 9883 children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_components7.__unstableAnimatePresence, { initial: false, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)( 9884 import_components7.__unstableMotion.div, 9885 { 9886 custom: animationDirection, 9887 variants: slideVariants, 9888 initial: "initial", 9889 animate: "animate", 9890 exit: "exit", 9891 transition: { 9892 type: "tween", 9893 duration: disableMotion ? 0 : ANIMATION_DURATION2, 9894 ease: [0.33, 0, 0, 1] 9895 }, 9896 style: { 9897 width: "100%", 9898 gridColumn: "1", 9899 gridRow: "1" 9900 }, 9901 children: [ 9902 /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)( 9903 import_components7.__experimentalHStack, 9904 { 9905 spacing: 2, 9906 className: "boot-navigation-screen__title-icon", 9907 children: [ 9908 !isRoot && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 9909 import_components7.Button, 9910 { 9911 ref: backButtonRef, 9912 icon, 9913 onClick: handleBackClick, 9914 label: (0, import_i18n2.__)("Back"), 9915 size: "small", 9916 variant: "tertiary" 9917 } 9918 ), 9919 /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 9920 import_components7.__experimentalHeading, 9921 { 9922 className: "boot-navigation-screen__title", 9923 level: 1, 9924 size: "15px", 9925 children: title 9926 } 9927 ), 9928 actions && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "boot-navigation-screen__actions", children: actions }) 9929 ] 9930 } 9931 ), 9932 description && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "boot-navigation-screen__description", children: description }), 9933 content 9934 ] 9935 }, 9936 navigationKey 9937 ) }) 9938 } 9939 ); 9940 } 9941 9942 // packages/boot/build-module/components/navigation/use-sidebar-parent.mjs 9943 var import_element20 = __toESM(require_element(), 1); 9944 var import_data3 = __toESM(require_data(), 1); 9945 import { privateApis as routePrivateApis2 } from "@wordpress/route"; 9946 9947 // packages/boot/build-module/components/navigation/path-matching.mjs 9948 var isValidParentPath = (currentPath, menuPath) => { 9949 if (!menuPath || menuPath === currentPath) { 9950 return false; 9951 } 9952 const normalizePath = (path) => { 9953 const normalized = path.startsWith("/") ? path : "/" + path; 9954 return normalized.endsWith("/") && normalized.length > 1 ? normalized.slice(0, -1) : normalized; 9955 }; 9956 const normalizedCurrent = normalizePath(currentPath); 9957 const normalizedMenu = normalizePath(menuPath); 9958 return normalizedCurrent.startsWith(normalizedMenu) && (normalizedCurrent[normalizedMenu.length] === "/" || normalizedMenu === "/"); 9959 }; 9960 var findClosestMenuItem = (currentPath, menuItems) => { 9961 const exactMatch = menuItems.find((item) => item.to === currentPath); 9962 if (exactMatch) { 9963 return exactMatch; 9964 } 9965 let bestMatch = null; 9966 let bestPathLength = 0; 9967 for (const item of menuItems) { 9968 if (!item.to) { 9969 continue; 9970 } 9971 if (isValidParentPath(currentPath, item.to)) { 9972 if (item.to.length > bestPathLength) { 9973 bestMatch = item; 9974 bestPathLength = item.to.length; 9975 } 9976 } 9977 } 9978 return bestMatch; 9979 }; 9980 var findDrilldownParent = (id, menuItems) => { 9981 if (!id) { 9982 return void 0; 9983 } 9984 const currentItem = menuItems.find((item) => item.id === id); 9985 if (!currentItem) { 9986 return void 0; 9987 } 9988 if (currentItem.parent) { 9989 const parentItem = menuItems.find( 9990 (item) => item.id === currentItem.parent 9991 ); 9992 if (parentItem?.parent_type === "drilldown") { 9993 return parentItem.id; 9994 } 9995 if (parentItem) { 9996 return findDrilldownParent(parentItem.id, menuItems); 9997 } 9998 } 9999 return void 0; 10000 }; 10001 var findDropdownParent = (id, menuItems) => { 10002 if (!id) { 10003 return void 0; 10004 } 10005 const currentItem = menuItems.find((item) => item.id === id); 10006 if (!currentItem) { 10007 return void 0; 10008 } 10009 if (currentItem.parent) { 10010 const parentItem = menuItems.find( 10011 (item) => item.id === currentItem.parent 10012 ); 10013 if (parentItem?.parent_type === "dropdown") { 10014 return parentItem.id; 10015 } 10016 } 10017 return void 0; 10018 }; 10019 10020 // packages/boot/build-module/components/navigation/use-sidebar-parent.mjs 10021 var { useRouter, useMatches } = unlock2(routePrivateApis2); 10022 function useSidebarParent() { 10023 const matches = useMatches(); 10024 const router = useRouter(); 10025 const menuItems = (0, import_data3.useSelect)( 10026 (select) => ( 10027 // @ts-ignore 10028 select(STORE_NAME).getMenuItems() 10029 ), 10030 [] 10031 ); 10032 const currentPath = matches[matches.length - 1].pathname.slice( 10033 router.options.basepath?.length ?? 0 10034 ); 10035 const currentMenuItem = findClosestMenuItem(currentPath, menuItems); 10036 const [parentId, setParentId] = (0, import_element20.useState)( 10037 findDrilldownParent(currentMenuItem?.id, menuItems) 10038 ); 10039 const [parentDropdownId, setParentDropdownId] = (0, import_element20.useState)(findDropdownParent(currentMenuItem?.id, menuItems)); 10040 (0, import_element20.useEffect)(() => { 10041 const matchedMenuItem = findClosestMenuItem(currentPath, menuItems); 10042 const updatedParentId = findDrilldownParent( 10043 matchedMenuItem?.id, 10044 menuItems 10045 ); 10046 const updatedDropdownParent = findDropdownParent( 10047 matchedMenuItem?.id, 10048 menuItems 10049 ); 10050 setParentId(updatedParentId); 10051 setParentDropdownId(updatedDropdownParent); 10052 }, [currentPath, menuItems]); 10053 return [ 10054 parentId, 10055 setParentId, 10056 parentDropdownId, 10057 setParentDropdownId 10058 ]; 10059 } 10060 10061 // packages/boot/build-module/components/navigation/index.mjs 10062 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 10063 function Navigation() { 10064 const backButtonRef = (0, import_element21.useRef)(null); 10065 const [animationDirection, setAnimationDirection] = (0, import_element21.useState)(null); 10066 const [parentId, setParentId, parentDropdownId, setParentDropdownId] = useSidebarParent(); 10067 const menuItems = (0, import_data4.useSelect)( 10068 (select) => ( 10069 // @ts-ignore 10070 select(STORE_NAME).getMenuItems() 10071 ), 10072 [] 10073 ); 10074 const parent = (0, import_element21.useMemo)( 10075 () => menuItems.find((item) => item.id === parentId), 10076 [menuItems, parentId] 10077 ); 10078 const navigationKey = parent ? `drilldown-$parent.id}` : "root"; 10079 const handleNavigate = ({ 10080 id, 10081 direction 10082 }) => { 10083 setAnimationDirection(direction); 10084 setParentId(id); 10085 }; 10086 const handleDropdownToggle = (dropdownId) => { 10087 setParentDropdownId( 10088 parentDropdownId === dropdownId ? void 0 : dropdownId 10089 ); 10090 }; 10091 const items = (0, import_element21.useMemo)( 10092 () => menuItems.filter((item) => item.parent === parentId), 10093 [menuItems, parentId] 10094 ); 10095 const hasRealIcons = items.some((item) => !!item.icon); 10096 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 10097 NavigationScreen, 10098 { 10099 isRoot: !parent, 10100 title: parent ? parent.label : "", 10101 backMenuItem: parent?.parent, 10102 backButtonRef, 10103 animationDirection: animationDirection || void 0, 10104 navigationKey, 10105 onNavigate: handleNavigate, 10106 content: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { role: "list", children: items.map((item) => { 10107 if (item.parent_type === "dropdown") { 10108 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 10109 DropdownItem, 10110 { 10111 id: item.id, 10112 className: "boot-navigation-item", 10113 icon: item.icon, 10114 shouldShowPlaceholder: hasRealIcons, 10115 isExpanded: parentDropdownId === item.id, 10116 onToggle: () => handleDropdownToggle(item.id), 10117 children: item.label 10118 }, 10119 item.id 10120 ); 10121 } 10122 if (item.parent_type === "drilldown") { 10123 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 10124 DrilldownItem, 10125 { 10126 id: item.id, 10127 icon: item.icon, 10128 shouldShowPlaceholder: hasRealIcons, 10129 onNavigate: handleNavigate, 10130 children: item.label 10131 }, 10132 item.id 10133 ); 10134 } 10135 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 10136 NavigationItem, 10137 { 10138 to: item.to, 10139 icon: item.icon, 10140 shouldShowPlaceholder: hasRealIcons, 10141 children: item.label 10142 }, 10143 item.id 10144 ); 10145 }) }) 10146 } 10147 ); 10148 } 10149 var navigation_default = Navigation; 10150 10151 // packages/boot/build-module/components/save-button/index.mjs 10152 var import_element23 = __toESM(require_element(), 1); 10153 var import_data6 = __toESM(require_data(), 1); 10154 var import_i18n4 = __toESM(require_i18n(), 1); 10155 var import_core_data2 = __toESM(require_core_data(), 1); 10156 var import_keycodes = __toESM(require_keycodes(), 1); 10157 var import_editor2 = __toESM(require_editor(), 1); 10158 var import_components8 = __toESM(require_components(), 1); 10159 10160 // packages/boot/build-module/components/save-panel/use-save-shortcut.mjs 10161 var import_element22 = __toESM(require_element(), 1); 10162 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); 10163 var import_i18n3 = __toESM(require_i18n(), 1); 10164 var import_data5 = __toESM(require_data(), 1); 10165 var import_core_data = __toESM(require_core_data(), 1); 10166 var import_editor = __toESM(require_editor(), 1); 10167 var shortcutName = "core/boot/save"; 10168 function useSaveShortcut({ 10169 openSavePanel 10170 }) { 10171 const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = (0, import_data5.useSelect)(import_core_data.store); 10172 const { hasNonPostEntityChanges, isPostSavingLocked } = (0, import_data5.useSelect)(import_editor.store); 10173 const { savePost } = (0, import_data5.useDispatch)(import_editor.store); 10174 const { registerShortcut, unregisterShortcut } = (0, import_data5.useDispatch)( 10175 import_keyboard_shortcuts.store 10176 ); 10177 (0, import_element22.useEffect)(() => { 10178 registerShortcut({ 10179 name: shortcutName, 10180 category: "global", 10181 description: (0, import_i18n3.__)("Save your changes."), 10182 keyCombination: { 10183 modifier: "primary", 10184 character: "s" 10185 } 10186 }); 10187 return () => { 10188 unregisterShortcut(shortcutName); 10189 }; 10190 }, [registerShortcut, unregisterShortcut]); 10191 (0, import_keyboard_shortcuts.useShortcut)(shortcutName, (event) => { 10192 event.preventDefault(); 10193 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 10194 const hasDirtyEntities = !!dirtyEntityRecords.length; 10195 const isSaving = dirtyEntityRecords.some( 10196 (record) => isSavingEntityRecord(record.kind, record.name, record.key) 10197 ); 10198 if (!hasDirtyEntities || isSaving) { 10199 return; 10200 } 10201 if (hasNonPostEntityChanges()) { 10202 openSavePanel(); 10203 } else if (!isPostSavingLocked()) { 10204 savePost(); 10205 } 10206 }); 10207 } 10208 10209 // packages/boot/build-module/components/save-button/index.mjs 10210 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 10211 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='020f606c18']")) { 10212 const style = document.createElement("style"); 10213 style.setAttribute("data-wp-hash", "020f606c18"); 10214 style.appendChild(document.createTextNode(".boot-save-button{width:100%}.boot-save-button__shortcut:not(:first-child){margin-left:8px}")); 10215 document.head.appendChild(style); 10216 } 10217 function SaveButton() { 10218 const [isSaveViewOpen, setIsSaveViewOpened] = (0, import_element23.useState)(false); 10219 const { isSaving, dirtyEntityRecordsCount } = (0, import_data6.useSelect)((select) => { 10220 const { isSavingEntityRecord, __experimentalGetDirtyEntityRecords } = select(import_core_data2.store); 10221 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 10222 return { 10223 isSaving: dirtyEntityRecords.some( 10224 (record) => isSavingEntityRecord(record.kind, record.name, record.key) 10225 ), 10226 dirtyEntityRecordsCount: dirtyEntityRecords.length 10227 }; 10228 }, []); 10229 const [showSavedState, setShowSavedState] = (0, import_element23.useState)(false); 10230 (0, import_element23.useEffect)(() => { 10231 if (isSaving) { 10232 setShowSavedState(true); 10233 } 10234 }, [isSaving]); 10235 const hasChanges = dirtyEntityRecordsCount > 0; 10236 (0, import_element23.useEffect)(() => { 10237 if (!isSaving && hasChanges) { 10238 setShowSavedState(false); 10239 } 10240 }, [isSaving, hasChanges]); 10241 function hideSavedState() { 10242 if (showSavedState) { 10243 setShowSavedState(false); 10244 } 10245 } 10246 const shouldShowButton = hasChanges || showSavedState; 10247 useSaveShortcut({ openSavePanel: () => setIsSaveViewOpened(true) }); 10248 if (!shouldShowButton) { 10249 return null; 10250 } 10251 const isInSavedState = showSavedState && !hasChanges; 10252 const disabled2 = isSaving || isInSavedState; 10253 const getLabel = () => { 10254 if (isInSavedState) { 10255 return (0, import_i18n4.__)("Saved"); 10256 } 10257 return (0, import_i18n4.sprintf)( 10258 // translators: %d: number of unsaved changes (number). 10259 (0, import_i18n4._n)( 10260 "Review %d change…", 10261 "Review %d changes…", 10262 dirtyEntityRecordsCount 10263 ), 10264 dirtyEntityRecordsCount 10265 ); 10266 }; 10267 const label = getLabel(); 10268 const shortcut = import_keycodes.displayShortcut.primary("s"); 10269 return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [ 10270 /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(tooltip_exports.Root, { children: [ 10271 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( 10272 tooltip_exports.Trigger, 10273 { 10274 render: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( 10275 import_components8.Button, 10276 { 10277 variant: "primary", 10278 size: "compact", 10279 onClick: () => setIsSaveViewOpened(true), 10280 onBlur: hideSavedState, 10281 disabled: disabled2, 10282 accessibleWhenDisabled: true, 10283 isBusy: isSaving, 10284 "aria-keyshortcuts": import_keycodes.rawShortcut.primary("s"), 10285 className: "boot-save-button", 10286 icon: isInSavedState ? check_default : void 0, 10287 children: label 10288 } 10289 ) 10290 } 10291 ), 10292 /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(tooltip_exports.Popup, { children: [ 10293 hasChanges && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: label }), 10294 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "boot-save-button__shortcut", children: shortcut }) 10295 ] }) 10296 ] }), 10297 isSaveViewOpen && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( 10298 import_components8.Modal, 10299 { 10300 title: (0, import_i18n4.__)("Review changes"), 10301 onRequestClose: () => setIsSaveViewOpened(false), 10302 size: "small", 10303 children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( 10304 import_editor2.EntitiesSavedStates, 10305 { 10306 close: () => setIsSaveViewOpened(false), 10307 variant: "inline" 10308 } 10309 ) 10310 } 10311 ) 10312 ] }); 10313 } 10314 10315 // packages/boot/build-module/components/sidebar/index.mjs 10316 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 10317 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='17b769ae66']")) { 10318 const style = document.createElement("style"); 10319 style.setAttribute("data-wp-hash", "17b769ae66"); 10320 style.appendChild(document.createTextNode(".boot-sidebar__scrollable{display:flex;flex-direction:column;height:100%;overflow:auto;position:relative}.boot-sidebar__content{contain:content;flex-grow:1;position:relative}.boot-sidebar__footer{padding:16px 8px 8px 16px}.boot-sidebar__back-button{margin:16px 12px 8px}")); 10321 document.head.appendChild(style); 10322 } 10323 function DashboardBackButton() { 10324 const dashboardLink = (0, import_data7.useSelect)( 10325 (select) => select(store).getDashboardLink(), 10326 [] 10327 ); 10328 return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 10329 import_components9.Button, 10330 { 10331 __next40pxDefaultSize: true, 10332 className: "boot-sidebar__back-button", 10333 href: dashboardLink || "/", 10334 icon: (0, import_i18n5.isRTL)() ? chevron_right_default : chevron_left_default, 10335 label: (0, import_i18n5.__)("Go to the Dashboard"), 10336 children: (0, import_i18n5.__)("Dashboard") 10337 } 10338 ); 10339 } 10340 function Sidebar() { 10341 return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "boot-sidebar__scrollable", children: [ 10342 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DashboardBackButton, {}), 10343 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "boot-sidebar__content", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(navigation_default, {}) }), 10344 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "boot-sidebar__footer", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SaveButton, {}) }) 10345 ] }); 10346 } 10347 10348 // packages/boot/build-module/components/save-panel/index.mjs 10349 var import_element24 = __toESM(require_element(), 1); 10350 var import_components10 = __toESM(require_components(), 1); 10351 var import_editor3 = __toESM(require_editor(), 1); 10352 var import_i18n6 = __toESM(require_i18n(), 1); 10353 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 10354 function SavePanel() { 10355 const [isOpen, setIsOpen] = (0, import_element24.useState)(false); 10356 useSaveShortcut({ 10357 openSavePanel: () => setIsOpen(true) 10358 }); 10359 if (!isOpen) { 10360 return false; 10361 } 10362 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 10363 import_components10.Modal, 10364 { 10365 className: "edit-site-save-panel__modal", 10366 onRequestClose: () => setIsOpen(false), 10367 title: (0, import_i18n6.__)("Review changes"), 10368 size: "small", 10369 children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 10370 import_editor3.EntitiesSavedStates, 10371 { 10372 close: () => setIsOpen(false), 10373 variant: "inline" 10374 } 10375 ) 10376 } 10377 ); 10378 } 10379 10380 // packages/boot/build-module/components/canvas-renderer/index.mjs 10381 var import_element26 = __toESM(require_element(), 1); 10382 10383 // packages/boot/build-module/components/canvas/index.mjs 10384 var import_element25 = __toESM(require_element(), 1); 10385 var import_components12 = __toESM(require_components(), 1); 10386 import { useNavigate } from "@wordpress/route"; 10387 10388 // packages/boot/build-module/components/canvas/back-button.mjs 10389 var import_components11 = __toESM(require_components(), 1); 10390 var import_i18n7 = __toESM(require_i18n(), 1); 10391 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 10392 function BootBackButton({ length }) { 10393 const handleBack = () => { 10394 window.history.back(); 10395 }; 10396 if (length > 1) { 10397 return null; 10398 } 10399 return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 10400 import_components11.Button, 10401 { 10402 size: "compact", 10403 onClick: handleBack, 10404 label: (0, import_i18n7.__)("Go back"), 10405 icon: (0, import_i18n7.isRTL)() ? chevron_right_default : chevron_left_default 10406 } 10407 ); 10408 } 10409 10410 // packages/boot/build-module/components/canvas/index.mjs 10411 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 10412 function Canvas({ canvas }) { 10413 const [Editor, setEditor] = (0, import_element25.useState)(null); 10414 const navigate = useNavigate(); 10415 (0, import_element25.useEffect)(() => { 10416 import("@wordpress/lazy-editor").then((module) => { 10417 setEditor(() => module.Editor); 10418 }).catch((error) => { 10419 console.error("Failed to load lazy editor:", error); 10420 }); 10421 }, []); 10422 if (!Editor) { 10423 return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 10424 "div", 10425 { 10426 style: { 10427 display: "flex", 10428 justifyContent: "center", 10429 alignItems: "center", 10430 height: "100%", 10431 padding: "2rem" 10432 }, 10433 children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components12.Spinner, {}) 10434 } 10435 ); 10436 } 10437 const backButton = !canvas.isPreview ? ({ length }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BootBackButton, { length }) : void 0; 10438 return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { style: { height: "100%", position: "relative" }, children: [ 10439 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 10440 "div", 10441 { 10442 style: { height: "100%" }, 10443 inert: canvas.isPreview ? "true" : void 0, 10444 children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 10445 Editor, 10446 { 10447 postType: canvas.postType, 10448 postId: canvas.postId, 10449 settings: { 10450 isPreviewMode: canvas.isPreview, 10451 styles: canvas.isPreview ? [{ css: "body{min-height:100vh;}" }] : [] 10452 }, 10453 backButton 10454 } 10455 ) 10456 } 10457 ), 10458 canvas.isPreview && canvas.editLink && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 10459 "div", 10460 { 10461 onClick: () => navigate({ to: canvas.editLink }), 10462 onKeyDown: (e) => { 10463 if (e.key === "Enter" || e.key === " ") { 10464 e.preventDefault(); 10465 navigate({ to: canvas.editLink }); 10466 } 10467 }, 10468 style: { 10469 position: "absolute", 10470 inset: 0, 10471 cursor: "pointer", 10472 zIndex: 1 10473 }, 10474 role: "button", 10475 tabIndex: 0, 10476 "aria-label": "Click to edit" 10477 } 10478 ) 10479 ] }); 10480 } 10481 10482 // packages/boot/build-module/components/canvas-renderer/index.mjs 10483 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 10484 function CanvasRenderer({ 10485 canvas, 10486 routeContentModule 10487 }) { 10488 const [CustomCanvas, setCustomCanvas] = (0, import_element26.useState)(null); 10489 (0, import_element26.useEffect)(() => { 10490 if (canvas === null && routeContentModule) { 10491 import(routeContentModule).then((module) => { 10492 setCustomCanvas(() => module.canvas); 10493 }).catch((error) => { 10494 console.error("Failed to load custom canvas:", error); 10495 }); 10496 } else { 10497 setCustomCanvas(null); 10498 } 10499 }, [canvas, routeContentModule]); 10500 if (canvas === void 0) { 10501 return null; 10502 } 10503 if (canvas === null) { 10504 if (!CustomCanvas) { 10505 return null; 10506 } 10507 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomCanvas, {}); 10508 } 10509 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Canvas, { canvas }); 10510 } 10511 10512 // packages/boot/build-module/components/app/use-route-title.mjs 10513 var import_element27 = __toESM(require_element(), 1); 10514 var import_data8 = __toESM(require_data(), 1); 10515 var import_core_data3 = __toESM(require_core_data(), 1); 10516 var import_i18n8 = __toESM(require_i18n(), 1); 10517 var import_html_entities = __toESM(require_html_entities(), 1); 10518 import { speak } from "@wordpress/a11y"; 10519 import { privateApis as routePrivateApis3 } from "@wordpress/route"; 10520 var { useLocation, useMatches: useMatches2 } = unlock2(routePrivateApis3); 10521 function useRouteTitle() { 10522 const location = useLocation(); 10523 const matches = useMatches2(); 10524 const currentMatch = matches[matches.length - 1]; 10525 const routeTitle = currentMatch?.loaderData?.title; 10526 const siteTitle = (0, import_data8.useSelect)( 10527 (select) => select(import_core_data3.store).getEntityRecord( 10528 "root", 10529 "__unstableBase" 10530 )?.name, 10531 [] 10532 ); 10533 const isInitialLocationRef = (0, import_element27.useRef)(true); 10534 (0, import_element27.useEffect)(() => { 10535 isInitialLocationRef.current = false; 10536 }, [location]); 10537 (0, import_element27.useEffect)(() => { 10538 if (isInitialLocationRef.current) { 10539 return; 10540 } 10541 if (routeTitle && typeof routeTitle === "string" && siteTitle && typeof siteTitle === "string") { 10542 const decodedRouteTitle = (0, import_html_entities.decodeEntities)(routeTitle); 10543 const decodedSiteTitle = (0, import_html_entities.decodeEntities)(siteTitle); 10544 const formattedTitle = (0, import_i18n8.sprintf)( 10545 /* translators: Admin document title. 1: Admin screen name, 2: Site name. */ 10546 (0, import_i18n8.__)("%1$s ‹ %2$s — WordPress"), 10547 decodedRouteTitle, 10548 decodedSiteTitle 10549 ); 10550 document.title = formattedTitle; 10551 if (decodedRouteTitle) { 10552 speak(decodedRouteTitle, "assertive"); 10553 } 10554 } 10555 }, [routeTitle, siteTitle, location]); 10556 } 10557 10558 // packages/boot/build-module/components/root/use-sync-body-background.mjs 10559 var import_element28 = __toESM(require_element(), 1); 10560 var import_compose3 = __toESM(require_compose(), 1); 10561 function useSyncBodyBackground() { 10562 const layoutRef = (0, import_element28.useRef)(null); 10563 (0, import_compose3.useIsomorphicLayoutEffect)(() => { 10564 if (!layoutRef.current) { 10565 return; 10566 } 10567 const body = layoutRef.current.ownerDocument.body; 10568 const bg = getComputedStyle(layoutRef.current).backgroundColor; 10569 if (!bg) { 10570 return; 10571 } 10572 const previousBackground = body.style.background; 10573 body.style.background = bg; 10574 return () => { 10575 body.style.background = previousBackground; 10576 }; 10577 }, []); 10578 return layoutRef; 10579 } 10580 10581 // packages/boot/build-module/components/root/index.mjs 10582 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 10583 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='d38c56df8c']")) { 10584 const style = document.createElement("style"); 10585 style.setAttribute("data-wp-hash", "d38c56df8c"); 10586 style.appendChild(document.createTextNode(".boot-layout{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:row;height:100%;isolation:isolate;width:100%}.boot-layout__sidebar-backdrop{background-color:rgba(0,0,0,.5);bottom:0;cursor:var(--wpds-cursor-control,pointer);left:0;position:fixed;right:0;top:0;z-index:100002}.boot-layout__sidebar{flex-shrink:0;height:100%;overflow:hidden;position:relative;width:240px}.boot-layout__sidebar.is-mobile{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);bottom:0;box-shadow:2px 0 8px rgba(0,0,0,.2);inset-inline-start:0;max-width:85vw;position:fixed;top:0;width:300px;z-index:100003}.boot-layout__mobile-sidebar-drawer{left:0;position:fixed;right:0;top:0}.boot-layout--single-page .boot-layout__mobile-sidebar-drawer{top:46px}.boot-layout__mobile-sidebar-drawer{align-items:center;background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-bottom:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);display:flex;justify-content:flex-start;padding:16px;z-index:3}.boot-layout__canvas.has-mobile-drawer{padding-top:65px;position:relative}.boot-layout__surfaces{display:flex;flex-grow:1;gap:8px;margin:0}@media (min-width:782px){.boot-layout__surfaces{margin:8px}.boot-layout--single-page .boot-layout__surfaces{margin-top:0;margin-inline-start:0}}.boot-layout__inspector,.boot-layout__stage{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-radius:0;bottom:0;color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;left:0;margin:0;overflow-y:auto;position:relative;position:fixed;right:0;top:0;width:100vw}.boot-layout--single-page .boot-layout__inspector,.boot-layout--single-page .boot-layout__stage{height:calc(100vh - 46px);top:46px}@media (min-width:782px){.boot-layout__inspector,.boot-layout__stage{border-radius:var(--wpds-border-radius-xl,12px);height:auto;margin:0;position:static;width:auto}.boot-layout--single-page .boot-layout__inspector,.boot-layout--single-page .boot-layout__stage{height:auto}}.boot-layout__stage{z-index:2}@media (min-width:782px){.boot-layout__stage{z-index:auto}}.boot-layout__inspector{z-index:3}@media (min-width:782px){.boot-layout__inspector{z-index:auto}}.boot-layout__canvas{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);border-radius:0;bottom:0;box-shadow:0 1px 3px rgba(0,0,0,.1);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;left:0;margin:0;overflow-y:auto;position:relative;position:fixed;right:0;top:0;width:100vw;z-index:1}.boot-layout--single-page .boot-layout__canvas{height:calc(100vh - 46px);top:46px}@media (min-width:782px){.boot-layout__canvas{border-radius:var(--wpds-border-radius-xl,12px);height:auto;position:static;width:auto;z-index:auto}.boot-layout--single-page .boot-layout__canvas{height:auto}.boot-layout.has-canvas .boot-layout__stage,.boot-layout__inspector{max-width:400px}}.boot-layout__canvas .interface-interface-skeleton{height:100%;left:0!important;position:relative;top:0!important}.boot-layout.has-full-canvas .boot-layout__surfaces{gap:0;margin:0}.boot-layout.has-full-canvas .boot-layout__inspector,.boot-layout.has-full-canvas .boot-layout__stage{display:none}.boot-layout.has-full-canvas .boot-layout__canvas{border:none;border-radius:0;bottom:0;box-shadow:none;left:0;margin:0;max-width:none;overflow:hidden;position:fixed;right:0;top:var(--wp-admin--admin-bar--height,0)}.boot-layout--single-page .boot-layout.has-full-canvas .boot-layout__canvas{top:46px}@media (min-width:782px){.boot-layout--single-page .boot-layout.has-full-canvas .boot-layout__canvas{top:32px}}@media (max-width:782px){.boot-layout__canvas:not(.has-mobile-drawer),.boot-layout__inspector,.boot-layout__stage{height:calc(100vh - var(--wp-admin--admin-bar--height, 0px));top:var(--wp-admin--admin-bar--height,0)}.boot-layout__mobile-sidebar-drawer{top:var(--wp-admin--admin-bar--height,0)}}")); 10587 document.head.appendChild(style); 10588 } 10589 var { useLocation: useLocation2, useMatches: useMatches3, Outlet } = unlock2(routePrivateApis4); 10590 function Root2() { 10591 const matches = useMatches3(); 10592 const location = useLocation2(); 10593 const currentMatch = matches[matches.length - 1]; 10594 const canvas = currentMatch?.loaderData?.canvas; 10595 const routeContentModule = currentMatch?.loaderData?.routeContentModule; 10596 const isFullScreen = canvas && !canvas.isPreview; 10597 useRouteTitle(); 10598 const isMobileViewport = (0, import_compose4.useViewportMatch)("medium", "<"); 10599 const [isMobileSidebarOpen, setIsMobileSidebarOpen] = (0, import_element29.useState)(false); 10600 const disableMotion = (0, import_compose4.useReducedMotion)(); 10601 (0, import_element29.useEffect)(() => { 10602 setIsMobileSidebarOpen(false); 10603 }, [location.pathname, isMobileViewport]); 10604 const themeColors = (0, import_element29.useMemo)(getAdminThemeColors, []); 10605 const layoutRef = useSyncBodyBackground(); 10606 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components13.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(tooltip_exports.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( 10607 import_theme.ThemeProvider, 10608 { 10609 isRoot: true, 10610 color: { ...themeColors, background: "#f8f8f8" }, 10611 children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_theme.ThemeProvider, { color: themeColors, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)( 10612 "div", 10613 { 10614 ref: layoutRef, 10615 className: clsx_default("boot-layout", { 10616 "has-canvas": !!canvas || canvas === null, 10617 "has-full-canvas": isFullScreen 10618 }), 10619 children: [ 10620 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SavePanel, {}), 10621 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_notices.SnackbarNotices, { className: "boot-notices__snackbar" }), 10622 isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(page_default.SidebarToggleFill, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( 10623 import_components13.Button, 10624 { 10625 icon: menu_default, 10626 onClick: () => setIsMobileSidebarOpen(true), 10627 label: (0, import_i18n9.__)("Open navigation panel"), 10628 size: "compact" 10629 } 10630 ) }), 10631 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components13.__unstableAnimatePresence, { children: isMobileViewport && isMobileSidebarOpen && !isFullScreen && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( 10632 import_components13.__unstableMotion.div, 10633 { 10634 initial: { opacity: 0 }, 10635 animate: { opacity: 1 }, 10636 exit: { opacity: 0 }, 10637 transition: { 10638 type: "tween", 10639 duration: disableMotion ? 0 : 0.2, 10640 ease: "easeOut" 10641 }, 10642 className: "boot-layout__sidebar-backdrop", 10643 onClick: () => setIsMobileSidebarOpen(false), 10644 onKeyDown: (event) => { 10645 if (event.key === "Escape") { 10646 setIsMobileSidebarOpen( 10647 false 10648 ); 10649 } 10650 }, 10651 role: "button", 10652 tabIndex: -1, 10653 "aria-label": (0, import_i18n9.__)( 10654 "Close navigation panel" 10655 ) 10656 } 10657 ) }), 10658 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components13.__unstableAnimatePresence, { children: isMobileViewport && isMobileSidebarOpen && !isFullScreen && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( 10659 import_components13.__unstableMotion.div, 10660 { 10661 initial: { x: "-100%" }, 10662 animate: { x: 0 }, 10663 exit: { x: "-100%" }, 10664 transition: { 10665 type: "tween", 10666 duration: disableMotion ? 0 : 0.2, 10667 ease: "easeOut" 10668 }, 10669 className: "boot-layout__sidebar is-mobile", 10670 children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Sidebar, {}) 10671 } 10672 ) }), 10673 !isMobileViewport && !isFullScreen && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "boot-layout__sidebar", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Sidebar, {}) }), 10674 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "boot-layout__surfaces", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)( 10675 import_theme.ThemeProvider, 10676 { 10677 color: { 10678 ...themeColors, 10679 background: "#ffffff" 10680 }, 10681 children: [ 10682 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Outlet, {}), 10683 (canvas || canvas === null) && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)( 10684 "div", 10685 { 10686 className: clsx_default( 10687 "boot-layout__canvas", 10688 { 10689 "has-mobile-drawer": canvas?.isPreview && isMobileViewport 10690 } 10691 ), 10692 children: [ 10693 canvas?.isPreview && isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "boot-layout__mobile-sidebar-drawer", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( 10694 import_components13.Button, 10695 { 10696 icon: menu_default, 10697 onClick: () => setIsMobileSidebarOpen( 10698 true 10699 ), 10700 label: (0, import_i18n9.__)( 10701 "Open navigation panel" 10702 ), 10703 size: "compact" 10704 } 10705 ) }), 10706 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( 10707 CanvasRenderer, 10708 { 10709 canvas, 10710 routeContentModule 10711 } 10712 ) 10713 ] 10714 } 10715 ) 10716 ] 10717 } 10718 ) }) 10719 ] 10720 } 10721 ) }) 10722 } 10723 ) }) }); 10724 } 10725 10726 // packages/boot/build-module/components/app/router.mjs 10727 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 10728 var { 10729 createLazyRoute, 10730 createRouter, 10731 createRootRoute, 10732 createRoute, 10733 RouterProvider, 10734 createBrowserHistory, 10735 parseHref, 10736 useLoaderData 10737 } = unlock2(routePrivateApis5); 10738 function NotFoundComponent() { 10739 return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "boot-layout__stage", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(page_default, { title: (0, import_i18n10.__)("Route not found"), hasPadding: true, children: (0, import_i18n10.__)("The page you're looking for does not exist") }) }); 10740 } 10741 function createRouteFromDefinition(route, parentRoute) { 10742 let tanstackRoute = createRoute({ 10743 getParentRoute: () => parentRoute, 10744 path: route.path, 10745 beforeLoad: async (opts) => { 10746 if (route.route_module) { 10747 const module = await import(route.route_module); 10748 const routeConfig = module.route || {}; 10749 if (routeConfig.beforeLoad) { 10750 return routeConfig.beforeLoad({ 10751 params: opts.params || {}, 10752 search: opts.search || {} 10753 }); 10754 } 10755 } 10756 }, 10757 loader: async (opts) => { 10758 let routeConfig = {}; 10759 if (route.route_module) { 10760 const module = await import(route.route_module); 10761 routeConfig = module.route || {}; 10762 } 10763 const context = { 10764 params: opts.params || {}, 10765 search: opts.deps || {} 10766 }; 10767 const [, loaderData, canvasData, titleData] = await Promise.all([ 10768 (0, import_data9.resolveSelect)(import_core_data4.store).getEntityRecord( 10769 "root", 10770 "__unstableBase" 10771 ), 10772 routeConfig.loader ? routeConfig.loader(context) : Promise.resolve(void 0), 10773 routeConfig.canvas ? routeConfig.canvas(context) : Promise.resolve(void 0), 10774 routeConfig.title ? routeConfig.title(context) : Promise.resolve(void 0) 10775 ]); 10776 let inspector = true; 10777 if (routeConfig.inspector) { 10778 inspector = await routeConfig.inspector(context); 10779 } 10780 return { 10781 ...loaderData, 10782 canvas: canvasData, 10783 inspector, 10784 title: titleData, 10785 routeContentModule: route.content_module 10786 }; 10787 }, 10788 loaderDeps: (opts) => opts.search 10789 }); 10790 tanstackRoute = tanstackRoute.lazy(async () => { 10791 const module = route.content_module ? await import(route.content_module) : {}; 10792 const Stage = module.stage; 10793 const Inspector = module.inspector; 10794 return createLazyRoute(route.path)({ 10795 component: function RouteComponent() { 10796 const { inspector: showInspector } = useLoaderData({ from: route.path }) ?? {}; 10797 return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [ 10798 Stage && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "boot-layout__stage", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Stage, {}) }), 10799 Inspector && showInspector && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "boot-layout__inspector", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Inspector, {}) }) 10800 ] }); 10801 } 10802 }); 10803 }); 10804 return tanstackRoute; 10805 } 10806 function createRouteTree(routes, rootComponent = Root2) { 10807 const rootRoute = createRootRoute({ 10808 component: rootComponent, 10809 context: () => ({}) 10810 }); 10811 const dynamicRoutes = routes.map( 10812 (route) => createRouteFromDefinition(route, rootRoute) 10813 ); 10814 return rootRoute.addChildren(dynamicRoutes); 10815 } 10816 function createPathHistory() { 10817 return createBrowserHistory({ 10818 parseLocation: () => { 10819 const url = new URL(window.location.href); 10820 const path = url.searchParams.get("p") || "/"; 10821 const pathHref = `$path}$url.hash}`; 10822 return parseHref(pathHref, window.history.state); 10823 }, 10824 createHref: (href) => { 10825 const searchParams = new URLSearchParams(window.location.search); 10826 searchParams.set("p", href); 10827 return `$window.location.pathname}?$searchParams}`; 10828 } 10829 }); 10830 } 10831 function Router({ 10832 routes, 10833 rootComponent = Root2 10834 }) { 10835 const router = (0, import_element30.useMemo)(() => { 10836 const history = createPathHistory(); 10837 const routeTree = createRouteTree(routes, rootComponent); 10838 return createRouter({ 10839 history, 10840 routeTree, 10841 defaultPreload: "intent", 10842 defaultNotFoundComponent: NotFoundComponent, 10843 defaultViewTransition: { 10844 types: ({ 10845 fromLocation 10846 }) => { 10847 if (!fromLocation) { 10848 return false; 10849 } 10850 return ["navigate"]; 10851 } 10852 } 10853 }); 10854 }, [routes, rootComponent]); 10855 return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(RouterProvider, { router }); 10856 } 10857 10858 // packages/boot/build-module/components/root/single-page.mjs 10859 var import_notices2 = __toESM(require_notices(), 1); 10860 var import_components14 = __toESM(require_components(), 1); 10861 var import_element31 = __toESM(require_element(), 1); 10862 import { privateApis as routePrivateApis6 } from "@wordpress/route"; 10863 var import_theme2 = __toESM(require_theme(), 1); 10864 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); 10865 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='d38c56df8c']")) { 10866 const style = document.createElement("style"); 10867 style.setAttribute("data-wp-hash", "d38c56df8c"); 10868 style.appendChild(document.createTextNode(".boot-layout{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:row;height:100%;isolation:isolate;width:100%}.boot-layout__sidebar-backdrop{background-color:rgba(0,0,0,.5);bottom:0;cursor:var(--wpds-cursor-control,pointer);left:0;position:fixed;right:0;top:0;z-index:100002}.boot-layout__sidebar{flex-shrink:0;height:100%;overflow:hidden;position:relative;width:240px}.boot-layout__sidebar.is-mobile{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);bottom:0;box-shadow:2px 0 8px rgba(0,0,0,.2);inset-inline-start:0;max-width:85vw;position:fixed;top:0;width:300px;z-index:100003}.boot-layout__mobile-sidebar-drawer{left:0;position:fixed;right:0;top:0}.boot-layout--single-page .boot-layout__mobile-sidebar-drawer{top:46px}.boot-layout__mobile-sidebar-drawer{align-items:center;background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-bottom:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);display:flex;justify-content:flex-start;padding:16px;z-index:3}.boot-layout__canvas.has-mobile-drawer{padding-top:65px;position:relative}.boot-layout__surfaces{display:flex;flex-grow:1;gap:8px;margin:0}@media (min-width:782px){.boot-layout__surfaces{margin:8px}.boot-layout--single-page .boot-layout__surfaces{margin-top:0;margin-inline-start:0}}.boot-layout__inspector,.boot-layout__stage{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border-radius:0;bottom:0;color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;left:0;margin:0;overflow-y:auto;position:relative;position:fixed;right:0;top:0;width:100vw}.boot-layout--single-page .boot-layout__inspector,.boot-layout--single-page .boot-layout__stage{height:calc(100vh - 46px);top:46px}@media (min-width:782px){.boot-layout__inspector,.boot-layout__stage{border-radius:var(--wpds-border-radius-xl,12px);height:auto;margin:0;position:static;width:auto}.boot-layout--single-page .boot-layout__inspector,.boot-layout--single-page .boot-layout__stage{height:auto}}.boot-layout__stage{z-index:2}@media (min-width:782px){.boot-layout__stage{z-index:auto}}.boot-layout__inspector{z-index:3}@media (min-width:782px){.boot-layout__inspector{z-index:auto}}.boot-layout__canvas{background:var(--wpds-color-background-surface-neutral,#fcfcfc);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);border-radius:0;bottom:0;box-shadow:0 1px 3px rgba(0,0,0,.1);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);flex:1;height:100vh;left:0;margin:0;overflow-y:auto;position:relative;position:fixed;right:0;top:0;width:100vw;z-index:1}.boot-layout--single-page .boot-layout__canvas{height:calc(100vh - 46px);top:46px}@media (min-width:782px){.boot-layout__canvas{border-radius:var(--wpds-border-radius-xl,12px);height:auto;position:static;width:auto;z-index:auto}.boot-layout--single-page .boot-layout__canvas{height:auto}.boot-layout.has-canvas .boot-layout__stage,.boot-layout__inspector{max-width:400px}}.boot-layout__canvas .interface-interface-skeleton{height:100%;left:0!important;position:relative;top:0!important}.boot-layout.has-full-canvas .boot-layout__surfaces{gap:0;margin:0}.boot-layout.has-full-canvas .boot-layout__inspector,.boot-layout.has-full-canvas .boot-layout__stage{display:none}.boot-layout.has-full-canvas .boot-layout__canvas{border:none;border-radius:0;bottom:0;box-shadow:none;left:0;margin:0;max-width:none;overflow:hidden;position:fixed;right:0;top:var(--wp-admin--admin-bar--height,0)}.boot-layout--single-page .boot-layout.has-full-canvas .boot-layout__canvas{top:46px}@media (min-width:782px){.boot-layout--single-page .boot-layout.has-full-canvas .boot-layout__canvas{top:32px}}@media (max-width:782px){.boot-layout__canvas:not(.has-mobile-drawer),.boot-layout__inspector,.boot-layout__stage{height:calc(100vh - var(--wp-admin--admin-bar--height, 0px));top:var(--wp-admin--admin-bar--height,0)}.boot-layout__mobile-sidebar-drawer{top:var(--wp-admin--admin-bar--height,0)}}")); 10869 document.head.appendChild(style); 10870 } 10871 var { useMatches: useMatches4, Outlet: Outlet2 } = unlock2(routePrivateApis6); 10872 function RootSinglePage() { 10873 const matches = useMatches4(); 10874 const currentMatch = matches[matches.length - 1]; 10875 const canvas = currentMatch?.loaderData?.canvas; 10876 const routeContentModule = currentMatch?.loaderData?.routeContentModule; 10877 const isFullScreen = canvas && !canvas.isPreview; 10878 useRouteTitle(); 10879 const themeColors = (0, import_element31.useMemo)(getAdminThemeColors, []); 10880 const layoutRef = useSyncBodyBackground(); 10881 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components14.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( 10882 import_theme2.ThemeProvider, 10883 { 10884 isRoot: true, 10885 color: { ...themeColors, background: "#f8f8f8" }, 10886 children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_theme2.ThemeProvider, { color: themeColors, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)( 10887 "div", 10888 { 10889 ref: layoutRef, 10890 className: clsx_default( 10891 "boot-layout boot-layout--single-page", 10892 { 10893 "has-canvas": !!canvas || canvas === null, 10894 "has-full-canvas": isFullScreen 10895 } 10896 ), 10897 children: [ 10898 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SavePanel, {}), 10899 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_notices2.SnackbarNotices, { className: "boot-notices__snackbar" }), 10900 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "boot-layout__surfaces", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)( 10901 import_theme2.ThemeProvider, 10902 { 10903 color: { 10904 ...themeColors, 10905 background: "#ffffff" 10906 }, 10907 children: [ 10908 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Outlet2, {}), 10909 (canvas || canvas === null) && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "boot-layout__canvas", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( 10910 CanvasRenderer, 10911 { 10912 canvas, 10913 routeContentModule 10914 } 10915 ) }) 10916 ] 10917 } 10918 ) }) 10919 ] 10920 } 10921 ) }) 10922 } 10923 ) }); 10924 } 10925 10926 // packages/boot/build-module/components/app/index.mjs 10927 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); 10928 function App({ rootComponent }) { 10929 const routes = (0, import_data10.useSelect)((select) => select(store).getRoutes(), []); 10930 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Router, { routes, rootComponent }); 10931 } 10932 async function runInitModules(initModules) { 10933 for (const moduleId of initModules ?? []) { 10934 const module = await import(moduleId); 10935 await module.init(); 10936 } 10937 } 10938 async function init({ 10939 mountId, 10940 menuItems, 10941 routes, 10942 initModules, 10943 dashboardLink 10944 }) { 10945 (menuItems ?? []).forEach((menuItem) => { 10946 (0, import_data10.dispatch)(store).registerMenuItem(menuItem.id, menuItem); 10947 }); 10948 (routes ?? []).forEach((route) => { 10949 (0, import_data10.dispatch)(store).registerRoute(route); 10950 }); 10951 if (dashboardLink) { 10952 (0, import_data10.dispatch)(store).setDashboardLink(dashboardLink); 10953 } 10954 await runInitModules(initModules); 10955 const rootElement = document.getElementById(mountId); 10956 if (rootElement) { 10957 const root = (0, import_element32.createRoot)(rootElement); 10958 root.render( 10959 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_element32.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(App, {}) }) 10960 ); 10961 } 10962 } 10963 async function initSinglePage({ 10964 mountId, 10965 routes, 10966 initModules 10967 }) { 10968 (routes ?? []).forEach((route) => { 10969 (0, import_data10.dispatch)(store).registerRoute(route); 10970 }); 10971 await runInitModules(initModules); 10972 const rootElement = document.getElementById(mountId); 10973 if (rootElement) { 10974 const root = (0, import_element32.createRoot)(rootElement); 10975 root.render( 10976 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_element32.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(App, { rootComponent: RootSinglePage }) }) 10977 ); 10978 } 10979 } 10980 10981 // packages/boot/build-module/index.mjs 10982 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='54fd778906']")) { 10983 const style = document.createElement("style"); 10984 style.setAttribute("data-wp-hash", "54fd778906"); 10985 style.appendChild(document.createTextNode("@media (min-width:600px){.boot-layout-container .boot-layout{bottom:0;left:0;min-height:calc(100vh - 46px);position:absolute;right:0;top:0}}@media (min-width:782px){.boot-layout-container .boot-layout{min-height:calc(100vh - 32px)}body:has(.boot-layout.has-full-canvas) .boot-layout-container .boot-layout{min-height:100vh}}.boot-layout-container .boot-layout img{height:auto;max-width:100%}.boot-layout .boot-notices__snackbar{bottom:24px;box-sizing:border-box;display:flex;flex-direction:column;left:0;padding-inline:16px;pointer-events:none;position:fixed;right:0}.boot-layout .boot-notices__snackbar .components-snackbar{margin-inline:auto}")); 10986 document.head.appendChild(style); 10987 } 10988 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='28f077581a']")) { 10989 const style = document.createElement("style"); 10990 style.setAttribute("data-wp-hash", "28f077581a"); 10991 style.appendChild(document.createTextNode("@media (max-width:782px){*{view-transition-name:none!important}}::view-transition-new(root),::view-transition-old(root){animation-duration:.25s}@media not (prefers-reduced-motion:reduce){.boot-layout__canvas .interface-interface-skeleton__header{view-transition-name:boot--canvas-header}.boot-layout__canvas .interface-interface-skeleton__sidebar{view-transition-name:boot--canvas-sidebar}.boot-layout__stage{view-transition-name:boot--stage}.boot-layout__inspector{view-transition-name:boot--inspector}.boot-layout__canvas.is-full-canvas .interface-interface-skeleton__content,.boot-layout__canvas:not(.is-full-canvas){view-transition-name:boot--canvas}@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.boot-layout__stage{view-transition-name:boot-safari--stage}.boot-layout__inspector{view-transition-name:boot-safari--inspector}.boot-layout__canvas.is-full-canvas .interface-interface-skeleton__content,.boot-layout__canvas:not(.is-full-canvas){view-transition-name:boot-safari--canvas}}.components-popover:first-of-type{view-transition-name:boot--components-popover}}::view-transition-group(boot--canvas),::view-transition-group(boot--canvas-header),::view-transition-group(boot--canvas-sidebar),::view-transition-group(boot-safari--canvas){z-index:1}::view-transition-new(boot-safari--canvas),::view-transition-new(boot-safari--inspector),::view-transition-new(boot-safari--stage),::view-transition-old(boot-safari--canvas),::view-transition-old(boot-safari--inspector),::view-transition-old(boot-safari--stage){width:auto}::view-transition-new(boot--canvas),::view-transition-new(boot--inspector),::view-transition-new(boot--stage),::view-transition-old(boot--canvas),::view-transition-old(boot--inspector),::view-transition-old(boot--stage){background:#fff;border-radius:var(--wpds-border-radius-xl,12px);height:100%;object-fit:none;object-position:left top;overflow:hidden;width:100%}::view-transition-new(boot--canvas),::view-transition-old(boot--canvas){object-position:center top}::view-transition-old(boot--inspector):only-child,::view-transition-old(boot--stage):only-child,::view-transition-old(boot-safari--inspector):only-child,::view-transition-old(boot-safari--stage):only-child{animation-name:zoomOut;will-change:transform,opacity}::view-transition-new(boot--inspector):only-child,::view-transition-new(boot--stage):only-child,::view-transition-new(boot-safari--inspector):only-child,::view-transition-new(boot-safari--stage):only-child{animation-name:zoomIn;will-change:transform,opacity}@keyframes zoomOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.9)}}@keyframes zoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}::view-transition-new(boot--canvas):only-child,::view-transition-new(boot-safari--canvas):only-child{animation-name:slideFromRight;will-change:transform}::view-transition-old(boot--canvas):only-child,::view-transition-old(boot-safari--canvas):only-child{animation-name:slideToRight;will-change:transform}@keyframes slideFromRight{0%{transform:translateX(100vw)}to{transform:translateX(0)}}@keyframes slideToRight{0%{transform:translateX(0)}to{transform:translateX(100vw)}}::view-transition-new(boot--canvas-header):only-child{animation-name:slideHeaderFromTop;will-change:transform}::view-transition-old(boot--canvas-header):only-child{animation-name:slideHeaderToTop;will-change:transform}@keyframes slideHeaderFromTop{0%{transform:translateY(-100%)}}@keyframes slideHeaderToTop{to{transform:translateY(-100%)}}::view-transition-new(boot--canvas-sidebar):only-child{animation-name:slideSidebarFromRight;will-change:transform}::view-transition-old(boot--canvas-sidebar):only-child{animation-name:slideSidebarToRight;will-change:transform}@keyframes slideSidebarFromRight{0%{transform:translateX(100%)}}@keyframes slideSidebarToRight{to{transform:translateX(100%)}}")); 10992 document.head.appendChild(style); 10993 } 10994 export { 10995 init, 10996 initSinglePage, 10997 store 10998 }; 10999 /*! Bundled license information: 11000 11001 use-sync-external-store/cjs/use-sync-external-store-shim.development.js: 11002 (** 11003 * @license React 11004 * use-sync-external-store-shim.development.js 11005 * 11006 * Copyright (c) Meta Platforms, Inc. and affiliates. 11007 * 11008 * This source code is licensed under the MIT license found in the 11009 * LICENSE file in the root directory of this source tree. 11010 *) 11011 11012 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: 11013 (** 11014 * @license React 11015 * use-sync-external-store-shim/with-selector.development.js 11016 * 11017 * Copyright (c) Meta Platforms, Inc. and affiliates. 11018 * 11019 * This source code is licensed under the MIT license found in the 11020 * LICENSE file in the root directory of this source tree. 11021 *) 11022 */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sat Jul 25 08:20:20 2026 | Cross-referenced by PHPXref |