| @@ -86,22 +86,8 @@ | ||
| 86 | 86 | module.exports = window.wp.editor; |
| 87 | 87 | } |
| 88 | 88 | }); |
| 89 | 89 | |
| 90 | - // package-external:@wordpress/core-data | |
| 91 | - var require_core_data = __commonJS({ | |
| 92 | - "package-external:@wordpress/core-data"(exports, module) { | |
| 93 | - module.exports = window.wp.coreData; | |
| 94 | - } | |
| 95 | - }); | |
| 96 | - | |
| 97 | - // package-external:@wordpress/api-fetch | |
| 98 | - var require_api_fetch = __commonJS({ | |
| 99 | - "package-external:@wordpress/api-fetch"(exports, module) { | |
| 100 | - module.exports = window.wp.apiFetch; | |
| 101 | - } | |
| 102 | - }); | |
| 103 | - | |
| 104 | 90 | // package-external:@wordpress/i18n |
| 105 | 91 | var require_i18n = __commonJS({ |
| 106 | 92 | "package-external:@wordpress/i18n"(exports, module) { |
| 107 | 93 | module.exports = window.wp.i18n; |
| @@ -107,12 +93,12 @@ | ||
| 107 | 93 | module.exports = window.wp.i18n; |
| 108 | 94 | } |
| 109 | 95 | }); |
| 110 | 96 | |
| 111 | - // vendor-external:react | |
| 112 | - var require_react = __commonJS({ | |
| 113 | - "vendor-external:react"(exports, module) { | |
| 114 | - module.exports = window.React; | |
| 97 | + // package-external:@wordpress/components | |
| 98 | + var require_components = __commonJS({ | |
| 99 | + "package-external:@wordpress/components"(exports, module) { | |
| 100 | + module.exports = window.wp.components; | |
| 115 | 101 | } |
| 116 | 102 | }); |
| 117 | 103 | |
| 118 | 104 | // vendor-external:react/jsx-runtime |
| @@ -121,205 +107,8 @@ | ||
| 121 | 107 | module.exports = window.ReactJSXRuntime; |
| 122 | 108 | } |
| 123 | 109 | }); |
| 124 | 110 | |
| 125 | - // vendor-external:react-dom | |
| 126 | - var require_react_dom = __commonJS({ | |
| 127 | - "vendor-external:react-dom"(exports, module) { | |
| 128 | - module.exports = window.ReactDOM; | |
| 129 | - } | |
| 130 | - }); | |
| 131 | - | |
| 132 | - // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js | |
| 133 | - var require_use_sync_external_store_shim_development = __commonJS({ | |
| 134 | - "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { | |
| 135 | - "use strict"; | |
| 136 | - (function() { | |
| 137 | - function is(x, y) { | |
| 138 | - return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; | |
| 139 | - } | |
| 140 | - function useSyncExternalStore$2(subscribe, getSnapshot) { | |
| 141 | - didWarnOld18Alpha || void 0 === React47.startTransition || (didWarnOld18Alpha = true, console.error( | |
| 142 | - "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." | |
| 143 | - )); | |
| 144 | - var value = getSnapshot(); | |
| 145 | - if (!didWarnUncachedGetSnapshot) { | |
| 146 | - var cachedValue = getSnapshot(); | |
| 147 | - objectIs(value, cachedValue) || (console.error( | |
| 148 | - "The result of getSnapshot should be cached to avoid an infinite loop" | |
| 149 | - ), didWarnUncachedGetSnapshot = true); | |
| 150 | - } | |
| 151 | - cachedValue = useState16({ | |
| 152 | - inst: { value, getSnapshot } | |
| 153 | - }); | |
| 154 | - var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; | |
| 155 | - useLayoutEffect3( | |
| 156 | - function() { | |
| 157 | - inst.value = value; | |
| 158 | - inst.getSnapshot = getSnapshot; | |
| 159 | - checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 160 | - }, | |
| 161 | - [subscribe, value, getSnapshot] | |
| 162 | - ); | |
| 163 | - useEffect17( | |
| 164 | - function() { | |
| 165 | - checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 166 | - return subscribe(function() { | |
| 167 | - checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 168 | - }); | |
| 169 | - }, | |
| 170 | - [subscribe] | |
| 171 | - ); | |
| 172 | - useDebugValue2(value); | |
| 173 | - return value; | |
| 174 | - } | |
| 175 | - function checkIfSnapshotChanged(inst) { | |
| 176 | - var latestGetSnapshot = inst.getSnapshot; | |
| 177 | - inst = inst.value; | |
| 178 | - try { | |
| 179 | - var nextValue = latestGetSnapshot(); | |
| 180 | - return !objectIs(inst, nextValue); | |
| 181 | - } catch (error) { | |
| 182 | - return true; | |
| 183 | - } | |
| 184 | - } | |
| 185 | - function useSyncExternalStore$1(subscribe, getSnapshot) { | |
| 186 | - return getSnapshot(); | |
| 187 | - } | |
| 188 | - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); | |
| 189 | - var React47 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState16 = React47.useState, useEffect17 = React47.useEffect, useLayoutEffect3 = React47.useLayoutEffect, useDebugValue2 = React47.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; | |
| 190 | - exports.useSyncExternalStore = void 0 !== React47.useSyncExternalStore ? React47.useSyncExternalStore : shim; | |
| 191 | - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); | |
| 192 | - })(); | |
| 193 | - } | |
| 194 | - }); | |
| 195 | - | |
| 196 | - // node_modules/use-sync-external-store/shim/index.js | |
| 197 | - var require_shim = __commonJS({ | |
| 198 | - "node_modules/use-sync-external-store/shim/index.js"(exports, module) { | |
| 199 | - "use strict"; | |
| 200 | - if (false) { | |
| 201 | - module.exports = null; | |
| 202 | - } else { | |
| 203 | - module.exports = require_use_sync_external_store_shim_development(); | |
| 204 | - } | |
| 205 | - } | |
| 206 | - }); | |
| 207 | - | |
| 208 | - // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js | |
| 209 | - var require_with_selector_development = __commonJS({ | |
| 210 | - "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { | |
| 211 | - "use strict"; | |
| 212 | - (function() { | |
| 213 | - function is(x, y) { | |
| 214 | - return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; | |
| 215 | - } | |
| 216 | - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); | |
| 217 | - var React47 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef22 = React47.useRef, useEffect17 = React47.useEffect, useMemo16 = React47.useMemo, useDebugValue2 = React47.useDebugValue; | |
| 218 | - exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { | |
| 219 | - var instRef = useRef22(null); | |
| 220 | - if (null === instRef.current) { | |
| 221 | - var inst = { hasValue: false, value: null }; | |
| 222 | - instRef.current = inst; | |
| 223 | - } else inst = instRef.current; | |
| 224 | - instRef = useMemo16( | |
| 225 | - function() { | |
| 226 | - function memoizedSelector(nextSnapshot) { | |
| 227 | - if (!hasMemo) { | |
| 228 | - hasMemo = true; | |
| 229 | - memoizedSnapshot = nextSnapshot; | |
| 230 | - nextSnapshot = selector(nextSnapshot); | |
| 231 | - if (void 0 !== isEqual && inst.hasValue) { | |
| 232 | - var currentSelection = inst.value; | |
| 233 | - if (isEqual(currentSelection, nextSnapshot)) | |
| 234 | - return memoizedSelection = currentSelection; | |
| 235 | - } | |
| 236 | - return memoizedSelection = nextSnapshot; | |
| 237 | - } | |
| 238 | - currentSelection = memoizedSelection; | |
| 239 | - if (objectIs(memoizedSnapshot, nextSnapshot)) | |
| 240 | - return currentSelection; | |
| 241 | - var nextSelection = selector(nextSnapshot); | |
| 242 | - if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) | |
| 243 | - return memoizedSnapshot = nextSnapshot, currentSelection; | |
| 244 | - memoizedSnapshot = nextSnapshot; | |
| 245 | - return memoizedSelection = nextSelection; | |
| 246 | - } | |
| 247 | - var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; | |
| 248 | - return [ | |
| 249 | - function() { | |
| 250 | - return memoizedSelector(getSnapshot()); | |
| 251 | - }, | |
| 252 | - null === maybeGetServerSnapshot ? void 0 : function() { | |
| 253 | - return memoizedSelector(maybeGetServerSnapshot()); | |
| 254 | - } | |
| 255 | - ]; | |
| 256 | - }, | |
| 257 | - [getSnapshot, getServerSnapshot, selector, isEqual] | |
| 258 | - ); | |
| 259 | - var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]); | |
| 260 | - useEffect17( | |
| 261 | - function() { | |
| 262 | - inst.hasValue = true; | |
| 263 | - inst.value = value; | |
| 264 | - }, | |
| 265 | - [value] | |
| 266 | - ); | |
| 267 | - useDebugValue2(value); | |
| 268 | - return value; | |
| 269 | - }; | |
| 270 | - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); | |
| 271 | - })(); | |
| 272 | - } | |
| 273 | - }); | |
| 274 | - | |
| 275 | - // node_modules/use-sync-external-store/shim/with-selector.js | |
| 276 | - var require_with_selector = __commonJS({ | |
| 277 | - "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { | |
| 278 | - "use strict"; | |
| 279 | - if (false) { | |
| 280 | - module.exports = null; | |
| 281 | - } else { | |
| 282 | - module.exports = require_with_selector_development(); | |
| 283 | - } | |
| 284 | - } | |
| 285 | - }); | |
| 286 | - | |
| 287 | - // package-external:@wordpress/primitives | |
| 288 | - var require_primitives = __commonJS({ | |
| 289 | - "package-external:@wordpress/primitives"(exports, module) { | |
| 290 | - module.exports = window.wp.primitives; | |
| 291 | - } | |
| 292 | - }); | |
| 293 | - | |
| 294 | - // package-external:@wordpress/compose | |
| 295 | - var require_compose = __commonJS({ | |
| 296 | - "package-external:@wordpress/compose"(exports, module) { | |
| 297 | - module.exports = window.wp.compose; | |
| 298 | - } | |
| 299 | - }); | |
| 300 | - | |
| 301 | - // package-external:@wordpress/theme | |
| 302 | - var require_theme = __commonJS({ | |
| 303 | - "package-external:@wordpress/theme"(exports, module) { | |
| 304 | - module.exports = window.wp.theme; | |
| 305 | - } | |
| 306 | - }); | |
| 307 | - | |
| 308 | - // package-external:@wordpress/private-apis | |
| 309 | - var require_private_apis = __commonJS({ | |
| 310 | - "package-external:@wordpress/private-apis"(exports, module) { | |
| 311 | - module.exports = window.wp.privateApis; | |
| 312 | - } | |
| 313 | - }); | |
| 314 | - | |
| 315 | - // package-external:@wordpress/components | |
| 316 | - var require_components = __commonJS({ | |
| 317 | - "package-external:@wordpress/components"(exports, module) { | |
| 318 | - module.exports = window.wp.components; | |
| 319 | - } | |
| 320 | - }); | |
| 321 | - | |
| 322 | 111 | // package-external:@wordpress/block-editor |
| 323 | 112 | var require_block_editor = __commonJS({ |
| 324 | 113 | "package-external:@wordpress/block-editor"(exports, module) { |
| 325 | 114 | module.exports = window.wp.blockEditor; |
| @@ -339,8 +128,15 @@ | ||
| 339 | 128 | module.exports = window.wp.plugins; |
| 340 | 129 | } |
| 341 | 130 | }); |
| 342 | 131 | |
| 132 | + // package-external:@wordpress/primitives | |
| 133 | + var require_primitives = __commonJS({ | |
| 134 | + "package-external:@wordpress/primitives"(exports, module) { | |
| 135 | + module.exports = window.wp.primitives; | |
| 136 | + } | |
| 137 | + }); | |
| 138 | + | |
| 343 | 139 | // package-external:@wordpress/notices |
| 344 | 140 | var require_notices = __commonJS({ |
| 345 | 141 | "package-external:@wordpress/notices"(exports, module) { |
| 346 | 142 | module.exports = window.wp.notices; |
| @@ -367,8 +163,29 @@ | ||
| 367 | 163 | module.exports = window.wp.htmlEntities; |
| 368 | 164 | } |
| 369 | 165 | }); |
| 370 | 166 | |
| 167 | + // package-external:@wordpress/core-data | |
| 168 | + var require_core_data = __commonJS({ | |
| 169 | + "package-external:@wordpress/core-data"(exports, module) { | |
| 170 | + module.exports = window.wp.coreData; | |
| 171 | + } | |
| 172 | + }); | |
| 173 | + | |
| 174 | + // package-external:@wordpress/compose | |
| 175 | + var require_compose = __commonJS({ | |
| 176 | + "package-external:@wordpress/compose"(exports, module) { | |
| 177 | + module.exports = window.wp.compose; | |
| 178 | + } | |
| 179 | + }); | |
| 180 | + | |
| 181 | + // package-external:@wordpress/private-apis | |
| 182 | + var require_private_apis = __commonJS({ | |
| 183 | + "package-external:@wordpress/private-apis"(exports, module) { | |
| 184 | + module.exports = window.wp.privateApis; | |
| 185 | + } | |
| 186 | + }); | |
| 187 | + | |
| 371 | 188 | // package-external:@wordpress/keyboard-shortcuts |
| 372 | 189 | var require_keyboard_shortcuts = __commonJS({ |
| 373 | 190 | "package-external:@wordpress/keyboard-shortcuts"(exports, module) { |
| 374 | 191 | module.exports = window.wp.keyboardShortcuts; |
| @@ -374,8 +191,15 @@ | ||
| 374 | 191 | module.exports = window.wp.keyboardShortcuts; |
| 375 | 192 | } |
| 376 | 193 | }); |
| 377 | 194 | |
| 195 | + // package-external:@wordpress/api-fetch | |
| 196 | + var require_api_fetch = __commonJS({ | |
| 197 | + "package-external:@wordpress/api-fetch"(exports, module) { | |
| 198 | + module.exports = window.wp.apiFetch; | |
| 199 | + } | |
| 200 | + }); | |
| 201 | + | |
| 378 | 202 | // package-external:@wordpress/hooks |
| 379 | 203 | var require_hooks = __commonJS({ |
| 380 | 204 | "package-external:@wordpress/hooks"(exports, module) { |
| 381 | 205 | module.exports = window.wp.hooks; |
| @@ -406,18 +230,16 @@ | ||
| 406 | 230 | initializeEditor: () => initializeEditor, |
| 407 | 231 | reinitializeEditor: () => reinitializeEditor, |
| 408 | 232 | store: () => store |
| 409 | 233 | }); |
| 410 | - var import_blocks2 = __toESM(require_blocks(), 1); | |
| 234 | + var import_blocks3 = __toESM(require_blocks(), 1); | |
| 411 | 235 | var import_block_library2 = __toESM(require_block_library(), 1); |
| 412 | 236 | var import_deprecated4 = __toESM(require_deprecated(), 1); |
| 413 | - var import_element29 = __toESM(require_element(), 1); | |
| 414 | - var import_data25 = __toESM(require_data(), 1); | |
| 237 | + var import_element13 = __toESM(require_element(), 1); | |
| 238 | + var import_data26 = __toESM(require_data(), 1); | |
| 415 | 239 | var import_preferences11 = __toESM(require_preferences(), 1); |
| 416 | 240 | var import_widgets = __toESM(require_widgets(), 1); |
| 417 | - var import_editor19 = __toESM(require_editor(), 1); | |
| 418 | - var import_core_data9 = __toESM(require_core_data(), 1); | |
| 419 | - var import_api_fetch2 = __toESM(require_api_fetch(), 1); | |
| 241 | + var import_editor20 = __toESM(require_editor(), 1); | |
| 420 | 242 | |
| 421 | 243 | // node_modules/clsx/dist/clsx.mjs |
| 422 | 244 | function r(e) { |
| 423 | 245 | var t, f, n = ""; |
| @@ -433,8776 +255,14 @@ | ||
| 433 | 255 | return n; |
| 434 | 256 | } |
| 435 | 257 | var clsx_default = clsx; |
| 436 | 258 | |
| 437 | - // node_modules/@base-ui/utils/safeReact.mjs | |
| 438 | - var React = __toESM(require_react(), 1); | |
| 439 | - var SafeReact = { | |
| 440 | - ...React | |
| 441 | - }; | |
| 442 | - | |
| 443 | - // node_modules/@base-ui/utils/useRefWithInit.mjs | |
| 444 | - var React2 = __toESM(require_react(), 1); | |
| 445 | - var UNINITIALIZED = {}; | |
| 446 | - function useRefWithInit(init, initArg) { | |
| 447 | - const ref = React2.useRef(UNINITIALIZED); | |
| 448 | - if (ref.current === UNINITIALIZED) { | |
| 449 | - ref.current = init(initArg); | |
| 450 | - } | |
| 451 | - return ref; | |
| 452 | - } | |
| 453 | - | |
| 454 | - // node_modules/@base-ui/utils/useStableCallback.mjs | |
| 455 | - var useInsertionEffect = SafeReact.useInsertionEffect; | |
| 456 | - var useSafeInsertionEffect = ( | |
| 457 | - // React 17 doesn't have useInsertionEffect. | |
| 458 | - useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. | |
| 459 | - useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() | |
| 460 | - ); | |
| 461 | - function useStableCallback(callback) { | |
| 462 | - const stable = useRefWithInit(createStableCallback).current; | |
| 463 | - stable.next = callback; | |
| 464 | - useSafeInsertionEffect(stable.effect); | |
| 465 | - return stable.trampoline; | |
| 466 | - } | |
| 467 | - function createStableCallback() { | |
| 468 | - const stable = { | |
| 469 | - next: void 0, | |
| 470 | - callback: assertNotCalled, | |
| 471 | - trampoline: (...args) => stable.callback?.(...args), | |
| 472 | - effect: () => { | |
| 473 | - stable.callback = stable.next; | |
| 474 | - } | |
| 475 | - }; | |
| 476 | - return stable; | |
| 477 | - } | |
| 478 | - function assertNotCalled() { | |
| 479 | - if (true) { | |
| 480 | - throw ( | |
| 481 | - /* minify-error-disabled */ | |
| 482 | - new Error("Base UI: Cannot call an event handler while rendering.") | |
| 483 | - ); | |
| 484 | - } | |
| 485 | - } | |
| 486 | - | |
| 487 | - // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs | |
| 488 | - var React3 = __toESM(require_react(), 1); | |
| 489 | - var noop = () => { | |
| 490 | - }; | |
| 491 | - var useIsoLayoutEffect = typeof document !== "undefined" ? React3.useLayoutEffect : noop; | |
| 492 | - | |
| 493 | - // node_modules/@base-ui/utils/warn.mjs | |
| 494 | - var set; | |
| 495 | - if (true) { | |
| 496 | - set = /* @__PURE__ */ new Set(); | |
| 497 | - } | |
| 498 | - function warn(...messages) { | |
| 499 | - if (true) { | |
| 500 | - const messageKey = messages.join(" "); | |
| 501 | - if (!set.has(messageKey)) { | |
| 502 | - set.add(messageKey); | |
| 503 | - console.warn(`Base UI: ${messageKey}`); | |
| 504 | - } | |
| 505 | - } | |
| 506 | - } | |
| 507 | - | |
| 508 | - // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs | |
| 509 | - var React4 = __toESM(require_react(), 1); | |
| 510 | - var DirectionContext = /* @__PURE__ */ React4.createContext(void 0); | |
| 511 | - if (true) DirectionContext.displayName = "DirectionContext"; | |
| 512 | - function useDirection() { | |
| 513 | - const context = React4.useContext(DirectionContext); | |
| 514 | - return context?.direction ?? "ltr"; | |
| 515 | - } | |
| 516 | - | |
| 517 | - // node_modules/@base-ui/react/internals/useRenderElement.mjs | |
| 518 | - var React7 = __toESM(require_react(), 1); | |
| 519 | - | |
| 520 | - // node_modules/@base-ui/utils/useMergedRefs.mjs | |
| 521 | - function useMergedRefs(a, b, c, d) { | |
| 522 | - const forkRef = useRefWithInit(createForkRef).current; | |
| 523 | - if (didChange(forkRef, a, b, c, d)) { | |
| 524 | - update(forkRef, [a, b, c, d]); | |
| 525 | - } | |
| 526 | - return forkRef.callback; | |
| 527 | - } | |
| 528 | - function useMergedRefsN(refs) { | |
| 529 | - const forkRef = useRefWithInit(createForkRef).current; | |
| 530 | - if (didChangeN(forkRef, refs)) { | |
| 531 | - update(forkRef, refs); | |
| 532 | - } | |
| 533 | - return forkRef.callback; | |
| 534 | - } | |
| 535 | - function createForkRef() { | |
| 536 | - return { | |
| 537 | - callback: null, | |
| 538 | - cleanup: null, | |
| 539 | - refs: [] | |
| 540 | - }; | |
| 541 | - } | |
| 542 | - function didChange(forkRef, a, b, c, d) { | |
| 543 | - return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; | |
| 544 | - } | |
| 545 | - function didChangeN(forkRef, newRefs) { | |
| 546 | - return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); | |
| 547 | - } | |
| 548 | - function update(forkRef, refs) { | |
| 549 | - forkRef.refs = refs; | |
| 550 | - if (refs.every((ref) => ref == null)) { | |
| 551 | - forkRef.callback = null; | |
| 552 | - return; | |
| 553 | - } | |
| 554 | - forkRef.callback = (instance) => { | |
| 555 | - if (forkRef.cleanup) { | |
| 556 | - forkRef.cleanup(); | |
| 557 | - forkRef.cleanup = null; | |
| 558 | - } | |
| 559 | - if (instance != null) { | |
| 560 | - const cleanupCallbacks = Array(refs.length).fill(null); | |
| 561 | - for (let i = 0; i < refs.length; i += 1) { | |
| 562 | - const ref = refs[i]; | |
| 563 | - if (ref == null) { | |
| 564 | - continue; | |
| 565 | - } | |
| 566 | - switch (typeof ref) { | |
| 567 | - case "function": { | |
| 568 | - const refCleanup = ref(instance); | |
| 569 | - if (typeof refCleanup === "function") { | |
| 570 | - cleanupCallbacks[i] = refCleanup; | |
| 571 | - } | |
| 572 | - break; | |
| 573 | - } | |
| 574 | - case "object": { | |
| 575 | - ref.current = instance; | |
| 576 | - break; | |
| 577 | - } | |
| 578 | - default: | |
| 579 | - } | |
| 580 | - } | |
| 581 | - forkRef.cleanup = () => { | |
| 582 | - for (let i = 0; i < refs.length; i += 1) { | |
| 583 | - const ref = refs[i]; | |
| 584 | - if (ref == null) { | |
| 585 | - continue; | |
| 586 | - } | |
| 587 | - switch (typeof ref) { | |
| 588 | - case "function": { | |
| 589 | - const cleanupCallback = cleanupCallbacks[i]; | |
| 590 | - if (typeof cleanupCallback === "function") { | |
| 591 | - cleanupCallback(); | |
| 592 | - } else { | |
| 593 | - ref(null); | |
| 594 | - } | |
| 595 | - break; | |
| 596 | - } | |
| 597 | - case "object": { | |
| 598 | - ref.current = null; | |
| 599 | - break; | |
| 600 | - } | |
| 601 | - default: | |
| 602 | - } | |
| 603 | - } | |
| 604 | - }; | |
| 605 | - } | |
| 606 | - }; | |
| 607 | - } | |
| 608 | - | |
| 609 | - // node_modules/@base-ui/utils/getReactElementRef.mjs | |
| 610 | - var React6 = __toESM(require_react(), 1); | |
| 611 | - | |
| 612 | - // node_modules/@base-ui/utils/reactVersion.mjs | |
| 613 | - var React5 = __toESM(require_react(), 1); | |
| 614 | - var majorVersion = parseInt(React5.version, 10); | |
| 615 | - function isReactVersionAtLeast(reactVersionToCheck) { | |
| 616 | - return majorVersion >= reactVersionToCheck; | |
| 617 | - } | |
| 618 | - | |
| 619 | - // node_modules/@base-ui/utils/getReactElementRef.mjs | |
| 620 | - function getReactElementRef(element) { | |
| 621 | - if (!/* @__PURE__ */ React6.isValidElement(element)) { | |
| 622 | - return null; | |
| 623 | - } | |
| 624 | - const reactElement = element; | |
| 625 | - const propsWithRef = reactElement.props; | |
| 626 | - return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; | |
| 627 | - } | |
| 628 | - | |
| 629 | - // node_modules/@base-ui/utils/mergeObjects.mjs | |
| 630 | - function mergeObjects(a, b) { | |
| 631 | - if (a && !b) { | |
| 632 | - return a; | |
| 633 | - } | |
| 634 | - if (!a && b) { | |
| 635 | - return b; | |
| 636 | - } | |
| 637 | - if (a || b) { | |
| 638 | - return { | |
| 639 | - ...a, | |
| 640 | - ...b | |
| 641 | - }; | |
| 642 | - } | |
| 643 | - return void 0; | |
| 644 | - } | |
| 645 | - | |
| 646 | - // node_modules/@base-ui/utils/empty.mjs | |
| 647 | - function NOOP() { | |
| 648 | - } | |
| 649 | - var EMPTY_ARRAY = Object.freeze([]); | |
| 650 | - var EMPTY_OBJECT = Object.freeze({}); | |
| 651 | - | |
| 652 | - // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs | |
| 653 | - function getStateAttributesProps(state, customMapping) { | |
| 654 | - const props = {}; | |
| 655 | - for (const key in state) { | |
| 656 | - const value = state[key]; | |
| 657 | - if (customMapping?.hasOwnProperty(key)) { | |
| 658 | - const customProps = customMapping[key](value); | |
| 659 | - if (customProps != null) { | |
| 660 | - Object.assign(props, customProps); | |
| 661 | - } | |
| 662 | - continue; | |
| 663 | - } | |
| 664 | - if (value === true) { | |
| 665 | - props[`data-${key.toLowerCase()}`] = ""; | |
| 666 | - } else if (value) { | |
| 667 | - props[`data-${key.toLowerCase()}`] = value.toString(); | |
| 668 | - } | |
| 669 | - } | |
| 670 | - return props; | |
| 671 | - } | |
| 672 | - | |
| 673 | - // node_modules/@base-ui/react/utils/resolveClassName.mjs | |
| 674 | - function resolveClassName(className, state) { | |
| 675 | - return typeof className === "function" ? className(state) : className; | |
| 676 | - } | |
| 677 | - | |
| 678 | - // node_modules/@base-ui/react/utils/resolveStyle.mjs | |
| 679 | - function resolveStyle(style, state) { | |
| 680 | - return typeof style === "function" ? style(state) : style; | |
| 681 | - } | |
| 682 | - | |
| 683 | - // node_modules/@base-ui/react/merge-props/mergeProps.mjs | |
| 684 | - var EMPTY_PROPS = {}; | |
| 685 | - function mergeProps(a, b, c, d, e) { | |
| 686 | - if (!c && !d && !e && !a) { | |
| 687 | - return createInitialMergedProps(b); | |
| 688 | - } | |
| 689 | - let merged = createInitialMergedProps(a); | |
| 690 | - if (b) { | |
| 691 | - merged = mergeInto(merged, b); | |
| 692 | - } | |
| 693 | - if (c) { | |
| 694 | - merged = mergeInto(merged, c); | |
| 695 | - } | |
| 696 | - if (d) { | |
| 697 | - merged = mergeInto(merged, d); | |
| 698 | - } | |
| 699 | - if (e) { | |
| 700 | - merged = mergeInto(merged, e); | |
| 701 | - } | |
| 702 | - return merged; | |
| 703 | - } | |
| 704 | - function mergePropsN(props) { | |
| 705 | - if (props.length === 0) { | |
| 706 | - return EMPTY_PROPS; | |
| 707 | - } | |
| 708 | - if (props.length === 1) { | |
| 709 | - return createInitialMergedProps(props[0]); | |
| 710 | - } | |
| 711 | - let merged = createInitialMergedProps(props[0]); | |
| 712 | - for (let i = 1; i < props.length; i += 1) { | |
| 713 | - merged = mergeInto(merged, props[i]); | |
| 714 | - } | |
| 715 | - return merged; | |
| 716 | - } | |
| 717 | - function createInitialMergedProps(inputProps) { | |
| 718 | - if (isPropsGetter(inputProps)) { | |
| 719 | - return { | |
| 720 | - ...resolvePropsGetter(inputProps, EMPTY_PROPS) | |
| 721 | - }; | |
| 722 | - } | |
| 723 | - return copyInitialProps(inputProps); | |
| 724 | - } | |
| 725 | - function mergeInto(merged, inputProps) { | |
| 726 | - if (isPropsGetter(inputProps)) { | |
| 727 | - return resolvePropsGetter(inputProps, merged); | |
| 728 | - } | |
| 729 | - return mutablyMergeInto(merged, inputProps); | |
| 730 | - } | |
| 731 | - function copyInitialProps(inputProps) { | |
| 732 | - const copiedProps = { | |
| 733 | - ...inputProps | |
| 734 | - }; | |
| 735 | - for (const propName in copiedProps) { | |
| 736 | - const propValue = copiedProps[propName]; | |
| 737 | - if (isEventHandler(propName, propValue)) { | |
| 738 | - copiedProps[propName] = wrapEventHandler(propValue); | |
| 739 | - } | |
| 740 | - } | |
| 741 | - return copiedProps; | |
| 742 | - } | |
| 743 | - function mutablyMergeInto(mergedProps, externalProps) { | |
| 744 | - if (!externalProps) { | |
| 745 | - return mergedProps; | |
| 746 | - } | |
| 747 | - for (const propName in externalProps) { | |
| 748 | - const externalPropValue = externalProps[propName]; | |
| 749 | - switch (propName) { | |
| 750 | - case "style": { | |
| 751 | - mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); | |
| 752 | - break; | |
| 753 | - } | |
| 754 | - case "className": { | |
| 755 | - mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); | |
| 756 | - break; | |
| 757 | - } | |
| 758 | - default: { | |
| 759 | - if (isEventHandler(propName, externalPropValue)) { | |
| 760 | - mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); | |
| 761 | - } else { | |
| 762 | - mergedProps[propName] = externalPropValue; | |
| 763 | - } | |
| 764 | - } | |
| 765 | - } | |
| 766 | - } | |
| 767 | - return mergedProps; | |
| 768 | - } | |
| 769 | - function isEventHandler(key, value) { | |
| 770 | - const code0 = key.charCodeAt(0); | |
| 771 | - const code1 = key.charCodeAt(1); | |
| 772 | - const code2 = key.charCodeAt(2); | |
| 773 | - return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); | |
| 774 | - } | |
| 775 | - function isPropsGetter(inputProps) { | |
| 776 | - return typeof inputProps === "function"; | |
| 777 | - } | |
| 778 | - function resolvePropsGetter(inputProps, previousProps) { | |
| 779 | - if (isPropsGetter(inputProps)) { | |
| 780 | - return inputProps(previousProps); | |
| 781 | - } | |
| 782 | - return inputProps ?? EMPTY_PROPS; | |
| 783 | - } | |
| 784 | - function mergeEventHandlers(ourHandler, theirHandler) { | |
| 785 | - if (!theirHandler) { | |
| 786 | - return ourHandler; | |
| 787 | - } | |
| 788 | - if (!ourHandler) { | |
| 789 | - return wrapEventHandler(theirHandler); | |
| 790 | - } | |
| 791 | - return (...args) => { | |
| 792 | - const event = args[0]; | |
| 793 | - if (isSyntheticEvent(event)) { | |
| 794 | - const baseUIEvent = event; | |
| 795 | - makeEventPreventable(baseUIEvent); | |
| 796 | - const result2 = theirHandler(...args); | |
| 797 | - if (!baseUIEvent.baseUIHandlerPrevented) { | |
| 798 | - ourHandler?.(...args); | |
| 799 | - } | |
| 800 | - return result2; | |
| 801 | - } | |
| 802 | - const result = theirHandler(...args); | |
| 803 | - ourHandler?.(...args); | |
| 804 | - return result; | |
| 805 | - }; | |
| 806 | - } | |
| 807 | - function wrapEventHandler(handler) { | |
| 808 | - if (!handler) { | |
| 809 | - return handler; | |
| 810 | - } | |
| 811 | - return (...args) => { | |
| 812 | - const event = args[0]; | |
| 813 | - if (isSyntheticEvent(event)) { | |
| 814 | - makeEventPreventable(event); | |
| 815 | - } | |
| 816 | - return handler(...args); | |
| 817 | - }; | |
| 818 | - } | |
| 819 | - function makeEventPreventable(event) { | |
| 820 | - event.preventBaseUIHandler = () => { | |
| 821 | - event.baseUIHandlerPrevented = true; | |
| 822 | - }; | |
| 823 | - return event; | |
| 824 | - } | |
| 825 | - function mergeClassNames(ourClassName, theirClassName) { | |
| 826 | - if (theirClassName) { | |
| 827 | - if (ourClassName) { | |
| 828 | - return theirClassName + " " + ourClassName; | |
| 829 | - } | |
| 830 | - return theirClassName; | |
| 831 | - } | |
| 832 | - return ourClassName; | |
| 833 | - } | |
| 834 | - function isSyntheticEvent(event) { | |
| 835 | - return event != null && typeof event === "object" && "nativeEvent" in event; | |
| 836 | - } | |
| 837 | - | |
| 838 | - // node_modules/@base-ui/react/internals/useRenderElement.mjs | |
| 839 | - var import_react = __toESM(require_react(), 1); | |
| 840 | - function useRenderElement(element, componentProps, params = {}) { | |
| 841 | - const renderProp = componentProps.render; | |
| 842 | - const outProps = useRenderElementProps(componentProps, params); | |
| 843 | - if (params.enabled === false) { | |
| 844 | - return null; | |
| 845 | - } | |
| 846 | - const state = params.state ?? EMPTY_OBJECT; | |
| 847 | - return evaluateRenderProp(element, renderProp, outProps, state); | |
| 848 | - } | |
| 849 | - function useRenderElementProps(componentProps, params = {}) { | |
| 850 | - const { | |
| 851 | - className: classNameProp, | |
| 852 | - style: styleProp, | |
| 853 | - render: renderProp | |
| 854 | - } = componentProps; | |
| 855 | - const { | |
| 856 | - state = EMPTY_OBJECT, | |
| 857 | - ref, | |
| 858 | - props, | |
| 859 | - stateAttributesMapping: stateAttributesMapping3, | |
| 860 | - enabled = true | |
| 861 | - } = params; | |
| 862 | - const className = enabled ? resolveClassName(classNameProp, state) : void 0; | |
| 863 | - const style = enabled ? resolveStyle(styleProp, state) : void 0; | |
| 864 | - const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT; | |
| 865 | - const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; | |
| 866 | - const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; | |
| 867 | - if (typeof document !== "undefined") { | |
| 868 | - if (!enabled) { | |
| 869 | - useMergedRefs(null, null); | |
| 870 | - } else if (Array.isArray(ref)) { | |
| 871 | - outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); | |
| 872 | - } else { | |
| 873 | - outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); | |
| 874 | - } | |
| 875 | - } | |
| 876 | - if (!enabled) { | |
| 877 | - return EMPTY_OBJECT; | |
| 878 | - } | |
| 879 | - if (className !== void 0) { | |
| 880 | - outProps.className = mergeClassNames(outProps.className, className); | |
| 881 | - } | |
| 882 | - if (style !== void 0) { | |
| 883 | - outProps.style = mergeObjects(outProps.style, style); | |
| 884 | - } | |
| 885 | - return outProps; | |
| 886 | - } | |
| 887 | - function resolveRenderFunctionProps(props) { | |
| 888 | - if (Array.isArray(props)) { | |
| 889 | - return mergePropsN(props); | |
| 890 | - } | |
| 891 | - return mergeProps(void 0, props); | |
| 892 | - } | |
| 893 | - var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); | |
| 894 | - var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; | |
| 895 | - var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; | |
| 896 | - function evaluateRenderProp(element, render, props, state) { | |
| 897 | - if (render) { | |
| 898 | - if (typeof render === "function") { | |
| 899 | - if (true) { | |
| 900 | - warnIfRenderPropLooksLikeComponent(render); | |
| 901 | - } | |
| 902 | - return render(props, state); | |
| 903 | - } | |
| 904 | - const mergedProps = mergeProps(props, render.props); | |
| 905 | - mergedProps.ref = props.ref; | |
| 906 | - let newElement = render; | |
| 907 | - if (newElement?.$$typeof === REACT_LAZY_TYPE) { | |
| 908 | - const children = React7.Children.toArray(render); | |
| 909 | - newElement = children[0]; | |
| 910 | - } | |
| 911 | - if (true) { | |
| 912 | - if (!/* @__PURE__ */ React7.isValidElement(newElement)) { | |
| 913 | - throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n")); | |
| 914 | - } | |
| 915 | - } | |
| 916 | - return /* @__PURE__ */ React7.cloneElement(newElement, mergedProps); | |
| 917 | - } | |
| 918 | - if (element) { | |
| 919 | - if (typeof element === "string") { | |
| 920 | - return renderTag(element, props); | |
| 921 | - } | |
| 922 | - } | |
| 923 | - throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); | |
| 924 | - } | |
| 925 | - function warnIfRenderPropLooksLikeComponent(renderFn) { | |
| 926 | - const functionName = renderFn.name; | |
| 927 | - if (functionName.length === 0) { | |
| 928 | - return; | |
| 929 | - } | |
| 930 | - if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { | |
| 931 | - return; | |
| 932 | - } | |
| 933 | - if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { | |
| 934 | - return; | |
| 935 | - } | |
| 936 | - warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop"); | |
| 937 | - } | |
| 938 | - function renderTag(Tag, props) { | |
| 939 | - if (Tag === "button") { | |
| 940 | - return /* @__PURE__ */ (0, import_react.createElement)("button", { | |
| 941 | - type: "button", | |
| 942 | - ...props, | |
| 943 | - key: props.key | |
| 944 | - }); | |
| 945 | - } | |
| 946 | - if (Tag === "img") { | |
| 947 | - return /* @__PURE__ */ (0, import_react.createElement)("img", { | |
| 948 | - alt: "", | |
| 949 | - ...props, | |
| 950 | - key: props.key | |
| 951 | - }); | |
| 952 | - } | |
| 953 | - return /* @__PURE__ */ React7.createElement(Tag, props); | |
| 954 | - } | |
| 955 | - | |
| 956 | - // node_modules/@base-ui/utils/useId.mjs | |
| 957 | - var React8 = __toESM(require_react(), 1); | |
| 958 | - var globalId = 0; | |
| 959 | - function useGlobalId(idOverride, prefix = "mui") { | |
| 960 | - const [defaultId, setDefaultId] = React8.useState(idOverride); | |
| 961 | - const id = idOverride || defaultId; | |
| 962 | - React8.useEffect(() => { | |
| 963 | - if (defaultId == null) { | |
| 964 | - globalId += 1; | |
| 965 | - setDefaultId(`${prefix}-${globalId}`); | |
| 966 | - } | |
| 967 | - }, [defaultId, prefix]); | |
| 968 | - return id; | |
| 969 | - } | |
| 970 | - var maybeReactUseId = SafeReact.useId; | |
| 971 | - function useId(idOverride, prefix) { | |
| 972 | - if (maybeReactUseId !== void 0) { | |
| 973 | - const reactId = maybeReactUseId(); | |
| 974 | - return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId); | |
| 975 | - } | |
| 976 | - return useGlobalId(idOverride, prefix); | |
| 977 | - } | |
| 978 | - | |
| 979 | - // node_modules/@base-ui/react/internals/useBaseUiId.mjs | |
| 980 | - function useBaseUiId(idOverride) { | |
| 981 | - return useId(idOverride, "base-ui"); | |
| 982 | - } | |
| 983 | - | |
| 984 | - // node_modules/@base-ui/react/internals/reason-parts.mjs | |
| 985 | - var reason_parts_exports = {}; | |
| 986 | - __export(reason_parts_exports, { | |
| 987 | - cancelOpen: () => cancelOpen, | |
| 988 | - chipRemovePress: () => chipRemovePress, | |
| 989 | - clearPress: () => clearPress, | |
| 990 | - closePress: () => closePress, | |
| 991 | - closeWatcher: () => closeWatcher, | |
| 992 | - decrementPress: () => decrementPress, | |
| 993 | - disabled: () => disabled, | |
| 994 | - drag: () => drag, | |
| 995 | - escapeKey: () => escapeKey, | |
| 996 | - focusOut: () => focusOut, | |
| 997 | - imperativeAction: () => imperativeAction, | |
| 998 | - incrementPress: () => incrementPress, | |
| 999 | - initial: () => initial, | |
| 1000 | - inputBlur: () => inputBlur, | |
| 1001 | - inputChange: () => inputChange, | |
| 1002 | - inputClear: () => inputClear, | |
| 1003 | - inputPaste: () => inputPaste, | |
| 1004 | - inputPress: () => inputPress, | |
| 1005 | - itemPress: () => itemPress, | |
| 1006 | - keyboard: () => keyboard, | |
| 1007 | - linkPress: () => linkPress, | |
| 1008 | - listNavigation: () => listNavigation, | |
| 1009 | - missing: () => missing, | |
| 1010 | - none: () => none, | |
| 1011 | - outsidePress: () => outsidePress, | |
| 1012 | - pointer: () => pointer, | |
| 1013 | - scrub: () => scrub, | |
| 1014 | - siblingOpen: () => siblingOpen, | |
| 1015 | - swipe: () => swipe, | |
| 1016 | - trackPress: () => trackPress, | |
| 1017 | - triggerFocus: () => triggerFocus, | |
| 1018 | - triggerHover: () => triggerHover, | |
| 1019 | - triggerPress: () => triggerPress, | |
| 1020 | - wheel: () => wheel, | |
| 1021 | - windowResize: () => windowResize | |
| 1022 | - }); | |
| 1023 | - var none = "none"; | |
| 1024 | - var triggerPress = "trigger-press"; | |
| 1025 | - var triggerHover = "trigger-hover"; | |
| 1026 | - var triggerFocus = "trigger-focus"; | |
| 1027 | - var outsidePress = "outside-press"; | |
| 1028 | - var itemPress = "item-press"; | |
| 1029 | - var closePress = "close-press"; | |
| 1030 | - var linkPress = "link-press"; | |
| 1031 | - var clearPress = "clear-press"; | |
| 1032 | - var chipRemovePress = "chip-remove-press"; | |
| 1033 | - var trackPress = "track-press"; | |
| 1034 | - var incrementPress = "increment-press"; | |
| 1035 | - var decrementPress = "decrement-press"; | |
| 1036 | - var inputChange = "input-change"; | |
| 1037 | - var inputClear = "input-clear"; | |
| 1038 | - var inputBlur = "input-blur"; | |
| 1039 | - var inputPaste = "input-paste"; | |
| 1040 | - var inputPress = "input-press"; | |
| 1041 | - var focusOut = "focus-out"; | |
| 1042 | - var escapeKey = "escape-key"; | |
| 1043 | - var closeWatcher = "close-watcher"; | |
| 1044 | - var listNavigation = "list-navigation"; | |
| 1045 | - var keyboard = "keyboard"; | |
| 1046 | - var pointer = "pointer"; | |
| 1047 | - var drag = "drag"; | |
| 1048 | - var wheel = "wheel"; | |
| 1049 | - var scrub = "scrub"; | |
| 1050 | - var cancelOpen = "cancel-open"; | |
| 1051 | - var siblingOpen = "sibling-open"; | |
| 1052 | - var disabled = "disabled"; | |
| 1053 | - var missing = "missing"; | |
| 1054 | - var initial = "initial"; | |
| 1055 | - var imperativeAction = "imperative-action"; | |
| 1056 | - var swipe = "swipe"; | |
| 1057 | - var windowResize = "window-resize"; | |
| 1058 | - | |
| 1059 | - // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs | |
| 1060 | - function createChangeEventDetails(reason, event, trigger, customProperties) { | |
| 1061 | - let canceled = false; | |
| 1062 | - let allowPropagation = false; | |
| 1063 | - const custom = customProperties ?? EMPTY_OBJECT; | |
| 1064 | - const details = { | |
| 1065 | - reason, | |
| 1066 | - event: event ?? new Event("base-ui"), | |
| 1067 | - cancel() { | |
| 1068 | - canceled = true; | |
| 1069 | - }, | |
| 1070 | - allowPropagation() { | |
| 1071 | - allowPropagation = true; | |
| 1072 | - }, | |
| 1073 | - get isCanceled() { | |
| 1074 | - return canceled; | |
| 1075 | - }, | |
| 1076 | - get isPropagationAllowed() { | |
| 1077 | - return allowPropagation; | |
| 1078 | - }, | |
| 1079 | - trigger, | |
| 1080 | - ...custom | |
| 1081 | - }; | |
| 1082 | - return details; | |
| 1083 | - } | |
| 1084 | - | |
| 1085 | - // node_modules/@base-ui/react/internals/useTransitionStatus.mjs | |
| 1086 | - var React10 = __toESM(require_react(), 1); | |
| 1087 | - | |
| 1088 | - // node_modules/@base-ui/utils/useOnMount.mjs | |
| 1089 | - var React9 = __toESM(require_react(), 1); | |
| 1090 | - var EMPTY = []; | |
| 1091 | - function useOnMount(fn) { | |
| 1092 | - React9.useEffect(fn, EMPTY); | |
| 1093 | - } | |
| 1094 | - | |
| 1095 | - // node_modules/@base-ui/utils/useAnimationFrame.mjs | |
| 1096 | - var EMPTY2 = null; | |
| 1097 | - var LAST_RAF = globalThis.requestAnimationFrame; | |
| 1098 | - var Scheduler = class { | |
| 1099 | - /* This implementation uses an array as a backing data-structure for frame callbacks. | |
| 1100 | - * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it | |
| 1101 | - * never calls the native `cancelAnimationFrame` if there are no frames left. This can | |
| 1102 | - * be much more efficient if there is a call pattern that alterns as | |
| 1103 | - * "request-cancel-request-cancel-…". | |
| 1104 | - * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation | |
| 1105 | - * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ | |
| 1106 | - callbacks = []; | |
| 1107 | - callbacksCount = 0; | |
| 1108 | - nextId = 1; | |
| 1109 | - startId = 1; | |
| 1110 | - isScheduled = false; | |
| 1111 | - tick = (timestamp) => { | |
| 1112 | - this.isScheduled = false; | |
| 1113 | - const currentCallbacks = this.callbacks; | |
| 1114 | - const currentCallbacksCount = this.callbacksCount; | |
| 1115 | - this.callbacks = []; | |
| 1116 | - this.callbacksCount = 0; | |
| 1117 | - this.startId = this.nextId; | |
| 1118 | - if (currentCallbacksCount > 0) { | |
| 1119 | - for (let i = 0; i < currentCallbacks.length; i += 1) { | |
| 1120 | - currentCallbacks[i]?.(timestamp); | |
| 1121 | - } | |
| 1122 | - } | |
| 1123 | - }; | |
| 1124 | - request(fn) { | |
| 1125 | - const id = this.nextId; | |
| 1126 | - this.nextId += 1; | |
| 1127 | - this.callbacks.push(fn); | |
| 1128 | - this.callbacksCount += 1; | |
| 1129 | - const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); | |
| 1130 | - if (!this.isScheduled || didRAFChange) { | |
| 1131 | - requestAnimationFrame(this.tick); | |
| 1132 | - this.isScheduled = true; | |
| 1133 | - } | |
| 1134 | - return id; | |
| 1135 | - } | |
| 1136 | - cancel(id) { | |
| 1137 | - const index2 = id - this.startId; | |
| 1138 | - if (index2 < 0 || index2 >= this.callbacks.length) { | |
| 1139 | - return; | |
| 1140 | - } | |
| 1141 | - this.callbacks[index2] = null; | |
| 1142 | - this.callbacksCount -= 1; | |
| 1143 | - } | |
| 1144 | - }; | |
| 1145 | - var scheduler = new Scheduler(); | |
| 1146 | - var AnimationFrame = class _AnimationFrame { | |
| 1147 | - static create() { | |
| 1148 | - return new _AnimationFrame(); | |
| 1149 | - } | |
| 1150 | - static request(fn) { | |
| 1151 | - return scheduler.request(fn); | |
| 1152 | - } | |
| 1153 | - static cancel(id) { | |
| 1154 | - return scheduler.cancel(id); | |
| 1155 | - } | |
| 1156 | - currentId = EMPTY2; | |
| 1157 | - /** | |
| 1158 | - * Executes `fn` after `delay`, clearing any previously scheduled call. | |
| 1159 | - */ | |
| 1160 | - request(fn) { | |
| 1161 | - this.cancel(); | |
| 1162 | - this.currentId = scheduler.request(() => { | |
| 1163 | - this.currentId = EMPTY2; | |
| 1164 | - fn(); | |
| 1165 | - }); | |
| 1166 | - } | |
| 1167 | - cancel = () => { | |
| 1168 | - if (this.currentId !== EMPTY2) { | |
| 1169 | - scheduler.cancel(this.currentId); | |
| 1170 | - this.currentId = EMPTY2; | |
| 1171 | - } | |
| 1172 | - }; | |
| 1173 | - disposeEffect = () => { | |
| 1174 | - return this.cancel; | |
| 1175 | - }; | |
| 1176 | - }; | |
| 1177 | - function useAnimationFrame() { | |
| 1178 | - const timeout = useRefWithInit(AnimationFrame.create).current; | |
| 1179 | - useOnMount(timeout.disposeEffect); | |
| 1180 | - return timeout; | |
| 1181 | - } | |
| 1182 | - | |
| 1183 | - // node_modules/@base-ui/react/internals/useTransitionStatus.mjs | |
| 1184 | - function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { | |
| 1185 | - const [transitionStatus, setTransitionStatus] = React10.useState(open && enableIdleState ? "idle" : void 0); | |
| 1186 | - const [mounted, setMounted] = React10.useState(open); | |
| 1187 | - if (open && !mounted) { | |
| 1188 | - setMounted(true); | |
| 1189 | - setTransitionStatus("starting"); | |
| 1190 | - } | |
| 1191 | - if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { | |
| 1192 | - setTransitionStatus("ending"); | |
| 1193 | - } | |
| 1194 | - if (!open && !mounted && transitionStatus === "ending") { | |
| 1195 | - setTransitionStatus(void 0); | |
| 1196 | - } | |
| 1197 | - useIsoLayoutEffect(() => { | |
| 1198 | - if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { | |
| 1199 | - const frame = AnimationFrame.request(() => { | |
| 1200 | - setTransitionStatus("ending"); | |
| 1201 | - }); | |
| 1202 | - return () => { | |
| 1203 | - AnimationFrame.cancel(frame); | |
| 1204 | - }; | |
| 1205 | - } | |
| 1206 | - return void 0; | |
| 1207 | - }, [open, mounted, transitionStatus, deferEndingState]); | |
| 1208 | - useIsoLayoutEffect(() => { | |
| 1209 | - if (!open || enableIdleState) { | |
| 1210 | - return void 0; | |
| 1211 | - } | |
| 1212 | - const frame = AnimationFrame.request(() => { | |
| 1213 | - setTransitionStatus(void 0); | |
| 1214 | - }); | |
| 1215 | - return () => { | |
| 1216 | - AnimationFrame.cancel(frame); | |
| 1217 | - }; | |
| 1218 | - }, [enableIdleState, open]); | |
| 1219 | - useIsoLayoutEffect(() => { | |
| 1220 | - if (!open || !enableIdleState) { | |
| 1221 | - return void 0; | |
| 1222 | - } | |
| 1223 | - if (open && mounted && transitionStatus !== "idle") { | |
| 1224 | - setTransitionStatus("starting"); | |
| 1225 | - } | |
| 1226 | - const frame = AnimationFrame.request(() => { | |
| 1227 | - setTransitionStatus("idle"); | |
| 1228 | - }); | |
| 1229 | - return () => { | |
| 1230 | - AnimationFrame.cancel(frame); | |
| 1231 | - }; | |
| 1232 | - }, [enableIdleState, open, mounted, transitionStatus]); | |
| 1233 | - return { | |
| 1234 | - mounted, | |
| 1235 | - setMounted, | |
| 1236 | - transitionStatus | |
| 1237 | - }; | |
| 1238 | - } | |
| 1239 | - | |
| 1240 | - // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs | |
| 1241 | - var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { | |
| 1242 | - TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; | |
| 1243 | - TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; | |
| 1244 | - return TransitionStatusDataAttributes2; | |
| 1245 | - })({}); | |
| 1246 | - var STARTING_HOOK = { | |
| 1247 | - [TransitionStatusDataAttributes.startingStyle]: "" | |
| 1248 | - }; | |
| 1249 | - var ENDING_HOOK = { | |
| 1250 | - [TransitionStatusDataAttributes.endingStyle]: "" | |
| 1251 | - }; | |
| 1252 | - var transitionStatusMapping = { | |
| 1253 | - transitionStatus(value) { | |
| 1254 | - if (value === "starting") { | |
| 1255 | - return STARTING_HOOK; | |
| 1256 | - } | |
| 1257 | - if (value === "ending") { | |
| 1258 | - return ENDING_HOOK; | |
| 1259 | - } | |
| 1260 | - return null; | |
| 1261 | - } | |
| 1262 | - }; | |
| 1263 | - | |
| 1264 | - // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs | |
| 1265 | - function hasWindow() { | |
| 1266 | - return typeof window !== "undefined"; | |
| 1267 | - } | |
| 1268 | - function getNodeName(node) { | |
| 1269 | - if (isNode(node)) { | |
| 1270 | - return (node.nodeName || "").toLowerCase(); | |
| 1271 | - } | |
| 1272 | - return "#document"; | |
| 1273 | - } | |
| 1274 | - function getWindow(node) { | |
| 1275 | - var _node$ownerDocument; | |
| 1276 | - return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; | |
| 1277 | - } | |
| 1278 | - function getDocumentElement(node) { | |
| 1279 | - var _ref; | |
| 1280 | - return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; | |
| 1281 | - } | |
| 1282 | - function isNode(value) { | |
| 1283 | - if (!hasWindow()) { | |
| 1284 | - return false; | |
| 1285 | - } | |
| 1286 | - return value instanceof Node || value instanceof getWindow(value).Node; | |
| 1287 | - } | |
| 1288 | - function isElement(value) { | |
| 1289 | - if (!hasWindow()) { | |
| 1290 | - return false; | |
| 1291 | - } | |
| 1292 | - return value instanceof Element || value instanceof getWindow(value).Element; | |
| 1293 | - } | |
| 1294 | - function isHTMLElement(value) { | |
| 1295 | - if (!hasWindow()) { | |
| 1296 | - return false; | |
| 1297 | - } | |
| 1298 | - return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; | |
| 1299 | - } | |
| 1300 | - function isShadowRoot(value) { | |
| 1301 | - if (!hasWindow() || typeof ShadowRoot === "undefined") { | |
| 1302 | - return false; | |
| 1303 | - } | |
| 1304 | - return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; | |
| 1305 | - } | |
| 1306 | - function isOverflowElement(element) { | |
| 1307 | - const { | |
| 1308 | - overflow, | |
| 1309 | - overflowX, | |
| 1310 | - overflowY, | |
| 1311 | - display | |
| 1312 | - } = getComputedStyle2(element); | |
| 1313 | - return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; | |
| 1314 | - } | |
| 1315 | - function isTableElement(element) { | |
| 1316 | - return /^(table|td|th)$/.test(getNodeName(element)); | |
| 1317 | - } | |
| 1318 | - function isTopLayer(element) { | |
| 1319 | - try { | |
| 1320 | - if (element.matches(":popover-open")) { | |
| 1321 | - return true; | |
| 1322 | - } | |
| 1323 | - } catch (_e) { | |
| 1324 | - } | |
| 1325 | - try { | |
| 1326 | - return element.matches(":modal"); | |
| 1327 | - } catch (_e) { | |
| 1328 | - return false; | |
| 1329 | - } | |
| 1330 | - } | |
| 1331 | - var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; | |
| 1332 | - var containRe = /paint|layout|strict|content/; | |
| 1333 | - var isNotNone = (value) => !!value && value !== "none"; | |
| 1334 | - var isWebKitValue; | |
| 1335 | - function isContainingBlock(elementOrCss) { | |
| 1336 | - const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; | |
| 1337 | - return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || ""); | |
| 1338 | - } | |
| 1339 | - function getContainingBlock(element) { | |
| 1340 | - let currentNode = getParentNode(element); | |
| 1341 | - while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | |
| 1342 | - if (isContainingBlock(currentNode)) { | |
| 1343 | - return currentNode; | |
| 1344 | - } else if (isTopLayer(currentNode)) { | |
| 1345 | - return null; | |
| 1346 | - } | |
| 1347 | - currentNode = getParentNode(currentNode); | |
| 1348 | - } | |
| 1349 | - return null; | |
| 1350 | - } | |
| 1351 | - function isWebKit() { | |
| 1352 | - if (isWebKitValue == null) { | |
| 1353 | - isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); | |
| 1354 | - } | |
| 1355 | - return isWebKitValue; | |
| 1356 | - } | |
| 1357 | - function isLastTraversableNode(node) { | |
| 1358 | - return /^(html|body|#document)$/.test(getNodeName(node)); | |
| 1359 | - } | |
| 1360 | - function getComputedStyle2(element) { | |
| 1361 | - return getWindow(element).getComputedStyle(element); | |
| 1362 | - } | |
| 1363 | - function getNodeScroll(element) { | |
| 1364 | - if (isElement(element)) { | |
| 1365 | - return { | |
| 1366 | - scrollLeft: element.scrollLeft, | |
| 1367 | - scrollTop: element.scrollTop | |
| 1368 | - }; | |
| 1369 | - } | |
| 1370 | - return { | |
| 1371 | - scrollLeft: element.scrollX, | |
| 1372 | - scrollTop: element.scrollY | |
| 1373 | - }; | |
| 1374 | - } | |
| 1375 | - function getParentNode(node) { | |
| 1376 | - if (getNodeName(node) === "html") { | |
| 1377 | - return node; | |
| 1378 | - } | |
| 1379 | - const result = ( | |
| 1380 | - // Step into the shadow DOM of the parent of a slotted node. | |
| 1381 | - node.assignedSlot || // DOM Element detected. | |
| 1382 | - node.parentNode || // ShadowRoot detected. | |
| 1383 | - isShadowRoot(node) && node.host || // Fallback. | |
| 1384 | - getDocumentElement(node) | |
| 1385 | - ); | |
| 1386 | - return isShadowRoot(result) ? result.host : result; | |
| 1387 | - } | |
| 1388 | - function getNearestOverflowAncestor(node) { | |
| 1389 | - const parentNode = getParentNode(node); | |
| 1390 | - if (isLastTraversableNode(parentNode)) { | |
| 1391 | - return node.ownerDocument ? node.ownerDocument.body : node.body; | |
| 1392 | - } | |
| 1393 | - if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { | |
| 1394 | - return parentNode; | |
| 1395 | - } | |
| 1396 | - return getNearestOverflowAncestor(parentNode); | |
| 1397 | - } | |
| 1398 | - function getOverflowAncestors(node, list, traverseIframes) { | |
| 1399 | - var _node$ownerDocument2; | |
| 1400 | - if (list === void 0) { | |
| 1401 | - list = []; | |
| 1402 | - } | |
| 1403 | - if (traverseIframes === void 0) { | |
| 1404 | - traverseIframes = true; | |
| 1405 | - } | |
| 1406 | - const scrollableAncestor = getNearestOverflowAncestor(node); | |
| 1407 | - const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); | |
| 1408 | - const win = getWindow(scrollableAncestor); | |
| 1409 | - if (isBody) { | |
| 1410 | - const frameElement = getFrameElement(win); | |
| 1411 | - return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); | |
| 1412 | - } else { | |
| 1413 | - return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); | |
| 1414 | - } | |
| 1415 | - } | |
| 1416 | - function getFrameElement(win) { | |
| 1417 | - return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; | |
| 1418 | - } | |
| 1419 | - | |
| 1420 | - // node_modules/@base-ui/utils/addEventListener.mjs | |
| 1421 | - function addEventListener(target, type, listener, options) { | |
| 1422 | - target.addEventListener(type, listener, options); | |
| 1423 | - return () => { | |
| 1424 | - target.removeEventListener(type, listener, options); | |
| 1425 | - }; | |
| 1426 | - } | |
| 1427 | - | |
| 1428 | - // node_modules/@base-ui/utils/useValueAsRef.mjs | |
| 1429 | - function useValueAsRef(value) { | |
| 1430 | - const latest = useRefWithInit(createLatestRef, value).current; | |
| 1431 | - latest.next = value; | |
| 1432 | - useIsoLayoutEffect(latest.effect); | |
| 1433 | - return latest; | |
| 1434 | - } | |
| 1435 | - function createLatestRef(value) { | |
| 1436 | - const latest = { | |
| 1437 | - current: value, | |
| 1438 | - next: value, | |
| 1439 | - effect: () => { | |
| 1440 | - latest.current = latest.next; | |
| 1441 | - } | |
| 1442 | - }; | |
| 1443 | - return latest; | |
| 1444 | - } | |
| 1445 | - | |
| 1446 | - // node_modules/@base-ui/utils/owner.mjs | |
| 1447 | - function ownerDocument(node) { | |
| 1448 | - return node?.ownerDocument || document; | |
| 1449 | - } | |
| 1450 | - | |
| 1451 | - // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs | |
| 1452 | - var React11 = __toESM(require_react(), 1); | |
| 1453 | - | |
| 1454 | - // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs | |
| 1455 | - var ReactDOM = __toESM(require_react_dom(), 1); | |
| 1456 | - | |
| 1457 | - // node_modules/@base-ui/react/utils/resolveRef.mjs | |
| 1458 | - function resolveRef(maybeRef) { | |
| 1459 | - if (maybeRef == null) { | |
| 1460 | - return maybeRef; | |
| 1461 | - } | |
| 1462 | - return "current" in maybeRef ? maybeRef.current : maybeRef; | |
| 1463 | - } | |
| 1464 | - | |
| 1465 | - // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs | |
| 1466 | - function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { | |
| 1467 | - const frame = useAnimationFrame(); | |
| 1468 | - return useStableCallback((fnToExecute, signal = null) => { | |
| 1469 | - frame.cancel(); | |
| 1470 | - const element = resolveRef(elementOrRef); | |
| 1471 | - if (element == null) { | |
| 1472 | - return; | |
| 1473 | - } | |
| 1474 | - const resolvedElement = element; | |
| 1475 | - const done = () => { | |
| 1476 | - ReactDOM.flushSync(fnToExecute); | |
| 1477 | - }; | |
| 1478 | - if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { | |
| 1479 | - fnToExecute(); | |
| 1480 | - return; | |
| 1481 | - } | |
| 1482 | - function exec() { | |
| 1483 | - Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { | |
| 1484 | - if (!signal?.aborted) { | |
| 1485 | - done(); | |
| 1486 | - } | |
| 1487 | - }).catch(() => { | |
| 1488 | - if (treatAbortedAsFinished) { | |
| 1489 | - if (!signal?.aborted) { | |
| 1490 | - done(); | |
| 1491 | - } | |
| 1492 | - return; | |
| 1493 | - } | |
| 1494 | - const currentAnimations = resolvedElement.getAnimations(); | |
| 1495 | - if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { | |
| 1496 | - exec(); | |
| 1497 | - } | |
| 1498 | - }); | |
| 1499 | - } | |
| 1500 | - if (waitForStartingStyleRemoved) { | |
| 1501 | - const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; | |
| 1502 | - if (!resolvedElement.hasAttribute(startingStyleAttribute)) { | |
| 1503 | - frame.request(exec); | |
| 1504 | - return; | |
| 1505 | - } | |
| 1506 | - const attributeObserver = new MutationObserver(() => { | |
| 1507 | - if (!resolvedElement.hasAttribute(startingStyleAttribute)) { | |
| 1508 | - attributeObserver.disconnect(); | |
| 1509 | - exec(); | |
| 1510 | - } | |
| 1511 | - }); | |
| 1512 | - attributeObserver.observe(resolvedElement, { | |
| 1513 | - attributes: true, | |
| 1514 | - attributeFilter: [startingStyleAttribute] | |
| 1515 | - }); | |
| 1516 | - signal?.addEventListener("abort", () => attributeObserver.disconnect(), { | |
| 1517 | - once: true | |
| 1518 | - }); | |
| 1519 | - return; | |
| 1520 | - } | |
| 1521 | - frame.request(exec); | |
| 1522 | - }); | |
| 1523 | - } | |
| 1524 | - | |
| 1525 | - // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs | |
| 1526 | - function useOpenChangeComplete(parameters) { | |
| 1527 | - const { | |
| 1528 | - enabled = true, | |
| 1529 | - open, | |
| 1530 | - ref, | |
| 1531 | - onComplete: onCompleteParam | |
| 1532 | - } = parameters; | |
| 1533 | - const onComplete = useStableCallback(onCompleteParam); | |
| 1534 | - const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); | |
| 1535 | - React11.useEffect(() => { | |
| 1536 | - if (!enabled) { | |
| 1537 | - return void 0; | |
| 1538 | - } | |
| 1539 | - const abortController = new AbortController(); | |
| 1540 | - runOnceAnimationsFinish(onComplete, abortController.signal); | |
| 1541 | - return () => { | |
| 1542 | - abortController.abort(); | |
| 1543 | - }; | |
| 1544 | - }, [enabled, open, onComplete, runOnceAnimationsFinish]); | |
| 1545 | - } | |
| 1546 | - | |
| 1547 | - // node_modules/@base-ui/utils/useOnFirstRender.mjs | |
| 1548 | - var React12 = __toESM(require_react(), 1); | |
| 1549 | - function useOnFirstRender(fn) { | |
| 1550 | - const ref = React12.useRef(true); | |
| 1551 | - if (ref.current) { | |
| 1552 | - ref.current = false; | |
| 1553 | - fn(); | |
| 1554 | - } | |
| 1555 | - } | |
| 1556 | - | |
| 1557 | - // node_modules/@base-ui/utils/platform/parts.mjs | |
| 1558 | - var parts_exports = {}; | |
| 1559 | - __export(parts_exports, { | |
| 1560 | - engine: () => engine_exports, | |
| 1561 | - env: () => env_exports, | |
| 1562 | - os: () => os_exports, | |
| 1563 | - screenReader: () => screen_reader_exports | |
| 1564 | - }); | |
| 1565 | - | |
| 1566 | - // node_modules/@base-ui/utils/platform/os.mjs | |
| 1567 | - var os_exports = {}; | |
| 1568 | - __export(os_exports, { | |
| 1569 | - android: () => android, | |
| 1570 | - apple: () => apple, | |
| 1571 | - ios: () => ios, | |
| 1572 | - linux: () => linux, | |
| 1573 | - mac: () => mac, | |
| 1574 | - windows: () => windows | |
| 1575 | - }); | |
| 1576 | - | |
| 1577 | - // node_modules/@base-ui/utils/platform/shared.mjs | |
| 1578 | - function readRawData() { | |
| 1579 | - if (typeof navigator === "undefined") { | |
| 1580 | - return { | |
| 1581 | - userAgent: "", | |
| 1582 | - platform: "", | |
| 1583 | - maxTouchPoints: 0 | |
| 1584 | - }; | |
| 1585 | - } | |
| 1586 | - if (true) { | |
| 1587 | - const uaData = navigator.userAgentData; | |
| 1588 | - if (uaData && Array.isArray(uaData.brands)) { | |
| 1589 | - return { | |
| 1590 | - userAgent: uaData.brands.map(({ | |
| 1591 | - brand, | |
| 1592 | - version: version2 | |
| 1593 | - }) => `${brand}/${version2}`).join(" "), | |
| 1594 | - platform: uaData.platform ?? navigator.platform ?? "", | |
| 1595 | - maxTouchPoints: navigator.maxTouchPoints ?? 0 | |
| 1596 | - }; | |
| 1597 | - } | |
| 1598 | - } | |
| 1599 | - return { | |
| 1600 | - userAgent: navigator.userAgent, | |
| 1601 | - platform: navigator.platform ?? "", | |
| 1602 | - maxTouchPoints: navigator.maxTouchPoints ?? 0 | |
| 1603 | - }; | |
| 1604 | - } | |
| 1605 | - var { | |
| 1606 | - userAgent, | |
| 1607 | - platform, | |
| 1608 | - maxTouchPoints | |
| 1609 | - } = readRawData(); | |
| 1610 | - var lowerUserAgent = userAgent.toLowerCase(); | |
| 1611 | - var lowerPlatform = platform.toLowerCase(); | |
| 1612 | - | |
| 1613 | - // node_modules/@base-ui/utils/platform/os.mjs | |
| 1614 | - var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; | |
| 1615 | - var ANDROID_STRING = "android"; | |
| 1616 | - var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); | |
| 1617 | - var mac = !ios && lowerPlatform.startsWith("mac"); | |
| 1618 | - var windows = lowerPlatform.startsWith("win"); | |
| 1619 | - var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); | |
| 1620 | - var apple = mac || ios; | |
| 1621 | - | |
| 1622 | - // node_modules/@base-ui/utils/platform/engine.mjs | |
| 1623 | - var engine_exports = {}; | |
| 1624 | - __export(engine_exports, { | |
| 1625 | - blink: () => blink, | |
| 1626 | - gecko: () => gecko, | |
| 1627 | - webkit: () => webkit | |
| 1628 | - }); | |
| 1629 | - var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); | |
| 1630 | - var gecko = !webkit && lowerUserAgent.includes("firefox"); | |
| 1631 | - var blink = !webkit && lowerUserAgent.includes("chrom"); | |
| 1632 | - | |
| 1633 | - // node_modules/@base-ui/utils/platform/screen-reader.mjs | |
| 1634 | - var screen_reader_exports = {}; | |
| 1635 | - __export(screen_reader_exports, { | |
| 1636 | - voiceOver: () => voiceOver | |
| 1637 | - }); | |
| 1638 | - var voiceOver = apple; | |
| 1639 | - | |
| 1640 | - // node_modules/@base-ui/utils/platform/env.mjs | |
| 1641 | - var env_exports = {}; | |
| 1642 | - __export(env_exports, { | |
| 1643 | - jsdom: () => jsdom | |
| 1644 | - }); | |
| 1645 | - var jsdom = /jsdom|happydom/.test(lowerUserAgent); | |
| 1646 | - | |
| 1647 | - // node_modules/@base-ui/utils/useTimeout.mjs | |
| 1648 | - var EMPTY3 = 0; | |
| 1649 | - var Timeout = class _Timeout { | |
| 1650 | - static create() { | |
| 1651 | - return new _Timeout(); | |
| 1652 | - } | |
| 1653 | - currentId = EMPTY3; | |
| 1654 | - /** | |
| 1655 | - * Executes `fn` after `delay`, clearing any previously scheduled call. | |
| 1656 | - */ | |
| 1657 | - start(delay, fn) { | |
| 1658 | - this.clear(); | |
| 1659 | - this.currentId = setTimeout(() => { | |
| 1660 | - this.currentId = EMPTY3; | |
| 1661 | - fn(); | |
| 1662 | - }, delay); | |
| 1663 | - } | |
| 1664 | - isStarted() { | |
| 1665 | - return this.currentId !== EMPTY3; | |
| 1666 | - } | |
| 1667 | - clear = () => { | |
| 1668 | - if (this.currentId !== EMPTY3) { | |
| 1669 | - clearTimeout(this.currentId); | |
| 1670 | - this.currentId = EMPTY3; | |
| 1671 | - } | |
| 1672 | - }; | |
| 1673 | - disposeEffect = () => { | |
| 1674 | - return this.clear; | |
| 1675 | - }; | |
| 1676 | - }; | |
| 1677 | - function useTimeout() { | |
| 1678 | - const timeout = useRefWithInit(Timeout.create).current; | |
| 1679 | - useOnMount(timeout.disposeEffect); | |
| 1680 | - return timeout; | |
| 1681 | - } | |
| 1682 | - | |
| 1683 | - // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs | |
| 1684 | - var React13 = __toESM(require_react(), 1); | |
| 1685 | - | |
| 1686 | - // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs | |
| 1687 | - function isReactEvent(event) { | |
| 1688 | - return "nativeEvent" in event; | |
| 1689 | - } | |
| 1690 | - function isMouseLikePointerType(pointerType, strict) { | |
| 1691 | - const values = ["mouse", "pen"]; | |
| 1692 | - if (!strict) { | |
| 1693 | - values.push("", void 0); | |
| 1694 | - } | |
| 1695 | - return values.includes(pointerType); | |
| 1696 | - } | |
| 1697 | - function isClickLikeEvent(event) { | |
| 1698 | - const type = event.type; | |
| 1699 | - return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; | |
| 1700 | - } | |
| 1701 | - | |
| 1702 | - // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs | |
| 1703 | - var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; | |
| 1704 | - var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; | |
| 1705 | - | |
| 1706 | - // node_modules/@base-ui/react/internals/shadowDom.mjs | |
| 1707 | - function activeElement(doc) { | |
| 1708 | - let element = doc.activeElement; | |
| 1709 | - while (element?.shadowRoot?.activeElement != null) { | |
| 1710 | - element = element.shadowRoot.activeElement; | |
| 1711 | - } | |
| 1712 | - return element; | |
| 1713 | - } | |
| 1714 | - function contains(parent, child) { | |
| 1715 | - if (!parent || !child) { | |
| 1716 | - return false; | |
| 1717 | - } | |
| 1718 | - const rootNode = child.getRootNode?.(); | |
| 1719 | - if (parent.contains(child)) { | |
| 1720 | - return true; | |
| 1721 | - } | |
| 1722 | - if (rootNode && isShadowRoot(rootNode)) { | |
| 1723 | - let next = child; | |
| 1724 | - while (next) { | |
| 1725 | - if (parent === next) { | |
| 1726 | - return true; | |
| 1727 | - } | |
| 1728 | - next = next.parentNode || next.host; | |
| 1729 | - } | |
| 1730 | - } | |
| 1731 | - return false; | |
| 1732 | - } | |
| 1733 | - function getTarget(event) { | |
| 1734 | - if ("composedPath" in event) { | |
| 1735 | - return event.composedPath()[0]; | |
| 1736 | - } | |
| 1737 | - return event.target; | |
| 1738 | - } | |
| 1739 | - | |
| 1740 | - // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs | |
| 1741 | - function isTargetInsideEnabledTrigger(target, triggerElements) { | |
| 1742 | - if (!isElement(target)) { | |
| 1743 | - return false; | |
| 1744 | - } | |
| 1745 | - const targetElement = target; | |
| 1746 | - if (triggerElements.hasElement(targetElement)) { | |
| 1747 | - return !targetElement.hasAttribute("data-trigger-disabled"); | |
| 1748 | - } | |
| 1749 | - for (const [, trigger] of triggerElements.entries()) { | |
| 1750 | - if (contains(trigger, targetElement)) { | |
| 1751 | - return !trigger.hasAttribute("data-trigger-disabled"); | |
| 1752 | - } | |
| 1753 | - } | |
| 1754 | - return false; | |
| 1755 | - } | |
| 1756 | - function isEventTargetWithin(event, node) { | |
| 1757 | - if (node == null) { | |
| 1758 | - return false; | |
| 1759 | - } | |
| 1760 | - if ("composedPath" in event) { | |
| 1761 | - return event.composedPath().includes(node); | |
| 1762 | - } | |
| 1763 | - const eventAgain = event; | |
| 1764 | - return eventAgain.target != null && node.contains(eventAgain.target); | |
| 1765 | - } | |
| 1766 | - function isRootElement(element) { | |
| 1767 | - return element.matches("html,body"); | |
| 1768 | - } | |
| 1769 | - function isTypeableElement(element) { | |
| 1770 | - return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); | |
| 1771 | - } | |
| 1772 | - function isInteractiveElement(element) { | |
| 1773 | - return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null; | |
| 1774 | - } | |
| 1775 | - function matchesFocusVisible(element) { | |
| 1776 | - if (!element || parts_exports.env.jsdom) { | |
| 1777 | - return true; | |
| 1778 | - } | |
| 1779 | - try { | |
| 1780 | - return element.matches(":focus-visible"); | |
| 1781 | - } catch (_e) { | |
| 1782 | - return true; | |
| 1783 | - } | |
| 1784 | - } | |
| 1785 | - | |
| 1786 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs | |
| 1787 | - function resolveValue(value, pointerType) { | |
| 1788 | - if (pointerType != null && !isMouseLikePointerType(pointerType)) { | |
| 1789 | - return 0; | |
| 1790 | - } | |
| 1791 | - if (typeof value === "function") { | |
| 1792 | - return value(); | |
| 1793 | - } | |
| 1794 | - return value; | |
| 1795 | - } | |
| 1796 | - function getDelay(value, prop, pointerType) { | |
| 1797 | - const result = resolveValue(value, pointerType); | |
| 1798 | - if (typeof result === "number") { | |
| 1799 | - return result; | |
| 1800 | - } | |
| 1801 | - return result?.[prop]; | |
| 1802 | - } | |
| 1803 | - function getRestMs(value) { | |
| 1804 | - if (typeof value === "function") { | |
| 1805 | - return value(); | |
| 1806 | - } | |
| 1807 | - return value; | |
| 1808 | - } | |
| 1809 | - function isClickLikeOpenEvent(openEventType, interactedInside) { | |
| 1810 | - return interactedInside || openEventType === "click" || openEventType === "mousedown"; | |
| 1811 | - } | |
| 1812 | - function isHoverOpenEvent(openEventType) { | |
| 1813 | - return openEventType?.includes("mouse") && openEventType !== "mousedown"; | |
| 1814 | - } | |
| 1815 | - | |
| 1816 | - // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs | |
| 259 | + // packages/admin-ui/build-module/navigable-region/index.mjs | |
| 260 | + var import_element = __toESM(require_element(), 1); | |
| 1817 | 261 | var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); |
| 1818 | - var FloatingDelayGroupContext = /* @__PURE__ */ React13.createContext({ | |
| 1819 | - hasProvider: false, | |
| 1820 | - timeoutMs: 0, | |
| 1821 | - delayRef: { | |
| 1822 | - current: 0 | |
| 1823 | - }, | |
| 1824 | - initialDelayRef: { | |
| 1825 | - current: 0 | |
| 1826 | - }, | |
| 1827 | - timeout: new Timeout(), | |
| 1828 | - currentIdRef: { | |
| 1829 | - current: null | |
| 1830 | - }, | |
| 1831 | - currentContextRef: { | |
| 1832 | - current: null | |
| 1833 | - } | |
| 1834 | - }); | |
| 1835 | - if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; | |
| 1836 | - function resetDelayRef(delayRef, initialDelayRef) { | |
| 1837 | - delayRef.current = initialDelayRef.current; | |
| 1838 | - } | |
| 1839 | - function FloatingDelayGroup(props) { | |
| 1840 | - const { | |
| 1841 | - children, | |
| 1842 | - delay, | |
| 1843 | - timeoutMs = 0 | |
| 1844 | - } = props; | |
| 1845 | - const delayRef = React13.useRef(delay); | |
| 1846 | - const initialDelayRef = React13.useRef(delay); | |
| 1847 | - const currentIdRef = React13.useRef(null); | |
| 1848 | - const currentContextRef = React13.useRef(null); | |
| 1849 | - const timeout = useTimeout(); | |
| 1850 | - useIsoLayoutEffect(() => { | |
| 1851 | - initialDelayRef.current = delay; | |
| 1852 | - if (!currentIdRef.current) { | |
| 1853 | - delayRef.current = delay; | |
| 1854 | - return; | |
| 1855 | - } | |
| 1856 | - delayRef.current = { | |
| 1857 | - open: getDelay(delayRef.current, "open"), | |
| 1858 | - close: getDelay(delay, "close") | |
| 1859 | - }; | |
| 1860 | - }, [delay, currentIdRef, delayRef, initialDelayRef]); | |
| 1861 | - return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { | |
| 1862 | - value: React13.useMemo(() => ({ | |
| 1863 | - hasProvider: true, | |
| 1864 | - delayRef, | |
| 1865 | - initialDelayRef, | |
| 1866 | - currentIdRef, | |
| 1867 | - timeoutMs, | |
| 1868 | - currentContextRef, | |
| 1869 | - timeout | |
| 1870 | - }), [timeoutMs, timeout]), | |
| 1871 | - children | |
| 1872 | - }); | |
| 1873 | - } | |
| 1874 | - function useDelayGroup(context, options = { | |
| 1875 | - open: false | |
| 1876 | - }) { | |
| 1877 | - const { | |
| 1878 | - open | |
| 1879 | - } = options; | |
| 1880 | - const store2 = "rootStore" in context ? context.rootStore : context; | |
| 1881 | - const floatingId = store2.useState("floatingId"); | |
| 1882 | - const groupContext = React13.useContext(FloatingDelayGroupContext); | |
| 1883 | - const { | |
| 1884 | - currentIdRef, | |
| 1885 | - delayRef, | |
| 1886 | - timeoutMs, | |
| 1887 | - initialDelayRef, | |
| 1888 | - currentContextRef, | |
| 1889 | - hasProvider, | |
| 1890 | - timeout | |
| 1891 | - } = groupContext; | |
| 1892 | - const [isInstantPhase, setIsInstantPhase] = React13.useState(false); | |
| 1893 | - const openRef = React13.useRef(open); | |
| 1894 | - const isUnmountedRef = React13.useRef(false); | |
| 1895 | - useIsoLayoutEffect(() => { | |
| 1896 | - openRef.current = open; | |
| 1897 | - }, [open]); | |
| 1898 | - useIsoLayoutEffect(() => { | |
| 1899 | - return () => { | |
| 1900 | - isUnmountedRef.current = true; | |
| 1901 | - }; | |
| 1902 | - }, []); | |
| 1903 | - useIsoLayoutEffect(() => { | |
| 1904 | - function unset() { | |
| 1905 | - if (!isUnmountedRef.current) { | |
| 1906 | - setIsInstantPhase(false); | |
| 1907 | - } | |
| 1908 | - currentContextRef.current?.setIsInstantPhase(false); | |
| 1909 | - currentIdRef.current = null; | |
| 1910 | - currentContextRef.current = null; | |
| 1911 | - delayRef.current = initialDelayRef.current; | |
| 1912 | - timeout.clear(); | |
| 1913 | - } | |
| 1914 | - if (!currentIdRef.current) { | |
| 1915 | - return void 0; | |
| 1916 | - } | |
| 1917 | - if (!open && currentIdRef.current === floatingId) { | |
| 1918 | - setIsInstantPhase(false); | |
| 1919 | - if (timeoutMs) { | |
| 1920 | - const closingId = floatingId; | |
| 1921 | - timeout.start(timeoutMs, () => { | |
| 1922 | - if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { | |
| 1923 | - return; | |
| 1924 | - } | |
| 1925 | - unset(); | |
| 1926 | - }); | |
| 1927 | - return () => { | |
| 1928 | - if (openRef.current || currentIdRef.current !== closingId) { | |
| 1929 | - timeout.clear(); | |
| 1930 | - } | |
| 1931 | - }; | |
| 1932 | - } | |
| 1933 | - unset(); | |
| 1934 | - } | |
| 1935 | - return void 0; | |
| 1936 | - }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]); | |
| 1937 | - useIsoLayoutEffect(() => { | |
| 1938 | - if (!open) { | |
| 1939 | - return; | |
| 1940 | - } | |
| 1941 | - const prevContext = currentContextRef.current; | |
| 1942 | - const prevId = currentIdRef.current; | |
| 1943 | - timeout.clear(); | |
| 1944 | - currentContextRef.current = { | |
| 1945 | - onOpenChange: store2.setOpen, | |
| 1946 | - setIsInstantPhase | |
| 1947 | - }; | |
| 1948 | - currentIdRef.current = floatingId; | |
| 1949 | - delayRef.current = { | |
| 1950 | - open: 0, | |
| 1951 | - close: getDelay(initialDelayRef.current, "close") | |
| 1952 | - }; | |
| 1953 | - if (prevId !== null && prevId !== floatingId) { | |
| 1954 | - setIsInstantPhase(true); | |
| 1955 | - prevContext?.setIsInstantPhase(true); | |
| 1956 | - prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); | |
| 1957 | - } else { | |
| 1958 | - setIsInstantPhase(false); | |
| 1959 | - prevContext?.setIsInstantPhase(false); | |
| 1960 | - } | |
| 1961 | - }, [open, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); | |
| 1962 | - useIsoLayoutEffect(() => { | |
| 1963 | - return () => { | |
| 1964 | - if (currentIdRef.current === floatingId) { | |
| 1965 | - currentContextRef.current = null; | |
| 1966 | - if (!openRef.current) { | |
| 1967 | - return; | |
| 1968 | - } | |
| 1969 | - currentIdRef.current = null; | |
| 1970 | - resetDelayRef(delayRef, initialDelayRef); | |
| 1971 | - timeout.clear(); | |
| 1972 | - } | |
| 1973 | - }; | |
| 1974 | - }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); | |
| 1975 | - return React13.useMemo(() => ({ | |
| 1976 | - hasProvider, | |
| 1977 | - delayRef, | |
| 1978 | - isInstantPhase | |
| 1979 | - }), [hasProvider, delayRef, isInstantPhase]); | |
| 1980 | - } | |
| 1981 | - | |
| 1982 | - // node_modules/@base-ui/utils/mergeCleanups.mjs | |
| 1983 | - function mergeCleanups(...cleanups) { | |
| 1984 | - return () => { | |
| 1985 | - for (let i = 0; i < cleanups.length; i += 1) { | |
| 1986 | - const cleanup = cleanups[i]; | |
| 1987 | - if (cleanup) { | |
| 1988 | - cleanup(); | |
| 1989 | - } | |
| 1990 | - } | |
| 1991 | - }; | |
| 1992 | - } | |
| 1993 | - | |
| 1994 | - // node_modules/@base-ui/react/utils/FocusGuard.mjs | |
| 1995 | - var React14 = __toESM(require_react(), 1); | |
| 1996 | - | |
| 1997 | - // node_modules/@base-ui/utils/visuallyHidden.mjs | |
| 1998 | - var visuallyHiddenBase = { | |
| 1999 | - clipPath: "inset(50%)", | |
| 2000 | - overflow: "hidden", | |
| 2001 | - whiteSpace: "nowrap", | |
| 2002 | - border: 0, | |
| 2003 | - padding: 0, | |
| 2004 | - width: 1, | |
| 2005 | - height: 1, | |
| 2006 | - margin: -1 | |
| 2007 | - }; | |
| 2008 | - var visuallyHidden = { | |
| 2009 | - ...visuallyHiddenBase, | |
| 2010 | - position: "fixed", | |
| 2011 | - top: 0, | |
| 2012 | - left: 0 | |
| 2013 | - }; | |
| 2014 | - var visuallyHiddenInput = { | |
| 2015 | - ...visuallyHiddenBase, | |
| 2016 | - position: "absolute" | |
| 2017 | - }; | |
| 2018 | - | |
| 2019 | - // node_modules/@base-ui/react/utils/FocusGuard.mjs | |
| 2020 | - var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); | |
| 2021 | - var FocusGuard = /* @__PURE__ */ React14.forwardRef(function FocusGuard2(props, ref) { | |
| 2022 | - const [role, setRole] = React14.useState(); | |
| 2023 | - useIsoLayoutEffect(() => { | |
| 2024 | - if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { | |
| 2025 | - setRole("button"); | |
| 2026 | - } | |
| 2027 | - }, []); | |
| 2028 | - const restProps = { | |
| 2029 | - tabIndex: 0, | |
| 2030 | - // Role is only for VoiceOver | |
| 2031 | - role | |
| 2032 | - }; | |
| 2033 | - return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { | |
| 2034 | - ...props, | |
| 2035 | - ref, | |
| 2036 | - style: visuallyHidden, | |
| 2037 | - "aria-hidden": role ? void 0 : true, | |
| 2038 | - ...restProps, | |
| 2039 | - "data-base-ui-focus-guard": "" | |
| 2040 | - }); | |
| 2041 | - }); | |
| 2042 | - if (true) FocusGuard.displayName = "FocusGuard"; | |
| 2043 | - | |
| 2044 | - // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs | |
| 2045 | - var sides = ["top", "right", "bottom", "left"]; | |
| 2046 | - var min = Math.min; | |
| 2047 | - var max = Math.max; | |
| 2048 | - var round = Math.round; | |
| 2049 | - var floor = Math.floor; | |
| 2050 | - var createCoords = (v) => ({ | |
| 2051 | - x: v, | |
| 2052 | - y: v | |
| 2053 | - }); | |
| 2054 | - var oppositeSideMap = { | |
| 2055 | - left: "right", | |
| 2056 | - right: "left", | |
| 2057 | - bottom: "top", | |
| 2058 | - top: "bottom" | |
| 2059 | - }; | |
| 2060 | - function clamp(start, value, end) { | |
| 2061 | - return max(start, min(value, end)); | |
| 2062 | - } | |
| 2063 | - function evaluate(value, param) { | |
| 2064 | - return typeof value === "function" ? value(param) : value; | |
| 2065 | - } | |
| 2066 | - function getSide(placement) { | |
| 2067 | - return placement.split("-")[0]; | |
| 2068 | - } | |
| 2069 | - function getAlignment(placement) { | |
| 2070 | - return placement.split("-")[1]; | |
| 2071 | - } | |
| 2072 | - function getOppositeAxis(axis) { | |
| 2073 | - return axis === "x" ? "y" : "x"; | |
| 2074 | - } | |
| 2075 | - function getAxisLength(axis) { | |
| 2076 | - return axis === "y" ? "height" : "width"; | |
| 2077 | - } | |
| 2078 | - function getSideAxis(placement) { | |
| 2079 | - const firstChar = placement[0]; | |
| 2080 | - return firstChar === "t" || firstChar === "b" ? "y" : "x"; | |
| 2081 | - } | |
| 2082 | - function getAlignmentAxis(placement) { | |
| 2083 | - return getOppositeAxis(getSideAxis(placement)); | |
| 2084 | - } | |
| 2085 | - function getAlignmentSides(placement, rects, rtl) { | |
| 2086 | - if (rtl === void 0) { | |
| 2087 | - rtl = false; | |
| 2088 | - } | |
| 2089 | - const alignment = getAlignment(placement); | |
| 2090 | - const alignmentAxis = getAlignmentAxis(placement); | |
| 2091 | - const length = getAxisLength(alignmentAxis); | |
| 2092 | - let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; | |
| 2093 | - if (rects.reference[length] > rects.floating[length]) { | |
| 2094 | - mainAlignmentSide = getOppositePlacement(mainAlignmentSide); | |
| 2095 | - } | |
| 2096 | - return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; | |
| 2097 | - } | |
| 2098 | - function getExpandedPlacements(placement) { | |
| 2099 | - const oppositePlacement = getOppositePlacement(placement); | |
| 2100 | - return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; | |
| 2101 | - } | |
| 2102 | - function getOppositeAlignmentPlacement(placement) { | |
| 2103 | - return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); | |
| 2104 | - } | |
| 2105 | - var lrPlacement = ["left", "right"]; | |
| 2106 | - var rlPlacement = ["right", "left"]; | |
| 2107 | - var tbPlacement = ["top", "bottom"]; | |
| 2108 | - var btPlacement = ["bottom", "top"]; | |
| 2109 | - function getSideList(side, isStart, rtl) { | |
| 2110 | - switch (side) { | |
| 2111 | - case "top": | |
| 2112 | - case "bottom": | |
| 2113 | - if (rtl) return isStart ? rlPlacement : lrPlacement; | |
| 2114 | - return isStart ? lrPlacement : rlPlacement; | |
| 2115 | - case "left": | |
| 2116 | - case "right": | |
| 2117 | - return isStart ? tbPlacement : btPlacement; | |
| 2118 | - default: | |
| 2119 | - return []; | |
| 2120 | - } | |
| 2121 | - } | |
| 2122 | - function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { | |
| 2123 | - const alignment = getAlignment(placement); | |
| 2124 | - let list = getSideList(getSide(placement), direction === "start", rtl); | |
| 2125 | - if (alignment) { | |
| 2126 | - list = list.map((side) => side + "-" + alignment); | |
| 2127 | - if (flipAlignment) { | |
| 2128 | - list = list.concat(list.map(getOppositeAlignmentPlacement)); | |
| 2129 | - } | |
| 2130 | - } | |
| 2131 | - return list; | |
| 2132 | - } | |
| 2133 | - function getOppositePlacement(placement) { | |
| 2134 | - const side = getSide(placement); | |
| 2135 | - return oppositeSideMap[side] + placement.slice(side.length); | |
| 2136 | - } | |
| 2137 | - function expandPaddingObject(padding) { | |
| 2138 | - return { | |
| 2139 | - top: 0, | |
| 2140 | - right: 0, | |
| 2141 | - bottom: 0, | |
| 2142 | - left: 0, | |
| 2143 | - ...padding | |
| 2144 | - }; | |
| 2145 | - } | |
| 2146 | - function getPaddingObject(padding) { | |
| 2147 | - return typeof padding !== "number" ? expandPaddingObject(padding) : { | |
| 2148 | - top: padding, | |
| 2149 | - right: padding, | |
| 2150 | - bottom: padding, | |
| 2151 | - left: padding | |
| 2152 | - }; | |
| 2153 | - } | |
| 2154 | - function rectToClientRect(rect) { | |
| 2155 | - const { | |
| 2156 | - x, | |
| 2157 | - y, | |
| 2158 | - width, | |
| 2159 | - height | |
| 2160 | - } = rect; | |
| 2161 | - return { | |
| 2162 | - width, | |
| 2163 | - height, | |
| 2164 | - top: y, | |
| 2165 | - left: x, | |
| 2166 | - right: x + width, | |
| 2167 | - bottom: y + height, | |
| 2168 | - x, | |
| 2169 | - y | |
| 2170 | - }; | |
| 2171 | - } | |
| 2172 | - | |
| 2173 | - // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs | |
| 2174 | - function isHiddenByStyles(styles) { | |
| 2175 | - return styles.visibility === "hidden" || styles.visibility === "collapse"; | |
| 2176 | - } | |
| 2177 | - function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { | |
| 2178 | - if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { | |
| 2179 | - return false; | |
| 2180 | - } | |
| 2181 | - if (typeof element.checkVisibility === "function") { | |
| 2182 | - return element.checkVisibility(); | |
| 2183 | - } | |
| 2184 | - return styles.display !== "none" && styles.display !== "contents"; | |
| 2185 | - } | |
| 2186 | - | |
| 2187 | - // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs | |
| 2188 | - var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; | |
| 2189 | - function getParentElement(element) { | |
| 2190 | - const assignedSlot = element.assignedSlot; | |
| 2191 | - if (assignedSlot) { | |
| 2192 | - return assignedSlot; | |
| 2193 | - } | |
| 2194 | - if (element.parentElement) { | |
| 2195 | - return element.parentElement; | |
| 2196 | - } | |
| 2197 | - const rootNode = element.getRootNode(); | |
| 2198 | - return isShadowRoot(rootNode) ? rootNode.host : null; | |
| 2199 | - } | |
| 2200 | - function getDetailsSummary(details) { | |
| 2201 | - for (const child of Array.from(details.children)) { | |
| 2202 | - if (getNodeName(child) === "summary") { | |
| 2203 | - return child; | |
| 2204 | - } | |
| 2205 | - } | |
| 2206 | - return null; | |
| 2207 | - } | |
| 2208 | - function isWithinOpenDetailsSummary(element, details) { | |
| 2209 | - const summary = getDetailsSummary(details); | |
| 2210 | - return !!summary && (element === summary || contains(summary, element)); | |
| 2211 | - } | |
| 2212 | - function isFocusableCandidate(element) { | |
| 2213 | - const nodeName = element ? getNodeName(element) : ""; | |
| 2214 | - return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== "summary" || element.parentElement != null && getNodeName(element.parentElement) === "details" && getDetailsSummary(element.parentElement) === element) && (nodeName !== "details" || getDetailsSummary(element) == null) && (nodeName !== "input" || element.type !== "hidden"); | |
| 2215 | - } | |
| 2216 | - function isFocusableElement(element) { | |
| 2217 | - if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { | |
| 2218 | - return false; | |
| 2219 | - } | |
| 2220 | - for (let current = element; current; current = getParentElement(current)) { | |
| 2221 | - const isAncestor = current !== element; | |
| 2222 | - const isSlot = getNodeName(current) === "slot"; | |
| 2223 | - if (current.hasAttribute("inert")) { | |
| 2224 | - return false; | |
| 2225 | - } | |
| 2226 | - if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { | |
| 2227 | - return false; | |
| 2228 | - } | |
| 2229 | - } | |
| 2230 | - return true; | |
| 2231 | - } | |
| 2232 | - function isVisibleInTabbableTree(element, isAncestor) { | |
| 2233 | - const styles = getComputedStyle2(element); | |
| 2234 | - if (!isAncestor) { | |
| 2235 | - return isElementVisible(element, styles); | |
| 2236 | - } | |
| 2237 | - return styles.display !== "none"; | |
| 2238 | - } | |
| 2239 | - function getTabIndex(element) { | |
| 2240 | - const tabIndex = element.tabIndex; | |
| 2241 | - if (tabIndex < 0) { | |
| 2242 | - const nodeName = getNodeName(element); | |
| 2243 | - if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { | |
| 2244 | - return 0; | |
| 2245 | - } | |
| 2246 | - } | |
| 2247 | - return tabIndex; | |
| 2248 | - } | |
| 2249 | - function getNamedRadioInput(element) { | |
| 2250 | - if (getNodeName(element) !== "input") { | |
| 2251 | - return null; | |
| 2252 | - } | |
| 2253 | - const input = element; | |
| 2254 | - return input.type === "radio" && input.name !== "" ? input : null; | |
| 2255 | - } | |
| 2256 | - function isTabbableRadio(element, candidates) { | |
| 2257 | - const input = getNamedRadioInput(element); | |
| 2258 | - if (!input) { | |
| 2259 | - return true; | |
| 2260 | - } | |
| 2261 | - const checkedRadio = candidates.find((candidate) => { | |
| 2262 | - const radio = getNamedRadioInput(candidate); | |
| 2263 | - return radio?.name === input.name && radio.form === input.form && radio.checked; | |
| 2264 | - }); | |
| 2265 | - if (checkedRadio) { | |
| 2266 | - return checkedRadio === input; | |
| 2267 | - } | |
| 2268 | - return candidates.find((candidate) => { | |
| 2269 | - const radio = getNamedRadioInput(candidate); | |
| 2270 | - return radio?.name === input.name && radio.form === input.form; | |
| 2271 | - }) === input; | |
| 2272 | - } | |
| 2273 | - function getComposedChildren(container) { | |
| 2274 | - if (isHTMLElement(container) && getNodeName(container) === "slot") { | |
| 2275 | - const assignedElements = container.assignedElements({ | |
| 2276 | - flatten: true | |
| 2277 | - }); | |
| 2278 | - if (assignedElements.length > 0) { | |
| 2279 | - return assignedElements; | |
| 2280 | - } | |
| 2281 | - } | |
| 2282 | - if (isHTMLElement(container) && container.shadowRoot) { | |
| 2283 | - return Array.from(container.shadowRoot.children); | |
| 2284 | - } | |
| 2285 | - return Array.from(container.children); | |
| 2286 | - } | |
| 2287 | - function appendCandidates(container, list) { | |
| 2288 | - getComposedChildren(container).forEach((child) => { | |
| 2289 | - if (isFocusableCandidate(child)) { | |
| 2290 | - list.push(child); | |
| 2291 | - } | |
| 2292 | - appendCandidates(child, list); | |
| 2293 | - }); | |
| 2294 | - } | |
| 2295 | - function appendMatchingElements(container, selector, list) { | |
| 2296 | - getComposedChildren(container).forEach((child) => { | |
| 2297 | - if (isHTMLElement(child) && child.matches(selector)) { | |
| 2298 | - list.push(child); | |
| 2299 | - } | |
| 2300 | - appendMatchingElements(child, selector, list); | |
| 2301 | - }); | |
| 2302 | - } | |
| 2303 | - function focusable(container) { | |
| 2304 | - const candidates = []; | |
| 2305 | - appendCandidates(container, candidates); | |
| 2306 | - return candidates.filter(isFocusableElement); | |
| 2307 | - } | |
| 2308 | - function tabbable(container) { | |
| 2309 | - const candidates = focusable(container); | |
| 2310 | - return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); | |
| 2311 | - } | |
| 2312 | - function getTabbableIn(container, dir) { | |
| 2313 | - const list = tabbable(container); | |
| 2314 | - const len = list.length; | |
| 2315 | - if (len === 0) { | |
| 2316 | - return void 0; | |
| 2317 | - } | |
| 2318 | - const active = activeElement(ownerDocument(container)); | |
| 2319 | - const index2 = list.indexOf(active); | |
| 2320 | - const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; | |
| 2321 | - return list[nextIndex]; | |
| 2322 | - } | |
| 2323 | - function getNextTabbable(referenceElement) { | |
| 2324 | - return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; | |
| 2325 | - } | |
| 2326 | - function getPreviousTabbable(referenceElement) { | |
| 2327 | - return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; | |
| 2328 | - } | |
| 2329 | - function isOutsideEvent(event, container) { | |
| 2330 | - const containerElement = container || event.currentTarget; | |
| 2331 | - const relatedTarget = event.relatedTarget; | |
| 2332 | - return !relatedTarget || !contains(containerElement, relatedTarget); | |
| 2333 | - } | |
| 2334 | - function disableFocusInside(container) { | |
| 2335 | - const tabbableElements = tabbable(container); | |
| 2336 | - tabbableElements.forEach((element) => { | |
| 2337 | - element.dataset.tabindex = element.getAttribute("tabindex") || ""; | |
| 2338 | - element.setAttribute("tabindex", "-1"); | |
| 2339 | - }); | |
| 2340 | - } | |
| 2341 | - function enableFocusInside(container) { | |
| 2342 | - const elements = []; | |
| 2343 | - appendMatchingElements(container, "[data-tabindex]", elements); | |
| 2344 | - elements.forEach((element) => { | |
| 2345 | - const tabindex = element.dataset.tabindex; | |
| 2346 | - delete element.dataset.tabindex; | |
| 2347 | - if (tabindex) { | |
| 2348 | - element.setAttribute("tabindex", tabindex); | |
| 2349 | - } else { | |
| 2350 | - element.removeAttribute("tabindex"); | |
| 2351 | - } | |
| 2352 | - }); | |
| 2353 | - } | |
| 2354 | - | |
| 2355 | - // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs | |
| 2356 | - function getNodeChildren(nodes, id, onlyOpenChildren = true) { | |
| 2357 | - const directChildren = nodes.filter((node) => node.parentId === id); | |
| 2358 | - return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); | |
| 2359 | - } | |
| 2360 | - | |
| 2361 | - // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs | |
| 2362 | - function createAttribute(name) { | |
| 2363 | - return `data-base-ui-${name}`; | |
| 2364 | - } | |
| 2365 | - | |
| 2366 | - // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs | |
| 2367 | - var React15 = __toESM(require_react(), 1); | |
| 2368 | - var ReactDOM2 = __toESM(require_react_dom(), 1); | |
| 2369 | - | |
| 2370 | - // node_modules/@base-ui/react/internals/constants.mjs | |
| 2371 | - var DISABLED_TRANSITIONS_STYLE = { | |
| 2372 | - style: { | |
| 2373 | - transition: "none" | |
| 2374 | - } | |
| 2375 | - }; | |
| 2376 | - var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; | |
| 2377 | - var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; | |
| 2378 | - var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; | |
| 2379 | - var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; | |
| 2380 | - var POPUP_COLLISION_AVOIDANCE = { | |
| 2381 | - fallbackAxisSide: "end" | |
| 2382 | - }; | |
| 2383 | - var ownerVisuallyHidden = { | |
| 2384 | - clipPath: "inset(50%)", | |
| 2385 | - position: "fixed", | |
| 2386 | - top: 0, | |
| 2387 | - left: 0 | |
| 2388 | - }; | |
| 2389 | - | |
| 2390 | - // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs | |
| 2391 | - var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); | |
| 2392 | - var PortalContext = /* @__PURE__ */ React15.createContext(null); | |
| 2393 | - if (true) PortalContext.displayName = "PortalContext"; | |
| 2394 | - var usePortalContext = () => React15.useContext(PortalContext); | |
| 2395 | - var attr = createAttribute("portal"); | |
| 2396 | - function useFloatingPortalNode(props = {}) { | |
| 2397 | - const { | |
| 2398 | - ref, | |
| 2399 | - container: containerProp, | |
| 2400 | - componentProps = EMPTY_OBJECT, | |
| 2401 | - elementProps | |
| 2402 | - } = props; | |
| 2403 | - const uniqueId = useId(); | |
| 2404 | - const portalContext = usePortalContext(); | |
| 2405 | - const parentPortalNode = portalContext?.portalNode; | |
| 2406 | - const [containerElement, setContainerElement] = React15.useState(null); | |
| 2407 | - const [portalNode, setPortalNode] = React15.useState(null); | |
| 2408 | - const setPortalNodeRef = useStableCallback((node) => { | |
| 2409 | - if (node !== null) { | |
| 2410 | - setPortalNode(node); | |
| 2411 | - } | |
| 2412 | - }); | |
| 2413 | - const containerRef = React15.useRef(null); | |
| 2414 | - useIsoLayoutEffect(() => { | |
| 2415 | - if (containerProp === null) { | |
| 2416 | - if (containerRef.current) { | |
| 2417 | - containerRef.current = null; | |
| 2418 | - setPortalNode(null); | |
| 2419 | - setContainerElement(null); | |
| 2420 | - } | |
| 2421 | - return; | |
| 2422 | - } | |
| 2423 | - if (uniqueId == null) { | |
| 2424 | - return; | |
| 2425 | - } | |
| 2426 | - const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; | |
| 2427 | - if (resolvedContainer == null) { | |
| 2428 | - if (containerRef.current) { | |
| 2429 | - containerRef.current = null; | |
| 2430 | - setPortalNode(null); | |
| 2431 | - setContainerElement(null); | |
| 2432 | - } | |
| 2433 | - return; | |
| 2434 | - } | |
| 2435 | - if (containerRef.current !== resolvedContainer) { | |
| 2436 | - containerRef.current = resolvedContainer; | |
| 2437 | - setPortalNode(null); | |
| 2438 | - setContainerElement(resolvedContainer); | |
| 2439 | - } | |
| 2440 | - }, [containerProp, parentPortalNode, uniqueId]); | |
| 2441 | - const portalElement = useRenderElement("div", componentProps, { | |
| 2442 | - ref: [ref, setPortalNodeRef], | |
| 2443 | - props: [{ | |
| 2444 | - id: uniqueId, | |
| 2445 | - [attr]: "" | |
| 2446 | - }, elementProps] | |
| 2447 | - }); | |
| 2448 | - const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; | |
| 2449 | - return { | |
| 2450 | - portalNode, | |
| 2451 | - portalSubtree | |
| 2452 | - }; | |
| 2453 | - } | |
| 2454 | - var FloatingPortal = /* @__PURE__ */ React15.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { | |
| 2455 | - const { | |
| 2456 | - render, | |
| 2457 | - className, | |
| 2458 | - style, | |
| 2459 | - children, | |
| 2460 | - container, | |
| 2461 | - renderGuards, | |
| 2462 | - ...elementProps | |
| 2463 | - } = componentProps; | |
| 2464 | - const { | |
| 2465 | - portalNode, | |
| 2466 | - portalSubtree | |
| 2467 | - } = useFloatingPortalNode({ | |
| 2468 | - container, | |
| 2469 | - ref: forwardedRef, | |
| 2470 | - componentProps, | |
| 2471 | - elementProps | |
| 2472 | - }); | |
| 2473 | - const beforeOutsideRef = React15.useRef(null); | |
| 2474 | - const afterOutsideRef = React15.useRef(null); | |
| 2475 | - const beforeInsideRef = React15.useRef(null); | |
| 2476 | - const afterInsideRef = React15.useRef(null); | |
| 2477 | - const [focusManagerState, setFocusManagerState] = React15.useState(null); | |
| 2478 | - const focusInsideDisabledRef = React15.useRef(false); | |
| 2479 | - const modal = focusManagerState?.modal; | |
| 2480 | - const open = focusManagerState?.open; | |
| 2481 | - const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; | |
| 2482 | - React15.useEffect(() => { | |
| 2483 | - if (!portalNode || modal) { | |
| 2484 | - return void 0; | |
| 2485 | - } | |
| 2486 | - function onFocus(event) { | |
| 2487 | - if (portalNode && event.relatedTarget && isOutsideEvent(event)) { | |
| 2488 | - if (event.type === "focusin") { | |
| 2489 | - if (focusInsideDisabledRef.current) { | |
| 2490 | - enableFocusInside(portalNode); | |
| 2491 | - focusInsideDisabledRef.current = false; | |
| 2492 | - } | |
| 2493 | - } else { | |
| 2494 | - disableFocusInside(portalNode); | |
| 2495 | - focusInsideDisabledRef.current = true; | |
| 2496 | - } | |
| 2497 | - } | |
| 2498 | - } | |
| 2499 | - return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); | |
| 2500 | - }, [portalNode, modal]); | |
| 2501 | - useIsoLayoutEffect(() => { | |
| 2502 | - if (!portalNode || open !== true || !focusInsideDisabledRef.current) { | |
| 2503 | - return; | |
| 2504 | - } | |
| 2505 | - enableFocusInside(portalNode); | |
| 2506 | - focusInsideDisabledRef.current = false; | |
| 2507 | - }, [open, portalNode]); | |
| 2508 | - const portalContextValue = React15.useMemo(() => ({ | |
| 2509 | - beforeOutsideRef, | |
| 2510 | - afterOutsideRef, | |
| 2511 | - beforeInsideRef, | |
| 2512 | - afterInsideRef, | |
| 2513 | - portalNode, | |
| 2514 | - setFocusManagerState | |
| 2515 | - }), [portalNode]); | |
| 2516 | - return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React15.Fragment, { | |
| 2517 | - children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { | |
| 2518 | - value: portalContextValue, | |
| 2519 | - children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { | |
| 2520 | - "data-type": "outside", | |
| 2521 | - ref: beforeOutsideRef, | |
| 2522 | - onFocus: (event) => { | |
| 2523 | - if (isOutsideEvent(event, portalNode)) { | |
| 2524 | - beforeInsideRef.current?.focus(); | |
| 2525 | - } else { | |
| 2526 | - const domReference = focusManagerState ? focusManagerState.domReference : null; | |
| 2527 | - const prevTabbable = getPreviousTabbable(domReference); | |
| 2528 | - prevTabbable?.focus(); | |
| 2529 | - } | |
| 2530 | - } | |
| 2531 | - }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { | |
| 2532 | - "aria-owns": portalNode.id, | |
| 2533 | - style: ownerVisuallyHidden | |
| 2534 | - }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { | |
| 2535 | - "data-type": "outside", | |
| 2536 | - ref: afterOutsideRef, | |
| 2537 | - onFocus: (event) => { | |
| 2538 | - if (isOutsideEvent(event, portalNode)) { | |
| 2539 | - afterInsideRef.current?.focus(); | |
| 2540 | - } else { | |
| 2541 | - const domReference = focusManagerState ? focusManagerState.domReference : null; | |
| 2542 | - const nextTabbable = getNextTabbable(domReference); | |
| 2543 | - nextTabbable?.focus(); | |
| 2544 | - if (focusManagerState?.closeOnFocusOut) { | |
| 2545 | - focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); | |
| 2546 | - } | |
| 2547 | - } | |
| 2548 | - } | |
| 2549 | - })] | |
| 2550 | - })] | |
| 2551 | - }); | |
| 2552 | - }); | |
| 2553 | - if (true) FloatingPortal.displayName = "FloatingPortal"; | |
| 2554 | - | |
| 2555 | - // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs | |
| 2556 | - var React16 = __toESM(require_react(), 1); | |
| 2557 | - | |
| 2558 | - // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs | |
| 2559 | - function createEventEmitter() { | |
| 2560 | - const map = /* @__PURE__ */ new Map(); | |
| 2561 | - return { | |
| 2562 | - emit(event, data) { | |
| 2563 | - map.get(event)?.forEach((listener) => listener(data)); | |
| 2564 | - }, | |
| 2565 | - on(event, listener) { | |
| 2566 | - if (!map.has(event)) { | |
| 2567 | - map.set(event, /* @__PURE__ */ new Set()); | |
| 2568 | - } | |
| 2569 | - map.get(event).add(listener); | |
| 2570 | - }, | |
| 2571 | - off(event, listener) { | |
| 2572 | - map.get(event)?.delete(listener); | |
| 2573 | - } | |
| 2574 | - }; | |
| 2575 | - } | |
| 2576 | - | |
| 2577 | - // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs | |
| 2578 | - var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); | |
| 2579 | - var FloatingNodeContext = /* @__PURE__ */ React16.createContext(null); | |
| 2580 | - if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; | |
| 2581 | - var FloatingTreeContext = /* @__PURE__ */ React16.createContext(null); | |
| 2582 | - if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; | |
| 2583 | - var useFloatingParentNodeId = () => React16.useContext(FloatingNodeContext)?.id || null; | |
| 2584 | - var useFloatingTree = (externalTree) => { | |
| 2585 | - const contextTree = React16.useContext(FloatingTreeContext); | |
| 2586 | - return externalTree ?? contextTree; | |
| 2587 | - }; | |
| 2588 | - | |
| 2589 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs | |
| 2590 | - var React17 = __toESM(require_react(), 1); | |
| 2591 | - function createVirtualElement(domElement, data) { | |
| 2592 | - let offsetX = null; | |
| 2593 | - let offsetY = null; | |
| 2594 | - let isAutoUpdateEvent = false; | |
| 2595 | - return { | |
| 2596 | - contextElement: domElement || void 0, | |
| 2597 | - getBoundingClientRect() { | |
| 2598 | - const domRect = domElement?.getBoundingClientRect() || { | |
| 2599 | - width: 0, | |
| 2600 | - height: 0, | |
| 2601 | - x: 0, | |
| 2602 | - y: 0 | |
| 2603 | - }; | |
| 2604 | - const isXAxis = data.axis === "x" || data.axis === "both"; | |
| 2605 | - const isYAxis = data.axis === "y" || data.axis === "both"; | |
| 2606 | - const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; | |
| 2607 | - let width = domRect.width; | |
| 2608 | - let height = domRect.height; | |
| 2609 | - let x = domRect.x; | |
| 2610 | - let y = domRect.y; | |
| 2611 | - if (offsetX == null && data.x && isXAxis) { | |
| 2612 | - offsetX = domRect.x - data.x; | |
| 2613 | - } | |
| 2614 | - if (offsetY == null && data.y && isYAxis) { | |
| 2615 | - offsetY = domRect.y - data.y; | |
| 2616 | - } | |
| 2617 | - x -= offsetX || 0; | |
| 2618 | - y -= offsetY || 0; | |
| 2619 | - width = 0; | |
| 2620 | - height = 0; | |
| 2621 | - if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { | |
| 2622 | - width = data.axis === "y" ? domRect.width : 0; | |
| 2623 | - height = data.axis === "x" ? domRect.height : 0; | |
| 2624 | - x = isXAxis && data.x != null ? data.x : x; | |
| 2625 | - y = isYAxis && data.y != null ? data.y : y; | |
| 2626 | - } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { | |
| 2627 | - height = data.axis === "x" ? domRect.height : height; | |
| 2628 | - width = data.axis === "y" ? domRect.width : width; | |
| 2629 | - } | |
| 2630 | - isAutoUpdateEvent = true; | |
| 2631 | - return { | |
| 2632 | - width, | |
| 2633 | - height, | |
| 2634 | - x, | |
| 2635 | - y, | |
| 2636 | - top: y, | |
| 2637 | - right: x + width, | |
| 2638 | - bottom: y + height, | |
| 2639 | - left: x | |
| 2640 | - }; | |
| 2641 | - } | |
| 2642 | - }; | |
| 2643 | - } | |
| 2644 | - function isMouseBasedEvent(event) { | |
| 2645 | - return event != null && event.clientX != null; | |
| 2646 | - } | |
| 2647 | - function useClientPoint(context, props = {}) { | |
| 2648 | - const { | |
| 2649 | - enabled = true, | |
| 2650 | - axis = "both" | |
| 2651 | - } = props; | |
| 2652 | - const store2 = "rootStore" in context ? context.rootStore : context; | |
| 2653 | - const open = store2.useState("open"); | |
| 2654 | - const floating = store2.useState("floatingElement"); | |
| 2655 | - const domReference = store2.useState("domReferenceElement"); | |
| 2656 | - const dataRef = store2.context.dataRef; | |
| 2657 | - const initialRef = React17.useRef(false); | |
| 2658 | - const cleanupListenerRef = React17.useRef(null); | |
| 2659 | - const [pointerType, setPointerType] = React17.useState(); | |
| 2660 | - const [reactive, setReactive] = React17.useState([]); | |
| 2661 | - const resetReference = useStableCallback((reference2) => { | |
| 2662 | - store2.set("positionReference", reference2); | |
| 2663 | - }); | |
| 2664 | - const setReference = useStableCallback((newX, newY, referenceElement) => { | |
| 2665 | - if (initialRef.current) { | |
| 2666 | - return; | |
| 2667 | - } | |
| 2668 | - if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { | |
| 2669 | - return; | |
| 2670 | - } | |
| 2671 | - store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, { | |
| 2672 | - x: newX, | |
| 2673 | - y: newY, | |
| 2674 | - axis, | |
| 2675 | - dataRef, | |
| 2676 | - pointerType | |
| 2677 | - })); | |
| 2678 | - }); | |
| 2679 | - const handleReferenceEnterOrMove = useStableCallback((event) => { | |
| 2680 | - if (!open) { | |
| 2681 | - setReference(event.clientX, event.clientY, event.currentTarget); | |
| 2682 | - } else if (!cleanupListenerRef.current) { | |
| 2683 | - setReference(event.clientX, event.clientY, event.currentTarget); | |
| 2684 | - setReactive([]); | |
| 2685 | - } | |
| 2686 | - }); | |
| 2687 | - const openCheck = isMouseLikePointerType(pointerType) ? floating : open; | |
| 2688 | - React17.useEffect(() => { | |
| 2689 | - if (!enabled) { | |
| 2690 | - resetReference(domReference); | |
| 2691 | - return void 0; | |
| 2692 | - } | |
| 2693 | - if (!openCheck) { | |
| 2694 | - return void 0; | |
| 2695 | - } | |
| 2696 | - function cleanupListener() { | |
| 2697 | - cleanupListenerRef.current?.(); | |
| 2698 | - cleanupListenerRef.current = null; | |
| 2699 | - } | |
| 2700 | - const win = getWindow(floating); | |
| 2701 | - function handleMouseMove(event) { | |
| 2702 | - const target = getTarget(event); | |
| 2703 | - if (!contains(floating, target)) { | |
| 2704 | - setReference(event.clientX, event.clientY); | |
| 2705 | - } else { | |
| 2706 | - cleanupListener(); | |
| 2707 | - } | |
| 2708 | - } | |
| 2709 | - if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { | |
| 2710 | - cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); | |
| 2711 | - } else { | |
| 2712 | - resetReference(domReference); | |
| 2713 | - } | |
| 2714 | - return cleanupListener; | |
| 2715 | - }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]); | |
| 2716 | - React17.useEffect(() => () => { | |
| 2717 | - store2.set("positionReference", null); | |
| 2718 | - }, [store2]); | |
| 2719 | - React17.useEffect(() => { | |
| 2720 | - if (enabled && !floating) { | |
| 2721 | - initialRef.current = false; | |
| 2722 | - } | |
| 2723 | - }, [enabled, floating]); | |
| 2724 | - React17.useEffect(() => { | |
| 2725 | - if (!enabled && open) { | |
| 2726 | - initialRef.current = true; | |
| 2727 | - } | |
| 2728 | - }, [enabled, open]); | |
| 2729 | - const reference = React17.useMemo(() => { | |
| 2730 | - function setPointerTypeRef(event) { | |
| 2731 | - setPointerType(event.pointerType); | |
| 2732 | - } | |
| 2733 | - return { | |
| 2734 | - onPointerDown: setPointerTypeRef, | |
| 2735 | - onPointerEnter: setPointerTypeRef, | |
| 2736 | - onMouseMove: handleReferenceEnterOrMove, | |
| 2737 | - onMouseEnter: handleReferenceEnterOrMove | |
| 2738 | - }; | |
| 2739 | - }, [handleReferenceEnterOrMove]); | |
| 2740 | - return React17.useMemo(() => enabled ? { | |
| 2741 | - reference, | |
| 2742 | - trigger: reference | |
| 2743 | - } : {}, [enabled, reference]); | |
| 2744 | - } | |
| 2745 | - | |
| 2746 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs | |
| 2747 | - var React18 = __toESM(require_react(), 1); | |
| 2748 | - function alwaysFalse() { | |
| 2749 | - return false; | |
| 2750 | - } | |
| 2751 | - function normalizeProp(normalizable) { | |
| 2752 | - return { | |
| 2753 | - escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, | |
| 2754 | - outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true | |
| 2755 | - }; | |
| 2756 | - } | |
| 2757 | - function useDismiss(context, props = {}) { | |
| 2758 | - const { | |
| 2759 | - enabled = true, | |
| 2760 | - escapeKey: escapeKey2 = true, | |
| 2761 | - outsidePress: outsidePressProp = true, | |
| 2762 | - outsidePressEvent = "sloppy", | |
| 2763 | - referencePress = alwaysFalse, | |
| 2764 | - bubbles, | |
| 2765 | - externalTree | |
| 2766 | - } = props; | |
| 2767 | - const store2 = "rootStore" in context ? context.rootStore : context; | |
| 2768 | - const open = store2.useState("open"); | |
| 2769 | - const floatingElement = store2.useState("floatingElement"); | |
| 2770 | - const { | |
| 2771 | - dataRef | |
| 2772 | - } = store2.context; | |
| 2773 | - const tree = useFloatingTree(externalTree); | |
| 2774 | - const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); | |
| 2775 | - const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; | |
| 2776 | - const outsidePressEnabled = outsidePress2 !== false; | |
| 2777 | - const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); | |
| 2778 | - const { | |
| 2779 | - escapeKey: escapeKeyBubbles, | |
| 2780 | - outsidePress: outsidePressBubbles | |
| 2781 | - } = normalizeProp(bubbles); | |
| 2782 | - const pressStartedInsideRef = React18.useRef(false); | |
| 2783 | - const pressStartPreventedRef = React18.useRef(false); | |
| 2784 | - const suppressNextOutsideClickRef = React18.useRef(false); | |
| 2785 | - const isComposingRef = React18.useRef(false); | |
| 2786 | - const currentPointerTypeRef = React18.useRef(""); | |
| 2787 | - const touchStateRef = React18.useRef(null); | |
| 2788 | - const cancelDismissOnEndTimeout = useTimeout(); | |
| 2789 | - const clearInsideReactTreeTimeout = useTimeout(); | |
| 2790 | - const clearInsideReactTree = useStableCallback(() => { | |
| 2791 | - clearInsideReactTreeTimeout.clear(); | |
| 2792 | - dataRef.current.insideReactTree = false; | |
| 2793 | - }); | |
| 2794 | - const hasBlockingChild = useStableCallback((bubbleKey) => { | |
| 2795 | - const nodeId = dataRef.current.floatingContext?.nodeId; | |
| 2796 | - const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; | |
| 2797 | - return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); | |
| 2798 | - }); | |
| 2799 | - const isEventWithinOwnElements = useStableCallback((event) => { | |
| 2800 | - return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement")); | |
| 2801 | - }); | |
| 2802 | - const closeOnReferencePress = useStableCallback((event) => { | |
| 2803 | - if (!referencePress()) { | |
| 2804 | - return; | |
| 2805 | - } | |
| 2806 | - store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); | |
| 2807 | - }); | |
| 2808 | - const closeOnEscapeKeyDown = useStableCallback((event) => { | |
| 2809 | - if (!open || !enabled || !escapeKey2 || event.key !== "Escape") { | |
| 2810 | - return; | |
| 2811 | - } | |
| 2812 | - if (isComposingRef.current) { | |
| 2813 | - return; | |
| 2814 | - } | |
| 2815 | - if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { | |
| 2816 | - return; | |
| 2817 | - } | |
| 2818 | - const native = isReactEvent(event) ? event.nativeEvent : event; | |
| 2819 | - const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); | |
| 2820 | - store2.setOpen(false, eventDetails); | |
| 2821 | - if (!eventDetails.isCanceled) { | |
| 2822 | - event.preventDefault(); | |
| 2823 | - } | |
| 2824 | - if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { | |
| 2825 | - event.stopPropagation(); | |
| 2826 | - } | |
| 2827 | - }); | |
| 2828 | - const markInsideReactTree = useStableCallback(() => { | |
| 2829 | - dataRef.current.insideReactTree = true; | |
| 2830 | - clearInsideReactTreeTimeout.start(0, clearInsideReactTree); | |
| 2831 | - }); | |
| 2832 | - const markPressStartedInsideReactTree = useStableCallback((event) => { | |
| 2833 | - if (!open || !enabled || event.button !== 0) { | |
| 2834 | - return; | |
| 2835 | - } | |
| 2836 | - const target = getTarget(event.nativeEvent); | |
| 2837 | - if (!contains(store2.select("floatingElement"), target)) { | |
| 2838 | - return; | |
| 2839 | - } | |
| 2840 | - if (!pressStartedInsideRef.current) { | |
| 2841 | - pressStartedInsideRef.current = true; | |
| 2842 | - pressStartPreventedRef.current = false; | |
| 2843 | - } | |
| 2844 | - }); | |
| 2845 | - const markInsidePressStartPrevented = useStableCallback((event) => { | |
| 2846 | - if (!open || !enabled) { | |
| 2847 | - return; | |
| 2848 | - } | |
| 2849 | - if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { | |
| 2850 | - return; | |
| 2851 | - } | |
| 2852 | - if (pressStartedInsideRef.current) { | |
| 2853 | - pressStartPreventedRef.current = true; | |
| 2854 | - } | |
| 2855 | - }); | |
| 2856 | - React18.useEffect(() => { | |
| 2857 | - if (!open || !enabled) { | |
| 2858 | - return void 0; | |
| 2859 | - } | |
| 2860 | - dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; | |
| 2861 | - dataRef.current.__outsidePressBubbles = outsidePressBubbles; | |
| 2862 | - const compositionTimeout = new Timeout(); | |
| 2863 | - const preventedPressSuppressionTimeout = new Timeout(); | |
| 2864 | - function handleCompositionStart() { | |
| 2865 | - compositionTimeout.clear(); | |
| 2866 | - isComposingRef.current = true; | |
| 2867 | - } | |
| 2868 | - function handleCompositionEnd() { | |
| 2869 | - compositionTimeout.start( | |
| 2870 | - // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. | |
| 2871 | - // Only apply to WebKit for the test to remain 0ms. | |
| 2872 | - parts_exports.engine.webkit ? 5 : 0, | |
| 2873 | - () => { | |
| 2874 | - isComposingRef.current = false; | |
| 2875 | - } | |
| 2876 | - ); | |
| 2877 | - } | |
| 2878 | - function suppressImmediateOutsideClickAfterPreventedStart() { | |
| 2879 | - suppressNextOutsideClickRef.current = true; | |
| 2880 | - preventedPressSuppressionTimeout.start(0, () => { | |
| 2881 | - suppressNextOutsideClickRef.current = false; | |
| 2882 | - }); | |
| 2883 | - } | |
| 2884 | - function resetPressStartState() { | |
| 2885 | - pressStartedInsideRef.current = false; | |
| 2886 | - pressStartPreventedRef.current = false; | |
| 2887 | - } | |
| 2888 | - function getOutsidePressEvent() { | |
| 2889 | - const type = currentPointerTypeRef.current; | |
| 2890 | - const computedType = type === "pen" || !type ? "mouse" : type; | |
| 2891 | - const outsidePressEventValue = getOutsidePressEventProp(); | |
| 2892 | - const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; | |
| 2893 | - if (typeof resolved === "string") { | |
| 2894 | - return resolved; | |
| 2895 | - } | |
| 2896 | - return resolved[computedType]; | |
| 2897 | - } | |
| 2898 | - function shouldIgnoreEvent(event) { | |
| 2899 | - const computedOutsidePressEvent = getOutsidePressEvent(); | |
| 2900 | - return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; | |
| 2901 | - } | |
| 2902 | - function isEventWithinFloatingTree(event) { | |
| 2903 | - const nodeId = dataRef.current.floatingContext?.nodeId; | |
| 2904 | - const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); | |
| 2905 | - return isEventWithinOwnElements(event) || targetIsInsideChildren; | |
| 2906 | - } | |
| 2907 | - function closeOnPressOutside(event) { | |
| 2908 | - if (shouldIgnoreEvent(event)) { | |
| 2909 | - if (event.type !== "click" && !isEventWithinOwnElements(event)) { | |
| 2910 | - preventedPressSuppressionTimeout.clear(); | |
| 2911 | - suppressNextOutsideClickRef.current = false; | |
| 2912 | - } | |
| 2913 | - clearInsideReactTree(); | |
| 2914 | - return; | |
| 2915 | - } | |
| 2916 | - if (dataRef.current.insideReactTree) { | |
| 2917 | - clearInsideReactTree(); | |
| 2918 | - return; | |
| 2919 | - } | |
| 2920 | - const target = getTarget(event); | |
| 2921 | - const inertSelector = `[${createAttribute("inert")}]`; | |
| 2922 | - const targetRoot = isElement(target) ? target.getRootNode() : null; | |
| 2923 | - const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector)); | |
| 2924 | - const triggers = store2.context.triggerElements; | |
| 2925 | - if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { | |
| 2926 | - return; | |
| 2927 | - } | |
| 2928 | - let targetRootAncestor = isElement(target) ? target : null; | |
| 2929 | - while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { | |
| 2930 | - const nextParent = getParentNode(targetRootAncestor); | |
| 2931 | - if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { | |
| 2932 | - break; | |
| 2933 | - } | |
| 2934 | - targetRootAncestor = nextParent; | |
| 2935 | - } | |
| 2936 | - if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). | |
| 2937 | - !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the | |
| 2938 | - // element was injected after the floating element rendered. | |
| 2939 | - markers.every((marker) => !contains(targetRootAncestor, marker))) { | |
| 2940 | - return; | |
| 2941 | - } | |
| 2942 | - if (isHTMLElement(target) && !("touches" in event)) { | |
| 2943 | - const lastTraversableNode = isLastTraversableNode(target); | |
| 2944 | - const style = getComputedStyle2(target); | |
| 2945 | - const scrollRe = /auto|scroll/; | |
| 2946 | - const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); | |
| 2947 | - const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); | |
| 2948 | - const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; | |
| 2949 | - const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; | |
| 2950 | - const isRTL3 = style.direction === "rtl"; | |
| 2951 | - const pressedVerticalScrollbar = canScrollY && (isRTL3 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); | |
| 2952 | - const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; | |
| 2953 | - if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { | |
| 2954 | - return; | |
| 2955 | - } | |
| 2956 | - } | |
| 2957 | - if (isEventWithinFloatingTree(event)) { | |
| 2958 | - return; | |
| 2959 | - } | |
| 2960 | - if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) { | |
| 2961 | - preventedPressSuppressionTimeout.clear(); | |
| 2962 | - suppressNextOutsideClickRef.current = false; | |
| 2963 | - return; | |
| 2964 | - } | |
| 2965 | - if (typeof outsidePress2 === "function" && !outsidePress2(event)) { | |
| 2966 | - return; | |
| 2967 | - } | |
| 2968 | - if (hasBlockingChild("__outsidePressBubbles")) { | |
| 2969 | - return; | |
| 2970 | - } | |
| 2971 | - store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); | |
| 2972 | - clearInsideReactTree(); | |
| 2973 | - } | |
| 2974 | - function handlePointerDown(event) { | |
| 2975 | - if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { | |
| 2976 | - return; | |
| 2977 | - } | |
| 2978 | - closeOnPressOutside(event); | |
| 2979 | - } | |
| 2980 | - function handleTouchStart(event) { | |
| 2981 | - if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { | |
| 2982 | - return; | |
| 2983 | - } | |
| 2984 | - const touch = event.touches[0]; | |
| 2985 | - if (touch) { | |
| 2986 | - touchStateRef.current = { | |
| 2987 | - startTime: Date.now(), | |
| 2988 | - startX: touch.clientX, | |
| 2989 | - startY: touch.clientY, | |
| 2990 | - dismissOnTouchEnd: false, | |
| 2991 | - dismissOnMouseDown: true | |
| 2992 | - }; | |
| 2993 | - cancelDismissOnEndTimeout.start(1e3, () => { | |
| 2994 | - if (touchStateRef.current) { | |
| 2995 | - touchStateRef.current.dismissOnTouchEnd = false; | |
| 2996 | - touchStateRef.current.dismissOnMouseDown = false; | |
| 2997 | - } | |
| 2998 | - }); | |
| 2999 | - } | |
| 3000 | - } | |
| 3001 | - function addTargetEventListenerOnce(event, listener) { | |
| 3002 | - const target = getTarget(event); | |
| 3003 | - if (!target) { | |
| 3004 | - return; | |
| 3005 | - } | |
| 3006 | - const unsubscribe2 = addEventListener(target, event.type, () => { | |
| 3007 | - listener(event); | |
| 3008 | - unsubscribe2(); | |
| 3009 | - }); | |
| 3010 | - } | |
| 3011 | - function handleTouchStartCapture(event) { | |
| 3012 | - currentPointerTypeRef.current = "touch"; | |
| 3013 | - addTargetEventListenerOnce(event, handleTouchStart); | |
| 3014 | - } | |
| 3015 | - function closeOnPressOutsideCapture(event) { | |
| 3016 | - cancelDismissOnEndTimeout.clear(); | |
| 3017 | - if (event.type === "pointerdown") { | |
| 3018 | - currentPointerTypeRef.current = event.pointerType; | |
| 3019 | - } | |
| 3020 | - if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { | |
| 3021 | - return; | |
| 3022 | - } | |
| 3023 | - addTargetEventListenerOnce(event, (targetEvent) => { | |
| 3024 | - if (targetEvent.type === "pointerdown") { | |
| 3025 | - handlePointerDown(targetEvent); | |
| 3026 | - } else { | |
| 3027 | - closeOnPressOutside(targetEvent); | |
| 3028 | - } | |
| 3029 | - }); | |
| 3030 | - } | |
| 3031 | - function handlePressEndCapture(event) { | |
| 3032 | - if (!pressStartedInsideRef.current) { | |
| 3033 | - return; | |
| 3034 | - } | |
| 3035 | - const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; | |
| 3036 | - resetPressStartState(); | |
| 3037 | - if (getOutsidePressEvent() !== "intentional") { | |
| 3038 | - return; | |
| 3039 | - } | |
| 3040 | - if (event.type === "pointercancel") { | |
| 3041 | - if (pressStartedInsideDefaultPrevented) { | |
| 3042 | - suppressImmediateOutsideClickAfterPreventedStart(); | |
| 3043 | - } | |
| 3044 | - return; | |
| 3045 | - } | |
| 3046 | - if (isEventWithinFloatingTree(event)) { | |
| 3047 | - return; | |
| 3048 | - } | |
| 3049 | - if (pressStartedInsideDefaultPrevented) { | |
| 3050 | - suppressImmediateOutsideClickAfterPreventedStart(); | |
| 3051 | - return; | |
| 3052 | - } | |
| 3053 | - if (typeof outsidePress2 === "function" && !outsidePress2(event)) { | |
| 3054 | - return; | |
| 3055 | - } | |
| 3056 | - preventedPressSuppressionTimeout.clear(); | |
| 3057 | - suppressNextOutsideClickRef.current = true; | |
| 3058 | - clearInsideReactTree(); | |
| 3059 | - } | |
| 3060 | - function handleTouchMove(event) { | |
| 3061 | - if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { | |
| 3062 | - return; | |
| 3063 | - } | |
| 3064 | - const touch = event.touches[0]; | |
| 3065 | - if (!touch) { | |
| 3066 | - return; | |
| 3067 | - } | |
| 3068 | - const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); | |
| 3069 | - const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); | |
| 3070 | - const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); | |
| 3071 | - if (distance > 5) { | |
| 3072 | - touchStateRef.current.dismissOnTouchEnd = true; | |
| 3073 | - } | |
| 3074 | - if (distance > 10) { | |
| 3075 | - closeOnPressOutside(event); | |
| 3076 | - cancelDismissOnEndTimeout.clear(); | |
| 3077 | - touchStateRef.current = null; | |
| 3078 | - } | |
| 3079 | - } | |
| 3080 | - function handleTouchMoveCapture(event) { | |
| 3081 | - addTargetEventListenerOnce(event, handleTouchMove); | |
| 3082 | - } | |
| 3083 | - function handleTouchEnd(event) { | |
| 3084 | - if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { | |
| 3085 | - return; | |
| 3086 | - } | |
| 3087 | - if (touchStateRef.current.dismissOnTouchEnd) { | |
| 3088 | - closeOnPressOutside(event); | |
| 3089 | - } | |
| 3090 | - cancelDismissOnEndTimeout.clear(); | |
| 3091 | - touchStateRef.current = null; | |
| 3092 | - } | |
| 3093 | - function handleTouchEndCapture(event) { | |
| 3094 | - addTargetEventListenerOnce(event, handleTouchEnd); | |
| 3095 | - } | |
| 3096 | - const doc = ownerDocument(floatingElement); | |
| 3097 | - const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, true), addEventListener(doc, "touchmove", handleTouchMoveCapture, true), addEventListener(doc, "touchend", handleTouchEndCapture, true))); | |
| 3098 | - return () => { | |
| 3099 | - unsubscribe(); | |
| 3100 | - compositionTimeout.clear(); | |
| 3101 | - preventedPressSuppressionTimeout.clear(); | |
| 3102 | - resetPressStartState(); | |
| 3103 | - suppressNextOutsideClickRef.current = false; | |
| 3104 | - }; | |
| 3105 | - }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout]); | |
| 3106 | - React18.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]); | |
| 3107 | - const reference = React18.useMemo(() => ({ | |
| 3108 | - onKeyDown: closeOnEscapeKeyDown, | |
| 3109 | - onPointerDown: closeOnReferencePress, | |
| 3110 | - onClick: closeOnReferencePress | |
| 3111 | - }), [closeOnEscapeKeyDown, closeOnReferencePress]); | |
| 3112 | - const floating = React18.useMemo(() => ({ | |
| 3113 | - onKeyDown: closeOnEscapeKeyDown, | |
| 3114 | - // `onMouseDown` may be blocked if `event.preventDefault()` is called in | |
| 3115 | - // `onPointerDown`, such as with <NumberField.ScrubArea>. | |
| 3116 | - // See https://github.com/mui/base-ui/pull/3379 | |
| 3117 | - onPointerDown: markInsidePressStartPrevented, | |
| 3118 | - onMouseDown: markInsidePressStartPrevented, | |
| 3119 | - onClickCapture: markInsideReactTree, | |
| 3120 | - onMouseDownCapture(event) { | |
| 3121 | - markInsideReactTree(); | |
| 3122 | - markPressStartedInsideReactTree(event); | |
| 3123 | - }, | |
| 3124 | - onPointerDownCapture(event) { | |
| 3125 | - markInsideReactTree(); | |
| 3126 | - markPressStartedInsideReactTree(event); | |
| 3127 | - }, | |
| 3128 | - onMouseUpCapture: markInsideReactTree, | |
| 3129 | - onTouchEndCapture: markInsideReactTree, | |
| 3130 | - onTouchMoveCapture: markInsideReactTree | |
| 3131 | - }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); | |
| 3132 | - return React18.useMemo(() => enabled ? { | |
| 3133 | - reference, | |
| 3134 | - floating, | |
| 3135 | - trigger: reference | |
| 3136 | - } : {}, [enabled, reference, floating]); | |
| 3137 | - } | |
| 3138 | - | |
| 3139 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs | |
| 3140 | - var React25 = __toESM(require_react(), 1); | |
| 3141 | - | |
| 3142 | - // node_modules/@floating-ui/core/dist/floating-ui.core.mjs | |
| 3143 | - function computeCoordsFromPlacement(_ref, placement, rtl) { | |
| 3144 | - let { | |
| 3145 | - reference, | |
| 3146 | - floating | |
| 3147 | - } = _ref; | |
| 3148 | - const sideAxis = getSideAxis(placement); | |
| 3149 | - const alignmentAxis = getAlignmentAxis(placement); | |
| 3150 | - const alignLength = getAxisLength(alignmentAxis); | |
| 3151 | - const side = getSide(placement); | |
| 3152 | - const isVertical = sideAxis === "y"; | |
| 3153 | - const commonX = reference.x + reference.width / 2 - floating.width / 2; | |
| 3154 | - const commonY = reference.y + reference.height / 2 - floating.height / 2; | |
| 3155 | - const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; | |
| 3156 | - let coords; | |
| 3157 | - switch (side) { | |
| 3158 | - case "top": | |
| 3159 | - coords = { | |
| 3160 | - x: commonX, | |
| 3161 | - y: reference.y - floating.height | |
| 3162 | - }; | |
| 3163 | - break; | |
| 3164 | - case "bottom": | |
| 3165 | - coords = { | |
| 3166 | - x: commonX, | |
| 3167 | - y: reference.y + reference.height | |
| 3168 | - }; | |
| 3169 | - break; | |
| 3170 | - case "right": | |
| 3171 | - coords = { | |
| 3172 | - x: reference.x + reference.width, | |
| 3173 | - y: commonY | |
| 3174 | - }; | |
| 3175 | - break; | |
| 3176 | - case "left": | |
| 3177 | - coords = { | |
| 3178 | - x: reference.x - floating.width, | |
| 3179 | - y: commonY | |
| 3180 | - }; | |
| 3181 | - break; | |
| 3182 | - default: | |
| 3183 | - coords = { | |
| 3184 | - x: reference.x, | |
| 3185 | - y: reference.y | |
| 3186 | - }; | |
| 3187 | - } | |
| 3188 | - switch (getAlignment(placement)) { | |
| 3189 | - case "start": | |
| 3190 | - coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); | |
| 3191 | - break; | |
| 3192 | - case "end": | |
| 3193 | - coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); | |
| 3194 | - break; | |
| 3195 | - } | |
| 3196 | - return coords; | |
| 3197 | - } | |
| 3198 | - async function detectOverflow(state, options) { | |
| 3199 | - var _await$platform$isEle; | |
| 3200 | - if (options === void 0) { | |
| 3201 | - options = {}; | |
| 3202 | - } | |
| 3203 | - const { | |
| 3204 | - x, | |
| 3205 | - y, | |
| 3206 | - platform: platform3, | |
| 3207 | - rects, | |
| 3208 | - elements, | |
| 3209 | - strategy | |
| 3210 | - } = state; | |
| 3211 | - const { | |
| 3212 | - boundary = "clippingAncestors", | |
| 3213 | - rootBoundary = "viewport", | |
| 3214 | - elementContext = "floating", | |
| 3215 | - altBoundary = false, | |
| 3216 | - padding = 0 | |
| 3217 | - } = evaluate(options, state); | |
| 3218 | - const paddingObject = getPaddingObject(padding); | |
| 3219 | - const altContext = elementContext === "floating" ? "reference" : "floating"; | |
| 3220 | - const element = elements[altBoundary ? altContext : elementContext]; | |
| 3221 | - const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ | |
| 3222 | - element: ((_await$platform$isEle = await (platform3.isElement == null ? void 0 : platform3.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform3.getDocumentElement == null ? void 0 : platform3.getDocumentElement(elements.floating)), | |
| 3223 | - boundary, | |
| 3224 | - rootBoundary, | |
| 3225 | - strategy | |
| 3226 | - })); | |
| 3227 | - const rect = elementContext === "floating" ? { | |
| 3228 | - x, | |
| 3229 | - y, | |
| 3230 | - width: rects.floating.width, | |
| 3231 | - height: rects.floating.height | |
| 3232 | - } : rects.reference; | |
| 3233 | - const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); | |
| 3234 | - const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { | |
| 3235 | - x: 1, | |
| 3236 | - y: 1 | |
| 3237 | - } : { | |
| 3238 | - x: 1, | |
| 3239 | - y: 1 | |
| 3240 | - }; | |
| 3241 | - const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ | |
| 3242 | - elements, | |
| 3243 | - rect, | |
| 3244 | - offsetParent, | |
| 3245 | - strategy | |
| 3246 | - }) : rect); | |
| 3247 | - return { | |
| 3248 | - top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, | |
| 3249 | - bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, | |
| 3250 | - left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, | |
| 3251 | - right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x | |
| 3252 | - }; | |
| 3253 | - } | |
| 3254 | - var MAX_RESET_COUNT = 50; | |
| 3255 | - var computePosition = async (reference, floating, config) => { | |
| 3256 | - const { | |
| 3257 | - placement = "bottom", | |
| 3258 | - strategy = "absolute", | |
| 3259 | - middleware = [], | |
| 3260 | - platform: platform3 | |
| 3261 | - } = config; | |
| 3262 | - const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { | |
| 3263 | - ...platform3, | |
| 3264 | - detectOverflow | |
| 3265 | - }; | |
| 3266 | - const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); | |
| 3267 | - let rects = await platform3.getElementRects({ | |
| 3268 | - reference, | |
| 3269 | - floating, | |
| 3270 | - strategy | |
| 3271 | - }); | |
| 3272 | - let { | |
| 3273 | - x, | |
| 3274 | - y | |
| 3275 | - } = computeCoordsFromPlacement(rects, placement, rtl); | |
| 3276 | - let statefulPlacement = placement; | |
| 3277 | - let resetCount = 0; | |
| 3278 | - const middlewareData = {}; | |
| 3279 | - for (let i = 0; i < middleware.length; i++) { | |
| 3280 | - const currentMiddleware = middleware[i]; | |
| 3281 | - if (!currentMiddleware) { | |
| 3282 | - continue; | |
| 3283 | - } | |
| 3284 | - const { | |
| 3285 | - name, | |
| 3286 | - fn | |
| 3287 | - } = currentMiddleware; | |
| 3288 | - const { | |
| 3289 | - x: nextX, | |
| 3290 | - y: nextY, | |
| 3291 | - data, | |
| 3292 | - reset | |
| 3293 | - } = await fn({ | |
| 3294 | - x, | |
| 3295 | - y, | |
| 3296 | - initialPlacement: placement, | |
| 3297 | - placement: statefulPlacement, | |
| 3298 | - strategy, | |
| 3299 | - middlewareData, | |
| 3300 | - rects, | |
| 3301 | - platform: platformWithDetectOverflow, | |
| 3302 | - elements: { | |
| 3303 | - reference, | |
| 3304 | - floating | |
| 3305 | - } | |
| 3306 | - }); | |
| 3307 | - x = nextX != null ? nextX : x; | |
| 3308 | - y = nextY != null ? nextY : y; | |
| 3309 | - middlewareData[name] = { | |
| 3310 | - ...middlewareData[name], | |
| 3311 | - ...data | |
| 3312 | - }; | |
| 3313 | - if (reset && resetCount < MAX_RESET_COUNT) { | |
| 3314 | - resetCount++; | |
| 3315 | - if (typeof reset === "object") { | |
| 3316 | - if (reset.placement) { | |
| 3317 | - statefulPlacement = reset.placement; | |
| 3318 | - } | |
| 3319 | - if (reset.rects) { | |
| 3320 | - rects = reset.rects === true ? await platform3.getElementRects({ | |
| 3321 | - reference, | |
| 3322 | - floating, | |
| 3323 | - strategy | |
| 3324 | - }) : reset.rects; | |
| 3325 | - } | |
| 3326 | - ({ | |
| 3327 | - x, | |
| 3328 | - y | |
| 3329 | - } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); | |
| 3330 | - } | |
| 3331 | - i = -1; | |
| 3332 | - } | |
| 3333 | - } | |
| 3334 | - return { | |
| 3335 | - x, | |
| 3336 | - y, | |
| 3337 | - placement: statefulPlacement, | |
| 3338 | - strategy, | |
| 3339 | - middlewareData | |
| 3340 | - }; | |
| 3341 | - }; | |
| 3342 | - var flip = function(options) { | |
| 3343 | - if (options === void 0) { | |
| 3344 | - options = {}; | |
| 3345 | - } | |
| 3346 | - return { | |
| 3347 | - name: "flip", | |
| 3348 | - options, | |
| 3349 | - async fn(state) { | |
| 3350 | - var _middlewareData$arrow, _middlewareData$flip; | |
| 3351 | - const { | |
| 3352 | - placement, | |
| 3353 | - middlewareData, | |
| 3354 | - rects, | |
| 3355 | - initialPlacement, | |
| 3356 | - platform: platform3, | |
| 3357 | - elements | |
| 3358 | - } = state; | |
| 3359 | - const { | |
| 3360 | - mainAxis: checkMainAxis = true, | |
| 3361 | - crossAxis: checkCrossAxis = true, | |
| 3362 | - fallbackPlacements: specifiedFallbackPlacements, | |
| 3363 | - fallbackStrategy = "bestFit", | |
| 3364 | - fallbackAxisSideDirection = "none", | |
| 3365 | - flipAlignment = true, | |
| 3366 | - ...detectOverflowOptions | |
| 3367 | - } = evaluate(options, state); | |
| 3368 | - if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { | |
| 3369 | - return {}; | |
| 3370 | - } | |
| 3371 | - const side = getSide(placement); | |
| 3372 | - const initialSideAxis = getSideAxis(initialPlacement); | |
| 3373 | - const isBasePlacement = getSide(initialPlacement) === initialPlacement; | |
| 3374 | - const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); | |
| 3375 | - const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); | |
| 3376 | - const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; | |
| 3377 | - if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { | |
| 3378 | - fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); | |
| 3379 | - } | |
| 3380 | - const placements2 = [initialPlacement, ...fallbackPlacements]; | |
| 3381 | - const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 3382 | - const overflows = []; | |
| 3383 | - let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; | |
| 3384 | - if (checkMainAxis) { | |
| 3385 | - overflows.push(overflow[side]); | |
| 3386 | - } | |
| 3387 | - if (checkCrossAxis) { | |
| 3388 | - const sides2 = getAlignmentSides(placement, rects, rtl); | |
| 3389 | - overflows.push(overflow[sides2[0]], overflow[sides2[1]]); | |
| 3390 | - } | |
| 3391 | - overflowsData = [...overflowsData, { | |
| 3392 | - placement, | |
| 3393 | - overflows | |
| 3394 | - }]; | |
| 3395 | - if (!overflows.every((side2) => side2 <= 0)) { | |
| 3396 | - var _middlewareData$flip2, _overflowsData$filter; | |
| 3397 | - const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; | |
| 3398 | - const nextPlacement = placements2[nextIndex]; | |
| 3399 | - if (nextPlacement) { | |
| 3400 | - const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; | |
| 3401 | - if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis | |
| 3402 | - // overflows the main axis. | |
| 3403 | - overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { | |
| 3404 | - return { | |
| 3405 | - data: { | |
| 3406 | - index: nextIndex, | |
| 3407 | - overflows: overflowsData | |
| 3408 | - }, | |
| 3409 | - reset: { | |
| 3410 | - placement: nextPlacement | |
| 3411 | - } | |
| 3412 | - }; | |
| 3413 | - } | |
| 3414 | - } | |
| 3415 | - let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; | |
| 3416 | - if (!resetPlacement) { | |
| 3417 | - switch (fallbackStrategy) { | |
| 3418 | - case "bestFit": { | |
| 3419 | - var _overflowsData$filter2; | |
| 3420 | - const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { | |
| 3421 | - if (hasFallbackAxisSideDirection) { | |
| 3422 | - const currentSideAxis = getSideAxis(d.placement); | |
| 3423 | - return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal | |
| 3424 | - // reading directions favoring greater width. | |
| 3425 | - currentSideAxis === "y"; | |
| 3426 | - } | |
| 3427 | - return true; | |
| 3428 | - }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; | |
| 3429 | - if (placement2) { | |
| 3430 | - resetPlacement = placement2; | |
| 3431 | - } | |
| 3432 | - break; | |
| 3433 | - } | |
| 3434 | - case "initialPlacement": | |
| 3435 | - resetPlacement = initialPlacement; | |
| 3436 | - break; | |
| 3437 | - } | |
| 3438 | - } | |
| 3439 | - if (placement !== resetPlacement) { | |
| 3440 | - return { | |
| 3441 | - reset: { | |
| 3442 | - placement: resetPlacement | |
| 3443 | - } | |
| 3444 | - }; | |
| 3445 | - } | |
| 3446 | - } | |
| 3447 | - return {}; | |
| 3448 | - } | |
| 3449 | - }; | |
| 3450 | - }; | |
| 3451 | - function getSideOffsets(overflow, rect) { | |
| 3452 | - return { | |
| 3453 | - top: overflow.top - rect.height, | |
| 3454 | - right: overflow.right - rect.width, | |
| 3455 | - bottom: overflow.bottom - rect.height, | |
| 3456 | - left: overflow.left - rect.width | |
| 3457 | - }; | |
| 3458 | - } | |
| 3459 | - function isAnySideFullyClipped(overflow) { | |
| 3460 | - return sides.some((side) => overflow[side] >= 0); | |
| 3461 | - } | |
| 3462 | - var hide = function(options) { | |
| 3463 | - if (options === void 0) { | |
| 3464 | - options = {}; | |
| 3465 | - } | |
| 3466 | - return { | |
| 3467 | - name: "hide", | |
| 3468 | - options, | |
| 3469 | - async fn(state) { | |
| 3470 | - const { | |
| 3471 | - rects, | |
| 3472 | - platform: platform3 | |
| 3473 | - } = state; | |
| 3474 | - const { | |
| 3475 | - strategy = "referenceHidden", | |
| 3476 | - ...detectOverflowOptions | |
| 3477 | - } = evaluate(options, state); | |
| 3478 | - switch (strategy) { | |
| 3479 | - case "referenceHidden": { | |
| 3480 | - const overflow = await platform3.detectOverflow(state, { | |
| 3481 | - ...detectOverflowOptions, | |
| 3482 | - elementContext: "reference" | |
| 3483 | - }); | |
| 3484 | - const offsets = getSideOffsets(overflow, rects.reference); | |
| 3485 | - return { | |
| 3486 | - data: { | |
| 3487 | - referenceHiddenOffsets: offsets, | |
| 3488 | - referenceHidden: isAnySideFullyClipped(offsets) | |
| 3489 | - } | |
| 3490 | - }; | |
| 3491 | - } | |
| 3492 | - case "escaped": { | |
| 3493 | - const overflow = await platform3.detectOverflow(state, { | |
| 3494 | - ...detectOverflowOptions, | |
| 3495 | - altBoundary: true | |
| 3496 | - }); | |
| 3497 | - const offsets = getSideOffsets(overflow, rects.floating); | |
| 3498 | - return { | |
| 3499 | - data: { | |
| 3500 | - escapedOffsets: offsets, | |
| 3501 | - escaped: isAnySideFullyClipped(offsets) | |
| 3502 | - } | |
| 3503 | - }; | |
| 3504 | - } | |
| 3505 | - default: { | |
| 3506 | - return {}; | |
| 3507 | - } | |
| 3508 | - } | |
| 3509 | - } | |
| 3510 | - }; | |
| 3511 | - }; | |
| 3512 | - var originSides = /* @__PURE__ */ new Set(["left", "top"]); | |
| 3513 | - async function convertValueToCoords(state, options) { | |
| 3514 | - const { | |
| 3515 | - placement, | |
| 3516 | - platform: platform3, | |
| 3517 | - elements | |
| 3518 | - } = state; | |
| 3519 | - const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); | |
| 3520 | - const side = getSide(placement); | |
| 3521 | - const alignment = getAlignment(placement); | |
| 3522 | - const isVertical = getSideAxis(placement) === "y"; | |
| 3523 | - const mainAxisMulti = originSides.has(side) ? -1 : 1; | |
| 3524 | - const crossAxisMulti = rtl && isVertical ? -1 : 1; | |
| 3525 | - const rawValue = evaluate(options, state); | |
| 3526 | - let { | |
| 3527 | - mainAxis, | |
| 3528 | - crossAxis, | |
| 3529 | - alignmentAxis | |
| 3530 | - } = typeof rawValue === "number" ? { | |
| 3531 | - mainAxis: rawValue, | |
| 3532 | - crossAxis: 0, | |
| 3533 | - alignmentAxis: null | |
| 3534 | - } : { | |
| 3535 | - mainAxis: rawValue.mainAxis || 0, | |
| 3536 | - crossAxis: rawValue.crossAxis || 0, | |
| 3537 | - alignmentAxis: rawValue.alignmentAxis | |
| 3538 | - }; | |
| 3539 | - if (alignment && typeof alignmentAxis === "number") { | |
| 3540 | - crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; | |
| 3541 | - } | |
| 3542 | - return isVertical ? { | |
| 3543 | - x: crossAxis * crossAxisMulti, | |
| 3544 | - y: mainAxis * mainAxisMulti | |
| 3545 | - } : { | |
| 3546 | - x: mainAxis * mainAxisMulti, | |
| 3547 | - y: crossAxis * crossAxisMulti | |
| 3548 | - }; | |
| 3549 | - } | |
| 3550 | - var offset = function(options) { | |
| 3551 | - if (options === void 0) { | |
| 3552 | - options = 0; | |
| 3553 | - } | |
| 3554 | - return { | |
| 3555 | - name: "offset", | |
| 3556 | - options, | |
| 3557 | - async fn(state) { | |
| 3558 | - var _middlewareData$offse, _middlewareData$arrow; | |
| 3559 | - const { | |
| 3560 | - x, | |
| 3561 | - y, | |
| 3562 | - placement, | |
| 3563 | - middlewareData | |
| 3564 | - } = state; | |
| 3565 | - const diffCoords = await convertValueToCoords(state, options); | |
| 3566 | - if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { | |
| 3567 | - return {}; | |
| 3568 | - } | |
| 3569 | - return { | |
| 3570 | - x: x + diffCoords.x, | |
| 3571 | - y: y + diffCoords.y, | |
| 3572 | - data: { | |
| 3573 | - ...diffCoords, | |
| 3574 | - placement | |
| 3575 | - } | |
| 3576 | - }; | |
| 3577 | - } | |
| 3578 | - }; | |
| 3579 | - }; | |
| 3580 | - var shift = function(options) { | |
| 3581 | - if (options === void 0) { | |
| 3582 | - options = {}; | |
| 3583 | - } | |
| 3584 | - return { | |
| 3585 | - name: "shift", | |
| 3586 | - options, | |
| 3587 | - async fn(state) { | |
| 3588 | - const { | |
| 3589 | - x, | |
| 3590 | - y, | |
| 3591 | - placement, | |
| 3592 | - platform: platform3 | |
| 3593 | - } = state; | |
| 3594 | - const { | |
| 3595 | - mainAxis: checkMainAxis = true, | |
| 3596 | - crossAxis: checkCrossAxis = false, | |
| 3597 | - limiter = { | |
| 3598 | - fn: (_ref) => { | |
| 3599 | - let { | |
| 3600 | - x: x2, | |
| 3601 | - y: y2 | |
| 3602 | - } = _ref; | |
| 3603 | - return { | |
| 3604 | - x: x2, | |
| 3605 | - y: y2 | |
| 3606 | - }; | |
| 3607 | - } | |
| 3608 | - }, | |
| 3609 | - ...detectOverflowOptions | |
| 3610 | - } = evaluate(options, state); | |
| 3611 | - const coords = { | |
| 3612 | - x, | |
| 3613 | - y | |
| 3614 | - }; | |
| 3615 | - const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 3616 | - const crossAxis = getSideAxis(getSide(placement)); | |
| 3617 | - const mainAxis = getOppositeAxis(crossAxis); | |
| 3618 | - let mainAxisCoord = coords[mainAxis]; | |
| 3619 | - let crossAxisCoord = coords[crossAxis]; | |
| 3620 | - if (checkMainAxis) { | |
| 3621 | - const minSide = mainAxis === "y" ? "top" : "left"; | |
| 3622 | - const maxSide = mainAxis === "y" ? "bottom" : "right"; | |
| 3623 | - const min2 = mainAxisCoord + overflow[minSide]; | |
| 3624 | - const max2 = mainAxisCoord - overflow[maxSide]; | |
| 3625 | - mainAxisCoord = clamp(min2, mainAxisCoord, max2); | |
| 3626 | - } | |
| 3627 | - if (checkCrossAxis) { | |
| 3628 | - const minSide = crossAxis === "y" ? "top" : "left"; | |
| 3629 | - const maxSide = crossAxis === "y" ? "bottom" : "right"; | |
| 3630 | - const min2 = crossAxisCoord + overflow[minSide]; | |
| 3631 | - const max2 = crossAxisCoord - overflow[maxSide]; | |
| 3632 | - crossAxisCoord = clamp(min2, crossAxisCoord, max2); | |
| 3633 | - } | |
| 3634 | - const limitedCoords = limiter.fn({ | |
| 3635 | - ...state, | |
| 3636 | - [mainAxis]: mainAxisCoord, | |
| 3637 | - [crossAxis]: crossAxisCoord | |
| 3638 | - }); | |
| 3639 | - return { | |
| 3640 | - ...limitedCoords, | |
| 3641 | - data: { | |
| 3642 | - x: limitedCoords.x - x, | |
| 3643 | - y: limitedCoords.y - y, | |
| 3644 | - enabled: { | |
| 3645 | - [mainAxis]: checkMainAxis, | |
| 3646 | - [crossAxis]: checkCrossAxis | |
| 3647 | - } | |
| 3648 | - } | |
| 3649 | - }; | |
| 3650 | - } | |
| 3651 | - }; | |
| 3652 | - }; | |
| 3653 | - var limitShift = function(options) { | |
| 3654 | - if (options === void 0) { | |
| 3655 | - options = {}; | |
| 3656 | - } | |
| 3657 | - return { | |
| 3658 | - options, | |
| 3659 | - fn(state) { | |
| 3660 | - const { | |
| 3661 | - x, | |
| 3662 | - y, | |
| 3663 | - placement, | |
| 3664 | - rects, | |
| 3665 | - middlewareData | |
| 3666 | - } = state; | |
| 3667 | - const { | |
| 3668 | - offset: offset4 = 0, | |
| 3669 | - mainAxis: checkMainAxis = true, | |
| 3670 | - crossAxis: checkCrossAxis = true | |
| 3671 | - } = evaluate(options, state); | |
| 3672 | - const coords = { | |
| 3673 | - x, | |
| 3674 | - y | |
| 3675 | - }; | |
| 3676 | - const crossAxis = getSideAxis(placement); | |
| 3677 | - const mainAxis = getOppositeAxis(crossAxis); | |
| 3678 | - let mainAxisCoord = coords[mainAxis]; | |
| 3679 | - let crossAxisCoord = coords[crossAxis]; | |
| 3680 | - const rawOffset = evaluate(offset4, state); | |
| 3681 | - const computedOffset = typeof rawOffset === "number" ? { | |
| 3682 | - mainAxis: rawOffset, | |
| 3683 | - crossAxis: 0 | |
| 3684 | - } : { | |
| 3685 | - mainAxis: 0, | |
| 3686 | - crossAxis: 0, | |
| 3687 | - ...rawOffset | |
| 3688 | - }; | |
| 3689 | - if (checkMainAxis) { | |
| 3690 | - const len = mainAxis === "y" ? "height" : "width"; | |
| 3691 | - const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; | |
| 3692 | - const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; | |
| 3693 | - if (mainAxisCoord < limitMin) { | |
| 3694 | - mainAxisCoord = limitMin; | |
| 3695 | - } else if (mainAxisCoord > limitMax) { | |
| 3696 | - mainAxisCoord = limitMax; | |
| 3697 | - } | |
| 3698 | - } | |
| 3699 | - if (checkCrossAxis) { | |
| 3700 | - var _middlewareData$offse, _middlewareData$offse2; | |
| 3701 | - const len = mainAxis === "y" ? "width" : "height"; | |
| 3702 | - const isOriginSide = originSides.has(getSide(placement)); | |
| 3703 | - const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); | |
| 3704 | - const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); | |
| 3705 | - if (crossAxisCoord < limitMin) { | |
| 3706 | - crossAxisCoord = limitMin; | |
| 3707 | - } else if (crossAxisCoord > limitMax) { | |
| 3708 | - crossAxisCoord = limitMax; | |
| 3709 | - } | |
| 3710 | - } | |
| 3711 | - return { | |
| 3712 | - [mainAxis]: mainAxisCoord, | |
| 3713 | - [crossAxis]: crossAxisCoord | |
| 3714 | - }; | |
| 3715 | - } | |
| 3716 | - }; | |
| 3717 | - }; | |
| 3718 | - var size = function(options) { | |
| 3719 | - if (options === void 0) { | |
| 3720 | - options = {}; | |
| 3721 | - } | |
| 3722 | - return { | |
| 3723 | - name: "size", | |
| 3724 | - options, | |
| 3725 | - async fn(state) { | |
| 3726 | - var _state$middlewareData, _state$middlewareData2; | |
| 3727 | - const { | |
| 3728 | - placement, | |
| 3729 | - rects, | |
| 3730 | - platform: platform3, | |
| 3731 | - elements | |
| 3732 | - } = state; | |
| 3733 | - const { | |
| 3734 | - apply = () => { | |
| 3735 | - }, | |
| 3736 | - ...detectOverflowOptions | |
| 3737 | - } = evaluate(options, state); | |
| 3738 | - const overflow = await platform3.detectOverflow(state, detectOverflowOptions); | |
| 3739 | - const side = getSide(placement); | |
| 3740 | - const alignment = getAlignment(placement); | |
| 3741 | - const isYAxis = getSideAxis(placement) === "y"; | |
| 3742 | - const { | |
| 3743 | - width, | |
| 3744 | - height | |
| 3745 | - } = rects.floating; | |
| 3746 | - let heightSide; | |
| 3747 | - let widthSide; | |
| 3748 | - if (side === "top" || side === "bottom") { | |
| 3749 | - heightSide = side; | |
| 3750 | - widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; | |
| 3751 | - } else { | |
| 3752 | - widthSide = side; | |
| 3753 | - heightSide = alignment === "end" ? "top" : "bottom"; | |
| 3754 | - } | |
| 3755 | - const maximumClippingHeight = height - overflow.top - overflow.bottom; | |
| 3756 | - const maximumClippingWidth = width - overflow.left - overflow.right; | |
| 3757 | - const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); | |
| 3758 | - const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); | |
| 3759 | - const noShift = !state.middlewareData.shift; | |
| 3760 | - let availableHeight = overflowAvailableHeight; | |
| 3761 | - let availableWidth = overflowAvailableWidth; | |
| 3762 | - if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { | |
| 3763 | - availableWidth = maximumClippingWidth; | |
| 3764 | - } | |
| 3765 | - if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { | |
| 3766 | - availableHeight = maximumClippingHeight; | |
| 3767 | - } | |
| 3768 | - if (noShift && !alignment) { | |
| 3769 | - const xMin = max(overflow.left, 0); | |
| 3770 | - const xMax = max(overflow.right, 0); | |
| 3771 | - const yMin = max(overflow.top, 0); | |
| 3772 | - const yMax = max(overflow.bottom, 0); | |
| 3773 | - if (isYAxis) { | |
| 3774 | - availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); | |
| 3775 | - } else { | |
| 3776 | - availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); | |
| 3777 | - } | |
| 3778 | - } | |
| 3779 | - await apply({ | |
| 3780 | - ...state, | |
| 3781 | - availableWidth, | |
| 3782 | - availableHeight | |
| 3783 | - }); | |
| 3784 | - const nextDimensions = await platform3.getDimensions(elements.floating); | |
| 3785 | - if (width !== nextDimensions.width || height !== nextDimensions.height) { | |
| 3786 | - return { | |
| 3787 | - reset: { | |
| 3788 | - rects: true | |
| 3789 | - } | |
| 3790 | - }; | |
| 3791 | - } | |
| 3792 | - return {}; | |
| 3793 | - } | |
| 3794 | - }; | |
| 3795 | - }; | |
| 3796 | - | |
| 3797 | - // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs | |
| 3798 | - function getCssDimensions(element) { | |
| 3799 | - const css = getComputedStyle2(element); | |
| 3800 | - let width = parseFloat(css.width) || 0; | |
| 3801 | - let height = parseFloat(css.height) || 0; | |
| 3802 | - const hasOffset = isHTMLElement(element); | |
| 3803 | - const offsetWidth = hasOffset ? element.offsetWidth : width; | |
| 3804 | - const offsetHeight = hasOffset ? element.offsetHeight : height; | |
| 3805 | - const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; | |
| 3806 | - if (shouldFallback) { | |
| 3807 | - width = offsetWidth; | |
| 3808 | - height = offsetHeight; | |
| 3809 | - } | |
| 3810 | - return { | |
| 3811 | - width, | |
| 3812 | - height, | |
| 3813 | - $: shouldFallback | |
| 3814 | - }; | |
| 3815 | - } | |
| 3816 | - function unwrapElement(element) { | |
| 3817 | - return !isElement(element) ? element.contextElement : element; | |
| 3818 | - } | |
| 3819 | - function getScale(element) { | |
| 3820 | - const domElement = unwrapElement(element); | |
| 3821 | - if (!isHTMLElement(domElement)) { | |
| 3822 | - return createCoords(1); | |
| 3823 | - } | |
| 3824 | - const rect = domElement.getBoundingClientRect(); | |
| 3825 | - const { | |
| 3826 | - width, | |
| 3827 | - height, | |
| 3828 | - $ | |
| 3829 | - } = getCssDimensions(domElement); | |
| 3830 | - let x = ($ ? round(rect.width) : rect.width) / width; | |
| 3831 | - let y = ($ ? round(rect.height) : rect.height) / height; | |
| 3832 | - if (!x || !Number.isFinite(x)) { | |
| 3833 | - x = 1; | |
| 3834 | - } | |
| 3835 | - if (!y || !Number.isFinite(y)) { | |
| 3836 | - y = 1; | |
| 3837 | - } | |
| 3838 | - return { | |
| 3839 | - x, | |
| 3840 | - y | |
| 3841 | - }; | |
| 3842 | - } | |
| 3843 | - var noOffsets = /* @__PURE__ */ createCoords(0); | |
| 3844 | - function getVisualOffsets(element) { | |
| 3845 | - const win = getWindow(element); | |
| 3846 | - if (!isWebKit() || !win.visualViewport) { | |
| 3847 | - return noOffsets; | |
| 3848 | - } | |
| 3849 | - return { | |
| 3850 | - x: win.visualViewport.offsetLeft, | |
| 3851 | - y: win.visualViewport.offsetTop | |
| 3852 | - }; | |
| 3853 | - } | |
| 3854 | - function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { | |
| 3855 | - if (isFixed === void 0) { | |
| 3856 | - isFixed = false; | |
| 3857 | - } | |
| 3858 | - if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { | |
| 3859 | - return false; | |
| 3860 | - } | |
| 3861 | - return isFixed; | |
| 3862 | - } | |
| 3863 | - function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { | |
| 3864 | - if (includeScale === void 0) { | |
| 3865 | - includeScale = false; | |
| 3866 | - } | |
| 3867 | - if (isFixedStrategy === void 0) { | |
| 3868 | - isFixedStrategy = false; | |
| 3869 | - } | |
| 3870 | - const clientRect = element.getBoundingClientRect(); | |
| 3871 | - const domElement = unwrapElement(element); | |
| 3872 | - let scale = createCoords(1); | |
| 3873 | - if (includeScale) { | |
| 3874 | - if (offsetParent) { | |
| 3875 | - if (isElement(offsetParent)) { | |
| 3876 | - scale = getScale(offsetParent); | |
| 3877 | - } | |
| 3878 | - } else { | |
| 3879 | - scale = getScale(element); | |
| 3880 | - } | |
| 3881 | - } | |
| 3882 | - const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); | |
| 3883 | - let x = (clientRect.left + visualOffsets.x) / scale.x; | |
| 3884 | - let y = (clientRect.top + visualOffsets.y) / scale.y; | |
| 3885 | - let width = clientRect.width / scale.x; | |
| 3886 | - let height = clientRect.height / scale.y; | |
| 3887 | - if (domElement) { | |
| 3888 | - const win = getWindow(domElement); | |
| 3889 | - const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; | |
| 3890 | - let currentWin = win; | |
| 3891 | - let currentIFrame = getFrameElement(currentWin); | |
| 3892 | - while (currentIFrame && offsetParent && offsetWin !== currentWin) { | |
| 3893 | - const iframeScale = getScale(currentIFrame); | |
| 3894 | - const iframeRect = currentIFrame.getBoundingClientRect(); | |
| 3895 | - const css = getComputedStyle2(currentIFrame); | |
| 3896 | - const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; | |
| 3897 | - const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; | |
| 3898 | - x *= iframeScale.x; | |
| 3899 | - y *= iframeScale.y; | |
| 3900 | - width *= iframeScale.x; | |
| 3901 | - height *= iframeScale.y; | |
| 3902 | - x += left; | |
| 3903 | - y += top; | |
| 3904 | - currentWin = getWindow(currentIFrame); | |
| 3905 | - currentIFrame = getFrameElement(currentWin); | |
| 3906 | - } | |
| 3907 | - } | |
| 3908 | - return rectToClientRect({ | |
| 3909 | - width, | |
| 3910 | - height, | |
| 3911 | - x, | |
| 3912 | - y | |
| 3913 | - }); | |
| 3914 | - } | |
| 3915 | - function getWindowScrollBarX(element, rect) { | |
| 3916 | - const leftScroll = getNodeScroll(element).scrollLeft; | |
| 3917 | - if (!rect) { | |
| 3918 | - return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; | |
| 3919 | - } | |
| 3920 | - return rect.left + leftScroll; | |
| 3921 | - } | |
| 3922 | - function getHTMLOffset(documentElement, scroll) { | |
| 3923 | - const htmlRect = documentElement.getBoundingClientRect(); | |
| 3924 | - const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); | |
| 3925 | - const y = htmlRect.top + scroll.scrollTop; | |
| 3926 | - return { | |
| 3927 | - x, | |
| 3928 | - y | |
| 3929 | - }; | |
| 3930 | - } | |
| 3931 | - function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { | |
| 3932 | - let { | |
| 3933 | - elements, | |
| 3934 | - rect, | |
| 3935 | - offsetParent, | |
| 3936 | - strategy | |
| 3937 | - } = _ref; | |
| 3938 | - const isFixed = strategy === "fixed"; | |
| 3939 | - const documentElement = getDocumentElement(offsetParent); | |
| 3940 | - const topLayer = elements ? isTopLayer(elements.floating) : false; | |
| 3941 | - if (offsetParent === documentElement || topLayer && isFixed) { | |
| 3942 | - return rect; | |
| 3943 | - } | |
| 3944 | - let scroll = { | |
| 3945 | - scrollLeft: 0, | |
| 3946 | - scrollTop: 0 | |
| 3947 | - }; | |
| 3948 | - let scale = createCoords(1); | |
| 3949 | - const offsets = createCoords(0); | |
| 3950 | - const isOffsetParentAnElement = isHTMLElement(offsetParent); | |
| 3951 | - if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { | |
| 3952 | - if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { | |
| 3953 | - scroll = getNodeScroll(offsetParent); | |
| 3954 | - } | |
| 3955 | - if (isOffsetParentAnElement) { | |
| 3956 | - const offsetRect = getBoundingClientRect(offsetParent); | |
| 3957 | - scale = getScale(offsetParent); | |
| 3958 | - offsets.x = offsetRect.x + offsetParent.clientLeft; | |
| 3959 | - offsets.y = offsetRect.y + offsetParent.clientTop; | |
| 3960 | - } | |
| 3961 | - } | |
| 3962 | - const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); | |
| 3963 | - return { | |
| 3964 | - width: rect.width * scale.x, | |
| 3965 | - height: rect.height * scale.y, | |
| 3966 | - x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, | |
| 3967 | - y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y | |
| 3968 | - }; | |
| 3969 | - } | |
| 3970 | - function getClientRects(element) { | |
| 3971 | - return Array.from(element.getClientRects()); | |
| 3972 | - } | |
| 3973 | - function getDocumentRect(element) { | |
| 3974 | - const html = getDocumentElement(element); | |
| 3975 | - const scroll = getNodeScroll(element); | |
| 3976 | - const body = element.ownerDocument.body; | |
| 3977 | - const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); | |
| 3978 | - const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); | |
| 3979 | - let x = -scroll.scrollLeft + getWindowScrollBarX(element); | |
| 3980 | - const y = -scroll.scrollTop; | |
| 3981 | - if (getComputedStyle2(body).direction === "rtl") { | |
| 3982 | - x += max(html.clientWidth, body.clientWidth) - width; | |
| 3983 | - } | |
| 3984 | - return { | |
| 3985 | - width, | |
| 3986 | - height, | |
| 3987 | - x, | |
| 3988 | - y | |
| 3989 | - }; | |
| 3990 | - } | |
| 3991 | - var SCROLLBAR_MAX = 25; | |
| 3992 | - function getViewportRect(element, strategy) { | |
| 3993 | - const win = getWindow(element); | |
| 3994 | - const html = getDocumentElement(element); | |
| 3995 | - const visualViewport = win.visualViewport; | |
| 3996 | - let width = html.clientWidth; | |
| 3997 | - let height = html.clientHeight; | |
| 3998 | - let x = 0; | |
| 3999 | - let y = 0; | |
| 4000 | - if (visualViewport) { | |
| 4001 | - width = visualViewport.width; | |
| 4002 | - height = visualViewport.height; | |
| 4003 | - const visualViewportBased = isWebKit(); | |
| 4004 | - if (!visualViewportBased || visualViewportBased && strategy === "fixed") { | |
| 4005 | - x = visualViewport.offsetLeft; | |
| 4006 | - y = visualViewport.offsetTop; | |
| 4007 | - } | |
| 4008 | - } | |
| 4009 | - const windowScrollbarX = getWindowScrollBarX(html); | |
| 4010 | - if (windowScrollbarX <= 0) { | |
| 4011 | - const doc = html.ownerDocument; | |
| 4012 | - const body = doc.body; | |
| 4013 | - const bodyStyles = getComputedStyle(body); | |
| 4014 | - const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; | |
| 4015 | - const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); | |
| 4016 | - if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { | |
| 4017 | - width -= clippingStableScrollbarWidth; | |
| 4018 | - } | |
| 4019 | - } else if (windowScrollbarX <= SCROLLBAR_MAX) { | |
| 4020 | - width += windowScrollbarX; | |
| 4021 | - } | |
| 4022 | - return { | |
| 4023 | - width, | |
| 4024 | - height, | |
| 4025 | - x, | |
| 4026 | - y | |
| 4027 | - }; | |
| 4028 | - } | |
| 4029 | - function getInnerBoundingClientRect(element, strategy) { | |
| 4030 | - const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); | |
| 4031 | - const top = clientRect.top + element.clientTop; | |
| 4032 | - const left = clientRect.left + element.clientLeft; | |
| 4033 | - const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); | |
| 4034 | - const width = element.clientWidth * scale.x; | |
| 4035 | - const height = element.clientHeight * scale.y; | |
| 4036 | - const x = left * scale.x; | |
| 4037 | - const y = top * scale.y; | |
| 4038 | - return { | |
| 4039 | - width, | |
| 4040 | - height, | |
| 4041 | - x, | |
| 4042 | - y | |
| 4043 | - }; | |
| 4044 | - } | |
| 4045 | - function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { | |
| 4046 | - let rect; | |
| 4047 | - if (clippingAncestor === "viewport") { | |
| 4048 | - rect = getViewportRect(element, strategy); | |
| 4049 | - } else if (clippingAncestor === "document") { | |
| 4050 | - rect = getDocumentRect(getDocumentElement(element)); | |
| 4051 | - } else if (isElement(clippingAncestor)) { | |
| 4052 | - rect = getInnerBoundingClientRect(clippingAncestor, strategy); | |
| 4053 | - } else { | |
| 4054 | - const visualOffsets = getVisualOffsets(element); | |
| 4055 | - rect = { | |
| 4056 | - x: clippingAncestor.x - visualOffsets.x, | |
| 4057 | - y: clippingAncestor.y - visualOffsets.y, | |
| 4058 | - width: clippingAncestor.width, | |
| 4059 | - height: clippingAncestor.height | |
| 4060 | - }; | |
| 4061 | - } | |
| 4062 | - return rectToClientRect(rect); | |
| 4063 | - } | |
| 4064 | - function hasFixedPositionAncestor(element, stopNode) { | |
| 4065 | - const parentNode = getParentNode(element); | |
| 4066 | - if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { | |
| 4067 | - return false; | |
| 4068 | - } | |
| 4069 | - return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); | |
| 4070 | - } | |
| 4071 | - function getClippingElementAncestors(element, cache) { | |
| 4072 | - const cachedResult = cache.get(element); | |
| 4073 | - if (cachedResult) { | |
| 4074 | - return cachedResult; | |
| 4075 | - } | |
| 4076 | - let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); | |
| 4077 | - let currentContainingBlockComputedStyle = null; | |
| 4078 | - const elementIsFixed = getComputedStyle2(element).position === "fixed"; | |
| 4079 | - let currentNode = elementIsFixed ? getParentNode(element) : element; | |
| 4080 | - while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { | |
| 4081 | - const computedStyle = getComputedStyle2(currentNode); | |
| 4082 | - const currentNodeIsContaining = isContainingBlock(currentNode); | |
| 4083 | - if (!currentNodeIsContaining && computedStyle.position === "fixed") { | |
| 4084 | - currentContainingBlockComputedStyle = null; | |
| 4085 | - } | |
| 4086 | - const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); | |
| 4087 | - if (shouldDropCurrentNode) { | |
| 4088 | - result = result.filter((ancestor) => ancestor !== currentNode); | |
| 4089 | - } else { | |
| 4090 | - currentContainingBlockComputedStyle = computedStyle; | |
| 4091 | - } | |
| 4092 | - currentNode = getParentNode(currentNode); | |
| 4093 | - } | |
| 4094 | - cache.set(element, result); | |
| 4095 | - return result; | |
| 4096 | - } | |
| 4097 | - function getClippingRect(_ref) { | |
| 4098 | - let { | |
| 4099 | - element, | |
| 4100 | - boundary, | |
| 4101 | - rootBoundary, | |
| 4102 | - strategy | |
| 4103 | - } = _ref; | |
| 4104 | - const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); | |
| 4105 | - const clippingAncestors = [...elementClippingAncestors, rootBoundary]; | |
| 4106 | - const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); | |
| 4107 | - let top = firstRect.top; | |
| 4108 | - let right = firstRect.right; | |
| 4109 | - let bottom = firstRect.bottom; | |
| 4110 | - let left = firstRect.left; | |
| 4111 | - for (let i = 1; i < clippingAncestors.length; i++) { | |
| 4112 | - const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); | |
| 4113 | - top = max(rect.top, top); | |
| 4114 | - right = min(rect.right, right); | |
| 4115 | - bottom = min(rect.bottom, bottom); | |
| 4116 | - left = max(rect.left, left); | |
| 4117 | - } | |
| 4118 | - return { | |
| 4119 | - width: right - left, | |
| 4120 | - height: bottom - top, | |
| 4121 | - x: left, | |
| 4122 | - y: top | |
| 4123 | - }; | |
| 4124 | - } | |
| 4125 | - function getDimensions(element) { | |
| 4126 | - const { | |
| 4127 | - width, | |
| 4128 | - height | |
| 4129 | - } = getCssDimensions(element); | |
| 4130 | - return { | |
| 4131 | - width, | |
| 4132 | - height | |
| 4133 | - }; | |
| 4134 | - } | |
| 4135 | - function getRectRelativeToOffsetParent(element, offsetParent, strategy) { | |
| 4136 | - const isOffsetParentAnElement = isHTMLElement(offsetParent); | |
| 4137 | - const documentElement = getDocumentElement(offsetParent); | |
| 4138 | - const isFixed = strategy === "fixed"; | |
| 4139 | - const rect = getBoundingClientRect(element, true, isFixed, offsetParent); | |
| 4140 | - let scroll = { | |
| 4141 | - scrollLeft: 0, | |
| 4142 | - scrollTop: 0 | |
| 4143 | - }; | |
| 4144 | - const offsets = createCoords(0); | |
| 4145 | - function setLeftRTLScrollbarOffset() { | |
| 4146 | - offsets.x = getWindowScrollBarX(documentElement); | |
| 4147 | - } | |
| 4148 | - if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { | |
| 4149 | - if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { | |
| 4150 | - scroll = getNodeScroll(offsetParent); | |
| 4151 | - } | |
| 4152 | - if (isOffsetParentAnElement) { | |
| 4153 | - const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); | |
| 4154 | - offsets.x = offsetRect.x + offsetParent.clientLeft; | |
| 4155 | - offsets.y = offsetRect.y + offsetParent.clientTop; | |
| 4156 | - } else if (documentElement) { | |
| 4157 | - setLeftRTLScrollbarOffset(); | |
| 4158 | - } | |
| 4159 | - } | |
| 4160 | - if (isFixed && !isOffsetParentAnElement && documentElement) { | |
| 4161 | - setLeftRTLScrollbarOffset(); | |
| 4162 | - } | |
| 4163 | - const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); | |
| 4164 | - const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; | |
| 4165 | - const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; | |
| 4166 | - return { | |
| 4167 | - x, | |
| 4168 | - y, | |
| 4169 | - width: rect.width, | |
| 4170 | - height: rect.height | |
| 4171 | - }; | |
| 4172 | - } | |
| 4173 | - function isStaticPositioned(element) { | |
| 4174 | - return getComputedStyle2(element).position === "static"; | |
| 4175 | - } | |
| 4176 | - function getTrueOffsetParent(element, polyfill) { | |
| 4177 | - if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { | |
| 4178 | - return null; | |
| 4179 | - } | |
| 4180 | - if (polyfill) { | |
| 4181 | - return polyfill(element); | |
| 4182 | - } | |
| 4183 | - let rawOffsetParent = element.offsetParent; | |
| 4184 | - if (getDocumentElement(element) === rawOffsetParent) { | |
| 4185 | - rawOffsetParent = rawOffsetParent.ownerDocument.body; | |
| 4186 | - } | |
| 4187 | - return rawOffsetParent; | |
| 4188 | - } | |
| 4189 | - function getOffsetParent(element, polyfill) { | |
| 4190 | - const win = getWindow(element); | |
| 4191 | - if (isTopLayer(element)) { | |
| 4192 | - return win; | |
| 4193 | - } | |
| 4194 | - if (!isHTMLElement(element)) { | |
| 4195 | - let svgOffsetParent = getParentNode(element); | |
| 4196 | - while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { | |
| 4197 | - if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { | |
| 4198 | - return svgOffsetParent; | |
| 4199 | - } | |
| 4200 | - svgOffsetParent = getParentNode(svgOffsetParent); | |
| 4201 | - } | |
| 4202 | - return win; | |
| 4203 | - } | |
| 4204 | - let offsetParent = getTrueOffsetParent(element, polyfill); | |
| 4205 | - while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { | |
| 4206 | - offsetParent = getTrueOffsetParent(offsetParent, polyfill); | |
| 4207 | - } | |
| 4208 | - if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { | |
| 4209 | - return win; | |
| 4210 | - } | |
| 4211 | - return offsetParent || getContainingBlock(element) || win; | |
| 4212 | - } | |
| 4213 | - var getElementRects = async function(data) { | |
| 4214 | - const getOffsetParentFn = this.getOffsetParent || getOffsetParent; | |
| 4215 | - const getDimensionsFn = this.getDimensions; | |
| 4216 | - const floatingDimensions = await getDimensionsFn(data.floating); | |
| 4217 | - return { | |
| 4218 | - reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), | |
| 4219 | - floating: { | |
| 4220 | - x: 0, | |
| 4221 | - y: 0, | |
| 4222 | - width: floatingDimensions.width, | |
| 4223 | - height: floatingDimensions.height | |
| 4224 | - } | |
| 4225 | - }; | |
| 4226 | - }; | |
| 4227 | - function isRTL(element) { | |
| 4228 | - return getComputedStyle2(element).direction === "rtl"; | |
| 4229 | - } | |
| 4230 | - var platform2 = { | |
| 4231 | - convertOffsetParentRelativeRectToViewportRelativeRect, | |
| 4232 | - getDocumentElement, | |
| 4233 | - getClippingRect, | |
| 4234 | - getOffsetParent, | |
| 4235 | - getElementRects, | |
| 4236 | - getClientRects, | |
| 4237 | - getDimensions, | |
| 4238 | - getScale, | |
| 4239 | - isElement, | |
| 4240 | - isRTL | |
| 4241 | - }; | |
| 4242 | - function rectsAreEqual(a, b) { | |
| 4243 | - return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; | |
| 4244 | - } | |
| 4245 | - function observeMove(element, onMove) { | |
| 4246 | - let io = null; | |
| 4247 | - let timeoutId; | |
| 4248 | - const root = getDocumentElement(element); | |
| 4249 | - function cleanup() { | |
| 4250 | - var _io; | |
| 4251 | - clearTimeout(timeoutId); | |
| 4252 | - (_io = io) == null || _io.disconnect(); | |
| 4253 | - io = null; | |
| 4254 | - } | |
| 4255 | - function refresh(skip, threshold) { | |
| 4256 | - if (skip === void 0) { | |
| 4257 | - skip = false; | |
| 4258 | - } | |
| 4259 | - if (threshold === void 0) { | |
| 4260 | - threshold = 1; | |
| 4261 | - } | |
| 4262 | - cleanup(); | |
| 4263 | - const elementRectForRootMargin = element.getBoundingClientRect(); | |
| 4264 | - const { | |
| 4265 | - left, | |
| 4266 | - top, | |
| 4267 | - width, | |
| 4268 | - height | |
| 4269 | - } = elementRectForRootMargin; | |
| 4270 | - if (!skip) { | |
| 4271 | - onMove(); | |
| 4272 | - } | |
| 4273 | - if (!width || !height) { | |
| 4274 | - return; | |
| 4275 | - } | |
| 4276 | - const insetTop = floor(top); | |
| 4277 | - const insetRight = floor(root.clientWidth - (left + width)); | |
| 4278 | - const insetBottom = floor(root.clientHeight - (top + height)); | |
| 4279 | - const insetLeft = floor(left); | |
| 4280 | - const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; | |
| 4281 | - const options = { | |
| 4282 | - rootMargin, | |
| 4283 | - threshold: max(0, min(1, threshold)) || 1 | |
| 4284 | - }; | |
| 4285 | - let isFirstUpdate = true; | |
| 4286 | - function handleObserve(entries) { | |
| 4287 | - const ratio = entries[0].intersectionRatio; | |
| 4288 | - if (ratio !== threshold) { | |
| 4289 | - if (!isFirstUpdate) { | |
| 4290 | - return refresh(); | |
| 4291 | - } | |
| 4292 | - if (!ratio) { | |
| 4293 | - timeoutId = setTimeout(() => { | |
| 4294 | - refresh(false, 1e-7); | |
| 4295 | - }, 1e3); | |
| 4296 | - } else { | |
| 4297 | - refresh(false, ratio); | |
| 4298 | - } | |
| 4299 | - } | |
| 4300 | - if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { | |
| 4301 | - refresh(); | |
| 4302 | - } | |
| 4303 | - isFirstUpdate = false; | |
| 4304 | - } | |
| 4305 | - try { | |
| 4306 | - io = new IntersectionObserver(handleObserve, { | |
| 4307 | - ...options, | |
| 4308 | - // Handle <iframe>s | |
| 4309 | - root: root.ownerDocument | |
| 4310 | - }); | |
| 4311 | - } catch (_e) { | |
| 4312 | - io = new IntersectionObserver(handleObserve, options); | |
| 4313 | - } | |
| 4314 | - io.observe(element); | |
| 4315 | - } | |
| 4316 | - refresh(true); | |
| 4317 | - return cleanup; | |
| 4318 | - } | |
| 4319 | - function autoUpdate(reference, floating, update2, options) { | |
| 4320 | - if (options === void 0) { | |
| 4321 | - options = {}; | |
| 4322 | - } | |
| 4323 | - const { | |
| 4324 | - ancestorScroll = true, | |
| 4325 | - ancestorResize = true, | |
| 4326 | - elementResize = typeof ResizeObserver === "function", | |
| 4327 | - layoutShift = typeof IntersectionObserver === "function", | |
| 4328 | - animationFrame = false | |
| 4329 | - } = options; | |
| 4330 | - const referenceEl = unwrapElement(reference); | |
| 4331 | - const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; | |
| 4332 | - ancestors.forEach((ancestor) => { | |
| 4333 | - ancestorScroll && ancestor.addEventListener("scroll", update2, { | |
| 4334 | - passive: true | |
| 4335 | - }); | |
| 4336 | - ancestorResize && ancestor.addEventListener("resize", update2); | |
| 4337 | - }); | |
| 4338 | - const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null; | |
| 4339 | - let reobserveFrame = -1; | |
| 4340 | - let resizeObserver = null; | |
| 4341 | - if (elementResize) { | |
| 4342 | - resizeObserver = new ResizeObserver((_ref) => { | |
| 4343 | - let [firstEntry] = _ref; | |
| 4344 | - if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { | |
| 4345 | - resizeObserver.unobserve(floating); | |
| 4346 | - cancelAnimationFrame(reobserveFrame); | |
| 4347 | - reobserveFrame = requestAnimationFrame(() => { | |
| 4348 | - var _resizeObserver; | |
| 4349 | - (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); | |
| 4350 | - }); | |
| 4351 | - } | |
| 4352 | - update2(); | |
| 4353 | - }); | |
| 4354 | - if (referenceEl && !animationFrame) { | |
| 4355 | - resizeObserver.observe(referenceEl); | |
| 4356 | - } | |
| 4357 | - if (floating) { | |
| 4358 | - resizeObserver.observe(floating); | |
| 4359 | - } | |
| 4360 | - } | |
| 4361 | - let frameId; | |
| 4362 | - let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; | |
| 4363 | - if (animationFrame) { | |
| 4364 | - frameLoop(); | |
| 4365 | - } | |
| 4366 | - function frameLoop() { | |
| 4367 | - const nextRefRect = getBoundingClientRect(reference); | |
| 4368 | - if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { | |
| 4369 | - update2(); | |
| 4370 | - } | |
| 4371 | - prevRefRect = nextRefRect; | |
| 4372 | - frameId = requestAnimationFrame(frameLoop); | |
| 4373 | - } | |
| 4374 | - update2(); | |
| 4375 | - return () => { | |
| 4376 | - var _resizeObserver2; | |
| 4377 | - ancestors.forEach((ancestor) => { | |
| 4378 | - ancestorScroll && ancestor.removeEventListener("scroll", update2); | |
| 4379 | - ancestorResize && ancestor.removeEventListener("resize", update2); | |
| 4380 | - }); | |
| 4381 | - cleanupIo == null || cleanupIo(); | |
| 4382 | - (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); | |
| 4383 | - resizeObserver = null; | |
| 4384 | - if (animationFrame) { | |
| 4385 | - cancelAnimationFrame(frameId); | |
| 4386 | - } | |
| 4387 | - }; | |
| 4388 | - } | |
| 4389 | - var offset2 = offset; | |
| 4390 | - var shift2 = shift; | |
| 4391 | - var flip2 = flip; | |
| 4392 | - var size2 = size; | |
| 4393 | - var hide2 = hide; | |
| 4394 | - var limitShift2 = limitShift; | |
| 4395 | - var computePosition2 = (reference, floating, options) => { | |
| 4396 | - const cache = /* @__PURE__ */ new Map(); | |
| 4397 | - const mergedOptions = { | |
| 4398 | - platform: platform2, | |
| 4399 | - ...options | |
| 4400 | - }; | |
| 4401 | - const platformWithCache = { | |
| 4402 | - ...mergedOptions.platform, | |
| 4403 | - _c: cache | |
| 4404 | - }; | |
| 4405 | - return computePosition(reference, floating, { | |
| 4406 | - ...mergedOptions, | |
| 4407 | - platform: platformWithCache | |
| 4408 | - }); | |
| 4409 | - }; | |
| 4410 | - | |
| 4411 | - // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs | |
| 4412 | - var React19 = __toESM(require_react(), 1); | |
| 4413 | - var import_react2 = __toESM(require_react(), 1); | |
| 4414 | - var ReactDOM3 = __toESM(require_react_dom(), 1); | |
| 4415 | - var isClient = typeof document !== "undefined"; | |
| 4416 | - var noop2 = function noop3() { | |
| 4417 | - }; | |
| 4418 | - var index = isClient ? import_react2.useLayoutEffect : noop2; | |
| 4419 | - function deepEqual(a, b) { | |
| 4420 | - if (a === b) { | |
| 4421 | - return true; | |
| 4422 | - } | |
| 4423 | - if (typeof a !== typeof b) { | |
| 4424 | - return false; | |
| 4425 | - } | |
| 4426 | - if (typeof a === "function" && a.toString() === b.toString()) { | |
| 4427 | - return true; | |
| 4428 | - } | |
| 4429 | - let length; | |
| 4430 | - let i; | |
| 4431 | - let keys; | |
| 4432 | - if (a && b && typeof a === "object") { | |
| 4433 | - if (Array.isArray(a)) { | |
| 4434 | - length = a.length; | |
| 4435 | - if (length !== b.length) return false; | |
| 4436 | - for (i = length; i-- !== 0; ) { | |
| 4437 | - if (!deepEqual(a[i], b[i])) { | |
| 4438 | - return false; | |
| 4439 | - } | |
| 4440 | - } | |
| 4441 | - return true; | |
| 4442 | - } | |
| 4443 | - keys = Object.keys(a); | |
| 4444 | - length = keys.length; | |
| 4445 | - if (length !== Object.keys(b).length) { | |
| 4446 | - return false; | |
| 4447 | - } | |
| 4448 | - for (i = length; i-- !== 0; ) { | |
| 4449 | - if (!{}.hasOwnProperty.call(b, keys[i])) { | |
| 4450 | - return false; | |
| 4451 | - } | |
| 4452 | - } | |
| 4453 | - for (i = length; i-- !== 0; ) { | |
| 4454 | - const key = keys[i]; | |
| 4455 | - if (key === "_owner" && a.$$typeof) { | |
| 4456 | - continue; | |
| 4457 | - } | |
| 4458 | - if (!deepEqual(a[key], b[key])) { | |
| 4459 | - return false; | |
| 4460 | - } | |
| 4461 | - } | |
| 4462 | - return true; | |
| 4463 | - } | |
| 4464 | - return a !== a && b !== b; | |
| 4465 | - } | |
| 4466 | - function getDPR(element) { | |
| 4467 | - if (typeof window === "undefined") { | |
| 4468 | - return 1; | |
| 4469 | - } | |
| 4470 | - const win = element.ownerDocument.defaultView || window; | |
| 4471 | - return win.devicePixelRatio || 1; | |
| 4472 | - } | |
| 4473 | - function roundByDPR(element, value) { | |
| 4474 | - const dpr = getDPR(element); | |
| 4475 | - return Math.round(value * dpr) / dpr; | |
| 4476 | - } | |
| 4477 | - function useLatestRef(value) { | |
| 4478 | - const ref = React19.useRef(value); | |
| 4479 | - index(() => { | |
| 4480 | - ref.current = value; | |
| 4481 | - }); | |
| 4482 | - return ref; | |
| 4483 | - } | |
| 4484 | - function useFloating(options) { | |
| 4485 | - if (options === void 0) { | |
| 4486 | - options = {}; | |
| 4487 | - } | |
| 4488 | - const { | |
| 4489 | - placement = "bottom", | |
| 4490 | - strategy = "absolute", | |
| 4491 | - middleware = [], | |
| 4492 | - platform: platform3, | |
| 4493 | - elements: { | |
| 4494 | - reference: externalReference, | |
| 4495 | - floating: externalFloating | |
| 4496 | - } = {}, | |
| 4497 | - transform = true, | |
| 4498 | - whileElementsMounted, | |
| 4499 | - open | |
| 4500 | - } = options; | |
| 4501 | - const [data, setData] = React19.useState({ | |
| 4502 | - x: 0, | |
| 4503 | - y: 0, | |
| 4504 | - strategy, | |
| 4505 | - placement, | |
| 4506 | - middlewareData: {}, | |
| 4507 | - isPositioned: false | |
| 4508 | - }); | |
| 4509 | - const [latestMiddleware, setLatestMiddleware] = React19.useState(middleware); | |
| 4510 | - if (!deepEqual(latestMiddleware, middleware)) { | |
| 4511 | - setLatestMiddleware(middleware); | |
| 4512 | - } | |
| 4513 | - const [_reference, _setReference] = React19.useState(null); | |
| 4514 | - const [_floating, _setFloating] = React19.useState(null); | |
| 4515 | - const setReference = React19.useCallback((node) => { | |
| 4516 | - if (node !== referenceRef.current) { | |
| 4517 | - referenceRef.current = node; | |
| 4518 | - _setReference(node); | |
| 4519 | - } | |
| 4520 | - }, []); | |
| 4521 | - const setFloating = React19.useCallback((node) => { | |
| 4522 | - if (node !== floatingRef.current) { | |
| 4523 | - floatingRef.current = node; | |
| 4524 | - _setFloating(node); | |
| 4525 | - } | |
| 4526 | - }, []); | |
| 4527 | - const referenceEl = externalReference || _reference; | |
| 4528 | - const floatingEl = externalFloating || _floating; | |
| 4529 | - const referenceRef = React19.useRef(null); | |
| 4530 | - const floatingRef = React19.useRef(null); | |
| 4531 | - const dataRef = React19.useRef(data); | |
| 4532 | - const hasWhileElementsMounted = whileElementsMounted != null; | |
| 4533 | - const whileElementsMountedRef = useLatestRef(whileElementsMounted); | |
| 4534 | - const platformRef = useLatestRef(platform3); | |
| 4535 | - const openRef = useLatestRef(open); | |
| 4536 | - const update2 = React19.useCallback(() => { | |
| 4537 | - if (!referenceRef.current || !floatingRef.current) { | |
| 4538 | - return; | |
| 4539 | - } | |
| 4540 | - const config = { | |
| 4541 | - placement, | |
| 4542 | - strategy, | |
| 4543 | - middleware: latestMiddleware | |
| 4544 | - }; | |
| 4545 | - if (platformRef.current) { | |
| 4546 | - config.platform = platformRef.current; | |
| 4547 | - } | |
| 4548 | - computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { | |
| 4549 | - const fullData = { | |
| 4550 | - ...data2, | |
| 4551 | - // The floating element's position may be recomputed while it's closed | |
| 4552 | - // but still mounted (such as when transitioning out). To ensure | |
| 4553 | - // `isPositioned` will be `false` initially on the next open, avoid | |
| 4554 | - // setting it to `true` when `open === false` (must be specified). | |
| 4555 | - isPositioned: openRef.current !== false | |
| 4556 | - }; | |
| 4557 | - if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { | |
| 4558 | - dataRef.current = fullData; | |
| 4559 | - ReactDOM3.flushSync(() => { | |
| 4560 | - setData(fullData); | |
| 4561 | - }); | |
| 4562 | - } | |
| 4563 | - }); | |
| 4564 | - }, [latestMiddleware, placement, strategy, platformRef, openRef]); | |
| 4565 | - index(() => { | |
| 4566 | - if (open === false && dataRef.current.isPositioned) { | |
| 4567 | - dataRef.current.isPositioned = false; | |
| 4568 | - setData((data2) => ({ | |
| 4569 | - ...data2, | |
| 4570 | - isPositioned: false | |
| 4571 | - })); | |
| 4572 | - } | |
| 4573 | - }, [open]); | |
| 4574 | - const isMountedRef = React19.useRef(false); | |
| 4575 | - index(() => { | |
| 4576 | - isMountedRef.current = true; | |
| 4577 | - return () => { | |
| 4578 | - isMountedRef.current = false; | |
| 4579 | - }; | |
| 4580 | - }, []); | |
| 4581 | - index(() => { | |
| 4582 | - if (referenceEl) referenceRef.current = referenceEl; | |
| 4583 | - if (floatingEl) floatingRef.current = floatingEl; | |
| 4584 | - if (referenceEl && floatingEl) { | |
| 4585 | - if (whileElementsMountedRef.current) { | |
| 4586 | - return whileElementsMountedRef.current(referenceEl, floatingEl, update2); | |
| 4587 | - } | |
| 4588 | - update2(); | |
| 4589 | - } | |
| 4590 | - }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); | |
| 4591 | - const refs = React19.useMemo(() => ({ | |
| 4592 | - reference: referenceRef, | |
| 4593 | - floating: floatingRef, | |
| 4594 | - setReference, | |
| 4595 | - setFloating | |
| 4596 | - }), [setReference, setFloating]); | |
| 4597 | - const elements = React19.useMemo(() => ({ | |
| 4598 | - reference: referenceEl, | |
| 4599 | - floating: floatingEl | |
| 4600 | - }), [referenceEl, floatingEl]); | |
| 4601 | - const floatingStyles = React19.useMemo(() => { | |
| 4602 | - const initialStyles = { | |
| 4603 | - position: strategy, | |
| 4604 | - left: 0, | |
| 4605 | - top: 0 | |
| 4606 | - }; | |
| 4607 | - if (!elements.floating) { | |
| 4608 | - return initialStyles; | |
| 4609 | - } | |
| 4610 | - const x = roundByDPR(elements.floating, data.x); | |
| 4611 | - const y = roundByDPR(elements.floating, data.y); | |
| 4612 | - if (transform) { | |
| 4613 | - return { | |
| 4614 | - ...initialStyles, | |
| 4615 | - transform: "translate(" + x + "px, " + y + "px)", | |
| 4616 | - ...getDPR(elements.floating) >= 1.5 && { | |
| 4617 | - willChange: "transform" | |
| 4618 | - } | |
| 4619 | - }; | |
| 4620 | - } | |
| 4621 | - return { | |
| 4622 | - position: strategy, | |
| 4623 | - left: x, | |
| 4624 | - top: y | |
| 4625 | - }; | |
| 4626 | - }, [strategy, transform, elements.floating, data.x, data.y]); | |
| 4627 | - return React19.useMemo(() => ({ | |
| 4628 | - ...data, | |
| 4629 | - update: update2, | |
| 4630 | - refs, | |
| 4631 | - elements, | |
| 4632 | - floatingStyles | |
| 4633 | - }), [data, update2, refs, elements, floatingStyles]); | |
| 4634 | - } | |
| 4635 | - var offset3 = (options, deps) => { | |
| 4636 | - const result = offset2(options); | |
| 4637 | - return { | |
| 4638 | - name: result.name, | |
| 4639 | - fn: result.fn, | |
| 4640 | - options: [options, deps] | |
| 4641 | - }; | |
| 4642 | - }; | |
| 4643 | - var shift3 = (options, deps) => { | |
| 4644 | - const result = shift2(options); | |
| 4645 | - return { | |
| 4646 | - name: result.name, | |
| 4647 | - fn: result.fn, | |
| 4648 | - options: [options, deps] | |
| 4649 | - }; | |
| 4650 | - }; | |
| 4651 | - var limitShift3 = (options, deps) => { | |
| 4652 | - const result = limitShift2(options); | |
| 4653 | - return { | |
| 4654 | - fn: result.fn, | |
| 4655 | - options: [options, deps] | |
| 4656 | - }; | |
| 4657 | - }; | |
| 4658 | - var flip3 = (options, deps) => { | |
| 4659 | - const result = flip2(options); | |
| 4660 | - return { | |
| 4661 | - name: result.name, | |
| 4662 | - fn: result.fn, | |
| 4663 | - options: [options, deps] | |
| 4664 | - }; | |
| 4665 | - }; | |
| 4666 | - var size3 = (options, deps) => { | |
| 4667 | - const result = size2(options); | |
| 4668 | - return { | |
| 4669 | - name: result.name, | |
| 4670 | - fn: result.fn, | |
| 4671 | - options: [options, deps] | |
| 4672 | - }; | |
| 4673 | - }; | |
| 4674 | - var hide3 = (options, deps) => { | |
| 4675 | - const result = hide2(options); | |
| 4676 | - return { | |
| 4677 | - name: result.name, | |
| 4678 | - fn: result.fn, | |
| 4679 | - options: [options, deps] | |
| 4680 | - }; | |
| 4681 | - }; | |
| 4682 | - | |
| 4683 | - // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs | |
| 4684 | - var React24 = __toESM(require_react(), 1); | |
| 4685 | - var ReactDOM4 = __toESM(require_react_dom(), 1); | |
| 4686 | - | |
| 4687 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs | |
| 4688 | - var React23 = __toESM(require_react(), 1); | |
| 4689 | - | |
| 4690 | - // node_modules/@base-ui/utils/store/createSelector.mjs | |
| 4691 | - var createSelector = (a, b, c, d, e, f, ...other) => { | |
| 4692 | - if (other.length > 0) { | |
| 4693 | - throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1)); | |
| 4694 | - } | |
| 4695 | - let selector; | |
| 4696 | - if (a && b && c && d && e && f) { | |
| 4697 | - selector = (state, a1, a2, a3) => { | |
| 4698 | - const va = a(state, a1, a2, a3); | |
| 4699 | - const vb = b(state, a1, a2, a3); | |
| 4700 | - const vc = c(state, a1, a2, a3); | |
| 4701 | - const vd = d(state, a1, a2, a3); | |
| 4702 | - const ve = e(state, a1, a2, a3); | |
| 4703 | - return f(va, vb, vc, vd, ve, a1, a2, a3); | |
| 4704 | - }; | |
| 4705 | - } else if (a && b && c && d && e) { | |
| 4706 | - selector = (state, a1, a2, a3) => { | |
| 4707 | - const va = a(state, a1, a2, a3); | |
| 4708 | - const vb = b(state, a1, a2, a3); | |
| 4709 | - const vc = c(state, a1, a2, a3); | |
| 4710 | - const vd = d(state, a1, a2, a3); | |
| 4711 | - return e(va, vb, vc, vd, a1, a2, a3); | |
| 4712 | - }; | |
| 4713 | - } else if (a && b && c && d) { | |
| 4714 | - selector = (state, a1, a2, a3) => { | |
| 4715 | - const va = a(state, a1, a2, a3); | |
| 4716 | - const vb = b(state, a1, a2, a3); | |
| 4717 | - const vc = c(state, a1, a2, a3); | |
| 4718 | - return d(va, vb, vc, a1, a2, a3); | |
| 4719 | - }; | |
| 4720 | - } else if (a && b && c) { | |
| 4721 | - selector = (state, a1, a2, a3) => { | |
| 4722 | - const va = a(state, a1, a2, a3); | |
| 4723 | - const vb = b(state, a1, a2, a3); | |
| 4724 | - return c(va, vb, a1, a2, a3); | |
| 4725 | - }; | |
| 4726 | - } else if (a && b) { | |
| 4727 | - selector = (state, a1, a2, a3) => { | |
| 4728 | - const va = a(state, a1, a2, a3); | |
| 4729 | - return b(va, a1, a2, a3); | |
| 4730 | - }; | |
| 4731 | - } else if (a) { | |
| 4732 | - selector = a; | |
| 4733 | - } else { | |
| 4734 | - throw ( | |
| 4735 | - /* minify-error-disabled */ | |
| 4736 | - new Error("Missing arguments") | |
| 4737 | - ); | |
| 4738 | - } | |
| 4739 | - return selector; | |
| 4740 | - }; | |
| 4741 | - | |
| 4742 | - // node_modules/@base-ui/utils/store/useStore.mjs | |
| 4743 | - var React21 = __toESM(require_react(), 1); | |
| 4744 | - var import_shim = __toESM(require_shim(), 1); | |
| 4745 | - var import_with_selector = __toESM(require_with_selector(), 1); | |
| 4746 | - | |
| 4747 | - // node_modules/@base-ui/utils/fastHooks.mjs | |
| 4748 | - var React20 = __toESM(require_react(), 1); | |
| 4749 | - var hooks = []; | |
| 4750 | - var currentInstance = void 0; | |
| 4751 | - function getInstance() { | |
| 4752 | - return currentInstance; | |
| 4753 | - } | |
| 4754 | - function register(hook) { | |
| 4755 | - hooks.push(hook); | |
| 4756 | - } | |
| 4757 | - function fastComponent(fn) { | |
| 4758 | - const FastComponent = (props, forwardedRef) => { | |
| 4759 | - const instance = useRefWithInit(createInstance).current; | |
| 4760 | - let result; | |
| 4761 | - try { | |
| 4762 | - currentInstance = instance; | |
| 4763 | - for (const hook of hooks) { | |
| 4764 | - hook.before(instance); | |
| 4765 | - } | |
| 4766 | - result = fn(props, forwardedRef); | |
| 4767 | - for (const hook of hooks) { | |
| 4768 | - hook.after(instance); | |
| 4769 | - } | |
| 4770 | - instance.didInitialize = true; | |
| 4771 | - } finally { | |
| 4772 | - currentInstance = void 0; | |
| 4773 | - } | |
| 4774 | - return result; | |
| 4775 | - }; | |
| 4776 | - FastComponent.displayName = fn.displayName || fn.name; | |
| 4777 | - return FastComponent; | |
| 4778 | - } | |
| 4779 | - function fastComponentRef(fn) { | |
| 4780 | - return /* @__PURE__ */ React20.forwardRef(fastComponent(fn)); | |
| 4781 | - } | |
| 4782 | - function createInstance() { | |
| 4783 | - return { | |
| 4784 | - didInitialize: false | |
| 4785 | - }; | |
| 4786 | - } | |
| 4787 | - | |
| 4788 | - // node_modules/@base-ui/utils/store/useStore.mjs | |
| 4789 | - var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); | |
| 4790 | - var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; | |
| 4791 | - function useStore(store2, selector, a1, a2, a3) { | |
| 4792 | - return useStoreImplementation(store2, selector, a1, a2, a3); | |
| 4793 | - } | |
| 4794 | - function useStoreR19(store2, selector, a1, a2, a3) { | |
| 4795 | - const getSelection = React21.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]); | |
| 4796 | - return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection); | |
| 4797 | - } | |
| 4798 | - register({ | |
| 4799 | - before(instance) { | |
| 4800 | - instance.syncIndex = 0; | |
| 4801 | - if (!instance.didInitialize) { | |
| 4802 | - instance.syncTick = 1; | |
| 4803 | - instance.syncHooks = []; | |
| 4804 | - instance.didChangeStore = true; | |
| 4805 | - instance.getSnapshot = () => { | |
| 4806 | - let didChange2 = false; | |
| 4807 | - for (let i = 0; i < instance.syncHooks.length; i += 1) { | |
| 4808 | - const hook = instance.syncHooks[i]; | |
| 4809 | - const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); | |
| 4810 | - if (!Object.is(hook.value, value)) { | |
| 4811 | - didChange2 = true; | |
| 4812 | - hook.value = value; | |
| 4813 | - } | |
| 4814 | - } | |
| 4815 | - if (didChange2) { | |
| 4816 | - instance.syncTick += 1; | |
| 4817 | - } | |
| 4818 | - return instance.syncTick; | |
| 4819 | - }; | |
| 4820 | - } | |
| 4821 | - }, | |
| 4822 | - after(instance) { | |
| 4823 | - if (instance.syncHooks.length > 0) { | |
| 4824 | - if (instance.didChangeStore) { | |
| 4825 | - instance.didChangeStore = false; | |
| 4826 | - instance.subscribe = (onStoreChange) => { | |
| 4827 | - const stores = /* @__PURE__ */ new Set(); | |
| 4828 | - for (const hook of instance.syncHooks) { | |
| 4829 | - stores.add(hook.store); | |
| 4830 | - } | |
| 4831 | - const unsubscribes = []; | |
| 4832 | - for (const store2 of stores) { | |
| 4833 | - unsubscribes.push(store2.subscribe(onStoreChange)); | |
| 4834 | - } | |
| 4835 | - return () => { | |
| 4836 | - for (const unsubscribe of unsubscribes) { | |
| 4837 | - unsubscribe(); | |
| 4838 | - } | |
| 4839 | - }; | |
| 4840 | - }; | |
| 4841 | - } | |
| 4842 | - (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); | |
| 4843 | - } | |
| 4844 | - } | |
| 4845 | - }); | |
| 4846 | - function useStoreFast(store2, selector, a1, a2, a3) { | |
| 4847 | - const instance = getInstance(); | |
| 4848 | - if (!instance) { | |
| 4849 | - return useStoreR19(store2, selector, a1, a2, a3); | |
| 4850 | - } | |
| 4851 | - const index2 = instance.syncIndex; | |
| 4852 | - instance.syncIndex += 1; | |
| 4853 | - let hook; | |
| 4854 | - if (!instance.didInitialize) { | |
| 4855 | - hook = { | |
| 4856 | - store: store2, | |
| 4857 | - selector, | |
| 4858 | - a1, | |
| 4859 | - a2, | |
| 4860 | - a3, | |
| 4861 | - value: selector(store2.getSnapshot(), a1, a2, a3) | |
| 4862 | - }; | |
| 4863 | - instance.syncHooks.push(hook); | |
| 4864 | - } else { | |
| 4865 | - hook = instance.syncHooks[index2]; | |
| 4866 | - if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { | |
| 4867 | - if (hook.store !== store2) { | |
| 4868 | - instance.didChangeStore = true; | |
| 4869 | - } | |
| 4870 | - hook.store = store2; | |
| 4871 | - hook.selector = selector; | |
| 4872 | - hook.a1 = a1; | |
| 4873 | - hook.a2 = a2; | |
| 4874 | - hook.a3 = a3; | |
| 4875 | - hook.value = selector(store2.getSnapshot(), a1, a2, a3); | |
| 4876 | - } | |
| 4877 | - } | |
| 4878 | - return hook.value; | |
| 4879 | - } | |
| 4880 | - function useStoreLegacy(store2, selector, a1, a2, a3) { | |
| 4881 | - return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3)); | |
| 4882 | - } | |
| 4883 | - | |
| 4884 | - // node_modules/@base-ui/utils/store/Store.mjs | |
| 4885 | - var Store = class { | |
| 4886 | - /** | |
| 4887 | - * The current state of the store. | |
| 4888 | - * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. | |
| 4889 | - * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState). | |
| 4890 | - * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. | |
| 4891 | - * | |
| 4892 | - * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. | |
| 4893 | - */ | |
| 4894 | - // Internal state to handle recursive `setState()` calls | |
| 4895 | - constructor(state) { | |
| 4896 | - this.state = state; | |
| 4897 | - this.listeners = /* @__PURE__ */ new Set(); | |
| 4898 | - this.updateTick = 0; | |
| 4899 | - } | |
| 4900 | - /** | |
| 4901 | - * Registers a listener that will be called whenever the store's state changes. | |
| 4902 | - * | |
| 4903 | - * @param fn The listener function to be called on state changes. | |
| 4904 | - * @returns A function to unsubscribe the listener. | |
| 4905 | - */ | |
| 4906 | - subscribe = (fn) => { | |
| 4907 | - this.listeners.add(fn); | |
| 4908 | - return () => { | |
| 4909 | - this.listeners.delete(fn); | |
| 4910 | - }; | |
| 4911 | - }; | |
| 4912 | - /** | |
| 4913 | - * Returns the current state of the store. | |
| 4914 | - */ | |
| 4915 | - getSnapshot = () => { | |
| 4916 | - return this.state; | |
| 4917 | - }; | |
| 4918 | - /** | |
| 4919 | - * Updates the entire store's state and notifies all registered listeners. | |
| 4920 | - * | |
| 4921 | - * @param newState The new state to set for the store. | |
| 4922 | - */ | |
| 4923 | - setState(newState) { | |
| 4924 | - if (this.state === newState) { | |
| 4925 | - return; | |
| 4926 | - } | |
| 4927 | - this.state = newState; | |
| 4928 | - this.updateTick += 1; | |
| 4929 | - const currentTick = this.updateTick; | |
| 4930 | - for (const listener of this.listeners) { | |
| 4931 | - if (currentTick !== this.updateTick) { | |
| 4932 | - return; | |
| 4933 | - } | |
| 4934 | - listener(newState); | |
| 4935 | - } | |
| 4936 | - } | |
| 4937 | - /** | |
| 4938 | - * Merges the provided changes into the current state and notifies listeners if there are changes. | |
| 4939 | - * | |
| 4940 | - * @param changes An object containing the changes to apply to the current state. | |
| 4941 | - */ | |
| 4942 | - update(changes) { | |
| 4943 | - for (const key in changes) { | |
| 4944 | - if (!Object.is(this.state[key], changes[key])) { | |
| 4945 | - this.setState({ | |
| 4946 | - ...this.state, | |
| 4947 | - ...changes | |
| 4948 | - }); | |
| 4949 | - return; | |
| 4950 | - } | |
| 4951 | - } | |
| 4952 | - } | |
| 4953 | - /** | |
| 4954 | - * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. | |
| 4955 | - * | |
| 4956 | - * @param key The key in the store's state to update. | |
| 4957 | - * @param value The new value to set for the specified key. | |
| 4958 | - */ | |
| 4959 | - set(key, value) { | |
| 4960 | - if (!Object.is(this.state[key], value)) { | |
| 4961 | - this.setState({ | |
| 4962 | - ...this.state, | |
| 4963 | - [key]: value | |
| 4964 | - }); | |
| 4965 | - } | |
| 4966 | - } | |
| 4967 | - /** | |
| 4968 | - * Gives the state a new reference and updates all registered listeners. | |
| 4969 | - */ | |
| 4970 | - notifyAll() { | |
| 4971 | - const newState = { | |
| 4972 | - ...this.state | |
| 4973 | - }; | |
| 4974 | - this.setState(newState); | |
| 4975 | - } | |
| 4976 | - use(selector, a1, a2, a3) { | |
| 4977 | - return useStore(this, selector, a1, a2, a3); | |
| 4978 | - } | |
| 4979 | - }; | |
| 4980 | - | |
| 4981 | - // node_modules/@base-ui/utils/store/ReactStore.mjs | |
| 4982 | - var React22 = __toESM(require_react(), 1); | |
| 4983 | - var ReactStore = class extends Store { | |
| 4984 | - /** | |
| 4985 | - * Creates a new ReactStore instance. | |
| 4986 | - * | |
| 4987 | - * @param state Initial state of the store. | |
| 4988 | - * @param context Non-reactive context values. | |
| 4989 | - * @param selectors Optional selectors for use with `useState`. | |
| 4990 | - */ | |
| 4991 | - constructor(state, context = {}, selectors3) { | |
| 4992 | - super(state); | |
| 4993 | - this.context = context; | |
| 4994 | - this.selectors = selectors3; | |
| 4995 | - } | |
| 4996 | - /** | |
| 4997 | - * Non-reactive values such as refs, callbacks, etc. | |
| 4998 | - */ | |
| 4999 | - /** | |
| 5000 | - * Synchronizes a single external value into the store. | |
| 5001 | - * | |
| 5002 | - * Note that the while the value in `state` is updated immediately, the value returned | |
| 5003 | - * by `useState` is updated before the next render (similarly to React's `useState`). | |
| 5004 | - */ | |
| 5005 | - useSyncedValue(key, value) { | |
| 5006 | - React22.useDebugValue(key); | |
| 5007 | - const store2 = this; | |
| 5008 | - useIsoLayoutEffect(() => { | |
| 5009 | - if (store2.state[key] !== value) { | |
| 5010 | - store2.set(key, value); | |
| 5011 | - } | |
| 5012 | - }, [store2, key, value]); | |
| 5013 | - } | |
| 5014 | - /** | |
| 5015 | - * Synchronizes a single external value into the store and | |
| 5016 | - * cleans it up (sets to `undefined`) on unmount. | |
| 5017 | - * | |
| 5018 | - * Note that the while the value in `state` is updated immediately, the value returned | |
| 5019 | - * by `useState` is updated before the next render (similarly to React's `useState`). | |
| 5020 | - */ | |
| 5021 | - useSyncedValueWithCleanup(key, value) { | |
| 5022 | - const store2 = this; | |
| 5023 | - useIsoLayoutEffect(() => { | |
| 5024 | - if (store2.state[key] !== value) { | |
| 5025 | - store2.set(key, value); | |
| 5026 | - } | |
| 5027 | - return () => { | |
| 5028 | - store2.set(key, void 0); | |
| 5029 | - }; | |
| 5030 | - }, [store2, key, value]); | |
| 5031 | - } | |
| 5032 | - /** | |
| 5033 | - * Synchronizes multiple external values into the store. | |
| 5034 | - * | |
| 5035 | - * Note that the while the values in `state` are updated immediately, the values returned | |
| 5036 | - * by `useState` are updated before the next render (similarly to React's `useState`). | |
| 5037 | - */ | |
| 5038 | - useSyncedValues(statePart) { | |
| 5039 | - const store2 = this; | |
| 5040 | - if (true) { | |
| 5041 | - React22.useDebugValue(statePart, (p) => Object.keys(p)); | |
| 5042 | - const keys = React22.useRef(Object.keys(statePart)).current; | |
| 5043 | - const nextKeys = Object.keys(statePart); | |
| 5044 | - if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { | |
| 5045 | - console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); | |
| 5046 | - } | |
| 5047 | - } | |
| 5048 | - const dependencies = Object.values(statePart); | |
| 5049 | - useIsoLayoutEffect(() => { | |
| 5050 | - store2.update(statePart); | |
| 5051 | - }, [store2, ...dependencies]); | |
| 5052 | - } | |
| 5053 | - /** | |
| 5054 | - * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` | |
| 5055 | - * is non-undefined, the store's state at `key` is updated to match `controlled`. | |
| 5056 | - */ | |
| 5057 | - useControlledProp(key, controlled) { | |
| 5058 | - React22.useDebugValue(key); | |
| 5059 | - const store2 = this; | |
| 5060 | - const isControlled = controlled !== void 0; | |
| 5061 | - useIsoLayoutEffect(() => { | |
| 5062 | - if (isControlled && !Object.is(store2.state[key], controlled)) { | |
| 5063 | - store2.setState({ | |
| 5064 | - ...store2.state, | |
| 5065 | - [key]: controlled | |
| 5066 | - }); | |
| 5067 | - } | |
| 5068 | - }, [store2, key, controlled, isControlled]); | |
| 5069 | - if (true) { | |
| 5070 | - const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); | |
| 5071 | - if (!cache.has(key)) { | |
| 5072 | - cache.set(key, isControlled); | |
| 5073 | - } | |
| 5074 | - const previouslyControlled = cache.get(key); | |
| 5075 | - if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { | |
| 5076 | - console.error(`A component is changing the ${isControlled ? "" : "un"}controlled state of ${key.toString()} to be ${isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`); | |
| 5077 | - } | |
| 5078 | - } | |
| 5079 | - } | |
| 5080 | - /** Gets the current value from the store using a selector with the provided key. | |
| 5081 | - * | |
| 5082 | - * @param key Key of the selector to use. | |
| 5083 | - */ | |
| 5084 | - select(key, a1, a2, a3) { | |
| 5085 | - const selector = this.selectors[key]; | |
| 5086 | - return selector(this.state, a1, a2, a3); | |
| 5087 | - } | |
| 5088 | - /** | |
| 5089 | - * Returns a value from the store's state using a selector function. | |
| 5090 | - * Used to subscribe to specific parts of the state. | |
| 5091 | - * This methods causes a rerender whenever the selected state changes. | |
| 5092 | - * | |
| 5093 | - * @param key Key of the selector to use. | |
| 5094 | - */ | |
| 5095 | - useState(key, a1, a2, a3) { | |
| 5096 | - React22.useDebugValue(key); | |
| 5097 | - return useStore(this, this.selectors[key], a1, a2, a3); | |
| 5098 | - } | |
| 5099 | - /** | |
| 5100 | - * Wraps a function with `useStableCallback` to ensure it has a stable reference | |
| 5101 | - * and assigns it to the context. | |
| 5102 | - * | |
| 5103 | - * @param key Key of the event callback. Must be a function in the context. | |
| 5104 | - * @param fn Function to assign. | |
| 5105 | - */ | |
| 5106 | - useContextCallback(key, fn) { | |
| 5107 | - React22.useDebugValue(key); | |
| 5108 | - const stableFunction = useStableCallback(fn ?? NOOP); | |
| 5109 | - this.context[key] = stableFunction; | |
| 5110 | - } | |
| 5111 | - /** | |
| 5112 | - * Returns a stable setter function for a specific key in the store's state. | |
| 5113 | - * It's commonly used to pass as a ref callback to React elements. | |
| 5114 | - * | |
| 5115 | - * @param key Key of the state to set. | |
| 5116 | - */ | |
| 5117 | - useStateSetter(key) { | |
| 5118 | - const ref = React22.useRef(void 0); | |
| 5119 | - if (ref.current === void 0) { | |
| 5120 | - ref.current = (value) => { | |
| 5121 | - this.set(key, value); | |
| 5122 | - }; | |
| 5123 | - } | |
| 5124 | - return ref.current; | |
| 5125 | - } | |
| 5126 | - /** | |
| 5127 | - * Observes changes derived from the store's selectors and calls the listener when the selected value changes. | |
| 5128 | - * | |
| 5129 | - * @param key Key of the selector to observe. | |
| 5130 | - * @param listener Listener function called when the selector result changes. | |
| 5131 | - */ | |
| 5132 | - observe(selector, listener) { | |
| 5133 | - let selectFn; | |
| 5134 | - if (typeof selector === "function") { | |
| 5135 | - selectFn = selector; | |
| 5136 | - } else { | |
| 5137 | - selectFn = this.selectors[selector]; | |
| 5138 | - } | |
| 5139 | - let prevValue = selectFn(this.state); | |
| 5140 | - listener(prevValue, prevValue, this); | |
| 5141 | - return this.subscribe((nextState) => { | |
| 5142 | - const nextValue = selectFn(nextState); | |
| 5143 | - if (!Object.is(prevValue, nextValue)) { | |
| 5144 | - const oldValue = prevValue; | |
| 5145 | - prevValue = nextValue; | |
| 5146 | - listener(nextValue, oldValue, this); | |
| 5147 | - } | |
| 5148 | - }); | |
| 5149 | - } | |
| 5150 | - }; | |
| 5151 | - | |
| 5152 | - // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs | |
| 5153 | - var selectors = { | |
| 5154 | - open: createSelector((state) => state.open), | |
| 5155 | - transitionStatus: createSelector((state) => state.transitionStatus), | |
| 5156 | - domReferenceElement: createSelector((state) => state.domReferenceElement), | |
| 5157 | - referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement), | |
| 5158 | - floatingElement: createSelector((state) => state.floatingElement), | |
| 5159 | - floatingId: createSelector((state) => state.floatingId) | |
| 5160 | - }; | |
| 5161 | - var FloatingRootStore = class extends ReactStore { | |
| 5162 | - constructor(options) { | |
| 5163 | - const { | |
| 5164 | - syncOnly, | |
| 5165 | - nested, | |
| 5166 | - onOpenChange, | |
| 5167 | - triggerElements, | |
| 5168 | - ...initialState | |
| 5169 | - } = options; | |
| 5170 | - super({ | |
| 5171 | - ...initialState, | |
| 5172 | - positionReference: initialState.referenceElement, | |
| 5173 | - domReferenceElement: initialState.referenceElement | |
| 5174 | - }, { | |
| 5175 | - onOpenChange, | |
| 5176 | - dataRef: { | |
| 5177 | - current: {} | |
| 5178 | - }, | |
| 5179 | - events: createEventEmitter(), | |
| 5180 | - nested, | |
| 5181 | - triggerElements | |
| 5182 | - }, selectors); | |
| 5183 | - this.syncOnly = syncOnly; | |
| 5184 | - } | |
| 5185 | - /** | |
| 5186 | - * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. | |
| 5187 | - */ | |
| 5188 | - syncOpenEvent = (newOpen, event) => { | |
| 5189 | - if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing | |
| 5190 | - // click events to upgrade a hover-open. | |
| 5191 | - event != null && isClickLikeEvent(event)) { | |
| 5192 | - this.context.dataRef.current.openEvent = newOpen ? event : void 0; | |
| 5193 | - } | |
| 5194 | - }; | |
| 5195 | - /** | |
| 5196 | - * Runs the root-owned side effects for an open state change. | |
| 5197 | - */ | |
| 5198 | - dispatchOpenChange = (newOpen, eventDetails) => { | |
| 5199 | - this.syncOpenEvent(newOpen, eventDetails.event); | |
| 5200 | - const details = { | |
| 5201 | - open: newOpen, | |
| 5202 | - reason: eventDetails.reason, | |
| 5203 | - nativeEvent: eventDetails.event, | |
| 5204 | - nested: this.context.nested, | |
| 5205 | - triggerElement: eventDetails.trigger | |
| 5206 | - }; | |
| 5207 | - this.context.events.emit("openchange", details); | |
| 5208 | - }; | |
| 5209 | - /** | |
| 5210 | - * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. | |
| 5211 | - * | |
| 5212 | - * @param newOpen The new open state. | |
| 5213 | - * @param eventDetails Details about the event that triggered the open state change. | |
| 5214 | - */ | |
| 5215 | - setOpen = (newOpen, eventDetails) => { | |
| 5216 | - if (this.syncOnly) { | |
| 5217 | - this.context.onOpenChange?.(newOpen, eventDetails); | |
| 5218 | - return; | |
| 5219 | - } | |
| 5220 | - this.dispatchOpenChange(newOpen, eventDetails); | |
| 5221 | - this.context.onOpenChange?.(newOpen, eventDetails); | |
| 5222 | - }; | |
| 5223 | - }; | |
| 5224 | - | |
| 5225 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs | |
| 5226 | - function useSyncedFloatingRootContext(options) { | |
| 5227 | - const { | |
| 5228 | - popupStore, | |
| 5229 | - treatPopupAsFloatingElement = false, | |
| 5230 | - floatingRootContext: floatingRootContextProp, | |
| 5231 | - floatingId, | |
| 5232 | - nested, | |
| 5233 | - onOpenChange | |
| 5234 | - } = options; | |
| 5235 | - const open = popupStore.useState("open"); | |
| 5236 | - const referenceElement = popupStore.useState("activeTriggerElement"); | |
| 5237 | - const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); | |
| 5238 | - const triggerElements = popupStore.context.triggerElements; | |
| 5239 | - const handleOpenChange = onOpenChange; | |
| 5240 | - const internalStoreRef = React23.useRef(null); | |
| 5241 | - if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { | |
| 5242 | - internalStoreRef.current = new FloatingRootStore({ | |
| 5243 | - open, | |
| 5244 | - transitionStatus: void 0, | |
| 5245 | - referenceElement, | |
| 5246 | - floatingElement, | |
| 5247 | - triggerElements, | |
| 5248 | - onOpenChange: handleOpenChange, | |
| 5249 | - floatingId, | |
| 5250 | - syncOnly: true, | |
| 5251 | - nested | |
| 5252 | - }); | |
| 5253 | - } | |
| 5254 | - const store2 = floatingRootContextProp ?? internalStoreRef.current; | |
| 5255 | - popupStore.useSyncedValue("floatingId", floatingId); | |
| 5256 | - useIsoLayoutEffect(() => { | |
| 5257 | - const valuesToSync = { | |
| 5258 | - open, | |
| 5259 | - floatingId, | |
| 5260 | - referenceElement, | |
| 5261 | - floatingElement | |
| 5262 | - }; | |
| 5263 | - if (isElement(referenceElement)) { | |
| 5264 | - valuesToSync.domReferenceElement = referenceElement; | |
| 5265 | - } | |
| 5266 | - if (store2.state.positionReference === store2.state.referenceElement) { | |
| 5267 | - valuesToSync.positionReference = referenceElement; | |
| 5268 | - } | |
| 5269 | - store2.update(valuesToSync); | |
| 5270 | - }, [open, floatingId, referenceElement, floatingElement, store2]); | |
| 5271 | - store2.context.onOpenChange = handleOpenChange; | |
| 5272 | - store2.context.nested = nested; | |
| 5273 | - return store2; | |
| 5274 | - } | |
| 5275 | - | |
| 5276 | - // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs | |
| 5277 | - var FOCUSABLE_POPUP_PROPS = { | |
| 5278 | - tabIndex: -1, | |
| 5279 | - [FOCUSABLE_ATTRIBUTE]: "" | |
| 5280 | - }; | |
| 5281 | - function usePopupStore(externalStore, createStore, treatPopupAsFloatingElement = false) { | |
| 5282 | - const floatingId = useId(); | |
| 5283 | - const nested = useFloatingParentNodeId() != null; | |
| 5284 | - const internalStoreRef = React24.useRef(null); | |
| 5285 | - if (externalStore === void 0 && internalStoreRef.current === null) { | |
| 5286 | - internalStoreRef.current = createStore(floatingId, nested); | |
| 5287 | - } | |
| 5288 | - const store2 = externalStore ?? internalStoreRef.current; | |
| 5289 | - useSyncedFloatingRootContext({ | |
| 5290 | - popupStore: store2, | |
| 5291 | - treatPopupAsFloatingElement, | |
| 5292 | - floatingRootContext: store2.state.floatingRootContext, | |
| 5293 | - floatingId, | |
| 5294 | - nested, | |
| 5295 | - onOpenChange: store2.setOpen | |
| 5296 | - }); | |
| 5297 | - return { | |
| 5298 | - store: store2, | |
| 5299 | - internalStore: internalStoreRef.current | |
| 5300 | - }; | |
| 5301 | - } | |
| 5302 | - function useTriggerRegistration(id, store2) { | |
| 5303 | - const registeredElementIdRef = React24.useRef(null); | |
| 5304 | - const registeredElementRef = React24.useRef(null); | |
| 5305 | - return React24.useCallback((element) => { | |
| 5306 | - if (id === void 0) { | |
| 5307 | - return; | |
| 5308 | - } | |
| 5309 | - let shouldSyncTriggerCount = false; | |
| 5310 | - if (registeredElementIdRef.current !== null) { | |
| 5311 | - const registeredId = registeredElementIdRef.current; | |
| 5312 | - const registeredElement = registeredElementRef.current; | |
| 5313 | - const currentElement = store2.context.triggerElements.getById(registeredId); | |
| 5314 | - if (registeredElement && currentElement === registeredElement) { | |
| 5315 | - store2.context.triggerElements.delete(registeredId); | |
| 5316 | - shouldSyncTriggerCount = true; | |
| 5317 | - } | |
| 5318 | - registeredElementIdRef.current = null; | |
| 5319 | - registeredElementRef.current = null; | |
| 5320 | - } | |
| 5321 | - if (element !== null) { | |
| 5322 | - registeredElementIdRef.current = id; | |
| 5323 | - registeredElementRef.current = element; | |
| 5324 | - store2.context.triggerElements.add(id, element); | |
| 5325 | - shouldSyncTriggerCount = true; | |
| 5326 | - } | |
| 5327 | - if (shouldSyncTriggerCount) { | |
| 5328 | - const triggerCount = store2.context.triggerElements.size; | |
| 5329 | - if (store2.select("open") && store2.state.triggerCount !== triggerCount) { | |
| 5330 | - store2.set("triggerCount", triggerCount); | |
| 5331 | - } | |
| 5332 | - } | |
| 5333 | - }, [store2, id]); | |
| 5334 | - } | |
| 5335 | - function setPopupOpenState(state, open, trigger, preventUnmountOnClose = false) { | |
| 5336 | - if (open) { | |
| 5337 | - state.preventUnmountingOnClose = false; | |
| 5338 | - } else if (preventUnmountOnClose) { | |
| 5339 | - state.preventUnmountingOnClose = true; | |
| 5340 | - } | |
| 5341 | - const triggerId = trigger?.id ?? null; | |
| 5342 | - if (triggerId || open) { | |
| 5343 | - state.activeTriggerId = triggerId; | |
| 5344 | - state.activeTriggerElement = trigger ?? null; | |
| 5345 | - } | |
| 5346 | - } | |
| 5347 | - function attachPreventUnmountOnClose(eventDetails) { | |
| 5348 | - let preventUnmountOnClose = false; | |
| 5349 | - eventDetails.preventUnmountOnClose = () => { | |
| 5350 | - preventUnmountOnClose = true; | |
| 5351 | - }; | |
| 5352 | - return () => preventUnmountOnClose; | |
| 5353 | - } | |
| 5354 | - function applyPopupOpenChange(store2, nextOpen, eventDetails, options = {}) { | |
| 5355 | - const reason = eventDetails.reason; | |
| 5356 | - const isHover = reason === reason_parts_exports.triggerHover; | |
| 5357 | - const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; | |
| 5358 | - const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); | |
| 5359 | - const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); | |
| 5360 | - store2.context.onOpenChange?.(nextOpen, eventDetails); | |
| 5361 | - if (eventDetails.isCanceled) { | |
| 5362 | - return; | |
| 5363 | - } | |
| 5364 | - options.onBeforeDispatch?.(); | |
| 5365 | - store2.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); | |
| 5366 | - const changeState = () => { | |
| 5367 | - const updatedState = { | |
| 5368 | - ...options.extraState, | |
| 5369 | - open: nextOpen | |
| 5370 | - }; | |
| 5371 | - if (isFocusOpen) { | |
| 5372 | - updatedState.instantType = "focus"; | |
| 5373 | - } else if (isDismissClose) { | |
| 5374 | - updatedState.instantType = "dismiss"; | |
| 5375 | - } else if (isHover) { | |
| 5376 | - updatedState.instantType = void 0; | |
| 5377 | - } | |
| 5378 | - setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); | |
| 5379 | - store2.update(updatedState); | |
| 5380 | - }; | |
| 5381 | - if (isHover) { | |
| 5382 | - ReactDOM4.flushSync(changeState); | |
| 5383 | - } else { | |
| 5384 | - changeState(); | |
| 5385 | - } | |
| 5386 | - } | |
| 5387 | - function useInitialOpenSync(store2, openProp, defaultOpen, defaultTriggerId) { | |
| 5388 | - useOnFirstRender(() => { | |
| 5389 | - if (openProp === void 0 && store2.state.open === false && defaultOpen) { | |
| 5390 | - store2.state = { | |
| 5391 | - ...store2.state, | |
| 5392 | - open: true, | |
| 5393 | - activeTriggerId: defaultTriggerId, | |
| 5394 | - preventUnmountingOnClose: false | |
| 5395 | - }; | |
| 5396 | - } | |
| 5397 | - }); | |
| 5398 | - } | |
| 5399 | - function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) { | |
| 5400 | - const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId); | |
| 5401 | - const baseRegisterTrigger = useTriggerRegistration(triggerId, store2); | |
| 5402 | - const registerTrigger = useStableCallback((element) => { | |
| 5403 | - baseRegisterTrigger(element); | |
| 5404 | - if (!element) { | |
| 5405 | - return; | |
| 5406 | - } | |
| 5407 | - const open = store2.select("open"); | |
| 5408 | - const activeTriggerId = store2.select("activeTriggerId"); | |
| 5409 | - if (activeTriggerId === triggerId) { | |
| 5410 | - store2.update({ | |
| 5411 | - activeTriggerElement: element, | |
| 5412 | - ...open ? stateUpdates : null | |
| 5413 | - }); | |
| 5414 | - return; | |
| 5415 | - } | |
| 5416 | - if (activeTriggerId == null && open) { | |
| 5417 | - store2.update({ | |
| 5418 | - activeTriggerId: triggerId, | |
| 5419 | - activeTriggerElement: element, | |
| 5420 | - ...stateUpdates | |
| 5421 | - }); | |
| 5422 | - } | |
| 5423 | - }); | |
| 5424 | - useIsoLayoutEffect(() => { | |
| 5425 | - if (isMountedByThisTrigger) { | |
| 5426 | - store2.update({ | |
| 5427 | - activeTriggerElement: triggerElementRef.current, | |
| 5428 | - ...stateUpdates | |
| 5429 | - }); | |
| 5430 | - } | |
| 5431 | - }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]); | |
| 5432 | - return { | |
| 5433 | - registerTrigger, | |
| 5434 | - isMountedByThisTrigger | |
| 5435 | - }; | |
| 5436 | - } | |
| 5437 | - function useImplicitActiveTrigger(store2, options = {}) { | |
| 5438 | - const { | |
| 5439 | - closeOnActiveTriggerUnmount = false | |
| 5440 | - } = options; | |
| 5441 | - const open = store2.useState("open"); | |
| 5442 | - const reactiveTriggerCount = store2.useState("triggerCount"); | |
| 5443 | - useIsoLayoutEffect(() => { | |
| 5444 | - if (!open) { | |
| 5445 | - if (store2.state.triggerCount !== 0) { | |
| 5446 | - store2.set("triggerCount", 0); | |
| 5447 | - } | |
| 5448 | - return; | |
| 5449 | - } | |
| 5450 | - const triggerCount = store2.context.triggerElements.size; | |
| 5451 | - const stateUpdates = {}; | |
| 5452 | - if (store2.state.triggerCount !== triggerCount) { | |
| 5453 | - stateUpdates.triggerCount = triggerCount; | |
| 5454 | - } | |
| 5455 | - const activeTriggerId = store2.select("activeTriggerId"); | |
| 5456 | - let lostActiveTriggerId = null; | |
| 5457 | - if (activeTriggerId) { | |
| 5458 | - const activeTriggerElement = store2.context.triggerElements.getById(activeTriggerId); | |
| 5459 | - if (!activeTriggerElement) { | |
| 5460 | - lostActiveTriggerId = activeTriggerId; | |
| 5461 | - } else if (activeTriggerElement !== store2.state.activeTriggerElement) { | |
| 5462 | - stateUpdates.activeTriggerElement = activeTriggerElement; | |
| 5463 | - } | |
| 5464 | - } | |
| 5465 | - if (!lostActiveTriggerId && !activeTriggerId && triggerCount === 1) { | |
| 5466 | - const iteratorResult = store2.context.triggerElements.entries().next(); | |
| 5467 | - if (!iteratorResult.done) { | |
| 5468 | - const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; | |
| 5469 | - stateUpdates.activeTriggerId = implicitTriggerId; | |
| 5470 | - stateUpdates.activeTriggerElement = implicitTriggerElement; | |
| 5471 | - } | |
| 5472 | - } | |
| 5473 | - if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { | |
| 5474 | - store2.update(stateUpdates); | |
| 5475 | - } | |
| 5476 | - if (lostActiveTriggerId) { | |
| 5477 | - if (closeOnActiveTriggerUnmount) { | |
| 5478 | - queueMicrotask(() => { | |
| 5479 | - if (store2.select("open") && store2.select("activeTriggerId") === lostActiveTriggerId && !store2.context.triggerElements.getById(lostActiveTriggerId)) { | |
| 5480 | - const eventDetails = createChangeEventDetails(reason_parts_exports.none); | |
| 5481 | - store2.setOpen(false, eventDetails); | |
| 5482 | - if (!eventDetails.isCanceled) { | |
| 5483 | - store2.update({ | |
| 5484 | - activeTriggerId: null, | |
| 5485 | - activeTriggerElement: null | |
| 5486 | - }); | |
| 5487 | - } | |
| 5488 | - } | |
| 5489 | - }); | |
| 5490 | - } | |
| 5491 | - } | |
| 5492 | - }, [open, store2, reactiveTriggerCount, closeOnActiveTriggerUnmount]); | |
| 5493 | - } | |
| 5494 | - function useOpenStateTransitions(open, store2, onUnmount) { | |
| 5495 | - const { | |
| 5496 | - mounted, | |
| 5497 | - setMounted, | |
| 5498 | - transitionStatus | |
| 5499 | - } = useTransitionStatus(open); | |
| 5500 | - const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose"); | |
| 5501 | - const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose; | |
| 5502 | - store2.useSyncedValues({ | |
| 5503 | - mounted, | |
| 5504 | - transitionStatus, | |
| 5505 | - preventUnmountingOnClose: syncedPreventUnmountingOnClose | |
| 5506 | - }); | |
| 5507 | - const forceUnmount = useStableCallback(() => { | |
| 5508 | - setMounted(false); | |
| 5509 | - store2.update({ | |
| 5510 | - activeTriggerId: null, | |
| 5511 | - activeTriggerElement: null, | |
| 5512 | - mounted: false, | |
| 5513 | - preventUnmountingOnClose: false | |
| 5514 | - }); | |
| 5515 | - onUnmount?.(); | |
| 5516 | - store2.context.onOpenChangeComplete?.(false); | |
| 5517 | - }); | |
| 5518 | - useOpenChangeComplete({ | |
| 5519 | - enabled: mounted && !open && !syncedPreventUnmountingOnClose, | |
| 5520 | - open, | |
| 5521 | - ref: store2.context.popupRef, | |
| 5522 | - onComplete() { | |
| 5523 | - if (!open) { | |
| 5524 | - forceUnmount(); | |
| 5525 | - } | |
| 5526 | - } | |
| 5527 | - }); | |
| 5528 | - return { | |
| 5529 | - forceUnmount, | |
| 5530 | - transitionStatus | |
| 5531 | - }; | |
| 5532 | - } | |
| 5533 | - function usePopupInteractionProps(store2, statePart) { | |
| 5534 | - store2.useSyncedValues(statePart); | |
| 5535 | - useIsoLayoutEffect(() => () => { | |
| 5536 | - store2.update({ | |
| 5537 | - activeTriggerProps: EMPTY_OBJECT, | |
| 5538 | - inactiveTriggerProps: EMPTY_OBJECT, | |
| 5539 | - popupProps: EMPTY_OBJECT | |
| 5540 | - }); | |
| 5541 | - }, [store2]); | |
| 5542 | - } | |
| 5543 | - | |
| 5544 | - // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs | |
| 5545 | - var PopupTriggerMap = class { | |
| 5546 | - constructor() { | |
| 5547 | - this.elementsSet = /* @__PURE__ */ new Set(); | |
| 5548 | - this.idMap = /* @__PURE__ */ new Map(); | |
| 5549 | - } | |
| 5550 | - /** | |
| 5551 | - * Adds a trigger element with the given ID. | |
| 5552 | - * | |
| 5553 | - * Note: The provided element is assumed to not be registered under multiple IDs. | |
| 5554 | - */ | |
| 5555 | - add(id, element) { | |
| 5556 | - const existingElement = this.idMap.get(id); | |
| 5557 | - if (existingElement === element) { | |
| 5558 | - return; | |
| 5559 | - } | |
| 5560 | - if (existingElement !== void 0) { | |
| 5561 | - this.elementsSet.delete(existingElement); | |
| 5562 | - } | |
| 5563 | - this.elementsSet.add(element); | |
| 5564 | - this.idMap.set(id, element); | |
| 5565 | - if (true) { | |
| 5566 | - if (this.elementsSet.size !== this.idMap.size) { | |
| 5567 | - throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); | |
| 5568 | - } | |
| 5569 | - } | |
| 5570 | - } | |
| 5571 | - /** | |
| 5572 | - * Removes the trigger element with the given ID. | |
| 5573 | - */ | |
| 5574 | - delete(id) { | |
| 5575 | - const element = this.idMap.get(id); | |
| 5576 | - if (element) { | |
| 5577 | - this.elementsSet.delete(element); | |
| 5578 | - this.idMap.delete(id); | |
| 5579 | - } | |
| 5580 | - } | |
| 5581 | - /** | |
| 5582 | - * Whether the given element is registered as a trigger. | |
| 5583 | - */ | |
| 5584 | - hasElement(element) { | |
| 5585 | - return this.elementsSet.has(element); | |
| 5586 | - } | |
| 5587 | - /** | |
| 5588 | - * Whether there is a registered trigger element matching the given predicate. | |
| 5589 | - */ | |
| 5590 | - hasMatchingElement(predicate) { | |
| 5591 | - for (const element of this.elementsSet) { | |
| 5592 | - if (predicate(element)) { | |
| 5593 | - return true; | |
| 5594 | - } | |
| 5595 | - } | |
| 5596 | - return false; | |
| 5597 | - } | |
| 5598 | - /** | |
| 5599 | - * Returns the trigger element associated with the given ID, or undefined if no such element exists. | |
| 5600 | - */ | |
| 5601 | - getById(id) { | |
| 5602 | - return this.idMap.get(id); | |
| 5603 | - } | |
| 5604 | - /** | |
| 5605 | - * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. | |
| 5606 | - */ | |
| 5607 | - entries() { | |
| 5608 | - return this.idMap.entries(); | |
| 5609 | - } | |
| 5610 | - /** | |
| 5611 | - * Returns an iterable of all registered trigger elements. | |
| 5612 | - */ | |
| 5613 | - elements() { | |
| 5614 | - return this.elementsSet.values(); | |
| 5615 | - } | |
| 5616 | - /** | |
| 5617 | - * Returns the number of registered trigger elements. | |
| 5618 | - */ | |
| 5619 | - get size() { | |
| 5620 | - return this.idMap.size; | |
| 5621 | - } | |
| 5622 | - }; | |
| 5623 | - | |
| 5624 | - // node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs | |
| 5625 | - function getEmptyRootContext() { | |
| 5626 | - return new FloatingRootStore({ | |
| 5627 | - open: false, | |
| 5628 | - transitionStatus: void 0, | |
| 5629 | - floatingElement: null, | |
| 5630 | - referenceElement: null, | |
| 5631 | - triggerElements: new PopupTriggerMap(), | |
| 5632 | - floatingId: void 0, | |
| 5633 | - syncOnly: false, | |
| 5634 | - nested: false, | |
| 5635 | - onOpenChange: void 0 | |
| 5636 | - }); | |
| 5637 | - } | |
| 5638 | - | |
| 5639 | - // node_modules/@base-ui/react/utils/popups/store.mjs | |
| 5640 | - function createInitialPopupStoreState() { | |
| 5641 | - return { | |
| 5642 | - open: false, | |
| 5643 | - openProp: void 0, | |
| 5644 | - mounted: false, | |
| 5645 | - transitionStatus: void 0, | |
| 5646 | - floatingRootContext: getEmptyRootContext(), | |
| 5647 | - floatingId: void 0, | |
| 5648 | - triggerCount: 0, | |
| 5649 | - preventUnmountingOnClose: false, | |
| 5650 | - payload: void 0, | |
| 5651 | - activeTriggerId: null, | |
| 5652 | - activeTriggerElement: null, | |
| 5653 | - triggerIdProp: void 0, | |
| 5654 | - popupElement: null, | |
| 5655 | - positionerElement: null, | |
| 5656 | - activeTriggerProps: EMPTY_OBJECT, | |
| 5657 | - inactiveTriggerProps: EMPTY_OBJECT, | |
| 5658 | - popupProps: EMPTY_OBJECT | |
| 5659 | - }; | |
| 5660 | - } | |
| 5661 | - function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) { | |
| 5662 | - return new FloatingRootStore({ | |
| 5663 | - open: false, | |
| 5664 | - transitionStatus: void 0, | |
| 5665 | - floatingElement: null, | |
| 5666 | - referenceElement: null, | |
| 5667 | - triggerElements, | |
| 5668 | - floatingId, | |
| 5669 | - syncOnly: true, | |
| 5670 | - nested, | |
| 5671 | - onOpenChange: void 0 | |
| 5672 | - }); | |
| 5673 | - } | |
| 5674 | - var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId); | |
| 5675 | - var openSelector = createSelector((state) => state.openProp ?? state.open); | |
| 5676 | - var popupIdSelector = createSelector((state) => { | |
| 5677 | - const popupId = state.popupElement?.id ?? state.floatingId; | |
| 5678 | - return popupId || void 0; | |
| 5679 | - }); | |
| 5680 | - function triggerOwnsOpenPopup(state, triggerId) { | |
| 5681 | - return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; | |
| 5682 | - } | |
| 5683 | - function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { | |
| 5684 | - if (triggerOwnsOpenPopup(state, triggerId)) { | |
| 5685 | - return true; | |
| 5686 | - } | |
| 5687 | - return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; | |
| 5688 | - } | |
| 5689 | - var popupStoreSelectors = { | |
| 5690 | - open: openSelector, | |
| 5691 | - mounted: createSelector((state) => state.mounted), | |
| 5692 | - transitionStatus: createSelector((state) => state.transitionStatus), | |
| 5693 | - floatingRootContext: createSelector((state) => state.floatingRootContext), | |
| 5694 | - triggerCount: createSelector((state) => state.triggerCount), | |
| 5695 | - preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose), | |
| 5696 | - payload: createSelector((state) => state.payload), | |
| 5697 | - activeTriggerId: activeTriggerIdSelector, | |
| 5698 | - activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null), | |
| 5699 | - popupId: popupIdSelector, | |
| 5700 | - /** | |
| 5701 | - * Whether the trigger with the given ID was used to open the popup. | |
| 5702 | - */ | |
| 5703 | - isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId), | |
| 5704 | - /** | |
| 5705 | - * Whether the popup is open and was activated by a trigger with the given ID. | |
| 5706 | - */ | |
| 5707 | - isOpenedByTrigger: createSelector((state, triggerId) => triggerOwnsOpenPopup(state, triggerId)), | |
| 5708 | - /** | |
| 5709 | - * Whether the popup is mounted and was activated by a trigger with the given ID. | |
| 5710 | - */ | |
| 5711 | - isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted), | |
| 5712 | - triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps), | |
| 5713 | - /** | |
| 5714 | - * Popup id for the trigger that currently owns the open popup. | |
| 5715 | - */ | |
| 5716 | - triggerPopupId: createSelector((state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0), | |
| 5717 | - popupProps: createSelector((state) => state.popupProps), | |
| 5718 | - popupElement: createSelector((state) => state.popupElement), | |
| 5719 | - positionerElement: createSelector((state) => state.positionerElement) | |
| 5720 | - }; | |
| 5721 | - | |
| 5722 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs | |
| 5723 | - function useFloatingRootContext(options) { | |
| 5724 | - const { | |
| 5725 | - open = false, | |
| 5726 | - onOpenChange, | |
| 5727 | - elements = {} | |
| 5728 | - } = options; | |
| 5729 | - const floatingId = useId(); | |
| 5730 | - const nested = useFloatingParentNodeId() != null; | |
| 5731 | - if (true) { | |
| 5732 | - const optionDomReference = elements.reference; | |
| 5733 | - if (optionDomReference && !isElement(optionDomReference)) { | |
| 5734 | - console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); | |
| 5735 | - } | |
| 5736 | - } | |
| 5737 | - const store2 = useRefWithInit(() => new FloatingRootStore({ | |
| 5738 | - open, | |
| 5739 | - transitionStatus: void 0, | |
| 5740 | - onOpenChange, | |
| 5741 | - referenceElement: elements.reference ?? null, | |
| 5742 | - floatingElement: elements.floating ?? null, | |
| 5743 | - triggerElements: new PopupTriggerMap(), | |
| 5744 | - floatingId, | |
| 5745 | - syncOnly: false, | |
| 5746 | - nested | |
| 5747 | - })).current; | |
| 5748 | - useIsoLayoutEffect(() => { | |
| 5749 | - const valuesToSync = { | |
| 5750 | - open, | |
| 5751 | - floatingId | |
| 5752 | - }; | |
| 5753 | - if (elements.reference !== void 0) { | |
| 5754 | - valuesToSync.referenceElement = elements.reference; | |
| 5755 | - valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null; | |
| 5756 | - } | |
| 5757 | - if (elements.floating !== void 0) { | |
| 5758 | - valuesToSync.floatingElement = elements.floating; | |
| 5759 | - } | |
| 5760 | - store2.update(valuesToSync); | |
| 5761 | - }, [open, floatingId, elements.reference, elements.floating, store2]); | |
| 5762 | - store2.context.onOpenChange = onOpenChange; | |
| 5763 | - store2.context.nested = nested; | |
| 5764 | - return store2; | |
| 5765 | - } | |
| 5766 | - | |
| 5767 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs | |
| 5768 | - function useFloating2(options = {}) { | |
| 5769 | - const { | |
| 5770 | - nodeId, | |
| 5771 | - externalTree | |
| 5772 | - } = options; | |
| 5773 | - const internalStore = useFloatingRootContext(options); | |
| 5774 | - const store2 = options.rootContext || internalStore; | |
| 5775 | - const referenceElement = store2.useState("referenceElement"); | |
| 5776 | - const floatingElement = store2.useState("floatingElement"); | |
| 5777 | - const domReferenceElement = store2.useState("domReferenceElement"); | |
| 5778 | - const open = store2.useState("open"); | |
| 5779 | - const floatingId = store2.useState("floatingId"); | |
| 5780 | - const [positionReference, setPositionReferenceRaw] = React25.useState(null); | |
| 5781 | - const [localDomReference, setLocalDomReference] = React25.useState(void 0); | |
| 5782 | - const [localFloatingElement, setLocalFloatingElement] = React25.useState(void 0); | |
| 5783 | - const domReferenceRef = React25.useRef(null); | |
| 5784 | - const tree = useFloatingTree(externalTree); | |
| 5785 | - const storeElements = React25.useMemo(() => ({ | |
| 5786 | - reference: referenceElement, | |
| 5787 | - floating: floatingElement, | |
| 5788 | - domReference: domReferenceElement | |
| 5789 | - }), [referenceElement, floatingElement, domReferenceElement]); | |
| 5790 | - const position = useFloating({ | |
| 5791 | - ...options, | |
| 5792 | - elements: { | |
| 5793 | - ...storeElements, | |
| 5794 | - ...positionReference && { | |
| 5795 | - reference: positionReference | |
| 5796 | - } | |
| 5797 | - } | |
| 5798 | - }); | |
| 5799 | - const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; | |
| 5800 | - const syncedFloatingElement = localFloatingElement === void 0 ? store2.state.floatingElement : localFloatingElement; | |
| 5801 | - store2.useSyncedValue("referenceElement", localDomReference ?? null); | |
| 5802 | - store2.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); | |
| 5803 | - store2.useSyncedValue("floatingElement", syncedFloatingElement); | |
| 5804 | - const setPositionReference = React25.useCallback((node) => { | |
| 5805 | - const computedPositionReference = isElement(node) ? { | |
| 5806 | - getBoundingClientRect: () => node.getBoundingClientRect(), | |
| 5807 | - getClientRects: () => node.getClientRects(), | |
| 5808 | - contextElement: node | |
| 5809 | - } : node; | |
| 5810 | - setPositionReferenceRaw(computedPositionReference); | |
| 5811 | - position.refs.setReference(computedPositionReference); | |
| 5812 | - }, [position.refs]); | |
| 5813 | - const setReference = React25.useCallback((node) => { | |
| 5814 | - if (isElement(node) || node === null) { | |
| 5815 | - domReferenceRef.current = node; | |
| 5816 | - setLocalDomReference(node); | |
| 5817 | - } | |
| 5818 | - if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to | |
| 5819 | - // `null` to support `positionReference` + an unstable `reference` | |
| 5820 | - // callback ref. | |
| 5821 | - node !== null && !isElement(node)) { | |
| 5822 | - position.refs.setReference(node); | |
| 5823 | - } | |
| 5824 | - }, [position.refs, setLocalDomReference]); | |
| 5825 | - const setFloating = React25.useCallback((node) => { | |
| 5826 | - setLocalFloatingElement(node); | |
| 5827 | - position.refs.setFloating(node); | |
| 5828 | - }, [position.refs]); | |
| 5829 | - const refs = React25.useMemo(() => ({ | |
| 5830 | - ...position.refs, | |
| 5831 | - setReference, | |
| 5832 | - setFloating, | |
| 5833 | - setPositionReference, | |
| 5834 | - domReference: domReferenceRef | |
| 5835 | - }), [position.refs, setReference, setFloating, setPositionReference]); | |
| 5836 | - const elements = React25.useMemo(() => ({ | |
| 5837 | - ...position.elements, | |
| 5838 | - domReference: domReferenceElement | |
| 5839 | - }), [position.elements, domReferenceElement]); | |
| 5840 | - const context = React25.useMemo(() => ({ | |
| 5841 | - ...position, | |
| 5842 | - dataRef: store2.context.dataRef, | |
| 5843 | - open, | |
| 5844 | - onOpenChange: store2.setOpen, | |
| 5845 | - events: store2.context.events, | |
| 5846 | - floatingId, | |
| 5847 | - refs, | |
| 5848 | - elements, | |
| 5849 | - nodeId, | |
| 5850 | - rootStore: store2 | |
| 5851 | - }), [position, refs, elements, nodeId, store2, open, floatingId]); | |
| 5852 | - useIsoLayoutEffect(() => { | |
| 5853 | - if (domReferenceElement) { | |
| 5854 | - domReferenceRef.current = domReferenceElement; | |
| 5855 | - } | |
| 5856 | - }, [domReferenceElement]); | |
| 5857 | - useIsoLayoutEffect(() => { | |
| 5858 | - store2.context.dataRef.current.floatingContext = context; | |
| 5859 | - const node = tree?.nodesRef.current.find((n) => n.id === nodeId); | |
| 5860 | - if (node) { | |
| 5861 | - node.context = context; | |
| 5862 | - } | |
| 5863 | - }); | |
| 5864 | - return React25.useMemo(() => ({ | |
| 5865 | - ...position, | |
| 5866 | - context, | |
| 5867 | - refs, | |
| 5868 | - elements, | |
| 5869 | - rootStore: store2 | |
| 5870 | - }), [position, refs, elements, context, store2]); | |
| 5871 | - } | |
| 5872 | - | |
| 5873 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs | |
| 5874 | - var React26 = __toESM(require_react(), 1); | |
| 5875 | - var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; | |
| 5876 | - function useFocus(context, props = {}) { | |
| 5877 | - const { | |
| 5878 | - enabled = true, | |
| 5879 | - delay | |
| 5880 | - } = props; | |
| 5881 | - const store2 = "rootStore" in context ? context.rootStore : context; | |
| 5882 | - const { | |
| 5883 | - events, | |
| 5884 | - dataRef | |
| 5885 | - } = store2.context; | |
| 5886 | - const blockFocusRef = React26.useRef(false); | |
| 5887 | - const blockedReferenceRef = React26.useRef(null); | |
| 5888 | - const keyboardModalityRef = React26.useRef(true); | |
| 5889 | - const timeout = useTimeout(); | |
| 5890 | - React26.useEffect(() => { | |
| 5891 | - const domReference = store2.select("domReferenceElement"); | |
| 5892 | - if (!enabled) { | |
| 5893 | - return void 0; | |
| 5894 | - } | |
| 5895 | - const win = getWindow(domReference); | |
| 5896 | - function onBlur() { | |
| 5897 | - const currentDomReference = store2.select("domReferenceElement"); | |
| 5898 | - if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { | |
| 5899 | - blockFocusRef.current = true; | |
| 5900 | - } | |
| 5901 | - } | |
| 5902 | - function onKeyDown() { | |
| 5903 | - keyboardModalityRef.current = true; | |
| 5904 | - } | |
| 5905 | - function onPointerDown() { | |
| 5906 | - keyboardModalityRef.current = false; | |
| 5907 | - } | |
| 5908 | - return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); | |
| 5909 | - }, [store2, enabled]); | |
| 5910 | - React26.useEffect(() => { | |
| 5911 | - if (!enabled) { | |
| 5912 | - return void 0; | |
| 5913 | - } | |
| 5914 | - function onOpenChangeLocal(details) { | |
| 5915 | - if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { | |
| 5916 | - const referenceElement = store2.select("domReferenceElement"); | |
| 5917 | - if (isElement(referenceElement)) { | |
| 5918 | - blockedReferenceRef.current = referenceElement; | |
| 5919 | - blockFocusRef.current = true; | |
| 5920 | - } | |
| 5921 | - } | |
| 5922 | - } | |
| 5923 | - events.on("openchange", onOpenChangeLocal); | |
| 5924 | - return () => { | |
| 5925 | - events.off("openchange", onOpenChangeLocal); | |
| 5926 | - }; | |
| 5927 | - }, [events, enabled, store2]); | |
| 5928 | - const reference = React26.useMemo(() => { | |
| 5929 | - function resetBlockedFocus() { | |
| 5930 | - blockFocusRef.current = false; | |
| 5931 | - blockedReferenceRef.current = null; | |
| 5932 | - } | |
| 5933 | - return { | |
| 5934 | - onMouseLeave() { | |
| 5935 | - resetBlockedFocus(); | |
| 5936 | - }, | |
| 5937 | - onFocus(event) { | |
| 5938 | - const focusTarget = event.currentTarget; | |
| 5939 | - if (blockFocusRef.current) { | |
| 5940 | - if (blockedReferenceRef.current === focusTarget) { | |
| 5941 | - return; | |
| 5942 | - } | |
| 5943 | - resetBlockedFocus(); | |
| 5944 | - } | |
| 5945 | - const target = getTarget(event.nativeEvent); | |
| 5946 | - if (isElement(target)) { | |
| 5947 | - if (isMacSafari && !event.relatedTarget) { | |
| 5948 | - if (!keyboardModalityRef.current && !isTypeableElement(target)) { | |
| 5949 | - return; | |
| 5950 | - } | |
| 5951 | - } else if (!matchesFocusVisible(target)) { | |
| 5952 | - return; | |
| 5953 | - } | |
| 5954 | - } | |
| 5955 | - const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements); | |
| 5956 | - const { | |
| 5957 | - nativeEvent, | |
| 5958 | - currentTarget | |
| 5959 | - } = event; | |
| 5960 | - const delayValue = typeof delay === "function" ? delay() : delay; | |
| 5961 | - if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { | |
| 5962 | - store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); | |
| 5963 | - return; | |
| 5964 | - } | |
| 5965 | - timeout.start(delayValue, () => { | |
| 5966 | - if (blockFocusRef.current) { | |
| 5967 | - return; | |
| 5968 | - } | |
| 5969 | - store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); | |
| 5970 | - }); | |
| 5971 | - }, | |
| 5972 | - onBlur(event) { | |
| 5973 | - resetBlockedFocus(); | |
| 5974 | - const relatedTarget = event.relatedTarget; | |
| 5975 | - const nativeEvent = event.nativeEvent; | |
| 5976 | - const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; | |
| 5977 | - timeout.start(0, () => { | |
| 5978 | - const domReference = store2.select("domReferenceElement"); | |
| 5979 | - const activeEl = activeElement(ownerDocument(domReference)); | |
| 5980 | - if (!relatedTarget && activeEl === domReference) { | |
| 5981 | - return; | |
| 5982 | - } | |
| 5983 | - if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { | |
| 5984 | - return; | |
| 5985 | - } | |
| 5986 | - const nextFocusedElement = relatedTarget ?? activeEl; | |
| 5987 | - if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) { | |
| 5988 | - return; | |
| 5989 | - } | |
| 5990 | - store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); | |
| 5991 | - }); | |
| 5992 | - } | |
| 5993 | - }; | |
| 5994 | - }, [dataRef, delay, store2, timeout]); | |
| 5995 | - return React26.useMemo(() => enabled ? { | |
| 5996 | - reference, | |
| 5997 | - trigger: reference | |
| 5998 | - } : {}, [enabled, reference]); | |
| 5999 | - } | |
| 6000 | - | |
| 6001 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs | |
| 6002 | - var React27 = __toESM(require_react(), 1); | |
| 6003 | - | |
| 6004 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs | |
| 6005 | - var HoverInteraction = class _HoverInteraction { | |
| 6006 | - constructor() { | |
| 6007 | - this.pointerType = void 0; | |
| 6008 | - this.interactedInside = false; | |
| 6009 | - this.handler = void 0; | |
| 6010 | - this.blockMouseMove = true; | |
| 6011 | - this.performedPointerEventsMutation = false; | |
| 6012 | - this.pointerEventsScopeElement = null; | |
| 6013 | - this.pointerEventsReferenceElement = null; | |
| 6014 | - this.pointerEventsFloatingElement = null; | |
| 6015 | - this.restTimeoutPending = false; | |
| 6016 | - this.openChangeTimeout = new Timeout(); | |
| 6017 | - this.restTimeout = new Timeout(); | |
| 6018 | - this.handleCloseOptions = void 0; | |
| 6019 | - } | |
| 6020 | - static create() { | |
| 6021 | - return new _HoverInteraction(); | |
| 6022 | - } | |
| 6023 | - dispose = () => { | |
| 6024 | - this.openChangeTimeout.clear(); | |
| 6025 | - this.restTimeout.clear(); | |
| 6026 | - }; | |
| 6027 | - disposeEffect = () => { | |
| 6028 | - return this.dispose; | |
| 6029 | - }; | |
| 6030 | - }; | |
| 6031 | - var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); | |
| 6032 | - function clearSafePolygonPointerEventsMutation(instance) { | |
| 6033 | - if (!instance.performedPointerEventsMutation) { | |
| 6034 | - return; | |
| 6035 | - } | |
| 6036 | - const scopeElement = instance.pointerEventsScopeElement; | |
| 6037 | - if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { | |
| 6038 | - instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); | |
| 6039 | - instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); | |
| 6040 | - instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); | |
| 6041 | - pointerEventsMutationOwnerByScopeElement.delete(scopeElement); | |
| 6042 | - } | |
| 6043 | - instance.performedPointerEventsMutation = false; | |
| 6044 | - instance.pointerEventsScopeElement = null; | |
| 6045 | - instance.pointerEventsReferenceElement = null; | |
| 6046 | - instance.pointerEventsFloatingElement = null; | |
| 6047 | - } | |
| 6048 | - function applySafePolygonPointerEventsMutation(instance, options) { | |
| 6049 | - const { | |
| 6050 | - scopeElement, | |
| 6051 | - referenceElement, | |
| 6052 | - floatingElement | |
| 6053 | - } = options; | |
| 6054 | - const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); | |
| 6055 | - if (existingOwner && existingOwner !== instance) { | |
| 6056 | - clearSafePolygonPointerEventsMutation(existingOwner); | |
| 6057 | - } | |
| 6058 | - clearSafePolygonPointerEventsMutation(instance); | |
| 6059 | - instance.performedPointerEventsMutation = true; | |
| 6060 | - instance.pointerEventsScopeElement = scopeElement; | |
| 6061 | - instance.pointerEventsReferenceElement = referenceElement; | |
| 6062 | - instance.pointerEventsFloatingElement = floatingElement; | |
| 6063 | - pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); | |
| 6064 | - scopeElement.style.pointerEvents = "none"; | |
| 6065 | - referenceElement.style.pointerEvents = "auto"; | |
| 6066 | - floatingElement.style.pointerEvents = "auto"; | |
| 6067 | - } | |
| 6068 | - function useHoverInteractionSharedState(store2) { | |
| 6069 | - const data = store2.context.dataRef.current; | |
| 6070 | - const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; | |
| 6071 | - if (!data.hoverInteractionState) { | |
| 6072 | - data.hoverInteractionState = instance; | |
| 6073 | - } | |
| 6074 | - useOnMount(data.hoverInteractionState.disposeEffect); | |
| 6075 | - return data.hoverInteractionState; | |
| 6076 | - } | |
| 6077 | - | |
| 6078 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs | |
| 6079 | - function useHoverFloatingInteraction(context, parameters = {}) { | |
| 6080 | - const { | |
| 6081 | - enabled = true, | |
| 6082 | - closeDelay: closeDelayProp = 0, | |
| 6083 | - nodeId: nodeIdProp | |
| 6084 | - } = parameters; | |
| 6085 | - const store2 = "rootStore" in context ? context.rootStore : context; | |
| 6086 | - const open = store2.useState("open"); | |
| 6087 | - const floatingElement = store2.useState("floatingElement"); | |
| 6088 | - const domReferenceElement = store2.useState("domReferenceElement"); | |
| 6089 | - const { | |
| 6090 | - dataRef | |
| 6091 | - } = store2.context; | |
| 6092 | - const tree = useFloatingTree(); | |
| 6093 | - const parentId = useFloatingParentNodeId(); | |
| 6094 | - const instance = useHoverInteractionSharedState(store2); | |
| 6095 | - const childClosedTimeout = useTimeout(); | |
| 6096 | - const isClickLikeOpenEvent2 = useStableCallback(() => { | |
| 6097 | - return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); | |
| 6098 | - }); | |
| 6099 | - const isHoverOpen = useStableCallback(() => { | |
| 6100 | - return isHoverOpenEvent(dataRef.current.openEvent?.type); | |
| 6101 | - }); | |
| 6102 | - const clearPointerEvents = useStableCallback(() => { | |
| 6103 | - clearSafePolygonPointerEventsMutation(instance); | |
| 6104 | - }); | |
| 6105 | - useIsoLayoutEffect(() => { | |
| 6106 | - if (!open) { | |
| 6107 | - instance.pointerType = void 0; | |
| 6108 | - instance.restTimeoutPending = false; | |
| 6109 | - instance.interactedInside = false; | |
| 6110 | - clearPointerEvents(); | |
| 6111 | - } | |
| 6112 | - }, [open, instance, clearPointerEvents]); | |
| 6113 | - React27.useEffect(() => { | |
| 6114 | - return clearPointerEvents; | |
| 6115 | - }, [clearPointerEvents]); | |
| 6116 | - useIsoLayoutEffect(() => { | |
| 6117 | - if (!enabled) { | |
| 6118 | - return void 0; | |
| 6119 | - } | |
| 6120 | - if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { | |
| 6121 | - const ref = domReferenceElement; | |
| 6122 | - const floatingEl = floatingElement; | |
| 6123 | - const doc = ownerDocument(floatingElement); | |
| 6124 | - const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; | |
| 6125 | - if (parentFloating) { | |
| 6126 | - parentFloating.style.pointerEvents = ""; | |
| 6127 | - } | |
| 6128 | - const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; | |
| 6129 | - const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; | |
| 6130 | - const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; | |
| 6131 | - applySafePolygonPointerEventsMutation(instance, { | |
| 6132 | - scopeElement, | |
| 6133 | - referenceElement: ref, | |
| 6134 | - floatingElement: floatingEl | |
| 6135 | - }); | |
| 6136 | - return () => { | |
| 6137 | - clearPointerEvents(); | |
| 6138 | - }; | |
| 6139 | - } | |
| 6140 | - return void 0; | |
| 6141 | - }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); | |
| 6142 | - React27.useEffect(() => { | |
| 6143 | - if (!enabled) { | |
| 6144 | - return void 0; | |
| 6145 | - } | |
| 6146 | - function hasParentChildren() { | |
| 6147 | - return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); | |
| 6148 | - } | |
| 6149 | - function closeWithDelay(event) { | |
| 6150 | - const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); | |
| 6151 | - const close = () => { | |
| 6152 | - store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 6153 | - tree?.events.emit("floating.closed", event); | |
| 6154 | - }; | |
| 6155 | - if (closeDelay) { | |
| 6156 | - instance.openChangeTimeout.start(closeDelay, close); | |
| 6157 | - } else { | |
| 6158 | - instance.openChangeTimeout.clear(); | |
| 6159 | - close(); | |
| 6160 | - } | |
| 6161 | - } | |
| 6162 | - function handleInteractInside(event) { | |
| 6163 | - const target = getTarget(event); | |
| 6164 | - if (!isInteractiveElement(target)) { | |
| 6165 | - instance.interactedInside = false; | |
| 6166 | - return; | |
| 6167 | - } | |
| 6168 | - instance.interactedInside = target?.closest("[aria-haspopup]") != null; | |
| 6169 | - } | |
| 6170 | - function onFloatingMouseEnter() { | |
| 6171 | - instance.openChangeTimeout.clear(); | |
| 6172 | - childClosedTimeout.clear(); | |
| 6173 | - tree?.events.off("floating.closed", onNodeClosed); | |
| 6174 | - clearPointerEvents(); | |
| 6175 | - } | |
| 6176 | - function onFloatingMouseLeave(event) { | |
| 6177 | - if (hasParentChildren() && tree) { | |
| 6178 | - tree.events.on("floating.closed", onNodeClosed); | |
| 6179 | - return; | |
| 6180 | - } | |
| 6181 | - if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { | |
| 6182 | - return; | |
| 6183 | - } | |
| 6184 | - const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; | |
| 6185 | - const relatedTarget = event.relatedTarget; | |
| 6186 | - const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); | |
| 6187 | - if (isMovingIntoDescendantFloating) { | |
| 6188 | - return; | |
| 6189 | - } | |
| 6190 | - if (instance.handler) { | |
| 6191 | - instance.handler(event); | |
| 6192 | - return; | |
| 6193 | - } | |
| 6194 | - clearPointerEvents(); | |
| 6195 | - if (isHoverOpen() && !isClickLikeOpenEvent2()) { | |
| 6196 | - closeWithDelay(event); | |
| 6197 | - } | |
| 6198 | - } | |
| 6199 | - function onNodeClosed(event) { | |
| 6200 | - if (!tree || !parentId || hasParentChildren()) { | |
| 6201 | - return; | |
| 6202 | - } | |
| 6203 | - childClosedTimeout.start(0, () => { | |
| 6204 | - tree.events.off("floating.closed", onNodeClosed); | |
| 6205 | - store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 6206 | - tree.events.emit("floating.closed", event); | |
| 6207 | - }); | |
| 6208 | - } | |
| 6209 | - const floating = floatingElement; | |
| 6210 | - return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { | |
| 6211 | - tree?.events.off("floating.closed", onNodeClosed); | |
| 6212 | - }); | |
| 6213 | - }, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); | |
| 6214 | - } | |
| 6215 | - | |
| 6216 | - // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs | |
| 6217 | - var React28 = __toESM(require_react(), 1); | |
| 6218 | - var ReactDOM5 = __toESM(require_react_dom(), 1); | |
| 6219 | - var EMPTY_REF = { | |
| 6220 | - current: null | |
| 6221 | - }; | |
| 6222 | - function useHoverReferenceInteraction(context, props = {}) { | |
| 6223 | - const { | |
| 6224 | - enabled = true, | |
| 6225 | - delay = 0, | |
| 6226 | - handleClose = null, | |
| 6227 | - mouseOnly = false, | |
| 6228 | - restMs = 0, | |
| 6229 | - move = true, | |
| 6230 | - triggerElementRef = EMPTY_REF, | |
| 6231 | - externalTree, | |
| 6232 | - isActiveTrigger = true, | |
| 6233 | - getHandleCloseContext, | |
| 6234 | - isClosing, | |
| 6235 | - shouldOpen: shouldOpenProp | |
| 6236 | - } = props; | |
| 6237 | - const store2 = "rootStore" in context ? context.rootStore : context; | |
| 6238 | - const { | |
| 6239 | - dataRef, | |
| 6240 | - events | |
| 6241 | - } = store2.context; | |
| 6242 | - const tree = useFloatingTree(externalTree); | |
| 6243 | - const instance = useHoverInteractionSharedState(store2); | |
| 6244 | - const isHoverCloseActiveRef = React28.useRef(false); | |
| 6245 | - const handleCloseRef = useValueAsRef(handleClose); | |
| 6246 | - const delayRef = useValueAsRef(delay); | |
| 6247 | - const restMsRef = useValueAsRef(restMs); | |
| 6248 | - const enabledRef = useValueAsRef(enabled); | |
| 6249 | - const shouldOpenRef = useValueAsRef(shouldOpenProp); | |
| 6250 | - const isClosingRef = useValueAsRef(isClosing); | |
| 6251 | - const isClickLikeOpenEvent2 = useStableCallback(() => { | |
| 6252 | - return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); | |
| 6253 | - }); | |
| 6254 | - const checkShouldOpen = useStableCallback(() => { | |
| 6255 | - return shouldOpenRef.current?.() !== false; | |
| 6256 | - }); | |
| 6257 | - const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { | |
| 6258 | - const allTriggers = store2.context.triggerElements; | |
| 6259 | - if (allTriggers.hasElement(currentTarget)) { | |
| 6260 | - return !currentDomReference || !contains(currentDomReference, currentTarget); | |
| 6261 | - } | |
| 6262 | - if (!isElement(target)) { | |
| 6263 | - return false; | |
| 6264 | - } | |
| 6265 | - const targetElement = target; | |
| 6266 | - return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); | |
| 6267 | - }); | |
| 6268 | - const cleanupMouseMoveHandler = useStableCallback(() => { | |
| 6269 | - if (!instance.handler) { | |
| 6270 | - return; | |
| 6271 | - } | |
| 6272 | - const doc = ownerDocument(store2.select("domReferenceElement")); | |
| 6273 | - doc.removeEventListener("mousemove", instance.handler); | |
| 6274 | - instance.handler = void 0; | |
| 6275 | - }); | |
| 6276 | - const clearPointerEvents = useStableCallback(() => { | |
| 6277 | - clearSafePolygonPointerEventsMutation(instance); | |
| 6278 | - }); | |
| 6279 | - if (isActiveTrigger) { | |
| 6280 | - instance.handleCloseOptions = handleCloseRef.current?.__options; | |
| 6281 | - } | |
| 6282 | - React28.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); | |
| 6283 | - React28.useEffect(() => { | |
| 6284 | - if (!enabled) { | |
| 6285 | - return void 0; | |
| 6286 | - } | |
| 6287 | - function onOpenChangeLocal(details) { | |
| 6288 | - if (!details.open) { | |
| 6289 | - isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; | |
| 6290 | - cleanupMouseMoveHandler(); | |
| 6291 | - instance.openChangeTimeout.clear(); | |
| 6292 | - instance.restTimeout.clear(); | |
| 6293 | - instance.blockMouseMove = true; | |
| 6294 | - instance.restTimeoutPending = false; | |
| 6295 | - } else { | |
| 6296 | - isHoverCloseActiveRef.current = false; | |
| 6297 | - } | |
| 6298 | - } | |
| 6299 | - events.on("openchange", onOpenChangeLocal); | |
| 6300 | - return () => { | |
| 6301 | - events.off("openchange", onOpenChangeLocal); | |
| 6302 | - }; | |
| 6303 | - }, [enabled, events, instance, cleanupMouseMoveHandler]); | |
| 6304 | - React28.useEffect(() => { | |
| 6305 | - if (!enabled) { | |
| 6306 | - return void 0; | |
| 6307 | - } | |
| 6308 | - function closeWithDelay(event, runElseBranch = true) { | |
| 6309 | - const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); | |
| 6310 | - if (closeDelay) { | |
| 6311 | - instance.openChangeTimeout.start(closeDelay, () => { | |
| 6312 | - store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 6313 | - tree?.events.emit("floating.closed", event); | |
| 6314 | - }); | |
| 6315 | - } else if (runElseBranch) { | |
| 6316 | - instance.openChangeTimeout.clear(); | |
| 6317 | - store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 6318 | - tree?.events.emit("floating.closed", event); | |
| 6319 | - } | |
| 6320 | - } | |
| 6321 | - const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null); | |
| 6322 | - if (!isElement(trigger)) { | |
| 6323 | - return void 0; | |
| 6324 | - } | |
| 6325 | - function onMouseEnter(event) { | |
| 6326 | - instance.openChangeTimeout.clear(); | |
| 6327 | - instance.blockMouseMove = false; | |
| 6328 | - if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { | |
| 6329 | - return; | |
| 6330 | - } | |
| 6331 | - const restMsValue = getRestMs(restMsRef.current); | |
| 6332 | - const openDelay = getDelay(delayRef.current, "open", instance.pointerType); | |
| 6333 | - const eventTarget = getTarget(event); | |
| 6334 | - const currentTarget = event.currentTarget ?? null; | |
| 6335 | - const currentDomReference = store2.select("domReferenceElement"); | |
| 6336 | - let triggerNode = currentTarget; | |
| 6337 | - if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) { | |
| 6338 | - for (const triggerElement of store2.context.triggerElements.elements()) { | |
| 6339 | - if (contains(triggerElement, eventTarget)) { | |
| 6340 | - triggerNode = triggerElement; | |
| 6341 | - break; | |
| 6342 | - } | |
| 6343 | - } | |
| 6344 | - } | |
| 6345 | - if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { | |
| 6346 | - triggerNode = currentDomReference; | |
| 6347 | - } | |
| 6348 | - const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); | |
| 6349 | - const isOpen = store2.select("open"); | |
| 6350 | - const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending"; | |
| 6351 | - const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; | |
| 6352 | - const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; | |
| 6353 | - const isRestOnlyDelay = restMsValue > 0 && !openDelay; | |
| 6354 | - const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; | |
| 6355 | - const shouldOpen = !isOpen || isOverInactive; | |
| 6356 | - if (shouldOpenImmediately) { | |
| 6357 | - if (checkShouldOpen()) { | |
| 6358 | - store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 6359 | - } | |
| 6360 | - return; | |
| 6361 | - } | |
| 6362 | - if (isRestOnlyDelay) { | |
| 6363 | - return; | |
| 6364 | - } | |
| 6365 | - if (openDelay) { | |
| 6366 | - instance.openChangeTimeout.start(openDelay, () => { | |
| 6367 | - if (shouldOpen && checkShouldOpen()) { | |
| 6368 | - store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 6369 | - } | |
| 6370 | - }); | |
| 6371 | - } else if (shouldOpen) { | |
| 6372 | - if (checkShouldOpen()) { | |
| 6373 | - store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); | |
| 6374 | - } | |
| 6375 | - } | |
| 6376 | - } | |
| 6377 | - function onMouseLeave(event) { | |
| 6378 | - if (isClickLikeOpenEvent2()) { | |
| 6379 | - clearPointerEvents(); | |
| 6380 | - return; | |
| 6381 | - } | |
| 6382 | - cleanupMouseMoveHandler(); | |
| 6383 | - const domReferenceElement = store2.select("domReferenceElement"); | |
| 6384 | - const doc = ownerDocument(domReferenceElement); | |
| 6385 | - instance.restTimeout.clear(); | |
| 6386 | - instance.restTimeoutPending = false; | |
| 6387 | - const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); | |
| 6388 | - if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { | |
| 6389 | - return; | |
| 6390 | - } | |
| 6391 | - if (handleCloseRef.current && handleCloseContextBase) { | |
| 6392 | - if (!store2.select("open")) { | |
| 6393 | - instance.openChangeTimeout.clear(); | |
| 6394 | - } | |
| 6395 | - const currentTrigger = triggerElementRef.current; | |
| 6396 | - instance.handler = handleCloseRef.current({ | |
| 6397 | - ...handleCloseContextBase, | |
| 6398 | - tree, | |
| 6399 | - x: event.clientX, | |
| 6400 | - y: event.clientY, | |
| 6401 | - onClose() { | |
| 6402 | - clearPointerEvents(); | |
| 6403 | - cleanupMouseMoveHandler(); | |
| 6404 | - if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) { | |
| 6405 | - closeWithDelay(event, true); | |
| 6406 | - } | |
| 6407 | - } | |
| 6408 | - }); | |
| 6409 | - doc.addEventListener("mousemove", instance.handler); | |
| 6410 | - instance.handler(event); | |
| 6411 | - return; | |
| 6412 | - } | |
| 6413 | - const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true; | |
| 6414 | - if (shouldClose) { | |
| 6415 | - closeWithDelay(event); | |
| 6416 | - } | |
| 6417 | - } | |
| 6418 | - if (move) { | |
| 6419 | - return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { | |
| 6420 | - once: true | |
| 6421 | - }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); | |
| 6422 | - } | |
| 6423 | - return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); | |
| 6424 | - }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen]); | |
| 6425 | - return React28.useMemo(() => { | |
| 6426 | - if (!enabled) { | |
| 6427 | - return void 0; | |
| 6428 | - } | |
| 6429 | - function setPointerRef(event) { | |
| 6430 | - instance.pointerType = event.pointerType; | |
| 6431 | - } | |
| 6432 | - return { | |
| 6433 | - onPointerDown: setPointerRef, | |
| 6434 | - onPointerEnter: setPointerRef, | |
| 6435 | - onMouseMove(event) { | |
| 6436 | - const { | |
| 6437 | - nativeEvent | |
| 6438 | - } = event; | |
| 6439 | - const trigger = event.currentTarget; | |
| 6440 | - const currentDomReference = store2.select("domReferenceElement"); | |
| 6441 | - const currentOpen = store2.select("open"); | |
| 6442 | - const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); | |
| 6443 | - if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { | |
| 6444 | - return; | |
| 6445 | - } | |
| 6446 | - if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { | |
| 6447 | - const floatingElement = store2.select("floatingElement"); | |
| 6448 | - if (floatingElement) { | |
| 6449 | - const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; | |
| 6450 | - applySafePolygonPointerEventsMutation(instance, { | |
| 6451 | - scopeElement, | |
| 6452 | - referenceElement: trigger, | |
| 6453 | - floatingElement | |
| 6454 | - }); | |
| 6455 | - } | |
| 6456 | - } | |
| 6457 | - const restMsValue = getRestMs(restMsRef.current); | |
| 6458 | - if (currentOpen && !isOverInactive || restMsValue === 0) { | |
| 6459 | - return; | |
| 6460 | - } | |
| 6461 | - if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { | |
| 6462 | - return; | |
| 6463 | - } | |
| 6464 | - instance.restTimeout.clear(); | |
| 6465 | - function handleMouseMove() { | |
| 6466 | - instance.restTimeoutPending = false; | |
| 6467 | - if (isClickLikeOpenEvent2()) { | |
| 6468 | - return; | |
| 6469 | - } | |
| 6470 | - const latestOpen = store2.select("open"); | |
| 6471 | - if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { | |
| 6472 | - store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); | |
| 6473 | - } | |
| 6474 | - } | |
| 6475 | - if (instance.pointerType === "touch") { | |
| 6476 | - ReactDOM5.flushSync(() => { | |
| 6477 | - handleMouseMove(); | |
| 6478 | - }); | |
| 6479 | - } else if (isOverInactive && currentOpen) { | |
| 6480 | - handleMouseMove(); | |
| 6481 | - } else { | |
| 6482 | - instance.restTimeoutPending = true; | |
| 6483 | - instance.restTimeout.start(restMsValue, handleMouseMove); | |
| 6484 | - } | |
| 6485 | - } | |
| 6486 | - }; | |
| 6487 | - }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]); | |
| 6488 | - } | |
| 6489 | - | |
| 6490 | - // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs | |
| 6491 | - var CURSOR_SPEED_THRESHOLD = 0.1; | |
| 6492 | - var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; | |
| 6493 | - var POLYGON_BUFFER = 0.5; | |
| 6494 | - function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { | |
| 6495 | - return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; | |
| 6496 | - } | |
| 6497 | - function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { | |
| 6498 | - let isInsideValue = false; | |
| 6499 | - if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { | |
| 6500 | - isInsideValue = !isInsideValue; | |
| 6501 | - } | |
| 6502 | - if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { | |
| 6503 | - isInsideValue = !isInsideValue; | |
| 6504 | - } | |
| 6505 | - if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { | |
| 6506 | - isInsideValue = !isInsideValue; | |
| 6507 | - } | |
| 6508 | - if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { | |
| 6509 | - isInsideValue = !isInsideValue; | |
| 6510 | - } | |
| 6511 | - return isInsideValue; | |
| 6512 | - } | |
| 6513 | - function isInsideRect(pointX, pointY, rect) { | |
| 6514 | - return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; | |
| 6515 | - } | |
| 6516 | - function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { | |
| 6517 | - const minX = Math.min(x1, x2); | |
| 6518 | - const maxX = Math.max(x1, x2); | |
| 6519 | - const minY = Math.min(y1, y2); | |
| 6520 | - const maxY = Math.max(y1, y2); | |
| 6521 | - return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; | |
| 6522 | - } | |
| 6523 | - function safePolygon(options = {}) { | |
| 6524 | - const { | |
| 6525 | - blockPointerEvents = false | |
| 6526 | - } = options; | |
| 6527 | - const timeout = new Timeout(); | |
| 6528 | - const fn = ({ | |
| 6529 | - x, | |
| 6530 | - y, | |
| 6531 | - placement, | |
| 6532 | - elements, | |
| 6533 | - onClose, | |
| 6534 | - nodeId, | |
| 6535 | - tree | |
| 6536 | - }) => { | |
| 6537 | - const side = placement?.split("-")[0]; | |
| 6538 | - let hasLanded = false; | |
| 6539 | - let lastX = null; | |
| 6540 | - let lastY = null; | |
| 6541 | - let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; | |
| 6542 | - function isCursorMovingSlowly(nextX, nextY) { | |
| 6543 | - const currentTime = performance.now(); | |
| 6544 | - const elapsedTime = currentTime - lastCursorTime; | |
| 6545 | - if (lastX === null || lastY === null || elapsedTime === 0) { | |
| 6546 | - lastX = nextX; | |
| 6547 | - lastY = nextY; | |
| 6548 | - lastCursorTime = currentTime; | |
| 6549 | - return false; | |
| 6550 | - } | |
| 6551 | - const deltaX = nextX - lastX; | |
| 6552 | - const deltaY = nextY - lastY; | |
| 6553 | - const distanceSquared = deltaX * deltaX + deltaY * deltaY; | |
| 6554 | - const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; | |
| 6555 | - lastX = nextX; | |
| 6556 | - lastY = nextY; | |
| 6557 | - lastCursorTime = currentTime; | |
| 6558 | - return distanceSquared < thresholdSquared; | |
| 6559 | - } | |
| 6560 | - function close() { | |
| 6561 | - timeout.clear(); | |
| 6562 | - onClose(); | |
| 6563 | - } | |
| 6564 | - return function onMouseMove(event) { | |
| 6565 | - timeout.clear(); | |
| 6566 | - const domReference = elements.domReference; | |
| 6567 | - const floating = elements.floating; | |
| 6568 | - if (!domReference || !floating || side == null || x == null || y == null) { | |
| 6569 | - return void 0; | |
| 6570 | - } | |
| 6571 | - const { | |
| 6572 | - clientX, | |
| 6573 | - clientY | |
| 6574 | - } = event; | |
| 6575 | - const target = getTarget(event); | |
| 6576 | - const isLeave = event.type === "mouseleave"; | |
| 6577 | - const isOverFloatingEl = contains(floating, target); | |
| 6578 | - const isOverReferenceEl = contains(domReference, target); | |
| 6579 | - if (isOverFloatingEl) { | |
| 6580 | - hasLanded = true; | |
| 6581 | - if (!isLeave) { | |
| 6582 | - return void 0; | |
| 6583 | - } | |
| 6584 | - } | |
| 6585 | - if (isOverReferenceEl) { | |
| 6586 | - hasLanded = false; | |
| 6587 | - if (!isLeave) { | |
| 6588 | - hasLanded = true; | |
| 6589 | - return void 0; | |
| 6590 | - } | |
| 6591 | - } | |
| 6592 | - if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { | |
| 6593 | - return void 0; | |
| 6594 | - } | |
| 6595 | - function hasOpenChildNode() { | |
| 6596 | - return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); | |
| 6597 | - } | |
| 6598 | - function closeIfNoOpenChild() { | |
| 6599 | - if (!hasOpenChildNode()) { | |
| 6600 | - close(); | |
| 6601 | - } | |
| 6602 | - } | |
| 6603 | - if (hasOpenChildNode()) { | |
| 6604 | - return void 0; | |
| 6605 | - } | |
| 6606 | - const refRect = domReference.getBoundingClientRect(); | |
| 6607 | - const rect = floating.getBoundingClientRect(); | |
| 6608 | - const cursorLeaveFromRight = x > rect.right - rect.width / 2; | |
| 6609 | - const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; | |
| 6610 | - const isFloatingWider = rect.width > refRect.width; | |
| 6611 | - const isFloatingTaller = rect.height > refRect.height; | |
| 6612 | - const left = (isFloatingWider ? refRect : rect).left; | |
| 6613 | - const right = (isFloatingWider ? refRect : rect).right; | |
| 6614 | - const top = (isFloatingTaller ? refRect : rect).top; | |
| 6615 | - const bottom = (isFloatingTaller ? refRect : rect).bottom; | |
| 6616 | - if (side === "top" && y >= refRect.bottom - 1 || side === "bottom" && y <= refRect.top + 1 || side === "left" && x >= refRect.right - 1 || side === "right" && x <= refRect.left + 1) { | |
| 6617 | - closeIfNoOpenChild(); | |
| 6618 | - return void 0; | |
| 6619 | - } | |
| 6620 | - let isInsideTroughRect = false; | |
| 6621 | - switch (side) { | |
| 6622 | - case "top": | |
| 6623 | - isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); | |
| 6624 | - break; | |
| 6625 | - case "bottom": | |
| 6626 | - isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); | |
| 6627 | - break; | |
| 6628 | - case "left": | |
| 6629 | - isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); | |
| 6630 | - break; | |
| 6631 | - case "right": | |
| 6632 | - isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); | |
| 6633 | - break; | |
| 6634 | - default: | |
| 6635 | - } | |
| 6636 | - if (isInsideTroughRect) { | |
| 6637 | - return void 0; | |
| 6638 | - } | |
| 6639 | - if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { | |
| 6640 | - closeIfNoOpenChild(); | |
| 6641 | - return void 0; | |
| 6642 | - } | |
| 6643 | - if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { | |
| 6644 | - closeIfNoOpenChild(); | |
| 6645 | - return void 0; | |
| 6646 | - } | |
| 6647 | - let isInsidePolygon = false; | |
| 6648 | - switch (side) { | |
| 6649 | - case "top": { | |
| 6650 | - const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 6651 | - const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 6652 | - const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 6653 | - const cursorPointY = y + POLYGON_BUFFER + 1; | |
| 6654 | - const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; | |
| 6655 | - const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; | |
| 6656 | - isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); | |
| 6657 | - break; | |
| 6658 | - } | |
| 6659 | - case "bottom": { | |
| 6660 | - const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 6661 | - const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 6662 | - const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; | |
| 6663 | - const cursorPointY = y - POLYGON_BUFFER; | |
| 6664 | - const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; | |
| 6665 | - const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; | |
| 6666 | - isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); | |
| 6667 | - break; | |
| 6668 | - } | |
| 6669 | - case "left": { | |
| 6670 | - const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 6671 | - const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 6672 | - const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 6673 | - const cursorPointX = x + POLYGON_BUFFER + 1; | |
| 6674 | - const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; | |
| 6675 | - const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; | |
| 6676 | - isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); | |
| 6677 | - break; | |
| 6678 | - } | |
| 6679 | - case "right": { | |
| 6680 | - const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; | |
| 6681 | - const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 6682 | - const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; | |
| 6683 | - const cursorPointX = x - POLYGON_BUFFER; | |
| 6684 | - const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; | |
| 6685 | - const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; | |
| 6686 | - isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); | |
| 6687 | - break; | |
| 6688 | - } | |
| 6689 | - default: | |
| 6690 | - } | |
| 6691 | - if (!isInsidePolygon) { | |
| 6692 | - closeIfNoOpenChild(); | |
| 6693 | - } else if (!hasLanded) { | |
| 6694 | - timeout.start(40, closeIfNoOpenChild); | |
| 6695 | - } | |
| 6696 | - return void 0; | |
| 6697 | - }; | |
| 6698 | - }; | |
| 6699 | - fn.__options = { | |
| 6700 | - ...options, | |
| 6701 | - blockPointerEvents | |
| 6702 | - }; | |
| 6703 | - return fn; | |
| 6704 | - } | |
| 6705 | - | |
| 6706 | - // node_modules/@base-ui/react/utils/popupStateMapping.mjs | |
| 6707 | - var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) { | |
| 6708 | - CommonPopupDataAttributes2["open"] = "data-open"; | |
| 6709 | - CommonPopupDataAttributes2["closed"] = "data-closed"; | |
| 6710 | - CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; | |
| 6711 | - CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; | |
| 6712 | - CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden"; | |
| 6713 | - CommonPopupDataAttributes2["side"] = "data-side"; | |
| 6714 | - CommonPopupDataAttributes2["align"] = "data-align"; | |
| 6715 | - return CommonPopupDataAttributes2; | |
| 6716 | - })({}); | |
| 6717 | - var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) { | |
| 6718 | - CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open"; | |
| 6719 | - CommonTriggerDataAttributes2["pressed"] = "data-pressed"; | |
| 6720 | - return CommonTriggerDataAttributes2; | |
| 6721 | - })({}); | |
| 6722 | - var TRIGGER_HOOK = { | |
| 6723 | - [CommonTriggerDataAttributes.popupOpen]: "" | |
| 6724 | - }; | |
| 6725 | - var PRESSABLE_TRIGGER_HOOK = { | |
| 6726 | - [CommonTriggerDataAttributes.popupOpen]: "", | |
| 6727 | - [CommonTriggerDataAttributes.pressed]: "" | |
| 6728 | - }; | |
| 6729 | - var POPUP_OPEN_HOOK = { | |
| 6730 | - [CommonPopupDataAttributes.open]: "" | |
| 6731 | - }; | |
| 6732 | - var POPUP_CLOSED_HOOK = { | |
| 6733 | - [CommonPopupDataAttributes.closed]: "" | |
| 6734 | - }; | |
| 6735 | - var ANCHOR_HIDDEN_HOOK = { | |
| 6736 | - [CommonPopupDataAttributes.anchorHidden]: "" | |
| 6737 | - }; | |
| 6738 | - var triggerOpenStateMapping = { | |
| 6739 | - open(value) { | |
| 6740 | - if (value) { | |
| 6741 | - return TRIGGER_HOOK; | |
| 6742 | - } | |
| 6743 | - return null; | |
| 6744 | - } | |
| 6745 | - }; | |
| 6746 | - var popupStateMapping = { | |
| 6747 | - open(value) { | |
| 6748 | - if (value) { | |
| 6749 | - return POPUP_OPEN_HOOK; | |
| 6750 | - } | |
| 6751 | - return POPUP_CLOSED_HOOK; | |
| 6752 | - }, | |
| 6753 | - anchorHidden(value) { | |
| 6754 | - if (value) { | |
| 6755 | - return ANCHOR_HIDDEN_HOOK; | |
| 6756 | - } | |
| 6757 | - return null; | |
| 6758 | - } | |
| 6759 | - }; | |
| 6760 | - | |
| 6761 | - // node_modules/@base-ui/utils/inertValue.mjs | |
| 6762 | - function inertValue(value) { | |
| 6763 | - if (isReactVersionAtLeast(19)) { | |
| 6764 | - return value; | |
| 6765 | - } | |
| 6766 | - return value ? "true" : void 0; | |
| 6767 | - } | |
| 6768 | - | |
| 6769 | - // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs | |
| 6770 | - var React29 = __toESM(require_react(), 1); | |
| 6771 | - | |
| 6772 | - // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs | |
| 6773 | - var baseArrow = (options) => ({ | |
| 6774 | - name: "arrow", | |
| 6775 | - options, | |
| 6776 | - async fn(state) { | |
| 6777 | - const { | |
| 6778 | - x, | |
| 6779 | - y, | |
| 6780 | - placement, | |
| 6781 | - rects, | |
| 6782 | - platform: platform3, | |
| 6783 | - elements, | |
| 6784 | - middlewareData | |
| 6785 | - } = state; | |
| 6786 | - const { | |
| 6787 | - element, | |
| 6788 | - padding = 0, | |
| 6789 | - offsetParent = "real" | |
| 6790 | - } = evaluate(options, state) || {}; | |
| 6791 | - if (element == null) { | |
| 6792 | - return {}; | |
| 6793 | - } | |
| 6794 | - const paddingObject = getPaddingObject(padding); | |
| 6795 | - const coords = { | |
| 6796 | - x, | |
| 6797 | - y | |
| 6798 | - }; | |
| 6799 | - const axis = getAlignmentAxis(placement); | |
| 6800 | - const length = getAxisLength(axis); | |
| 6801 | - const arrowDimensions = await platform3.getDimensions(element); | |
| 6802 | - const isYAxis = axis === "y"; | |
| 6803 | - const minProp = isYAxis ? "top" : "left"; | |
| 6804 | - const maxProp = isYAxis ? "bottom" : "right"; | |
| 6805 | - const clientProp = isYAxis ? "clientHeight" : "clientWidth"; | |
| 6806 | - const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; | |
| 6807 | - const startDiff = coords[axis] - rects.reference[axis]; | |
| 6808 | - const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; | |
| 6809 | - let clientSize = elements.floating[clientProp] || rects.floating[length]; | |
| 6810 | - if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { | |
| 6811 | - clientSize = elements.floating[clientProp] || rects.floating[length]; | |
| 6812 | - } | |
| 6813 | - const centerToReference = endDiff / 2 - startDiff / 2; | |
| 6814 | - const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; | |
| 6815 | - const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); | |
| 6816 | - const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); | |
| 6817 | - const min2 = minPadding; | |
| 6818 | - const max2 = clientSize - arrowDimensions[length] - maxPadding; | |
| 6819 | - const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; | |
| 6820 | - const offset4 = clamp(min2, center, max2); | |
| 6821 | - const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; | |
| 6822 | - const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; | |
| 6823 | - return { | |
| 6824 | - [axis]: coords[axis] + alignmentOffset, | |
| 6825 | - data: { | |
| 6826 | - [axis]: offset4, | |
| 6827 | - centerOffset: center - offset4 - alignmentOffset, | |
| 6828 | - ...shouldAddOffset && { | |
| 6829 | - alignmentOffset | |
| 6830 | - } | |
| 6831 | - }, | |
| 6832 | - reset: shouldAddOffset | |
| 6833 | - }; | |
| 6834 | - } | |
| 6835 | - }); | |
| 6836 | - var arrow4 = (options, deps) => ({ | |
| 6837 | - ...baseArrow(options), | |
| 6838 | - options: [options, deps] | |
| 6839 | - }); | |
| 6840 | - | |
| 6841 | - // node_modules/@base-ui/react/utils/hideMiddleware.mjs | |
| 6842 | - var nativeHideFn = hide3().fn; | |
| 6843 | - var hide4 = { | |
| 6844 | - name: "hide", | |
| 6845 | - async fn(state) { | |
| 6846 | - const { | |
| 6847 | - width, | |
| 6848 | - height, | |
| 6849 | - x, | |
| 6850 | - y | |
| 6851 | - } = state.rects.reference; | |
| 6852 | - const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0; | |
| 6853 | - const nativeHideResult = await nativeHideFn(state); | |
| 6854 | - return { | |
| 6855 | - data: { | |
| 6856 | - referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden | |
| 6857 | - } | |
| 6858 | - }; | |
| 6859 | - } | |
| 6860 | - }; | |
| 6861 | - | |
| 6862 | - // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs | |
| 6863 | - var DEFAULT_SIDES = { | |
| 6864 | - sideX: "left", | |
| 6865 | - sideY: "top" | |
| 6866 | - }; | |
| 6867 | - var adaptiveOrigin = { | |
| 6868 | - name: "adaptiveOrigin", | |
| 6869 | - async fn(state) { | |
| 6870 | - const { | |
| 6871 | - x: rawX, | |
| 6872 | - y: rawY, | |
| 6873 | - rects: { | |
| 6874 | - floating: floatRect | |
| 6875 | - }, | |
| 6876 | - elements: { | |
| 6877 | - floating | |
| 6878 | - }, | |
| 6879 | - platform: platform3, | |
| 6880 | - strategy, | |
| 6881 | - placement | |
| 6882 | - } = state; | |
| 6883 | - const win = getWindow(floating); | |
| 6884 | - const styles = win.getComputedStyle(floating); | |
| 6885 | - const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; | |
| 6886 | - if (!hasTransition) { | |
| 6887 | - return { | |
| 6888 | - x: rawX, | |
| 6889 | - y: rawY, | |
| 6890 | - data: DEFAULT_SIDES | |
| 6891 | - }; | |
| 6892 | - } | |
| 6893 | - const offsetParent = await platform3.getOffsetParent?.(floating); | |
| 6894 | - let offsetDimensions = { | |
| 6895 | - width: 0, | |
| 6896 | - height: 0 | |
| 6897 | - }; | |
| 6898 | - if (strategy === "fixed" && win?.visualViewport) { | |
| 6899 | - offsetDimensions = { | |
| 6900 | - width: win.visualViewport.width, | |
| 6901 | - height: win.visualViewport.height | |
| 6902 | - }; | |
| 6903 | - } else if (offsetParent === win) { | |
| 6904 | - const doc = ownerDocument(floating); | |
| 6905 | - offsetDimensions = { | |
| 6906 | - width: doc.documentElement.clientWidth, | |
| 6907 | - height: doc.documentElement.clientHeight | |
| 6908 | - }; | |
| 6909 | - } else if (await platform3.isElement?.(offsetParent)) { | |
| 6910 | - offsetDimensions = await platform3.getDimensions(offsetParent); | |
| 6911 | - } | |
| 6912 | - const currentSide = getSide(placement); | |
| 6913 | - let x = rawX; | |
| 6914 | - let y = rawY; | |
| 6915 | - if (currentSide === "left") { | |
| 6916 | - x = offsetDimensions.width - (rawX + floatRect.width); | |
| 6917 | - } | |
| 6918 | - if (currentSide === "top") { | |
| 6919 | - y = offsetDimensions.height - (rawY + floatRect.height); | |
| 6920 | - } | |
| 6921 | - const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; | |
| 6922 | - const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; | |
| 6923 | - return { | |
| 6924 | - x, | |
| 6925 | - y, | |
| 6926 | - data: { | |
| 6927 | - sideX, | |
| 6928 | - sideY | |
| 6929 | - } | |
| 6930 | - }; | |
| 6931 | - } | |
| 6932 | - }; | |
| 6933 | - | |
| 6934 | - // node_modules/@base-ui/react/utils/useAnchorPositioning.mjs | |
| 6935 | - function getLogicalSide(sideParam, renderedSide, isRtl) { | |
| 6936 | - const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; | |
| 6937 | - const logicalRight = isRtl ? "inline-start" : "inline-end"; | |
| 6938 | - const logicalLeft = isRtl ? "inline-end" : "inline-start"; | |
| 6939 | - return { | |
| 6940 | - top: "top", | |
| 6941 | - right: isLogicalSideParam ? logicalRight : "right", | |
| 6942 | - bottom: "bottom", | |
| 6943 | - left: isLogicalSideParam ? logicalLeft : "left" | |
| 6944 | - }[renderedSide]; | |
| 6945 | - } | |
| 6946 | - function getOffsetData(state, sideParam, isRtl) { | |
| 6947 | - const { | |
| 6948 | - rects, | |
| 6949 | - placement | |
| 6950 | - } = state; | |
| 6951 | - const data = { | |
| 6952 | - side: getLogicalSide(sideParam, getSide(placement), isRtl), | |
| 6953 | - align: getAlignment(placement) || "center", | |
| 6954 | - anchor: { | |
| 6955 | - width: rects.reference.width, | |
| 6956 | - height: rects.reference.height | |
| 6957 | - }, | |
| 6958 | - positioner: { | |
| 6959 | - width: rects.floating.width, | |
| 6960 | - height: rects.floating.height | |
| 6961 | - } | |
| 6962 | - }; | |
| 6963 | - return data; | |
| 6964 | - } | |
| 6965 | - function useAnchorPositioning(params) { | |
| 6966 | - const { | |
| 6967 | - // Public parameters | |
| 6968 | - anchor, | |
| 6969 | - positionMethod = "absolute", | |
| 6970 | - side: sideParam = "bottom", | |
| 6971 | - sideOffset = 0, | |
| 6972 | - align = "center", | |
| 6973 | - alignOffset = 0, | |
| 6974 | - collisionBoundary, | |
| 6975 | - collisionPadding: collisionPaddingParam = 5, | |
| 6976 | - sticky = false, | |
| 6977 | - arrowPadding = 5, | |
| 6978 | - disableAnchorTracking = false, | |
| 6979 | - inline: inlineMiddleware, | |
| 6980 | - // Private parameters | |
| 6981 | - keepMounted = false, | |
| 6982 | - floatingRootContext, | |
| 6983 | - mounted, | |
| 6984 | - collisionAvoidance, | |
| 6985 | - shiftCrossAxis = false, | |
| 6986 | - nodeId, | |
| 6987 | - adaptiveOrigin: adaptiveOrigin2, | |
| 6988 | - lazyFlip = false, | |
| 6989 | - externalTree | |
| 6990 | - } = params; | |
| 6991 | - const [mountSide, setMountSide] = React29.useState(null); | |
| 6992 | - if (!mounted && mountSide !== null) { | |
| 6993 | - setMountSide(null); | |
| 6994 | - } | |
| 6995 | - const collisionAvoidanceSide = collisionAvoidance.side || "flip"; | |
| 6996 | - const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; | |
| 6997 | - const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; | |
| 6998 | - const anchorFn = typeof anchor === "function" ? anchor : void 0; | |
| 6999 | - const anchorFnCallback = useStableCallback(anchorFn); | |
| 7000 | - const anchorDep = anchorFn ? anchorFnCallback : anchor; | |
| 7001 | - const anchorValueRef = useValueAsRef(anchor); | |
| 7002 | - const mountedRef = useValueAsRef(mounted); | |
| 7003 | - const direction = useDirection(); | |
| 7004 | - const isRtl = direction === "rtl"; | |
| 7005 | - const side = mountSide || { | |
| 7006 | - top: "top", | |
| 7007 | - right: "right", | |
| 7008 | - bottom: "bottom", | |
| 7009 | - left: "left", | |
| 7010 | - "inline-end": isRtl ? "left" : "right", | |
| 7011 | - "inline-start": isRtl ? "right" : "left" | |
| 7012 | - }[sideParam]; | |
| 7013 | - const placement = align === "center" ? side : `${side}-${align}`; | |
| 7014 | - let collisionPadding = collisionPaddingParam; | |
| 7015 | - const bias = 1; | |
| 7016 | - const biasTop = sideParam === "bottom" ? bias : 0; | |
| 7017 | - const biasBottom = sideParam === "top" ? bias : 0; | |
| 7018 | - const biasLeft = sideParam === "right" ? bias : 0; | |
| 7019 | - const biasRight = sideParam === "left" ? bias : 0; | |
| 7020 | - if (typeof collisionPadding === "number") { | |
| 7021 | - collisionPadding = { | |
| 7022 | - top: collisionPadding + biasTop, | |
| 7023 | - right: collisionPadding + biasRight, | |
| 7024 | - bottom: collisionPadding + biasBottom, | |
| 7025 | - left: collisionPadding + biasLeft | |
| 7026 | - }; | |
| 7027 | - } else if (collisionPadding) { | |
| 7028 | - collisionPadding = { | |
| 7029 | - top: (collisionPadding.top || 0) + biasTop, | |
| 7030 | - right: (collisionPadding.right || 0) + biasRight, | |
| 7031 | - bottom: (collisionPadding.bottom || 0) + biasBottom, | |
| 7032 | - left: (collisionPadding.left || 0) + biasLeft | |
| 7033 | - }; | |
| 7034 | - } | |
| 7035 | - const commonCollisionProps = { | |
| 7036 | - boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, | |
| 7037 | - padding: collisionPadding | |
| 7038 | - }; | |
| 7039 | - const arrowRef = React29.useRef(null); | |
| 7040 | - const sideOffsetRef = useValueAsRef(sideOffset); | |
| 7041 | - const alignOffsetRef = useValueAsRef(alignOffset); | |
| 7042 | - const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; | |
| 7043 | - const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; | |
| 7044 | - const middleware = []; | |
| 7045 | - if (inlineMiddleware) { | |
| 7046 | - middleware.push(inlineMiddleware); | |
| 7047 | - } | |
| 7048 | - middleware.push(offset3((state) => { | |
| 7049 | - const data = getOffsetData(state, sideParam, isRtl); | |
| 7050 | - const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; | |
| 7051 | - const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; | |
| 7052 | - return { | |
| 7053 | - mainAxis: sideAxis, | |
| 7054 | - crossAxis: alignAxis, | |
| 7055 | - alignmentAxis: alignAxis | |
| 7056 | - }; | |
| 7057 | - }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); | |
| 7058 | - const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; | |
| 7059 | - const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); | |
| 7060 | - const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ | |
| 7061 | - ...commonCollisionProps, | |
| 7062 | - // Ensure the popup flips if it's been limited by its --available-height and it resizes. | |
| 7063 | - // Since the size() padding is smaller than the flip() padding, flip() will take precedence. | |
| 7064 | - padding: { | |
| 7065 | - top: collisionPadding.top + bias, | |
| 7066 | - right: collisionPadding.right + bias, | |
| 7067 | - bottom: collisionPadding.bottom + bias, | |
| 7068 | - left: collisionPadding.left + bias | |
| 7069 | - }, | |
| 7070 | - mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", | |
| 7071 | - crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, | |
| 7072 | - fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide | |
| 7073 | - }); | |
| 7074 | - const shiftMiddleware = shiftDisabled ? null : shift3((data) => { | |
| 7075 | - const html = ownerDocument(data.elements.floating).documentElement; | |
| 7076 | - return { | |
| 7077 | - ...commonCollisionProps, | |
| 7078 | - // Use the Layout Viewport to avoid shifting around when pinch-zooming | |
| 7079 | - // for context menus. | |
| 7080 | - rootBoundary: shiftCrossAxis ? { | |
| 7081 | - x: 0, | |
| 7082 | - y: 0, | |
| 7083 | - width: html.clientWidth, | |
| 7084 | - height: html.clientHeight | |
| 7085 | - } : void 0, | |
| 7086 | - mainAxis: collisionAvoidanceAlign !== "none", | |
| 7087 | - crossAxis: crossAxisShiftEnabled, | |
| 7088 | - limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { | |
| 7089 | - if (!arrowRef.current) { | |
| 7090 | - return {}; | |
| 7091 | - } | |
| 7092 | - const { | |
| 7093 | - width, | |
| 7094 | - height | |
| 7095 | - } = arrowRef.current.getBoundingClientRect(); | |
| 7096 | - const sideAxis = getSideAxis(getSide(limitData.placement)); | |
| 7097 | - const arrowSize = sideAxis === "y" ? width : height; | |
| 7098 | - const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; | |
| 7099 | - return { | |
| 7100 | - offset: arrowSize / 2 + offsetAmount / 2 | |
| 7101 | - }; | |
| 7102 | - }) | |
| 7103 | - }; | |
| 7104 | - }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]); | |
| 7105 | - if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { | |
| 7106 | - middleware.push(shiftMiddleware, flipMiddleware); | |
| 7107 | - } else { | |
| 7108 | - middleware.push(flipMiddleware, shiftMiddleware); | |
| 7109 | - } | |
| 7110 | - middleware.push(size3({ | |
| 7111 | - ...commonCollisionProps, | |
| 7112 | - apply({ | |
| 7113 | - elements: { | |
| 7114 | - floating | |
| 7115 | - }, | |
| 7116 | - availableWidth, | |
| 7117 | - availableHeight, | |
| 7118 | - rects | |
| 7119 | - }) { | |
| 7120 | - if (!mountedRef.current) { | |
| 7121 | - return; | |
| 7122 | - } | |
| 7123 | - const floatingStyle = floating.style; | |
| 7124 | - floatingStyle.setProperty("--available-width", `${availableWidth}px`); | |
| 7125 | - floatingStyle.setProperty("--available-height", `${availableHeight}px`); | |
| 7126 | - const dpr = getWindow(floating).devicePixelRatio || 1; | |
| 7127 | - const { | |
| 7128 | - x: x2, | |
| 7129 | - y: y2, | |
| 7130 | - width, | |
| 7131 | - height | |
| 7132 | - } = rects.reference; | |
| 7133 | - const anchorWidth = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr; | |
| 7134 | - const anchorHeight = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr; | |
| 7135 | - floatingStyle.setProperty("--anchor-width", `${anchorWidth}px`); | |
| 7136 | - floatingStyle.setProperty("--anchor-height", `${anchorHeight}px`); | |
| 7137 | - } | |
| 7138 | - }), arrow4((state) => ({ | |
| 7139 | - // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, | |
| 7140 | - // we'll create a fake element. | |
| 7141 | - element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), | |
| 7142 | - padding: arrowPadding, | |
| 7143 | - offsetParent: "floating" | |
| 7144 | - }), [arrowPadding]), { | |
| 7145 | - name: "transformOrigin", | |
| 7146 | - fn(state) { | |
| 7147 | - const { | |
| 7148 | - elements: elements2, | |
| 7149 | - middlewareData: middlewareData2, | |
| 7150 | - placement: renderedPlacement2, | |
| 7151 | - rects, | |
| 7152 | - y: y2 | |
| 7153 | - } = state; | |
| 7154 | - const currentRenderedSide = getSide(renderedPlacement2); | |
| 7155 | - const currentRenderedAxis = getSideAxis(currentRenderedSide); | |
| 7156 | - const arrowEl = arrowRef.current; | |
| 7157 | - const arrowX = middlewareData2.arrow?.x || 0; | |
| 7158 | - const arrowY = middlewareData2.arrow?.y || 0; | |
| 7159 | - const arrowWidth = arrowEl?.clientWidth || 0; | |
| 7160 | - const arrowHeight = arrowEl?.clientHeight || 0; | |
| 7161 | - const transformX = arrowX + arrowWidth / 2; | |
| 7162 | - const transformY = arrowY + arrowHeight / 2; | |
| 7163 | - const shiftY = Math.abs(middlewareData2.shift?.y || 0); | |
| 7164 | - const halfAnchorHeight = rects.reference.height / 2; | |
| 7165 | - const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; | |
| 7166 | - const isOverlappingAnchor = shiftY > sideOffsetValue; | |
| 7167 | - const adjacentTransformOrigin = { | |
| 7168 | - top: `${transformX}px calc(100% + ${sideOffsetValue}px)`, | |
| 7169 | - bottom: `${transformX}px ${-sideOffsetValue}px`, | |
| 7170 | - left: `calc(100% + ${sideOffsetValue}px) ${transformY}px`, | |
| 7171 | - right: `${-sideOffsetValue}px ${transformY}px` | |
| 7172 | - }[currentRenderedSide]; | |
| 7173 | - const overlapTransformOrigin = `${transformX}px ${rects.reference.y + halfAnchorHeight - y2}px`; | |
| 7174 | - elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin); | |
| 7175 | - return {}; | |
| 7176 | - } | |
| 7177 | - }, hide4, adaptiveOrigin2); | |
| 7178 | - useIsoLayoutEffect(() => { | |
| 7179 | - if (!mounted && floatingRootContext) { | |
| 7180 | - floatingRootContext.update({ | |
| 7181 | - referenceElement: null, | |
| 7182 | - floatingElement: null, | |
| 7183 | - domReferenceElement: null, | |
| 7184 | - positionReference: null | |
| 7185 | - }); | |
| 7186 | - } | |
| 7187 | - }, [mounted, floatingRootContext]); | |
| 7188 | - const autoUpdateOptions = React29.useMemo(() => ({ | |
| 7189 | - elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", | |
| 7190 | - layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" | |
| 7191 | - }), [disableAnchorTracking]); | |
| 7192 | - const { | |
| 7193 | - refs, | |
| 7194 | - elements, | |
| 7195 | - x, | |
| 7196 | - y, | |
| 7197 | - middlewareData, | |
| 7198 | - update: update2, | |
| 7199 | - placement: renderedPlacement, | |
| 7200 | - context, | |
| 7201 | - isPositioned, | |
| 7202 | - floatingStyles: originalFloatingStyles | |
| 7203 | - } = useFloating2({ | |
| 7204 | - rootContext: floatingRootContext, | |
| 7205 | - open: keepMounted ? mounted : void 0, | |
| 7206 | - placement, | |
| 7207 | - middleware, | |
| 7208 | - strategy: positionMethod, | |
| 7209 | - whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), | |
| 7210 | - nodeId, | |
| 7211 | - externalTree | |
| 7212 | - }); | |
| 7213 | - const { | |
| 7214 | - sideX, | |
| 7215 | - sideY | |
| 7216 | - } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; | |
| 7217 | - const resolvedPosition = isPositioned ? positionMethod : "fixed"; | |
| 7218 | - const floatingStyles = React29.useMemo(() => { | |
| 7219 | - const base = adaptiveOrigin2 ? { | |
| 7220 | - position: resolvedPosition, | |
| 7221 | - [sideX]: x, | |
| 7222 | - [sideY]: y | |
| 7223 | - } : { | |
| 7224 | - position: resolvedPosition, | |
| 7225 | - ...originalFloatingStyles | |
| 7226 | - }; | |
| 7227 | - if (!isPositioned) { | |
| 7228 | - base.opacity = 0; | |
| 7229 | - } | |
| 7230 | - return base; | |
| 7231 | - }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]); | |
| 7232 | - const registeredPositionReferenceRef = React29.useRef(null); | |
| 7233 | - useIsoLayoutEffect(() => { | |
| 7234 | - if (!mounted) { | |
| 7235 | - return; | |
| 7236 | - } | |
| 7237 | - const anchorValue = anchorValueRef.current; | |
| 7238 | - const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; | |
| 7239 | - const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; | |
| 7240 | - const finalAnchor = unwrappedElement || null; | |
| 7241 | - if (finalAnchor !== registeredPositionReferenceRef.current) { | |
| 7242 | - refs.setPositionReference(finalAnchor); | |
| 7243 | - registeredPositionReferenceRef.current = finalAnchor; | |
| 7244 | - } | |
| 7245 | - }, [mounted, refs, anchorDep, anchorValueRef]); | |
| 7246 | - React29.useEffect(() => { | |
| 7247 | - if (!mounted) { | |
| 7248 | - return; | |
| 7249 | - } | |
| 7250 | - const anchorValue = anchorValueRef.current; | |
| 7251 | - if (typeof anchorValue === "function") { | |
| 7252 | - return; | |
| 7253 | - } | |
| 7254 | - if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { | |
| 7255 | - refs.setPositionReference(anchorValue.current); | |
| 7256 | - registeredPositionReferenceRef.current = anchorValue.current; | |
| 7257 | - } | |
| 7258 | - }, [mounted, refs, anchorDep, anchorValueRef]); | |
| 7259 | - React29.useEffect(() => { | |
| 7260 | - if (keepMounted && mounted && elements.reference && elements.floating) { | |
| 7261 | - return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions); | |
| 7262 | - } | |
| 7263 | - return void 0; | |
| 7264 | - }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); | |
| 7265 | - const renderedSide = getSide(renderedPlacement); | |
| 7266 | - const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); | |
| 7267 | - const renderedAlign = getAlignment(renderedPlacement) || "center"; | |
| 7268 | - const anchorHidden = Boolean(middlewareData.hide?.referenceHidden); | |
| 7269 | - useIsoLayoutEffect(() => { | |
| 7270 | - if (lazyFlip && mounted && isPositioned) { | |
| 7271 | - setMountSide(renderedSide); | |
| 7272 | - } | |
| 7273 | - }, [lazyFlip, mounted, isPositioned, renderedSide]); | |
| 7274 | - const arrowStyles = React29.useMemo(() => ({ | |
| 7275 | - position: "absolute", | |
| 7276 | - top: middlewareData.arrow?.y, | |
| 7277 | - left: middlewareData.arrow?.x | |
| 7278 | - }), [middlewareData.arrow]); | |
| 7279 | - const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; | |
| 7280 | - return React29.useMemo(() => ({ | |
| 7281 | - positionerStyles: floatingStyles, | |
| 7282 | - arrowStyles, | |
| 7283 | - arrowRef, | |
| 7284 | - arrowUncentered, | |
| 7285 | - side: logicalRenderedSide, | |
| 7286 | - align: renderedAlign, | |
| 7287 | - physicalSide: renderedSide, | |
| 7288 | - anchorHidden, | |
| 7289 | - refs, | |
| 7290 | - context, | |
| 7291 | - isPositioned, | |
| 7292 | - update: update2 | |
| 7293 | - }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]); | |
| 7294 | - } | |
| 7295 | - function isRef(param) { | |
| 7296 | - return param != null && "current" in param; | |
| 7297 | - } | |
| 7298 | - | |
| 7299 | - // node_modules/@base-ui/react/utils/getDisabledMountTransitionStyles.mjs | |
| 7300 | - function getDisabledMountTransitionStyles(transitionStatus) { | |
| 7301 | - return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; | |
| 7302 | - } | |
| 7303 | - | |
| 7304 | - // node_modules/@base-ui/react/utils/usePositioner.mjs | |
| 7305 | - function usePositioner(componentProps, state, { | |
| 7306 | - styles, | |
| 7307 | - transitionStatus, | |
| 7308 | - props, | |
| 7309 | - refs, | |
| 7310 | - hidden, | |
| 7311 | - inert = false | |
| 7312 | - }) { | |
| 7313 | - const style = { | |
| 7314 | - ...styles | |
| 7315 | - }; | |
| 7316 | - if (inert) { | |
| 7317 | - style.pointerEvents = "none"; | |
| 7318 | - } | |
| 7319 | - return useRenderElement("div", componentProps, { | |
| 7320 | - state, | |
| 7321 | - ref: refs, | |
| 7322 | - props: [{ | |
| 7323 | - role: "presentation", | |
| 7324 | - hidden, | |
| 7325 | - style | |
| 7326 | - }, getDisabledMountTransitionStyles(transitionStatus), props], | |
| 7327 | - stateAttributesMapping: popupStateMapping | |
| 7328 | - }); | |
| 7329 | - } | |
| 7330 | - | |
| 7331 | - // node_modules/@base-ui/react/utils/usePopupViewport.mjs | |
| 7332 | - var React32 = __toESM(require_react(), 1); | |
| 7333 | - var ReactDOM6 = __toESM(require_react_dom(), 1); | |
| 7334 | - | |
| 7335 | - // node_modules/@base-ui/utils/usePreviousValue.mjs | |
| 7336 | - var React30 = __toESM(require_react(), 1); | |
| 7337 | - function usePreviousValue(value) { | |
| 7338 | - const [state, setState] = React30.useState({ | |
| 7339 | - current: value, | |
| 7340 | - previous: null | |
| 7341 | - }); | |
| 7342 | - if (value !== state.current) { | |
| 7343 | - setState({ | |
| 7344 | - current: value, | |
| 7345 | - previous: state.current | |
| 7346 | - }); | |
| 7347 | - } | |
| 7348 | - return state.previous; | |
| 7349 | - } | |
| 7350 | - | |
| 7351 | - // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs | |
| 7352 | - var React31 = __toESM(require_react(), 1); | |
| 7353 | - | |
| 7354 | - // node_modules/@base-ui/react/utils/getCssDimensions.mjs | |
| 7355 | - function getCssDimensions2(element) { | |
| 7356 | - const css = getComputedStyle2(element); | |
| 7357 | - let width = parseFloat(css.width) || 0; | |
| 7358 | - let height = parseFloat(css.height) || 0; | |
| 7359 | - const hasOffset = isHTMLElement(element); | |
| 7360 | - const offsetWidth = hasOffset ? element.offsetWidth : width; | |
| 7361 | - const offsetHeight = hasOffset ? element.offsetHeight : height; | |
| 7362 | - const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; | |
| 7363 | - if (shouldFallback) { | |
| 7364 | - width = offsetWidth; | |
| 7365 | - height = offsetHeight; | |
| 7366 | - } | |
| 7367 | - return { | |
| 7368 | - width, | |
| 7369 | - height | |
| 7370 | - }; | |
| 7371 | - } | |
| 7372 | - | |
| 7373 | - // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs | |
| 7374 | - function usePopupAutoResize(parameters) { | |
| 7375 | - const { | |
| 7376 | - popupElement, | |
| 7377 | - positionerElement, | |
| 7378 | - content, | |
| 7379 | - mounted, | |
| 7380 | - onMeasureLayout: onMeasureLayoutParam, | |
| 7381 | - onMeasureLayoutComplete: onMeasureLayoutCompleteParam, | |
| 7382 | - side, | |
| 7383 | - direction | |
| 7384 | - } = parameters; | |
| 7385 | - const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false); | |
| 7386 | - const animationFrame = useAnimationFrame(); | |
| 7387 | - const committedDimensionsRef = React31.useRef(null); | |
| 7388 | - const isInitialRenderRef = React31.useRef(true); | |
| 7389 | - const restoreAnchoringStylesRef = React31.useRef(NOOP); | |
| 7390 | - const onMeasureLayout = useStableCallback(onMeasureLayoutParam); | |
| 7391 | - const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); | |
| 7392 | - const anchoringStyles = React31.useMemo(() => { | |
| 7393 | - let isOriginSide = side === "top"; | |
| 7394 | - let isPhysicalLeft = side === "left"; | |
| 7395 | - if (direction === "rtl") { | |
| 7396 | - isOriginSide = isOriginSide || side === "inline-end"; | |
| 7397 | - isPhysicalLeft = isPhysicalLeft || side === "inline-end"; | |
| 7398 | - } else { | |
| 7399 | - isOriginSide = isOriginSide || side === "inline-start"; | |
| 7400 | - isPhysicalLeft = isPhysicalLeft || side === "inline-start"; | |
| 7401 | - } | |
| 7402 | - return isOriginSide ? { | |
| 7403 | - position: "absolute", | |
| 7404 | - [side === "top" ? "bottom" : "top"]: "0", | |
| 7405 | - [isPhysicalLeft ? "right" : "left"]: "0" | |
| 7406 | - } : EMPTY_OBJECT; | |
| 7407 | - }, [side, direction]); | |
| 7408 | - useIsoLayoutEffect(() => { | |
| 7409 | - if (!mounted) { | |
| 7410 | - restoreAnchoringStylesRef.current = NOOP; | |
| 7411 | - isInitialRenderRef.current = true; | |
| 7412 | - committedDimensionsRef.current = null; | |
| 7413 | - return void 0; | |
| 7414 | - } | |
| 7415 | - if (!popupElement || !positionerElement) { | |
| 7416 | - return void 0; | |
| 7417 | - } | |
| 7418 | - restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); | |
| 7419 | - setPopupCssSize(popupElement, "auto"); | |
| 7420 | - const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); | |
| 7421 | - const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); | |
| 7422 | - const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); | |
| 7423 | - const restorePositionerAvailableSize = applyElementStyles(positionerElement, { | |
| 7424 | - "--available-width": "max-content", | |
| 7425 | - "--available-height": "max-content" | |
| 7426 | - }); | |
| 7427 | - function restoreMeasurementOverrides() { | |
| 7428 | - restorePopupPosition(); | |
| 7429 | - restorePopupTransform(); | |
| 7430 | - restorePositionerAvailableSize(); | |
| 7431 | - } | |
| 7432 | - function restoreMeasurementOverridesIncludingScale() { | |
| 7433 | - restoreMeasurementOverrides(); | |
| 7434 | - restorePopupScale(); | |
| 7435 | - } | |
| 7436 | - onMeasureLayout?.(); | |
| 7437 | - if (isInitialRenderRef.current || committedDimensionsRef.current === null) { | |
| 7438 | - setPositionerCssSize(positionerElement, "max-content"); | |
| 7439 | - const dimensions = getCssDimensions2(popupElement); | |
| 7440 | - committedDimensionsRef.current = dimensions; | |
| 7441 | - setPositionerCssSize(positionerElement, dimensions); | |
| 7442 | - restoreMeasurementOverridesIncludingScale(); | |
| 7443 | - onMeasureLayoutComplete?.(null, dimensions); | |
| 7444 | - isInitialRenderRef.current = false; | |
| 7445 | - return () => { | |
| 7446 | - restoreAnchoringStylesRef.current(); | |
| 7447 | - restoreAnchoringStylesRef.current = NOOP; | |
| 7448 | - }; | |
| 7449 | - } | |
| 7450 | - setPositionerCssSize(positionerElement, "max-content"); | |
| 7451 | - const previousDimensions = committedDimensionsRef.current; | |
| 7452 | - const newDimensions = getCssDimensions2(popupElement); | |
| 7453 | - committedDimensionsRef.current = newDimensions; | |
| 7454 | - setPopupCssSize(popupElement, previousDimensions); | |
| 7455 | - restoreMeasurementOverridesIncludingScale(); | |
| 7456 | - onMeasureLayoutComplete?.(previousDimensions, newDimensions); | |
| 7457 | - setPositionerCssSize(positionerElement, newDimensions); | |
| 7458 | - const abortController = new AbortController(); | |
| 7459 | - animationFrame.request(() => { | |
| 7460 | - setPopupCssSize(popupElement, newDimensions); | |
| 7461 | - runOnceAnimationsFinish(() => { | |
| 7462 | - popupElement.style.setProperty("--popup-width", "auto"); | |
| 7463 | - popupElement.style.setProperty("--popup-height", "auto"); | |
| 7464 | - }, abortController.signal); | |
| 7465 | - }); | |
| 7466 | - return () => { | |
| 7467 | - abortController.abort(); | |
| 7468 | - animationFrame.cancel(); | |
| 7469 | - restoreAnchoringStylesRef.current(); | |
| 7470 | - restoreAnchoringStylesRef.current = NOOP; | |
| 7471 | - }; | |
| 7472 | - }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); | |
| 7473 | - } | |
| 7474 | - function overrideElementStyle(element, property, value) { | |
| 7475 | - const originalValue = element.style.getPropertyValue(property); | |
| 7476 | - element.style.setProperty(property, value); | |
| 7477 | - return () => { | |
| 7478 | - element.style.setProperty(property, originalValue); | |
| 7479 | - }; | |
| 7480 | - } | |
| 7481 | - function applyElementStyles(element, styles) { | |
| 7482 | - const restorers = []; | |
| 7483 | - for (const [key, value] of Object.entries(styles)) { | |
| 7484 | - restorers.push(overrideElementStyle(element, key, value)); | |
| 7485 | - } | |
| 7486 | - return restorers.length ? () => { | |
| 7487 | - restorers.forEach((restore) => restore()); | |
| 7488 | - } : NOOP; | |
| 7489 | - } | |
| 7490 | - function setPopupCssSize(popupElement, size4) { | |
| 7491 | - const width = size4 === "auto" ? "auto" : `${size4.width}px`; | |
| 7492 | - const height = size4 === "auto" ? "auto" : `${size4.height}px`; | |
| 7493 | - popupElement.style.setProperty("--popup-width", width); | |
| 7494 | - popupElement.style.setProperty("--popup-height", height); | |
| 7495 | - } | |
| 7496 | - function setPositionerCssSize(positionerElement, size4) { | |
| 7497 | - const width = size4 === "max-content" ? "max-content" : `${size4.width}px`; | |
| 7498 | - const height = size4 === "max-content" ? "max-content" : `${size4.height}px`; | |
| 7499 | - positionerElement.style.setProperty("--positioner-width", width); | |
| 7500 | - positionerElement.style.setProperty("--positioner-height", height); | |
| 7501 | - } | |
| 7502 | - | |
| 7503 | - // node_modules/@base-ui/react/utils/usePopupViewport.mjs | |
| 7504 | - var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); | |
| 7505 | - function usePopupViewport(parameters) { | |
| 7506 | - const { | |
| 7507 | - store: store2, | |
| 7508 | - side, | |
| 7509 | - cssVars, | |
| 7510 | - children | |
| 7511 | - } = parameters; | |
| 7512 | - const direction = useDirection(); | |
| 7513 | - const activeTrigger = store2.useState("activeTriggerElement"); | |
| 7514 | - const activeTriggerId = store2.useState("activeTriggerId"); | |
| 7515 | - const open = store2.useState("open"); | |
| 7516 | - const payload = store2.useState("payload"); | |
| 7517 | - const mounted = store2.useState("mounted"); | |
| 7518 | - const popupElement = store2.useState("popupElement"); | |
| 7519 | - const positionerElement = store2.useState("positionerElement"); | |
| 7520 | - const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null); | |
| 7521 | - const currentContentKey = usePopupContentKey(activeTriggerId, payload); | |
| 7522 | - const capturedNodeRef = React32.useRef(null); | |
| 7523 | - const [previousContentNode, setPreviousContentNode] = React32.useState(null); | |
| 7524 | - const [newTriggerOffset, setNewTriggerOffset] = React32.useState(null); | |
| 7525 | - const currentContainerRef = React32.useRef(null); | |
| 7526 | - const previousContainerRef = React32.useRef(null); | |
| 7527 | - const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false); | |
| 7528 | - const cleanupFrame = useAnimationFrame(); | |
| 7529 | - const [previousContentDimensions, setPreviousContentDimensions] = React32.useState(null); | |
| 7530 | - const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React32.useState(false); | |
| 7531 | - useIsoLayoutEffect(() => { | |
| 7532 | - store2.set("hasViewport", true); | |
| 7533 | - return () => { | |
| 7534 | - store2.set("hasViewport", false); | |
| 7535 | - }; | |
| 7536 | - }, [store2]); | |
| 7537 | - const handleMeasureLayout = useStableCallback(() => { | |
| 7538 | - currentContainerRef.current?.style.setProperty("animation", "none"); | |
| 7539 | - currentContainerRef.current?.style.setProperty("transition", "none"); | |
| 7540 | - previousContainerRef.current?.style.setProperty("display", "none"); | |
| 7541 | - }); | |
| 7542 | - const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { | |
| 7543 | - currentContainerRef.current?.style.removeProperty("animation"); | |
| 7544 | - currentContainerRef.current?.style.removeProperty("transition"); | |
| 7545 | - previousContainerRef.current?.style.removeProperty("display"); | |
| 7546 | - if (previousDimensions) { | |
| 7547 | - setPreviousContentDimensions(previousDimensions); | |
| 7548 | - } | |
| 7549 | - }); | |
| 7550 | - const lastHandledTriggerRef = React32.useRef(null); | |
| 7551 | - useIsoLayoutEffect(() => { | |
| 7552 | - if (!open || !mounted) { | |
| 7553 | - lastHandledTriggerRef.current = null; | |
| 7554 | - } | |
| 7555 | - }, [open, mounted]); | |
| 7556 | - useIsoLayoutEffect(() => { | |
| 7557 | - if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { | |
| 7558 | - setPreviousContentNode(capturedNodeRef.current); | |
| 7559 | - setShowStartingStyleAttribute(true); | |
| 7560 | - const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); | |
| 7561 | - setNewTriggerOffset(offset4); | |
| 7562 | - cleanupFrame.request(() => { | |
| 7563 | - ReactDOM6.flushSync(() => { | |
| 7564 | - setShowStartingStyleAttribute(false); | |
| 7565 | - }); | |
| 7566 | - onAnimationsFinished(() => { | |
| 7567 | - setPreviousContentNode(null); | |
| 7568 | - setPreviousContentDimensions(null); | |
| 7569 | - capturedNodeRef.current = null; | |
| 7570 | - }); | |
| 7571 | - }); | |
| 7572 | - lastHandledTriggerRef.current = activeTrigger; | |
| 7573 | - } | |
| 7574 | - }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]); | |
| 7575 | - useIsoLayoutEffect(() => { | |
| 7576 | - const source = currentContainerRef.current; | |
| 7577 | - if (!source) { | |
| 7578 | - return; | |
| 7579 | - } | |
| 7580 | - const wrapper = ownerDocument(source).createElement("div"); | |
| 7581 | - for (const child of Array.from(source.childNodes)) { | |
| 7582 | - wrapper.appendChild(child.cloneNode(true)); | |
| 7583 | - } | |
| 7584 | - capturedNodeRef.current = wrapper; | |
| 7585 | - }); | |
| 7586 | - const isTransitioning = previousContentNode != null; | |
| 7587 | - let childrenToRender; | |
| 7588 | - if (!isTransitioning) { | |
| 7589 | - childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { | |
| 7590 | - "data-current": true, | |
| 7591 | - ref: currentContainerRef, | |
| 7592 | - children | |
| 7593 | - }, currentContentKey); | |
| 7594 | - } else { | |
| 7595 | - childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(React32.Fragment, { | |
| 7596 | - children: [/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { | |
| 7597 | - "data-previous": true, | |
| 7598 | - inert: inertValue(true), | |
| 7599 | - ref: previousContainerRef, | |
| 7600 | - style: { | |
| 7601 | - ...previousContentDimensions ? { | |
| 7602 | - [cssVars.popupWidth]: `${previousContentDimensions.width}px`, | |
| 7603 | - [cssVars.popupHeight]: `${previousContentDimensions.height}px` | |
| 7604 | - } : null, | |
| 7605 | - position: "absolute" | |
| 7606 | - }, | |
| 7607 | - "data-ending-style": showStartingStyleAttribute ? void 0 : "" | |
| 7608 | - }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { | |
| 7609 | - "data-current": true, | |
| 7610 | - ref: currentContainerRef, | |
| 7611 | - "data-starting-style": showStartingStyleAttribute ? "" : void 0, | |
| 7612 | - children | |
| 7613 | - }, currentContentKey)] | |
| 7614 | - }); | |
| 7615 | - } | |
| 7616 | - useIsoLayoutEffect(() => { | |
| 7617 | - const container = previousContainerRef.current; | |
| 7618 | - if (!container || !previousContentNode) { | |
| 7619 | - return; | |
| 7620 | - } | |
| 7621 | - container.replaceChildren(...Array.from(previousContentNode.childNodes)); | |
| 7622 | - }, [previousContentNode]); | |
| 7623 | - usePopupAutoResize({ | |
| 7624 | - popupElement, | |
| 7625 | - positionerElement, | |
| 7626 | - mounted, | |
| 7627 | - content: payload, | |
| 7628 | - onMeasureLayout: handleMeasureLayout, | |
| 7629 | - onMeasureLayoutComplete: handleMeasureLayoutComplete, | |
| 7630 | - side, | |
| 7631 | - direction | |
| 7632 | - }); | |
| 7633 | - const state = { | |
| 7634 | - activationDirection: getActivationDirection(newTriggerOffset), | |
| 7635 | - transitioning: isTransitioning | |
| 7636 | - }; | |
| 7637 | - return { | |
| 7638 | - children: childrenToRender, | |
| 7639 | - state | |
| 7640 | - }; | |
| 7641 | - } | |
| 7642 | - function getActivationDirection(offset4) { | |
| 7643 | - if (!offset4) { | |
| 7644 | - return void 0; | |
| 7645 | - } | |
| 7646 | - return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; | |
| 7647 | - } | |
| 7648 | - function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { | |
| 7649 | - if (value > tolerance) { | |
| 7650 | - return positiveLabel; | |
| 7651 | - } | |
| 7652 | - if (value < -tolerance) { | |
| 7653 | - return negativeLabel; | |
| 7654 | - } | |
| 7655 | - return ""; | |
| 7656 | - } | |
| 7657 | - function calculateRelativePosition(from, to) { | |
| 7658 | - const fromRect = from.getBoundingClientRect(); | |
| 7659 | - const toRect = to.getBoundingClientRect(); | |
| 7660 | - const fromCenter = { | |
| 7661 | - x: fromRect.left + fromRect.width / 2, | |
| 7662 | - y: fromRect.top + fromRect.height / 2 | |
| 7663 | - }; | |
| 7664 | - const toCenter = { | |
| 7665 | - x: toRect.left + toRect.width / 2, | |
| 7666 | - y: toRect.top + toRect.height / 2 | |
| 7667 | - }; | |
| 7668 | - return { | |
| 7669 | - horizontal: toCenter.x - fromCenter.x, | |
| 7670 | - vertical: toCenter.y - fromCenter.y | |
| 7671 | - }; | |
| 7672 | - } | |
| 7673 | - function usePopupContentKey(activeTriggerId, payload) { | |
| 7674 | - const [contentKey, setContentKey] = React32.useState(0); | |
| 7675 | - const previousActiveTriggerIdRef = React32.useRef(activeTriggerId); | |
| 7676 | - const previousPayloadRef = React32.useRef(payload); | |
| 7677 | - const pendingPayloadUpdateRef = React32.useRef(false); | |
| 7678 | - useIsoLayoutEffect(() => { | |
| 7679 | - const previousActiveTriggerId = previousActiveTriggerIdRef.current; | |
| 7680 | - const previousPayload = previousPayloadRef.current; | |
| 7681 | - const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; | |
| 7682 | - const payloadChanged = payload !== previousPayload; | |
| 7683 | - if (triggerIdChanged) { | |
| 7684 | - setContentKey((value) => value + 1); | |
| 7685 | - pendingPayloadUpdateRef.current = !payloadChanged; | |
| 7686 | - } else if (pendingPayloadUpdateRef.current && payloadChanged) { | |
| 7687 | - setContentKey((value) => value + 1); | |
| 7688 | - pendingPayloadUpdateRef.current = false; | |
| 7689 | - } | |
| 7690 | - previousActiveTriggerIdRef.current = activeTriggerId; | |
| 7691 | - previousPayloadRef.current = payload; | |
| 7692 | - }, [activeTriggerId, payload]); | |
| 7693 | - return `${activeTriggerId ?? "current"}-${contentKey}`; | |
| 7694 | - } | |
| 7695 | - | |
| 7696 | - // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs | |
| 7697 | - var React33 = __toESM(require_react(), 1); | |
| 7698 | - var ReactDOM7 = __toESM(require_react_dom(), 1); | |
| 7699 | - var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); | |
| 7700 | - var FloatingPortalLite = /* @__PURE__ */ React33.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { | |
| 7701 | - const { | |
| 7702 | - children, | |
| 7703 | - container, | |
| 7704 | - className, | |
| 7705 | - render, | |
| 7706 | - style, | |
| 7707 | - ...elementProps | |
| 7708 | - } = componentProps; | |
| 7709 | - const { | |
| 7710 | - portalNode, | |
| 7711 | - portalSubtree | |
| 7712 | - } = useFloatingPortalNode({ | |
| 7713 | - container, | |
| 7714 | - ref: forwardedRef, | |
| 7715 | - componentProps, | |
| 7716 | - elementProps | |
| 7717 | - }); | |
| 7718 | - if (!portalSubtree && !portalNode) { | |
| 7719 | - return null; | |
| 7720 | - } | |
| 7721 | - return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React33.Fragment, { | |
| 7722 | - children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] | |
| 7723 | - }); | |
| 7724 | - }); | |
| 7725 | - if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; | |
| 7726 | - | |
| 7727 | - // node_modules/@base-ui/react/tooltip/index.parts.mjs | |
| 7728 | - var index_parts_exports = {}; | |
| 7729 | - __export(index_parts_exports, { | |
| 7730 | - Arrow: () => TooltipArrow, | |
| 7731 | - Handle: () => TooltipHandle, | |
| 7732 | - Popup: () => TooltipPopup, | |
| 7733 | - Portal: () => TooltipPortal, | |
| 7734 | - Positioner: () => TooltipPositioner, | |
| 7735 | - Provider: () => TooltipProvider, | |
| 7736 | - Root: () => TooltipRoot, | |
| 7737 | - Trigger: () => TooltipTrigger, | |
| 7738 | - Viewport: () => TooltipViewport, | |
| 7739 | - createHandle: () => createTooltipHandle | |
| 7740 | - }); | |
| 7741 | - | |
| 7742 | - // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs | |
| 7743 | - var React36 = __toESM(require_react(), 1); | |
| 7744 | - | |
| 7745 | - // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs | |
| 7746 | - var React34 = __toESM(require_react(), 1); | |
| 7747 | - var TooltipRootContext = /* @__PURE__ */ React34.createContext(void 0); | |
| 7748 | - if (true) TooltipRootContext.displayName = "TooltipRootContext"; | |
| 7749 | - function useTooltipRootContext(optional) { | |
| 7750 | - const context = React34.useContext(TooltipRootContext); | |
| 7751 | - if (context === void 0 && !optional) { | |
| 7752 | - throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); | |
| 7753 | - } | |
| 7754 | - return context; | |
| 7755 | - } | |
| 7756 | - | |
| 7757 | - // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs | |
| 7758 | - var React35 = __toESM(require_react(), 1); | |
| 7759 | - var selectors2 = { | |
| 7760 | - ...popupStoreSelectors, | |
| 7761 | - disabled: createSelector((state) => state.disabled), | |
| 7762 | - instantType: createSelector((state) => state.instantType), | |
| 7763 | - isInstantPhase: createSelector((state) => state.isInstantPhase), | |
| 7764 | - trackCursorAxis: createSelector((state) => state.trackCursorAxis), | |
| 7765 | - disableHoverablePopup: createSelector((state) => state.disableHoverablePopup), | |
| 7766 | - lastOpenChangeReason: createSelector((state) => state.openChangeReason), | |
| 7767 | - closeOnClick: createSelector((state) => state.closeOnClick), | |
| 7768 | - closeDelay: createSelector((state) => state.closeDelay), | |
| 7769 | - hasViewport: createSelector((state) => state.hasViewport) | |
| 7770 | - }; | |
| 7771 | - var TooltipStore = class _TooltipStore extends ReactStore { | |
| 7772 | - constructor(initialState, floatingId, nested = false) { | |
| 7773 | - const triggerElements = new PopupTriggerMap(); | |
| 7774 | - const state = { | |
| 7775 | - ...createInitialState(), | |
| 7776 | - ...initialState | |
| 7777 | - }; | |
| 7778 | - state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested); | |
| 7779 | - super(state, { | |
| 7780 | - popupRef: /* @__PURE__ */ React35.createRef(), | |
| 7781 | - onOpenChange: void 0, | |
| 7782 | - onOpenChangeComplete: void 0, | |
| 7783 | - triggerElements | |
| 7784 | - }, selectors2); | |
| 7785 | - } | |
| 7786 | - setOpen = (nextOpen, eventDetails) => { | |
| 7787 | - applyPopupOpenChange(this, nextOpen, eventDetails, { | |
| 7788 | - extraState: { | |
| 7789 | - openChangeReason: eventDetails.reason | |
| 7790 | - } | |
| 7791 | - }); | |
| 7792 | - }; | |
| 7793 | - // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. | |
| 7794 | - cancelPendingOpen(event) { | |
| 7795 | - this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); | |
| 7796 | - } | |
| 7797 | - static useStore(externalStore, initialState) { | |
| 7798 | - const store2 = usePopupStore(externalStore, (floatingId, nested) => new _TooltipStore(initialState, floatingId, nested)).store; | |
| 7799 | - return store2; | |
| 7800 | - } | |
| 7801 | - }; | |
| 7802 | - function createInitialState() { | |
| 7803 | - return { | |
| 7804 | - ...createInitialPopupStoreState(), | |
| 7805 | - disabled: false, | |
| 7806 | - instantType: void 0, | |
| 7807 | - isInstantPhase: false, | |
| 7808 | - trackCursorAxis: "none", | |
| 7809 | - disableHoverablePopup: false, | |
| 7810 | - openChangeReason: null, | |
| 7811 | - closeOnClick: true, | |
| 7812 | - closeDelay: 0, | |
| 7813 | - hasViewport: false | |
| 7814 | - }; | |
| 7815 | - } | |
| 7816 | - | |
| 7817 | - // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs | |
| 7818 | - var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); | |
| 7819 | - var TooltipRoot = fastComponent(function TooltipRoot2(props) { | |
| 7820 | - const { | |
| 7821 | - disabled: disabled2 = false, | |
| 7822 | - defaultOpen = false, | |
| 7823 | - open: openProp, | |
| 7824 | - disableHoverablePopup = false, | |
| 7825 | - trackCursorAxis = "none", | |
| 7826 | - actionsRef, | |
| 7827 | - onOpenChange, | |
| 7828 | - onOpenChangeComplete, | |
| 7829 | - handle, | |
| 7830 | - triggerId: triggerIdProp, | |
| 7831 | - defaultTriggerId: defaultTriggerIdProp = null, | |
| 7832 | - children | |
| 7833 | - } = props; | |
| 7834 | - const store2 = TooltipStore.useStore(handle?.store, { | |
| 7835 | - open: defaultOpen, | |
| 7836 | - openProp, | |
| 7837 | - activeTriggerId: defaultTriggerIdProp, | |
| 7838 | - triggerIdProp | |
| 7839 | - }); | |
| 7840 | - useInitialOpenSync(store2, openProp, defaultOpen, defaultTriggerIdProp); | |
| 7841 | - store2.useControlledProp("openProp", openProp); | |
| 7842 | - store2.useControlledProp("triggerIdProp", triggerIdProp); | |
| 7843 | - store2.useContextCallback("onOpenChange", onOpenChange); | |
| 7844 | - store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); | |
| 7845 | - const openState = store2.useState("open"); | |
| 7846 | - const open = !disabled2 && openState; | |
| 7847 | - const activeTriggerId = store2.useState("activeTriggerId"); | |
| 7848 | - const mounted = store2.useState("mounted"); | |
| 7849 | - const payload = store2.useState("payload"); | |
| 7850 | - store2.useSyncedValues({ | |
| 7851 | - trackCursorAxis, | |
| 7852 | - disableHoverablePopup | |
| 7853 | - }); | |
| 7854 | - store2.useSyncedValue("disabled", disabled2); | |
| 7855 | - useImplicitActiveTrigger(store2, { | |
| 7856 | - closeOnActiveTriggerUnmount: true | |
| 7857 | - }); | |
| 7858 | - const { | |
| 7859 | - forceUnmount, | |
| 7860 | - transitionStatus | |
| 7861 | - } = useOpenStateTransitions(open, store2); | |
| 7862 | - const isInstantPhase = store2.useState("isInstantPhase"); | |
| 7863 | - const instantType = store2.useState("instantType"); | |
| 7864 | - const lastOpenChangeReason = store2.useState("lastOpenChangeReason"); | |
| 7865 | - const previousInstantTypeRef = React36.useRef(null); | |
| 7866 | - useIsoLayoutEffect(() => { | |
| 7867 | - if (openState && disabled2) { | |
| 7868 | - store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); | |
| 7869 | - } | |
| 7870 | - }, [openState, disabled2, store2]); | |
| 7871 | - useIsoLayoutEffect(() => { | |
| 7872 | - if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { | |
| 7873 | - if (instantType !== "delay") { | |
| 7874 | - previousInstantTypeRef.current = instantType; | |
| 7875 | - } | |
| 7876 | - store2.set("instantType", "delay"); | |
| 7877 | - } else if (previousInstantTypeRef.current !== null) { | |
| 7878 | - store2.set("instantType", previousInstantTypeRef.current); | |
| 7879 | - previousInstantTypeRef.current = null; | |
| 7880 | - } | |
| 7881 | - }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]); | |
| 7882 | - useIsoLayoutEffect(() => { | |
| 7883 | - if (open) { | |
| 7884 | - if (activeTriggerId == null) { | |
| 7885 | - store2.set("payload", void 0); | |
| 7886 | - } | |
| 7887 | - } | |
| 7888 | - }, [store2, activeTriggerId, open]); | |
| 7889 | - const handleImperativeClose = React36.useCallback(() => { | |
| 7890 | - store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); | |
| 7891 | - }, [store2]); | |
| 7892 | - React36.useImperativeHandle(actionsRef, () => ({ | |
| 7893 | - unmount: forceUnmount, | |
| 7894 | - close: handleImperativeClose | |
| 7895 | - }), [forceUnmount, handleImperativeClose]); | |
| 7896 | - const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none"; | |
| 7897 | - return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(TooltipRootContext.Provider, { | |
| 7898 | - value: store2, | |
| 7899 | - children: [shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipInteractions, { | |
| 7900 | - store: store2, | |
| 7901 | - disabled: disabled2, | |
| 7902 | - trackCursorAxis | |
| 7903 | - }), typeof children === "function" ? children({ | |
| 7904 | - payload | |
| 7905 | - }) : children] | |
| 7906 | - }); | |
| 7907 | - }); | |
| 7908 | - if (true) TooltipRoot.displayName = "TooltipRoot"; | |
| 7909 | - function TooltipInteractions({ | |
| 7910 | - store: store2, | |
| 7911 | - disabled: disabled2, | |
| 7912 | - trackCursorAxis | |
| 7913 | - }) { | |
| 7914 | - const floatingRootContext = store2.useState("floatingRootContext"); | |
| 7915 | - const dismiss = useDismiss(floatingRootContext, { | |
| 7916 | - enabled: !disabled2, | |
| 7917 | - referencePress: () => store2.select("closeOnClick") | |
| 7918 | - }); | |
| 7919 | - const clientPoint = useClientPoint(floatingRootContext, { | |
| 7920 | - enabled: !disabled2 && trackCursorAxis !== "none", | |
| 7921 | - axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis | |
| 7922 | - }); | |
| 7923 | - const activeTriggerProps = React36.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); | |
| 7924 | - const inactiveTriggerProps = React36.useMemo(() => mergeProps(clientPoint.trigger, dismiss.trigger), [clientPoint.trigger, dismiss.trigger]); | |
| 7925 | - const popupProps = React36.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [clientPoint.floating, dismiss.floating]); | |
| 7926 | - usePopupInteractionProps(store2, { | |
| 7927 | - activeTriggerProps, | |
| 7928 | - inactiveTriggerProps, | |
| 7929 | - popupProps | |
| 7930 | - }); | |
| 7931 | - return null; | |
| 7932 | - } | |
| 7933 | - | |
| 7934 | - // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs | |
| 7935 | - var React38 = __toESM(require_react(), 1); | |
| 7936 | - | |
| 7937 | - // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs | |
| 7938 | - var React37 = __toESM(require_react(), 1); | |
| 7939 | - var TooltipProviderContext = /* @__PURE__ */ React37.createContext(void 0); | |
| 7940 | - if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; | |
| 7941 | - function useTooltipProviderContext() { | |
| 7942 | - return React37.useContext(TooltipProviderContext); | |
| 7943 | - } | |
| 7944 | - | |
| 7945 | - // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs | |
| 7946 | - var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) { | |
| 7947 | - TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen"; | |
| 7948 | - TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled"; | |
| 7949 | - return TooltipTriggerDataAttributes2; | |
| 7950 | - })({}); | |
| 7951 | - | |
| 7952 | - // node_modules/@base-ui/react/tooltip/utils/constants.mjs | |
| 7953 | - var OPEN_DELAY = 600; | |
| 7954 | - | |
| 7955 | - // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs | |
| 7956 | - var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; | |
| 7957 | - function getTargetElement(event) { | |
| 7958 | - if ("composedPath" in event) { | |
| 7959 | - const path = event.composedPath(); | |
| 7960 | - for (let i = 0; i < path.length; i += 1) { | |
| 7961 | - const element = path[i]; | |
| 7962 | - if (isElement(element)) { | |
| 7963 | - return element; | |
| 7964 | - } | |
| 7965 | - } | |
| 7966 | - } | |
| 7967 | - const target = event.target; | |
| 7968 | - if (isElement(target)) { | |
| 7969 | - return target; | |
| 7970 | - } | |
| 7971 | - return null; | |
| 7972 | - } | |
| 7973 | - function closestEnabledTooltipTrigger(element) { | |
| 7974 | - let current = element; | |
| 7975 | - while (current) { | |
| 7976 | - if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) { | |
| 7977 | - return current; | |
| 7978 | - } | |
| 7979 | - const parentElement = current.parentElement; | |
| 7980 | - if (parentElement) { | |
| 7981 | - current = parentElement; | |
| 7982 | - continue; | |
| 7983 | - } | |
| 7984 | - const root = current.getRootNode(); | |
| 7985 | - current = "host" in root && isElement(root.host) ? root.host : null; | |
| 7986 | - } | |
| 7987 | - return null; | |
| 7988 | - } | |
| 7989 | - var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { | |
| 7990 | - const { | |
| 7991 | - render, | |
| 7992 | - className, | |
| 7993 | - style, | |
| 7994 | - handle, | |
| 7995 | - payload, | |
| 7996 | - disabled: disabledProp, | |
| 7997 | - delay, | |
| 7998 | - closeOnClick = true, | |
| 7999 | - closeDelay, | |
| 8000 | - id: idProp, | |
| 8001 | - ...elementProps | |
| 8002 | - } = componentProps; | |
| 8003 | - const rootContext = useTooltipRootContext(true); | |
| 8004 | - const store2 = handle?.store ?? rootContext; | |
| 8005 | - if (!store2) { | |
| 8006 | - throw new Error(true ? "Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle." : formatErrorMessage_default(82)); | |
| 8007 | - } | |
| 8008 | - const thisTriggerId = useBaseUiId(idProp); | |
| 8009 | - const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId); | |
| 8010 | - const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId); | |
| 8011 | - const floatingRootContext = store2.useState("floatingRootContext"); | |
| 8012 | - const triggerElementRef = React38.useRef(null); | |
| 8013 | - const delayWithDefault = delay ?? OPEN_DELAY; | |
| 8014 | - const closeDelayWithDefault = closeDelay ?? 0; | |
| 8015 | - const { | |
| 8016 | - registerTrigger, | |
| 8017 | - isMountedByThisTrigger | |
| 8018 | - } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, { | |
| 8019 | - payload, | |
| 8020 | - closeOnClick, | |
| 8021 | - closeDelay: closeDelayWithDefault | |
| 8022 | - }); | |
| 8023 | - const providerContext = useTooltipProviderContext(); | |
| 8024 | - const { | |
| 8025 | - delayRef, | |
| 8026 | - isInstantPhase, | |
| 8027 | - hasProvider | |
| 8028 | - } = useDelayGroup(floatingRootContext, { | |
| 8029 | - open: isOpenedByThisTrigger | |
| 8030 | - }); | |
| 8031 | - const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); | |
| 8032 | - store2.useSyncedValue("isInstantPhase", isInstantPhase); | |
| 8033 | - const rootDisabled = store2.useState("disabled"); | |
| 8034 | - const disabled2 = disabledProp ?? rootDisabled; | |
| 8035 | - const disabledRef = useValueAsRef(disabled2); | |
| 8036 | - const trackCursorAxis = store2.useState("trackCursorAxis"); | |
| 8037 | - const disableHoverablePopup = store2.useState("disableHoverablePopup"); | |
| 8038 | - const isNestedTriggerHoveredRef = React38.useRef(false); | |
| 8039 | - const nestedTriggerOpenTimeout = useTimeout(); | |
| 8040 | - const pointerTypeRef = React38.useRef(void 0); | |
| 8041 | - function getOpenDelay() { | |
| 8042 | - const providerDelay = providerContext?.delay; | |
| 8043 | - const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0; | |
| 8044 | - let computedOpenDelay = delayWithDefault; | |
| 8045 | - if (hasProvider) { | |
| 8046 | - if (groupOpenValue !== 0) { | |
| 8047 | - computedOpenDelay = delay ?? providerDelay ?? delayWithDefault; | |
| 8048 | - } else { | |
| 8049 | - computedOpenDelay = 0; | |
| 8050 | - } | |
| 8051 | - } | |
| 8052 | - return computedOpenDelay; | |
| 8053 | - } | |
| 8054 | - function isEnabledNestedTriggerTarget(target) { | |
| 8055 | - const triggerEl = triggerElementRef.current; | |
| 8056 | - if (!triggerEl || !target) { | |
| 8057 | - return false; | |
| 8058 | - } | |
| 8059 | - const nearestTrigger = closestEnabledTooltipTrigger(target); | |
| 8060 | - return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); | |
| 8061 | - } | |
| 8062 | - function detectNestedTriggerHover(target) { | |
| 8063 | - const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); | |
| 8064 | - isNestedTriggerHoveredRef.current = nestedTriggerHovered; | |
| 8065 | - if (nestedTriggerHovered) { | |
| 8066 | - hoverInteraction.openChangeTimeout.clear(); | |
| 8067 | - hoverInteraction.restTimeout.clear(); | |
| 8068 | - hoverInteraction.restTimeoutPending = false; | |
| 8069 | - nestedTriggerOpenTimeout.clear(); | |
| 8070 | - } | |
| 8071 | - return nestedTriggerHovered; | |
| 8072 | - } | |
| 8073 | - const hoverProps = useHoverReferenceInteraction(floatingRootContext, { | |
| 8074 | - enabled: !disabled2, | |
| 8075 | - mouseOnly: true, | |
| 8076 | - move: false, | |
| 8077 | - handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, | |
| 8078 | - restMs: getOpenDelay, | |
| 8079 | - delay() { | |
| 8080 | - const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0; | |
| 8081 | - let computedCloseDelay = closeDelayWithDefault; | |
| 8082 | - if (closeDelay == null && hasProvider) { | |
| 8083 | - computedCloseDelay = closeValue; | |
| 8084 | - } | |
| 8085 | - return { | |
| 8086 | - close: computedCloseDelay | |
| 8087 | - }; | |
| 8088 | - }, | |
| 8089 | - triggerElementRef, | |
| 8090 | - isActiveTrigger: isTriggerActive, | |
| 8091 | - isClosing: () => store2.select("transitionStatus") === "ending", | |
| 8092 | - shouldOpen() { | |
| 8093 | - return !isNestedTriggerHoveredRef.current; | |
| 8094 | - } | |
| 8095 | - }); | |
| 8096 | - const focusProps = useFocus(floatingRootContext, { | |
| 8097 | - enabled: !disabled2 | |
| 8098 | - }).reference; | |
| 8099 | - const handleNestedTriggerHover = (event) => { | |
| 8100 | - const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; | |
| 8101 | - const target = getTargetElement(event); | |
| 8102 | - const nestedTriggerHovered = detectNestedTriggerHover(target); | |
| 8103 | - const triggerEl = triggerElementRef.current; | |
| 8104 | - const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); | |
| 8105 | - if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { | |
| 8106 | - store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); | |
| 8107 | - return; | |
| 8108 | - } | |
| 8109 | - if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. | |
| 8110 | - isMouseLikePointerType(pointerTypeRef.current)) { | |
| 8111 | - const open = () => { | |
| 8112 | - if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) { | |
| 8113 | - store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); | |
| 8114 | - } | |
| 8115 | - }; | |
| 8116 | - const openDelay = getOpenDelay(); | |
| 8117 | - if (openDelay === 0) { | |
| 8118 | - nestedTriggerOpenTimeout.clear(); | |
| 8119 | - open(); | |
| 8120 | - } else { | |
| 8121 | - nestedTriggerOpenTimeout.start(openDelay, open); | |
| 8122 | - } | |
| 8123 | - } | |
| 8124 | - }; | |
| 8125 | - const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger); | |
| 8126 | - const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; | |
| 8127 | - const state = { | |
| 8128 | - open: isOpenedByThisTrigger | |
| 8129 | - }; | |
| 8130 | - const element = useRenderElement("button", componentProps, { | |
| 8131 | - state, | |
| 8132 | - ref: [forwardedRef, registerTrigger, triggerElementRef], | |
| 8133 | - props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { | |
| 8134 | - onMouseOver(event) { | |
| 8135 | - handleNestedTriggerHover(event.nativeEvent); | |
| 8136 | - }, | |
| 8137 | - onFocus(event) { | |
| 8138 | - if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { | |
| 8139 | - event.preventBaseUIHandler(); | |
| 8140 | - } | |
| 8141 | - }, | |
| 8142 | - onMouseLeave() { | |
| 8143 | - isNestedTriggerHoveredRef.current = false; | |
| 8144 | - nestedTriggerOpenTimeout.clear(); | |
| 8145 | - pointerTypeRef.current = void 0; | |
| 8146 | - }, | |
| 8147 | - onPointerEnter(event) { | |
| 8148 | - pointerTypeRef.current = event.pointerType; | |
| 8149 | - }, | |
| 8150 | - onPointerDown(event) { | |
| 8151 | - pointerTypeRef.current = event.pointerType; | |
| 8152 | - store2.set("closeOnClick", closeOnClick); | |
| 8153 | - if (closeOnClick && !store2.select("open")) { | |
| 8154 | - store2.cancelPendingOpen(event.nativeEvent); | |
| 8155 | - } | |
| 8156 | - }, | |
| 8157 | - onClick(event) { | |
| 8158 | - if (closeOnClick && !store2.select("open")) { | |
| 8159 | - store2.cancelPendingOpen(event.nativeEvent); | |
| 8160 | - } | |
| 8161 | - }, | |
| 8162 | - id: thisTriggerId, | |
| 8163 | - [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0, | |
| 8164 | - [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" | |
| 8165 | - }, elementProps], | |
| 8166 | - stateAttributesMapping: triggerOpenStateMapping | |
| 8167 | - }); | |
| 8168 | - return element; | |
| 8169 | - }); | |
| 8170 | - if (true) TooltipTrigger.displayName = "TooltipTrigger"; | |
| 8171 | - | |
| 8172 | - // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs | |
| 8173 | - var React40 = __toESM(require_react(), 1); | |
| 8174 | - | |
| 8175 | - // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs | |
| 8176 | - var React39 = __toESM(require_react(), 1); | |
| 8177 | - var TooltipPortalContext = /* @__PURE__ */ React39.createContext(void 0); | |
| 8178 | - if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; | |
| 8179 | - function useTooltipPortalContext() { | |
| 8180 | - const value = React39.useContext(TooltipPortalContext); | |
| 8181 | - if (value === void 0) { | |
| 8182 | - throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); | |
| 8183 | - } | |
| 8184 | - return value; | |
| 8185 | - } | |
| 8186 | - | |
| 8187 | - // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs | |
| 8188 | - var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); | |
| 8189 | - var TooltipPortal = /* @__PURE__ */ React40.forwardRef(function TooltipPortal2(props, forwardedRef) { | |
| 8190 | - const { | |
| 8191 | - keepMounted = false, | |
| 8192 | - ...portalProps | |
| 8193 | - } = props; | |
| 8194 | - const store2 = useTooltipRootContext(); | |
| 8195 | - const mounted = store2.useState("mounted"); | |
| 8196 | - const shouldRender = mounted || keepMounted; | |
| 8197 | - if (!shouldRender) { | |
| 8198 | - return null; | |
| 8199 | - } | |
| 8200 | - return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipPortalContext.Provider, { | |
| 8201 | - value: keepMounted, | |
| 8202 | - children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FloatingPortalLite, { | |
| 8203 | - ref: forwardedRef, | |
| 8204 | - ...portalProps | |
| 8205 | - }) | |
| 8206 | - }); | |
| 8207 | - }); | |
| 8208 | - if (true) TooltipPortal.displayName = "TooltipPortal"; | |
| 8209 | - | |
| 8210 | - // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs | |
| 8211 | - var React42 = __toESM(require_react(), 1); | |
| 8212 | - | |
| 8213 | - // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs | |
| 8214 | - var React41 = __toESM(require_react(), 1); | |
| 8215 | - var TooltipPositionerContext = /* @__PURE__ */ React41.createContext(void 0); | |
| 8216 | - if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; | |
| 8217 | - function useTooltipPositionerContext() { | |
| 8218 | - const context = React41.useContext(TooltipPositionerContext); | |
| 8219 | - if (context === void 0) { | |
| 8220 | - throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); | |
| 8221 | - } | |
| 8222 | - return context; | |
| 8223 | - } | |
| 8224 | - | |
| 8225 | - // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs | |
| 8226 | - var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); | |
| 8227 | - var TooltipPositioner = /* @__PURE__ */ React42.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { | |
| 8228 | - const { | |
| 8229 | - render, | |
| 8230 | - className, | |
| 8231 | - anchor, | |
| 8232 | - positionMethod = "absolute", | |
| 8233 | - side = "top", | |
| 8234 | - align = "center", | |
| 8235 | - sideOffset = 0, | |
| 8236 | - alignOffset = 0, | |
| 8237 | - collisionBoundary = "clipping-ancestors", | |
| 8238 | - collisionPadding = 5, | |
| 8239 | - arrowPadding = 5, | |
| 8240 | - sticky = false, | |
| 8241 | - disableAnchorTracking = false, | |
| 8242 | - collisionAvoidance = POPUP_COLLISION_AVOIDANCE, | |
| 8243 | - style, | |
| 8244 | - ...elementProps | |
| 8245 | - } = componentProps; | |
| 8246 | - const store2 = useTooltipRootContext(); | |
| 8247 | - const keepMounted = useTooltipPortalContext(); | |
| 8248 | - const open = store2.useState("open"); | |
| 8249 | - const mounted = store2.useState("mounted"); | |
| 8250 | - const trackCursorAxis = store2.useState("trackCursorAxis"); | |
| 8251 | - const disableHoverablePopup = store2.useState("disableHoverablePopup"); | |
| 8252 | - const floatingRootContext = store2.useState("floatingRootContext"); | |
| 8253 | - const instantType = store2.useState("instantType"); | |
| 8254 | - const transitionStatus = store2.useState("transitionStatus"); | |
| 8255 | - const hasViewport = store2.useState("hasViewport"); | |
| 8256 | - const positioning = useAnchorPositioning({ | |
| 8257 | - anchor, | |
| 8258 | - positionMethod, | |
| 8259 | - floatingRootContext, | |
| 8260 | - mounted, | |
| 8261 | - side, | |
| 8262 | - sideOffset, | |
| 8263 | - align, | |
| 8264 | - alignOffset, | |
| 8265 | - collisionBoundary, | |
| 8266 | - collisionPadding, | |
| 8267 | - sticky, | |
| 8268 | - arrowPadding, | |
| 8269 | - disableAnchorTracking, | |
| 8270 | - keepMounted, | |
| 8271 | - collisionAvoidance, | |
| 8272 | - adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0 | |
| 8273 | - }); | |
| 8274 | - const state = React42.useMemo(() => ({ | |
| 8275 | - open, | |
| 8276 | - side: positioning.side, | |
| 8277 | - align: positioning.align, | |
| 8278 | - anchorHidden: positioning.anchorHidden, | |
| 8279 | - instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType | |
| 8280 | - }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); | |
| 8281 | - const element = usePositioner(componentProps, state, { | |
| 8282 | - styles: positioning.positionerStyles, | |
| 8283 | - transitionStatus, | |
| 8284 | - props: elementProps, | |
| 8285 | - refs: [forwardedRef, store2.useStateSetter("positionerElement")], | |
| 8286 | - hidden: !mounted, | |
| 8287 | - inert: !open || trackCursorAxis === "both" || disableHoverablePopup | |
| 8288 | - }); | |
| 8289 | - return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPositionerContext.Provider, { | |
| 8290 | - value: positioning, | |
| 8291 | - children: element | |
| 8292 | - }); | |
| 8293 | - }); | |
| 8294 | - if (true) TooltipPositioner.displayName = "TooltipPositioner"; | |
| 8295 | - | |
| 8296 | - // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs | |
| 8297 | - var React43 = __toESM(require_react(), 1); | |
| 8298 | - var stateAttributesMapping = { | |
| 8299 | - ...popupStateMapping, | |
| 8300 | - ...transitionStatusMapping | |
| 8301 | - }; | |
| 8302 | - var TooltipPopup = /* @__PURE__ */ React43.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { | |
| 8303 | - const { | |
| 8304 | - render, | |
| 8305 | - className, | |
| 8306 | - style, | |
| 8307 | - ...elementProps | |
| 8308 | - } = componentProps; | |
| 8309 | - const store2 = useTooltipRootContext(); | |
| 8310 | - const { | |
| 8311 | - side, | |
| 8312 | - align | |
| 8313 | - } = useTooltipPositionerContext(); | |
| 8314 | - const open = store2.useState("open"); | |
| 8315 | - const instantType = store2.useState("instantType"); | |
| 8316 | - const transitionStatus = store2.useState("transitionStatus"); | |
| 8317 | - const popupProps = store2.useState("popupProps"); | |
| 8318 | - const floatingContext = store2.useState("floatingRootContext"); | |
| 8319 | - const disabled2 = store2.useState("disabled"); | |
| 8320 | - const closeDelay = store2.useState("closeDelay"); | |
| 8321 | - useOpenChangeComplete({ | |
| 8322 | - open, | |
| 8323 | - ref: store2.context.popupRef, | |
| 8324 | - onComplete() { | |
| 8325 | - if (open) { | |
| 8326 | - store2.context.onOpenChangeComplete?.(true); | |
| 8327 | - } | |
| 8328 | - } | |
| 8329 | - }); | |
| 8330 | - useHoverFloatingInteraction(floatingContext, { | |
| 8331 | - enabled: !disabled2, | |
| 8332 | - closeDelay | |
| 8333 | - }); | |
| 8334 | - const setPopupElement = store2.useStateSetter("popupElement"); | |
| 8335 | - const state = { | |
| 8336 | - open, | |
| 8337 | - side, | |
| 8338 | - align, | |
| 8339 | - instant: instantType, | |
| 8340 | - transitionStatus | |
| 8341 | - }; | |
| 8342 | - const element = useRenderElement("div", componentProps, { | |
| 8343 | - state, | |
| 8344 | - ref: [forwardedRef, store2.context.popupRef, setPopupElement], | |
| 8345 | - props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], | |
| 8346 | - stateAttributesMapping | |
| 8347 | - }); | |
| 8348 | - return element; | |
| 8349 | - }); | |
| 8350 | - if (true) TooltipPopup.displayName = "TooltipPopup"; | |
| 8351 | - | |
| 8352 | - // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs | |
| 8353 | - var React44 = __toESM(require_react(), 1); | |
| 8354 | - var TooltipArrow = /* @__PURE__ */ React44.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { | |
| 8355 | - const { | |
| 8356 | - render, | |
| 8357 | - className, | |
| 8358 | - style, | |
| 8359 | - ...elementProps | |
| 8360 | - } = componentProps; | |
| 8361 | - const store2 = useTooltipRootContext(); | |
| 8362 | - const { | |
| 8363 | - arrowRef, | |
| 8364 | - side, | |
| 8365 | - align, | |
| 8366 | - arrowUncentered, | |
| 8367 | - arrowStyles | |
| 8368 | - } = useTooltipPositionerContext(); | |
| 8369 | - const open = store2.useState("open"); | |
| 8370 | - const instantType = store2.useState("instantType"); | |
| 8371 | - const state = { | |
| 8372 | - open, | |
| 8373 | - side, | |
| 8374 | - align, | |
| 8375 | - uncentered: arrowUncentered, | |
| 8376 | - instant: instantType | |
| 8377 | - }; | |
| 8378 | - const element = useRenderElement("div", componentProps, { | |
| 8379 | - state, | |
| 8380 | - ref: [forwardedRef, arrowRef], | |
| 8381 | - props: [{ | |
| 8382 | - style: arrowStyles, | |
| 8383 | - "aria-hidden": true | |
| 8384 | - }, elementProps], | |
| 8385 | - stateAttributesMapping: popupStateMapping | |
| 8386 | - }); | |
| 8387 | - return element; | |
| 8388 | - }); | |
| 8389 | - if (true) TooltipArrow.displayName = "TooltipArrow"; | |
| 8390 | - | |
| 8391 | - // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs | |
| 8392 | - var React45 = __toESM(require_react(), 1); | |
| 8393 | - var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); | |
| 8394 | - var TooltipProvider = function TooltipProvider2(props) { | |
| 8395 | - const { | |
| 8396 | - delay, | |
| 8397 | - closeDelay, | |
| 8398 | - timeout = 400 | |
| 8399 | - } = props; | |
| 8400 | - const contextValue = React45.useMemo(() => ({ | |
| 8401 | - delay, | |
| 8402 | - closeDelay | |
| 8403 | - }), [delay, closeDelay]); | |
| 8404 | - const delayValue = React45.useMemo(() => ({ | |
| 8405 | - open: delay, | |
| 8406 | - close: closeDelay | |
| 8407 | - }), [delay, closeDelay]); | |
| 8408 | - return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipProviderContext.Provider, { | |
| 8409 | - value: contextValue, | |
| 8410 | - children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FloatingDelayGroup, { | |
| 8411 | - delay: delayValue, | |
| 8412 | - timeoutMs: timeout, | |
| 8413 | - children: props.children | |
| 8414 | - }) | |
| 8415 | - }); | |
| 8416 | - }; | |
| 8417 | - if (true) TooltipProvider.displayName = "TooltipProvider"; | |
| 8418 | - | |
| 8419 | - // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs | |
| 8420 | - var React46 = __toESM(require_react(), 1); | |
| 8421 | - | |
| 8422 | - // node_modules/@base-ui/react/tooltip/viewport/TooltipViewportCssVars.mjs | |
| 8423 | - var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) { | |
| 8424 | - TooltipViewportCssVars2["popupWidth"] = "--popup-width"; | |
| 8425 | - TooltipViewportCssVars2["popupHeight"] = "--popup-height"; | |
| 8426 | - return TooltipViewportCssVars2; | |
| 8427 | - })({}); | |
| 8428 | - | |
| 8429 | - // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs | |
| 8430 | - var stateAttributesMapping2 = { | |
| 8431 | - activationDirection: (value) => value ? { | |
| 8432 | - "data-activation-direction": value | |
| 8433 | - } : null | |
| 8434 | - }; | |
| 8435 | - var TooltipViewport = /* @__PURE__ */ React46.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { | |
| 8436 | - const { | |
| 8437 | - render, | |
| 8438 | - className, | |
| 8439 | - style, | |
| 8440 | - children, | |
| 8441 | - ...elementProps | |
| 8442 | - } = componentProps; | |
| 8443 | - const store2 = useTooltipRootContext(); | |
| 8444 | - const positioner = useTooltipPositionerContext(); | |
| 8445 | - const instantType = store2.useState("instantType"); | |
| 8446 | - const { | |
| 8447 | - children: childrenToRender, | |
| 8448 | - state: viewportState | |
| 8449 | - } = usePopupViewport({ | |
| 8450 | - store: store2, | |
| 8451 | - side: positioner.side, | |
| 8452 | - cssVars: TooltipViewportCssVars, | |
| 8453 | - children | |
| 8454 | - }); | |
| 8455 | - const state = { | |
| 8456 | - activationDirection: viewportState.activationDirection, | |
| 8457 | - transitioning: viewportState.transitioning, | |
| 8458 | - instant: instantType | |
| 8459 | - }; | |
| 8460 | - return useRenderElement("div", componentProps, { | |
| 8461 | - state, | |
| 8462 | - ref: forwardedRef, | |
| 8463 | - props: [elementProps, { | |
| 8464 | - children: childrenToRender | |
| 8465 | - }], | |
| 8466 | - stateAttributesMapping: stateAttributesMapping2 | |
| 8467 | - }); | |
| 8468 | - }); | |
| 8469 | - if (true) TooltipViewport.displayName = "TooltipViewport"; | |
| 8470 | - | |
| 8471 | - // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs | |
| 8472 | - var TooltipHandle = class { | |
| 8473 | - /** | |
| 8474 | - * Internal store holding the tooltip state. | |
| 8475 | - * @internal | |
| 8476 | - */ | |
| 8477 | - constructor() { | |
| 8478 | - this.store = new TooltipStore(); | |
| 8479 | - } | |
| 8480 | - /** | |
| 8481 | - * Opens the tooltip and associates it with the trigger with the given ID. | |
| 8482 | - * The trigger must be a Tooltip.Trigger component with this handle passed as a prop. | |
| 8483 | - * | |
| 8484 | - * This method should only be called in an event handler or an effect (not during rendering). | |
| 8485 | - * | |
| 8486 | - * @param triggerId ID of the trigger to associate with the tooltip. | |
| 8487 | - */ | |
| 8488 | - open(triggerId) { | |
| 8489 | - const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; | |
| 8490 | - if (triggerId && !triggerElement) { | |
| 8491 | - throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "${triggerId}".` : formatErrorMessage_default(81, triggerId)); | |
| 8492 | - } | |
| 8493 | - this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); | |
| 8494 | - } | |
| 8495 | - /** | |
| 8496 | - * Closes the tooltip. | |
| 8497 | - */ | |
| 8498 | - close() { | |
| 8499 | - this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); | |
| 8500 | - } | |
| 8501 | - /** | |
| 8502 | - * Indicates whether the tooltip is currently open. | |
| 8503 | - */ | |
| 8504 | - get isOpen() { | |
| 8505 | - return this.store.select("open"); | |
| 8506 | - } | |
| 8507 | - }; | |
| 8508 | - function createTooltipHandle() { | |
| 8509 | - return new TooltipHandle(); | |
| 8510 | - } | |
| 8511 | - | |
| 8512 | - // node_modules/@base-ui/react/use-render/useRender.mjs | |
| 8513 | - function useRender(params) { | |
| 8514 | - return useRenderElement(params.defaultTagName ?? "div", params, params); | |
| 8515 | - } | |
| 8516 | - | |
| 8517 | - // packages/icons/build-module/library/chevron-down.mjs | |
| 8518 | - var import_primitives = __toESM(require_primitives(), 1); | |
| 8519 | - var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); | |
| 8520 | - var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); | |
| 8521 | - | |
| 8522 | - // packages/icons/build-module/library/chevron-left.mjs | |
| 8523 | - var import_primitives2 = __toESM(require_primitives(), 1); | |
| 8524 | - var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); | |
| 8525 | - var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives2.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); | |
| 8526 | - | |
| 8527 | - // packages/icons/build-module/library/chevron-right.mjs | |
| 8528 | - var import_primitives3 = __toESM(require_primitives(), 1); | |
| 8529 | - var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); | |
| 8530 | - var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives3.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); | |
| 8531 | - | |
| 8532 | - // packages/icons/build-module/library/chevron-up.mjs | |
| 8533 | - var import_primitives4 = __toESM(require_primitives(), 1); | |
| 8534 | - var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); | |
| 8535 | - var chevron_up_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives4.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); | |
| 8536 | - | |
| 8537 | - // packages/icons/build-module/library/fullscreen.mjs | |
| 8538 | - var import_primitives5 = __toESM(require_primitives(), 1); | |
| 8539 | - var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); | |
| 8540 | - var fullscreen_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives5.Path, { d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" }) }); | |
| 8541 | - | |
| 8542 | - // packages/ui/build-module/utils/render-slot-with-children.mjs | |
| 8543 | - var import_element10 = __toESM(require_element(), 1); | |
| 8544 | - function renderSlotWithChildren(slot, defaultSlot, children) { | |
| 8545 | - return (0, import_element10.cloneElement)(slot ?? defaultSlot, { children }); | |
| 8546 | - } | |
| 8547 | - | |
| 8548 | - // packages/ui/build-module/utils/theme-provider.mjs | |
| 8549 | - var theme = __toESM(require_theme(), 1); | |
| 8550 | - | |
| 8551 | - // packages/ui/build-module/lock-unlock.mjs | |
| 8552 | - var import_private_apis = __toESM(require_private_apis(), 1); | |
| 8553 | - var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( | |
| 8554 | - "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", | |
| 8555 | - "@wordpress/ui" | |
| 8556 | - ); | |
| 8557 | - | |
| 8558 | - // packages/ui/build-module/utils/theme-provider.mjs | |
| 8559 | - function getThemeProvider() { | |
| 8560 | - const themePackage = theme; | |
| 8561 | - if (themePackage.ThemeProvider) { | |
| 8562 | - return themePackage.ThemeProvider; | |
| 8563 | - } | |
| 8564 | - if (!themePackage.privateApis) { | |
| 8565 | - throw new Error( | |
| 8566 | - "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." | |
| 8567 | - ); | |
| 8568 | - } | |
| 8569 | - return unlock( | |
| 8570 | - themePackage.privateApis | |
| 8571 | - ).ThemeProvider; | |
| 8572 | - } | |
| 8573 | - var ThemeProvider = getThemeProvider(); | |
| 8574 | - | |
| 8575 | - // packages/ui/build-module/stack/stack.mjs | |
| 8576 | - var import_element11 = __toESM(require_element(), 1); | |
| 8577 | - var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; | |
| 8578 | - function getRuntime() { | |
| 8579 | - const globalScope = globalThis; | |
| 8580 | - if (globalScope.__wpStyleRuntime) { | |
| 8581 | - return globalScope.__wpStyleRuntime; | |
| 8582 | - } | |
| 8583 | - globalScope.__wpStyleRuntime = { | |
| 8584 | - documents: /* @__PURE__ */ new Map(), | |
| 8585 | - styles: /* @__PURE__ */ new Map(), | |
| 8586 | - injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 8587 | - }; | |
| 8588 | - if (typeof document !== "undefined") { | |
| 8589 | - registerDocument(document); | |
| 8590 | - } | |
| 8591 | - return globalScope.__wpStyleRuntime; | |
| 8592 | - } | |
| 8593 | - function documentContainsStyleHash(targetDocument, hash) { | |
| 8594 | - if (!targetDocument.head) { | |
| 8595 | - return false; | |
| 8596 | - } | |
| 8597 | - for (const style of targetDocument.head.querySelectorAll( | |
| 8598 | - `style[${STYLE_HASH_ATTRIBUTE}]` | |
| 8599 | - )) { | |
| 8600 | - if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { | |
| 8601 | - return true; | |
| 8602 | - } | |
| 8603 | - } | |
| 8604 | - return false; | |
| 8605 | - } | |
| 8606 | - function injectStyle(targetDocument, hash, css) { | |
| 8607 | - if (!targetDocument.head) { | |
| 8608 | - return; | |
| 8609 | - } | |
| 8610 | - const runtime = getRuntime(); | |
| 8611 | - let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 8612 | - if (!injectedStyles) { | |
| 8613 | - injectedStyles = /* @__PURE__ */ new Set(); | |
| 8614 | - runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 8615 | - } | |
| 8616 | - if (injectedStyles.has(hash)) { | |
| 8617 | - return; | |
| 8618 | - } | |
| 8619 | - if (documentContainsStyleHash(targetDocument, hash)) { | |
| 8620 | - injectedStyles.add(hash); | |
| 8621 | - return; | |
| 8622 | - } | |
| 8623 | - const style = targetDocument.createElement("style"); | |
| 8624 | - style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); | |
| 8625 | - style.appendChild(targetDocument.createTextNode(css)); | |
| 8626 | - targetDocument.head.appendChild(style); | |
| 8627 | - injectedStyles.add(hash); | |
| 8628 | - } | |
| 8629 | - function registerDocument(targetDocument) { | |
| 8630 | - const runtime = getRuntime(); | |
| 8631 | - runtime.documents.set( | |
| 8632 | - targetDocument, | |
| 8633 | - (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 8634 | - ); | |
| 8635 | - for (const [hash, css] of runtime.styles) { | |
| 8636 | - injectStyle(targetDocument, hash, css); | |
| 8637 | - } | |
| 8638 | - return () => { | |
| 8639 | - const count = runtime.documents.get(targetDocument); | |
| 8640 | - if (count === void 0) { | |
| 8641 | - return; | |
| 8642 | - } | |
| 8643 | - if (count <= 1) { | |
| 8644 | - runtime.documents.delete(targetDocument); | |
| 8645 | - return; | |
| 8646 | - } | |
| 8647 | - runtime.documents.set(targetDocument, count - 1); | |
| 8648 | - }; | |
| 8649 | - } | |
| 8650 | - function registerStyle(hash, css) { | |
| 8651 | - const runtime = getRuntime(); | |
| 8652 | - runtime.styles.set(hash, css); | |
| 8653 | - for (const targetDocument of runtime.documents.keys()) { | |
| 8654 | - injectStyle(targetDocument, hash, css); | |
| 8655 | - } | |
| 8656 | - } | |
| 8657 | - if (typeof process === "undefined" || true) { | |
| 8658 | - registerStyle("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); | |
| 8659 | - } | |
| 8660 | - var style_default = { "stack": "_19ce0419607e1896__stack" }; | |
| 8661 | - var gapTokens = { | |
| 8662 | - xs: "var(--wpds-dimension-gap-xs, 4px)", | |
| 8663 | - sm: "var(--wpds-dimension-gap-sm, 8px)", | |
| 8664 | - md: "var(--wpds-dimension-gap-md, 12px)", | |
| 8665 | - lg: "var(--wpds-dimension-gap-lg, 16px)", | |
| 8666 | - xl: "var(--wpds-dimension-gap-xl, 24px)", | |
| 8667 | - "2xl": "var(--wpds-dimension-gap-2xl, 32px)", | |
| 8668 | - "3xl": "var(--wpds-dimension-gap-3xl, 40px)" | |
| 8669 | - }; | |
| 8670 | - var Stack = (0, import_element11.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { | |
| 8671 | - const style = { | |
| 8672 | - gap: gap && gapTokens[gap], | |
| 8673 | - alignItems: align, | |
| 8674 | - justifyContent: justify, | |
| 8675 | - flexDirection: direction, | |
| 8676 | - flexWrap: wrap | |
| 8677 | - }; | |
| 8678 | - const element = useRender({ | |
| 8679 | - render, | |
| 8680 | - ref, | |
| 8681 | - props: mergeProps(props, { style, className: style_default.stack }) | |
| 8682 | - }); | |
| 8683 | - return element; | |
| 8684 | - }); | |
| 8685 | - | |
| 8686 | - // packages/ui/build-module/tooltip/index.mjs | |
| 8687 | - var tooltip_exports = {}; | |
| 8688 | - __export(tooltip_exports, { | |
| 8689 | - Popup: () => Popup, | |
| 8690 | - Portal: () => Portal, | |
| 8691 | - Positioner: () => Positioner, | |
| 8692 | - Provider: () => Provider, | |
| 8693 | - Root: () => Root, | |
| 8694 | - Trigger: () => Trigger | |
| 8695 | - }); | |
| 8696 | - | |
| 8697 | - // packages/ui/build-module/tooltip/popup.mjs | |
| 8698 | - var import_element14 = __toESM(require_element(), 1); | |
| 8699 | - | |
| 8700 | - // packages/ui/build-module/tooltip/portal.mjs | |
| 8701 | - var import_element12 = __toESM(require_element(), 1); | |
| 8702 | - | |
| 8703 | - // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs | |
| 8704 | - var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; | |
| 8705 | - function getRuntime2() { | |
| 8706 | - const globalScope = globalThis; | |
| 8707 | - if (globalScope.__wpStyleRuntime) { | |
| 8708 | - return globalScope.__wpStyleRuntime; | |
| 8709 | - } | |
| 8710 | - globalScope.__wpStyleRuntime = { | |
| 8711 | - documents: /* @__PURE__ */ new Map(), | |
| 8712 | - styles: /* @__PURE__ */ new Map(), | |
| 8713 | - injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 8714 | - }; | |
| 8715 | - if (typeof document !== "undefined") { | |
| 8716 | - registerDocument2(document); | |
| 8717 | - } | |
| 8718 | - return globalScope.__wpStyleRuntime; | |
| 8719 | - } | |
| 8720 | - function documentContainsStyleHash2(targetDocument, hash) { | |
| 8721 | - if (!targetDocument.head) { | |
| 8722 | - return false; | |
| 8723 | - } | |
| 8724 | - for (const style of targetDocument.head.querySelectorAll( | |
| 8725 | - `style[${STYLE_HASH_ATTRIBUTE2}]` | |
| 8726 | - )) { | |
| 8727 | - if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { | |
| 8728 | - return true; | |
| 8729 | - } | |
| 8730 | - } | |
| 8731 | - return false; | |
| 8732 | - } | |
| 8733 | - function injectStyle2(targetDocument, hash, css) { | |
| 8734 | - if (!targetDocument.head) { | |
| 8735 | - return; | |
| 8736 | - } | |
| 8737 | - const runtime = getRuntime2(); | |
| 8738 | - let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 8739 | - if (!injectedStyles) { | |
| 8740 | - injectedStyles = /* @__PURE__ */ new Set(); | |
| 8741 | - runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 8742 | - } | |
| 8743 | - if (injectedStyles.has(hash)) { | |
| 8744 | - return; | |
| 8745 | - } | |
| 8746 | - if (documentContainsStyleHash2(targetDocument, hash)) { | |
| 8747 | - injectedStyles.add(hash); | |
| 8748 | - return; | |
| 8749 | - } | |
| 8750 | - const style = targetDocument.createElement("style"); | |
| 8751 | - style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); | |
| 8752 | - style.appendChild(targetDocument.createTextNode(css)); | |
| 8753 | - targetDocument.head.appendChild(style); | |
| 8754 | - injectedStyles.add(hash); | |
| 8755 | - } | |
| 8756 | - function registerDocument2(targetDocument) { | |
| 8757 | - const runtime = getRuntime2(); | |
| 8758 | - runtime.documents.set( | |
| 8759 | - targetDocument, | |
| 8760 | - (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 8761 | - ); | |
| 8762 | - for (const [hash, css] of runtime.styles) { | |
| 8763 | - injectStyle2(targetDocument, hash, css); | |
| 8764 | - } | |
| 8765 | - return () => { | |
| 8766 | - const count = runtime.documents.get(targetDocument); | |
| 8767 | - if (count === void 0) { | |
| 8768 | - return; | |
| 8769 | - } | |
| 8770 | - if (count <= 1) { | |
| 8771 | - runtime.documents.delete(targetDocument); | |
| 8772 | - return; | |
| 8773 | - } | |
| 8774 | - runtime.documents.set(targetDocument, count - 1); | |
| 8775 | - }; | |
| 8776 | - } | |
| 8777 | - function registerStyle2(hash, css) { | |
| 8778 | - const runtime = getRuntime2(); | |
| 8779 | - runtime.styles.set(hash, css); | |
| 8780 | - for (const targetDocument of runtime.documents.keys()) { | |
| 8781 | - injectStyle2(targetDocument, hash, css); | |
| 8782 | - } | |
| 8783 | - } | |
| 8784 | - if (typeof process === "undefined" || true) { | |
| 8785 | - registerStyle2("be37f31c1e", "._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}}"); | |
| 8786 | - } | |
| 8787 | - var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; | |
| 8788 | - var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; | |
| 8789 | - function resolveOwnerDocument() { | |
| 8790 | - return typeof document === "undefined" ? null : document; | |
| 8791 | - } | |
| 8792 | - function isInWordPressEnvironment() { | |
| 8793 | - let topWp; | |
| 8794 | - try { | |
| 8795 | - topWp = window.top?.wp; | |
| 8796 | - } catch { | |
| 8797 | - } | |
| 8798 | - const wp = topWp ?? window.wp; | |
| 8799 | - return typeof wp?.components === "object" && wp.components !== null; | |
| 8800 | - } | |
| 8801 | - var cachedSlot = null; | |
| 8802 | - function ensureSlotIsAccessible(element) { | |
| 8803 | - element.setAttribute("aria-hidden", "false"); | |
| 8804 | - return element; | |
| 8805 | - } | |
| 8806 | - function createSlot(ownerDocument2) { | |
| 8807 | - const element = ownerDocument2.createElement("div"); | |
| 8808 | - element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); | |
| 8809 | - if (wp_compat_overlay_slot_default.slot) { | |
| 8810 | - element.classList.add(wp_compat_overlay_slot_default.slot); | |
| 8811 | - } | |
| 8812 | - ownerDocument2.body.appendChild(element); | |
| 8813 | - return element; | |
| 8814 | - } | |
| 8815 | - function getWpCompatOverlaySlot() { | |
| 8816 | - if (typeof window === "undefined") { | |
| 8817 | - return void 0; | |
| 8818 | - } | |
| 8819 | - if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { | |
| 8820 | - return void 0; | |
| 8821 | - } | |
| 8822 | - const ownerDocument2 = resolveOwnerDocument(); | |
| 8823 | - if (!ownerDocument2 || !ownerDocument2.body) { | |
| 8824 | - return void 0; | |
| 8825 | - } | |
| 8826 | - if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { | |
| 8827 | - return ensureSlotIsAccessible(cachedSlot); | |
| 8828 | - } | |
| 8829 | - const existing = ownerDocument2.querySelector( | |
| 8830 | - `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` | |
| 8831 | - ); | |
| 8832 | - if (existing instanceof HTMLDivElement) { | |
| 8833 | - cachedSlot = ensureSlotIsAccessible(existing); | |
| 8834 | - return cachedSlot; | |
| 8835 | - } | |
| 8836 | - if (cachedSlot?.isConnected) { | |
| 8837 | - cachedSlot.remove(); | |
| 8838 | - } | |
| 8839 | - cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); | |
| 8840 | - return cachedSlot; | |
| 8841 | - } | |
| 8842 | - | |
| 8843 | - // packages/ui/build-module/tooltip/portal.mjs | |
| 8844 | - var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); | |
| 8845 | - var Portal = (0, import_element12.forwardRef)( | |
| 8846 | - function TooltipPortal3({ container, ...restProps }, ref) { | |
| 8847 | - return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 8848 | - index_parts_exports.Portal, | |
| 8849 | - { | |
| 8850 | - container: container ?? getWpCompatOverlaySlot(), | |
| 8851 | - ...restProps, | |
| 8852 | - ref | |
| 8853 | - } | |
| 8854 | - ); | |
| 8855 | - } | |
| 8856 | - ); | |
| 8857 | - | |
| 8858 | - // packages/ui/build-module/tooltip/positioner.mjs | |
| 8859 | - var import_element13 = __toESM(require_element(), 1); | |
| 8860 | - var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); | |
| 8861 | - var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; | |
| 8862 | - function getRuntime3() { | |
| 8863 | - const globalScope = globalThis; | |
| 8864 | - if (globalScope.__wpStyleRuntime) { | |
| 8865 | - return globalScope.__wpStyleRuntime; | |
| 8866 | - } | |
| 8867 | - globalScope.__wpStyleRuntime = { | |
| 8868 | - documents: /* @__PURE__ */ new Map(), | |
| 8869 | - styles: /* @__PURE__ */ new Map(), | |
| 8870 | - injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 8871 | - }; | |
| 8872 | - if (typeof document !== "undefined") { | |
| 8873 | - registerDocument3(document); | |
| 8874 | - } | |
| 8875 | - return globalScope.__wpStyleRuntime; | |
| 8876 | - } | |
| 8877 | - function documentContainsStyleHash3(targetDocument, hash) { | |
| 8878 | - if (!targetDocument.head) { | |
| 8879 | - return false; | |
| 8880 | - } | |
| 8881 | - for (const style of targetDocument.head.querySelectorAll( | |
| 8882 | - `style[${STYLE_HASH_ATTRIBUTE3}]` | |
| 8883 | - )) { | |
| 8884 | - if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { | |
| 8885 | - return true; | |
| 8886 | - } | |
| 8887 | - } | |
| 8888 | - return false; | |
| 8889 | - } | |
| 8890 | - function injectStyle3(targetDocument, hash, css) { | |
| 8891 | - if (!targetDocument.head) { | |
| 8892 | - return; | |
| 8893 | - } | |
| 8894 | - const runtime = getRuntime3(); | |
| 8895 | - let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 8896 | - if (!injectedStyles) { | |
| 8897 | - injectedStyles = /* @__PURE__ */ new Set(); | |
| 8898 | - runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 8899 | - } | |
| 8900 | - if (injectedStyles.has(hash)) { | |
| 8901 | - return; | |
| 8902 | - } | |
| 8903 | - if (documentContainsStyleHash3(targetDocument, hash)) { | |
| 8904 | - injectedStyles.add(hash); | |
| 8905 | - return; | |
| 8906 | - } | |
| 8907 | - const style = targetDocument.createElement("style"); | |
| 8908 | - style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); | |
| 8909 | - style.appendChild(targetDocument.createTextNode(css)); | |
| 8910 | - targetDocument.head.appendChild(style); | |
| 8911 | - injectedStyles.add(hash); | |
| 8912 | - } | |
| 8913 | - function registerDocument3(targetDocument) { | |
| 8914 | - const runtime = getRuntime3(); | |
| 8915 | - runtime.documents.set( | |
| 8916 | - targetDocument, | |
| 8917 | - (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 8918 | - ); | |
| 8919 | - for (const [hash, css] of runtime.styles) { | |
| 8920 | - injectStyle3(targetDocument, hash, css); | |
| 8921 | - } | |
| 8922 | - return () => { | |
| 8923 | - const count = runtime.documents.get(targetDocument); | |
| 8924 | - if (count === void 0) { | |
| 8925 | - return; | |
| 8926 | - } | |
| 8927 | - if (count <= 1) { | |
| 8928 | - runtime.documents.delete(targetDocument); | |
| 8929 | - return; | |
| 8930 | - } | |
| 8931 | - runtime.documents.set(targetDocument, count - 1); | |
| 8932 | - }; | |
| 8933 | - } | |
| 8934 | - function registerStyle3(hash, css) { | |
| 8935 | - const runtime = getRuntime3(); | |
| 8936 | - runtime.styles.set(hash, css); | |
| 8937 | - for (const targetDocument of runtime.documents.keys()) { | |
| 8938 | - injectStyle3(targetDocument, hash, css); | |
| 8939 | - } | |
| 8940 | - } | |
| 8941 | - if (typeof process === "undefined" || true) { | |
| 8942 | - registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 8943 | - } | |
| 8944 | - var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 8945 | - if (typeof process === "undefined" || true) { | |
| 8946 | - registerStyle3("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); | |
| 8947 | - } | |
| 8948 | - var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; | |
| 8949 | - var Positioner = (0, import_element13.forwardRef)( | |
| 8950 | - function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { | |
| 8951 | - return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( | |
| 8952 | - index_parts_exports.Positioner, | |
| 8953 | - { | |
| 8954 | - ref, | |
| 8955 | - align, | |
| 8956 | - side, | |
| 8957 | - sideOffset, | |
| 8958 | - ...props, | |
| 8959 | - className: clsx_default( | |
| 8960 | - resets_default["box-sizing"], | |
| 8961 | - style_default2.positioner, | |
| 8962 | - className | |
| 8963 | - ) | |
| 8964 | - } | |
| 8965 | - ); | |
| 8966 | - } | |
| 8967 | - ); | |
| 8968 | - | |
| 8969 | - // packages/ui/build-module/tooltip/popup.mjs | |
| 8970 | - var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); | |
| 8971 | - var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; | |
| 8972 | - function getRuntime4() { | |
| 8973 | - const globalScope = globalThis; | |
| 8974 | - if (globalScope.__wpStyleRuntime) { | |
| 8975 | - return globalScope.__wpStyleRuntime; | |
| 8976 | - } | |
| 8977 | - globalScope.__wpStyleRuntime = { | |
| 8978 | - documents: /* @__PURE__ */ new Map(), | |
| 8979 | - styles: /* @__PURE__ */ new Map(), | |
| 8980 | - injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 8981 | - }; | |
| 8982 | - if (typeof document !== "undefined") { | |
| 8983 | - registerDocument4(document); | |
| 8984 | - } | |
| 8985 | - return globalScope.__wpStyleRuntime; | |
| 8986 | - } | |
| 8987 | - function documentContainsStyleHash4(targetDocument, hash) { | |
| 8988 | - if (!targetDocument.head) { | |
| 8989 | - return false; | |
| 8990 | - } | |
| 8991 | - for (const style of targetDocument.head.querySelectorAll( | |
| 8992 | - `style[${STYLE_HASH_ATTRIBUTE4}]` | |
| 8993 | - )) { | |
| 8994 | - if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { | |
| 8995 | - return true; | |
| 8996 | - } | |
| 8997 | - } | |
| 8998 | - return false; | |
| 8999 | - } | |
| 9000 | - function injectStyle4(targetDocument, hash, css) { | |
| 9001 | - if (!targetDocument.head) { | |
| 9002 | - return; | |
| 9003 | - } | |
| 9004 | - const runtime = getRuntime4(); | |
| 9005 | - let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 9006 | - if (!injectedStyles) { | |
| 9007 | - injectedStyles = /* @__PURE__ */ new Set(); | |
| 9008 | - runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 9009 | - } | |
| 9010 | - if (injectedStyles.has(hash)) { | |
| 9011 | - return; | |
| 9012 | - } | |
| 9013 | - if (documentContainsStyleHash4(targetDocument, hash)) { | |
| 9014 | - injectedStyles.add(hash); | |
| 9015 | - return; | |
| 9016 | - } | |
| 9017 | - const style = targetDocument.createElement("style"); | |
| 9018 | - style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); | |
| 9019 | - style.appendChild(targetDocument.createTextNode(css)); | |
| 9020 | - targetDocument.head.appendChild(style); | |
| 9021 | - injectedStyles.add(hash); | |
| 9022 | - } | |
| 9023 | - function registerDocument4(targetDocument) { | |
| 9024 | - const runtime = getRuntime4(); | |
| 9025 | - runtime.documents.set( | |
| 9026 | - targetDocument, | |
| 9027 | - (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 9028 | - ); | |
| 9029 | - for (const [hash, css] of runtime.styles) { | |
| 9030 | - injectStyle4(targetDocument, hash, css); | |
| 9031 | - } | |
| 9032 | - return () => { | |
| 9033 | - const count = runtime.documents.get(targetDocument); | |
| 9034 | - if (count === void 0) { | |
| 9035 | - return; | |
| 9036 | - } | |
| 9037 | - if (count <= 1) { | |
| 9038 | - runtime.documents.delete(targetDocument); | |
| 9039 | - return; | |
| 9040 | - } | |
| 9041 | - runtime.documents.set(targetDocument, count - 1); | |
| 9042 | - }; | |
| 9043 | - } | |
| 9044 | - function registerStyle4(hash, css) { | |
| 9045 | - const runtime = getRuntime4(); | |
| 9046 | - runtime.styles.set(hash, css); | |
| 9047 | - for (const targetDocument of runtime.documents.keys()) { | |
| 9048 | - injectStyle4(targetDocument, hash, css); | |
| 9049 | - } | |
| 9050 | - } | |
| 9051 | - if (typeof process === "undefined" || true) { | |
| 9052 | - registerStyle4("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); | |
| 9053 | - } | |
| 9054 | - var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; | |
| 9055 | - var POPUP_COLOR = { background: "#1e1e1e" }; | |
| 9056 | - var Popup = (0, import_element14.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { | |
| 9057 | - const popupContent = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( | |
| 9058 | - index_parts_exports.Popup, | |
| 9059 | - { | |
| 9060 | - ref, | |
| 9061 | - className: clsx_default(style_default3.popup, className), | |
| 9062 | - ...props, | |
| 9063 | - children | |
| 9064 | - } | |
| 9065 | - ) }); | |
| 9066 | - const positionedPopup = renderSlotWithChildren( | |
| 9067 | - positioner, | |
| 9068 | - /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Positioner, {}), | |
| 9069 | - popupContent | |
| 9070 | - ); | |
| 9071 | - return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Portal, {}), positionedPopup); | |
| 9072 | - }); | |
| 9073 | - | |
| 9074 | - // packages/ui/build-module/tooltip/trigger.mjs | |
| 9075 | - var import_element15 = __toESM(require_element(), 1); | |
| 9076 | - var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); | |
| 9077 | - var Trigger = (0, import_element15.forwardRef)( | |
| 9078 | - function TooltipTrigger3(props, ref) { | |
| 9079 | - return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(index_parts_exports.Trigger, { ref, ...props }); | |
| 9080 | - } | |
| 9081 | - ); | |
| 9082 | - | |
| 9083 | - // packages/ui/build-module/tooltip/root.mjs | |
| 9084 | - var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); | |
| 9085 | - function Root(props) { | |
| 9086 | - return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(index_parts_exports.Root, { ...props }); | |
| 9087 | - } | |
| 9088 | - | |
| 9089 | - // packages/ui/build-module/tooltip/provider.mjs | |
| 9090 | - var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); | |
| 9091 | - function Provider({ ...props }) { | |
| 9092 | - return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(index_parts_exports.Provider, { ...props }); | |
| 9093 | - } | |
| 9094 | - | |
| 9095 | - // packages/ui/build-module/visually-hidden/visually-hidden.mjs | |
| 9096 | - var import_element16 = __toESM(require_element(), 1); | |
| 9097 | - var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; | |
| 9098 | - function getRuntime5() { | |
| 9099 | - const globalScope = globalThis; | |
| 9100 | - if (globalScope.__wpStyleRuntime) { | |
| 9101 | - return globalScope.__wpStyleRuntime; | |
| 9102 | - } | |
| 9103 | - globalScope.__wpStyleRuntime = { | |
| 9104 | - documents: /* @__PURE__ */ new Map(), | |
| 9105 | - styles: /* @__PURE__ */ new Map(), | |
| 9106 | - injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 9107 | - }; | |
| 9108 | - if (typeof document !== "undefined") { | |
| 9109 | - registerDocument5(document); | |
| 9110 | - } | |
| 9111 | - return globalScope.__wpStyleRuntime; | |
| 9112 | - } | |
| 9113 | - function documentContainsStyleHash5(targetDocument, hash) { | |
| 9114 | - if (!targetDocument.head) { | |
| 9115 | - return false; | |
| 9116 | - } | |
| 9117 | - for (const style of targetDocument.head.querySelectorAll( | |
| 9118 | - `style[${STYLE_HASH_ATTRIBUTE5}]` | |
| 9119 | - )) { | |
| 9120 | - if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { | |
| 9121 | - return true; | |
| 9122 | - } | |
| 9123 | - } | |
| 9124 | - return false; | |
| 9125 | - } | |
| 9126 | - function injectStyle5(targetDocument, hash, css) { | |
| 9127 | - if (!targetDocument.head) { | |
| 9128 | - return; | |
| 9129 | - } | |
| 9130 | - const runtime = getRuntime5(); | |
| 9131 | - let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 9132 | - if (!injectedStyles) { | |
| 9133 | - injectedStyles = /* @__PURE__ */ new Set(); | |
| 9134 | - runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 9135 | - } | |
| 9136 | - if (injectedStyles.has(hash)) { | |
| 9137 | - return; | |
| 9138 | - } | |
| 9139 | - if (documentContainsStyleHash5(targetDocument, hash)) { | |
| 9140 | - injectedStyles.add(hash); | |
| 9141 | - return; | |
| 9142 | - } | |
| 9143 | - const style = targetDocument.createElement("style"); | |
| 9144 | - style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); | |
| 9145 | - style.appendChild(targetDocument.createTextNode(css)); | |
| 9146 | - targetDocument.head.appendChild(style); | |
| 9147 | - injectedStyles.add(hash); | |
| 9148 | - } | |
| 9149 | - function registerDocument5(targetDocument) { | |
| 9150 | - const runtime = getRuntime5(); | |
| 9151 | - runtime.documents.set( | |
| 9152 | - targetDocument, | |
| 9153 | - (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 9154 | - ); | |
| 9155 | - for (const [hash, css] of runtime.styles) { | |
| 9156 | - injectStyle5(targetDocument, hash, css); | |
| 9157 | - } | |
| 9158 | - return () => { | |
| 9159 | - const count = runtime.documents.get(targetDocument); | |
| 9160 | - if (count === void 0) { | |
| 9161 | - return; | |
| 9162 | - } | |
| 9163 | - if (count <= 1) { | |
| 9164 | - runtime.documents.delete(targetDocument); | |
| 9165 | - return; | |
| 9166 | - } | |
| 9167 | - runtime.documents.set(targetDocument, count - 1); | |
| 9168 | - }; | |
| 9169 | - } | |
| 9170 | - function registerStyle5(hash, css) { | |
| 9171 | - const runtime = getRuntime5(); | |
| 9172 | - runtime.styles.set(hash, css); | |
| 9173 | - for (const targetDocument of runtime.documents.keys()) { | |
| 9174 | - injectStyle5(targetDocument, hash, css); | |
| 9175 | - } | |
| 9176 | - } | |
| 9177 | - if (typeof process === "undefined" || true) { | |
| 9178 | - registerStyle5("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}"); | |
| 9179 | - } | |
| 9180 | - var style_default4 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; | |
| 9181 | - var VisuallyHidden = (0, import_element16.forwardRef)( | |
| 9182 | - function VisuallyHidden2({ render, ...restProps }, ref) { | |
| 9183 | - const element = useRender({ | |
| 9184 | - render, | |
| 9185 | - ref, | |
| 9186 | - props: mergeProps( | |
| 9187 | - { className: style_default4["visually-hidden"] }, | |
| 9188 | - restProps, | |
| 9189 | - { | |
| 9190 | - // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. | |
| 9191 | - "data-visually-hidden": "" | |
| 9192 | - } | |
| 9193 | - ) | |
| 9194 | - }); | |
| 9195 | - return element; | |
| 9196 | - } | |
| 9197 | - ); | |
| 9198 | - | |
| 9199 | - // packages/admin-ui/build-module/navigable-region/index.mjs | |
| 9200 | - var import_element17 = __toESM(require_element(), 1); | |
| 9201 | - var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); | |
| 9202 | - var NavigableRegion = (0, import_element17.forwardRef)( | |
| 262 | + var NavigableRegion = (0, import_element.forwardRef)( | |
| 9203 | 263 | ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { |
| 9204 | - return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( | |
| 264 | + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( | |
| 9205 | 265 | Tag, |
| 9206 | 266 | { |
| 9207 | 267 | ref, |
| 9208 | 268 | className: clsx_default("admin-ui-navigable-region", className), |
| @@ -9218,11 +278,11 @@ | ||
| 9218 | 278 | NavigableRegion.displayName = "NavigableRegion"; |
| 9219 | 279 | var navigable_region_default = NavigableRegion; |
| 9220 | 280 | |
| 9221 | 281 | // packages/edit-post/build-module/components/layout/index.mjs |
| 9222 | - var import_editor17 = __toESM(require_editor(), 1); | |
| 9223 | - var import_data24 = __toESM(require_data(), 1); | |
| 9224 | - var import_block_editor = __toESM(require_block_editor(), 1); | |
| 282 | + var import_editor18 = __toESM(require_editor(), 1); | |
| 283 | + var import_data25 = __toESM(require_data(), 1); | |
| 284 | + var import_block_editor2 = __toESM(require_block_editor(), 1); | |
| 9225 | 285 | |
| 9226 | 286 | // packages/global-styles-engine/build-module/utils/common.mjs |
| 9227 | 287 | var import_style_engine = __toESM(require_style_engine(), 1); |
| 9228 | 288 | var ROOT_BLOCK_SELECTOR = "body"; |
| @@ -9529,9 +589,36 @@ | ||
| 9529 | 589 | |
| 9530 | 590 | // packages/edit-post/build-module/components/layout/index.mjs |
| 9531 | 591 | var import_plugins = __toESM(require_plugins(), 1); |
| 9532 | 592 | var import_i18n14 = __toESM(require_i18n(), 1); |
| 9533 | - var import_element28 = __toESM(require_element(), 1); | |
| 593 | + var import_element12 = __toESM(require_element(), 1); | |
| 594 | + | |
| 595 | + // packages/icons/build-module/library/arrow-up-left.mjs | |
| 596 | + var import_primitives = __toESM(require_primitives(), 1); | |
| 597 | + var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); | |
| 598 | + var arrow_up_left_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.Path, { d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" }) }); | |
| 599 | + | |
| 600 | + // packages/icons/build-module/library/chevron-down.mjs | |
| 601 | + var import_primitives2 = __toESM(require_primitives(), 1); | |
| 602 | + var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); | |
| 603 | + var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives2.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); | |
| 604 | + | |
| 605 | + // packages/icons/build-module/library/chevron-up.mjs | |
| 606 | + var import_primitives3 = __toESM(require_primitives(), 1); | |
| 607 | + var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); | |
| 608 | + var chevron_up_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives3.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); | |
| 609 | + | |
| 610 | + // packages/icons/build-module/library/fullscreen.mjs | |
| 611 | + var import_primitives4 = __toESM(require_primitives(), 1); | |
| 612 | + var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); | |
| 613 | + var fullscreen_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives4.Path, { d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" }) }); | |
| 614 | + | |
| 615 | + // packages/icons/build-module/library/wordpress.mjs | |
| 616 | + var import_primitives5 = __toESM(require_primitives(), 1); | |
| 617 | + var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); | |
| 618 | + var wordpress_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives5.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) }); | |
| 619 | + | |
| 620 | + // packages/edit-post/build-module/components/layout/index.mjs | |
| 9534 | 621 | var import_notices3 = __toESM(require_notices(), 1); |
| 9535 | 622 | var import_preferences10 = __toESM(require_preferences(), 1); |
| 9536 | 623 | var import_commands2 = __toESM(require_commands(), 1); |
| 9537 | 624 | var import_block_library = __toESM(require_block_library(), 1); |
| @@ -9538,9 +625,9 @@ | ||
| 9538 | 625 | var import_url5 = __toESM(require_url(), 1); |
| 9539 | 626 | var import_html_entities = __toESM(require_html_entities(), 1); |
| 9540 | 627 | var import_core_data8 = __toESM(require_core_data(), 1); |
| 9541 | 628 | var import_components9 = __toESM(require_components(), 1); |
| 9542 | - var import_compose2 = __toESM(require_compose(), 1); | |
| 629 | + var import_compose3 = __toESM(require_compose(), 1); | |
| 9543 | 630 | |
| 9544 | 631 | // packages/edit-post/build-module/components/back-button/index.mjs |
| 9545 | 632 | var import_editor2 = __toESM(require_editor(), 1); |
| 9546 | 633 | var import_components2 = __toESM(require_components(), 1); |
| @@ -9551,34 +638,124 @@ | ||
| 9551 | 638 | var import_i18n = __toESM(require_i18n(), 1); |
| 9552 | 639 | var import_url = __toESM(require_url(), 1); |
| 9553 | 640 | var import_editor = __toESM(require_editor(), 1); |
| 9554 | 641 | var import_core_data = __toESM(require_core_data(), 1); |
| 9555 | - var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); | |
| 642 | + var import_compose = __toESM(require_compose(), 1); | |
| 643 | + var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); | |
| 644 | + var siteIconVariants = { | |
| 645 | + edit: { | |
| 646 | + clipPath: "inset(0% round 0px)" | |
| 647 | + }, | |
| 648 | + hover: { | |
| 649 | + clipPath: "inset( 22% round 2px )" | |
| 650 | + }, | |
| 651 | + tap: { | |
| 652 | + clipPath: "inset(0% round 0px)" | |
| 653 | + } | |
| 654 | + }; | |
| 655 | + var toggleHomeIconVariants = { | |
| 656 | + edit: { | |
| 657 | + opacity: 0, | |
| 658 | + scale: 0.2 | |
| 659 | + }, | |
| 660 | + hover: { | |
| 661 | + opacity: 1, | |
| 662 | + scale: 1, | |
| 663 | + clipPath: "inset( 22% round 2px )" | |
| 664 | + } | |
| 665 | + }; | |
| 9556 | 666 | function FullscreenModeClose({ showTooltip, icon, href, initialPost }) { |
| 9557 | - const postType = (0, import_data2.useSelect)( | |
| 667 | + const { isRequestingSiteIcon, postType, siteIconUrl } = (0, import_data2.useSelect)( | |
| 9558 | 668 | (select3) => { |
| 9559 | 669 | const { getCurrentPostType } = select3(import_editor.store); |
| 9560 | - const { getPostType } = select3(import_core_data.store); | |
| 9561 | - return getPostType(initialPost?.type || getCurrentPostType()); | |
| 670 | + const { getEntityRecord, getPostType, isResolving } = select3(import_core_data.store); | |
| 671 | + const siteData = getEntityRecord("root", "__unstableBase", void 0) || {}; | |
| 672 | + const _postType = initialPost?.type || getCurrentPostType(); | |
| 673 | + return { | |
| 674 | + isRequestingSiteIcon: isResolving("getEntityRecord", [ | |
| 675 | + "root", | |
| 676 | + "__unstableBase", | |
| 677 | + void 0 | |
| 678 | + ]), | |
| 679 | + postType: getPostType(_postType), | |
| 680 | + siteIconUrl: siteData.site_icon_url | |
| 681 | + }; | |
| 9562 | 682 | }, |
| 9563 | 683 | [initialPost?.type] |
| 9564 | 684 | ); |
| 685 | + const disableMotion = (0, import_compose.useReducedMotion)(); | |
| 686 | + const transition = { | |
| 687 | + duration: disableMotion ? 0 : 0.2 | |
| 688 | + }; | |
| 9565 | 689 | if (!postType) { |
| 9566 | 690 | return null; |
| 9567 | 691 | } |
| 692 | + let siteIconContent; | |
| 693 | + if (isRequestingSiteIcon && !siteIconUrl) { | |
| 694 | + siteIconContent = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "edit-post-fullscreen-mode-close-site-icon__image" }); | |
| 695 | + } else if (siteIconUrl) { | |
| 696 | + siteIconContent = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 697 | + "img", | |
| 698 | + { | |
| 699 | + className: "edit-post-fullscreen-mode-close-site-icon__image", | |
| 700 | + alt: (0, import_i18n.__)("Site Icon"), | |
| 701 | + src: siteIconUrl | |
| 702 | + } | |
| 703 | + ); | |
| 704 | + } else { | |
| 705 | + siteIconContent = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 706 | + import_components.Icon, | |
| 707 | + { | |
| 708 | + className: "edit-post-fullscreen-mode-close-site-icon__icon", | |
| 709 | + icon: wordpress_default, | |
| 710 | + size: 48 | |
| 711 | + } | |
| 712 | + ); | |
| 713 | + } | |
| 714 | + const buttonIcon = icon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_components.Icon, { size: "36px", icon }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "edit-post-fullscreen-mode-close-site-icon", children: siteIconContent }); | |
| 715 | + const classes = clsx_default("edit-post-fullscreen-mode-close", { | |
| 716 | + "has-icon": siteIconUrl | |
| 717 | + }); | |
| 9568 | 718 | const buttonHref = href ?? (0, import_url.addQueryArgs)("edit.php", { |
| 9569 | 719 | post_type: postType.slug |
| 9570 | 720 | }); |
| 9571 | 721 | const buttonLabel = postType?.labels?.view_items ?? (0, import_i18n.__)("Back"); |
| 9572 | - return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( | |
| 9573 | - import_components.Button, | |
| 722 | + return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)( | |
| 723 | + import_components.__unstableMotion.div, | |
| 9574 | 724 | { |
| 9575 | - size: "compact", | |
| 9576 | - href: buttonHref, | |
| 9577 | - label: buttonLabel, | |
| 9578 | - showTooltip, | |
| 9579 | - tooltipPosition: "bottom", | |
| 9580 | - icon: icon ?? ((0, import_i18n.isRTL)() ? chevron_right_default : chevron_left_default) | |
| 725 | + className: "edit-post-fullscreen-mode-close__view-mode-toggle", | |
| 726 | + animate: "edit", | |
| 727 | + initial: "edit", | |
| 728 | + whileHover: "hover", | |
| 729 | + whileTap: "tap", | |
| 730 | + transition, | |
| 731 | + children: [ | |
| 732 | + /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 733 | + import_components.Button, | |
| 734 | + { | |
| 735 | + __next40pxDefaultSize: true, | |
| 736 | + className: classes, | |
| 737 | + href: buttonHref, | |
| 738 | + label: buttonLabel, | |
| 739 | + showTooltip, | |
| 740 | + tooltipPosition: "middle right", | |
| 741 | + children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_components.__unstableMotion.div, { variants: !disableMotion && siteIconVariants, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "edit-post-fullscreen-mode-close__view-mode-toggle-icon", children: buttonIcon }) }) | |
| 742 | + } | |
| 743 | + ), | |
| 744 | + /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( | |
| 745 | + import_components.__unstableMotion.div, | |
| 746 | + { | |
| 747 | + className: clsx_default( | |
| 748 | + "edit-post-fullscreen-mode-close__back-icon", | |
| 749 | + { | |
| 750 | + "has-site-icon": siteIconUrl | |
| 751 | + } | |
| 752 | + ), | |
| 753 | + variants: !disableMotion && toggleHomeIconVariants, | |
| 754 | + children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_components.Icon, { icon: arrow_up_left_default }) | |
| 755 | + } | |
| 756 | + ) | |
| 757 | + ] | |
| 9581 | 758 | } |
| 9582 | 759 | ); |
| 9583 | 760 | } |
| 9584 | 761 | var fullscreen_mode_close_default = FullscreenModeClose; |
| @@ -9583,17 +760,17 @@ | ||
| 9583 | 760 | } |
| 9584 | 761 | var fullscreen_mode_close_default = FullscreenModeClose; |
| 9585 | 762 | |
| 9586 | 763 | // packages/edit-post/build-module/lock-unlock.mjs |
| 9587 | - var import_private_apis2 = __toESM(require_private_apis(), 1); | |
| 9588 | - var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( | |
| 764 | + var import_private_apis = __toESM(require_private_apis(), 1); | |
| 765 | + var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( | |
| 9589 | 766 | "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", |
| 9590 | 767 | "@wordpress/edit-post" |
| 9591 | 768 | ); |
| 9592 | 769 | |
| 9593 | 770 | // packages/edit-post/build-module/components/back-button/index.mjs |
| 9594 | - var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); | |
| 9595 | - var { BackButton: BackButtonFill } = unlock2(import_editor2.privateApis); | |
| 771 | + var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); | |
| 772 | + var { BackButton: BackButtonFill } = unlock(import_editor2.privateApis); | |
| 9596 | 773 | var slideX = { |
| 9597 | 774 | hidden: { x: "-100%" }, |
| 9598 | 775 | distractionFreeInactive: { x: 0 }, |
| 9599 | 776 | hover: { x: 0, transition: { type: "tween", delay: 0.2 } } |
| @@ -9598,14 +775,14 @@ | ||
| 9598 | 775 | distractionFreeInactive: { x: 0 }, |
| 9599 | 776 | hover: { x: 0, transition: { type: "tween", delay: 0.2 } } |
| 9600 | 777 | }; |
| 9601 | 778 | function BackButton({ initialPost }) { |
| 9602 | - return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(BackButtonFill, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( | |
| 779 | + return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BackButtonFill, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)( | |
| 9603 | 780 | import_components2.__unstableMotion.div, |
| 9604 | 781 | { |
| 9605 | 782 | variants: slideX, |
| 9606 | 783 | transition: { type: "tween", delay: 0.8 }, |
| 9607 | - children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( | |
| 784 | + children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)( | |
| 9608 | 785 | fullscreen_mode_close_default, |
| 9609 | 786 | { |
| 9610 | 787 | showTooltip: true, |
| 9611 | 788 | initialPost |
| @@ -9617,9 +794,9 @@ | ||
| 9617 | 794 | var back_button_default = BackButton; |
| 9618 | 795 | |
| 9619 | 796 | // packages/edit-post/build-module/components/editor-initialization/listener-hooks.mjs |
| 9620 | 797 | var import_data3 = __toESM(require_data(), 1); |
| 9621 | - var import_element18 = __toESM(require_element(), 1); | |
| 798 | + var import_element2 = __toESM(require_element(), 1); | |
| 9622 | 799 | var import_editor3 = __toESM(require_editor(), 1); |
| 9623 | 800 | var import_core_data2 = __toESM(require_core_data(), 1); |
| 9624 | 801 | |
| 9625 | 802 | // packages/edit-post/build-module/store/constants.mjs |
| @@ -9637,13 +814,13 @@ | ||
| 9637 | 814 | isViewable: postType?.viewable, |
| 9638 | 815 | newPermalink: getCurrentPost().link |
| 9639 | 816 | }; |
| 9640 | 817 | }, []); |
| 9641 | - const nodeToUpdateRef = (0, import_element18.useRef)(); | |
| 9642 | - (0, import_element18.useEffect)(() => { | |
| 818 | + const nodeToUpdateRef = (0, import_element2.useRef)(); | |
| 819 | + (0, import_element2.useEffect)(() => { | |
| 9643 | 820 | nodeToUpdateRef.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR); |
| 9644 | 821 | }, []); |
| 9645 | - (0, import_element18.useEffect)(() => { | |
| 822 | + (0, import_element2.useEffect)(() => { | |
| 9646 | 823 | if (!newPermalink || !nodeToUpdateRef.current) { |
| 9647 | 824 | return; |
| 9648 | 825 | } |
| 9649 | 826 | if (!isViewable) { |
| @@ -9661,9 +838,9 @@ | ||
| 9661 | 838 | return null; |
| 9662 | 839 | } |
| 9663 | 840 | |
| 9664 | 841 | // packages/edit-post/build-module/components/keyboard-shortcuts/index.mjs |
| 9665 | - var import_element19 = __toESM(require_element(), 1); | |
| 842 | + var import_element3 = __toESM(require_element(), 1); | |
| 9666 | 843 | var import_data7 = __toESM(require_data(), 1); |
| 9667 | 844 | var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); |
| 9668 | 845 | var import_i18n3 = __toESM(require_i18n(), 1); |
| 9669 | 846 | |
| @@ -9689,12 +866,9 @@ | ||
| 9689 | 866 | const existing = mergedMetaboxes.findIndex( |
| 9690 | 867 | (box) => box.id === metabox.id |
| 9691 | 868 | ); |
| 9692 | 869 | if (existing !== -1) { |
| 9693 | - mergedMetaboxes[existing] = { | |
| 9694 | - ...mergedMetaboxes[existing], | |
| 9695 | - ...metabox | |
| 9696 | - }; | |
| 870 | + mergedMetaboxes[existing] = metabox; | |
| 9697 | 871 | } else { |
| 9698 | 872 | mergedMetaboxes.push(metabox); |
| 9699 | 873 | } |
| 9700 | 874 | } |
| @@ -9785,9 +959,9 @@ | ||
| 9785 | 959 | return document.querySelector("#metaboxes .metabox-location-" + location); |
| 9786 | 960 | }; |
| 9787 | 961 | |
| 9788 | 962 | // packages/edit-post/build-module/store/actions.mjs |
| 9789 | - var { interfaceStore } = unlock2(import_editor4.privateApis); | |
| 963 | + var { interfaceStore } = unlock(import_editor4.privateApis); | |
| 9790 | 964 | var openGeneralSidebar = (name) => ({ registry }) => { |
| 9791 | 965 | registry.dispatch(interfaceStore).enableComplementaryArea("core", name); |
| 9792 | 966 | }; |
| 9793 | 967 | var closeGeneralSidebar = () => ({ registry }) => registry.dispatch(interfaceStore).disableComplementaryArea("core"); |
| @@ -9866,12 +1040,12 @@ | ||
| 9866 | 1040 | }); |
| 9867 | 1041 | return { type: "NOTHING" }; |
| 9868 | 1042 | } |
| 9869 | 1043 | var showBlockTypes = (blockNames) => ({ registry }) => { |
| 9870 | - unlock2(registry.dispatch(import_editor4.store)).showBlockTypes(blockNames); | |
| 1044 | + unlock(registry.dispatch(import_editor4.store)).showBlockTypes(blockNames); | |
| 9871 | 1045 | }; |
| 9872 | 1046 | var hideBlockTypes = (blockNames) => ({ registry }) => { |
| 9873 | - unlock2(registry.dispatch(import_editor4.store)).hideBlockTypes(blockNames); | |
| 1047 | + unlock(registry.dispatch(import_editor4.store)).hideBlockTypes(blockNames); | |
| 9874 | 1048 | }; |
| 9875 | 1049 | function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) { |
| 9876 | 1050 | return { |
| 9877 | 1051 | type: "SET_META_BOXES_PER_LOCATIONS", |
| @@ -10066,11 +1240,11 @@ | ||
| 10066 | 1240 | var import_preferences2 = __toESM(require_preferences(), 1); |
| 10067 | 1241 | var import_core_data4 = __toESM(require_core_data(), 1); |
| 10068 | 1242 | var import_editor5 = __toESM(require_editor(), 1); |
| 10069 | 1243 | var import_deprecated2 = __toESM(require_deprecated(), 1); |
| 10070 | - var { interfaceStore: interfaceStore2 } = unlock2(import_editor5.privateApis); | |
| 10071 | - var EMPTY_ARRAY2 = []; | |
| 10072 | - var EMPTY_OBJECT2 = {}; | |
| 1244 | + var { interfaceStore: interfaceStore2 } = unlock(import_editor5.privateApis); | |
| 1245 | + var EMPTY_ARRAY = []; | |
| 1246 | + var EMPTY_OBJECT = {}; | |
| 10073 | 1247 | var getEditorMode = (0, import_data5.createRegistrySelector)( |
| 10074 | 1248 | (select3) => () => select3(import_preferences2.store).get("core", "editorMode") ?? "visual" |
| 10075 | 1249 | ); |
| 10076 | 1250 | var isEditorSidebarOpened = (0, import_data5.createRegistrySelector)( |
| @@ -10113,9 +1287,9 @@ | ||
| 10113 | 1287 | opened: true |
| 10114 | 1288 | } |
| 10115 | 1289 | }; |
| 10116 | 1290 | }, panelsWithEnabledState ?? {}); |
| 10117 | - return panels ?? panelsWithEnabledState ?? EMPTY_OBJECT2; | |
| 1291 | + return panels ?? panelsWithEnabledState ?? EMPTY_OBJECT; | |
| 10118 | 1292 | } |
| 10119 | 1293 | var getPreferences = (0, import_data5.createRegistrySelector)((select3) => () => { |
| 10120 | 1294 | (0, import_deprecated2.default)(`select( 'core/edit-post' ).getPreferences`, { |
| 10121 | 1295 | since: "6.0", |
| @@ -10154,9 +1328,9 @@ | ||
| 10154 | 1328 | const value = preferences[preferenceKey]; |
| 10155 | 1329 | return value === void 0 ? defaultValue : value; |
| 10156 | 1330 | } |
| 10157 | 1331 | var getHiddenBlockTypes = (0, import_data5.createRegistrySelector)((select3) => () => { |
| 10158 | - return select3(import_preferences2.store).get("core", "hiddenBlockTypes") ?? EMPTY_ARRAY2; | |
| 1332 | + return select3(import_preferences2.store).get("core", "hiddenBlockTypes") ?? EMPTY_ARRAY; | |
| 10159 | 1333 | }); |
| 10160 | 1334 | var isPublishSidebarOpened = (0, import_data5.createRegistrySelector)( |
| 10161 | 1335 | (select3) => () => { |
| 10162 | 1336 | (0, import_deprecated2.default)(`select( 'core/edit-post' ).isPublishSidebarOpened`, { |
| @@ -10276,9 +1450,9 @@ | ||
| 10276 | 1450 | since: "6.5", |
| 10277 | 1451 | version: "6.7" |
| 10278 | 1452 | } |
| 10279 | 1453 | ); |
| 10280 | - return unlock2(select3(import_editor5.store)).getInserter(); | |
| 1454 | + return unlock(select3(import_editor5.store)).getInserter(); | |
| 10281 | 1455 | } |
| 10282 | 1456 | ); |
| 10283 | 1457 | var isListViewOpened = (0, import_data5.createRegistrySelector)((select3) => () => { |
| 10284 | 1458 | (0, import_deprecated2.default)(`select( 'core/edit-post' ).isListViewOpened`, { |
| @@ -10299,9 +1473,9 @@ | ||
| 10299 | 1473 | } |
| 10300 | 1474 | var getEditedPostTemplate = (0, import_data5.createRegistrySelector)( |
| 10301 | 1475 | (select3) => () => { |
| 10302 | 1476 | const { id: postId, type: postType } = select3(import_editor5.store).getCurrentPost(); |
| 10303 | - const templateId = unlock2(select3(import_core_data4.store)).getTemplateId( | |
| 1477 | + const templateId = unlock(select3(import_core_data4.store)).getTemplateId( | |
| 10304 | 1478 | postType, |
| 10305 | 1479 | postId |
| 10306 | 1480 | ); |
| 10307 | 1481 | if (!templateId) { |
| @@ -10326,9 +1500,9 @@ | ||
| 10326 | 1500 | // packages/edit-post/build-module/components/keyboard-shortcuts/index.mjs |
| 10327 | 1501 | function KeyboardShortcuts() { |
| 10328 | 1502 | const { toggleFullscreenMode: toggleFullscreenMode2 } = (0, import_data7.useDispatch)(store); |
| 10329 | 1503 | const { registerShortcut } = (0, import_data7.useDispatch)(import_keyboard_shortcuts.store); |
| 10330 | - (0, import_element19.useEffect)(() => { | |
| 1504 | + (0, import_element3.useEffect)(() => { | |
| 10331 | 1505 | registerShortcut({ |
| 10332 | 1506 | name: "core/edit-post/toggle-fullscreen", |
| 10333 | 1507 | category: "global", |
| 10334 | 1508 | description: (0, import_i18n3.__)("Enable or disable fullscreen mode."), |
| @@ -10348,21 +1522,24 @@ | ||
| 10348 | 1522 | // packages/edit-post/build-module/components/init-pattern-modal/index.mjs |
| 10349 | 1523 | var import_data8 = __toESM(require_data(), 1); |
| 10350 | 1524 | var import_i18n4 = __toESM(require_i18n(), 1); |
| 10351 | 1525 | var import_components3 = __toESM(require_components(), 1); |
| 10352 | - var import_element20 = __toESM(require_element(), 1); | |
| 1526 | + var import_element4 = __toESM(require_element(), 1); | |
| 10353 | 1527 | var import_editor6 = __toESM(require_editor(), 1); |
| 10354 | - var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); | |
| 1528 | + var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); | |
| 10355 | 1529 | function InitPatternModal() { |
| 10356 | 1530 | const { editPost } = (0, import_data8.useDispatch)(import_editor6.store); |
| 10357 | - const { isCleanNewPost } = (0, import_data8.useSelect)(import_editor6.store); | |
| 10358 | - const [syncType, setSyncType] = (0, import_element20.useState)(void 0); | |
| 10359 | - const [title, setTitle] = (0, import_element20.useState)(""); | |
| 10360 | - const [isModalOpen, setIsModalOpen] = (0, import_element20.useState)(() => isCleanNewPost()); | |
| 10361 | - if (!isModalOpen) { | |
| 1531 | + const [syncType, setSyncType] = (0, import_element4.useState)(void 0); | |
| 1532 | + const [title, setTitle] = (0, import_element4.useState)(""); | |
| 1533 | + const isNewPost = (0, import_data8.useSelect)( | |
| 1534 | + (select3) => select3(import_editor6.store).isCleanNewPost(), | |
| 1535 | + [] | |
| 1536 | + ); | |
| 1537 | + const [isModalOpen, setIsModalOpen] = (0, import_element4.useState)(() => isNewPost); | |
| 1538 | + if (!isNewPost) { | |
| 10362 | 1539 | return null; |
| 10363 | 1540 | } |
| 10364 | - return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( | |
| 1541 | + return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 10365 | 1542 | import_components3.Modal, |
| 10366 | 1543 | { |
| 10367 | 1544 | title: (0, import_i18n4.__)("Create pattern"), |
| 10368 | 1545 | onRequestClose: () => { |
| @@ -10367,10 +1544,10 @@ | ||
| 10367 | 1544 | title: (0, import_i18n4.__)("Create pattern"), |
| 10368 | 1545 | onRequestClose: () => { |
| 10369 | 1546 | setIsModalOpen(false); |
| 10370 | 1547 | }, |
| 10371 | - overlayClassName: "patterns-create-modal", | |
| 10372 | - children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( | |
| 1548 | + overlayClassName: "reusable-blocks-menu-items__convert-modal", | |
| 1549 | + children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 10373 | 1550 | "form", |
| 10374 | 1551 | { |
| 10375 | 1552 | onSubmit: (event) => { |
| 10376 | 1553 | event.preventDefault(); |
| @@ -10381,10 +1558,10 @@ | ||
| 10381 | 1558 | wp_pattern_sync_status: syncType |
| 10382 | 1559 | } |
| 10383 | 1560 | }); |
| 10384 | 1561 | }, |
| 10385 | - children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Stack, { direction: "column", gap: "lg", children: [ | |
| 10386 | - /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( | |
| 1562 | + children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_components3.__experimentalVStack, { spacing: "5", children: [ | |
| 1563 | + /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 10387 | 1564 | import_components3.TextControl, |
| 10388 | 1565 | { |
| 10389 | 1566 | label: (0, import_i18n4.__)("Name"), |
| 10390 | 1567 | value: title, |
| @@ -10389,12 +1566,13 @@ | ||
| 10389 | 1566 | label: (0, import_i18n4.__)("Name"), |
| 10390 | 1567 | value: title, |
| 10391 | 1568 | onChange: setTitle, |
| 10392 | 1569 | placeholder: (0, import_i18n4.__)("My pattern"), |
| 10393 | - className: "patterns-create-modal__name-input" | |
| 1570 | + className: "patterns-create-modal__name-input", | |
| 1571 | + __next40pxDefaultSize: true | |
| 10394 | 1572 | } |
| 10395 | 1573 | ), |
| 10396 | - /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( | |
| 1574 | + /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 10397 | 1575 | import_components3.ToggleControl, |
| 10398 | 1576 | { |
| 10399 | 1577 | label: (0, import_i18n4._x)("Synced", "pattern (singular)"), |
| 10400 | 1578 | help: (0, import_i18n4.__)( |
| @@ -10401,13 +1579,15 @@ | ||
| 10401 | 1579 | "Sync this pattern across multiple locations." |
| 10402 | 1580 | ), |
| 10403 | 1581 | checked: !syncType, |
| 10404 | 1582 | onChange: () => { |
| 10405 | - setSyncType(!syncType ? "unsynced" : void 0); | |
| 1583 | + setSyncType( | |
| 1584 | + !syncType ? "unsynced" : void 0 | |
| 1585 | + ); | |
| 10406 | 1586 | } |
| 10407 | 1587 | } |
| 10408 | 1588 | ), |
| 10409 | - /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Stack, { justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( | |
| 1589 | + /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components3.__experimentalHStack, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( | |
| 10410 | 1590 | import_components3.Button, |
| 10411 | 1591 | { |
| 10412 | 1592 | __next40pxDefaultSize: true, |
| 10413 | 1593 | variant: "primary", |
| @@ -10420,13 +1600,13 @@ | ||
| 10420 | 1600 | ] }) |
| 10421 | 1601 | } |
| 10422 | 1602 | ) |
| 10423 | 1603 | } |
| 10424 | - ); | |
| 1604 | + ) }); | |
| 10425 | 1605 | } |
| 10426 | 1606 | |
| 10427 | 1607 | // packages/edit-post/build-module/components/browser-url/index.mjs |
| 10428 | - var import_element21 = __toESM(require_element(), 1); | |
| 1608 | + var import_element5 = __toESM(require_element(), 1); | |
| 10429 | 1609 | var import_data9 = __toESM(require_data(), 1); |
| 10430 | 1610 | var import_url2 = __toESM(require_url(), 1); |
| 10431 | 1611 | var import_editor7 = __toESM(require_editor(), 1); |
| 10432 | 1612 | function getPostEditURL(postId) { |
| @@ -10432,9 +1612,9 @@ | ||
| 10432 | 1612 | function getPostEditURL(postId) { |
| 10433 | 1613 | return (0, import_url2.addQueryArgs)("post.php", { post: postId, action: "edit" }); |
| 10434 | 1614 | } |
| 10435 | 1615 | function BrowserURL() { |
| 10436 | - const [historyId, setHistoryId] = (0, import_element21.useState)(null); | |
| 1616 | + const [historyId, setHistoryId] = (0, import_element5.useState)(null); | |
| 10437 | 1617 | const { postId, postStatus } = (0, import_data9.useSelect)((select3) => { |
| 10438 | 1618 | const { getCurrentPost } = select3(import_editor7.store); |
| 10439 | 1619 | const post = getCurrentPost(); |
| 10440 | 1620 | let { id, status, type } = post; |
| @@ -10448,9 +1628,9 @@ | ||
| 10448 | 1628 | postId: id, |
| 10449 | 1629 | postStatus: status |
| 10450 | 1630 | }; |
| 10451 | 1631 | }, []); |
| 10452 | - (0, import_element21.useEffect)(() => { | |
| 1632 | + (0, import_element5.useEffect)(() => { | |
| 10453 | 1633 | if (postId && postId !== historyId && postStatus !== "auto-draft") { |
| 10454 | 1634 | window.history.replaceState( |
| 10455 | 1635 | { id: postId }, |
| 10456 | 1636 | "Post " + postId, |
| @@ -10465,16 +1645,16 @@ | ||
| 10465 | 1645 | // packages/edit-post/build-module/components/meta-boxes/index.mjs |
| 10466 | 1646 | var import_data12 = __toESM(require_data(), 1); |
| 10467 | 1647 | |
| 10468 | 1648 | // packages/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.mjs |
| 10469 | - var import_element22 = __toESM(require_element(), 1); | |
| 1649 | + var import_element6 = __toESM(require_element(), 1); | |
| 10470 | 1650 | var import_components4 = __toESM(require_components(), 1); |
| 10471 | 1651 | var import_data10 = __toESM(require_data(), 1); |
| 10472 | - var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); | |
| 1652 | + var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); | |
| 10473 | 1653 | function MetaBoxesArea({ location }) { |
| 10474 | - const container = (0, import_element22.useRef)(null); | |
| 10475 | - const formRef = (0, import_element22.useRef)(null); | |
| 10476 | - (0, import_element22.useEffect)(() => { | |
| 1654 | + const container = (0, import_element6.useRef)(null); | |
| 1655 | + const formRef = (0, import_element6.useRef)(null); | |
| 1656 | + (0, import_element6.useEffect)(() => { | |
| 10477 | 1657 | formRef.current = document.querySelector( |
| 10478 | 1658 | ".metabox-location-" + location |
| 10479 | 1659 | ); |
| 10480 | 1660 | if (formRef.current) { |
| @@ -10491,11 +1671,11 @@ | ||
| 10491 | 1671 | }, []); |
| 10492 | 1672 | const classes = clsx_default("edit-post-meta-boxes-area", `is-${location}`, { |
| 10493 | 1673 | "is-loading": isSaving |
| 10494 | 1674 | }); |
| 10495 | - return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: classes, children: [ | |
| 10496 | - isSaving && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components4.Spinner, { className: "edit-post-meta-boxes-area__spinner" }), | |
| 10497 | - /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( | |
| 1675 | + return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: classes, children: [ | |
| 1676 | + isSaving && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_components4.Spinner, {}), | |
| 1677 | + /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( | |
| 10498 | 1678 | "div", |
| 10499 | 1679 | { |
| 10500 | 1680 | className: "edit-post-meta-boxes-area__container", |
| 10501 | 1681 | ref: container |
| @@ -10500,15 +1680,15 @@ | ||
| 10500 | 1680 | className: "edit-post-meta-boxes-area__container", |
| 10501 | 1681 | ref: container |
| 10502 | 1682 | } |
| 10503 | 1683 | ), |
| 10504 | - /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "edit-post-meta-boxes-area__clear" }) | |
| 1684 | + /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "edit-post-meta-boxes-area__clear" }) | |
| 10505 | 1685 | ] }); |
| 10506 | 1686 | } |
| 10507 | 1687 | var meta_boxes_area_default = MetaBoxesArea; |
| 10508 | 1688 | |
| 10509 | 1689 | // packages/edit-post/build-module/components/meta-boxes/meta-box-visibility.mjs |
| 10510 | - var import_element23 = __toESM(require_element(), 1); | |
| 1690 | + var import_element7 = __toESM(require_element(), 1); | |
| 10511 | 1691 | var import_data11 = __toESM(require_data(), 1); |
| 10512 | 1692 | var import_editor8 = __toESM(require_editor(), 1); |
| 10513 | 1693 | function MetaBoxVisibility({ id }) { |
| 10514 | 1694 | const isVisible = (0, import_data11.useSelect)( |
| @@ -10518,9 +1698,9 @@ | ||
| 10518 | 1698 | ); |
| 10519 | 1699 | }, |
| 10520 | 1700 | [id] |
| 10521 | 1701 | ); |
| 10522 | - (0, import_element23.useEffect)(() => { | |
| 1702 | + (0, import_element7.useEffect)(() => { | |
| 10523 | 1703 | const element = document.getElementById(id); |
| 10524 | 1704 | if (!element) { |
| 10525 | 1705 | return; |
| 10526 | 1706 | } |
| @@ -10533,23 +1713,23 @@ | ||
| 10533 | 1713 | return null; |
| 10534 | 1714 | } |
| 10535 | 1715 | |
| 10536 | 1716 | // packages/edit-post/build-module/components/meta-boxes/index.mjs |
| 10537 | - var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); | |
| 1717 | + var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); | |
| 10538 | 1718 | function MetaBoxes({ location }) { |
| 10539 | 1719 | const metaBoxes2 = (0, import_data12.useSelect)( |
| 10540 | 1720 | (select3) => select3(store).getMetaBoxesPerLocation(location), |
| 10541 | 1721 | [location] |
| 10542 | 1722 | ); |
| 10543 | - return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [ | |
| 10544 | - (metaBoxes2 ?? []).map(({ id }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MetaBoxVisibility, { id }, id)), | |
| 10545 | - /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(meta_boxes_area_default, { location }) | |
| 1723 | + return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [ | |
| 1724 | + (metaBoxes2 ?? []).map(({ id }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MetaBoxVisibility, { id }, id)), | |
| 1725 | + /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(meta_boxes_area_default, { location }) | |
| 10546 | 1726 | ] }); |
| 10547 | 1727 | } |
| 10548 | 1728 | |
| 10549 | 1729 | // packages/edit-post/build-module/components/more-menu/index.mjs |
| 10550 | 1730 | var import_i18n10 = __toESM(require_i18n(), 1); |
| 10551 | - var import_compose = __toESM(require_compose(), 1); | |
| 1731 | + var import_compose2 = __toESM(require_compose(), 1); | |
| 10552 | 1732 | var import_editor14 = __toESM(require_editor(), 1); |
| 10553 | 1733 | var import_keycodes = __toESM(require_keycodes(), 1); |
| 10554 | 1734 | var import_preferences8 = __toESM(require_preferences(), 1); |
| 10555 | 1735 | |
| @@ -10558,9 +1738,9 @@ | ||
| 10558 | 1738 | var import_core_data5 = __toESM(require_core_data(), 1); |
| 10559 | 1739 | var import_data13 = __toESM(require_data(), 1); |
| 10560 | 1740 | var import_i18n5 = __toESM(require_i18n(), 1); |
| 10561 | 1741 | var import_url3 = __toESM(require_url(), 1); |
| 10562 | - var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); | |
| 1742 | + var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); | |
| 10563 | 1743 | function ManagePatternsMenuItem() { |
| 10564 | 1744 | const url = (0, import_data13.useSelect)((select3) => { |
| 10565 | 1745 | const { canUser } = select3(import_core_data5.store); |
| 10566 | 1746 | const defaultUrl = (0, import_url3.addQueryArgs)("edit.php", { |
| @@ -10573,9 +1753,9 @@ | ||
| 10573 | 1753 | kind: "postType", |
| 10574 | 1754 | name: "wp_template" |
| 10575 | 1755 | }) ? patternsUrl : defaultUrl; |
| 10576 | 1756 | }, []); |
| 10577 | - return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components5.MenuItem, { role: "menuitem", href: url, children: (0, import_i18n5.__)("Manage patterns") }); | |
| 1757 | + return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_components5.MenuItem, { role: "menuitem", href: url, children: (0, import_i18n5.__)("Manage patterns") }); | |
| 10578 | 1758 | } |
| 10579 | 1759 | var manage_patterns_menu_item_default = ManagePatternsMenuItem; |
| 10580 | 1760 | |
| 10581 | 1761 | // packages/edit-post/build-module/components/more-menu/welcome-guide-menu-item.mjs |
| @@ -10582,15 +1762,15 @@ | ||
| 10582 | 1762 | var import_data14 = __toESM(require_data(), 1); |
| 10583 | 1763 | var import_preferences3 = __toESM(require_preferences(), 1); |
| 10584 | 1764 | var import_i18n6 = __toESM(require_i18n(), 1); |
| 10585 | 1765 | var import_editor9 = __toESM(require_editor(), 1); |
| 10586 | - var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); | |
| 1766 | + var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); | |
| 10587 | 1767 | function WelcomeGuideMenuItem() { |
| 10588 | 1768 | const isEditingTemplate2 = (0, import_data14.useSelect)( |
| 10589 | 1769 | (select3) => select3(import_editor9.store).getCurrentPostType() === "wp_template", |
| 10590 | 1770 | [] |
| 10591 | 1771 | ); |
| 10592 | - return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( | |
| 1772 | + return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( | |
| 10593 | 1773 | import_preferences3.PreferenceToggleMenuItem, |
| 10594 | 1774 | { |
| 10595 | 1775 | scope: "core/edit-post", |
| 10596 | 1776 | name: isEditingTemplate2 ? "welcomeGuideTemplate" : "welcomeGuide", |
| @@ -10610,9 +1790,9 @@ | ||
| 10610 | 1790 | var import_editor12 = __toESM(require_editor(), 1); |
| 10611 | 1791 | var import_preferences6 = __toESM(require_preferences(), 1); |
| 10612 | 1792 | |
| 10613 | 1793 | // packages/edit-post/build-module/components/preferences-modal/enable-custom-fields.mjs |
| 10614 | - var import_element24 = __toESM(require_element(), 1); | |
| 1794 | + var import_element8 = __toESM(require_element(), 1); | |
| 10615 | 1795 | var import_i18n7 = __toESM(require_i18n(), 1); |
| 10616 | 1796 | var import_components6 = __toESM(require_components(), 1); |
| 10617 | 1797 | var import_data15 = __toESM(require_data(), 1); |
| 10618 | 1798 | var import_editor10 = __toESM(require_editor(), 1); |
| @@ -10617,10 +1797,10 @@ | ||
| 10617 | 1797 | var import_data15 = __toESM(require_data(), 1); |
| 10618 | 1798 | var import_editor10 = __toESM(require_editor(), 1); |
| 10619 | 1799 | var import_preferences4 = __toESM(require_preferences(), 1); |
| 10620 | 1800 | var import_url4 = __toESM(require_url(), 1); |
| 10621 | - var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); | |
| 10622 | - var { PreferenceBaseOption } = unlock2(import_preferences4.privateApis); | |
| 1801 | + var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); | |
| 1802 | + var { PreferenceBaseOption } = unlock(import_preferences4.privateApis); | |
| 10623 | 1803 | function submitCustomFieldsForm() { |
| 10624 | 1804 | const customFieldsForm = document.getElementById( |
| 10625 | 1805 | "toggle-custom-fields-form" |
| 10626 | 1806 | ); |
| @@ -10627,14 +1807,14 @@ | ||
| 10627 | 1807 | customFieldsForm.querySelector('[name="_wp_http_referer"]').setAttribute("value", (0, import_url4.getPathAndQueryString)(window.location.href)); |
| 10628 | 1808 | customFieldsForm.submit(); |
| 10629 | 1809 | } |
| 10630 | 1810 | function CustomFieldsConfirmation({ willEnable }) { |
| 10631 | - const [isReloading, setIsReloading] = (0, import_element24.useState)(false); | |
| 10632 | - return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [ | |
| 10633 | - /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "edit-post-preferences-modal__custom-fields-confirmation-message", children: (0, import_i18n7.__)( | |
| 1811 | + const [isReloading, setIsReloading] = (0, import_element8.useState)(false); | |
| 1812 | + return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [ | |
| 1813 | + /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "edit-post-preferences-modal__custom-fields-confirmation-message", children: (0, import_i18n7.__)( | |
| 10634 | 1814 | "A page reload is required for this change. Make sure your content is saved before reloading." |
| 10635 | 1815 | ) }), |
| 10636 | - /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( | |
| 1816 | + /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( | |
| 10637 | 1817 | import_components6.Button, |
| 10638 | 1818 | { |
| 10639 | 1819 | __next40pxDefaultSize: true, |
| 10640 | 1820 | variant: "secondary", |
| @@ -10653,16 +1833,16 @@ | ||
| 10653 | 1833 | function EnableCustomFieldsOption({ label }) { |
| 10654 | 1834 | const areCustomFieldsEnabled = (0, import_data15.useSelect)((select3) => { |
| 10655 | 1835 | return !!select3(import_editor10.store).getEditorSettings().enableCustomFields; |
| 10656 | 1836 | }, []); |
| 10657 | - const [isChecked, setIsChecked] = (0, import_element24.useState)(areCustomFieldsEnabled); | |
| 10658 | - return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( | |
| 1837 | + const [isChecked, setIsChecked] = (0, import_element8.useState)(areCustomFieldsEnabled); | |
| 1838 | + return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( | |
| 10659 | 1839 | PreferenceBaseOption, |
| 10660 | 1840 | { |
| 10661 | 1841 | label, |
| 10662 | 1842 | isChecked, |
| 10663 | 1843 | onChange: setIsChecked, |
| 10664 | - children: isChecked !== areCustomFieldsEnabled && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CustomFieldsConfirmation, { willEnable: isChecked }) | |
| 1844 | + children: isChecked !== areCustomFieldsEnabled && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CustomFieldsConfirmation, { willEnable: isChecked }) | |
| 10665 | 1845 | } |
| 10666 | 1846 | ); |
| 10667 | 1847 | } |
| 10668 | 1848 | |
| @@ -10669,10 +1849,10 @@ | ||
| 10669 | 1849 | // packages/edit-post/build-module/components/preferences-modal/enable-panel.mjs |
| 10670 | 1850 | var import_data16 = __toESM(require_data(), 1); |
| 10671 | 1851 | var import_editor11 = __toESM(require_editor(), 1); |
| 10672 | 1852 | var import_preferences5 = __toESM(require_preferences(), 1); |
| 10673 | - var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); | |
| 10674 | - var { PreferenceBaseOption: PreferenceBaseOption2 } = unlock2(import_preferences5.privateApis); | |
| 1853 | + var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); | |
| 1854 | + var { PreferenceBaseOption: PreferenceBaseOption2 } = unlock(import_preferences5.privateApis); | |
| 10675 | 1855 | function EnablePanelOption(props) { |
| 10676 | 1856 | const { toggleEditorPanelEnabled: toggleEditorPanelEnabled2 } = (0, import_data16.useDispatch)(import_editor11.store); |
| 10677 | 1857 | const { isChecked, isRemoved } = (0, import_data16.useSelect)( |
| 10678 | 1858 | (select3) => { |
| @@ -10686,9 +1866,9 @@ | ||
| 10686 | 1866 | ); |
| 10687 | 1867 | if (isRemoved) { |
| 10688 | 1868 | return null; |
| 10689 | 1869 | } |
| 10690 | - return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( | |
| 1870 | + return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)( | |
| 10691 | 1871 | PreferenceBaseOption2, |
| 10692 | 1872 | { |
| 10693 | 1873 | isChecked, |
| 10694 | 1874 | onChange: () => toggleEditorPanelEnabled2(props.panelName), |
| @@ -10697,19 +1877,15 @@ | ||
| 10697 | 1877 | ); |
| 10698 | 1878 | } |
| 10699 | 1879 | |
| 10700 | 1880 | // packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.mjs |
| 10701 | - var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); | |
| 10702 | - var { PreferencesModalSection } = unlock2(import_preferences6.privateApis); | |
| 10703 | - function MetaBoxesSection(sectionProps) { | |
| 10704 | - const { areCustomFieldsRegistered, metaBoxes: metaBoxes2 } = (0, import_data17.useSelect)((select3) => { | |
| 10705 | - const { getEditorSettings } = select3(import_editor12.store); | |
| 10706 | - const { getAllMetaBoxes: getAllMetaBoxes2 } = select3(store); | |
| 10707 | - return { | |
| 10708 | - areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== void 0, | |
| 10709 | - metaBoxes: getAllMetaBoxes2() | |
| 10710 | - }; | |
| 10711 | - }, []); | |
| 1881 | + var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); | |
| 1882 | + var { PreferencesModalSection } = unlock(import_preferences6.privateApis); | |
| 1883 | + function MetaBoxesSection({ | |
| 1884 | + areCustomFieldsRegistered, | |
| 1885 | + metaBoxes: metaBoxes2, | |
| 1886 | + ...sectionProps | |
| 1887 | + }) { | |
| 10712 | 1888 | const thirdPartyMetaBoxes = metaBoxes2.filter( |
| 10713 | 1889 | ({ id }) => id !== "postcustom" |
| 10714 | 1890 | ); |
| 10715 | 1891 | if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) { |
| @@ -10714,11 +1890,11 @@ | ||
| 10714 | 1890 | ); |
| 10715 | 1891 | if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) { |
| 10716 | 1892 | return null; |
| 10717 | 1893 | } |
| 10718 | - return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(PreferencesModalSection, { ...sectionProps, children: [ | |
| 10719 | - areCustomFieldsRegistered && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EnableCustomFieldsOption, { label: (0, import_i18n8.__)("Custom fields") }), | |
| 10720 | - thirdPartyMetaBoxes.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( | |
| 1894 | + return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(PreferencesModalSection, { ...sectionProps, children: [ | |
| 1895 | + areCustomFieldsRegistered && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EnableCustomFieldsOption, { label: (0, import_i18n8.__)("Custom fields") }), | |
| 1896 | + thirdPartyMetaBoxes.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 10721 | 1897 | EnablePanelOption, |
| 10722 | 1898 | { |
| 10723 | 1899 | label: title, |
| 10724 | 1900 | panelName: `meta-box-${id}` |
| @@ -10726,17 +1902,26 @@ | ||
| 10726 | 1902 | id |
| 10727 | 1903 | )) |
| 10728 | 1904 | ] }); |
| 10729 | 1905 | } |
| 1906 | + var meta_boxes_section_default = (0, import_data17.withSelect)((select3) => { | |
| 1907 | + const { getEditorSettings } = select3(import_editor12.store); | |
| 1908 | + const { getAllMetaBoxes: getAllMetaBoxes2 } = select3(store); | |
| 1909 | + return { | |
| 1910 | + // This setting should not live in the block editor's store. | |
| 1911 | + areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== void 0, | |
| 1912 | + metaBoxes: getAllMetaBoxes2() | |
| 1913 | + }; | |
| 1914 | + })(MetaBoxesSection); | |
| 10730 | 1915 | |
| 10731 | 1916 | // packages/edit-post/build-module/components/preferences-modal/index.mjs |
| 10732 | - var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); | |
| 10733 | - var { PreferenceToggleControl } = unlock2(import_preferences7.privateApis); | |
| 10734 | - var { PreferencesModal } = unlock2(import_editor13.privateApis); | |
| 1917 | + var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); | |
| 1918 | + var { PreferenceToggleControl } = unlock(import_preferences7.privateApis); | |
| 1919 | + var { PreferencesModal } = unlock(import_editor13.privateApis); | |
| 10735 | 1920 | function EditPostPreferencesModal() { |
| 10736 | 1921 | const extraSections = { |
| 10737 | - general: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MetaBoxesSection, { title: (0, import_i18n9.__)("Advanced") }), | |
| 10738 | - appearance: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( | |
| 1922 | + general: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(meta_boxes_section_default, { title: (0, import_i18n9.__)("Advanced") }), | |
| 1923 | + appearance: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( | |
| 10739 | 1924 | PreferenceToggleControl, |
| 10740 | 1925 | { |
| 10741 | 1926 | scope: "core/edit-post", |
| 10742 | 1927 | featureName: "themeStyles", |
| @@ -10744,18 +1929,18 @@ | ||
| 10744 | 1929 | label: (0, import_i18n9.__)("Use theme styles") |
| 10745 | 1930 | } |
| 10746 | 1931 | ) |
| 10747 | 1932 | }; |
| 10748 | - return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PreferencesModal, { extraSections }); | |
| 1933 | + return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreferencesModal, { extraSections }); | |
| 10749 | 1934 | } |
| 10750 | 1935 | |
| 10751 | 1936 | // packages/edit-post/build-module/components/more-menu/index.mjs |
| 10752 | - var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); | |
| 10753 | - var { ToolsMoreMenuGroup, ViewMoreMenuGroup } = unlock2(import_editor14.privateApis); | |
| 1937 | + var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); | |
| 1938 | + var { ToolsMoreMenuGroup, ViewMoreMenuGroup } = unlock(import_editor14.privateApis); | |
| 10754 | 1939 | var MoreMenu = () => { |
| 10755 | - const isLargeViewport = (0, import_compose.useViewportMatch)("large"); | |
| 10756 | - return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [ | |
| 10757 | - isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ViewMoreMenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( | |
| 1940 | + const isLargeViewport = (0, import_compose2.useViewportMatch)("large"); | |
| 1941 | + return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [ | |
| 1942 | + isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ViewMoreMenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( | |
| 10758 | 1943 | import_preferences8.PreferenceToggleMenuItem, |
| 10759 | 1944 | { |
| 10760 | 1945 | scope: "core/edit-post", |
| 10761 | 1946 | name: "fullscreenMode", |
| @@ -10767,13 +1952,13 @@ | ||
| 10767 | 1952 | ), |
| 10768 | 1953 | shortcut: import_keycodes.displayShortcut.secondary("f") |
| 10769 | 1954 | } |
| 10770 | 1955 | ) }), |
| 10771 | - /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(ToolsMoreMenuGroup, { children: [ | |
| 10772 | - /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(manage_patterns_menu_item_default, {}), | |
| 10773 | - /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(WelcomeGuideMenuItem, {}) | |
| 1956 | + /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ToolsMoreMenuGroup, { children: [ | |
| 1957 | + /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(manage_patterns_menu_item_default, {}), | |
| 1958 | + /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(WelcomeGuideMenuItem, {}) | |
| 10774 | 1959 | ] }), |
| 10775 | - /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EditPostPreferencesModal, {}) | |
| 1960 | + /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EditPostPreferencesModal, {}) | |
| 10776 | 1961 | ] }); |
| 10777 | 1962 | }; |
| 10778 | 1963 | var more_menu_default = MoreMenu; |
| 10779 | 1964 | |
| @@ -10783,15 +1968,15 @@ | ||
| 10783 | 1968 | // packages/edit-post/build-module/components/welcome-guide/default.mjs |
| 10784 | 1969 | var import_data18 = __toESM(require_data(), 1); |
| 10785 | 1970 | var import_components7 = __toESM(require_components(), 1); |
| 10786 | 1971 | var import_i18n11 = __toESM(require_i18n(), 1); |
| 10787 | - var import_element25 = __toESM(require_element(), 1); | |
| 1972 | + var import_element9 = __toESM(require_element(), 1); | |
| 10788 | 1973 | |
| 10789 | 1974 | // packages/edit-post/build-module/components/welcome-guide/image.mjs |
| 10790 | - var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); | |
| 1975 | + var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); | |
| 10791 | 1976 | function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { |
| 10792 | - return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("picture", { className: "edit-post-welcome-guide__image", children: [ | |
| 10793 | - /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( | |
| 1977 | + return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("picture", { className: "edit-post-welcome-guide__image", children: [ | |
| 1978 | + /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( | |
| 10794 | 1979 | "source", |
| 10795 | 1980 | { |
| 10796 | 1981 | srcSet: nonAnimatedSrc, |
| 10797 | 1982 | media: "(prefers-reduced-motion: reduce)" |
| @@ -10796,17 +1981,17 @@ | ||
| 10796 | 1981 | srcSet: nonAnimatedSrc, |
| 10797 | 1982 | media: "(prefers-reduced-motion: reduce)" |
| 10798 | 1983 | } |
| 10799 | 1984 | ), |
| 10800 | - /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" }) | |
| 1985 | + /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" }) | |
| 10801 | 1986 | ] }); |
| 10802 | 1987 | } |
| 10803 | 1988 | |
| 10804 | 1989 | // packages/edit-post/build-module/components/welcome-guide/default.mjs |
| 10805 | - var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); | |
| 1990 | + var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); | |
| 10806 | 1991 | function WelcomeGuideDefault() { |
| 10807 | 1992 | const { toggleFeature: toggleFeature2 } = (0, import_data18.useDispatch)(store); |
| 10808 | - return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 1993 | + return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 10809 | 1994 | import_components7.Guide, |
| 10810 | 1995 | { |
| 10811 | 1996 | className: "edit-post-welcome-guide", |
| 10812 | 1997 | contentLabel: (0, import_i18n11.__)("Welcome to the editor"), |
| @@ -10813,9 +1998,9 @@ | ||
| 10813 | 1998 | finishButtonText: (0, import_i18n11.__)("Get started"), |
| 10814 | 1999 | onFinish: () => toggleFeature2("welcomeGuide"), |
| 10815 | 2000 | pages: [ |
| 10816 | 2001 | { |
| 10817 | - image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 2002 | + image: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 10818 | 2003 | WelcomeGuideImage, |
| 10819 | 2004 | { |
| 10820 | 2005 | nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", |
| 10821 | 2006 | animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" |
| @@ -10820,17 +2005,17 @@ | ||
| 10820 | 2005 | nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", |
| 10821 | 2006 | animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" |
| 10822 | 2007 | } |
| 10823 | 2008 | ), |
| 10824 | - content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [ | |
| 10825 | - /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Welcome to the editor") }), | |
| 10826 | - /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n11.__)( | |
| 2009 | + content: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [ | |
| 2010 | + /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Welcome to the editor") }), | |
| 2011 | + /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n11.__)( | |
| 10827 | 2012 | "In the WordPress editor, each paragraph, image, or video is presented as a distinct \u201Cblock\u201D of content." |
| 10828 | 2013 | ) }) |
| 10829 | 2014 | ] }) |
| 10830 | 2015 | }, |
| 10831 | 2016 | { |
| 10832 | - image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 2017 | + image: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 10833 | 2018 | WelcomeGuideImage, |
| 10834 | 2019 | { |
| 10835 | 2020 | nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", |
| 10836 | 2021 | animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" |
| @@ -10835,17 +2020,17 @@ | ||
| 10835 | 2020 | nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", |
| 10836 | 2021 | animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" |
| 10837 | 2022 | } |
| 10838 | 2023 | ), |
| 10839 | - content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [ | |
| 10840 | - /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Customize each block") }), | |
| 10841 | - /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n11.__)( | |
| 2024 | + content: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [ | |
| 2025 | + /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Customize each block") }), | |
| 2026 | + /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n11.__)( | |
| 10842 | 2027 | "Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected." |
| 10843 | 2028 | ) }) |
| 10844 | 2029 | ] }) |
| 10845 | 2030 | }, |
| 10846 | 2031 | { |
| 10847 | - image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 2032 | + image: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 10848 | 2033 | WelcomeGuideImage, |
| 10849 | 2034 | { |
| 10850 | 2035 | nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", |
| 10851 | 2036 | animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" |
| @@ -10850,16 +2035,16 @@ | ||
| 10850 | 2035 | nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", |
| 10851 | 2036 | animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" |
| 10852 | 2037 | } |
| 10853 | 2038 | ), |
| 10854 | - content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [ | |
| 10855 | - /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Explore all blocks") }), | |
| 10856 | - /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element25.createInterpolateElement)( | |
| 2039 | + content: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [ | |
| 2040 | + /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Explore all blocks") }), | |
| 2041 | + /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element9.createInterpolateElement)( | |
| 10857 | 2042 | (0, import_i18n11.__)( |
| 10858 | 2043 | "All of the blocks available to you live in the block library. You\u2019ll find it wherever you see the <InserterIconImage /> icon." |
| 10859 | 2044 | ), |
| 10860 | 2045 | { |
| 10861 | - InserterIconImage: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 2046 | + InserterIconImage: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 10862 | 2047 | "img", |
| 10863 | 2048 | { |
| 10864 | 2049 | alt: (0, import_i18n11.__)("inserter"), |
| 10865 | 2050 | src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A" |
| @@ -10869,9 +2054,9 @@ | ||
| 10869 | 2054 | ) }) |
| 10870 | 2055 | ] }) |
| 10871 | 2056 | }, |
| 10872 | 2057 | { |
| 10873 | - image: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 2058 | + image: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 10874 | 2059 | WelcomeGuideImage, |
| 10875 | 2060 | { |
| 10876 | 2061 | nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", |
| 10877 | 2062 | animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" |
| @@ -10876,16 +2061,16 @@ | ||
| 10876 | 2061 | nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", |
| 10877 | 2062 | animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" |
| 10878 | 2063 | } |
| 10879 | 2064 | ), |
| 10880 | - content: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [ | |
| 10881 | - /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Learn more") }), | |
| 10882 | - /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element25.createInterpolateElement)( | |
| 2065 | + content: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [ | |
| 2066 | + /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n11.__)("Learn more") }), | |
| 2067 | + /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_element9.createInterpolateElement)( | |
| 10883 | 2068 | (0, import_i18n11.__)( |
| 10884 | 2069 | "New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>" |
| 10885 | 2070 | ), |
| 10886 | 2071 | { |
| 10887 | - a: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 2072 | + a: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 10888 | 2073 | import_components7.ExternalLink, |
| 10889 | 2074 | { |
| 10890 | 2075 | href: (0, import_i18n11.__)( |
| 10891 | 2076 | "https://wordpress.org/documentation/article/wordpress-block-editor/" |
| @@ -10904,12 +2089,12 @@ | ||
| 10904 | 2089 | // packages/edit-post/build-module/components/welcome-guide/template.mjs |
| 10905 | 2090 | var import_data19 = __toESM(require_data(), 1); |
| 10906 | 2091 | var import_components8 = __toESM(require_components(), 1); |
| 10907 | 2092 | var import_i18n12 = __toESM(require_i18n(), 1); |
| 10908 | - var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); | |
| 2093 | + var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); | |
| 10909 | 2094 | function WelcomeGuideTemplate() { |
| 10910 | 2095 | const { toggleFeature: toggleFeature2 } = (0, import_data19.useDispatch)(store); |
| 10911 | - return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( | |
| 2096 | + return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( | |
| 10912 | 2097 | import_components8.Guide, |
| 10913 | 2098 | { |
| 10914 | 2099 | className: "edit-template-welcome-guide", |
| 10915 | 2100 | contentLabel: (0, import_i18n12.__)("Welcome to the template editor"), |
| @@ -10916,9 +2101,9 @@ | ||
| 10916 | 2101 | finishButtonText: (0, import_i18n12.__)("Get started"), |
| 10917 | 2102 | onFinish: () => toggleFeature2("welcomeGuideTemplate"), |
| 10918 | 2103 | pages: [ |
| 10919 | 2104 | { |
| 10920 | - image: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( | |
| 2105 | + image: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( | |
| 10921 | 2106 | WelcomeGuideImage, |
| 10922 | 2107 | { |
| 10923 | 2108 | nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg", |
| 10924 | 2109 | animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif" |
| @@ -10923,11 +2108,11 @@ | ||
| 10923 | 2108 | nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg", |
| 10924 | 2109 | animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif" |
| 10925 | 2110 | } |
| 10926 | 2111 | ), |
| 10927 | - content: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [ | |
| 10928 | - /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n12.__)("Welcome to the template editor") }), | |
| 10929 | - /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n12.__)( | |
| 2112 | + content: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [ | |
| 2113 | + /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h1", { className: "edit-post-welcome-guide__heading", children: (0, import_i18n12.__)("Welcome to the template editor") }), | |
| 2114 | + /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "edit-post-welcome-guide__text", children: (0, import_i18n12.__)( | |
| 10930 | 2115 | "Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor." |
| 10931 | 2116 | ) }) |
| 10932 | 2117 | ] }) |
| 10933 | 2118 | } |
| @@ -10936,9 +2121,9 @@ | ||
| 10936 | 2121 | ); |
| 10937 | 2122 | } |
| 10938 | 2123 | |
| 10939 | 2124 | // packages/edit-post/build-module/components/welcome-guide/index.mjs |
| 10940 | - var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); | |
| 2125 | + var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); | |
| 10941 | 2126 | function WelcomeGuide({ postType }) { |
| 10942 | 2127 | const { isActive, isEditingTemplate: isEditingTemplate2 } = (0, import_data20.useSelect)( |
| 10943 | 2128 | (select3) => { |
| 10944 | 2129 | const { isFeatureActive: isFeatureActive2 } = select3(store); |
| @@ -10953,9 +2138,9 @@ | ||
| 10953 | 2138 | ); |
| 10954 | 2139 | if (!isActive) { |
| 10955 | 2140 | return null; |
| 10956 | 2141 | } |
| 10957 | - return isEditingTemplate2 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WelcomeGuideTemplate, {}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(WelcomeGuideDefault, {}); | |
| 2142 | + return isEditingTemplate2 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(WelcomeGuideTemplate, {}) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(WelcomeGuideDefault, {}); | |
| 10958 | 2143 | } |
| 10959 | 2144 | |
| 10960 | 2145 | // packages/edit-post/build-module/commands/use-commands.mjs |
| 10961 | 2146 | var import_data21 = __toESM(require_data(), 1); |
| @@ -10998,16 +2183,44 @@ | ||
| 10998 | 2183 | } |
| 10999 | 2184 | }); |
| 11000 | 2185 | } |
| 11001 | 2186 | |
| 2187 | + // packages/edit-post/build-module/components/layout/use-should-iframe.mjs | |
| 2188 | + var import_editor15 = __toESM(require_editor(), 1); | |
| 2189 | + var import_data22 = __toESM(require_data(), 1); | |
| 2190 | + var import_blocks2 = __toESM(require_blocks(), 1); | |
| 2191 | + var import_block_editor = __toESM(require_block_editor(), 1); | |
| 2192 | + var isGutenbergPlugin = true ? true : false; | |
| 2193 | + function useShouldIframe() { | |
| 2194 | + return (0, import_data22.useSelect)((select3) => { | |
| 2195 | + const { getCurrentPostType, getDeviceType } = select3(import_editor15.store); | |
| 2196 | + const { getClientIdsWithDescendants, getBlockName } = select3(import_block_editor.store); | |
| 2197 | + const { getBlockType } = select3(import_blocks2.store); | |
| 2198 | + return ( | |
| 2199 | + // If the Gutenberg plugin is active, we ALWAYS use the iframe for | |
| 2200 | + // consistency across the post and site editor. We plan on enforcing | |
| 2201 | + // the iframe in the future, so Gutenberg both serves as way for us | |
| 2202 | + // to warn plugin developers and for plugin developers to test their | |
| 2203 | + // blocks easily. Before GB v22.5, we only enforced it for | |
| 2204 | + // block-based themes (classic themes used the same rules as core). | |
| 2205 | + isGutenbergPlugin || // We also still want to iframe all the special | |
| 2206 | + // editor features and modes such as device previews, zoom out, and | |
| 2207 | + // template/pattern editing. | |
| 2208 | + getDeviceType() !== "Desktop" || ["wp_template", "wp_block"].includes(getCurrentPostType()) || unlock(select3(import_block_editor.store)).isZoomOut() || // Finally, still iframe the editor if all present blocks are v3 | |
| 2209 | + // (which means they are marked as iframe-compatible). | |
| 2210 | + [...new Set(getClientIdsWithDescendants().map(getBlockName))].map(getBlockType).filter(Boolean).every((blockType) => blockType.apiVersion >= 3) | |
| 2211 | + ); | |
| 2212 | + }, []); | |
| 2213 | + } | |
| 2214 | + | |
| 11002 | 2215 | // packages/edit-post/build-module/hooks/use-navigate-to-entity-record.mjs |
| 11003 | - var import_element26 = __toESM(require_element(), 1); | |
| 11004 | - var import_data22 = __toESM(require_data(), 1); | |
| 11005 | - var import_editor15 = __toESM(require_editor(), 1); | |
| 2216 | + var import_element10 = __toESM(require_element(), 1); | |
| 2217 | + var import_data23 = __toESM(require_data(), 1); | |
| 2218 | + var import_editor16 = __toESM(require_editor(), 1); | |
| 11006 | 2219 | var import_core_data6 = __toESM(require_core_data(), 1); |
| 11007 | 2220 | function useNavigateToEntityRecord(initialPostId, initialPostType, defaultRenderingMode) { |
| 11008 | - const registry = (0, import_data22.useRegistry)(); | |
| 11009 | - const [postHistory, dispatch2] = (0, import_element26.useReducer)( | |
| 2221 | + const registry = (0, import_data23.useRegistry)(); | |
| 2222 | + const [postHistory, dispatch2] = (0, import_element10.useReducer)( | |
| 11010 | 2223 | (historyState, { type, post: post2, previousRenderingMode: previousRenderingMode2, selectedBlockClientId }) => { |
| 11011 | 2224 | if (type === "push") { |
| 11012 | 2225 | const updatedHistory = [...historyState]; |
| 11013 | 2226 | const currentIndex = updatedHistory.length - 1; |
| @@ -11030,12 +2243,12 @@ | ||
| 11030 | 2243 | } |
| 11031 | 2244 | ] |
| 11032 | 2245 | ); |
| 11033 | 2246 | const { post, previousRenderingMode } = postHistory[postHistory.length - 1]; |
| 11034 | - const { getRenderingMode } = (0, import_data22.useSelect)(import_editor15.store); | |
| 11035 | - const { setRenderingMode } = (0, import_data22.useDispatch)(import_editor15.store); | |
| 11036 | - const { editEntityRecord } = (0, import_data22.useDispatch)(import_core_data6.store); | |
| 11037 | - const onNavigateToEntityRecord = (0, import_element26.useCallback)( | |
| 2247 | + const { getRenderingMode } = (0, import_data23.useSelect)(import_editor16.store); | |
| 2248 | + const { setRenderingMode } = (0, import_data23.useDispatch)(import_editor16.store); | |
| 2249 | + const { editEntityRecord } = (0, import_data23.useDispatch)(import_core_data6.store); | |
| 2250 | + const onNavigateToEntityRecord = (0, import_element10.useCallback)( | |
| 11038 | 2251 | (params) => { |
| 11039 | 2252 | const entityEdits = registry.select(import_core_data6.store).getEntityRecordEdits("postType", post.postType, post.postId); |
| 11040 | 2253 | const externalClientId = entityEdits?.selection?.selectionStart?.clientId ?? null; |
| 11041 | 2254 | dispatch2({ |
| @@ -11055,9 +2268,9 @@ | ||
| 11055 | 2268 | setRenderingMode, |
| 11056 | 2269 | defaultRenderingMode |
| 11057 | 2270 | ] |
| 11058 | 2271 | ); |
| 11059 | - const onNavigateToPreviousEntityRecord = (0, import_element26.useCallback)(() => { | |
| 2272 | + const onNavigateToPreviousEntityRecord = (0, import_element10.useCallback)(() => { | |
| 11060 | 2273 | if (postHistory.length > 1) { |
| 11061 | 2274 | const previousItem = postHistory[postHistory.length - 2]; |
| 11062 | 2275 | if (previousItem.selectedBlockClientId) { |
| 11063 | 2276 | editEntityRecord( |
| @@ -11097,63 +2310,43 @@ | ||
| 11097 | 2310 | }; |
| 11098 | 2311 | } |
| 11099 | 2312 | |
| 11100 | 2313 | // packages/edit-post/build-module/components/meta-boxes/use-meta-box-initialization.mjs |
| 11101 | - var import_data23 = __toESM(require_data(), 1); | |
| 11102 | - var import_editor16 = __toESM(require_editor(), 1); | |
| 2314 | + var import_data24 = __toESM(require_data(), 1); | |
| 2315 | + var import_editor17 = __toESM(require_editor(), 1); | |
| 11103 | 2316 | var import_core_data7 = __toESM(require_core_data(), 1); |
| 11104 | - var import_element27 = __toESM(require_element(), 1); | |
| 2317 | + var import_element11 = __toESM(require_element(), 1); | |
| 11105 | 2318 | var useMetaBoxInitialization = (enabled) => { |
| 11106 | - const { | |
| 11107 | - isEnabledAndEditorReady, | |
| 11108 | - isCollaborationEnabled, | |
| 11109 | - hasIncompatibleMetaBoxes, | |
| 11110 | - hasActiveMetaBoxes | |
| 11111 | - } = (0, import_data23.useSelect)( | |
| 11112 | - (select3) => { | |
| 11113 | - const { | |
| 11114 | - __unstableIsEditorReady, | |
| 11115 | - isCollaborationEnabledForCurrentPost | |
| 11116 | - } = unlock2(select3(import_editor16.store)); | |
| 11117 | - return { | |
| 11118 | - isEnabledAndEditorReady: enabled && __unstableIsEditorReady(), | |
| 11119 | - isCollaborationEnabled: isCollaborationEnabledForCurrentPost(), | |
| 11120 | - hasIncompatibleMetaBoxes: enabled ? select3(store).getAllMetaBoxes().some((metaBox) => !metaBox.__rtc_compatible) : false, | |
| 11121 | - hasActiveMetaBoxes: enabled && select3(store).hasMetaBoxes() | |
| 11122 | - }; | |
| 11123 | - }, | |
| 2319 | + const { isEnabledAndEditorReady, isCollaborationEnabled } = (0, import_data24.useSelect)( | |
| 2320 | + (select3) => ({ | |
| 2321 | + isEnabledAndEditorReady: enabled && select3(import_editor17.store).__unstableIsEditorReady(), | |
| 2322 | + isCollaborationEnabled: select3(import_editor17.store).isCollaborationEnabledForCurrentPost() | |
| 2323 | + }), | |
| 11124 | 2324 | [enabled] |
| 11125 | 2325 | ); |
| 11126 | - const { setCollaborationSupported } = unlock2((0, import_data23.useDispatch)(import_core_data7.store)); | |
| 11127 | - const { updateEditorSettings } = (0, import_data23.useDispatch)(import_editor16.store); | |
| 11128 | - const { initializeMetaBoxes: initializeMetaBoxes2 } = (0, import_data23.useDispatch)(store); | |
| 11129 | - (0, import_element27.useEffect)(() => { | |
| 2326 | + const { setCollaborationSupported } = unlock((0, import_data24.useDispatch)(import_core_data7.store)); | |
| 2327 | + const { initializeMetaBoxes: initializeMetaBoxes2 } = (0, import_data24.useDispatch)(store); | |
| 2328 | + (0, import_element11.useEffect)(() => { | |
| 11130 | 2329 | if (isEnabledAndEditorReady) { |
| 11131 | 2330 | initializeMetaBoxes2(); |
| 11132 | - if (isCollaborationEnabled && hasIncompatibleMetaBoxes) { | |
| 2331 | + if (isCollaborationEnabled) { | |
| 11133 | 2332 | setCollaborationSupported(false); |
| 11134 | 2333 | } |
| 11135 | - if (hasActiveMetaBoxes) { | |
| 11136 | - updateEditorSettings({ disableVisualRevisions: true }); | |
| 11137 | - } | |
| 11138 | 2334 | } |
| 11139 | 2335 | }, [ |
| 11140 | 2336 | isEnabledAndEditorReady, |
| 11141 | 2337 | initializeMetaBoxes2, |
| 11142 | 2338 | isCollaborationEnabled, |
| 11143 | - setCollaborationSupported, | |
| 11144 | - hasIncompatibleMetaBoxes, | |
| 11145 | - hasActiveMetaBoxes, | |
| 11146 | - updateEditorSettings | |
| 2339 | + setCollaborationSupported | |
| 11147 | 2340 | ]); |
| 11148 | 2341 | }; |
| 11149 | 2342 | |
| 11150 | 2343 | // packages/edit-post/build-module/components/layout/index.mjs |
| 11151 | - var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); | |
| 11152 | - var { useCommandContext } = unlock2(import_commands2.privateApis); | |
| 11153 | - var { useDrag } = unlock2(import_components9.privateApis); | |
| 11154 | - var { Editor, FullscreenMode, UploadProgressSnackbar } = unlock2(import_editor17.privateApis); | |
| 11155 | - var { BlockKeyboardShortcuts } = unlock2(import_block_library.privateApis); | |
| 2344 | + var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); | |
| 2345 | + var { useCommandContext } = unlock(import_commands2.privateApis); | |
| 2346 | + var { useDrag } = unlock(import_components9.privateApis); | |
| 2347 | + var { Editor, FullscreenMode } = unlock(import_editor18.privateApis); | |
| 2348 | + var { BlockKeyboardShortcuts } = unlock(import_block_library.privateApis); | |
| 11156 | 2349 | var DESIGN_POST_TYPES = [ |
| 11157 | 2350 | "wp_template", |
| 11158 | 2351 | "wp_template_part", |
| 11159 | 2352 | "wp_block", |
| @@ -11159,14 +2352,14 @@ | ||
| 11159 | 2352 | "wp_block", |
| 11160 | 2353 | "wp_navigation" |
| 11161 | 2354 | ]; |
| 11162 | 2355 | function useEditorStyles(settings) { |
| 11163 | - const { hasThemeStyleSupport } = (0, import_data24.useSelect)((select3) => { | |
| 2356 | + const { hasThemeStyleSupport } = (0, import_data25.useSelect)((select3) => { | |
| 11164 | 2357 | return { |
| 11165 | 2358 | hasThemeStyleSupport: select3(store).isFeatureActive("themeStyles") |
| 11166 | 2359 | }; |
| 11167 | 2360 | }, []); |
| 11168 | - return (0, import_element28.useMemo)(() => { | |
| 2361 | + return (0, import_element12.useMemo)(() => { | |
| 11169 | 2362 | const presetStyles = settings.styles?.filter( |
| 11170 | 2363 | (style) => style.__unstableType && style.__unstableType !== "theme" |
| 11171 | 2364 | ) ?? []; |
| 11172 | 2365 | const defaultEditorStyles = [ |
| @@ -11192,10 +2385,10 @@ | ||
| 11192 | 2385 | settings.styles, |
| 11193 | 2386 | hasThemeStyleSupport |
| 11194 | 2387 | ]); |
| 11195 | 2388 | } |
| 11196 | - function MetaBoxesMain() { | |
| 11197 | - const [isOpen, openHeight, hasAnyVisible] = (0, import_data24.useSelect)((select3) => { | |
| 2389 | + function MetaBoxesMain({ isLegacy }) { | |
| 2390 | + const [isOpen, openHeight, hasAnyVisible] = (0, import_data25.useSelect)((select3) => { | |
| 11198 | 2391 | const { get } = select3(import_preferences10.store); |
| 11199 | 2392 | const { isMetaBoxLocationVisible: isMetaBoxLocationVisible2 } = select3(store); |
| 11200 | 2393 | return [ |
| 11201 | 2394 | !!get("core/edit-post", "metaBoxesMainIsOpen"), |
| @@ -11202,12 +2395,12 @@ | ||
| 11202 | 2395 | get("core/edit-post", "metaBoxesMainOpenHeight"), |
| 11203 | 2396 | isMetaBoxLocationVisible2("normal") || isMetaBoxLocationVisible2("advanced") || isMetaBoxLocationVisible2("side") |
| 11204 | 2397 | ]; |
| 11205 | 2398 | }, []); |
| 11206 | - const { set: setPreference } = (0, import_data24.useDispatch)(import_preferences10.store); | |
| 11207 | - const isShort = (0, import_compose2.useMediaQuery)("(max-height: 549px)"); | |
| 11208 | - const [{ min: min2 = 0, max: max2 }, setHeightConstraints] = (0, import_element28.useState)(() => ({})); | |
| 11209 | - const effectSizeConstraints = (0, import_compose2.useRefEffect)((node) => { | |
| 2399 | + const { set: setPreference } = (0, import_data25.useDispatch)(import_preferences10.store); | |
| 2400 | + const isShort = (0, import_compose3.useMediaQuery)("(max-height: 549px)"); | |
| 2401 | + const [{ min = 0, max }, setHeightConstraints] = (0, import_element12.useState)(() => ({})); | |
| 2402 | + const effectSizeConstraints = (0, import_compose3.useRefEffect)((node) => { | |
| 11210 | 2403 | const container = node.closest( |
| 11211 | 2404 | ".interface-interface-skeleton__content" |
| 11212 | 2405 | ); |
| 11213 | 2406 | if (!container) { |
| @@ -11212,9 +2405,11 @@ | ||
| 11212 | 2405 | ); |
| 11213 | 2406 | if (!container) { |
| 11214 | 2407 | return; |
| 11215 | 2408 | } |
| 11216 | - const noticeContainer = container.querySelector(".editor-notices"); | |
| 2409 | + const noticeLists = container.querySelectorAll( | |
| 2410 | + ":scope > .components-notice-list" | |
| 2411 | + ); | |
| 11217 | 2412 | const resizeHandle = container.querySelector( |
| 11218 | 2413 | ".edit-post-meta-boxes-main__presenter" |
| 11219 | 2414 | ); |
| 11220 | 2415 | const deriveConstraints = () => { |
| @@ -11219,31 +2414,29 @@ | ||
| 11219 | 2414 | ); |
| 11220 | 2415 | const deriveConstraints = () => { |
| 11221 | 2416 | const fullHeight = container.offsetHeight; |
| 11222 | 2417 | let nextMax = fullHeight; |
| 11223 | - if (noticeContainer) { | |
| 11224 | - nextMax -= noticeContainer.offsetHeight; | |
| 2418 | + for (const element of noticeLists) { | |
| 2419 | + nextMax -= element.offsetHeight; | |
| 11225 | 2420 | } |
| 11226 | - const nextMin = resizeHandle?.offsetHeight ?? 0; | |
| 2421 | + const nextMin = resizeHandle.offsetHeight; | |
| 11227 | 2422 | setHeightConstraints({ min: nextMin, max: nextMax }); |
| 11228 | 2423 | }; |
| 11229 | 2424 | const observer = new window.ResizeObserver(deriveConstraints); |
| 11230 | 2425 | observer.observe(container); |
| 11231 | - if (noticeContainer) { | |
| 11232 | - observer.observe(noticeContainer); | |
| 2426 | + for (const element of noticeLists) { | |
| 2427 | + observer.observe(element); | |
| 11233 | 2428 | } |
| 11234 | 2429 | return () => observer.disconnect(); |
| 11235 | 2430 | }, []); |
| 11236 | - const metaBoxesMainRef = (0, import_element28.useRef)(); | |
| 11237 | - const setMainRefs = (0, import_compose2.useMergeRefs)([ | |
| 2431 | + const metaBoxesMainRef = (0, import_element12.useRef)(); | |
| 2432 | + const setMainRefs = (0, import_compose3.useMergeRefs)([ | |
| 11238 | 2433 | metaBoxesMainRef, |
| 11239 | 2434 | effectSizeConstraints |
| 11240 | 2435 | ]); |
| 11241 | - const separatorRef = (0, import_element28.useRef)(); | |
| 11242 | - const separatorHelpId = (0, import_element28.useId)(); | |
| 11243 | - const heightRef = (0, import_element28.useRef)(); | |
| 11244 | - const getAriaValueNow = (height) => Math.round((height - min2) / (max2 - min2) * 100); | |
| 11245 | - const persistIsOpen = (to = !isOpen) => setPreference("core/edit-post", "metaBoxesMainIsOpen", to); | |
| 2436 | + const separatorRef = (0, import_element12.useRef)(); | |
| 2437 | + const separatorHelpId = (0, import_element12.useId)(); | |
| 2438 | + const heightRef = (0, import_element12.useRef)(); | |
| 11246 | 2439 | const applyHeight = (candidateHeight = "auto", isPersistent) => { |
| 11247 | 2440 | let styleHeight; |
| 11248 | 2441 | if (candidateHeight === "auto") { |
| 11249 | 2442 | isPersistent = false; |
| @@ -11248,9 +2441,9 @@ | ||
| 11248 | 2441 | if (candidateHeight === "auto") { |
| 11249 | 2442 | isPersistent = false; |
| 11250 | 2443 | styleHeight = candidateHeight; |
| 11251 | 2444 | } else { |
| 11252 | - candidateHeight = Math.min(max2, Math.max(min2, candidateHeight)); | |
| 2445 | + candidateHeight = Math.min(max, Math.max(min, candidateHeight)); | |
| 11253 | 2446 | heightRef.current = candidateHeight; |
| 11254 | 2447 | styleHeight = `${candidateHeight}px`; |
| 11255 | 2448 | } |
| 11256 | 2449 | if (isPersistent) { |
| @@ -11273,13 +2466,13 @@ | ||
| 11273 | 2466 | if (first) { |
| 11274 | 2467 | pane.classList.add("is-resizing"); |
| 11275 | 2468 | let fromHeight = heightRef.current ?? pane.offsetHeight; |
| 11276 | 2469 | if (isOpen) { |
| 11277 | - if (fromHeight > max2) { | |
| 11278 | - fromHeight = max2; | |
| 2470 | + if (fromHeight > max) { | |
| 2471 | + fromHeight = max; | |
| 11279 | 2472 | } |
| 11280 | 2473 | } else { |
| 11281 | - fromHeight = min2; | |
| 2474 | + fromHeight = min; | |
| 11282 | 2475 | } |
| 11283 | 2476 | applyHeight(fromHeight - yMovement); |
| 11284 | 2477 | return { fromHeight }; |
| 11285 | 2478 | } |
| @@ -11292,9 +2485,9 @@ | ||
| 11292 | 2485 | const [onTap] = args; |
| 11293 | 2486 | onTap?.(); |
| 11294 | 2487 | return; |
| 11295 | 2488 | } |
| 11296 | - const nextIsOpen = heightRef.current > min2; | |
| 2489 | + const nextIsOpen = heightRef.current > min; | |
| 11297 | 2490 | persistIsOpen(nextIsOpen); |
| 11298 | 2491 | applyHeight(heightRef.current, nextIsOpen); |
| 11299 | 2492 | }, |
| 11300 | 2493 | { keyboardDisplacement: 20, filterTaps: true } |
| @@ -11301,25 +2494,30 @@ | ||
| 11301 | 2494 | ); |
| 11302 | 2495 | if (!hasAnyVisible) { |
| 11303 | 2496 | return; |
| 11304 | 2497 | } |
| 11305 | - const contents = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)( | |
| 2498 | + const contents = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)( | |
| 11306 | 2499 | "div", |
| 11307 | 2500 | { |
| 11308 | 2501 | className: "edit-post-layout__metaboxes edit-post-meta-boxes-main__liner", |
| 11309 | - hidden: !isOpen, | |
| 2502 | + hidden: !isLegacy && !isOpen, | |
| 11310 | 2503 | children: [ |
| 11311 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxes, { location: "normal" }), | |
| 11312 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxes, { location: "advanced" }) | |
| 2504 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MetaBoxes, { location: "normal" }), | |
| 2505 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MetaBoxes, { location: "advanced" }) | |
| 11313 | 2506 | ] |
| 11314 | 2507 | } |
| 11315 | 2508 | ); |
| 2509 | + if (isLegacy) { | |
| 2510 | + return contents; | |
| 2511 | + } | |
| 11316 | 2512 | const isAutoHeight = openHeight === void 0; |
| 11317 | 2513 | const usedOpenHeight = isShort ? "auto" : openHeight; |
| 11318 | - const usedHeight = isOpen ? usedOpenHeight : min2; | |
| 11319 | - const usedAriaValueNow = max2 === void 0 || isAutoHeight ? 50 : getAriaValueNow(usedHeight); | |
| 2514 | + const usedHeight = isOpen ? usedOpenHeight : min; | |
| 2515 | + const getAriaValueNow = (height) => Math.round((height - min) / (max - min) * 100); | |
| 2516 | + const usedAriaValueNow = max === void 0 || isAutoHeight ? 50 : getAriaValueNow(usedHeight); | |
| 2517 | + const persistIsOpen = (to = !isOpen) => setPreference("core/edit-post", "metaBoxesMainIsOpen", to); | |
| 11320 | 2518 | const paneLabel = (0, import_i18n14.__)("Meta Boxes"); |
| 11321 | - const toggle = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)( | |
| 2519 | + const toggle = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)( | |
| 11322 | 2520 | "button", |
| 11323 | 2521 | { |
| 11324 | 2522 | "aria-expanded": isOpen, |
| 11325 | 2523 | onClick: ({ detail }) => { |
| @@ -11329,37 +2527,29 @@ | ||
| 11329 | 2527 | }, |
| 11330 | 2528 | ...!isShort && bindDragGesture(persistIsOpen), |
| 11331 | 2529 | children: [ |
| 11332 | 2530 | paneLabel, |
| 11333 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components9.Icon, { icon: isOpen ? chevron_up_default : chevron_down_default }) | |
| 2531 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components9.Icon, { icon: isOpen ? chevron_up_default : chevron_down_default }) | |
| 11334 | 2532 | ] |
| 11335 | 2533 | } |
| 11336 | 2534 | ); |
| 11337 | - const separator = !isShort && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [ | |
| 11338 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(tooltip_exports.Root, { children: [ | |
| 11339 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( | |
| 11340 | - tooltip_exports.Trigger, | |
| 11341 | - { | |
| 11342 | - render: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( | |
| 11343 | - "button", | |
| 11344 | - { | |
| 11345 | - ref: separatorRef, | |
| 11346 | - role: "separator", | |
| 11347 | - "aria-valuenow": usedAriaValueNow, | |
| 11348 | - "aria-label": (0, import_i18n14.__)("Drag to resize"), | |
| 11349 | - "aria-describedby": separatorHelpId, | |
| 11350 | - ...bindDragGesture() | |
| 11351 | - } | |
| 11352 | - ) | |
| 11353 | - } | |
| 11354 | - ), | |
| 11355 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(tooltip_exports.Popup, { children: (0, import_i18n14.__)("Drag to resize") }) | |
| 11356 | - ] }), | |
| 11357 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(VisuallyHidden, { id: separatorHelpId, children: (0, import_i18n14.__)( | |
| 2535 | + const separator = !isShort && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [ | |
| 2536 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components9.Tooltip, { text: (0, import_i18n14.__)("Drag to resize"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( | |
| 2537 | + "button", | |
| 2538 | + { | |
| 2539 | + ref: separatorRef, | |
| 2540 | + role: "separator", | |
| 2541 | + "aria-valuenow": usedAriaValueNow, | |
| 2542 | + "aria-label": (0, import_i18n14.__)("Drag to resize"), | |
| 2543 | + "aria-describedby": separatorHelpId, | |
| 2544 | + ...bindDragGesture() | |
| 2545 | + } | |
| 2546 | + ) }), | |
| 2547 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components9.VisuallyHidden, { id: separatorHelpId, children: (0, import_i18n14.__)( | |
| 11358 | 2548 | "Use up and down arrow keys to resize the meta box pane." |
| 11359 | 2549 | ) }) |
| 11360 | 2550 | ] }); |
| 11361 | - return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)( | |
| 2551 | + return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)( | |
| 11362 | 2552 | navigable_region_default, |
| 11363 | 2553 | { |
| 11364 | 2554 | ariaLabel: paneLabel, |
| 11365 | 2555 | ref: setMainRefs, |
| @@ -11368,9 +2558,9 @@ | ||
| 11368 | 2558 | !isShort && "is-resizable" |
| 11369 | 2559 | ), |
| 11370 | 2560 | style: { height: usedHeight }, |
| 11371 | 2561 | children: [ |
| 11372 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "edit-post-meta-boxes-main__presenter", children: [ | |
| 2562 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "edit-post-meta-boxes-main__presenter", children: [ | |
| 11373 | 2563 | toggle, |
| 11374 | 2564 | separator |
| 11375 | 2565 | ] }), |
| 11376 | 2566 | contents |
| @@ -11384,9 +2574,10 @@ | ||
| 11384 | 2574 | settings, |
| 11385 | 2575 | initialEdits |
| 11386 | 2576 | }) { |
| 11387 | 2577 | useCommands(); |
| 11388 | - const { createErrorNotice } = (0, import_data24.useDispatch)(import_notices3.store); | |
| 2578 | + const shouldIframe = useShouldIframe(); | |
| 2579 | + const { createErrorNotice } = (0, import_data25.useDispatch)(import_notices3.store); | |
| 11389 | 2580 | const { |
| 11390 | 2581 | currentPost: { postId: currentPostId, postType: currentPostType }, |
| 11391 | 2582 | onNavigateToEntityRecord, |
| 11392 | 2583 | onNavigateToPreviousEntityRecord |
| @@ -11405,14 +2596,15 @@ | ||
| 11405 | 2596 | showIconLabels, |
| 11406 | 2597 | isDistractionFree, |
| 11407 | 2598 | showMetaBoxes, |
| 11408 | 2599 | isWelcomeGuideVisible, |
| 11409 | - templateId | |
| 11410 | - } = (0, import_data24.useSelect)( | |
| 2600 | + templateId, | |
| 2601 | + isDevicePreview | |
| 2602 | + } = (0, import_data25.useSelect)( | |
| 11411 | 2603 | (select3) => { |
| 11412 | 2604 | const { get } = select3(import_preferences10.store); |
| 11413 | 2605 | const { isFeatureActive: isFeatureActive2, hasMetaBoxes: hasMetaBoxes2 } = select3(store); |
| 11414 | - const { canUser, getPostType, getTemplateId } = unlock2( | |
| 2606 | + const { canUser, getPostType, getTemplateId } = unlock( | |
| 11415 | 2607 | select3(import_core_data8.store) |
| 11416 | 2608 | ); |
| 11417 | 2609 | const supportsTemplateMode = settings.supportsTemplateMode; |
| 11418 | 2610 | const isViewable = getPostType(currentPostType)?.viewable ?? false; |
| @@ -11419,14 +2611,12 @@ | ||
| 11419 | 2611 | const canViewTemplate = canUser("read", { |
| 11420 | 2612 | kind: "postType", |
| 11421 | 2613 | name: "wp_template" |
| 11422 | 2614 | }); |
| 11423 | - const { getBlockSelectionStart, isZoomOut } = unlock2( | |
| 11424 | - select3(import_block_editor.store) | |
| 2615 | + const { getBlockSelectionStart, isZoomOut } = unlock( | |
| 2616 | + select3(import_block_editor2.store) | |
| 11425 | 2617 | ); |
| 11426 | - const { getEditorMode: getEditorMode2, getDefaultRenderingMode } = unlock2( | |
| 11427 | - select3(import_editor17.store) | |
| 11428 | - ); | |
| 2618 | + const { getEditorMode: getEditorMode2, getDefaultRenderingMode, getDeviceType } = unlock(select3(import_editor18.store)); | |
| 11429 | 2619 | const isNotDesignPostType = !DESIGN_POST_TYPES.includes(currentPostType); |
| 11430 | 2620 | const isDirectlyEditingPattern = currentPostType === "wp_block" && !onNavigateToPreviousEntityRecord; |
| 11431 | 2621 | const _templateId = getTemplateId(currentPostType, currentPostId); |
| 11432 | 2622 | const defaultMode = getDefaultRenderingMode(currentPostType); |
| @@ -11439,9 +2629,10 @@ | ||
| 11439 | 2629 | showIconLabels: get("core", "showIconLabels"), |
| 11440 | 2630 | isDistractionFree: get("core", "distractionFree"), |
| 11441 | 2631 | showMetaBoxes: isNotDesignPostType && !isZoomOut() || isDirectlyEditingPattern, |
| 11442 | 2632 | isWelcomeGuideVisible: isFeatureActive2("welcomeGuide"), |
| 11443 | - templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate2 ? _templateId : null | |
| 2633 | + templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate2 ? _templateId : null, | |
| 2634 | + isDevicePreview: getDeviceType() !== "Desktop" | |
| 11444 | 2635 | }; |
| 11445 | 2636 | }, |
| 11446 | 2637 | [ |
| 11447 | 2638 | currentPostType, |
| @@ -11454,14 +2645,15 @@ | ||
| 11454 | 2645 | useMetaBoxInitialization(hasActiveMetaboxes && hasResolvedMode); |
| 11455 | 2646 | const commandContext = hasBlockSelected ? "block-selection-edit" : "entity-edit"; |
| 11456 | 2647 | useCommandContext(commandContext); |
| 11457 | 2648 | const styles = useEditorStyles(settings); |
| 11458 | - const editorSettings = (0, import_element28.useMemo)( | |
| 2649 | + const editorSettings = (0, import_element12.useMemo)( | |
| 11459 | 2650 | () => ({ |
| 11460 | 2651 | ...settings, |
| 11461 | 2652 | styles, |
| 11462 | 2653 | onNavigateToEntityRecord, |
| 11463 | - onNavigateToPreviousEntityRecord | |
| 2654 | + onNavigateToPreviousEntityRecord, | |
| 2655 | + defaultRenderingMode: "post-only" | |
| 11464 | 2656 | }), |
| 11465 | 2657 | [ |
| 11466 | 2658 | settings, |
| 11467 | 2659 | styles, |
| @@ -11488,10 +2680,10 @@ | ||
| 11488 | 2680 | name |
| 11489 | 2681 | ) |
| 11490 | 2682 | ); |
| 11491 | 2683 | } |
| 11492 | - const { createSuccessNotice } = (0, import_data24.useDispatch)(import_notices3.store); | |
| 11493 | - const onActionPerformed = (0, import_element28.useCallback)( | |
| 2684 | + const { createSuccessNotice } = (0, import_data25.useDispatch)(import_notices3.store); | |
| 2685 | + const onActionPerformed = (0, import_element12.useCallback)( | |
| 11494 | 2686 | (actionId, items) => { |
| 11495 | 2687 | switch (actionId) { |
| 11496 | 2688 | case "move-to-trash": |
| 11497 | 2689 | { |
| @@ -11534,61 +2726,69 @@ | ||
| 11534 | 2726 | } |
| 11535 | 2727 | }, |
| 11536 | 2728 | [createSuccessNotice] |
| 11537 | 2729 | ); |
| 11538 | - const initialPost = (0, import_element28.useMemo)(() => { | |
| 2730 | + const initialPost = (0, import_element12.useMemo)(() => { | |
| 11539 | 2731 | return { |
| 11540 | 2732 | type: initialPostType, |
| 11541 | 2733 | id: initialPostId |
| 11542 | 2734 | }; |
| 11543 | 2735 | }, [initialPostType, initialPostId]); |
| 11544 | - const backButton = (0, import_compose2.useViewportMatch)("medium") && isFullscreenActive ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(back_button_default, { initialPost }) : null; | |
| 11545 | - return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components9.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(tooltip_exports.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_editor17.ErrorBoundary, { canCopyContent: true, children: [ | |
| 11546 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WelcomeGuide, { postType: currentPostType }), | |
| 11547 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { ...navigateRegionsProps, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)( | |
| 11548 | - Editor, | |
| 2736 | + const backButton = (0, import_compose3.useViewportMatch)("medium") && isFullscreenActive ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(back_button_default, { initialPost }) : null; | |
| 2737 | + return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components9.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_editor18.ErrorBoundary, { canCopyContent: true, children: [ | |
| 2738 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(WelcomeGuide, { postType: currentPostType }), | |
| 2739 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( | |
| 2740 | + "div", | |
| 11549 | 2741 | { |
| 11550 | - settings: editorSettings, | |
| 11551 | - initialEdits, | |
| 11552 | - postType: currentPostType, | |
| 11553 | - postId: currentPostId, | |
| 11554 | - templateId, | |
| 11555 | - className, | |
| 11556 | - forceIsDirty: hasActiveMetaboxes, | |
| 11557 | - autoFocus: !isWelcomeGuideVisible, | |
| 11558 | - onActionPerformed, | |
| 11559 | - extraSidebarPanels: showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxes, { location: "side" }), | |
| 11560 | - extraContent: !isDistractionFree && showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MetaBoxesMain, {}), | |
| 11561 | - children: [ | |
| 11562 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor17.PostLockedModal, {}), | |
| 11563 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(EditorInitialization, {}), | |
| 11564 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(FullscreenMode, { isActive: isFullscreenActive }), | |
| 11565 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BrowserURL, {}), | |
| 11566 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor17.UnsavedChangesWarning, {}), | |
| 11567 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor17.AutosaveMonitor, {}), | |
| 11568 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor17.LocalAutosaveMonitor, {}), | |
| 11569 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(keyboard_shortcuts_default, {}), | |
| 11570 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_editor17.EditorKeyboardShortcutsRegister, {}), | |
| 11571 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BlockKeyboardShortcuts, {}), | |
| 11572 | - currentPostType === "wp_block" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(InitPatternModal, {}), | |
| 11573 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_plugins.PluginArea, { onError: onPluginAreaError }), | |
| 11574 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(more_menu_default, {}), | |
| 11575 | - backButton, | |
| 11576 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_notices3.SnackbarNotices, { className: "edit-post-layout__snackbar" }), | |
| 11577 | - /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UploadProgressSnackbar, {}) | |
| 11578 | - ] | |
| 2742 | + className: navigateRegionsProps.className, | |
| 2743 | + ...navigateRegionsProps, | |
| 2744 | + ref: navigateRegionsProps.ref, | |
| 2745 | + children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)( | |
| 2746 | + Editor, | |
| 2747 | + { | |
| 2748 | + settings: editorSettings, | |
| 2749 | + initialEdits, | |
| 2750 | + postType: currentPostType, | |
| 2751 | + postId: currentPostId, | |
| 2752 | + templateId, | |
| 2753 | + className, | |
| 2754 | + forceIsDirty: hasActiveMetaboxes, | |
| 2755 | + disableIframe: !shouldIframe, | |
| 2756 | + autoFocus: !isWelcomeGuideVisible, | |
| 2757 | + onActionPerformed, | |
| 2758 | + extraSidebarPanels: showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MetaBoxes, { location: "side" }), | |
| 2759 | + extraContent: !isDistractionFree && showMetaBoxes && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MetaBoxesMain, { isLegacy: isDevicePreview }), | |
| 2760 | + children: [ | |
| 2761 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_editor18.PostLockedModal, {}), | |
| 2762 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EditorInitialization, {}), | |
| 2763 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FullscreenMode, { isActive: isFullscreenActive }), | |
| 2764 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BrowserURL, {}), | |
| 2765 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_editor18.UnsavedChangesWarning, {}), | |
| 2766 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_editor18.AutosaveMonitor, {}), | |
| 2767 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_editor18.LocalAutosaveMonitor, {}), | |
| 2768 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(keyboard_shortcuts_default, {}), | |
| 2769 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_editor18.EditorKeyboardShortcutsRegister, {}), | |
| 2770 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BlockKeyboardShortcuts, {}), | |
| 2771 | + currentPostType === "wp_block" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(InitPatternModal, {}), | |
| 2772 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_plugins.PluginArea, { onError: onPluginAreaError }), | |
| 2773 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(more_menu_default, {}), | |
| 2774 | + backButton, | |
| 2775 | + /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_notices3.SnackbarNotices, { className: "edit-post-layout__snackbar" }) | |
| 2776 | + ] | |
| 2777 | + } | |
| 2778 | + ) | |
| 11579 | 2779 | } |
| 11580 | - ) }) | |
| 11581 | - ] }) }) }); | |
| 2780 | + ) | |
| 2781 | + ] }) }); | |
| 11582 | 2782 | } |
| 11583 | 2783 | var layout_default = Layout; |
| 11584 | 2784 | |
| 11585 | 2785 | // packages/edit-post/build-module/deprecated.mjs |
| 11586 | - var import_editor18 = __toESM(require_editor(), 1); | |
| 2786 | + var import_editor19 = __toESM(require_editor(), 1); | |
| 11587 | 2787 | var import_url6 = __toESM(require_url(), 1); |
| 11588 | 2788 | var import_deprecated3 = __toESM(require_deprecated(), 1); |
| 11589 | - var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); | |
| 11590 | - var { PluginPostExcerpt } = unlock2(import_editor18.privateApis); | |
| 2789 | + var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); | |
| 2790 | + var { PluginPostExcerpt } = unlock(import_editor19.privateApis); | |
| 11591 | 2791 | var isSiteEditor = (0, import_url6.getPath)(window.location.href)?.includes( |
| 11592 | 2792 | "site-editor.php" |
| 11593 | 2793 | ); |
| 11594 | 2794 | var deprecateSlot = (name) => { |
| @@ -11601,9 +2801,9 @@ | ||
| 11601 | 2801 | if (isSiteEditor) { |
| 11602 | 2802 | return null; |
| 11603 | 2803 | } |
| 11604 | 2804 | deprecateSlot("PluginBlockSettingsMenuItem"); |
| 11605 | - return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginBlockSettingsMenuItem, { ...props }); | |
| 2805 | + return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_editor19.PluginBlockSettingsMenuItem, { ...props }); | |
| 11606 | 2806 | } |
| 11607 | 2807 | function PluginDocumentSettingPanel(props) { |
| 11608 | 2808 | if (isSiteEditor) { |
| 11609 | 2809 | return null; |
| @@ -11608,9 +2808,9 @@ | ||
| 11608 | 2808 | if (isSiteEditor) { |
| 11609 | 2809 | return null; |
| 11610 | 2810 | } |
| 11611 | 2811 | deprecateSlot("PluginDocumentSettingPanel"); |
| 11612 | - return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginDocumentSettingPanel, { ...props }); | |
| 2812 | + return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_editor19.PluginDocumentSettingPanel, { ...props }); | |
| 11613 | 2813 | } |
| 11614 | 2814 | function PluginMoreMenuItem(props) { |
| 11615 | 2815 | if (isSiteEditor) { |
| 11616 | 2816 | return null; |
| @@ -11615,9 +2815,9 @@ | ||
| 11615 | 2815 | if (isSiteEditor) { |
| 11616 | 2816 | return null; |
| 11617 | 2817 | } |
| 11618 | 2818 | deprecateSlot("PluginMoreMenuItem"); |
| 11619 | - return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginMoreMenuItem, { ...props }); | |
| 2819 | + return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_editor19.PluginMoreMenuItem, { ...props }); | |
| 11620 | 2820 | } |
| 11621 | 2821 | function PluginPrePublishPanel(props) { |
| 11622 | 2822 | if (isSiteEditor) { |
| 11623 | 2823 | return null; |
| @@ -11622,9 +2822,9 @@ | ||
| 11622 | 2822 | if (isSiteEditor) { |
| 11623 | 2823 | return null; |
| 11624 | 2824 | } |
| 11625 | 2825 | deprecateSlot("PluginPrePublishPanel"); |
| 11626 | - return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginPrePublishPanel, { ...props }); | |
| 2826 | + return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_editor19.PluginPrePublishPanel, { ...props }); | |
| 11627 | 2827 | } |
| 11628 | 2828 | function PluginPostPublishPanel(props) { |
| 11629 | 2829 | if (isSiteEditor) { |
| 11630 | 2830 | return null; |
| @@ -11629,9 +2829,9 @@ | ||
| 11629 | 2829 | if (isSiteEditor) { |
| 11630 | 2830 | return null; |
| 11631 | 2831 | } |
| 11632 | 2832 | deprecateSlot("PluginPostPublishPanel"); |
| 11633 | - return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginPostPublishPanel, { ...props }); | |
| 2833 | + return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_editor19.PluginPostPublishPanel, { ...props }); | |
| 11634 | 2834 | } |
| 11635 | 2835 | function PluginPostStatusInfo(props) { |
| 11636 | 2836 | if (isSiteEditor) { |
| 11637 | 2837 | return null; |
| @@ -11636,9 +2836,9 @@ | ||
| 11636 | 2836 | if (isSiteEditor) { |
| 11637 | 2837 | return null; |
| 11638 | 2838 | } |
| 11639 | 2839 | deprecateSlot("PluginPostStatusInfo"); |
| 11640 | - return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginPostStatusInfo, { ...props }); | |
| 2840 | + return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_editor19.PluginPostStatusInfo, { ...props }); | |
| 11641 | 2841 | } |
| 11642 | 2842 | function PluginSidebar(props) { |
| 11643 | 2843 | if (isSiteEditor) { |
| 11644 | 2844 | return null; |
| @@ -11643,9 +2843,9 @@ | ||
| 11643 | 2843 | if (isSiteEditor) { |
| 11644 | 2844 | return null; |
| 11645 | 2845 | } |
| 11646 | 2846 | deprecateSlot("PluginSidebar"); |
| 11647 | - return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginSidebar, { ...props }); | |
| 2847 | + return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_editor19.PluginSidebar, { ...props }); | |
| 11648 | 2848 | } |
| 11649 | 2849 | function PluginSidebarMoreMenuItem(props) { |
| 11650 | 2850 | if (isSiteEditor) { |
| 11651 | 2851 | return null; |
| @@ -11650,9 +2850,9 @@ | ||
| 11650 | 2850 | if (isSiteEditor) { |
| 11651 | 2851 | return null; |
| 11652 | 2852 | } |
| 11653 | 2853 | deprecateSlot("PluginSidebarMoreMenuItem"); |
| 11654 | - return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_editor18.PluginSidebarMoreMenuItem, { ...props }); | |
| 2854 | + return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_editor19.PluginSidebarMoreMenuItem, { ...props }); | |
| 11655 | 2855 | } |
| 11656 | 2856 | function __experimentalPluginPostExcerpt() { |
| 11657 | 2857 | if (isSiteEditor) { |
| 11658 | 2858 | return null; |
| @@ -11665,27 +2865,24 @@ | ||
| 11665 | 2865 | return PluginPostExcerpt; |
| 11666 | 2866 | } |
| 11667 | 2867 | |
| 11668 | 2868 | // packages/edit-post/build-module/index.mjs |
| 11669 | - var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); | |
| 2869 | + var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); | |
| 11670 | 2870 | var { |
| 11671 | 2871 | BackButton: __experimentalMainDashboardButton, |
| 11672 | 2872 | registerCoreBlockBindingsSources |
| 11673 | - } = unlock2(import_editor19.privateApis); | |
| 11674 | - var { enablePreloadMultiUse, clearPreloadedData } = unlock2( | |
| 11675 | - import_api_fetch2.default.privateApis | |
| 11676 | - ); | |
| 2873 | + } = unlock(import_editor20.privateApis); | |
| 11677 | 2874 | function initializeEditor(id, postType, postId, settings, initialEdits) { |
| 11678 | 2875 | const isMediumOrBigger = window.matchMedia("(min-width: 782px)").matches; |
| 11679 | 2876 | const target = document.getElementById(id); |
| 11680 | - const root = (0, import_element29.createRoot)(target); | |
| 11681 | - (0, import_data25.dispatch)(import_preferences11.store).setDefaults("core/edit-post", { | |
| 2877 | + const root = (0, import_element13.createRoot)(target); | |
| 2878 | + (0, import_data26.dispatch)(import_preferences11.store).setDefaults("core/edit-post", { | |
| 11682 | 2879 | fullscreenMode: true, |
| 11683 | 2880 | themeStyles: true, |
| 11684 | 2881 | welcomeGuide: true, |
| 11685 | 2882 | welcomeGuideTemplate: true |
| 11686 | 2883 | }); |
| 11687 | - (0, import_data25.dispatch)(import_preferences11.store).setDefaults("core", { | |
| 2884 | + (0, import_data26.dispatch)(import_preferences11.store).setDefaults("core", { | |
| 11688 | 2885 | allowRightClickOverrides: true, |
| 11689 | 2886 | editorMode: "visual", |
| 11690 | 2887 | editorTool: "edit", |
| 11691 | 2888 | fixedToolbar: false, |
| @@ -11695,23 +2892,19 @@ | ||
| 11695 | 2892 | showBlockBreadcrumbs: true, |
| 11696 | 2893 | showIconLabels: false, |
| 11697 | 2894 | showListViewByDefault: false, |
| 11698 | 2895 | enableChoosePatternModal: true, |
| 11699 | - isPublishSidebarEnabled: true, | |
| 11700 | - showCollaborationCursor: false, | |
| 11701 | - showCollaborationJoinNotifications: true, | |
| 11702 | - showCollaborationLeaveNotifications: true, | |
| 11703 | - showCollaborationPostSaveNotifications: true | |
| 2896 | + isPublishSidebarEnabled: true | |
| 11704 | 2897 | }); |
| 11705 | 2898 | if (window.__clientSideMediaProcessing) { |
| 11706 | - (0, import_data25.dispatch)(import_preferences11.store).setDefaults("core/media", { | |
| 2899 | + (0, import_data26.dispatch)(import_preferences11.store).setDefaults("core/media", { | |
| 11707 | 2900 | requireApproval: true, |
| 11708 | 2901 | optimizeOnUpload: true |
| 11709 | 2902 | }); |
| 11710 | 2903 | } |
| 11711 | - (0, import_data25.dispatch)(import_blocks2.store).reapplyBlockTypeFilters(); | |
| 11712 | - if (isMediumOrBigger && (0, import_data25.select)(import_preferences11.store).get("core", "showListViewByDefault") && !(0, import_data25.select)(import_preferences11.store).get("core", "distractionFree")) { | |
| 11713 | - (0, import_data25.dispatch)(import_editor19.store).setIsListViewOpened(true); | |
| 2904 | + (0, import_data26.dispatch)(import_blocks3.store).reapplyBlockTypeFilters(); | |
| 2905 | + if (isMediumOrBigger && (0, import_data26.select)(import_preferences11.store).get("core", "showListViewByDefault") && !(0, import_data26.select)(import_preferences11.store).get("core", "distractionFree")) { | |
| 2906 | + (0, import_data26.dispatch)(import_editor20.store).setIsListViewOpened(true); | |
| 11714 | 2907 | } |
| 11715 | 2908 | (0, import_block_library2.registerCoreBlocks)(); |
| 11716 | 2909 | registerCoreBlockBindingsSources(); |
| 11717 | 2910 | (0, import_widgets.registerLegacyWidgetBlock)({ inserter: false }); |
| @@ -11744,136 +2937,21 @@ | ||
| 11744 | 2937 | }); |
| 11745 | 2938 | } |
| 11746 | 2939 | window.addEventListener("dragover", (e) => e.preventDefault(), false); |
| 11747 | 2940 | window.addEventListener("drop", (e) => e.preventDefault(), false); |
| 11748 | - enablePreloadMultiUse(); | |
| 11749 | - const preloadedResolutions = preloadResolutions(postType, postId); | |
| 11750 | - preloadedResolutions.finally(() => { | |
| 11751 | - clearPreloadedData(); | |
| 11752 | - if (postType && postId) { | |
| 11753 | - const post = (0, import_data25.select)(import_core_data9.store).getEntityRecord( | |
| 11754 | - "postType", | |
| 2941 | + root.render( | |
| 2942 | + /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_element13.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( | |
| 2943 | + layout_default, | |
| 2944 | + { | |
| 2945 | + settings, | |
| 2946 | + postId, | |
| 11755 | 2947 | postType, |
| 11756 | - postId | |
| 11757 | - ); | |
| 11758 | - if (post) { | |
| 11759 | - (0, import_data25.dispatch)(import_editor19.store).setupEditor( | |
| 11760 | - post, | |
| 11761 | - initialEdits, | |
| 11762 | - settings.template | |
| 11763 | - ); | |
| 2948 | + initialEdits | |
| 11764 | 2949 | } |
| 11765 | - } | |
| 11766 | - root.render( | |
| 11767 | - /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_element29.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( | |
| 11768 | - layout_default, | |
| 11769 | - { | |
| 11770 | - settings, | |
| 11771 | - postId, | |
| 11772 | - postType, | |
| 11773 | - initialEdits | |
| 11774 | - } | |
| 11775 | - ) }) | |
| 11776 | - ); | |
| 11777 | - }); | |
| 2950 | + ) }) | |
| 2951 | + ); | |
| 11778 | 2952 | return root; |
| 11779 | 2953 | } |
| 11780 | - async function preloadResolutions(postType, postId) { | |
| 11781 | - const core = (0, import_data25.resolveSelect)(import_core_data9.store); | |
| 11782 | - const coreSelect = (0, import_data25.select)(import_core_data9.store); | |
| 11783 | - try { | |
| 11784 | - await Promise.all([ | |
| 11785 | - core.getCurrentUser(), | |
| 11786 | - core.getEntitiesConfig("postType"), | |
| 11787 | - core.getEntitiesConfig("taxonomy"), | |
| 11788 | - core.getEntitiesConfig("root"), | |
| 11789 | - core.getEntityRecords("root", "taxonomy"), | |
| 11790 | - core.getCurrentTheme(), | |
| 11791 | - // Forward-resolver alias of `getCurrentTheme` with its own | |
| 11792 | - // resolution metadata, so it needs a separate kick. | |
| 11793 | - core.getThemeSupports(), | |
| 11794 | - core.getBlockPatternCategories(), | |
| 11795 | - core.__experimentalGetCurrentGlobalStylesId(), | |
| 11796 | - core.__experimentalGetCurrentThemeBaseGlobalStyles(), | |
| 11797 | - core.__experimentalGetCurrentThemeGlobalStylesVariations(), | |
| 11798 | - core.getEntityRecord("root", "__unstableBase"), | |
| 11799 | - core.getEntityRecord("root", "site"), | |
| 11800 | - core.canUser("read", { kind: "root", name: "site" }), | |
| 11801 | - core.canUser("create", { kind: "postType", name: "attachment" }), | |
| 11802 | - core.canUser("create", { kind: "postType", name: "page" }), | |
| 11803 | - core.canUser("create", { kind: "postType", name: "wp_block" }), | |
| 11804 | - core.canUser("create", { | |
| 11805 | - kind: "postType", | |
| 11806 | - name: "wp_template" | |
| 11807 | - }), | |
| 11808 | - // The DataForm-based inspector requests the entity form config | |
| 11809 | - // when the document sidebar mounts. The args must match the | |
| 11810 | - // `useViewConfig` call in `@wordpress/views` exactly for the | |
| 11811 | - // resolution (and its preload entry) to be shared. | |
| 11812 | - ...postType && window?.__experimentalDataFormInspector ? [ | |
| 11813 | - unlock2(core).getViewConfig("postType", postType, { | |
| 11814 | - fields: "form" | |
| 11815 | - }) | |
| 11816 | - ] : [], | |
| 11817 | - // Per-post resolvers. `getPostType` and `getEditedEntityRecord` | |
| 11818 | - // are shorthand/forward-resolver aliases with their own | |
| 11819 | - // resolution metadata, so they need separate kicks. | |
| 11820 | - ...postType && postId ? [ | |
| 11821 | - core.getPostType(postType), | |
| 11822 | - core.getEntityRecord("postType", postType, postId), | |
| 11823 | - core.getEditedEntityRecord( | |
| 11824 | - "postType", | |
| 11825 | - postType, | |
| 11826 | - postId | |
| 11827 | - ), | |
| 11828 | - core.getAutosaves(postType, postId), | |
| 11829 | - core.getDefaultTemplateId({ slug: "front-page" }), | |
| 11830 | - core.canUser("create", { | |
| 11831 | - kind: "postType", | |
| 11832 | - name: postType | |
| 11833 | - }) | |
| 11834 | - ] : [] | |
| 11835 | - ]); | |
| 11836 | - const tasks = []; | |
| 11837 | - const globalStylesId = coreSelect.__experimentalGetCurrentGlobalStylesId(); | |
| 11838 | - if (globalStylesId) { | |
| 11839 | - tasks.push( | |
| 11840 | - core.getEntityRecord("root", "globalStyles", globalStylesId), | |
| 11841 | - core.canUser("read", { | |
| 11842 | - kind: "root", | |
| 11843 | - name: "globalStyles", | |
| 11844 | - id: globalStylesId | |
| 11845 | - }) | |
| 11846 | - ); | |
| 11847 | - } | |
| 11848 | - if (postType && postId) { | |
| 11849 | - const post = coreSelect.getEntityRecord( | |
| 11850 | - "postType", | |
| 11851 | - postType, | |
| 11852 | - postId | |
| 11853 | - ); | |
| 11854 | - if (post) { | |
| 11855 | - let slug = "page" === postType ? "page" : "single-" + postType; | |
| 11856 | - if (post.slug) { | |
| 11857 | - slug += "-" + post.slug; | |
| 11858 | - } | |
| 11859 | - tasks.push(core.getDefaultTemplateId({ slug })); | |
| 11860 | - if (post.author) { | |
| 11861 | - tasks.push( | |
| 11862 | - core.getUser(post.author, { | |
| 11863 | - context: "view", | |
| 11864 | - _fields: "id,name" | |
| 11865 | - }) | |
| 11866 | - ); | |
| 11867 | - } | |
| 11868 | - } | |
| 11869 | - } | |
| 11870 | - if (tasks.length) { | |
| 11871 | - await Promise.all(tasks); | |
| 11872 | - } | |
| 11873 | - } catch { | |
| 11874 | - } | |
| 11875 | - } | |
| 11876 | 2954 | function reinitializeEditor() { |
| 11877 | 2955 | (0, import_deprecated4.default)("wp.editPost.reinitializeEditor", { |
| 11878 | 2956 | since: "6.2", |
| 11879 | 2957 | version: "6.3" |
| @@ -11880,29 +2958,5 @@ | ||
| 11880 | 2958 | }); |
| 11881 | 2959 | } |
| 11882 | 2960 | return __toCommonJS(index_exports); |
| 11883 | 2961 | })(); |
| 11884 | -/*! Bundled license information: | |
| 11885 | - | |
| 11886 | -use-sync-external-store/cjs/use-sync-external-store-shim.development.js: | |
| 11887 | - (** | |
| 11888 | - * @license React | |
| 11889 | - * use-sync-external-store-shim.development.js | |
| 11890 | - * | |
| 11891 | - * Copyright (c) Meta Platforms, Inc. and affiliates. | |
| 11892 | - * | |
| 11893 | - * This source code is licensed under the MIT license found in the | |
| 11894 | - * LICENSE file in the root directory of this source tree. | |
| 11895 | - *) | |
| 11896 | - | |
| 11897 | -use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: | |
| 11898 | - (** | |
| 11899 | - * @license React | |
| 11900 | - * use-sync-external-store-shim/with-selector.development.js | |
| 11901 | - * | |
| 11902 | - * Copyright (c) Meta Platforms, Inc. and affiliates. | |
| 11903 | - * | |
| 11904 | - * This source code is licensed under the MIT license found in the | |
| 11905 | - * LICENSE file in the root directory of this source tree. | |
| 11906 | - *) | |
| 11907 | -*/ | |
| 11908 | 2962 | //# sourceMappingURL=index.js.map |