| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 var __create = Object.create; 2 var __defProp = Object.defineProperty; 3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 4 var __getOwnPropNames = Object.getOwnPropertyNames; 5 var __getProtoOf = Object.getPrototypeOf; 6 var __hasOwnProp = Object.prototype.hasOwnProperty; 7 var __commonJS = (cb, mod) => function __require() { 8 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 9 }; 10 var __export = (target, all) => { 11 for (var name in all) 12 __defProp(target, name, { get: all[name], enumerable: true }); 13 }; 14 var __copyProps = (to, from, except, desc) => { 15 if (from && typeof from === "object" || typeof from === "function") { 16 for (let key of __getOwnPropNames(from)) 17 if (!__hasOwnProp.call(to, key) && key !== except) 18 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 19 } 20 return to; 21 }; 22 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 23 // If the importer is in node compatibility mode or this is not an ESM 24 // file that has been converted to a CommonJS file using a Babel- 25 // compatible transform (i.e. "__esModule" has not been set), then set 26 // "default" to the CommonJS "module.exports" for node compatibility. 27 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 28 mod 29 )); 30 31 // package-external:@wordpress/i18n 32 var require_i18n = __commonJS({ 33 "package-external:@wordpress/i18n"(exports, module) { 34 module.exports = window.wp.i18n; 35 } 36 }); 37 38 // package-external:@wordpress/element 39 var require_element = __commonJS({ 40 "package-external:@wordpress/element"(exports, module) { 41 module.exports = window.wp.element; 42 } 43 }); 44 45 // vendor-external:react 46 var require_react = __commonJS({ 47 "vendor-external:react"(exports, module) { 48 module.exports = window.React; 49 } 50 }); 51 52 // vendor-external:react/jsx-runtime 53 var require_jsx_runtime = __commonJS({ 54 "vendor-external:react/jsx-runtime"(exports, module) { 55 module.exports = window.ReactJSXRuntime; 56 } 57 }); 58 59 // vendor-external:react-dom 60 var require_react_dom = __commonJS({ 61 "vendor-external:react-dom"(exports, module) { 62 module.exports = window.ReactDOM; 63 } 64 }); 65 66 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js 67 var require_use_sync_external_store_shim_development = __commonJS({ 68 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { 69 "use strict"; 70 (function() { 71 function is(x, y) { 72 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 73 } 74 function useSyncExternalStore$2(subscribe, getSnapshot) { 75 didWarnOld18Alpha || void 0 === React52.startTransition || (didWarnOld18Alpha = true, console.error( 76 "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." 77 )); 78 var value = getSnapshot(); 79 if (!didWarnUncachedGetSnapshot) { 80 var cachedValue = getSnapshot(); 81 objectIs(value, cachedValue) || (console.error( 82 "The result of getSnapshot should be cached to avoid an infinite loop" 83 ), didWarnUncachedGetSnapshot = true); 84 } 85 cachedValue = useState14({ 86 inst: { value, getSnapshot } 87 }); 88 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 89 useLayoutEffect3( 90 function() { 91 inst.value = value; 92 inst.getSnapshot = getSnapshot; 93 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 94 }, 95 [subscribe, value, getSnapshot] 96 ); 97 useEffect15( 98 function() { 99 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 100 return subscribe(function() { 101 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 102 }); 103 }, 104 [subscribe] 105 ); 106 useDebugValue2(value); 107 return value; 108 } 109 function checkIfSnapshotChanged(inst) { 110 var latestGetSnapshot = inst.getSnapshot; 111 inst = inst.value; 112 try { 113 var nextValue = latestGetSnapshot(); 114 return !objectIs(inst, nextValue); 115 } catch (error2) { 116 return true; 117 } 118 } 119 function useSyncExternalStore$1(subscribe, getSnapshot) { 120 return getSnapshot(); 121 } 122 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 123 var React52 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState14 = React52.useState, useEffect15 = React52.useEffect, useLayoutEffect3 = React52.useLayoutEffect, useDebugValue2 = React52.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; 124 exports.useSyncExternalStore = void 0 !== React52.useSyncExternalStore ? React52.useSyncExternalStore : shim; 125 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 126 })(); 127 } 128 }); 129 130 // node_modules/use-sync-external-store/shim/index.js 131 var require_shim = __commonJS({ 132 "node_modules/use-sync-external-store/shim/index.js"(exports, module) { 133 "use strict"; 134 if (false) { 135 module.exports = null; 136 } else { 137 module.exports = require_use_sync_external_store_shim_development(); 138 } 139 } 140 }); 141 142 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js 143 var require_with_selector_development = __commonJS({ 144 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { 145 "use strict"; 146 (function() { 147 function is(x, y) { 148 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 149 } 150 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 151 var React52 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef22 = React52.useRef, useEffect15 = React52.useEffect, useMemo16 = React52.useMemo, useDebugValue2 = React52.useDebugValue; 152 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { 153 var instRef = useRef22(null); 154 if (null === instRef.current) { 155 var inst = { hasValue: false, value: null }; 156 instRef.current = inst; 157 } else inst = instRef.current; 158 instRef = useMemo16( 159 function() { 160 function memoizedSelector(nextSnapshot) { 161 if (!hasMemo) { 162 hasMemo = true; 163 memoizedSnapshot = nextSnapshot; 164 nextSnapshot = selector(nextSnapshot); 165 if (void 0 !== isEqual && inst.hasValue) { 166 var currentSelection = inst.value; 167 if (isEqual(currentSelection, nextSnapshot)) 168 return memoizedSelection = currentSelection; 169 } 170 return memoizedSelection = nextSnapshot; 171 } 172 currentSelection = memoizedSelection; 173 if (objectIs(memoizedSnapshot, nextSnapshot)) 174 return currentSelection; 175 var nextSelection = selector(nextSnapshot); 176 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) 177 return memoizedSnapshot = nextSnapshot, currentSelection; 178 memoizedSnapshot = nextSnapshot; 179 return memoizedSelection = nextSelection; 180 } 181 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; 182 return [ 183 function() { 184 return memoizedSelector(getSnapshot()); 185 }, 186 null === maybeGetServerSnapshot ? void 0 : function() { 187 return memoizedSelector(maybeGetServerSnapshot()); 188 } 189 ]; 190 }, 191 [getSnapshot, getServerSnapshot, selector, isEqual] 192 ); 193 var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]); 194 useEffect15( 195 function() { 196 inst.hasValue = true; 197 inst.value = value; 198 }, 199 [value] 200 ); 201 useDebugValue2(value); 202 return value; 203 }; 204 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 205 })(); 206 } 207 }); 208 209 // node_modules/use-sync-external-store/shim/with-selector.js 210 var require_with_selector = __commonJS({ 211 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { 212 "use strict"; 213 if (false) { 214 module.exports = null; 215 } else { 216 module.exports = require_with_selector_development(); 217 } 218 } 219 }); 220 221 // package-external:@wordpress/primitives 222 var require_primitives = __commonJS({ 223 "package-external:@wordpress/primitives"(exports, module) { 224 module.exports = window.wp.primitives; 225 } 226 }); 227 228 // package-external:@wordpress/theme 229 var require_theme = __commonJS({ 230 "package-external:@wordpress/theme"(exports, module) { 231 module.exports = window.wp.theme; 232 } 233 }); 234 235 // package-external:@wordpress/private-apis 236 var require_private_apis = __commonJS({ 237 "package-external:@wordpress/private-apis"(exports, module) { 238 module.exports = window.wp.privateApis; 239 } 240 }); 241 242 // package-external:@wordpress/components 243 var require_components = __commonJS({ 244 "package-external:@wordpress/components"(exports, module) { 245 module.exports = window.wp.components; 246 } 247 }); 248 249 // package-external:@wordpress/data 250 var require_data = __commonJS({ 251 "package-external:@wordpress/data"(exports, module) { 252 module.exports = window.wp.data; 253 } 254 }); 255 256 // package-external:@wordpress/core-data 257 var require_core_data = __commonJS({ 258 "package-external:@wordpress/core-data"(exports, module) { 259 module.exports = window.wp.coreData; 260 } 261 }); 262 263 // package-external:@wordpress/notices 264 var require_notices = __commonJS({ 265 "package-external:@wordpress/notices"(exports, module) { 266 module.exports = window.wp.notices; 267 } 268 }); 269 270 // package-external:@wordpress/url 271 var require_url = __commonJS({ 272 "package-external:@wordpress/url"(exports, module) { 273 module.exports = window.wp.url; 274 } 275 }); 276 277 // node_modules/clsx/dist/clsx.mjs 278 function r(e) { 279 var t, f, n = ""; 280 if ("string" == typeof e || "number" == typeof e) n += e; 281 else if ("object" == typeof e) if (Array.isArray(e)) { 282 var o = e.length; 283 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 284 } else for (f in e) e[f] && (n && (n += " "), n += f); 285 return n; 286 } 287 function clsx() { 288 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 289 return n; 290 } 291 var clsx_default = clsx; 292 293 // packages/ui/build-module/badge/badge.mjs 294 var import_element11 = __toESM(require_element(), 1); 295 296 // node_modules/@base-ui/utils/esm/error.js 297 var set; 298 if (true) { 299 set = /* @__PURE__ */ new Set(); 300 } 301 function error(...messages) { 302 if (true) { 303 const messageKey = messages.join(" "); 304 if (!set.has(messageKey)) { 305 set.add(messageKey); 306 console.error(`Base UI: $messageKey}`); 307 } 308 } 309 } 310 311 // node_modules/@base-ui/utils/esm/safeReact.js 312 var React2 = __toESM(require_react(), 1); 313 var SafeReact = { 314 ...React2 315 }; 316 317 // node_modules/@base-ui/utils/esm/useRefWithInit.js 318 var React3 = __toESM(require_react(), 1); 319 var UNINITIALIZED = {}; 320 function useRefWithInit(init, initArg) { 321 const ref = React3.useRef(UNINITIALIZED); 322 if (ref.current === UNINITIALIZED) { 323 ref.current = init(initArg); 324 } 325 return ref; 326 } 327 328 // node_modules/@base-ui/utils/esm/useStableCallback.js 329 var useInsertionEffect = SafeReact.useInsertionEffect; 330 var useSafeInsertionEffect = ( 331 // React 17 doesn't have useInsertionEffect. 332 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 333 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() 334 ); 335 function useStableCallback(callback) { 336 const stable = useRefWithInit(createStableCallback).current; 337 stable.next = callback; 338 useSafeInsertionEffect(stable.effect); 339 return stable.trampoline; 340 } 341 function createStableCallback() { 342 const stable = { 343 next: void 0, 344 callback: assertNotCalled, 345 trampoline: (...args) => stable.callback?.(...args), 346 effect: () => { 347 stable.callback = stable.next; 348 } 349 }; 350 return stable; 351 } 352 function assertNotCalled() { 353 if (true) { 354 throw ( 355 /* minify-error-disabled */ 356 new Error("Base UI: Cannot call an event handler while rendering.") 357 ); 358 } 359 } 360 361 // node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js 362 var React4 = __toESM(require_react(), 1); 363 var noop = () => { 364 }; 365 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; 366 367 // node_modules/@base-ui/utils/esm/warn.js 368 var set2; 369 if (true) { 370 set2 = /* @__PURE__ */ new Set(); 371 } 372 function warn(...messages) { 373 if (true) { 374 const messageKey = messages.join(" "); 375 if (!set2.has(messageKey)) { 376 set2.add(messageKey); 377 console.warn(`Base UI: $messageKey}`); 378 } 379 } 380 } 381 382 // node_modules/@base-ui/react/esm/internals/direction-context/DirectionContext.js 383 var React5 = __toESM(require_react(), 1); 384 var DirectionContext = /* @__PURE__ */ React5.createContext(void 0); 385 if (true) DirectionContext.displayName = "DirectionContext"; 386 function useDirection() { 387 const context = React5.useContext(DirectionContext); 388 return context?.direction ?? "ltr"; 389 } 390 391 // node_modules/@base-ui/react/esm/internals/useRenderElement.js 392 var React8 = __toESM(require_react(), 1); 393 394 // node_modules/@base-ui/utils/esm/useMergedRefs.js 395 function useMergedRefs(a, b, c, d) { 396 const forkRef = useRefWithInit(createForkRef).current; 397 if (didChange(forkRef, a, b, c, d)) { 398 update(forkRef, [a, b, c, d]); 399 } 400 return forkRef.callback; 401 } 402 function useMergedRefsN(refs) { 403 const forkRef = useRefWithInit(createForkRef).current; 404 if (didChangeN(forkRef, refs)) { 405 update(forkRef, refs); 406 } 407 return forkRef.callback; 408 } 409 function createForkRef() { 410 return { 411 callback: null, 412 cleanup: null, 413 refs: [] 414 }; 415 } 416 function didChange(forkRef, a, b, c, d) { 417 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; 418 } 419 function didChangeN(forkRef, newRefs) { 420 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 421 } 422 function update(forkRef, refs) { 423 forkRef.refs = refs; 424 if (refs.every((ref) => ref == null)) { 425 forkRef.callback = null; 426 return; 427 } 428 forkRef.callback = (instance) => { 429 if (forkRef.cleanup) { 430 forkRef.cleanup(); 431 forkRef.cleanup = null; 432 } 433 if (instance != null) { 434 const cleanupCallbacks = Array(refs.length).fill(null); 435 for (let i = 0; i < refs.length; i += 1) { 436 const ref = refs[i]; 437 if (ref == null) { 438 continue; 439 } 440 switch (typeof ref) { 441 case "function": { 442 const refCleanup = ref(instance); 443 if (typeof refCleanup === "function") { 444 cleanupCallbacks[i] = refCleanup; 445 } 446 break; 447 } 448 case "object": { 449 ref.current = instance; 450 break; 451 } 452 default: 453 } 454 } 455 forkRef.cleanup = () => { 456 for (let i = 0; i < refs.length; i += 1) { 457 const ref = refs[i]; 458 if (ref == null) { 459 continue; 460 } 461 switch (typeof ref) { 462 case "function": { 463 const cleanupCallback = cleanupCallbacks[i]; 464 if (typeof cleanupCallback === "function") { 465 cleanupCallback(); 466 } else { 467 ref(null); 468 } 469 break; 470 } 471 case "object": { 472 ref.current = null; 473 break; 474 } 475 default: 476 } 477 } 478 }; 479 } 480 }; 481 } 482 483 // node_modules/@base-ui/utils/esm/getReactElementRef.js 484 var React7 = __toESM(require_react(), 1); 485 486 // node_modules/@base-ui/utils/esm/reactVersion.js 487 var React6 = __toESM(require_react(), 1); 488 var majorVersion = parseInt(React6.version, 10); 489 function isReactVersionAtLeast(reactVersionToCheck) { 490 return majorVersion >= reactVersionToCheck; 491 } 492 493 // node_modules/@base-ui/utils/esm/getReactElementRef.js 494 function getReactElementRef(element) { 495 if (!/* @__PURE__ */ React7.isValidElement(element)) { 496 return null; 497 } 498 const reactElement = element; 499 const propsWithRef = reactElement.props; 500 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 501 } 502 503 // node_modules/@base-ui/utils/esm/mergeObjects.js 504 function mergeObjects(a, b) { 505 if (a && !b) { 506 return a; 507 } 508 if (!a && b) { 509 return b; 510 } 511 if (a || b) { 512 return { 513 ...a, 514 ...b 515 }; 516 } 517 return void 0; 518 } 519 520 // node_modules/@base-ui/utils/esm/empty.js 521 function NOOP() { 522 } 523 var EMPTY_ARRAY = Object.freeze([]); 524 var EMPTY_OBJECT = Object.freeze({}); 525 526 // node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js 527 function getStateAttributesProps(state, customMapping) { 528 const props = {}; 529 for (const key in state) { 530 const value = state[key]; 531 if (customMapping?.hasOwnProperty(key)) { 532 const customProps = customMapping[key](value); 533 if (customProps != null) { 534 Object.assign(props, customProps); 535 } 536 continue; 537 } 538 if (value === true) { 539 props[`data-$key.toLowerCase()}`] = ""; 540 } else if (value) { 541 props[`data-$key.toLowerCase()}`] = value.toString(); 542 } 543 } 544 return props; 545 } 546 547 // node_modules/@base-ui/react/esm/utils/resolveClassName.js 548 function resolveClassName(className, state) { 549 return typeof className === "function" ? className(state) : className; 550 } 551 552 // node_modules/@base-ui/react/esm/utils/resolveStyle.js 553 function resolveStyle(style, state) { 554 return typeof style === "function" ? style(state) : style; 555 } 556 557 // node_modules/@base-ui/react/esm/merge-props/mergeProps.js 558 var EMPTY_PROPS = {}; 559 function mergeProps(a, b, c, d, e) { 560 if (!c && !d && !e && !a) { 561 return createInitialMergedProps(b); 562 } 563 let merged = createInitialMergedProps(a); 564 if (b) { 565 merged = mergeInto(merged, b); 566 } 567 if (c) { 568 merged = mergeInto(merged, c); 569 } 570 if (d) { 571 merged = mergeInto(merged, d); 572 } 573 if (e) { 574 merged = mergeInto(merged, e); 575 } 576 return merged; 577 } 578 function mergePropsN(props) { 579 if (props.length === 0) { 580 return EMPTY_PROPS; 581 } 582 if (props.length === 1) { 583 return createInitialMergedProps(props[0]); 584 } 585 let merged = createInitialMergedProps(props[0]); 586 for (let i = 1; i < props.length; i += 1) { 587 merged = mergeInto(merged, props[i]); 588 } 589 return merged; 590 } 591 function createInitialMergedProps(inputProps) { 592 if (isPropsGetter(inputProps)) { 593 return { 594 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 595 }; 596 } 597 return copyInitialProps(inputProps); 598 } 599 function mergeInto(merged, inputProps) { 600 if (isPropsGetter(inputProps)) { 601 return resolvePropsGetter(inputProps, merged); 602 } 603 return mutablyMergeInto(merged, inputProps); 604 } 605 function copyInitialProps(inputProps) { 606 const copiedProps = { 607 ...inputProps 608 }; 609 for (const propName in copiedProps) { 610 const propValue = copiedProps[propName]; 611 if (isEventHandler(propName, propValue)) { 612 copiedProps[propName] = wrapEventHandler(propValue); 613 } 614 } 615 return copiedProps; 616 } 617 function mutablyMergeInto(mergedProps, externalProps) { 618 if (!externalProps) { 619 return mergedProps; 620 } 621 for (const propName in externalProps) { 622 const externalPropValue = externalProps[propName]; 623 switch (propName) { 624 case "style": { 625 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 626 break; 627 } 628 case "className": { 629 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 630 break; 631 } 632 default: { 633 if (isEventHandler(propName, externalPropValue)) { 634 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 635 } else { 636 mergedProps[propName] = externalPropValue; 637 } 638 } 639 } 640 } 641 return mergedProps; 642 } 643 function isEventHandler(key, value) { 644 const code0 = key.charCodeAt(0); 645 const code1 = key.charCodeAt(1); 646 const code2 = key.charCodeAt(2); 647 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 648 } 649 function isPropsGetter(inputProps) { 650 return typeof inputProps === "function"; 651 } 652 function resolvePropsGetter(inputProps, previousProps) { 653 if (isPropsGetter(inputProps)) { 654 return inputProps(previousProps); 655 } 656 return inputProps ?? EMPTY_PROPS; 657 } 658 function mergeEventHandlers(ourHandler, theirHandler) { 659 if (!theirHandler) { 660 return ourHandler; 661 } 662 if (!ourHandler) { 663 return wrapEventHandler(theirHandler); 664 } 665 return (...args) => { 666 const event = args[0]; 667 if (isSyntheticEvent(event)) { 668 const baseUIEvent = event; 669 makeEventPreventable(baseUIEvent); 670 const result2 = theirHandler(...args); 671 if (!baseUIEvent.baseUIHandlerPrevented) { 672 ourHandler?.(...args); 673 } 674 return result2; 675 } 676 const result = theirHandler(...args); 677 ourHandler?.(...args); 678 return result; 679 }; 680 } 681 function wrapEventHandler(handler) { 682 if (!handler) { 683 return handler; 684 } 685 return (...args) => { 686 const event = args[0]; 687 if (isSyntheticEvent(event)) { 688 makeEventPreventable(event); 689 } 690 return handler(...args); 691 }; 692 } 693 function makeEventPreventable(event) { 694 event.preventBaseUIHandler = () => { 695 event.baseUIHandlerPrevented = true; 696 }; 697 return event; 698 } 699 function mergeClassNames(ourClassName, theirClassName) { 700 if (theirClassName) { 701 if (ourClassName) { 702 return theirClassName + " " + ourClassName; 703 } 704 return theirClassName; 705 } 706 return ourClassName; 707 } 708 function isSyntheticEvent(event) { 709 return event != null && typeof event === "object" && "nativeEvent" in event; 710 } 711 712 // node_modules/@base-ui/react/esm/internals/useRenderElement.js 713 var import_react = __toESM(require_react(), 1); 714 function useRenderElement(element, componentProps, params = {}) { 715 const renderProp = componentProps.render; 716 const outProps = useRenderElementProps(componentProps, params); 717 if (params.enabled === false) { 718 return null; 719 } 720 const state = params.state ?? EMPTY_OBJECT; 721 return evaluateRenderProp(element, renderProp, outProps, state); 722 } 723 function useRenderElementProps(componentProps, params = {}) { 724 const { 725 className: classNameProp, 726 style: styleProp, 727 render: renderProp 728 } = componentProps; 729 const { 730 state = EMPTY_OBJECT, 731 ref, 732 props, 733 stateAttributesMapping: stateAttributesMapping3, 734 enabled = true 735 } = params; 736 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 737 const style = enabled ? resolveStyle(styleProp, state) : void 0; 738 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT; 739 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 740 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 741 if (typeof document !== "undefined") { 742 if (!enabled) { 743 useMergedRefs(null, null); 744 } else if (Array.isArray(ref)) { 745 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 746 } else { 747 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 748 } 749 } 750 if (!enabled) { 751 return EMPTY_OBJECT; 752 } 753 if (className !== void 0) { 754 outProps.className = mergeClassNames(outProps.className, className); 755 } 756 if (style !== void 0) { 757 outProps.style = mergeObjects(outProps.style, style); 758 } 759 return outProps; 760 } 761 function resolveRenderFunctionProps(props) { 762 if (Array.isArray(props)) { 763 return mergePropsN(props); 764 } 765 return mergeProps(void 0, props); 766 } 767 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 768 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 769 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 770 function evaluateRenderProp(element, render, props, state) { 771 if (render) { 772 if (typeof render === "function") { 773 if (true) { 774 warnIfRenderPropLooksLikeComponent(render); 775 } 776 return render(props, state); 777 } 778 const mergedProps = mergeProps(props, render.props); 779 mergedProps.ref = props.ref; 780 let newElement = render; 781 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 782 const children = React8.Children.toArray(render); 783 newElement = children[0]; 784 } 785 if (true) { 786 if (!/* @__PURE__ */ React8.isValidElement(newElement)) { 787 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")); 788 } 789 } 790 return /* @__PURE__ */ React8.cloneElement(newElement, mergedProps); 791 } 792 if (element) { 793 if (typeof element === "string") { 794 return renderTag(element, props); 795 } 796 } 797 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 798 } 799 function warnIfRenderPropLooksLikeComponent(renderFn) { 800 const functionName = renderFn.name; 801 if (functionName.length === 0) { 802 return; 803 } 804 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 805 return; 806 } 807 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 808 return; 809 } 810 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"); 811 } 812 function renderTag(Tag, props) { 813 if (Tag === "button") { 814 return /* @__PURE__ */ (0, import_react.createElement)("button", { 815 type: "button", 816 ...props, 817 key: props.key 818 }); 819 } 820 if (Tag === "img") { 821 return /* @__PURE__ */ (0, import_react.createElement)("img", { 822 alt: "", 823 ...props, 824 key: props.key 825 }); 826 } 827 return /* @__PURE__ */ React8.createElement(Tag, props); 828 } 829 830 // node_modules/@base-ui/react/esm/internals/reason-parts.js 831 var reason_parts_exports = {}; 832 __export(reason_parts_exports, { 833 cancelOpen: () => cancelOpen, 834 chipRemovePress: () => chipRemovePress, 835 clearPress: () => clearPress, 836 closePress: () => closePress, 837 closeWatcher: () => closeWatcher, 838 decrementPress: () => decrementPress, 839 disabled: () => disabled, 840 drag: () => drag, 841 escapeKey: () => escapeKey, 842 focusOut: () => focusOut, 843 imperativeAction: () => imperativeAction, 844 incrementPress: () => incrementPress, 845 initial: () => initial, 846 inputBlur: () => inputBlur, 847 inputChange: () => inputChange, 848 inputClear: () => inputClear, 849 inputPaste: () => inputPaste, 850 inputPress: () => inputPress, 851 itemPress: () => itemPress, 852 keyboard: () => keyboard, 853 linkPress: () => linkPress, 854 listNavigation: () => listNavigation, 855 missing: () => missing, 856 none: () => none, 857 outsidePress: () => outsidePress, 858 pointer: () => pointer, 859 scrub: () => scrub, 860 siblingOpen: () => siblingOpen, 861 swipe: () => swipe, 862 trackPress: () => trackPress, 863 triggerFocus: () => triggerFocus, 864 triggerHover: () => triggerHover, 865 triggerPress: () => triggerPress, 866 wheel: () => wheel, 867 windowResize: () => windowResize 868 }); 869 var none = "none"; 870 var triggerPress = "trigger-press"; 871 var triggerHover = "trigger-hover"; 872 var triggerFocus = "trigger-focus"; 873 var outsidePress = "outside-press"; 874 var itemPress = "item-press"; 875 var closePress = "close-press"; 876 var linkPress = "link-press"; 877 var clearPress = "clear-press"; 878 var chipRemovePress = "chip-remove-press"; 879 var trackPress = "track-press"; 880 var incrementPress = "increment-press"; 881 var decrementPress = "decrement-press"; 882 var inputChange = "input-change"; 883 var inputClear = "input-clear"; 884 var inputBlur = "input-blur"; 885 var inputPaste = "input-paste"; 886 var inputPress = "input-press"; 887 var focusOut = "focus-out"; 888 var escapeKey = "escape-key"; 889 var closeWatcher = "close-watcher"; 890 var listNavigation = "list-navigation"; 891 var keyboard = "keyboard"; 892 var pointer = "pointer"; 893 var drag = "drag"; 894 var wheel = "wheel"; 895 var scrub = "scrub"; 896 var cancelOpen = "cancel-open"; 897 var siblingOpen = "sibling-open"; 898 var disabled = "disabled"; 899 var missing = "missing"; 900 var initial = "initial"; 901 var imperativeAction = "imperative-action"; 902 var swipe = "swipe"; 903 var windowResize = "window-resize"; 904 905 // node_modules/@base-ui/react/esm/internals/createBaseUIEventDetails.js 906 function createChangeEventDetails(reason, event, trigger, customProperties) { 907 let canceled = false; 908 let allowPropagation = false; 909 const custom = customProperties ?? EMPTY_OBJECT; 910 const details = { 911 reason, 912 event: event ?? new Event("base-ui"), 913 cancel() { 914 canceled = true; 915 }, 916 allowPropagation() { 917 allowPropagation = true; 918 }, 919 get isCanceled() { 920 return canceled; 921 }, 922 get isPropagationAllowed() { 923 return allowPropagation; 924 }, 925 trigger, 926 ...custom 927 }; 928 return details; 929 } 930 931 // node_modules/@base-ui/utils/esm/useId.js 932 var React9 = __toESM(require_react(), 1); 933 var globalId = 0; 934 function useGlobalId(idOverride, prefix = "mui") { 935 const [defaultId, setDefaultId] = React9.useState(idOverride); 936 const id = idOverride || defaultId; 937 React9.useEffect(() => { 938 if (defaultId == null) { 939 globalId += 1; 940 setDefaultId(`$prefix}-$globalId}`); 941 } 942 }, [defaultId, prefix]); 943 return id; 944 } 945 var maybeReactUseId = SafeReact.useId; 946 function useId(idOverride, prefix) { 947 if (maybeReactUseId !== void 0) { 948 const reactId = maybeReactUseId(); 949 return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId); 950 } 951 return useGlobalId(idOverride, prefix); 952 } 953 954 // node_modules/@base-ui/react/esm/internals/useBaseUiId.js 955 function useBaseUiId(idOverride) { 956 return useId(idOverride, "base-ui"); 957 } 958 959 // node_modules/@base-ui/react/esm/internals/useTransitionStatus.js 960 var React11 = __toESM(require_react(), 1); 961 962 // node_modules/@base-ui/utils/esm/useOnMount.js 963 var React10 = __toESM(require_react(), 1); 964 var EMPTY = []; 965 function useOnMount(fn) { 966 React10.useEffect(fn, EMPTY); 967 } 968 969 // node_modules/@base-ui/utils/esm/useAnimationFrame.js 970 var EMPTY2 = null; 971 var LAST_RAF = globalThis.requestAnimationFrame; 972 var Scheduler = class { 973 /* This implementation uses an array as a backing data-structure for frame callbacks. 974 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it 975 * never calls the native `cancelAnimationFrame` if there are no frames left. This can 976 * be much more efficient if there is a call pattern that alterns as 977 * "request-cancel-request-cancel-…". 978 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation 979 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ 980 callbacks = []; 981 callbacksCount = 0; 982 nextId = 1; 983 startId = 1; 984 isScheduled = false; 985 tick = (timestamp) => { 986 this.isScheduled = false; 987 const currentCallbacks = this.callbacks; 988 const currentCallbacksCount = this.callbacksCount; 989 this.callbacks = []; 990 this.callbacksCount = 0; 991 this.startId = this.nextId; 992 if (currentCallbacksCount > 0) { 993 for (let i = 0; i < currentCallbacks.length; i += 1) { 994 currentCallbacks[i]?.(timestamp); 995 } 996 } 997 }; 998 request(fn) { 999 const id = this.nextId; 1000 this.nextId += 1; 1001 this.callbacks.push(fn); 1002 this.callbacksCount += 1; 1003 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); 1004 if (!this.isScheduled || didRAFChange) { 1005 requestAnimationFrame(this.tick); 1006 this.isScheduled = true; 1007 } 1008 return id; 1009 } 1010 cancel(id) { 1011 const index2 = id - this.startId; 1012 if (index2 < 0 || index2 >= this.callbacks.length) { 1013 return; 1014 } 1015 this.callbacks[index2] = null; 1016 this.callbacksCount -= 1; 1017 } 1018 }; 1019 var scheduler = new Scheduler(); 1020 var AnimationFrame = class _AnimationFrame { 1021 static create() { 1022 return new _AnimationFrame(); 1023 } 1024 static request(fn) { 1025 return scheduler.request(fn); 1026 } 1027 static cancel(id) { 1028 return scheduler.cancel(id); 1029 } 1030 currentId = EMPTY2; 1031 /** 1032 * Executes `fn` after `delay`, clearing any previously scheduled call. 1033 */ 1034 request(fn) { 1035 this.cancel(); 1036 this.currentId = scheduler.request(() => { 1037 this.currentId = EMPTY2; 1038 fn(); 1039 }); 1040 } 1041 cancel = () => { 1042 if (this.currentId !== EMPTY2) { 1043 scheduler.cancel(this.currentId); 1044 this.currentId = EMPTY2; 1045 } 1046 }; 1047 disposeEffect = () => { 1048 return this.cancel; 1049 }; 1050 }; 1051 function useAnimationFrame() { 1052 const timeout = useRefWithInit(AnimationFrame.create).current; 1053 useOnMount(timeout.disposeEffect); 1054 return timeout; 1055 } 1056 1057 // node_modules/@base-ui/react/esm/internals/useTransitionStatus.js 1058 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { 1059 const [transitionStatus, setTransitionStatus] = React11.useState(open && enableIdleState ? "idle" : void 0); 1060 const [mounted, setMounted] = React11.useState(open); 1061 if (open && !mounted) { 1062 setMounted(true); 1063 setTransitionStatus("starting"); 1064 } 1065 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { 1066 setTransitionStatus("ending"); 1067 } 1068 if (!open && !mounted && transitionStatus === "ending") { 1069 setTransitionStatus(void 0); 1070 } 1071 useIsoLayoutEffect(() => { 1072 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { 1073 const frame = AnimationFrame.request(() => { 1074 setTransitionStatus("ending"); 1075 }); 1076 return () => { 1077 AnimationFrame.cancel(frame); 1078 }; 1079 } 1080 return void 0; 1081 }, [open, mounted, transitionStatus, deferEndingState]); 1082 useIsoLayoutEffect(() => { 1083 if (!open || enableIdleState) { 1084 return void 0; 1085 } 1086 const frame = AnimationFrame.request(() => { 1087 setTransitionStatus(void 0); 1088 }); 1089 return () => { 1090 AnimationFrame.cancel(frame); 1091 }; 1092 }, [enableIdleState, open]); 1093 useIsoLayoutEffect(() => { 1094 if (!open || !enableIdleState) { 1095 return void 0; 1096 } 1097 if (open && mounted && transitionStatus !== "idle") { 1098 setTransitionStatus("starting"); 1099 } 1100 const frame = AnimationFrame.request(() => { 1101 setTransitionStatus("idle"); 1102 }); 1103 return () => { 1104 AnimationFrame.cancel(frame); 1105 }; 1106 }, [enableIdleState, open, mounted, transitionStatus]); 1107 return { 1108 mounted, 1109 setMounted, 1110 transitionStatus 1111 }; 1112 } 1113 1114 // node_modules/@base-ui/react/esm/internals/stateAttributesMapping.js 1115 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { 1116 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; 1117 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; 1118 return TransitionStatusDataAttributes2; 1119 })({}); 1120 var STARTING_HOOK = { 1121 [TransitionStatusDataAttributes.startingStyle]: "" 1122 }; 1123 var ENDING_HOOK = { 1124 [TransitionStatusDataAttributes.endingStyle]: "" 1125 }; 1126 var transitionStatusMapping = { 1127 transitionStatus(value) { 1128 if (value === "starting") { 1129 return STARTING_HOOK; 1130 } 1131 if (value === "ending") { 1132 return ENDING_HOOK; 1133 } 1134 return null; 1135 } 1136 }; 1137 1138 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js 1139 var React14 = __toESM(require_react(), 1); 1140 1141 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 1142 function hasWindow() { 1143 return typeof window !== "undefined"; 1144 } 1145 function getNodeName(node) { 1146 if (isNode(node)) { 1147 return (node.nodeName || "").toLowerCase(); 1148 } 1149 return "#document"; 1150 } 1151 function getWindow(node) { 1152 var _node$ownerDocument; 1153 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 1154 } 1155 function getDocumentElement(node) { 1156 var _ref; 1157 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 1158 } 1159 function isNode(value) { 1160 if (!hasWindow()) { 1161 return false; 1162 } 1163 return value instanceof Node || value instanceof getWindow(value).Node; 1164 } 1165 function isElement(value) { 1166 if (!hasWindow()) { 1167 return false; 1168 } 1169 return value instanceof Element || value instanceof getWindow(value).Element; 1170 } 1171 function isHTMLElement(value) { 1172 if (!hasWindow()) { 1173 return false; 1174 } 1175 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 1176 } 1177 function isShadowRoot(value) { 1178 if (!hasWindow() || typeof ShadowRoot === "undefined") { 1179 return false; 1180 } 1181 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 1182 } 1183 function isOverflowElement(element) { 1184 const { 1185 overflow, 1186 overflowX, 1187 overflowY, 1188 display 1189 } = getComputedStyle2(element); 1190 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 1191 } 1192 function isTableElement(element) { 1193 return /^(table|td|th)$/.test(getNodeName(element)); 1194 } 1195 function isTopLayer(element) { 1196 try { 1197 if (element.matches(":popover-open")) { 1198 return true; 1199 } 1200 } catch (_e) { 1201 } 1202 try { 1203 return element.matches(":modal"); 1204 } catch (_e) { 1205 return false; 1206 } 1207 } 1208 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 1209 var containRe = /paint|layout|strict|content/; 1210 var isNotNone = (value) => !!value && value !== "none"; 1211 var isWebKitValue; 1212 function isContainingBlock(elementOrCss) { 1213 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 1214 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 || ""); 1215 } 1216 function getContainingBlock(element) { 1217 let currentNode = getParentNode(element); 1218 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 1219 if (isContainingBlock(currentNode)) { 1220 return currentNode; 1221 } else if (isTopLayer(currentNode)) { 1222 return null; 1223 } 1224 currentNode = getParentNode(currentNode); 1225 } 1226 return null; 1227 } 1228 function isWebKit() { 1229 if (isWebKitValue == null) { 1230 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 1231 } 1232 return isWebKitValue; 1233 } 1234 function isLastTraversableNode(node) { 1235 return /^(html|body|#document)$/.test(getNodeName(node)); 1236 } 1237 function getComputedStyle2(element) { 1238 return getWindow(element).getComputedStyle(element); 1239 } 1240 function getNodeScroll(element) { 1241 if (isElement(element)) { 1242 return { 1243 scrollLeft: element.scrollLeft, 1244 scrollTop: element.scrollTop 1245 }; 1246 } 1247 return { 1248 scrollLeft: element.scrollX, 1249 scrollTop: element.scrollY 1250 }; 1251 } 1252 function getParentNode(node) { 1253 if (getNodeName(node) === "html") { 1254 return node; 1255 } 1256 const result = ( 1257 // Step into the shadow DOM of the parent of a slotted node. 1258 node.assignedSlot || // DOM Element detected. 1259 node.parentNode || // ShadowRoot detected. 1260 isShadowRoot(node) && node.host || // Fallback. 1261 getDocumentElement(node) 1262 ); 1263 return isShadowRoot(result) ? result.host : result; 1264 } 1265 function getNearestOverflowAncestor(node) { 1266 const parentNode = getParentNode(node); 1267 if (isLastTraversableNode(parentNode)) { 1268 return node.ownerDocument ? node.ownerDocument.body : node.body; 1269 } 1270 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 1271 return parentNode; 1272 } 1273 return getNearestOverflowAncestor(parentNode); 1274 } 1275 function getOverflowAncestors(node, list, traverseIframes) { 1276 var _node$ownerDocument2; 1277 if (list === void 0) { 1278 list = []; 1279 } 1280 if (traverseIframes === void 0) { 1281 traverseIframes = true; 1282 } 1283 const scrollableAncestor = getNearestOverflowAncestor(node); 1284 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 1285 const win = getWindow(scrollableAncestor); 1286 if (isBody) { 1287 const frameElement = getFrameElement(win); 1288 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 1289 } else { 1290 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 1291 } 1292 } 1293 function getFrameElement(win) { 1294 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 1295 } 1296 1297 // node_modules/@base-ui/react/esm/internals/composite/root/CompositeRootContext.js 1298 var React12 = __toESM(require_react(), 1); 1299 var CompositeRootContext = /* @__PURE__ */ React12.createContext(void 0); 1300 if (true) CompositeRootContext.displayName = "CompositeRootContext"; 1301 function useCompositeRootContext(optional = false) { 1302 const context = React12.useContext(CompositeRootContext); 1303 if (context === void 0 && !optional) { 1304 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); 1305 } 1306 return context; 1307 } 1308 1309 // node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.js 1310 var React13 = __toESM(require_react(), 1); 1311 function useFocusableWhenDisabled(parameters) { 1312 const { 1313 focusableWhenDisabled, 1314 disabled: disabled2, 1315 composite = false, 1316 tabIndex: tabIndexProp = 0, 1317 isNativeButton 1318 } = parameters; 1319 const isFocusableComposite = composite && focusableWhenDisabled !== false; 1320 const isNonFocusableComposite = composite && focusableWhenDisabled === false; 1321 const props = React13.useMemo(() => { 1322 const additionalProps = { 1323 // allow Tabbing away from focusableWhenDisabled elements 1324 onKeyDown(event) { 1325 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { 1326 event.preventDefault(); 1327 } 1328 } 1329 }; 1330 if (!composite) { 1331 additionalProps.tabIndex = tabIndexProp; 1332 if (!isNativeButton && disabled2) { 1333 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; 1334 } 1335 } 1336 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { 1337 additionalProps["aria-disabled"] = disabled2; 1338 } 1339 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { 1340 additionalProps.disabled = disabled2; 1341 } 1342 return additionalProps; 1343 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); 1344 return { 1345 props 1346 }; 1347 } 1348 1349 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js 1350 function useButton(parameters = {}) { 1351 const { 1352 disabled: disabled2 = false, 1353 focusableWhenDisabled, 1354 tabIndex = 0, 1355 native: isNativeButton = true, 1356 composite: compositeProp 1357 } = parameters; 1358 const elementRef = React14.useRef(null); 1359 const compositeRootContext = useCompositeRootContext(true); 1360 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; 1361 const { 1362 props: focusableWhenDisabledProps 1363 } = useFocusableWhenDisabled({ 1364 focusableWhenDisabled, 1365 disabled: disabled2, 1366 composite: isCompositeItem, 1367 tabIndex, 1368 isNativeButton 1369 }); 1370 if (true) { 1371 React14.useEffect(() => { 1372 if (!elementRef.current) { 1373 return; 1374 } 1375 const isButtonTag = isButtonElement(elementRef.current); 1376 if (isNativeButton) { 1377 if (!isButtonTag) { 1378 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 1379 const message = "A component that acts as a button expected a native <button> because the `nativeButton` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the `render` prop, or set `nativeButton` to `false`."; 1380 error(`$message}$ownerStackMessage}`); 1381 } 1382 } else if (isButtonTag) { 1383 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 1384 const message = "A component that acts as a button expected a non-<button> because the `nativeButton` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set `nativeButton` to `true`."; 1385 error(`$message}$ownerStackMessage}`); 1386 } 1387 }, [isNativeButton]); 1388 } 1389 const updateDisabled = React14.useCallback(() => { 1390 const element = elementRef.current; 1391 if (!isButtonElement(element)) { 1392 return; 1393 } 1394 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { 1395 element.disabled = false; 1396 } 1397 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); 1398 useIsoLayoutEffect(updateDisabled, [updateDisabled]); 1399 const getButtonProps = React14.useCallback((externalProps = {}) => { 1400 const { 1401 onClick: externalOnClick, 1402 onMouseDown: externalOnMouseDown, 1403 onKeyUp: externalOnKeyUp, 1404 onKeyDown: externalOnKeyDown, 1405 onPointerDown: externalOnPointerDown, 1406 ...otherExternalProps 1407 } = externalProps; 1408 return mergeProps({ 1409 onClick(event) { 1410 if (disabled2) { 1411 event.preventDefault(); 1412 return; 1413 } 1414 externalOnClick?.(event); 1415 }, 1416 onMouseDown(event) { 1417 if (!disabled2) { 1418 externalOnMouseDown?.(event); 1419 } 1420 }, 1421 onKeyDown(event) { 1422 if (disabled2) { 1423 return; 1424 } 1425 makeEventPreventable(event); 1426 externalOnKeyDown?.(event); 1427 if (event.baseUIHandlerPrevented) { 1428 return; 1429 } 1430 const isCurrentTarget = event.target === event.currentTarget; 1431 const currentTarget = event.currentTarget; 1432 const isButton = isButtonElement(currentTarget); 1433 const isLink = !isNativeButton && isValidLinkElement(currentTarget); 1434 const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink); 1435 const isEnterKey = event.key === "Enter"; 1436 const isSpaceKey = event.key === " "; 1437 const role = currentTarget.getAttribute("role"); 1438 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; 1439 if (isCurrentTarget && isCompositeItem && isSpaceKey) { 1440 if (event.defaultPrevented && isTextNavigationRole) { 1441 return; 1442 } 1443 event.preventDefault(); 1444 if (isLink || isNativeButton && isButton) { 1445 currentTarget.click(); 1446 event.preventBaseUIHandler(); 1447 } else if (shouldClick) { 1448 externalOnClick?.(event); 1449 event.preventBaseUIHandler(); 1450 } 1451 return; 1452 } 1453 if (shouldClick) { 1454 if (!isNativeButton && (isSpaceKey || isEnterKey)) { 1455 event.preventDefault(); 1456 } 1457 if (!isNativeButton && isEnterKey) { 1458 externalOnClick?.(event); 1459 } 1460 } 1461 }, 1462 onKeyUp(event) { 1463 if (disabled2) { 1464 return; 1465 } 1466 makeEventPreventable(event); 1467 externalOnKeyUp?.(event); 1468 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { 1469 event.preventDefault(); 1470 return; 1471 } 1472 if (event.baseUIHandlerPrevented) { 1473 return; 1474 } 1475 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") { 1476 externalOnClick?.(event); 1477 } 1478 }, 1479 onPointerDown(event) { 1480 if (disabled2) { 1481 event.preventDefault(); 1482 return; 1483 } 1484 externalOnPointerDown?.(event); 1485 } 1486 }, isNativeButton ? { 1487 type: "button" 1488 } : { 1489 role: "button" 1490 }, focusableWhenDisabledProps, otherExternalProps); 1491 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); 1492 const buttonRef = useStableCallback((element) => { 1493 elementRef.current = element; 1494 updateDisabled(); 1495 }); 1496 return { 1497 getButtonProps, 1498 buttonRef 1499 }; 1500 } 1501 function isButtonElement(elem) { 1502 return isHTMLElement(elem) && elem.tagName === "BUTTON"; 1503 } 1504 function isValidLinkElement(elem) { 1505 return Boolean(elem?.tagName === "A" && elem?.href); 1506 } 1507 1508 // node_modules/@base-ui/utils/esm/detectBrowser.js 1509 var hasNavigator = typeof navigator !== "undefined"; 1510 var nav = getNavigatorData(); 1511 var platform = getPlatform(); 1512 var userAgent = getUserAgent(); 1513 var isWebKit2 = typeof CSS === "undefined" || !CSS.supports ? false : CSS.supports("-webkit-backdrop-filter:none"); 1514 var isIOS = ( 1515 // iPads can claim to be MacIntel 1516 nav.platform === "MacIntel" && nav.maxTouchPoints > 1 ? true : /iP(hone|ad|od)|iOS/.test(nav.platform) 1517 ); 1518 var isFirefox = hasNavigator && /firefox/i.test(userAgent); 1519 var isSafari = hasNavigator && /apple/i.test(navigator.vendor); 1520 var isEdge = hasNavigator && /Edg/i.test(userAgent); 1521 var isAndroid = hasNavigator && /android/i.test(platform) || /android/i.test(userAgent); 1522 var isMac = hasNavigator && platform.toLowerCase().startsWith("mac") && !navigator.maxTouchPoints; 1523 var isJSDOM = userAgent.includes("jsdom/"); 1524 function getNavigatorData() { 1525 if (!hasNavigator) { 1526 return { 1527 platform: "", 1528 maxTouchPoints: -1 1529 }; 1530 } 1531 const uaData = navigator.userAgentData; 1532 if (uaData?.platform) { 1533 return { 1534 platform: uaData.platform, 1535 maxTouchPoints: navigator.maxTouchPoints 1536 }; 1537 } 1538 return { 1539 platform: navigator.platform ?? "", 1540 maxTouchPoints: navigator.maxTouchPoints ?? -1 1541 }; 1542 } 1543 function getUserAgent() { 1544 if (!hasNavigator) { 1545 return ""; 1546 } 1547 const uaData = navigator.userAgentData; 1548 if (uaData && Array.isArray(uaData.brands)) { 1549 return uaData.brands.map(({ 1550 brand, 1551 version: version2 1552 }) => `$brand}/$version2}`).join(" "); 1553 } 1554 return navigator.userAgent; 1555 } 1556 function getPlatform() { 1557 if (!hasNavigator) { 1558 return ""; 1559 } 1560 const uaData = navigator.userAgentData; 1561 if (uaData?.platform) { 1562 return uaData.platform; 1563 } 1564 return navigator.platform ?? ""; 1565 } 1566 1567 // node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js 1568 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 1569 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 1570 1571 // node_modules/@base-ui/react/esm/internals/shadowDom.js 1572 function activeElement(doc) { 1573 let element = doc.activeElement; 1574 while (element?.shadowRoot?.activeElement != null) { 1575 element = element.shadowRoot.activeElement; 1576 } 1577 return element; 1578 } 1579 function contains(parent, child) { 1580 if (!parent || !child) { 1581 return false; 1582 } 1583 const rootNode = child.getRootNode?.(); 1584 if (parent.contains(child)) { 1585 return true; 1586 } 1587 if (rootNode && isShadowRoot(rootNode)) { 1588 let next = child; 1589 while (next) { 1590 if (parent === next) { 1591 return true; 1592 } 1593 next = next.parentNode || next.host; 1594 } 1595 } 1596 return false; 1597 } 1598 function getTarget(event) { 1599 if ("composedPath" in event) { 1600 return event.composedPath()[0]; 1601 } 1602 return event.target; 1603 } 1604 1605 // node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js 1606 function isTargetInsideEnabledTrigger(target, triggerElements) { 1607 if (!isElement(target)) { 1608 return false; 1609 } 1610 const targetElement = target; 1611 if (triggerElements.hasElement(targetElement)) { 1612 return !targetElement.hasAttribute("data-trigger-disabled"); 1613 } 1614 for (const [, trigger] of triggerElements.entries()) { 1615 if (contains(trigger, targetElement)) { 1616 return !trigger.hasAttribute("data-trigger-disabled"); 1617 } 1618 } 1619 return false; 1620 } 1621 function isEventTargetWithin(event, node) { 1622 if (node == null) { 1623 return false; 1624 } 1625 if ("composedPath" in event) { 1626 return event.composedPath().includes(node); 1627 } 1628 const eventAgain = event; 1629 return eventAgain.target != null && node.contains(eventAgain.target); 1630 } 1631 function isRootElement(element) { 1632 return element.matches("html,body"); 1633 } 1634 function isTypeableElement(element) { 1635 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 1636 } 1637 function isInteractiveElement(element) { 1638 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 1639 } 1640 function matchesFocusVisible(element) { 1641 if (!element || isJSDOM) { 1642 return true; 1643 } 1644 try { 1645 return element.matches(":focus-visible"); 1646 } catch (_e) { 1647 return true; 1648 } 1649 } 1650 1651 // node_modules/@base-ui/react/esm/floating-ui-react/utils/nodes.js 1652 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 1653 const directChildren = nodes.filter((node) => node.parentId === id); 1654 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 1655 } 1656 1657 // node_modules/@base-ui/react/esm/floating-ui-react/utils/event.js 1658 function isReactEvent(event) { 1659 return "nativeEvent" in event; 1660 } 1661 function isMouseLikePointerType(pointerType, strict) { 1662 const values = ["mouse", "pen"]; 1663 if (!strict) { 1664 values.push("", void 0); 1665 } 1666 return values.includes(pointerType); 1667 } 1668 function isClickLikeEvent(event) { 1669 const type = event.type; 1670 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 1671 } 1672 1673 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 1674 var sides = ["top", "right", "bottom", "left"]; 1675 var min = Math.min; 1676 var max = Math.max; 1677 var round = Math.round; 1678 var floor = Math.floor; 1679 var createCoords = (v) => ({ 1680 x: v, 1681 y: v 1682 }); 1683 var oppositeSideMap = { 1684 left: "right", 1685 right: "left", 1686 bottom: "top", 1687 top: "bottom" 1688 }; 1689 function clamp(start, value, end) { 1690 return max(start, min(value, end)); 1691 } 1692 function evaluate(value, param) { 1693 return typeof value === "function" ? value(param) : value; 1694 } 1695 function getSide(placement) { 1696 return placement.split("-")[0]; 1697 } 1698 function getAlignment(placement) { 1699 return placement.split("-")[1]; 1700 } 1701 function getOppositeAxis(axis) { 1702 return axis === "x" ? "y" : "x"; 1703 } 1704 function getAxisLength(axis) { 1705 return axis === "y" ? "height" : "width"; 1706 } 1707 function getSideAxis(placement) { 1708 const firstChar = placement[0]; 1709 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 1710 } 1711 function getAlignmentAxis(placement) { 1712 return getOppositeAxis(getSideAxis(placement)); 1713 } 1714 function getAlignmentSides(placement, rects, rtl) { 1715 if (rtl === void 0) { 1716 rtl = false; 1717 } 1718 const alignment = getAlignment(placement); 1719 const alignmentAxis = getAlignmentAxis(placement); 1720 const length = getAxisLength(alignmentAxis); 1721 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 1722 if (rects.reference[length] > rects.floating[length]) { 1723 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 1724 } 1725 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 1726 } 1727 function getExpandedPlacements(placement) { 1728 const oppositePlacement = getOppositePlacement(placement); 1729 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 1730 } 1731 function getOppositeAlignmentPlacement(placement) { 1732 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 1733 } 1734 var lrPlacement = ["left", "right"]; 1735 var rlPlacement = ["right", "left"]; 1736 var tbPlacement = ["top", "bottom"]; 1737 var btPlacement = ["bottom", "top"]; 1738 function getSideList(side, isStart, rtl) { 1739 switch (side) { 1740 case "top": 1741 case "bottom": 1742 if (rtl) return isStart ? rlPlacement : lrPlacement; 1743 return isStart ? lrPlacement : rlPlacement; 1744 case "left": 1745 case "right": 1746 return isStart ? tbPlacement : btPlacement; 1747 default: 1748 return []; 1749 } 1750 } 1751 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 1752 const alignment = getAlignment(placement); 1753 let list = getSideList(getSide(placement), direction === "start", rtl); 1754 if (alignment) { 1755 list = list.map((side) => side + "-" + alignment); 1756 if (flipAlignment) { 1757 list = list.concat(list.map(getOppositeAlignmentPlacement)); 1758 } 1759 } 1760 return list; 1761 } 1762 function getOppositePlacement(placement) { 1763 const side = getSide(placement); 1764 return oppositeSideMap[side] + placement.slice(side.length); 1765 } 1766 function expandPaddingObject(padding) { 1767 return { 1768 top: 0, 1769 right: 0, 1770 bottom: 0, 1771 left: 0, 1772 ...padding 1773 }; 1774 } 1775 function getPaddingObject(padding) { 1776 return typeof padding !== "number" ? expandPaddingObject(padding) : { 1777 top: padding, 1778 right: padding, 1779 bottom: padding, 1780 left: padding 1781 }; 1782 } 1783 function rectToClientRect(rect) { 1784 const { 1785 x, 1786 y, 1787 width, 1788 height 1789 } = rect; 1790 return { 1791 width, 1792 height, 1793 top: y, 1794 left: x, 1795 right: x + width, 1796 bottom: y + height, 1797 x, 1798 y 1799 }; 1800 } 1801 1802 // node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js 1803 function isHiddenByStyles(styles) { 1804 return styles.visibility === "hidden" || styles.visibility === "collapse"; 1805 } 1806 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 1807 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 1808 return false; 1809 } 1810 if (typeof element.checkVisibility === "function") { 1811 return element.checkVisibility(); 1812 } 1813 return styles.display !== "none" && styles.display !== "contents"; 1814 } 1815 1816 // node_modules/@base-ui/utils/esm/owner.js 1817 function ownerDocument(node) { 1818 return node?.ownerDocument || document; 1819 } 1820 1821 // node_modules/@base-ui/react/esm/floating-ui-react/utils/tabbable.js 1822 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 1823 function getParentElement(element) { 1824 const assignedSlot = element.assignedSlot; 1825 if (assignedSlot) { 1826 return assignedSlot; 1827 } 1828 if (element.parentElement) { 1829 return element.parentElement; 1830 } 1831 const rootNode = element.getRootNode(); 1832 return isShadowRoot(rootNode) ? rootNode.host : null; 1833 } 1834 function getDetailsSummary(details) { 1835 for (const child of Array.from(details.children)) { 1836 if (getNodeName(child) === "summary") { 1837 return child; 1838 } 1839 } 1840 return null; 1841 } 1842 function isWithinOpenDetailsSummary(element, details) { 1843 const summary = getDetailsSummary(details); 1844 return !!summary && (element === summary || contains(summary, element)); 1845 } 1846 function isFocusableCandidate(element) { 1847 const nodeName = element ? getNodeName(element) : ""; 1848 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"); 1849 } 1850 function isFocusableElement(element) { 1851 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 1852 return false; 1853 } 1854 for (let current = element; current; current = getParentElement(current)) { 1855 const isAncestor = current !== element; 1856 const isSlot = getNodeName(current) === "slot"; 1857 if (current.hasAttribute("inert")) { 1858 return false; 1859 } 1860 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 1861 return false; 1862 } 1863 } 1864 return true; 1865 } 1866 function isVisibleInTabbableTree(element, isAncestor) { 1867 const styles = getComputedStyle2(element); 1868 if (!isAncestor) { 1869 return isElementVisible(element, styles); 1870 } 1871 return styles.display !== "none"; 1872 } 1873 function getTabIndex(element) { 1874 const tabIndex = element.tabIndex; 1875 if (tabIndex < 0) { 1876 const nodeName = getNodeName(element); 1877 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 1878 return 0; 1879 } 1880 } 1881 return tabIndex; 1882 } 1883 function getNamedRadioInput(element) { 1884 if (getNodeName(element) !== "input") { 1885 return null; 1886 } 1887 const input = element; 1888 return input.type === "radio" && input.name !== "" ? input : null; 1889 } 1890 function isTabbableRadio(element, candidates) { 1891 const input = getNamedRadioInput(element); 1892 if (!input) { 1893 return true; 1894 } 1895 const checkedRadio = candidates.find((candidate) => { 1896 const radio = getNamedRadioInput(candidate); 1897 return radio?.name === input.name && radio.form === input.form && radio.checked; 1898 }); 1899 if (checkedRadio) { 1900 return checkedRadio === input; 1901 } 1902 return candidates.find((candidate) => { 1903 const radio = getNamedRadioInput(candidate); 1904 return radio?.name === input.name && radio.form === input.form; 1905 }) === input; 1906 } 1907 function getComposedChildren(container) { 1908 if (isHTMLElement(container) && getNodeName(container) === "slot") { 1909 const assignedElements = container.assignedElements({ 1910 flatten: true 1911 }); 1912 if (assignedElements.length > 0) { 1913 return assignedElements; 1914 } 1915 } 1916 if (isHTMLElement(container) && container.shadowRoot) { 1917 return Array.from(container.shadowRoot.children); 1918 } 1919 return Array.from(container.children); 1920 } 1921 function appendCandidates(container, list) { 1922 getComposedChildren(container).forEach((child) => { 1923 if (isFocusableCandidate(child)) { 1924 list.push(child); 1925 } 1926 appendCandidates(child, list); 1927 }); 1928 } 1929 function appendMatchingElements(container, selector, list) { 1930 getComposedChildren(container).forEach((child) => { 1931 if (isHTMLElement(child) && child.matches(selector)) { 1932 list.push(child); 1933 } 1934 appendMatchingElements(child, selector, list); 1935 }); 1936 } 1937 function focusable(container) { 1938 const candidates = []; 1939 appendCandidates(container, candidates); 1940 return candidates.filter(isFocusableElement); 1941 } 1942 function tabbable(container) { 1943 const candidates = focusable(container); 1944 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 1945 } 1946 function getTabbableIn(container, dir) { 1947 const list = tabbable(container); 1948 const len = list.length; 1949 if (len === 0) { 1950 return void 0; 1951 } 1952 const active = activeElement(ownerDocument(container)); 1953 const index2 = list.indexOf(active); 1954 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; 1955 return list[nextIndex]; 1956 } 1957 function getNextTabbable(referenceElement) { 1958 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 1959 } 1960 function getPreviousTabbable(referenceElement) { 1961 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 1962 } 1963 function isOutsideEvent(event, container) { 1964 const containerElement = container || event.currentTarget; 1965 const relatedTarget = event.relatedTarget; 1966 return !relatedTarget || !contains(containerElement, relatedTarget); 1967 } 1968 function disableFocusInside(container) { 1969 const tabbableElements = tabbable(container); 1970 tabbableElements.forEach((element) => { 1971 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 1972 element.setAttribute("tabindex", "-1"); 1973 }); 1974 } 1975 function enableFocusInside(container) { 1976 const elements = []; 1977 appendMatchingElements(container, "[data-tabindex]", elements); 1978 elements.forEach((element) => { 1979 const tabindex = element.dataset.tabindex; 1980 delete element.dataset.tabindex; 1981 if (tabindex) { 1982 element.setAttribute("tabindex", tabindex); 1983 } else { 1984 element.removeAttribute("tabindex"); 1985 } 1986 }); 1987 } 1988 1989 // node_modules/@base-ui/utils/esm/addEventListener.js 1990 function addEventListener(target, type, listener, options) { 1991 target.addEventListener(type, listener, options); 1992 return () => { 1993 target.removeEventListener(type, listener, options); 1994 }; 1995 } 1996 1997 // node_modules/@base-ui/utils/esm/useValueAsRef.js 1998 function useValueAsRef(value) { 1999 const latest = useRefWithInit(createLatestRef, value).current; 2000 latest.next = value; 2001 useIsoLayoutEffect(latest.effect); 2002 return latest; 2003 } 2004 function createLatestRef(value) { 2005 const latest = { 2006 current: value, 2007 next: value, 2008 effect: () => { 2009 latest.current = latest.next; 2010 } 2011 }; 2012 return latest; 2013 } 2014 2015 // node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js 2016 var React15 = __toESM(require_react(), 1); 2017 2018 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js 2019 var ReactDOM = __toESM(require_react_dom(), 1); 2020 2021 // node_modules/@base-ui/react/esm/utils/resolveRef.js 2022 function resolveRef(maybeRef) { 2023 if (maybeRef == null) { 2024 return maybeRef; 2025 } 2026 return "current" in maybeRef ? maybeRef.current : maybeRef; 2027 } 2028 2029 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js 2030 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { 2031 const frame = useAnimationFrame(); 2032 return useStableCallback((fnToExecute, signal = null) => { 2033 frame.cancel(); 2034 const element = resolveRef(elementOrRef); 2035 if (element == null) { 2036 return; 2037 } 2038 const resolvedElement = element; 2039 const done = () => { 2040 ReactDOM.flushSync(fnToExecute); 2041 }; 2042 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 2043 fnToExecute(); 2044 return; 2045 } 2046 function exec() { 2047 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { 2048 if (!signal?.aborted) { 2049 done(); 2050 } 2051 }).catch(() => { 2052 if (treatAbortedAsFinished) { 2053 if (!signal?.aborted) { 2054 done(); 2055 } 2056 return; 2057 } 2058 const currentAnimations = resolvedElement.getAnimations(); 2059 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 2060 exec(); 2061 } 2062 }); 2063 } 2064 if (waitForStartingStyleRemoved) { 2065 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; 2066 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 2067 frame.request(exec); 2068 return; 2069 } 2070 const attributeObserver = new MutationObserver(() => { 2071 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 2072 attributeObserver.disconnect(); 2073 exec(); 2074 } 2075 }); 2076 attributeObserver.observe(resolvedElement, { 2077 attributes: true, 2078 attributeFilter: [startingStyleAttribute] 2079 }); 2080 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 2081 once: true 2082 }); 2083 return; 2084 } 2085 frame.request(exec); 2086 }); 2087 } 2088 2089 // node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js 2090 function useOpenChangeComplete(parameters) { 2091 const { 2092 enabled = true, 2093 open, 2094 ref, 2095 onComplete: onCompleteParam 2096 } = parameters; 2097 const onComplete = useStableCallback(onCompleteParam); 2098 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); 2099 React15.useEffect(() => { 2100 if (!enabled) { 2101 return void 0; 2102 } 2103 const abortController = new AbortController(); 2104 runOnceAnimationsFinish(onComplete, abortController.signal); 2105 return () => { 2106 abortController.abort(); 2107 }; 2108 }, [enabled, open, onComplete, runOnceAnimationsFinish]); 2109 } 2110 2111 // node_modules/@base-ui/utils/esm/useOnFirstRender.js 2112 var React16 = __toESM(require_react(), 1); 2113 function useOnFirstRender(fn) { 2114 const ref = React16.useRef(true); 2115 if (ref.current) { 2116 ref.current = false; 2117 fn(); 2118 } 2119 } 2120 2121 // node_modules/@base-ui/utils/esm/useTimeout.js 2122 var EMPTY3 = 0; 2123 var Timeout = class _Timeout { 2124 static create() { 2125 return new _Timeout(); 2126 } 2127 currentId = EMPTY3; 2128 /** 2129 * Executes `fn` after `delay`, clearing any previously scheduled call. 2130 */ 2131 start(delay, fn) { 2132 this.clear(); 2133 this.currentId = setTimeout(() => { 2134 this.currentId = EMPTY3; 2135 fn(); 2136 }, delay); 2137 } 2138 isStarted() { 2139 return this.currentId !== EMPTY3; 2140 } 2141 clear = () => { 2142 if (this.currentId !== EMPTY3) { 2143 clearTimeout(this.currentId); 2144 this.currentId = EMPTY3; 2145 } 2146 }; 2147 disposeEffect = () => { 2148 return this.clear; 2149 }; 2150 }; 2151 function useTimeout() { 2152 const timeout = useRefWithInit(Timeout.create).current; 2153 useOnMount(timeout.disposeEffect); 2154 return timeout; 2155 } 2156 2157 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js 2158 var React17 = __toESM(require_react(), 1); 2159 2160 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverShared.js 2161 function resolveValue(value, pointerType) { 2162 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 2163 return 0; 2164 } 2165 if (typeof value === "function") { 2166 return value(); 2167 } 2168 return value; 2169 } 2170 function getDelay(value, prop, pointerType) { 2171 const result = resolveValue(value, pointerType); 2172 if (typeof result === "number") { 2173 return result; 2174 } 2175 return result?.[prop]; 2176 } 2177 function getRestMs(value) { 2178 if (typeof value === "function") { 2179 return value(); 2180 } 2181 return value; 2182 } 2183 function isClickLikeOpenEvent(openEventType, interactedInside) { 2184 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 2185 } 2186 function isHoverOpenEvent(openEventType) { 2187 return openEventType?.includes("mouse") && openEventType !== "mousedown"; 2188 } 2189 2190 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js 2191 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 2192 var FloatingDelayGroupContext = /* @__PURE__ */ React17.createContext({ 2193 hasProvider: false, 2194 timeoutMs: 0, 2195 delayRef: { 2196 current: 0 2197 }, 2198 initialDelayRef: { 2199 current: 0 2200 }, 2201 timeout: new Timeout(), 2202 currentIdRef: { 2203 current: null 2204 }, 2205 currentContextRef: { 2206 current: null 2207 } 2208 }); 2209 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 2210 function FloatingDelayGroup(props) { 2211 const { 2212 children, 2213 delay, 2214 timeoutMs = 0 2215 } = props; 2216 const delayRef = React17.useRef(delay); 2217 const initialDelayRef = React17.useRef(delay); 2218 const currentIdRef = React17.useRef(null); 2219 const currentContextRef = React17.useRef(null); 2220 const timeout = useTimeout(); 2221 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { 2222 value: React17.useMemo(() => ({ 2223 hasProvider: true, 2224 delayRef, 2225 initialDelayRef, 2226 currentIdRef, 2227 timeoutMs, 2228 currentContextRef, 2229 timeout 2230 }), [timeoutMs, timeout]), 2231 children 2232 }); 2233 } 2234 function useDelayGroup(context, options = { 2235 open: false 2236 }) { 2237 const { 2238 open 2239 } = options; 2240 const store2 = "rootStore" in context ? context.rootStore : context; 2241 const floatingId = store2.useState("floatingId"); 2242 const groupContext = React17.useContext(FloatingDelayGroupContext); 2243 const { 2244 currentIdRef, 2245 delayRef, 2246 timeoutMs, 2247 initialDelayRef, 2248 currentContextRef, 2249 hasProvider, 2250 timeout 2251 } = groupContext; 2252 const [isInstantPhase, setIsInstantPhase] = React17.useState(false); 2253 useIsoLayoutEffect(() => { 2254 function unset() { 2255 setIsInstantPhase(false); 2256 currentContextRef.current?.setIsInstantPhase(false); 2257 currentIdRef.current = null; 2258 currentContextRef.current = null; 2259 delayRef.current = initialDelayRef.current; 2260 } 2261 if (!currentIdRef.current) { 2262 return void 0; 2263 } 2264 if (!open && currentIdRef.current === floatingId) { 2265 setIsInstantPhase(false); 2266 if (timeoutMs) { 2267 const closingId = floatingId; 2268 timeout.start(timeoutMs, () => { 2269 if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 2270 return; 2271 } 2272 unset(); 2273 }); 2274 return () => { 2275 timeout.clear(); 2276 }; 2277 } 2278 unset(); 2279 } 2280 return void 0; 2281 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]); 2282 useIsoLayoutEffect(() => { 2283 if (!open) { 2284 return; 2285 } 2286 const prevContext = currentContextRef.current; 2287 const prevId = currentIdRef.current; 2288 timeout.clear(); 2289 currentContextRef.current = { 2290 onOpenChange: store2.setOpen, 2291 setIsInstantPhase 2292 }; 2293 currentIdRef.current = floatingId; 2294 delayRef.current = { 2295 open: 0, 2296 close: getDelay(initialDelayRef.current, "close") 2297 }; 2298 if (prevId !== null && prevId !== floatingId) { 2299 setIsInstantPhase(true); 2300 prevContext?.setIsInstantPhase(true); 2301 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 2302 } else { 2303 setIsInstantPhase(false); 2304 prevContext?.setIsInstantPhase(false); 2305 } 2306 }, [open, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); 2307 useIsoLayoutEffect(() => { 2308 return () => { 2309 currentContextRef.current = null; 2310 }; 2311 }, [currentContextRef]); 2312 return React17.useMemo(() => ({ 2313 hasProvider, 2314 delayRef, 2315 isInstantPhase 2316 }), [hasProvider, delayRef, isInstantPhase]); 2317 } 2318 2319 // node_modules/@base-ui/utils/esm/mergeCleanups.js 2320 function mergeCleanups(...cleanups) { 2321 return () => { 2322 for (let i = 0; i < cleanups.length; i += 1) { 2323 const cleanup = cleanups[i]; 2324 if (cleanup) { 2325 cleanup(); 2326 } 2327 } 2328 }; 2329 } 2330 2331 // node_modules/@base-ui/react/esm/utils/FocusGuard.js 2332 var React18 = __toESM(require_react(), 1); 2333 2334 // node_modules/@base-ui/utils/esm/visuallyHidden.js 2335 var visuallyHiddenBase = { 2336 clipPath: "inset(50%)", 2337 overflow: "hidden", 2338 whiteSpace: "nowrap", 2339 border: 0, 2340 padding: 0, 2341 width: 1, 2342 height: 1, 2343 margin: -1 2344 }; 2345 var visuallyHidden = { 2346 ...visuallyHiddenBase, 2347 position: "fixed", 2348 top: 0, 2349 left: 0 2350 }; 2351 var visuallyHiddenInput = { 2352 ...visuallyHiddenBase, 2353 position: "absolute" 2354 }; 2355 2356 // node_modules/@base-ui/react/esm/utils/FocusGuard.js 2357 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 2358 var FocusGuard = /* @__PURE__ */ React18.forwardRef(function FocusGuard2(props, ref) { 2359 const [role, setRole] = React18.useState(); 2360 useIsoLayoutEffect(() => { 2361 if (isSafari) { 2362 setRole("button"); 2363 } 2364 }, []); 2365 const restProps = { 2366 tabIndex: 0, 2367 // Role is only for VoiceOver 2368 role 2369 }; 2370 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { 2371 ...props, 2372 ref, 2373 style: visuallyHidden, 2374 "aria-hidden": role ? void 0 : true, 2375 ...restProps, 2376 "data-base-ui-focus-guard": "" 2377 }); 2378 }); 2379 if (true) FocusGuard.displayName = "FocusGuard"; 2380 2381 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createAttribute.js 2382 function createAttribute(name) { 2383 return `data-base-ui-$name}`; 2384 } 2385 2386 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js 2387 var React19 = __toESM(require_react(), 1); 2388 var ReactDOM2 = __toESM(require_react_dom(), 1); 2389 2390 // node_modules/@base-ui/react/esm/internals/constants.js 2391 var DISABLED_TRANSITIONS_STYLE = { 2392 style: { 2393 transition: "none" 2394 } 2395 }; 2396 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 2397 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 2398 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 2399 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 2400 var POPUP_COLLISION_AVOIDANCE = { 2401 fallbackAxisSide: "end" 2402 }; 2403 var ownerVisuallyHidden = { 2404 clipPath: "inset(50%)", 2405 position: "fixed", 2406 top: 0, 2407 left: 0 2408 }; 2409 2410 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js 2411 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 2412 var PortalContext = /* @__PURE__ */ React19.createContext(null); 2413 if (true) PortalContext.displayName = "PortalContext"; 2414 var usePortalContext = () => React19.useContext(PortalContext); 2415 var attr = createAttribute("portal"); 2416 function useFloatingPortalNode(props = {}) { 2417 const { 2418 ref, 2419 container: containerProp, 2420 componentProps = EMPTY_OBJECT, 2421 elementProps 2422 } = props; 2423 const uniqueId = useId(); 2424 const portalContext = usePortalContext(); 2425 const parentPortalNode = portalContext?.portalNode; 2426 const [containerElement, setContainerElement] = React19.useState(null); 2427 const [portalNode, setPortalNode] = React19.useState(null); 2428 const setPortalNodeRef = useStableCallback((node) => { 2429 if (node !== null) { 2430 setPortalNode(node); 2431 } 2432 }); 2433 const containerRef = React19.useRef(null); 2434 useIsoLayoutEffect(() => { 2435 if (containerProp === null) { 2436 if (containerRef.current) { 2437 containerRef.current = null; 2438 setPortalNode(null); 2439 setContainerElement(null); 2440 } 2441 return; 2442 } 2443 if (uniqueId == null) { 2444 return; 2445 } 2446 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 2447 if (resolvedContainer == null) { 2448 if (containerRef.current) { 2449 containerRef.current = null; 2450 setPortalNode(null); 2451 setContainerElement(null); 2452 } 2453 return; 2454 } 2455 if (containerRef.current !== resolvedContainer) { 2456 containerRef.current = resolvedContainer; 2457 setPortalNode(null); 2458 setContainerElement(resolvedContainer); 2459 } 2460 }, [containerProp, parentPortalNode, uniqueId]); 2461 const portalElement = useRenderElement("div", componentProps, { 2462 ref: [ref, setPortalNodeRef], 2463 props: [{ 2464 id: uniqueId, 2465 [attr]: "" 2466 }, elementProps] 2467 }); 2468 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 2469 return { 2470 portalNode, 2471 portalSubtree 2472 }; 2473 } 2474 var FloatingPortal = /* @__PURE__ */ React19.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 2475 const { 2476 render, 2477 className, 2478 style, 2479 children, 2480 container, 2481 renderGuards, 2482 ...elementProps 2483 } = componentProps; 2484 const { 2485 portalNode, 2486 portalSubtree 2487 } = useFloatingPortalNode({ 2488 container, 2489 ref: forwardedRef, 2490 componentProps, 2491 elementProps 2492 }); 2493 const beforeOutsideRef = React19.useRef(null); 2494 const afterOutsideRef = React19.useRef(null); 2495 const beforeInsideRef = React19.useRef(null); 2496 const afterInsideRef = React19.useRef(null); 2497 const [focusManagerState, setFocusManagerState] = React19.useState(null); 2498 const focusInsideDisabledRef = React19.useRef(false); 2499 const modal = focusManagerState?.modal; 2500 const open = focusManagerState?.open; 2501 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 2502 React19.useEffect(() => { 2503 if (!portalNode || modal) { 2504 return void 0; 2505 } 2506 function onFocus(event) { 2507 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 2508 if (event.type === "focusin") { 2509 if (focusInsideDisabledRef.current) { 2510 enableFocusInside(portalNode); 2511 focusInsideDisabledRef.current = false; 2512 } 2513 } else { 2514 disableFocusInside(portalNode); 2515 focusInsideDisabledRef.current = true; 2516 } 2517 } 2518 } 2519 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 2520 }, [portalNode, modal]); 2521 React19.useEffect(() => { 2522 if (!portalNode || open !== false) { 2523 return; 2524 } 2525 enableFocusInside(portalNode); 2526 focusInsideDisabledRef.current = false; 2527 }, [open, portalNode]); 2528 const portalContextValue = React19.useMemo(() => ({ 2529 beforeOutsideRef, 2530 afterOutsideRef, 2531 beforeInsideRef, 2532 afterInsideRef, 2533 portalNode, 2534 setFocusManagerState 2535 }), [portalNode]); 2536 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React19.Fragment, { 2537 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { 2538 value: portalContextValue, 2539 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 2540 "data-type": "outside", 2541 ref: beforeOutsideRef, 2542 onFocus: (event) => { 2543 if (isOutsideEvent(event, portalNode)) { 2544 beforeInsideRef.current?.focus(); 2545 } else { 2546 const domReference = focusManagerState ? focusManagerState.domReference : null; 2547 const prevTabbable = getPreviousTabbable(domReference); 2548 prevTabbable?.focus(); 2549 } 2550 } 2551 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { 2552 "aria-owns": portalNode.id, 2553 style: ownerVisuallyHidden 2554 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 2555 "data-type": "outside", 2556 ref: afterOutsideRef, 2557 onFocus: (event) => { 2558 if (isOutsideEvent(event, portalNode)) { 2559 afterInsideRef.current?.focus(); 2560 } else { 2561 const domReference = focusManagerState ? focusManagerState.domReference : null; 2562 const nextTabbable = getNextTabbable(domReference); 2563 nextTabbable?.focus(); 2564 if (focusManagerState?.closeOnFocusOut) { 2565 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 2566 } 2567 } 2568 } 2569 })] 2570 })] 2571 }); 2572 }); 2573 if (true) FloatingPortal.displayName = "FloatingPortal"; 2574 2575 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js 2576 var React20 = __toESM(require_react(), 1); 2577 2578 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createEventEmitter.js 2579 function createEventEmitter() { 2580 const map = /* @__PURE__ */ new Map(); 2581 return { 2582 emit(event, data) { 2583 map.get(event)?.forEach((listener) => listener(data)); 2584 }, 2585 on(event, listener) { 2586 if (!map.has(event)) { 2587 map.set(event, /* @__PURE__ */ new Set()); 2588 } 2589 map.get(event).add(listener); 2590 }, 2591 off(event, listener) { 2592 map.get(event)?.delete(listener); 2593 } 2594 }; 2595 } 2596 2597 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js 2598 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 2599 var FloatingNodeContext = /* @__PURE__ */ React20.createContext(null); 2600 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 2601 var FloatingTreeContext = /* @__PURE__ */ React20.createContext(null); 2602 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 2603 var useFloatingParentNodeId = () => React20.useContext(FloatingNodeContext)?.id || null; 2604 var useFloatingTree = (externalTree) => { 2605 const contextTree = React20.useContext(FloatingTreeContext); 2606 return externalTree ?? contextTree; 2607 }; 2608 2609 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useClientPoint.js 2610 var React21 = __toESM(require_react(), 1); 2611 function createVirtualElement(domElement, data) { 2612 let offsetX = null; 2613 let offsetY = null; 2614 let isAutoUpdateEvent = false; 2615 return { 2616 contextElement: domElement || void 0, 2617 getBoundingClientRect() { 2618 const domRect = domElement?.getBoundingClientRect() || { 2619 width: 0, 2620 height: 0, 2621 x: 0, 2622 y: 0 2623 }; 2624 const isXAxis = data.axis === "x" || data.axis === "both"; 2625 const isYAxis = data.axis === "y" || data.axis === "both"; 2626 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 2627 let width = domRect.width; 2628 let height = domRect.height; 2629 let x = domRect.x; 2630 let y = domRect.y; 2631 if (offsetX == null && data.x && isXAxis) { 2632 offsetX = domRect.x - data.x; 2633 } 2634 if (offsetY == null && data.y && isYAxis) { 2635 offsetY = domRect.y - data.y; 2636 } 2637 x -= offsetX || 0; 2638 y -= offsetY || 0; 2639 width = 0; 2640 height = 0; 2641 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 2642 width = data.axis === "y" ? domRect.width : 0; 2643 height = data.axis === "x" ? domRect.height : 0; 2644 x = isXAxis && data.x != null ? data.x : x; 2645 y = isYAxis && data.y != null ? data.y : y; 2646 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 2647 height = data.axis === "x" ? domRect.height : height; 2648 width = data.axis === "y" ? domRect.width : width; 2649 } 2650 isAutoUpdateEvent = true; 2651 return { 2652 width, 2653 height, 2654 x, 2655 y, 2656 top: y, 2657 right: x + width, 2658 bottom: y + height, 2659 left: x 2660 }; 2661 } 2662 }; 2663 } 2664 function isMouseBasedEvent(event) { 2665 return event != null && event.clientX != null; 2666 } 2667 function useClientPoint(context, props = {}) { 2668 const { 2669 enabled = true, 2670 axis = "both" 2671 } = props; 2672 const store2 = "rootStore" in context ? context.rootStore : context; 2673 const open = store2.useState("open"); 2674 const floating = store2.useState("floatingElement"); 2675 const domReference = store2.useState("domReferenceElement"); 2676 const dataRef = store2.context.dataRef; 2677 const initialRef = React21.useRef(false); 2678 const cleanupListenerRef = React21.useRef(null); 2679 const [pointerType, setPointerType] = React21.useState(); 2680 const [reactive, setReactive] = React21.useState([]); 2681 const resetReference = useStableCallback((reference2) => { 2682 store2.set("positionReference", reference2); 2683 }); 2684 const setReference = useStableCallback((newX, newY, referenceElement) => { 2685 if (initialRef.current) { 2686 return; 2687 } 2688 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 2689 return; 2690 } 2691 store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 2692 x: newX, 2693 y: newY, 2694 axis, 2695 dataRef, 2696 pointerType 2697 })); 2698 }); 2699 const handleReferenceEnterOrMove = useStableCallback((event) => { 2700 if (!open) { 2701 setReference(event.clientX, event.clientY, event.currentTarget); 2702 } else if (!cleanupListenerRef.current) { 2703 setReference(event.clientX, event.clientY, event.currentTarget); 2704 setReactive([]); 2705 } 2706 }); 2707 const openCheck = isMouseLikePointerType(pointerType) ? floating : open; 2708 React21.useEffect(() => { 2709 if (!enabled) { 2710 resetReference(domReference); 2711 return void 0; 2712 } 2713 if (!openCheck) { 2714 return void 0; 2715 } 2716 function cleanupListener() { 2717 cleanupListenerRef.current?.(); 2718 cleanupListenerRef.current = null; 2719 } 2720 const win = getWindow(floating); 2721 function handleMouseMove(event) { 2722 const target = getTarget(event); 2723 if (!contains(floating, target)) { 2724 setReference(event.clientX, event.clientY); 2725 } else { 2726 cleanupListener(); 2727 } 2728 } 2729 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 2730 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 2731 } else { 2732 resetReference(domReference); 2733 } 2734 return cleanupListener; 2735 }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]); 2736 React21.useEffect(() => () => { 2737 store2.set("positionReference", null); 2738 }, [store2]); 2739 React21.useEffect(() => { 2740 if (enabled && !floating) { 2741 initialRef.current = false; 2742 } 2743 }, [enabled, floating]); 2744 React21.useEffect(() => { 2745 if (!enabled && open) { 2746 initialRef.current = true; 2747 } 2748 }, [enabled, open]); 2749 const reference = React21.useMemo(() => { 2750 function setPointerTypeRef(event) { 2751 setPointerType(event.pointerType); 2752 } 2753 return { 2754 onPointerDown: setPointerTypeRef, 2755 onPointerEnter: setPointerTypeRef, 2756 onMouseMove: handleReferenceEnterOrMove, 2757 onMouseEnter: handleReferenceEnterOrMove 2758 }; 2759 }, [handleReferenceEnterOrMove]); 2760 return React21.useMemo(() => enabled ? { 2761 reference, 2762 trigger: reference 2763 } : {}, [enabled, reference]); 2764 } 2765 2766 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useDismiss.js 2767 var React22 = __toESM(require_react(), 1); 2768 var bubbleHandlerKeys = { 2769 intentional: "onClick", 2770 sloppy: "onPointerDown" 2771 }; 2772 function alwaysFalse() { 2773 return false; 2774 } 2775 function normalizeProp(normalizable) { 2776 return { 2777 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 2778 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 2779 }; 2780 } 2781 function useDismiss(context, props = {}) { 2782 const { 2783 enabled = true, 2784 escapeKey: escapeKey2 = true, 2785 outsidePress: outsidePressProp = true, 2786 outsidePressEvent = "sloppy", 2787 referencePress = alwaysFalse, 2788 referencePressEvent = "sloppy", 2789 bubbles, 2790 externalTree 2791 } = props; 2792 const store2 = "rootStore" in context ? context.rootStore : context; 2793 const open = store2.useState("open"); 2794 const floatingElement = store2.useState("floatingElement"); 2795 const { 2796 dataRef 2797 } = store2.context; 2798 const tree = useFloatingTree(externalTree); 2799 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 2800 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 2801 const outsidePressEnabled = outsidePress2 !== false; 2802 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 2803 const { 2804 escapeKey: escapeKeyBubbles, 2805 outsidePress: outsidePressBubbles 2806 } = normalizeProp(bubbles); 2807 const pressStartedInsideRef = React22.useRef(false); 2808 const pressStartPreventedRef = React22.useRef(false); 2809 const suppressNextOutsideClickRef = React22.useRef(false); 2810 const isComposingRef = React22.useRef(false); 2811 const currentPointerTypeRef = React22.useRef(""); 2812 const touchStateRef = React22.useRef(null); 2813 const cancelDismissOnEndTimeout = useTimeout(); 2814 const clearInsideReactTreeTimeout = useTimeout(); 2815 const clearInsideReactTree = useStableCallback(() => { 2816 clearInsideReactTreeTimeout.clear(); 2817 dataRef.current.insideReactTree = false; 2818 }); 2819 const hasBlockingChild = useStableCallback((bubbleKey) => { 2820 const nodeId = dataRef.current.floatingContext?.nodeId; 2821 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 2822 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); 2823 }); 2824 const isEventWithinOwnElements = useStableCallback((event) => { 2825 return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement")); 2826 }); 2827 const closeOnReferencePress = useStableCallback((event) => { 2828 if (!referencePress()) { 2829 return; 2830 } 2831 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 2832 }); 2833 const closeOnEscapeKeyDown = useStableCallback((event) => { 2834 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") { 2835 return; 2836 } 2837 if (isComposingRef.current) { 2838 return; 2839 } 2840 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { 2841 return; 2842 } 2843 const native = isReactEvent(event) ? event.nativeEvent : event; 2844 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 2845 store2.setOpen(false, eventDetails); 2846 if (!eventDetails.isCanceled) { 2847 event.preventDefault(); 2848 } 2849 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 2850 event.stopPropagation(); 2851 } 2852 }); 2853 const markInsideReactTree = useStableCallback(() => { 2854 dataRef.current.insideReactTree = true; 2855 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 2856 }); 2857 const markPressStartedInsideReactTree = useStableCallback((event) => { 2858 if (!open || !enabled || event.button !== 0) { 2859 return; 2860 } 2861 const target = getTarget(event.nativeEvent); 2862 if (!contains(store2.select("floatingElement"), target)) { 2863 return; 2864 } 2865 if (!pressStartedInsideRef.current) { 2866 pressStartedInsideRef.current = true; 2867 pressStartPreventedRef.current = false; 2868 } 2869 }); 2870 const markInsidePressStartPrevented = useStableCallback((event) => { 2871 if (!open || !enabled) { 2872 return; 2873 } 2874 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 2875 return; 2876 } 2877 if (pressStartedInsideRef.current) { 2878 pressStartPreventedRef.current = true; 2879 } 2880 }); 2881 React22.useEffect(() => { 2882 if (!open || !enabled) { 2883 return void 0; 2884 } 2885 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 2886 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 2887 const compositionTimeout = new Timeout(); 2888 const preventedPressSuppressionTimeout = new Timeout(); 2889 function handleCompositionStart() { 2890 compositionTimeout.clear(); 2891 isComposingRef.current = true; 2892 } 2893 function handleCompositionEnd() { 2894 compositionTimeout.start( 2895 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 2896 // Only apply to WebKit for the test to remain 0ms. 2897 isWebKit() ? 5 : 0, 2898 () => { 2899 isComposingRef.current = false; 2900 } 2901 ); 2902 } 2903 function suppressImmediateOutsideClickAfterPreventedStart() { 2904 suppressNextOutsideClickRef.current = true; 2905 preventedPressSuppressionTimeout.start(0, () => { 2906 suppressNextOutsideClickRef.current = false; 2907 }); 2908 } 2909 function resetPressStartState() { 2910 pressStartedInsideRef.current = false; 2911 pressStartPreventedRef.current = false; 2912 } 2913 function getOutsidePressEvent() { 2914 const type = currentPointerTypeRef.current; 2915 const computedType = type === "pen" || !type ? "mouse" : type; 2916 const outsidePressEventValue = getOutsidePressEventProp(); 2917 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 2918 if (typeof resolved === "string") { 2919 return resolved; 2920 } 2921 return resolved[computedType]; 2922 } 2923 function shouldIgnoreEvent(event) { 2924 const computedOutsidePressEvent = getOutsidePressEvent(); 2925 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 2926 } 2927 function isEventWithinFloatingTree(event) { 2928 const nodeId = dataRef.current.floatingContext?.nodeId; 2929 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 2930 return isEventWithinOwnElements(event) || targetIsInsideChildren; 2931 } 2932 function closeOnPressOutside(event) { 2933 if (shouldIgnoreEvent(event)) { 2934 if (event.type !== "click" && !isEventWithinOwnElements(event)) { 2935 preventedPressSuppressionTimeout.clear(); 2936 suppressNextOutsideClickRef.current = false; 2937 } 2938 clearInsideReactTree(); 2939 return; 2940 } 2941 if (dataRef.current.insideReactTree) { 2942 clearInsideReactTree(); 2943 return; 2944 } 2945 const target = getTarget(event); 2946 const inertSelector = `[$createAttribute("inert")}]`; 2947 const targetRoot = isElement(target) ? target.getRootNode() : null; 2948 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector)); 2949 const triggers = store2.context.triggerElements; 2950 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 2951 return; 2952 } 2953 let targetRootAncestor = isElement(target) ? target : null; 2954 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 2955 const nextParent = getParentNode(targetRootAncestor); 2956 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 2957 break; 2958 } 2959 targetRootAncestor = nextParent; 2960 } 2961 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 2962 !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the 2963 // element was injected after the floating element rendered. 2964 markers.every((marker) => !contains(targetRootAncestor, marker))) { 2965 return; 2966 } 2967 if (isHTMLElement(target) && !("touches" in event)) { 2968 const lastTraversableNode = isLastTraversableNode(target); 2969 const style = getComputedStyle2(target); 2970 const scrollRe = /auto|scroll/; 2971 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 2972 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 2973 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 2974 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 2975 const isRTL2 = style.direction === "rtl"; 2976 const pressedVerticalScrollbar = canScrollY && (isRTL2 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 2977 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 2978 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 2979 return; 2980 } 2981 } 2982 if (isEventWithinFloatingTree(event)) { 2983 return; 2984 } 2985 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) { 2986 preventedPressSuppressionTimeout.clear(); 2987 suppressNextOutsideClickRef.current = false; 2988 return; 2989 } 2990 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 2991 return; 2992 } 2993 if (hasBlockingChild("__outsidePressBubbles")) { 2994 return; 2995 } 2996 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 2997 clearInsideReactTree(); 2998 } 2999 function handlePointerDown(event) { 3000 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { 3001 return; 3002 } 3003 closeOnPressOutside(event); 3004 } 3005 function handleTouchStart(event) { 3006 if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { 3007 return; 3008 } 3009 const touch = event.touches[0]; 3010 if (touch) { 3011 touchStateRef.current = { 3012 startTime: Date.now(), 3013 startX: touch.clientX, 3014 startY: touch.clientY, 3015 dismissOnTouchEnd: false, 3016 dismissOnMouseDown: true 3017 }; 3018 cancelDismissOnEndTimeout.start(1e3, () => { 3019 if (touchStateRef.current) { 3020 touchStateRef.current.dismissOnTouchEnd = false; 3021 touchStateRef.current.dismissOnMouseDown = false; 3022 } 3023 }); 3024 } 3025 } 3026 function addTargetEventListenerOnce(event, listener) { 3027 const target = getTarget(event); 3028 if (!target) { 3029 return; 3030 } 3031 const unsubscribe2 = addEventListener(target, event.type, () => { 3032 listener(event); 3033 unsubscribe2(); 3034 }); 3035 } 3036 function handleTouchStartCapture(event) { 3037 currentPointerTypeRef.current = "touch"; 3038 addTargetEventListenerOnce(event, handleTouchStart); 3039 } 3040 function closeOnPressOutsideCapture(event) { 3041 cancelDismissOnEndTimeout.clear(); 3042 if (event.type === "pointerdown") { 3043 currentPointerTypeRef.current = event.pointerType; 3044 } 3045 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 3046 return; 3047 } 3048 addTargetEventListenerOnce(event, (targetEvent) => { 3049 if (targetEvent.type === "pointerdown") { 3050 handlePointerDown(targetEvent); 3051 } else { 3052 closeOnPressOutside(targetEvent); 3053 } 3054 }); 3055 } 3056 function handlePressEndCapture(event) { 3057 if (!pressStartedInsideRef.current) { 3058 return; 3059 } 3060 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 3061 resetPressStartState(); 3062 if (getOutsidePressEvent() !== "intentional") { 3063 return; 3064 } 3065 if (event.type === "pointercancel") { 3066 if (pressStartedInsideDefaultPrevented) { 3067 suppressImmediateOutsideClickAfterPreventedStart(); 3068 } 3069 return; 3070 } 3071 if (isEventWithinFloatingTree(event)) { 3072 return; 3073 } 3074 if (pressStartedInsideDefaultPrevented) { 3075 suppressImmediateOutsideClickAfterPreventedStart(); 3076 return; 3077 } 3078 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 3079 return; 3080 } 3081 preventedPressSuppressionTimeout.clear(); 3082 suppressNextOutsideClickRef.current = true; 3083 clearInsideReactTree(); 3084 } 3085 function handleTouchMove(event) { 3086 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 3087 return; 3088 } 3089 const touch = event.touches[0]; 3090 if (!touch) { 3091 return; 3092 } 3093 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 3094 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 3095 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 3096 if (distance > 5) { 3097 touchStateRef.current.dismissOnTouchEnd = true; 3098 } 3099 if (distance > 10) { 3100 closeOnPressOutside(event); 3101 cancelDismissOnEndTimeout.clear(); 3102 touchStateRef.current = null; 3103 } 3104 } 3105 function handleTouchMoveCapture(event) { 3106 addTargetEventListenerOnce(event, handleTouchMove); 3107 } 3108 function handleTouchEnd(event) { 3109 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 3110 return; 3111 } 3112 if (touchStateRef.current.dismissOnTouchEnd) { 3113 closeOnPressOutside(event); 3114 } 3115 cancelDismissOnEndTimeout.clear(); 3116 touchStateRef.current = null; 3117 } 3118 function handleTouchEndCapture(event) { 3119 addTargetEventListenerOnce(event, handleTouchEnd); 3120 } 3121 const doc = ownerDocument(floatingElement); 3122 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))); 3123 return () => { 3124 unsubscribe(); 3125 compositionTimeout.clear(); 3126 preventedPressSuppressionTimeout.clear(); 3127 resetPressStartState(); 3128 suppressNextOutsideClickRef.current = false; 3129 }; 3130 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout]); 3131 React22.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]); 3132 const reference = React22.useMemo(() => ({ 3133 onKeyDown: closeOnEscapeKeyDown, 3134 [bubbleHandlerKeys[referencePressEvent]]: closeOnReferencePress, 3135 ...referencePressEvent !== "intentional" && { 3136 onClick: closeOnReferencePress 3137 } 3138 }), [closeOnEscapeKeyDown, closeOnReferencePress, referencePressEvent]); 3139 const floating = React22.useMemo(() => ({ 3140 onKeyDown: closeOnEscapeKeyDown, 3141 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 3142 // `onPointerDown`, such as with <NumberField.ScrubArea>. 3143 // See https://github.com/mui/base-ui/pull/3379 3144 onPointerDown: markInsidePressStartPrevented, 3145 onMouseDown: markInsidePressStartPrevented, 3146 onClickCapture: markInsideReactTree, 3147 onMouseDownCapture(event) { 3148 markInsideReactTree(); 3149 markPressStartedInsideReactTree(event); 3150 }, 3151 onPointerDownCapture(event) { 3152 markInsideReactTree(); 3153 markPressStartedInsideReactTree(event); 3154 }, 3155 onMouseUpCapture: markInsideReactTree, 3156 onTouchEndCapture: markInsideReactTree, 3157 onTouchMoveCapture: markInsideReactTree 3158 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 3159 return React22.useMemo(() => enabled ? { 3160 reference, 3161 floating, 3162 trigger: reference 3163 } : {}, [enabled, reference, floating]); 3164 } 3165 3166 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js 3167 var React29 = __toESM(require_react(), 1); 3168 3169 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs 3170 function computeCoordsFromPlacement(_ref, placement, rtl) { 3171 let { 3172 reference, 3173 floating 3174 } = _ref; 3175 const sideAxis = getSideAxis(placement); 3176 const alignmentAxis = getAlignmentAxis(placement); 3177 const alignLength = getAxisLength(alignmentAxis); 3178 const side = getSide(placement); 3179 const isVertical = sideAxis === "y"; 3180 const commonX = reference.x + reference.width / 2 - floating.width / 2; 3181 const commonY = reference.y + reference.height / 2 - floating.height / 2; 3182 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 3183 let coords; 3184 switch (side) { 3185 case "top": 3186 coords = { 3187 x: commonX, 3188 y: reference.y - floating.height 3189 }; 3190 break; 3191 case "bottom": 3192 coords = { 3193 x: commonX, 3194 y: reference.y + reference.height 3195 }; 3196 break; 3197 case "right": 3198 coords = { 3199 x: reference.x + reference.width, 3200 y: commonY 3201 }; 3202 break; 3203 case "left": 3204 coords = { 3205 x: reference.x - floating.width, 3206 y: commonY 3207 }; 3208 break; 3209 default: 3210 coords = { 3211 x: reference.x, 3212 y: reference.y 3213 }; 3214 } 3215 switch (getAlignment(placement)) { 3216 case "start": 3217 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 3218 break; 3219 case "end": 3220 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 3221 break; 3222 } 3223 return coords; 3224 } 3225 async function detectOverflow(state, options) { 3226 var _await$platform$isEle; 3227 if (options === void 0) { 3228 options = {}; 3229 } 3230 const { 3231 x, 3232 y, 3233 platform: platform3, 3234 rects, 3235 elements, 3236 strategy 3237 } = state; 3238 const { 3239 boundary = "clippingAncestors", 3240 rootBoundary = "viewport", 3241 elementContext = "floating", 3242 altBoundary = false, 3243 padding = 0 3244 } = evaluate(options, state); 3245 const paddingObject = getPaddingObject(padding); 3246 const altContext = elementContext === "floating" ? "reference" : "floating"; 3247 const element = elements[altBoundary ? altContext : elementContext]; 3248 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 3249 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)), 3250 boundary, 3251 rootBoundary, 3252 strategy 3253 })); 3254 const rect = elementContext === "floating" ? { 3255 x, 3256 y, 3257 width: rects.floating.width, 3258 height: rects.floating.height 3259 } : rects.reference; 3260 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); 3261 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 3262 x: 1, 3263 y: 1 3264 } : { 3265 x: 1, 3266 y: 1 3267 }; 3268 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 3269 elements, 3270 rect, 3271 offsetParent, 3272 strategy 3273 }) : rect); 3274 return { 3275 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 3276 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 3277 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 3278 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 3279 }; 3280 } 3281 var MAX_RESET_COUNT = 50; 3282 var computePosition = async (reference, floating, config) => { 3283 const { 3284 placement = "bottom", 3285 strategy = "absolute", 3286 middleware = [], 3287 platform: platform3 3288 } = config; 3289 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 3290 ...platform3, 3291 detectOverflow 3292 }; 3293 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 3294 let rects = await platform3.getElementRects({ 3295 reference, 3296 floating, 3297 strategy 3298 }); 3299 let { 3300 x, 3301 y 3302 } = computeCoordsFromPlacement(rects, placement, rtl); 3303 let statefulPlacement = placement; 3304 let resetCount = 0; 3305 const middlewareData = {}; 3306 for (let i = 0; i < middleware.length; i++) { 3307 const currentMiddleware = middleware[i]; 3308 if (!currentMiddleware) { 3309 continue; 3310 } 3311 const { 3312 name, 3313 fn 3314 } = currentMiddleware; 3315 const { 3316 x: nextX, 3317 y: nextY, 3318 data, 3319 reset 3320 } = await fn({ 3321 x, 3322 y, 3323 initialPlacement: placement, 3324 placement: statefulPlacement, 3325 strategy, 3326 middlewareData, 3327 rects, 3328 platform: platformWithDetectOverflow, 3329 elements: { 3330 reference, 3331 floating 3332 } 3333 }); 3334 x = nextX != null ? nextX : x; 3335 y = nextY != null ? nextY : y; 3336 middlewareData[name] = { 3337 ...middlewareData[name], 3338 ...data 3339 }; 3340 if (reset && resetCount < MAX_RESET_COUNT) { 3341 resetCount++; 3342 if (typeof reset === "object") { 3343 if (reset.placement) { 3344 statefulPlacement = reset.placement; 3345 } 3346 if (reset.rects) { 3347 rects = reset.rects === true ? await platform3.getElementRects({ 3348 reference, 3349 floating, 3350 strategy 3351 }) : reset.rects; 3352 } 3353 ({ 3354 x, 3355 y 3356 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 3357 } 3358 i = -1; 3359 } 3360 } 3361 return { 3362 x, 3363 y, 3364 placement: statefulPlacement, 3365 strategy, 3366 middlewareData 3367 }; 3368 }; 3369 var flip = function(options) { 3370 if (options === void 0) { 3371 options = {}; 3372 } 3373 return { 3374 name: "flip", 3375 options, 3376 async fn(state) { 3377 var _middlewareData$arrow, _middlewareData$flip; 3378 const { 3379 placement, 3380 middlewareData, 3381 rects, 3382 initialPlacement, 3383 platform: platform3, 3384 elements 3385 } = state; 3386 const { 3387 mainAxis: checkMainAxis = true, 3388 crossAxis: checkCrossAxis = true, 3389 fallbackPlacements: specifiedFallbackPlacements, 3390 fallbackStrategy = "bestFit", 3391 fallbackAxisSideDirection = "none", 3392 flipAlignment = true, 3393 ...detectOverflowOptions 3394 } = evaluate(options, state); 3395 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 3396 return {}; 3397 } 3398 const side = getSide(placement); 3399 const initialSideAxis = getSideAxis(initialPlacement); 3400 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 3401 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 3402 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 3403 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 3404 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 3405 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 3406 } 3407 const placements2 = [initialPlacement, ...fallbackPlacements]; 3408 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3409 const overflows = []; 3410 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 3411 if (checkMainAxis) { 3412 overflows.push(overflow[side]); 3413 } 3414 if (checkCrossAxis) { 3415 const sides2 = getAlignmentSides(placement, rects, rtl); 3416 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 3417 } 3418 overflowsData = [...overflowsData, { 3419 placement, 3420 overflows 3421 }]; 3422 if (!overflows.every((side2) => side2 <= 0)) { 3423 var _middlewareData$flip2, _overflowsData$filter; 3424 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 3425 const nextPlacement = placements2[nextIndex]; 3426 if (nextPlacement) { 3427 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 3428 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 3429 // overflows the main axis. 3430 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { 3431 return { 3432 data: { 3433 index: nextIndex, 3434 overflows: overflowsData 3435 }, 3436 reset: { 3437 placement: nextPlacement 3438 } 3439 }; 3440 } 3441 } 3442 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; 3443 if (!resetPlacement) { 3444 switch (fallbackStrategy) { 3445 case "bestFit": { 3446 var _overflowsData$filter2; 3447 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { 3448 if (hasFallbackAxisSideDirection) { 3449 const currentSideAxis = getSideAxis(d.placement); 3450 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 3451 // reading directions favoring greater width. 3452 currentSideAxis === "y"; 3453 } 3454 return true; 3455 }).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]; 3456 if (placement2) { 3457 resetPlacement = placement2; 3458 } 3459 break; 3460 } 3461 case "initialPlacement": 3462 resetPlacement = initialPlacement; 3463 break; 3464 } 3465 } 3466 if (placement !== resetPlacement) { 3467 return { 3468 reset: { 3469 placement: resetPlacement 3470 } 3471 }; 3472 } 3473 } 3474 return {}; 3475 } 3476 }; 3477 }; 3478 function getSideOffsets(overflow, rect) { 3479 return { 3480 top: overflow.top - rect.height, 3481 right: overflow.right - rect.width, 3482 bottom: overflow.bottom - rect.height, 3483 left: overflow.left - rect.width 3484 }; 3485 } 3486 function isAnySideFullyClipped(overflow) { 3487 return sides.some((side) => overflow[side] >= 0); 3488 } 3489 var hide = function(options) { 3490 if (options === void 0) { 3491 options = {}; 3492 } 3493 return { 3494 name: "hide", 3495 options, 3496 async fn(state) { 3497 const { 3498 rects, 3499 platform: platform3 3500 } = state; 3501 const { 3502 strategy = "referenceHidden", 3503 ...detectOverflowOptions 3504 } = evaluate(options, state); 3505 switch (strategy) { 3506 case "referenceHidden": { 3507 const overflow = await platform3.detectOverflow(state, { 3508 ...detectOverflowOptions, 3509 elementContext: "reference" 3510 }); 3511 const offsets = getSideOffsets(overflow, rects.reference); 3512 return { 3513 data: { 3514 referenceHiddenOffsets: offsets, 3515 referenceHidden: isAnySideFullyClipped(offsets) 3516 } 3517 }; 3518 } 3519 case "escaped": { 3520 const overflow = await platform3.detectOverflow(state, { 3521 ...detectOverflowOptions, 3522 altBoundary: true 3523 }); 3524 const offsets = getSideOffsets(overflow, rects.floating); 3525 return { 3526 data: { 3527 escapedOffsets: offsets, 3528 escaped: isAnySideFullyClipped(offsets) 3529 } 3530 }; 3531 } 3532 default: { 3533 return {}; 3534 } 3535 } 3536 } 3537 }; 3538 }; 3539 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 3540 async function convertValueToCoords(state, options) { 3541 const { 3542 placement, 3543 platform: platform3, 3544 elements 3545 } = state; 3546 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 3547 const side = getSide(placement); 3548 const alignment = getAlignment(placement); 3549 const isVertical = getSideAxis(placement) === "y"; 3550 const mainAxisMulti = originSides.has(side) ? -1 : 1; 3551 const crossAxisMulti = rtl && isVertical ? -1 : 1; 3552 const rawValue = evaluate(options, state); 3553 let { 3554 mainAxis, 3555 crossAxis, 3556 alignmentAxis 3557 } = typeof rawValue === "number" ? { 3558 mainAxis: rawValue, 3559 crossAxis: 0, 3560 alignmentAxis: null 3561 } : { 3562 mainAxis: rawValue.mainAxis || 0, 3563 crossAxis: rawValue.crossAxis || 0, 3564 alignmentAxis: rawValue.alignmentAxis 3565 }; 3566 if (alignment && typeof alignmentAxis === "number") { 3567 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 3568 } 3569 return isVertical ? { 3570 x: crossAxis * crossAxisMulti, 3571 y: mainAxis * mainAxisMulti 3572 } : { 3573 x: mainAxis * mainAxisMulti, 3574 y: crossAxis * crossAxisMulti 3575 }; 3576 } 3577 var offset = function(options) { 3578 if (options === void 0) { 3579 options = 0; 3580 } 3581 return { 3582 name: "offset", 3583 options, 3584 async fn(state) { 3585 var _middlewareData$offse, _middlewareData$arrow; 3586 const { 3587 x, 3588 y, 3589 placement, 3590 middlewareData 3591 } = state; 3592 const diffCoords = await convertValueToCoords(state, options); 3593 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 3594 return {}; 3595 } 3596 return { 3597 x: x + diffCoords.x, 3598 y: y + diffCoords.y, 3599 data: { 3600 ...diffCoords, 3601 placement 3602 } 3603 }; 3604 } 3605 }; 3606 }; 3607 var shift = function(options) { 3608 if (options === void 0) { 3609 options = {}; 3610 } 3611 return { 3612 name: "shift", 3613 options, 3614 async fn(state) { 3615 const { 3616 x, 3617 y, 3618 placement, 3619 platform: platform3 3620 } = state; 3621 const { 3622 mainAxis: checkMainAxis = true, 3623 crossAxis: checkCrossAxis = false, 3624 limiter = { 3625 fn: (_ref) => { 3626 let { 3627 x: x2, 3628 y: y2 3629 } = _ref; 3630 return { 3631 x: x2, 3632 y: y2 3633 }; 3634 } 3635 }, 3636 ...detectOverflowOptions 3637 } = evaluate(options, state); 3638 const coords = { 3639 x, 3640 y 3641 }; 3642 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3643 const crossAxis = getSideAxis(getSide(placement)); 3644 const mainAxis = getOppositeAxis(crossAxis); 3645 let mainAxisCoord = coords[mainAxis]; 3646 let crossAxisCoord = coords[crossAxis]; 3647 if (checkMainAxis) { 3648 const minSide = mainAxis === "y" ? "top" : "left"; 3649 const maxSide = mainAxis === "y" ? "bottom" : "right"; 3650 const min2 = mainAxisCoord + overflow[minSide]; 3651 const max2 = mainAxisCoord - overflow[maxSide]; 3652 mainAxisCoord = clamp(min2, mainAxisCoord, max2); 3653 } 3654 if (checkCrossAxis) { 3655 const minSide = crossAxis === "y" ? "top" : "left"; 3656 const maxSide = crossAxis === "y" ? "bottom" : "right"; 3657 const min2 = crossAxisCoord + overflow[minSide]; 3658 const max2 = crossAxisCoord - overflow[maxSide]; 3659 crossAxisCoord = clamp(min2, crossAxisCoord, max2); 3660 } 3661 const limitedCoords = limiter.fn({ 3662 ...state, 3663 [mainAxis]: mainAxisCoord, 3664 [crossAxis]: crossAxisCoord 3665 }); 3666 return { 3667 ...limitedCoords, 3668 data: { 3669 x: limitedCoords.x - x, 3670 y: limitedCoords.y - y, 3671 enabled: { 3672 [mainAxis]: checkMainAxis, 3673 [crossAxis]: checkCrossAxis 3674 } 3675 } 3676 }; 3677 } 3678 }; 3679 }; 3680 var limitShift = function(options) { 3681 if (options === void 0) { 3682 options = {}; 3683 } 3684 return { 3685 options, 3686 fn(state) { 3687 const { 3688 x, 3689 y, 3690 placement, 3691 rects, 3692 middlewareData 3693 } = state; 3694 const { 3695 offset: offset4 = 0, 3696 mainAxis: checkMainAxis = true, 3697 crossAxis: checkCrossAxis = true 3698 } = evaluate(options, state); 3699 const coords = { 3700 x, 3701 y 3702 }; 3703 const crossAxis = getSideAxis(placement); 3704 const mainAxis = getOppositeAxis(crossAxis); 3705 let mainAxisCoord = coords[mainAxis]; 3706 let crossAxisCoord = coords[crossAxis]; 3707 const rawOffset = evaluate(offset4, state); 3708 const computedOffset = typeof rawOffset === "number" ? { 3709 mainAxis: rawOffset, 3710 crossAxis: 0 3711 } : { 3712 mainAxis: 0, 3713 crossAxis: 0, 3714 ...rawOffset 3715 }; 3716 if (checkMainAxis) { 3717 const len = mainAxis === "y" ? "height" : "width"; 3718 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 3719 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 3720 if (mainAxisCoord < limitMin) { 3721 mainAxisCoord = limitMin; 3722 } else if (mainAxisCoord > limitMax) { 3723 mainAxisCoord = limitMax; 3724 } 3725 } 3726 if (checkCrossAxis) { 3727 var _middlewareData$offse, _middlewareData$offse2; 3728 const len = mainAxis === "y" ? "width" : "height"; 3729 const isOriginSide = originSides.has(getSide(placement)); 3730 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); 3731 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); 3732 if (crossAxisCoord < limitMin) { 3733 crossAxisCoord = limitMin; 3734 } else if (crossAxisCoord > limitMax) { 3735 crossAxisCoord = limitMax; 3736 } 3737 } 3738 return { 3739 [mainAxis]: mainAxisCoord, 3740 [crossAxis]: crossAxisCoord 3741 }; 3742 } 3743 }; 3744 }; 3745 var size = function(options) { 3746 if (options === void 0) { 3747 options = {}; 3748 } 3749 return { 3750 name: "size", 3751 options, 3752 async fn(state) { 3753 var _state$middlewareData, _state$middlewareData2; 3754 const { 3755 placement, 3756 rects, 3757 platform: platform3, 3758 elements 3759 } = state; 3760 const { 3761 apply = () => { 3762 }, 3763 ...detectOverflowOptions 3764 } = evaluate(options, state); 3765 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 3766 const side = getSide(placement); 3767 const alignment = getAlignment(placement); 3768 const isYAxis = getSideAxis(placement) === "y"; 3769 const { 3770 width, 3771 height 3772 } = rects.floating; 3773 let heightSide; 3774 let widthSide; 3775 if (side === "top" || side === "bottom") { 3776 heightSide = side; 3777 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; 3778 } else { 3779 widthSide = side; 3780 heightSide = alignment === "end" ? "top" : "bottom"; 3781 } 3782 const maximumClippingHeight = height - overflow.top - overflow.bottom; 3783 const maximumClippingWidth = width - overflow.left - overflow.right; 3784 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 3785 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 3786 const noShift = !state.middlewareData.shift; 3787 let availableHeight = overflowAvailableHeight; 3788 let availableWidth = overflowAvailableWidth; 3789 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { 3790 availableWidth = maximumClippingWidth; 3791 } 3792 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { 3793 availableHeight = maximumClippingHeight; 3794 } 3795 if (noShift && !alignment) { 3796 const xMin = max(overflow.left, 0); 3797 const xMax = max(overflow.right, 0); 3798 const yMin = max(overflow.top, 0); 3799 const yMax = max(overflow.bottom, 0); 3800 if (isYAxis) { 3801 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); 3802 } else { 3803 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); 3804 } 3805 } 3806 await apply({ 3807 ...state, 3808 availableWidth, 3809 availableHeight 3810 }); 3811 const nextDimensions = await platform3.getDimensions(elements.floating); 3812 if (width !== nextDimensions.width || height !== nextDimensions.height) { 3813 return { 3814 reset: { 3815 rects: true 3816 } 3817 }; 3818 } 3819 return {}; 3820 } 3821 }; 3822 }; 3823 3824 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 3825 function getCssDimensions(element) { 3826 const css = getComputedStyle2(element); 3827 let width = parseFloat(css.width) || 0; 3828 let height = parseFloat(css.height) || 0; 3829 const hasOffset = isHTMLElement(element); 3830 const offsetWidth = hasOffset ? element.offsetWidth : width; 3831 const offsetHeight = hasOffset ? element.offsetHeight : height; 3832 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 3833 if (shouldFallback) { 3834 width = offsetWidth; 3835 height = offsetHeight; 3836 } 3837 return { 3838 width, 3839 height, 3840 $: shouldFallback 3841 }; 3842 } 3843 function unwrapElement(element) { 3844 return !isElement(element) ? element.contextElement : element; 3845 } 3846 function getScale(element) { 3847 const domElement = unwrapElement(element); 3848 if (!isHTMLElement(domElement)) { 3849 return createCoords(1); 3850 } 3851 const rect = domElement.getBoundingClientRect(); 3852 const { 3853 width, 3854 height, 3855 $ 3856 } = getCssDimensions(domElement); 3857 let x = ($ ? round(rect.width) : rect.width) / width; 3858 let y = ($ ? round(rect.height) : rect.height) / height; 3859 if (!x || !Number.isFinite(x)) { 3860 x = 1; 3861 } 3862 if (!y || !Number.isFinite(y)) { 3863 y = 1; 3864 } 3865 return { 3866 x, 3867 y 3868 }; 3869 } 3870 var noOffsets = /* @__PURE__ */ createCoords(0); 3871 function getVisualOffsets(element) { 3872 const win = getWindow(element); 3873 if (!isWebKit() || !win.visualViewport) { 3874 return noOffsets; 3875 } 3876 return { 3877 x: win.visualViewport.offsetLeft, 3878 y: win.visualViewport.offsetTop 3879 }; 3880 } 3881 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 3882 if (isFixed === void 0) { 3883 isFixed = false; 3884 } 3885 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 3886 return false; 3887 } 3888 return isFixed; 3889 } 3890 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 3891 if (includeScale === void 0) { 3892 includeScale = false; 3893 } 3894 if (isFixedStrategy === void 0) { 3895 isFixedStrategy = false; 3896 } 3897 const clientRect = element.getBoundingClientRect(); 3898 const domElement = unwrapElement(element); 3899 let scale = createCoords(1); 3900 if (includeScale) { 3901 if (offsetParent) { 3902 if (isElement(offsetParent)) { 3903 scale = getScale(offsetParent); 3904 } 3905 } else { 3906 scale = getScale(element); 3907 } 3908 } 3909 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 3910 let x = (clientRect.left + visualOffsets.x) / scale.x; 3911 let y = (clientRect.top + visualOffsets.y) / scale.y; 3912 let width = clientRect.width / scale.x; 3913 let height = clientRect.height / scale.y; 3914 if (domElement) { 3915 const win = getWindow(domElement); 3916 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 3917 let currentWin = win; 3918 let currentIFrame = getFrameElement(currentWin); 3919 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 3920 const iframeScale = getScale(currentIFrame); 3921 const iframeRect = currentIFrame.getBoundingClientRect(); 3922 const css = getComputedStyle2(currentIFrame); 3923 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 3924 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 3925 x *= iframeScale.x; 3926 y *= iframeScale.y; 3927 width *= iframeScale.x; 3928 height *= iframeScale.y; 3929 x += left; 3930 y += top; 3931 currentWin = getWindow(currentIFrame); 3932 currentIFrame = getFrameElement(currentWin); 3933 } 3934 } 3935 return rectToClientRect({ 3936 width, 3937 height, 3938 x, 3939 y 3940 }); 3941 } 3942 function getWindowScrollBarX(element, rect) { 3943 const leftScroll = getNodeScroll(element).scrollLeft; 3944 if (!rect) { 3945 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 3946 } 3947 return rect.left + leftScroll; 3948 } 3949 function getHTMLOffset(documentElement, scroll) { 3950 const htmlRect = documentElement.getBoundingClientRect(); 3951 const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 3952 const y = htmlRect.top + scroll.scrollTop; 3953 return { 3954 x, 3955 y 3956 }; 3957 } 3958 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 3959 let { 3960 elements, 3961 rect, 3962 offsetParent, 3963 strategy 3964 } = _ref; 3965 const isFixed = strategy === "fixed"; 3966 const documentElement = getDocumentElement(offsetParent); 3967 const topLayer = elements ? isTopLayer(elements.floating) : false; 3968 if (offsetParent === documentElement || topLayer && isFixed) { 3969 return rect; 3970 } 3971 let scroll = { 3972 scrollLeft: 0, 3973 scrollTop: 0 3974 }; 3975 let scale = createCoords(1); 3976 const offsets = createCoords(0); 3977 const isOffsetParentAnElement = isHTMLElement(offsetParent); 3978 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 3979 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 3980 scroll = getNodeScroll(offsetParent); 3981 } 3982 if (isOffsetParentAnElement) { 3983 const offsetRect = getBoundingClientRect(offsetParent); 3984 scale = getScale(offsetParent); 3985 offsets.x = offsetRect.x + offsetParent.clientLeft; 3986 offsets.y = offsetRect.y + offsetParent.clientTop; 3987 } 3988 } 3989 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 3990 return { 3991 width: rect.width * scale.x, 3992 height: rect.height * scale.y, 3993 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 3994 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 3995 }; 3996 } 3997 function getClientRects(element) { 3998 return Array.from(element.getClientRects()); 3999 } 4000 function getDocumentRect(element) { 4001 const html = getDocumentElement(element); 4002 const scroll = getNodeScroll(element); 4003 const body = element.ownerDocument.body; 4004 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 4005 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 4006 let x = -scroll.scrollLeft + getWindowScrollBarX(element); 4007 const y = -scroll.scrollTop; 4008 if (getComputedStyle2(body).direction === "rtl") { 4009 x += max(html.clientWidth, body.clientWidth) - width; 4010 } 4011 return { 4012 width, 4013 height, 4014 x, 4015 y 4016 }; 4017 } 4018 var SCROLLBAR_MAX = 25; 4019 function getViewportRect(element, strategy) { 4020 const win = getWindow(element); 4021 const html = getDocumentElement(element); 4022 const visualViewport = win.visualViewport; 4023 let width = html.clientWidth; 4024 let height = html.clientHeight; 4025 let x = 0; 4026 let y = 0; 4027 if (visualViewport) { 4028 width = visualViewport.width; 4029 height = visualViewport.height; 4030 const visualViewportBased = isWebKit(); 4031 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 4032 x = visualViewport.offsetLeft; 4033 y = visualViewport.offsetTop; 4034 } 4035 } 4036 const windowScrollbarX = getWindowScrollBarX(html); 4037 if (windowScrollbarX <= 0) { 4038 const doc = html.ownerDocument; 4039 const body = doc.body; 4040 const bodyStyles = getComputedStyle(body); 4041 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 4042 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 4043 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { 4044 width -= clippingStableScrollbarWidth; 4045 } 4046 } else if (windowScrollbarX <= SCROLLBAR_MAX) { 4047 width += windowScrollbarX; 4048 } 4049 return { 4050 width, 4051 height, 4052 x, 4053 y 4054 }; 4055 } 4056 function getInnerBoundingClientRect(element, strategy) { 4057 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 4058 const top = clientRect.top + element.clientTop; 4059 const left = clientRect.left + element.clientLeft; 4060 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 4061 const width = element.clientWidth * scale.x; 4062 const height = element.clientHeight * scale.y; 4063 const x = left * scale.x; 4064 const y = top * scale.y; 4065 return { 4066 width, 4067 height, 4068 x, 4069 y 4070 }; 4071 } 4072 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 4073 let rect; 4074 if (clippingAncestor === "viewport") { 4075 rect = getViewportRect(element, strategy); 4076 } else if (clippingAncestor === "document") { 4077 rect = getDocumentRect(getDocumentElement(element)); 4078 } else if (isElement(clippingAncestor)) { 4079 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 4080 } else { 4081 const visualOffsets = getVisualOffsets(element); 4082 rect = { 4083 x: clippingAncestor.x - visualOffsets.x, 4084 y: clippingAncestor.y - visualOffsets.y, 4085 width: clippingAncestor.width, 4086 height: clippingAncestor.height 4087 }; 4088 } 4089 return rectToClientRect(rect); 4090 } 4091 function hasFixedPositionAncestor(element, stopNode) { 4092 const parentNode = getParentNode(element); 4093 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 4094 return false; 4095 } 4096 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 4097 } 4098 function getClippingElementAncestors(element, cache) { 4099 const cachedResult = cache.get(element); 4100 if (cachedResult) { 4101 return cachedResult; 4102 } 4103 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 4104 let currentContainingBlockComputedStyle = null; 4105 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 4106 let currentNode = elementIsFixed ? getParentNode(element) : element; 4107 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 4108 const computedStyle = getComputedStyle2(currentNode); 4109 const currentNodeIsContaining = isContainingBlock(currentNode); 4110 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 4111 currentContainingBlockComputedStyle = null; 4112 } 4113 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 4114 if (shouldDropCurrentNode) { 4115 result = result.filter((ancestor) => ancestor !== currentNode); 4116 } else { 4117 currentContainingBlockComputedStyle = computedStyle; 4118 } 4119 currentNode = getParentNode(currentNode); 4120 } 4121 cache.set(element, result); 4122 return result; 4123 } 4124 function getClippingRect(_ref) { 4125 let { 4126 element, 4127 boundary, 4128 rootBoundary, 4129 strategy 4130 } = _ref; 4131 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 4132 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 4133 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 4134 let top = firstRect.top; 4135 let right = firstRect.right; 4136 let bottom = firstRect.bottom; 4137 let left = firstRect.left; 4138 for (let i = 1; i < clippingAncestors.length; i++) { 4139 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); 4140 top = max(rect.top, top); 4141 right = min(rect.right, right); 4142 bottom = min(rect.bottom, bottom); 4143 left = max(rect.left, left); 4144 } 4145 return { 4146 width: right - left, 4147 height: bottom - top, 4148 x: left, 4149 y: top 4150 }; 4151 } 4152 function getDimensions(element) { 4153 const { 4154 width, 4155 height 4156 } = getCssDimensions(element); 4157 return { 4158 width, 4159 height 4160 }; 4161 } 4162 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 4163 const isOffsetParentAnElement = isHTMLElement(offsetParent); 4164 const documentElement = getDocumentElement(offsetParent); 4165 const isFixed = strategy === "fixed"; 4166 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 4167 let scroll = { 4168 scrollLeft: 0, 4169 scrollTop: 0 4170 }; 4171 const offsets = createCoords(0); 4172 function setLeftRTLScrollbarOffset() { 4173 offsets.x = getWindowScrollBarX(documentElement); 4174 } 4175 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 4176 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 4177 scroll = getNodeScroll(offsetParent); 4178 } 4179 if (isOffsetParentAnElement) { 4180 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 4181 offsets.x = offsetRect.x + offsetParent.clientLeft; 4182 offsets.y = offsetRect.y + offsetParent.clientTop; 4183 } else if (documentElement) { 4184 setLeftRTLScrollbarOffset(); 4185 } 4186 } 4187 if (isFixed && !isOffsetParentAnElement && documentElement) { 4188 setLeftRTLScrollbarOffset(); 4189 } 4190 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 4191 const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 4192 const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 4193 return { 4194 x, 4195 y, 4196 width: rect.width, 4197 height: rect.height 4198 }; 4199 } 4200 function isStaticPositioned(element) { 4201 return getComputedStyle2(element).position === "static"; 4202 } 4203 function getTrueOffsetParent(element, polyfill) { 4204 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 4205 return null; 4206 } 4207 if (polyfill) { 4208 return polyfill(element); 4209 } 4210 let rawOffsetParent = element.offsetParent; 4211 if (getDocumentElement(element) === rawOffsetParent) { 4212 rawOffsetParent = rawOffsetParent.ownerDocument.body; 4213 } 4214 return rawOffsetParent; 4215 } 4216 function getOffsetParent(element, polyfill) { 4217 const win = getWindow(element); 4218 if (isTopLayer(element)) { 4219 return win; 4220 } 4221 if (!isHTMLElement(element)) { 4222 let svgOffsetParent = getParentNode(element); 4223 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 4224 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 4225 return svgOffsetParent; 4226 } 4227 svgOffsetParent = getParentNode(svgOffsetParent); 4228 } 4229 return win; 4230 } 4231 let offsetParent = getTrueOffsetParent(element, polyfill); 4232 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 4233 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 4234 } 4235 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 4236 return win; 4237 } 4238 return offsetParent || getContainingBlock(element) || win; 4239 } 4240 var getElementRects = async function(data) { 4241 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 4242 const getDimensionsFn = this.getDimensions; 4243 const floatingDimensions = await getDimensionsFn(data.floating); 4244 return { 4245 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 4246 floating: { 4247 x: 0, 4248 y: 0, 4249 width: floatingDimensions.width, 4250 height: floatingDimensions.height 4251 } 4252 }; 4253 }; 4254 function isRTL(element) { 4255 return getComputedStyle2(element).direction === "rtl"; 4256 } 4257 var platform2 = { 4258 convertOffsetParentRelativeRectToViewportRelativeRect, 4259 getDocumentElement, 4260 getClippingRect, 4261 getOffsetParent, 4262 getElementRects, 4263 getClientRects, 4264 getDimensions, 4265 getScale, 4266 isElement, 4267 isRTL 4268 }; 4269 function rectsAreEqual(a, b) { 4270 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; 4271 } 4272 function observeMove(element, onMove) { 4273 let io = null; 4274 let timeoutId; 4275 const root = getDocumentElement(element); 4276 function cleanup() { 4277 var _io; 4278 clearTimeout(timeoutId); 4279 (_io = io) == null || _io.disconnect(); 4280 io = null; 4281 } 4282 function refresh(skip, threshold) { 4283 if (skip === void 0) { 4284 skip = false; 4285 } 4286 if (threshold === void 0) { 4287 threshold = 1; 4288 } 4289 cleanup(); 4290 const elementRectForRootMargin = element.getBoundingClientRect(); 4291 const { 4292 left, 4293 top, 4294 width, 4295 height 4296 } = elementRectForRootMargin; 4297 if (!skip) { 4298 onMove(); 4299 } 4300 if (!width || !height) { 4301 return; 4302 } 4303 const insetTop = floor(top); 4304 const insetRight = floor(root.clientWidth - (left + width)); 4305 const insetBottom = floor(root.clientHeight - (top + height)); 4306 const insetLeft = floor(left); 4307 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 4308 const options = { 4309 rootMargin, 4310 threshold: max(0, min(1, threshold)) || 1 4311 }; 4312 let isFirstUpdate = true; 4313 function handleObserve(entries) { 4314 const ratio = entries[0].intersectionRatio; 4315 if (ratio !== threshold) { 4316 if (!isFirstUpdate) { 4317 return refresh(); 4318 } 4319 if (!ratio) { 4320 timeoutId = setTimeout(() => { 4321 refresh(false, 1e-7); 4322 }, 1e3); 4323 } else { 4324 refresh(false, ratio); 4325 } 4326 } 4327 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 4328 refresh(); 4329 } 4330 isFirstUpdate = false; 4331 } 4332 try { 4333 io = new IntersectionObserver(handleObserve, { 4334 ...options, 4335 // Handle <iframe>s 4336 root: root.ownerDocument 4337 }); 4338 } catch (_e) { 4339 io = new IntersectionObserver(handleObserve, options); 4340 } 4341 io.observe(element); 4342 } 4343 refresh(true); 4344 return cleanup; 4345 } 4346 function autoUpdate(reference, floating, update2, options) { 4347 if (options === void 0) { 4348 options = {}; 4349 } 4350 const { 4351 ancestorScroll = true, 4352 ancestorResize = true, 4353 elementResize = typeof ResizeObserver === "function", 4354 layoutShift = typeof IntersectionObserver === "function", 4355 animationFrame = false 4356 } = options; 4357 const referenceEl = unwrapElement(reference); 4358 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 4359 ancestors.forEach((ancestor) => { 4360 ancestorScroll && ancestor.addEventListener("scroll", update2, { 4361 passive: true 4362 }); 4363 ancestorResize && ancestor.addEventListener("resize", update2); 4364 }); 4365 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null; 4366 let reobserveFrame = -1; 4367 let resizeObserver = null; 4368 if (elementResize) { 4369 resizeObserver = new ResizeObserver((_ref) => { 4370 let [firstEntry] = _ref; 4371 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 4372 resizeObserver.unobserve(floating); 4373 cancelAnimationFrame(reobserveFrame); 4374 reobserveFrame = requestAnimationFrame(() => { 4375 var _resizeObserver; 4376 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 4377 }); 4378 } 4379 update2(); 4380 }); 4381 if (referenceEl && !animationFrame) { 4382 resizeObserver.observe(referenceEl); 4383 } 4384 if (floating) { 4385 resizeObserver.observe(floating); 4386 } 4387 } 4388 let frameId; 4389 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 4390 if (animationFrame) { 4391 frameLoop(); 4392 } 4393 function frameLoop() { 4394 const nextRefRect = getBoundingClientRect(reference); 4395 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 4396 update2(); 4397 } 4398 prevRefRect = nextRefRect; 4399 frameId = requestAnimationFrame(frameLoop); 4400 } 4401 update2(); 4402 return () => { 4403 var _resizeObserver2; 4404 ancestors.forEach((ancestor) => { 4405 ancestorScroll && ancestor.removeEventListener("scroll", update2); 4406 ancestorResize && ancestor.removeEventListener("resize", update2); 4407 }); 4408 cleanupIo == null || cleanupIo(); 4409 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 4410 resizeObserver = null; 4411 if (animationFrame) { 4412 cancelAnimationFrame(frameId); 4413 } 4414 }; 4415 } 4416 var offset2 = offset; 4417 var shift2 = shift; 4418 var flip2 = flip; 4419 var size2 = size; 4420 var hide2 = hide; 4421 var limitShift2 = limitShift; 4422 var computePosition2 = (reference, floating, options) => { 4423 const cache = /* @__PURE__ */ new Map(); 4424 const mergedOptions = { 4425 platform: platform2, 4426 ...options 4427 }; 4428 const platformWithCache = { 4429 ...mergedOptions.platform, 4430 _c: cache 4431 }; 4432 return computePosition(reference, floating, { 4433 ...mergedOptions, 4434 platform: platformWithCache 4435 }); 4436 }; 4437 4438 // node_modules/@base-ui/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 4439 var React23 = __toESM(require_react(), 1); 4440 var import_react2 = __toESM(require_react(), 1); 4441 var ReactDOM3 = __toESM(require_react_dom(), 1); 4442 var isClient = typeof document !== "undefined"; 4443 var noop2 = function noop3() { 4444 }; 4445 var index = isClient ? import_react2.useLayoutEffect : noop2; 4446 function deepEqual(a, b) { 4447 if (a === b) { 4448 return true; 4449 } 4450 if (typeof a !== typeof b) { 4451 return false; 4452 } 4453 if (typeof a === "function" && a.toString() === b.toString()) { 4454 return true; 4455 } 4456 let length; 4457 let i; 4458 let keys; 4459 if (a && b && typeof a === "object") { 4460 if (Array.isArray(a)) { 4461 length = a.length; 4462 if (length !== b.length) return false; 4463 for (i = length; i-- !== 0; ) { 4464 if (!deepEqual(a[i], b[i])) { 4465 return false; 4466 } 4467 } 4468 return true; 4469 } 4470 keys = Object.keys(a); 4471 length = keys.length; 4472 if (length !== Object.keys(b).length) { 4473 return false; 4474 } 4475 for (i = length; i-- !== 0; ) { 4476 if (!{}.hasOwnProperty.call(b, keys[i])) { 4477 return false; 4478 } 4479 } 4480 for (i = length; i-- !== 0; ) { 4481 const key = keys[i]; 4482 if (key === "_owner" && a.$$typeof) { 4483 continue; 4484 } 4485 if (!deepEqual(a[key], b[key])) { 4486 return false; 4487 } 4488 } 4489 return true; 4490 } 4491 return a !== a && b !== b; 4492 } 4493 function getDPR(element) { 4494 if (typeof window === "undefined") { 4495 return 1; 4496 } 4497 const win = element.ownerDocument.defaultView || window; 4498 return win.devicePixelRatio || 1; 4499 } 4500 function roundByDPR(element, value) { 4501 const dpr = getDPR(element); 4502 return Math.round(value * dpr) / dpr; 4503 } 4504 function useLatestRef(value) { 4505 const ref = React23.useRef(value); 4506 index(() => { 4507 ref.current = value; 4508 }); 4509 return ref; 4510 } 4511 function useFloating(options) { 4512 if (options === void 0) { 4513 options = {}; 4514 } 4515 const { 4516 placement = "bottom", 4517 strategy = "absolute", 4518 middleware = [], 4519 platform: platform3, 4520 elements: { 4521 reference: externalReference, 4522 floating: externalFloating 4523 } = {}, 4524 transform = true, 4525 whileElementsMounted, 4526 open 4527 } = options; 4528 const [data, setData] = React23.useState({ 4529 x: 0, 4530 y: 0, 4531 strategy, 4532 placement, 4533 middlewareData: {}, 4534 isPositioned: false 4535 }); 4536 const [latestMiddleware, setLatestMiddleware] = React23.useState(middleware); 4537 if (!deepEqual(latestMiddleware, middleware)) { 4538 setLatestMiddleware(middleware); 4539 } 4540 const [_reference, _setReference] = React23.useState(null); 4541 const [_floating, _setFloating] = React23.useState(null); 4542 const setReference = React23.useCallback((node) => { 4543 if (node !== referenceRef.current) { 4544 referenceRef.current = node; 4545 _setReference(node); 4546 } 4547 }, []); 4548 const setFloating = React23.useCallback((node) => { 4549 if (node !== floatingRef.current) { 4550 floatingRef.current = node; 4551 _setFloating(node); 4552 } 4553 }, []); 4554 const referenceEl = externalReference || _reference; 4555 const floatingEl = externalFloating || _floating; 4556 const referenceRef = React23.useRef(null); 4557 const floatingRef = React23.useRef(null); 4558 const dataRef = React23.useRef(data); 4559 const hasWhileElementsMounted = whileElementsMounted != null; 4560 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 4561 const platformRef = useLatestRef(platform3); 4562 const openRef = useLatestRef(open); 4563 const update2 = React23.useCallback(() => { 4564 if (!referenceRef.current || !floatingRef.current) { 4565 return; 4566 } 4567 const config = { 4568 placement, 4569 strategy, 4570 middleware: latestMiddleware 4571 }; 4572 if (platformRef.current) { 4573 config.platform = platformRef.current; 4574 } 4575 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { 4576 const fullData = { 4577 ...data2, 4578 // The floating element's position may be recomputed while it's closed 4579 // but still mounted (such as when transitioning out). To ensure 4580 // `isPositioned` will be `false` initially on the next open, avoid 4581 // setting it to `true` when `open === false` (must be specified). 4582 isPositioned: openRef.current !== false 4583 }; 4584 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 4585 dataRef.current = fullData; 4586 ReactDOM3.flushSync(() => { 4587 setData(fullData); 4588 }); 4589 } 4590 }); 4591 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 4592 index(() => { 4593 if (open === false && dataRef.current.isPositioned) { 4594 dataRef.current.isPositioned = false; 4595 setData((data2) => ({ 4596 ...data2, 4597 isPositioned: false 4598 })); 4599 } 4600 }, [open]); 4601 const isMountedRef = React23.useRef(false); 4602 index(() => { 4603 isMountedRef.current = true; 4604 return () => { 4605 isMountedRef.current = false; 4606 }; 4607 }, []); 4608 index(() => { 4609 if (referenceEl) referenceRef.current = referenceEl; 4610 if (floatingEl) floatingRef.current = floatingEl; 4611 if (referenceEl && floatingEl) { 4612 if (whileElementsMountedRef.current) { 4613 return whileElementsMountedRef.current(referenceEl, floatingEl, update2); 4614 } 4615 update2(); 4616 } 4617 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); 4618 const refs = React23.useMemo(() => ({ 4619 reference: referenceRef, 4620 floating: floatingRef, 4621 setReference, 4622 setFloating 4623 }), [setReference, setFloating]); 4624 const elements = React23.useMemo(() => ({ 4625 reference: referenceEl, 4626 floating: floatingEl 4627 }), [referenceEl, floatingEl]); 4628 const floatingStyles = React23.useMemo(() => { 4629 const initialStyles = { 4630 position: strategy, 4631 left: 0, 4632 top: 0 4633 }; 4634 if (!elements.floating) { 4635 return initialStyles; 4636 } 4637 const x = roundByDPR(elements.floating, data.x); 4638 const y = roundByDPR(elements.floating, data.y); 4639 if (transform) { 4640 return { 4641 ...initialStyles, 4642 transform: "translate(" + x + "px, " + y + "px)", 4643 ...getDPR(elements.floating) >= 1.5 && { 4644 willChange: "transform" 4645 } 4646 }; 4647 } 4648 return { 4649 position: strategy, 4650 left: x, 4651 top: y 4652 }; 4653 }, [strategy, transform, elements.floating, data.x, data.y]); 4654 return React23.useMemo(() => ({ 4655 ...data, 4656 update: update2, 4657 refs, 4658 elements, 4659 floatingStyles 4660 }), [data, update2, refs, elements, floatingStyles]); 4661 } 4662 var offset3 = (options, deps) => { 4663 const result = offset2(options); 4664 return { 4665 name: result.name, 4666 fn: result.fn, 4667 options: [options, deps] 4668 }; 4669 }; 4670 var shift3 = (options, deps) => { 4671 const result = shift2(options); 4672 return { 4673 name: result.name, 4674 fn: result.fn, 4675 options: [options, deps] 4676 }; 4677 }; 4678 var limitShift3 = (options, deps) => { 4679 const result = limitShift2(options); 4680 return { 4681 fn: result.fn, 4682 options: [options, deps] 4683 }; 4684 }; 4685 var flip3 = (options, deps) => { 4686 const result = flip2(options); 4687 return { 4688 name: result.name, 4689 fn: result.fn, 4690 options: [options, deps] 4691 }; 4692 }; 4693 var size3 = (options, deps) => { 4694 const result = size2(options); 4695 return { 4696 name: result.name, 4697 fn: result.fn, 4698 options: [options, deps] 4699 }; 4700 }; 4701 var hide3 = (options, deps) => { 4702 const result = hide2(options); 4703 return { 4704 name: result.name, 4705 fn: result.fn, 4706 options: [options, deps] 4707 }; 4708 }; 4709 4710 // node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js 4711 var React28 = __toESM(require_react(), 1); 4712 4713 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js 4714 var React27 = __toESM(require_react(), 1); 4715 4716 // node_modules/@base-ui/utils/esm/store/createSelector.js 4717 var createSelector = (a, b, c, d, e, f, ...other) => { 4718 if (other.length > 0) { 4719 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1)); 4720 } 4721 let selector; 4722 if (a && b && c && d && e && f) { 4723 selector = (state, a1, a2, a3) => { 4724 const va = a(state, a1, a2, a3); 4725 const vb = b(state, a1, a2, a3); 4726 const vc = c(state, a1, a2, a3); 4727 const vd = d(state, a1, a2, a3); 4728 const ve = e(state, a1, a2, a3); 4729 return f(va, vb, vc, vd, ve, a1, a2, a3); 4730 }; 4731 } else if (a && b && c && d && e) { 4732 selector = (state, a1, a2, a3) => { 4733 const va = a(state, a1, a2, a3); 4734 const vb = b(state, a1, a2, a3); 4735 const vc = c(state, a1, a2, a3); 4736 const vd = d(state, a1, a2, a3); 4737 return e(va, vb, vc, vd, a1, a2, a3); 4738 }; 4739 } else if (a && b && c && d) { 4740 selector = (state, a1, a2, a3) => { 4741 const va = a(state, a1, a2, a3); 4742 const vb = b(state, a1, a2, a3); 4743 const vc = c(state, a1, a2, a3); 4744 return d(va, vb, vc, a1, a2, a3); 4745 }; 4746 } else if (a && b && c) { 4747 selector = (state, a1, a2, a3) => { 4748 const va = a(state, a1, a2, a3); 4749 const vb = b(state, a1, a2, a3); 4750 return c(va, vb, a1, a2, a3); 4751 }; 4752 } else if (a && b) { 4753 selector = (state, a1, a2, a3) => { 4754 const va = a(state, a1, a2, a3); 4755 return b(va, a1, a2, a3); 4756 }; 4757 } else if (a) { 4758 selector = a; 4759 } else { 4760 throw ( 4761 /* minify-error-disabled */ 4762 new Error("Missing arguments") 4763 ); 4764 } 4765 return selector; 4766 }; 4767 4768 // node_modules/@base-ui/utils/esm/store/useStore.js 4769 var React25 = __toESM(require_react(), 1); 4770 var import_shim = __toESM(require_shim(), 1); 4771 var import_with_selector = __toESM(require_with_selector(), 1); 4772 4773 // node_modules/@base-ui/utils/esm/fastHooks.js 4774 var React24 = __toESM(require_react(), 1); 4775 var hooks = []; 4776 var currentInstance = void 0; 4777 function getInstance() { 4778 return currentInstance; 4779 } 4780 function register(hook) { 4781 hooks.push(hook); 4782 } 4783 function fastComponent(fn) { 4784 const FastComponent = (props, forwardedRef) => { 4785 const instance = useRefWithInit(createInstance).current; 4786 let result; 4787 try { 4788 currentInstance = instance; 4789 for (const hook of hooks) { 4790 hook.before(instance); 4791 } 4792 result = fn(props, forwardedRef); 4793 for (const hook of hooks) { 4794 hook.after(instance); 4795 } 4796 instance.didInitialize = true; 4797 } finally { 4798 currentInstance = void 0; 4799 } 4800 return result; 4801 }; 4802 FastComponent.displayName = fn.displayName || fn.name; 4803 return FastComponent; 4804 } 4805 function fastComponentRef(fn) { 4806 return /* @__PURE__ */ React24.forwardRef(fastComponent(fn)); 4807 } 4808 function createInstance() { 4809 return { 4810 didInitialize: false 4811 }; 4812 } 4813 4814 // node_modules/@base-ui/utils/esm/store/useStore.js 4815 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 4816 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 4817 function useStore(store2, selector, a1, a2, a3) { 4818 return useStoreImplementation(store2, selector, a1, a2, a3); 4819 } 4820 function useStoreR19(store2, selector, a1, a2, a3) { 4821 const getSelection = React25.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]); 4822 return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection); 4823 } 4824 register({ 4825 before(instance) { 4826 instance.syncIndex = 0; 4827 if (!instance.didInitialize) { 4828 instance.syncTick = 1; 4829 instance.syncHooks = []; 4830 instance.didChangeStore = true; 4831 instance.getSnapshot = () => { 4832 let didChange2 = false; 4833 for (let i = 0; i < instance.syncHooks.length; i += 1) { 4834 const hook = instance.syncHooks[i]; 4835 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 4836 if (hook.didChange || !Object.is(hook.value, value)) { 4837 didChange2 = true; 4838 hook.value = value; 4839 hook.didChange = false; 4840 } 4841 } 4842 if (didChange2) { 4843 instance.syncTick += 1; 4844 } 4845 return instance.syncTick; 4846 }; 4847 } 4848 }, 4849 after(instance) { 4850 if (instance.syncHooks.length > 0) { 4851 if (instance.didChangeStore) { 4852 instance.didChangeStore = false; 4853 instance.subscribe = (onStoreChange) => { 4854 const stores = /* @__PURE__ */ new Set(); 4855 for (const hook of instance.syncHooks) { 4856 stores.add(hook.store); 4857 } 4858 const unsubscribes = []; 4859 for (const store2 of stores) { 4860 unsubscribes.push(store2.subscribe(onStoreChange)); 4861 } 4862 return () => { 4863 for (const unsubscribe of unsubscribes) { 4864 unsubscribe(); 4865 } 4866 }; 4867 }; 4868 } 4869 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 4870 } 4871 } 4872 }); 4873 function useStoreFast(store2, selector, a1, a2, a3) { 4874 const instance = getInstance(); 4875 if (!instance) { 4876 return useStoreR19(store2, selector, a1, a2, a3); 4877 } 4878 const index2 = instance.syncIndex; 4879 instance.syncIndex += 1; 4880 let hook; 4881 if (!instance.didInitialize) { 4882 hook = { 4883 store: store2, 4884 selector, 4885 a1, 4886 a2, 4887 a3, 4888 value: selector(store2.getSnapshot(), a1, a2, a3), 4889 didChange: false 4890 }; 4891 instance.syncHooks.push(hook); 4892 } else { 4893 hook = instance.syncHooks[index2]; 4894 if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { 4895 if (hook.store !== store2) { 4896 instance.didChangeStore = true; 4897 } 4898 hook.store = store2; 4899 hook.selector = selector; 4900 hook.a1 = a1; 4901 hook.a2 = a2; 4902 hook.a3 = a3; 4903 hook.didChange = true; 4904 } 4905 } 4906 return hook.value; 4907 } 4908 function useStoreLegacy(store2, selector, a1, a2, a3) { 4909 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3)); 4910 } 4911 4912 // node_modules/@base-ui/utils/esm/store/Store.js 4913 var Store = class { 4914 /** 4915 * The current state of the store. 4916 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 4917 * 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). 4918 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 4919 * 4920 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 4921 */ 4922 // Internal state to handle recursive `setState()` calls 4923 constructor(state) { 4924 this.state = state; 4925 this.listeners = /* @__PURE__ */ new Set(); 4926 this.updateTick = 0; 4927 } 4928 /** 4929 * Registers a listener that will be called whenever the store's state changes. 4930 * 4931 * @param fn The listener function to be called on state changes. 4932 * @returns A function to unsubscribe the listener. 4933 */ 4934 subscribe = (fn) => { 4935 this.listeners.add(fn); 4936 return () => { 4937 this.listeners.delete(fn); 4938 }; 4939 }; 4940 /** 4941 * Returns the current state of the store. 4942 */ 4943 getSnapshot = () => { 4944 return this.state; 4945 }; 4946 /** 4947 * Updates the entire store's state and notifies all registered listeners. 4948 * 4949 * @param newState The new state to set for the store. 4950 */ 4951 setState(newState) { 4952 if (this.state === newState) { 4953 return; 4954 } 4955 this.state = newState; 4956 this.updateTick += 1; 4957 const currentTick = this.updateTick; 4958 for (const listener of this.listeners) { 4959 if (currentTick !== this.updateTick) { 4960 return; 4961 } 4962 listener(newState); 4963 } 4964 } 4965 /** 4966 * Merges the provided changes into the current state and notifies listeners if there are changes. 4967 * 4968 * @param changes An object containing the changes to apply to the current state. 4969 */ 4970 update(changes) { 4971 for (const key in changes) { 4972 if (!Object.is(this.state[key], changes[key])) { 4973 this.setState({ 4974 ...this.state, 4975 ...changes 4976 }); 4977 return; 4978 } 4979 } 4980 } 4981 /** 4982 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 4983 * 4984 * @param key The key in the store's state to update. 4985 * @param value The new value to set for the specified key. 4986 */ 4987 set(key, value) { 4988 if (!Object.is(this.state[key], value)) { 4989 this.setState({ 4990 ...this.state, 4991 [key]: value 4992 }); 4993 } 4994 } 4995 /** 4996 * Gives the state a new reference and updates all registered listeners. 4997 */ 4998 notifyAll() { 4999 const newState = { 5000 ...this.state 5001 }; 5002 this.setState(newState); 5003 } 5004 use(selector, a1, a2, a3) { 5005 return useStore(this, selector, a1, a2, a3); 5006 } 5007 }; 5008 5009 // node_modules/@base-ui/utils/esm/store/ReactStore.js 5010 var React26 = __toESM(require_react(), 1); 5011 var ReactStore = class extends Store { 5012 /** 5013 * Creates a new ReactStore instance. 5014 * 5015 * @param state Initial state of the store. 5016 * @param context Non-reactive context values. 5017 * @param selectors Optional selectors for use with `useState`. 5018 */ 5019 constructor(state, context = {}, selectors3) { 5020 super(state); 5021 this.context = context; 5022 this.selectors = selectors3; 5023 } 5024 /** 5025 * Non-reactive values such as refs, callbacks, etc. 5026 */ 5027 /** 5028 * Synchronizes a single external value into the store. 5029 * 5030 * Note that the while the value in `state` is updated immediately, the value returned 5031 * by `useState` is updated before the next render (similarly to React's `useState`). 5032 */ 5033 useSyncedValue(key, value) { 5034 React26.useDebugValue(key); 5035 const store2 = this; 5036 useIsoLayoutEffect(() => { 5037 if (store2.state[key] !== value) { 5038 store2.set(key, value); 5039 } 5040 }, [store2, key, value]); 5041 } 5042 /** 5043 * Synchronizes a single external value into the store and 5044 * cleans it up (sets to `undefined`) on unmount. 5045 * 5046 * Note that the while the value in `state` is updated immediately, the value returned 5047 * by `useState` is updated before the next render (similarly to React's `useState`). 5048 */ 5049 useSyncedValueWithCleanup(key, value) { 5050 const store2 = this; 5051 useIsoLayoutEffect(() => { 5052 if (store2.state[key] !== value) { 5053 store2.set(key, value); 5054 } 5055 return () => { 5056 store2.set(key, void 0); 5057 }; 5058 }, [store2, key, value]); 5059 } 5060 /** 5061 * Synchronizes multiple external values into the store. 5062 * 5063 * Note that the while the values in `state` are updated immediately, the values returned 5064 * by `useState` are updated before the next render (similarly to React's `useState`). 5065 */ 5066 useSyncedValues(statePart) { 5067 const store2 = this; 5068 if (true) { 5069 React26.useDebugValue(statePart, (p) => Object.keys(p)); 5070 const keys = React26.useRef(Object.keys(statePart)).current; 5071 const nextKeys = Object.keys(statePart); 5072 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { 5073 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 5074 } 5075 } 5076 const dependencies = Object.values(statePart); 5077 useIsoLayoutEffect(() => { 5078 store2.update(statePart); 5079 }, [store2, ...dependencies]); 5080 } 5081 /** 5082 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 5083 * is non-undefined, the store's state at `key` is updated to match `controlled`. 5084 */ 5085 useControlledProp(key, controlled) { 5086 React26.useDebugValue(key); 5087 const store2 = this; 5088 const isControlled = controlled !== void 0; 5089 useIsoLayoutEffect(() => { 5090 if (isControlled && !Object.is(store2.state[key], controlled)) { 5091 store2.setState({ 5092 ...store2.state, 5093 [key]: controlled 5094 }); 5095 } 5096 }, [store2, key, controlled, isControlled]); 5097 if (true) { 5098 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 5099 if (!cache.has(key)) { 5100 cache.set(key, isControlled); 5101 } 5102 const previouslyControlled = cache.get(key); 5103 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 5104 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).`); 5105 } 5106 } 5107 } 5108 /** Gets the current value from the store using a selector with the provided key. 5109 * 5110 * @param key Key of the selector to use. 5111 */ 5112 select(key, a1, a2, a3) { 5113 const selector = this.selectors[key]; 5114 return selector(this.state, a1, a2, a3); 5115 } 5116 /** 5117 * Returns a value from the store's state using a selector function. 5118 * Used to subscribe to specific parts of the state. 5119 * This methods causes a rerender whenever the selected state changes. 5120 * 5121 * @param key Key of the selector to use. 5122 */ 5123 useState(key, a1, a2, a3) { 5124 React26.useDebugValue(key); 5125 return useStore(this, this.selectors[key], a1, a2, a3); 5126 } 5127 /** 5128 * Wraps a function with `useStableCallback` to ensure it has a stable reference 5129 * and assigns it to the context. 5130 * 5131 * @param key Key of the event callback. Must be a function in the context. 5132 * @param fn Function to assign. 5133 */ 5134 useContextCallback(key, fn) { 5135 React26.useDebugValue(key); 5136 const stableFunction = useStableCallback(fn ?? NOOP); 5137 this.context[key] = stableFunction; 5138 } 5139 /** 5140 * Returns a stable setter function for a specific key in the store's state. 5141 * It's commonly used to pass as a ref callback to React elements. 5142 * 5143 * @param key Key of the state to set. 5144 */ 5145 useStateSetter(key) { 5146 const ref = React26.useRef(void 0); 5147 if (ref.current === void 0) { 5148 ref.current = (value) => { 5149 this.set(key, value); 5150 }; 5151 } 5152 return ref.current; 5153 } 5154 /** 5155 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 5156 * 5157 * @param key Key of the selector to observe. 5158 * @param listener Listener function called when the selector result changes. 5159 */ 5160 observe(selector, listener) { 5161 let selectFn; 5162 if (typeof selector === "function") { 5163 selectFn = selector; 5164 } else { 5165 selectFn = this.selectors[selector]; 5166 } 5167 let prevValue = selectFn(this.state); 5168 listener(prevValue, prevValue, this); 5169 return this.subscribe((nextState) => { 5170 const nextValue = selectFn(nextState); 5171 if (!Object.is(prevValue, nextValue)) { 5172 const oldValue = prevValue; 5173 prevValue = nextValue; 5174 listener(nextValue, oldValue, this); 5175 } 5176 }); 5177 } 5178 }; 5179 5180 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingRootStore.js 5181 var selectors = { 5182 open: createSelector((state) => state.open), 5183 transitionStatus: createSelector((state) => state.transitionStatus), 5184 domReferenceElement: createSelector((state) => state.domReferenceElement), 5185 referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement), 5186 floatingElement: createSelector((state) => state.floatingElement), 5187 floatingId: createSelector((state) => state.floatingId) 5188 }; 5189 var FloatingRootStore = class extends ReactStore { 5190 constructor(options) { 5191 const { 5192 syncOnly, 5193 nested, 5194 onOpenChange, 5195 triggerElements, 5196 ...initialState 5197 } = options; 5198 super({ 5199 ...initialState, 5200 positionReference: initialState.referenceElement, 5201 domReferenceElement: initialState.referenceElement 5202 }, { 5203 onOpenChange, 5204 dataRef: { 5205 current: {} 5206 }, 5207 events: createEventEmitter(), 5208 nested, 5209 triggerElements 5210 }, selectors); 5211 this.syncOnly = syncOnly; 5212 } 5213 /** 5214 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 5215 */ 5216 syncOpenEvent = (newOpen, event) => { 5217 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 5218 // click events to upgrade a hover-open. 5219 event != null && isClickLikeEvent(event)) { 5220 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 5221 } 5222 }; 5223 /** 5224 * Runs the root-owned side effects for an open state change. 5225 */ 5226 dispatchOpenChange = (newOpen, eventDetails) => { 5227 this.syncOpenEvent(newOpen, eventDetails.event); 5228 const details = { 5229 open: newOpen, 5230 reason: eventDetails.reason, 5231 nativeEvent: eventDetails.event, 5232 nested: this.context.nested, 5233 triggerElement: eventDetails.trigger 5234 }; 5235 this.context.events.emit("openchange", details); 5236 }; 5237 /** 5238 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 5239 * 5240 * @param newOpen The new open state. 5241 * @param eventDetails Details about the event that triggered the open state change. 5242 */ 5243 setOpen = (newOpen, eventDetails) => { 5244 if (this.syncOnly) { 5245 this.context.onOpenChange?.(newOpen, eventDetails); 5246 return; 5247 } 5248 this.dispatchOpenChange(newOpen, eventDetails); 5249 this.context.onOpenChange?.(newOpen, eventDetails); 5250 }; 5251 }; 5252 5253 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js 5254 function useSyncedFloatingRootContext(options) { 5255 const { 5256 popupStore, 5257 treatPopupAsFloatingElement = false, 5258 floatingRootContext: floatingRootContextProp, 5259 floatingId, 5260 nested, 5261 onOpenChange 5262 } = options; 5263 const open = popupStore.useState("open"); 5264 const referenceElement = popupStore.useState("activeTriggerElement"); 5265 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 5266 const triggerElements = popupStore.context.triggerElements; 5267 const handleOpenChange = onOpenChange; 5268 const internalStoreRef = React27.useRef(null); 5269 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { 5270 internalStoreRef.current = new FloatingRootStore({ 5271 open, 5272 transitionStatus: void 0, 5273 referenceElement, 5274 floatingElement, 5275 triggerElements, 5276 onOpenChange: handleOpenChange, 5277 floatingId, 5278 syncOnly: true, 5279 nested 5280 }); 5281 } 5282 const store2 = floatingRootContextProp ?? internalStoreRef.current; 5283 popupStore.useSyncedValue("floatingId", floatingId); 5284 useIsoLayoutEffect(() => { 5285 const valuesToSync = { 5286 open, 5287 floatingId, 5288 referenceElement, 5289 floatingElement 5290 }; 5291 if (isElement(referenceElement)) { 5292 valuesToSync.domReferenceElement = referenceElement; 5293 } 5294 if (store2.state.positionReference === store2.state.referenceElement) { 5295 valuesToSync.positionReference = referenceElement; 5296 } 5297 store2.update(valuesToSync); 5298 }, [open, floatingId, referenceElement, floatingElement, store2]); 5299 store2.context.onOpenChange = handleOpenChange; 5300 store2.context.nested = nested; 5301 return store2; 5302 } 5303 5304 // node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js 5305 var FOCUSABLE_POPUP_PROPS = { 5306 tabIndex: -1, 5307 [FOCUSABLE_ATTRIBUTE]: "" 5308 }; 5309 function usePopupStore(externalStore, createStore, treatPopupAsFloatingElement = false) { 5310 const floatingId = useId(); 5311 const nested = useFloatingParentNodeId() != null; 5312 const internalStoreRef = React28.useRef(null); 5313 if (externalStore === void 0 && internalStoreRef.current === null) { 5314 internalStoreRef.current = createStore(floatingId, nested); 5315 } 5316 const store2 = externalStore ?? internalStoreRef.current; 5317 useSyncedFloatingRootContext({ 5318 popupStore: store2, 5319 treatPopupAsFloatingElement, 5320 floatingRootContext: store2.state.floatingRootContext, 5321 floatingId, 5322 nested, 5323 onOpenChange: store2.setOpen 5324 }); 5325 return { 5326 store: store2, 5327 internalStore: internalStoreRef.current 5328 }; 5329 } 5330 function useTriggerRegistration(id, store2) { 5331 const registeredElementIdRef = React28.useRef(null); 5332 const registeredElementRef = React28.useRef(null); 5333 return React28.useCallback((element) => { 5334 if (id === void 0) { 5335 return; 5336 } 5337 let shouldSyncTriggerCount = false; 5338 if (registeredElementIdRef.current !== null) { 5339 const registeredId = registeredElementIdRef.current; 5340 const registeredElement = registeredElementRef.current; 5341 const currentElement = store2.context.triggerElements.getById(registeredId); 5342 if (registeredElement && currentElement === registeredElement) { 5343 store2.context.triggerElements.delete(registeredId); 5344 shouldSyncTriggerCount = true; 5345 } 5346 registeredElementIdRef.current = null; 5347 registeredElementRef.current = null; 5348 } 5349 if (element !== null) { 5350 registeredElementIdRef.current = id; 5351 registeredElementRef.current = element; 5352 store2.context.triggerElements.add(id, element); 5353 shouldSyncTriggerCount = true; 5354 } 5355 if (shouldSyncTriggerCount) { 5356 const triggerCount = store2.context.triggerElements.size; 5357 if (store2.select("open") && store2.state.triggerCount !== triggerCount) { 5358 store2.set("triggerCount", triggerCount); 5359 } 5360 } 5361 }, [store2, id]); 5362 } 5363 function setOpenTriggerState(state, open, trigger) { 5364 const triggerId = trigger?.id ?? null; 5365 if (triggerId || open) { 5366 state.activeTriggerId = triggerId; 5367 state.activeTriggerElement = trigger ?? null; 5368 } 5369 } 5370 function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) { 5371 const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId); 5372 const baseRegisterTrigger = useTriggerRegistration(triggerId, store2); 5373 const registerTrigger = useStableCallback((element) => { 5374 baseRegisterTrigger(element); 5375 if (!element) { 5376 return; 5377 } 5378 const open = store2.select("open"); 5379 const activeTriggerId = store2.select("activeTriggerId"); 5380 if (activeTriggerId === triggerId) { 5381 store2.update({ 5382 activeTriggerElement: element, 5383 ...open ? stateUpdates : null 5384 }); 5385 return; 5386 } 5387 if (activeTriggerId == null && open) { 5388 store2.update({ 5389 activeTriggerId: triggerId, 5390 activeTriggerElement: element, 5391 ...stateUpdates 5392 }); 5393 } 5394 }); 5395 useIsoLayoutEffect(() => { 5396 if (isMountedByThisTrigger) { 5397 store2.update({ 5398 activeTriggerElement: triggerElementRef.current, 5399 ...stateUpdates 5400 }); 5401 } 5402 }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]); 5403 return { 5404 registerTrigger, 5405 isMountedByThisTrigger 5406 }; 5407 } 5408 function useImplicitActiveTrigger(store2) { 5409 const open = store2.useState("open"); 5410 const reactiveTriggerCount = store2.useState("triggerCount"); 5411 useIsoLayoutEffect(() => { 5412 if (!open) { 5413 if (store2.state.triggerCount !== 0) { 5414 store2.set("triggerCount", 0); 5415 } 5416 return; 5417 } 5418 const triggerCount = store2.context.triggerElements.size; 5419 const stateUpdates = {}; 5420 if (store2.state.triggerCount !== triggerCount) { 5421 stateUpdates.triggerCount = triggerCount; 5422 } 5423 if (!store2.select("activeTriggerId") && triggerCount === 1) { 5424 const iteratorResult = store2.context.triggerElements.entries().next(); 5425 if (!iteratorResult.done) { 5426 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 5427 stateUpdates.activeTriggerId = implicitTriggerId; 5428 stateUpdates.activeTriggerElement = implicitTriggerElement; 5429 } 5430 } 5431 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0) { 5432 store2.update(stateUpdates); 5433 } 5434 }, [open, store2, reactiveTriggerCount]); 5435 } 5436 function useOpenStateTransitions(open, store2, onUnmount) { 5437 const { 5438 mounted, 5439 setMounted, 5440 transitionStatus 5441 } = useTransitionStatus(open); 5442 store2.useSyncedValues({ 5443 mounted, 5444 transitionStatus 5445 }); 5446 const forceUnmount = useStableCallback(() => { 5447 setMounted(false); 5448 store2.update({ 5449 activeTriggerId: null, 5450 activeTriggerElement: null, 5451 mounted: false, 5452 preventUnmountingOnClose: false 5453 }); 5454 onUnmount?.(); 5455 store2.context.onOpenChangeComplete?.(false); 5456 }); 5457 const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose"); 5458 useOpenChangeComplete({ 5459 enabled: mounted && !open && !preventUnmountingOnClose, 5460 open, 5461 ref: store2.context.popupRef, 5462 onComplete() { 5463 if (!open) { 5464 forceUnmount(); 5465 } 5466 } 5467 }); 5468 return { 5469 forceUnmount, 5470 transitionStatus 5471 }; 5472 } 5473 function usePopupInteractionProps(store2, statePart) { 5474 store2.useSyncedValues(statePart); 5475 useIsoLayoutEffect(() => () => { 5476 store2.update({ 5477 activeTriggerProps: EMPTY_OBJECT, 5478 inactiveTriggerProps: EMPTY_OBJECT, 5479 popupProps: EMPTY_OBJECT 5480 }); 5481 }, [store2]); 5482 } 5483 5484 // node_modules/@base-ui/react/esm/utils/popups/popupTriggerMap.js 5485 var PopupTriggerMap = class { 5486 constructor() { 5487 this.elementsSet = /* @__PURE__ */ new Set(); 5488 this.idMap = /* @__PURE__ */ new Map(); 5489 } 5490 /** 5491 * Adds a trigger element with the given ID. 5492 * 5493 * Note: The provided element is assumed to not be registered under multiple IDs. 5494 */ 5495 add(id, element) { 5496 const existingElement = this.idMap.get(id); 5497 if (existingElement === element) { 5498 return; 5499 } 5500 if (existingElement !== void 0) { 5501 this.elementsSet.delete(existingElement); 5502 } 5503 this.elementsSet.add(element); 5504 this.idMap.set(id, element); 5505 if (true) { 5506 if (this.elementsSet.size !== this.idMap.size) { 5507 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 5508 } 5509 } 5510 } 5511 /** 5512 * Removes the trigger element with the given ID. 5513 */ 5514 delete(id) { 5515 const element = this.idMap.get(id); 5516 if (element) { 5517 this.elementsSet.delete(element); 5518 this.idMap.delete(id); 5519 } 5520 } 5521 /** 5522 * Whether the given element is registered as a trigger. 5523 */ 5524 hasElement(element) { 5525 return this.elementsSet.has(element); 5526 } 5527 /** 5528 * Whether there is a registered trigger element matching the given predicate. 5529 */ 5530 hasMatchingElement(predicate) { 5531 for (const element of this.elementsSet) { 5532 if (predicate(element)) { 5533 return true; 5534 } 5535 } 5536 return false; 5537 } 5538 /** 5539 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 5540 */ 5541 getById(id) { 5542 return this.idMap.get(id); 5543 } 5544 /** 5545 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 5546 */ 5547 entries() { 5548 return this.idMap.entries(); 5549 } 5550 /** 5551 * Returns an iterable of all registered trigger elements. 5552 */ 5553 elements() { 5554 return this.elementsSet.values(); 5555 } 5556 /** 5557 * Returns the number of registered trigger elements. 5558 */ 5559 get size() { 5560 return this.idMap.size; 5561 } 5562 }; 5563 5564 // node_modules/@base-ui/react/esm/floating-ui-react/utils/getEmptyRootContext.js 5565 function getEmptyRootContext() { 5566 return new FloatingRootStore({ 5567 open: false, 5568 transitionStatus: void 0, 5569 floatingElement: null, 5570 referenceElement: null, 5571 triggerElements: new PopupTriggerMap(), 5572 floatingId: void 0, 5573 syncOnly: false, 5574 nested: false, 5575 onOpenChange: void 0 5576 }); 5577 } 5578 5579 // node_modules/@base-ui/react/esm/utils/popups/store.js 5580 function createInitialPopupStoreState() { 5581 return { 5582 open: false, 5583 openProp: void 0, 5584 mounted: false, 5585 transitionStatus: void 0, 5586 floatingRootContext: getEmptyRootContext(), 5587 floatingId: void 0, 5588 triggerCount: 0, 5589 preventUnmountingOnClose: false, 5590 payload: void 0, 5591 activeTriggerId: null, 5592 activeTriggerElement: null, 5593 triggerIdProp: void 0, 5594 popupElement: null, 5595 positionerElement: null, 5596 activeTriggerProps: EMPTY_OBJECT, 5597 inactiveTriggerProps: EMPTY_OBJECT, 5598 popupProps: EMPTY_OBJECT 5599 }; 5600 } 5601 function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) { 5602 return new FloatingRootStore({ 5603 open: false, 5604 transitionStatus: void 0, 5605 floatingElement: null, 5606 referenceElement: null, 5607 triggerElements, 5608 floatingId, 5609 syncOnly: true, 5610 nested, 5611 onOpenChange: void 0 5612 }); 5613 } 5614 var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId); 5615 var openSelector = createSelector((state) => state.openProp ?? state.open); 5616 var popupIdSelector = createSelector((state) => { 5617 const popupId = state.popupElement?.id ?? state.floatingId; 5618 return popupId || void 0; 5619 }); 5620 function triggerOwnsOpenPopup(state, triggerId) { 5621 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; 5622 } 5623 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { 5624 if (triggerOwnsOpenPopup(state, triggerId)) { 5625 return true; 5626 } 5627 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; 5628 } 5629 var popupStoreSelectors = { 5630 open: openSelector, 5631 mounted: createSelector((state) => state.mounted), 5632 transitionStatus: createSelector((state) => state.transitionStatus), 5633 floatingRootContext: createSelector((state) => state.floatingRootContext), 5634 triggerCount: createSelector((state) => state.triggerCount), 5635 preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose), 5636 payload: createSelector((state) => state.payload), 5637 activeTriggerId: activeTriggerIdSelector, 5638 activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null), 5639 popupId: popupIdSelector, 5640 /** 5641 * Whether the trigger with the given ID was used to open the popup. 5642 */ 5643 isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId), 5644 /** 5645 * Whether the popup is open and was activated by a trigger with the given ID. 5646 */ 5647 isOpenedByTrigger: createSelector((state, triggerId) => triggerOwnsOpenPopup(state, triggerId)), 5648 /** 5649 * Whether the popup is mounted and was activated by a trigger with the given ID. 5650 */ 5651 isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted), 5652 triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps), 5653 /** 5654 * Popup id for the trigger that currently owns the open popup. 5655 */ 5656 triggerPopupId: createSelector((state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0), 5657 popupProps: createSelector((state) => state.popupProps), 5658 popupElement: createSelector((state) => state.popupElement), 5659 positionerElement: createSelector((state) => state.positionerElement) 5660 }; 5661 5662 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloatingRootContext.js 5663 function useFloatingRootContext(options) { 5664 const { 5665 open = false, 5666 onOpenChange, 5667 elements = {} 5668 } = options; 5669 const floatingId = useId(); 5670 const nested = useFloatingParentNodeId() != null; 5671 if (true) { 5672 const optionDomReference = elements.reference; 5673 if (optionDomReference && !isElement(optionDomReference)) { 5674 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); 5675 } 5676 } 5677 const store2 = useRefWithInit(() => new FloatingRootStore({ 5678 open, 5679 transitionStatus: void 0, 5680 onOpenChange, 5681 referenceElement: elements.reference ?? null, 5682 floatingElement: elements.floating ?? null, 5683 triggerElements: new PopupTriggerMap(), 5684 floatingId, 5685 syncOnly: false, 5686 nested 5687 })).current; 5688 useIsoLayoutEffect(() => { 5689 const valuesToSync = { 5690 open, 5691 floatingId 5692 }; 5693 if (elements.reference !== void 0) { 5694 valuesToSync.referenceElement = elements.reference; 5695 valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null; 5696 } 5697 if (elements.floating !== void 0) { 5698 valuesToSync.floatingElement = elements.floating; 5699 } 5700 store2.update(valuesToSync); 5701 }, [open, floatingId, elements.reference, elements.floating, store2]); 5702 store2.context.onOpenChange = onOpenChange; 5703 store2.context.nested = nested; 5704 return store2; 5705 } 5706 5707 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js 5708 function useFloating2(options = {}) { 5709 const { 5710 nodeId, 5711 externalTree 5712 } = options; 5713 const internalStore = useFloatingRootContext(options); 5714 const store2 = options.rootContext || internalStore; 5715 const referenceElement = store2.useState("referenceElement"); 5716 const floatingElement = store2.useState("floatingElement"); 5717 const domReferenceElement = store2.useState("domReferenceElement"); 5718 const open = store2.useState("open"); 5719 const floatingId = store2.useState("floatingId"); 5720 const [positionReference, setPositionReferenceRaw] = React29.useState(null); 5721 const [localDomReference, setLocalDomReference] = React29.useState(void 0); 5722 const [localFloatingElement, setLocalFloatingElement] = React29.useState(void 0); 5723 const domReferenceRef = React29.useRef(null); 5724 const tree = useFloatingTree(externalTree); 5725 const storeElements = React29.useMemo(() => ({ 5726 reference: referenceElement, 5727 floating: floatingElement, 5728 domReference: domReferenceElement 5729 }), [referenceElement, floatingElement, domReferenceElement]); 5730 const position = useFloating({ 5731 ...options, 5732 elements: { 5733 ...storeElements, 5734 ...positionReference && { 5735 reference: positionReference 5736 } 5737 } 5738 }); 5739 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; 5740 const syncedFloatingElement = localFloatingElement === void 0 ? store2.state.floatingElement : localFloatingElement; 5741 store2.useSyncedValue("referenceElement", localDomReference ?? null); 5742 store2.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); 5743 store2.useSyncedValue("floatingElement", syncedFloatingElement); 5744 const setPositionReference = React29.useCallback((node) => { 5745 const computedPositionReference = isElement(node) ? { 5746 getBoundingClientRect: () => node.getBoundingClientRect(), 5747 getClientRects: () => node.getClientRects(), 5748 contextElement: node 5749 } : node; 5750 setPositionReferenceRaw(computedPositionReference); 5751 position.refs.setReference(computedPositionReference); 5752 }, [position.refs]); 5753 const setReference = React29.useCallback((node) => { 5754 if (isElement(node) || node === null) { 5755 domReferenceRef.current = node; 5756 setLocalDomReference(node); 5757 } 5758 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to 5759 // `null` to support `positionReference` + an unstable `reference` 5760 // callback ref. 5761 node !== null && !isElement(node)) { 5762 position.refs.setReference(node); 5763 } 5764 }, [position.refs, setLocalDomReference]); 5765 const setFloating = React29.useCallback((node) => { 5766 setLocalFloatingElement(node); 5767 position.refs.setFloating(node); 5768 }, [position.refs]); 5769 const refs = React29.useMemo(() => ({ 5770 ...position.refs, 5771 setReference, 5772 setFloating, 5773 setPositionReference, 5774 domReference: domReferenceRef 5775 }), [position.refs, setReference, setFloating, setPositionReference]); 5776 const elements = React29.useMemo(() => ({ 5777 ...position.elements, 5778 domReference: domReferenceElement 5779 }), [position.elements, domReferenceElement]); 5780 const context = React29.useMemo(() => ({ 5781 ...position, 5782 dataRef: store2.context.dataRef, 5783 open, 5784 onOpenChange: store2.setOpen, 5785 events: store2.context.events, 5786 floatingId, 5787 refs, 5788 elements, 5789 nodeId, 5790 rootStore: store2 5791 }), [position, refs, elements, nodeId, store2, open, floatingId]); 5792 useIsoLayoutEffect(() => { 5793 if (domReferenceElement) { 5794 domReferenceRef.current = domReferenceElement; 5795 } 5796 }, [domReferenceElement]); 5797 useIsoLayoutEffect(() => { 5798 store2.context.dataRef.current.floatingContext = context; 5799 const node = tree?.nodesRef.current.find((n) => n.id === nodeId); 5800 if (node) { 5801 node.context = context; 5802 } 5803 }); 5804 return React29.useMemo(() => ({ 5805 ...position, 5806 context, 5807 refs, 5808 elements, 5809 rootStore: store2 5810 }), [position, refs, elements, context, store2]); 5811 } 5812 5813 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFocus.js 5814 var React30 = __toESM(require_react(), 1); 5815 var isMacSafari = isMac && isSafari; 5816 function useFocus(context, props = {}) { 5817 const { 5818 enabled = true, 5819 delay 5820 } = props; 5821 const store2 = "rootStore" in context ? context.rootStore : context; 5822 const { 5823 events, 5824 dataRef 5825 } = store2.context; 5826 const blockFocusRef = React30.useRef(false); 5827 const blockedReferenceRef = React30.useRef(null); 5828 const keyboardModalityRef = React30.useRef(true); 5829 const timeout = useTimeout(); 5830 React30.useEffect(() => { 5831 const domReference = store2.select("domReferenceElement"); 5832 if (!enabled) { 5833 return void 0; 5834 } 5835 const win = getWindow(domReference); 5836 function onBlur() { 5837 const currentDomReference = store2.select("domReferenceElement"); 5838 if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 5839 blockFocusRef.current = true; 5840 } 5841 } 5842 function onKeyDown() { 5843 keyboardModalityRef.current = true; 5844 } 5845 function onPointerDown() { 5846 keyboardModalityRef.current = false; 5847 } 5848 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 5849 }, [store2, enabled]); 5850 React30.useEffect(() => { 5851 if (!enabled) { 5852 return void 0; 5853 } 5854 function onOpenChangeLocal(details) { 5855 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 5856 const referenceElement = store2.select("domReferenceElement"); 5857 if (isElement(referenceElement)) { 5858 blockedReferenceRef.current = referenceElement; 5859 blockFocusRef.current = true; 5860 } 5861 } 5862 } 5863 events.on("openchange", onOpenChangeLocal); 5864 return () => { 5865 events.off("openchange", onOpenChangeLocal); 5866 }; 5867 }, [events, enabled, store2]); 5868 const reference = React30.useMemo(() => { 5869 function resetBlockedFocus() { 5870 blockFocusRef.current = false; 5871 blockedReferenceRef.current = null; 5872 } 5873 return { 5874 onMouseLeave() { 5875 resetBlockedFocus(); 5876 }, 5877 onFocus(event) { 5878 const focusTarget = event.currentTarget; 5879 if (blockFocusRef.current) { 5880 if (blockedReferenceRef.current === focusTarget) { 5881 return; 5882 } 5883 resetBlockedFocus(); 5884 } 5885 const target = getTarget(event.nativeEvent); 5886 if (isElement(target)) { 5887 if (isMacSafari && !event.relatedTarget) { 5888 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 5889 return; 5890 } 5891 } else if (!matchesFocusVisible(target)) { 5892 return; 5893 } 5894 } 5895 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements); 5896 const { 5897 nativeEvent, 5898 currentTarget 5899 } = event; 5900 const delayValue = typeof delay === "function" ? delay() : delay; 5901 if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { 5902 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 5903 return; 5904 } 5905 timeout.start(delayValue, () => { 5906 if (blockFocusRef.current) { 5907 return; 5908 } 5909 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 5910 }); 5911 }, 5912 onBlur(event) { 5913 resetBlockedFocus(); 5914 const relatedTarget = event.relatedTarget; 5915 const nativeEvent = event.nativeEvent; 5916 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 5917 timeout.start(0, () => { 5918 const domReference = store2.select("domReferenceElement"); 5919 const activeEl = activeElement(ownerDocument(domReference)); 5920 if (!relatedTarget && activeEl === domReference) { 5921 return; 5922 } 5923 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 5924 return; 5925 } 5926 const nextFocusedElement = relatedTarget ?? activeEl; 5927 if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) { 5928 return; 5929 } 5930 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 5931 }); 5932 } 5933 }; 5934 }, [dataRef, delay, store2, timeout]); 5935 return React30.useMemo(() => enabled ? { 5936 reference, 5937 trigger: reference 5938 } : {}, [enabled, reference]); 5939 } 5940 5941 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js 5942 var React31 = __toESM(require_react(), 1); 5943 5944 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js 5945 var HoverInteraction = class _HoverInteraction { 5946 constructor() { 5947 this.pointerType = void 0; 5948 this.interactedInside = false; 5949 this.handler = void 0; 5950 this.blockMouseMove = true; 5951 this.performedPointerEventsMutation = false; 5952 this.pointerEventsScopeElement = null; 5953 this.pointerEventsReferenceElement = null; 5954 this.pointerEventsFloatingElement = null; 5955 this.restTimeoutPending = false; 5956 this.openChangeTimeout = new Timeout(); 5957 this.restTimeout = new Timeout(); 5958 this.handleCloseOptions = void 0; 5959 } 5960 static create() { 5961 return new _HoverInteraction(); 5962 } 5963 dispose = () => { 5964 this.openChangeTimeout.clear(); 5965 this.restTimeout.clear(); 5966 }; 5967 disposeEffect = () => { 5968 return this.dispose; 5969 }; 5970 }; 5971 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 5972 function clearSafePolygonPointerEventsMutation(instance) { 5973 if (!instance.performedPointerEventsMutation) { 5974 return; 5975 } 5976 const scopeElement = instance.pointerEventsScopeElement; 5977 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 5978 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 5979 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 5980 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 5981 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 5982 } 5983 instance.performedPointerEventsMutation = false; 5984 instance.pointerEventsScopeElement = null; 5985 instance.pointerEventsReferenceElement = null; 5986 instance.pointerEventsFloatingElement = null; 5987 } 5988 function applySafePolygonPointerEventsMutation(instance, options) { 5989 const { 5990 scopeElement, 5991 referenceElement, 5992 floatingElement 5993 } = options; 5994 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 5995 if (existingOwner && existingOwner !== instance) { 5996 clearSafePolygonPointerEventsMutation(existingOwner); 5997 } 5998 clearSafePolygonPointerEventsMutation(instance); 5999 instance.performedPointerEventsMutation = true; 6000 instance.pointerEventsScopeElement = scopeElement; 6001 instance.pointerEventsReferenceElement = referenceElement; 6002 instance.pointerEventsFloatingElement = floatingElement; 6003 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 6004 scopeElement.style.pointerEvents = "none"; 6005 referenceElement.style.pointerEvents = "auto"; 6006 floatingElement.style.pointerEvents = "auto"; 6007 } 6008 function useHoverInteractionSharedState(store2) { 6009 const data = store2.context.dataRef.current; 6010 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; 6011 if (!data.hoverInteractionState) { 6012 data.hoverInteractionState = instance; 6013 } 6014 useOnMount(data.hoverInteractionState.disposeEffect); 6015 return data.hoverInteractionState; 6016 } 6017 6018 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js 6019 function useHoverFloatingInteraction(context, parameters = {}) { 6020 const { 6021 enabled = true, 6022 closeDelay: closeDelayProp = 0, 6023 nodeId: nodeIdProp 6024 } = parameters; 6025 const store2 = "rootStore" in context ? context.rootStore : context; 6026 const open = store2.useState("open"); 6027 const floatingElement = store2.useState("floatingElement"); 6028 const domReferenceElement = store2.useState("domReferenceElement"); 6029 const { 6030 dataRef 6031 } = store2.context; 6032 const tree = useFloatingTree(); 6033 const parentId = useFloatingParentNodeId(); 6034 const instance = useHoverInteractionSharedState(store2); 6035 const childClosedTimeout = useTimeout(); 6036 const isClickLikeOpenEvent2 = useStableCallback(() => { 6037 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 6038 }); 6039 const isHoverOpen = useStableCallback(() => { 6040 return isHoverOpenEvent(dataRef.current.openEvent?.type); 6041 }); 6042 const clearPointerEvents = useStableCallback(() => { 6043 clearSafePolygonPointerEventsMutation(instance); 6044 }); 6045 useIsoLayoutEffect(() => { 6046 if (!open) { 6047 instance.pointerType = void 0; 6048 instance.restTimeoutPending = false; 6049 instance.interactedInside = false; 6050 clearPointerEvents(); 6051 } 6052 }, [open, instance, clearPointerEvents]); 6053 React31.useEffect(() => { 6054 return clearPointerEvents; 6055 }, [clearPointerEvents]); 6056 useIsoLayoutEffect(() => { 6057 if (!enabled) { 6058 return void 0; 6059 } 6060 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 6061 const ref = domReferenceElement; 6062 const floatingEl = floatingElement; 6063 const doc = ownerDocument(floatingElement); 6064 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 6065 if (parentFloating) { 6066 parentFloating.style.pointerEvents = ""; 6067 } 6068 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; 6069 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; 6070 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; 6071 applySafePolygonPointerEventsMutation(instance, { 6072 scopeElement, 6073 referenceElement: ref, 6074 floatingElement: floatingEl 6075 }); 6076 return () => { 6077 clearPointerEvents(); 6078 }; 6079 } 6080 return void 0; 6081 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 6082 React31.useEffect(() => { 6083 if (!enabled) { 6084 return void 0; 6085 } 6086 function hasParentChildren() { 6087 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); 6088 } 6089 function closeWithDelay(event) { 6090 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 6091 const close = () => { 6092 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6093 tree?.events.emit("floating.closed", event); 6094 }; 6095 if (closeDelay) { 6096 instance.openChangeTimeout.start(closeDelay, close); 6097 } else { 6098 instance.openChangeTimeout.clear(); 6099 close(); 6100 } 6101 } 6102 function handleInteractInside(event) { 6103 const target = getTarget(event); 6104 if (!isInteractiveElement(target)) { 6105 instance.interactedInside = false; 6106 return; 6107 } 6108 instance.interactedInside = target?.closest("[aria-haspopup]") != null; 6109 } 6110 function onFloatingMouseEnter() { 6111 instance.openChangeTimeout.clear(); 6112 childClosedTimeout.clear(); 6113 tree?.events.off("floating.closed", onNodeClosed); 6114 clearPointerEvents(); 6115 } 6116 function onFloatingMouseLeave(event) { 6117 if (hasParentChildren() && tree) { 6118 tree.events.on("floating.closed", onNodeClosed); 6119 return; 6120 } 6121 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { 6122 return; 6123 } 6124 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 6125 const relatedTarget = event.relatedTarget; 6126 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 6127 if (isMovingIntoDescendantFloating) { 6128 return; 6129 } 6130 if (instance.handler) { 6131 instance.handler(event); 6132 return; 6133 } 6134 clearPointerEvents(); 6135 if (!isClickLikeOpenEvent2()) { 6136 closeWithDelay(event); 6137 } 6138 } 6139 function onNodeClosed(event) { 6140 if (!tree || !parentId || hasParentChildren()) { 6141 return; 6142 } 6143 childClosedTimeout.start(0, () => { 6144 tree.events.off("floating.closed", onNodeClosed); 6145 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6146 tree.events.emit("floating.closed", event); 6147 }); 6148 } 6149 const floating = floatingElement; 6150 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 6151 tree?.events.off("floating.closed", onNodeClosed); 6152 }); 6153 }, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); 6154 } 6155 6156 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js 6157 var React32 = __toESM(require_react(), 1); 6158 var ReactDOM4 = __toESM(require_react_dom(), 1); 6159 var EMPTY_REF = { 6160 current: null 6161 }; 6162 function useHoverReferenceInteraction(context, props = {}) { 6163 const { 6164 enabled = true, 6165 delay = 0, 6166 handleClose = null, 6167 mouseOnly = false, 6168 restMs = 0, 6169 move = true, 6170 triggerElementRef = EMPTY_REF, 6171 externalTree, 6172 isActiveTrigger = true, 6173 getHandleCloseContext, 6174 isClosing, 6175 shouldOpen: shouldOpenProp 6176 } = props; 6177 const store2 = "rootStore" in context ? context.rootStore : context; 6178 const { 6179 dataRef, 6180 events 6181 } = store2.context; 6182 const tree = useFloatingTree(externalTree); 6183 const instance = useHoverInteractionSharedState(store2); 6184 const isHoverCloseActiveRef = React32.useRef(false); 6185 const handleCloseRef = useValueAsRef(handleClose); 6186 const delayRef = useValueAsRef(delay); 6187 const restMsRef = useValueAsRef(restMs); 6188 const enabledRef = useValueAsRef(enabled); 6189 const shouldOpenRef = useValueAsRef(shouldOpenProp); 6190 const isClosingRef = useValueAsRef(isClosing); 6191 const isClickLikeOpenEvent2 = useStableCallback(() => { 6192 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 6193 }); 6194 const checkShouldOpen = useStableCallback(() => { 6195 return shouldOpenRef.current?.() !== false; 6196 }); 6197 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 6198 const allTriggers = store2.context.triggerElements; 6199 if (allTriggers.hasElement(currentTarget)) { 6200 return !currentDomReference || !contains(currentDomReference, currentTarget); 6201 } 6202 if (!isElement(target)) { 6203 return false; 6204 } 6205 const targetElement = target; 6206 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 6207 }); 6208 const cleanupMouseMoveHandler = useStableCallback(() => { 6209 if (!instance.handler) { 6210 return; 6211 } 6212 const doc = ownerDocument(store2.select("domReferenceElement")); 6213 doc.removeEventListener("mousemove", instance.handler); 6214 instance.handler = void 0; 6215 }); 6216 const clearPointerEvents = useStableCallback(() => { 6217 clearSafePolygonPointerEventsMutation(instance); 6218 }); 6219 if (isActiveTrigger) { 6220 instance.handleCloseOptions = handleCloseRef.current?.__options; 6221 } 6222 React32.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 6223 React32.useEffect(() => { 6224 if (!enabled) { 6225 return void 0; 6226 } 6227 function onOpenChangeLocal(details) { 6228 if (!details.open) { 6229 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 6230 cleanupMouseMoveHandler(); 6231 instance.openChangeTimeout.clear(); 6232 instance.restTimeout.clear(); 6233 instance.blockMouseMove = true; 6234 instance.restTimeoutPending = false; 6235 } else { 6236 isHoverCloseActiveRef.current = false; 6237 } 6238 } 6239 events.on("openchange", onOpenChangeLocal); 6240 return () => { 6241 events.off("openchange", onOpenChangeLocal); 6242 }; 6243 }, [enabled, events, instance, cleanupMouseMoveHandler]); 6244 React32.useEffect(() => { 6245 if (!enabled) { 6246 return void 0; 6247 } 6248 function closeWithDelay(event, runElseBranch = true) { 6249 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 6250 if (closeDelay) { 6251 instance.openChangeTimeout.start(closeDelay, () => { 6252 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6253 tree?.events.emit("floating.closed", event); 6254 }); 6255 } else if (runElseBranch) { 6256 instance.openChangeTimeout.clear(); 6257 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6258 tree?.events.emit("floating.closed", event); 6259 } 6260 } 6261 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null); 6262 if (!isElement(trigger)) { 6263 return void 0; 6264 } 6265 function onMouseEnter(event) { 6266 instance.openChangeTimeout.clear(); 6267 instance.blockMouseMove = false; 6268 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 6269 return; 6270 } 6271 const restMsValue = getRestMs(restMsRef.current); 6272 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 6273 const eventTarget = getTarget(event); 6274 const currentTarget = event.currentTarget ?? null; 6275 const currentDomReference = store2.select("domReferenceElement"); 6276 let triggerNode = currentTarget; 6277 if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) { 6278 for (const triggerElement of store2.context.triggerElements.elements()) { 6279 if (contains(triggerElement, eventTarget)) { 6280 triggerNode = triggerElement; 6281 break; 6282 } 6283 } 6284 } 6285 if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 6286 triggerNode = currentDomReference; 6287 } 6288 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 6289 const isOpen = store2.select("open"); 6290 const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending"; 6291 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; 6292 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 6293 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 6294 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 6295 const shouldOpen = !isOpen || isOverInactive; 6296 if (shouldOpenImmediately) { 6297 if (checkShouldOpen()) { 6298 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6299 } 6300 return; 6301 } 6302 if (isRestOnlyDelay) { 6303 return; 6304 } 6305 if (openDelay) { 6306 instance.openChangeTimeout.start(openDelay, () => { 6307 if (shouldOpen && checkShouldOpen()) { 6308 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6309 } 6310 }); 6311 } else if (shouldOpen) { 6312 if (checkShouldOpen()) { 6313 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6314 } 6315 } 6316 } 6317 function onMouseLeave(event) { 6318 if (isClickLikeOpenEvent2()) { 6319 clearPointerEvents(); 6320 return; 6321 } 6322 cleanupMouseMoveHandler(); 6323 const domReferenceElement = store2.select("domReferenceElement"); 6324 const doc = ownerDocument(domReferenceElement); 6325 instance.restTimeout.clear(); 6326 instance.restTimeoutPending = false; 6327 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 6328 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { 6329 return; 6330 } 6331 if (handleCloseRef.current && handleCloseContextBase) { 6332 if (!store2.select("open")) { 6333 instance.openChangeTimeout.clear(); 6334 } 6335 const currentTrigger = triggerElementRef.current; 6336 instance.handler = handleCloseRef.current({ 6337 ...handleCloseContextBase, 6338 tree, 6339 x: event.clientX, 6340 y: event.clientY, 6341 onClose() { 6342 clearPointerEvents(); 6343 cleanupMouseMoveHandler(); 6344 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) { 6345 closeWithDelay(event, true); 6346 } 6347 } 6348 }); 6349 doc.addEventListener("mousemove", instance.handler); 6350 instance.handler(event); 6351 return; 6352 } 6353 const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true; 6354 if (shouldClose) { 6355 closeWithDelay(event); 6356 } 6357 } 6358 if (move) { 6359 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 6360 once: true 6361 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 6362 } 6363 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 6364 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen]); 6365 return React32.useMemo(() => { 6366 if (!enabled) { 6367 return void 0; 6368 } 6369 function setPointerRef(event) { 6370 instance.pointerType = event.pointerType; 6371 } 6372 return { 6373 onPointerDown: setPointerRef, 6374 onPointerEnter: setPointerRef, 6375 onMouseMove(event) { 6376 const { 6377 nativeEvent 6378 } = event; 6379 const trigger = event.currentTarget; 6380 const currentDomReference = store2.select("domReferenceElement"); 6381 const currentOpen = store2.select("open"); 6382 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 6383 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 6384 return; 6385 } 6386 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 6387 const floatingElement = store2.select("floatingElement"); 6388 if (floatingElement) { 6389 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 6390 applySafePolygonPointerEventsMutation(instance, { 6391 scopeElement, 6392 referenceElement: trigger, 6393 floatingElement 6394 }); 6395 } 6396 } 6397 const restMsValue = getRestMs(restMsRef.current); 6398 if (currentOpen && !isOverInactive || restMsValue === 0) { 6399 return; 6400 } 6401 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 6402 return; 6403 } 6404 instance.restTimeout.clear(); 6405 function handleMouseMove() { 6406 instance.restTimeoutPending = false; 6407 if (isClickLikeOpenEvent2()) { 6408 return; 6409 } 6410 const latestOpen = store2.select("open"); 6411 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { 6412 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 6413 } 6414 } 6415 if (instance.pointerType === "touch") { 6416 ReactDOM4.flushSync(() => { 6417 handleMouseMove(); 6418 }); 6419 } else if (isOverInactive && currentOpen) { 6420 handleMouseMove(); 6421 } else { 6422 instance.restTimeoutPending = true; 6423 instance.restTimeout.start(restMsValue, handleMouseMove); 6424 } 6425 } 6426 }; 6427 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]); 6428 } 6429 6430 // node_modules/@base-ui/react/esm/floating-ui-react/safePolygon.js 6431 var CURSOR_SPEED_THRESHOLD = 0.1; 6432 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 6433 var POLYGON_BUFFER = 0.5; 6434 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 6435 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 6436 } 6437 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { 6438 let isInsideValue = false; 6439 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { 6440 isInsideValue = !isInsideValue; 6441 } 6442 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { 6443 isInsideValue = !isInsideValue; 6444 } 6445 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 6446 isInsideValue = !isInsideValue; 6447 } 6448 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 6449 isInsideValue = !isInsideValue; 6450 } 6451 return isInsideValue; 6452 } 6453 function isInsideRect(pointX, pointY, rect) { 6454 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 6455 } 6456 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { 6457 const minX = Math.min(x1, x2); 6458 const maxX = Math.max(x1, x2); 6459 const minY = Math.min(y1, y2); 6460 const maxY = Math.max(y1, y2); 6461 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 6462 } 6463 function safePolygon(options = {}) { 6464 const { 6465 blockPointerEvents = false 6466 } = options; 6467 const timeout = new Timeout(); 6468 const fn = ({ 6469 x, 6470 y, 6471 placement, 6472 elements, 6473 onClose, 6474 nodeId, 6475 tree 6476 }) => { 6477 const side = placement?.split("-")[0]; 6478 let hasLanded = false; 6479 let lastX = null; 6480 let lastY = null; 6481 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 6482 function isCursorMovingSlowly(nextX, nextY) { 6483 const currentTime = performance.now(); 6484 const elapsedTime = currentTime - lastCursorTime; 6485 if (lastX === null || lastY === null || elapsedTime === 0) { 6486 lastX = nextX; 6487 lastY = nextY; 6488 lastCursorTime = currentTime; 6489 return false; 6490 } 6491 const deltaX = nextX - lastX; 6492 const deltaY = nextY - lastY; 6493 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 6494 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 6495 lastX = nextX; 6496 lastY = nextY; 6497 lastCursorTime = currentTime; 6498 return distanceSquared < thresholdSquared; 6499 } 6500 function close() { 6501 timeout.clear(); 6502 onClose(); 6503 } 6504 return function onMouseMove(event) { 6505 timeout.clear(); 6506 const domReference = elements.domReference; 6507 const floating = elements.floating; 6508 if (!domReference || !floating || side == null || x == null || y == null) { 6509 return void 0; 6510 } 6511 const { 6512 clientX, 6513 clientY 6514 } = event; 6515 const target = getTarget(event); 6516 const isLeave = event.type === "mouseleave"; 6517 const isOverFloatingEl = contains(floating, target); 6518 const isOverReferenceEl = contains(domReference, target); 6519 if (isOverFloatingEl) { 6520 hasLanded = true; 6521 if (!isLeave) { 6522 return void 0; 6523 } 6524 } 6525 if (isOverReferenceEl) { 6526 hasLanded = false; 6527 if (!isLeave) { 6528 hasLanded = true; 6529 return void 0; 6530 } 6531 } 6532 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 6533 return void 0; 6534 } 6535 function hasOpenChildNode() { 6536 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 6537 } 6538 function closeIfNoOpenChild() { 6539 if (!hasOpenChildNode()) { 6540 close(); 6541 } 6542 } 6543 if (hasOpenChildNode()) { 6544 return void 0; 6545 } 6546 const refRect = domReference.getBoundingClientRect(); 6547 const rect = floating.getBoundingClientRect(); 6548 const cursorLeaveFromRight = x > rect.right - rect.width / 2; 6549 const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; 6550 const isFloatingWider = rect.width > refRect.width; 6551 const isFloatingTaller = rect.height > refRect.height; 6552 const left = (isFloatingWider ? refRect : rect).left; 6553 const right = (isFloatingWider ? refRect : rect).right; 6554 const top = (isFloatingTaller ? refRect : rect).top; 6555 const bottom = (isFloatingTaller ? refRect : rect).bottom; 6556 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) { 6557 closeIfNoOpenChild(); 6558 return void 0; 6559 } 6560 let isInsideTroughRect = false; 6561 switch (side) { 6562 case "top": 6563 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 6564 break; 6565 case "bottom": 6566 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 6567 break; 6568 case "left": 6569 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 6570 break; 6571 case "right": 6572 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 6573 break; 6574 default: 6575 } 6576 if (isInsideTroughRect) { 6577 return void 0; 6578 } 6579 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 6580 closeIfNoOpenChild(); 6581 return void 0; 6582 } 6583 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 6584 closeIfNoOpenChild(); 6585 return void 0; 6586 } 6587 let isInsidePolygon = false; 6588 switch (side) { 6589 case "top": { 6590 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6591 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6592 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6593 const cursorPointY = y + POLYGON_BUFFER + 1; 6594 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 6595 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 6596 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 6597 break; 6598 } 6599 case "bottom": { 6600 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6601 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6602 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 6603 const cursorPointY = y - POLYGON_BUFFER; 6604 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 6605 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 6606 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 6607 break; 6608 } 6609 case "left": { 6610 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6611 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6612 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6613 const cursorPointX = x + POLYGON_BUFFER + 1; 6614 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 6615 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 6616 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 6617 break; 6618 } 6619 case "right": { 6620 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 6621 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6622 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 6623 const cursorPointX = x - POLYGON_BUFFER; 6624 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 6625 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 6626 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 6627 break; 6628 } 6629 default: 6630 } 6631 if (!isInsidePolygon) { 6632 closeIfNoOpenChild(); 6633 } else if (!hasLanded) { 6634 timeout.start(40, closeIfNoOpenChild); 6635 } 6636 return void 0; 6637 }; 6638 }; 6639 fn.__options = { 6640 ...options, 6641 blockPointerEvents 6642 }; 6643 return fn; 6644 } 6645 6646 // node_modules/@base-ui/react/esm/utils/popupStateMapping.js 6647 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) { 6648 CommonPopupDataAttributes2["open"] = "data-open"; 6649 CommonPopupDataAttributes2["closed"] = "data-closed"; 6650 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 6651 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 6652 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden"; 6653 CommonPopupDataAttributes2["side"] = "data-side"; 6654 CommonPopupDataAttributes2["align"] = "data-align"; 6655 return CommonPopupDataAttributes2; 6656 })({}); 6657 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) { 6658 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open"; 6659 CommonTriggerDataAttributes2["pressed"] = "data-pressed"; 6660 return CommonTriggerDataAttributes2; 6661 })({}); 6662 var TRIGGER_HOOK = { 6663 [CommonTriggerDataAttributes.popupOpen]: "" 6664 }; 6665 var PRESSABLE_TRIGGER_HOOK = { 6666 [CommonTriggerDataAttributes.popupOpen]: "", 6667 [CommonTriggerDataAttributes.pressed]: "" 6668 }; 6669 var POPUP_OPEN_HOOK = { 6670 [CommonPopupDataAttributes.open]: "" 6671 }; 6672 var POPUP_CLOSED_HOOK = { 6673 [CommonPopupDataAttributes.closed]: "" 6674 }; 6675 var ANCHOR_HIDDEN_HOOK = { 6676 [CommonPopupDataAttributes.anchorHidden]: "" 6677 }; 6678 var triggerOpenStateMapping = { 6679 open(value) { 6680 if (value) { 6681 return TRIGGER_HOOK; 6682 } 6683 return null; 6684 } 6685 }; 6686 var popupStateMapping = { 6687 open(value) { 6688 if (value) { 6689 return POPUP_OPEN_HOOK; 6690 } 6691 return POPUP_CLOSED_HOOK; 6692 }, 6693 anchorHidden(value) { 6694 if (value) { 6695 return ANCHOR_HIDDEN_HOOK; 6696 } 6697 return null; 6698 } 6699 }; 6700 6701 // node_modules/@base-ui/utils/esm/inertValue.js 6702 function inertValue(value) { 6703 if (isReactVersionAtLeast(19)) { 6704 return value; 6705 } 6706 return value ? "true" : void 0; 6707 } 6708 6709 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js 6710 var React33 = __toESM(require_react(), 1); 6711 6712 // node_modules/@base-ui/react/esm/floating-ui-react/middleware/arrow.js 6713 var baseArrow = (options) => ({ 6714 name: "arrow", 6715 options, 6716 async fn(state) { 6717 const { 6718 x, 6719 y, 6720 placement, 6721 rects, 6722 platform: platform3, 6723 elements, 6724 middlewareData 6725 } = state; 6726 const { 6727 element, 6728 padding = 0, 6729 offsetParent = "real" 6730 } = evaluate(options, state) || {}; 6731 if (element == null) { 6732 return {}; 6733 } 6734 const paddingObject = getPaddingObject(padding); 6735 const coords = { 6736 x, 6737 y 6738 }; 6739 const axis = getAlignmentAxis(placement); 6740 const length = getAxisLength(axis); 6741 const arrowDimensions = await platform3.getDimensions(element); 6742 const isYAxis = axis === "y"; 6743 const minProp = isYAxis ? "top" : "left"; 6744 const maxProp = isYAxis ? "bottom" : "right"; 6745 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 6746 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 6747 const startDiff = coords[axis] - rects.reference[axis]; 6748 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; 6749 let clientSize = elements.floating[clientProp] || rects.floating[length]; 6750 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { 6751 clientSize = elements.floating[clientProp] || rects.floating[length]; 6752 } 6753 const centerToReference = endDiff / 2 - startDiff / 2; 6754 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 6755 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 6756 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 6757 const min2 = minPadding; 6758 const max2 = clientSize - arrowDimensions[length] - maxPadding; 6759 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 6760 const offset4 = clamp(min2, center, max2); 6761 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 6762 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; 6763 return { 6764 [axis]: coords[axis] + alignmentOffset, 6765 data: { 6766 [axis]: offset4, 6767 centerOffset: center - offset4 - alignmentOffset, 6768 ...shouldAddOffset && { 6769 alignmentOffset 6770 } 6771 }, 6772 reset: shouldAddOffset 6773 }; 6774 } 6775 }); 6776 var arrow4 = (options, deps) => ({ 6777 ...baseArrow(options), 6778 options: [options, deps] 6779 }); 6780 6781 // node_modules/@base-ui/react/esm/utils/hideMiddleware.js 6782 var hide4 = { 6783 name: "hide", 6784 async fn(state) { 6785 const { 6786 width, 6787 height, 6788 x, 6789 y 6790 } = state.rects.reference; 6791 const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0; 6792 const nativeHideResult = await hide3().fn(state); 6793 return { 6794 data: { 6795 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden 6796 } 6797 }; 6798 } 6799 }; 6800 6801 // node_modules/@base-ui/react/esm/utils/adaptiveOriginMiddleware.js 6802 var DEFAULT_SIDES = { 6803 sideX: "left", 6804 sideY: "top" 6805 }; 6806 var adaptiveOrigin = { 6807 name: "adaptiveOrigin", 6808 async fn(state) { 6809 const { 6810 x: rawX, 6811 y: rawY, 6812 rects: { 6813 floating: floatRect 6814 }, 6815 elements: { 6816 floating 6817 }, 6818 platform: platform3, 6819 strategy, 6820 placement 6821 } = state; 6822 const win = getWindow(floating); 6823 const styles = win.getComputedStyle(floating); 6824 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 6825 if (!hasTransition) { 6826 return { 6827 x: rawX, 6828 y: rawY, 6829 data: DEFAULT_SIDES 6830 }; 6831 } 6832 const offsetParent = await platform3.getOffsetParent?.(floating); 6833 let offsetDimensions = { 6834 width: 0, 6835 height: 0 6836 }; 6837 if (strategy === "fixed" && win?.visualViewport) { 6838 offsetDimensions = { 6839 width: win.visualViewport.width, 6840 height: win.visualViewport.height 6841 }; 6842 } else if (offsetParent === win) { 6843 const doc = ownerDocument(floating); 6844 offsetDimensions = { 6845 width: doc.documentElement.clientWidth, 6846 height: doc.documentElement.clientHeight 6847 }; 6848 } else if (await platform3.isElement?.(offsetParent)) { 6849 offsetDimensions = await platform3.getDimensions(offsetParent); 6850 } 6851 const currentSide = getSide(placement); 6852 let x = rawX; 6853 let y = rawY; 6854 if (currentSide === "left") { 6855 x = offsetDimensions.width - (rawX + floatRect.width); 6856 } 6857 if (currentSide === "top") { 6858 y = offsetDimensions.height - (rawY + floatRect.height); 6859 } 6860 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 6861 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 6862 return { 6863 x, 6864 y, 6865 data: { 6866 sideX, 6867 sideY 6868 } 6869 }; 6870 } 6871 }; 6872 6873 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js 6874 function getLogicalSide(sideParam, renderedSide, isRtl) { 6875 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 6876 const logicalRight = isRtl ? "inline-start" : "inline-end"; 6877 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 6878 return { 6879 top: "top", 6880 right: isLogicalSideParam ? logicalRight : "right", 6881 bottom: "bottom", 6882 left: isLogicalSideParam ? logicalLeft : "left" 6883 }[renderedSide]; 6884 } 6885 function getOffsetData(state, sideParam, isRtl) { 6886 const { 6887 rects, 6888 placement 6889 } = state; 6890 const data = { 6891 side: getLogicalSide(sideParam, getSide(placement), isRtl), 6892 align: getAlignment(placement) || "center", 6893 anchor: { 6894 width: rects.reference.width, 6895 height: rects.reference.height 6896 }, 6897 positioner: { 6898 width: rects.floating.width, 6899 height: rects.floating.height 6900 } 6901 }; 6902 return data; 6903 } 6904 function useAnchorPositioning(params) { 6905 const { 6906 // Public parameters 6907 anchor, 6908 positionMethod = "absolute", 6909 side: sideParam = "bottom", 6910 sideOffset = 0, 6911 align = "center", 6912 alignOffset = 0, 6913 collisionBoundary, 6914 collisionPadding: collisionPaddingParam = 5, 6915 sticky = false, 6916 arrowPadding = 5, 6917 disableAnchorTracking = false, 6918 inline: inlineMiddleware, 6919 // Private parameters 6920 keepMounted = false, 6921 floatingRootContext, 6922 mounted, 6923 collisionAvoidance, 6924 shiftCrossAxis = false, 6925 nodeId, 6926 adaptiveOrigin: adaptiveOrigin2, 6927 lazyFlip = false, 6928 externalTree 6929 } = params; 6930 const [mountSide, setMountSide] = React33.useState(null); 6931 if (!mounted && mountSide !== null) { 6932 setMountSide(null); 6933 } 6934 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 6935 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 6936 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 6937 const anchorFn = typeof anchor === "function" ? anchor : void 0; 6938 const anchorFnCallback = useStableCallback(anchorFn); 6939 const anchorDep = anchorFn ? anchorFnCallback : anchor; 6940 const anchorValueRef = useValueAsRef(anchor); 6941 const mountedRef = useValueAsRef(mounted); 6942 const direction = useDirection(); 6943 const isRtl = direction === "rtl"; 6944 const side = mountSide || { 6945 top: "top", 6946 right: "right", 6947 bottom: "bottom", 6948 left: "left", 6949 "inline-end": isRtl ? "left" : "right", 6950 "inline-start": isRtl ? "right" : "left" 6951 }[sideParam]; 6952 const placement = align === "center" ? side : `$side}-$align}`; 6953 let collisionPadding = collisionPaddingParam; 6954 const bias = 1; 6955 const biasTop = sideParam === "bottom" ? bias : 0; 6956 const biasBottom = sideParam === "top" ? bias : 0; 6957 const biasLeft = sideParam === "right" ? bias : 0; 6958 const biasRight = sideParam === "left" ? bias : 0; 6959 if (typeof collisionPadding === "number") { 6960 collisionPadding = { 6961 top: collisionPadding + biasTop, 6962 right: collisionPadding + biasRight, 6963 bottom: collisionPadding + biasBottom, 6964 left: collisionPadding + biasLeft 6965 }; 6966 } else if (collisionPadding) { 6967 collisionPadding = { 6968 top: (collisionPadding.top || 0) + biasTop, 6969 right: (collisionPadding.right || 0) + biasRight, 6970 bottom: (collisionPadding.bottom || 0) + biasBottom, 6971 left: (collisionPadding.left || 0) + biasLeft 6972 }; 6973 } 6974 const commonCollisionProps = { 6975 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 6976 padding: collisionPadding 6977 }; 6978 const arrowRef = React33.useRef(null); 6979 const sideOffsetRef = useValueAsRef(sideOffset); 6980 const alignOffsetRef = useValueAsRef(alignOffset); 6981 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 6982 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 6983 const middleware = []; 6984 if (inlineMiddleware) { 6985 middleware.push(inlineMiddleware); 6986 } 6987 middleware.push(offset3((state) => { 6988 const data = getOffsetData(state, sideParam, isRtl); 6989 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 6990 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 6991 return { 6992 mainAxis: sideAxis, 6993 crossAxis: alignAxis, 6994 alignmentAxis: alignAxis 6995 }; 6996 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); 6997 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 6998 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 6999 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 7000 ...commonCollisionProps, 7001 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 7002 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 7003 padding: { 7004 top: collisionPadding.top + bias, 7005 right: collisionPadding.right + bias, 7006 bottom: collisionPadding.bottom + bias, 7007 left: collisionPadding.left + bias 7008 }, 7009 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 7010 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 7011 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 7012 }); 7013 const shiftMiddleware = shiftDisabled ? null : shift3((data) => { 7014 const html = ownerDocument(data.elements.floating).documentElement; 7015 return { 7016 ...commonCollisionProps, 7017 // Use the Layout Viewport to avoid shifting around when pinch-zooming 7018 // for context menus. 7019 rootBoundary: shiftCrossAxis ? { 7020 x: 0, 7021 y: 0, 7022 width: html.clientWidth, 7023 height: html.clientHeight 7024 } : void 0, 7025 mainAxis: collisionAvoidanceAlign !== "none", 7026 crossAxis: crossAxisShiftEnabled, 7027 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 7028 if (!arrowRef.current) { 7029 return {}; 7030 } 7031 const { 7032 width, 7033 height 7034 } = arrowRef.current.getBoundingClientRect(); 7035 const sideAxis = getSideAxis(getSide(limitData.placement)); 7036 const arrowSize = sideAxis === "y" ? width : height; 7037 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 7038 return { 7039 offset: arrowSize / 2 + offsetAmount / 2 7040 }; 7041 }) 7042 }; 7043 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]); 7044 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { 7045 middleware.push(shiftMiddleware, flipMiddleware); 7046 } else { 7047 middleware.push(flipMiddleware, shiftMiddleware); 7048 } 7049 middleware.push(size3({ 7050 ...commonCollisionProps, 7051 apply({ 7052 elements: { 7053 floating 7054 }, 7055 availableWidth, 7056 availableHeight, 7057 rects 7058 }) { 7059 if (!mountedRef.current) { 7060 return; 7061 } 7062 const floatingStyle = floating.style; 7063 floatingStyle.setProperty("--available-width", `$availableWidth}px`); 7064 floatingStyle.setProperty("--available-height", `$availableHeight}px`); 7065 const dpr = getWindow(floating).devicePixelRatio || 1; 7066 const { 7067 x: x2, 7068 y: y2, 7069 width, 7070 height 7071 } = rects.reference; 7072 const anchorWidth = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr; 7073 const anchorHeight = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr; 7074 floatingStyle.setProperty("--anchor-width", `$anchorWidth}px`); 7075 floatingStyle.setProperty("--anchor-height", `$anchorHeight}px`); 7076 } 7077 }), arrow4((state) => ({ 7078 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 7079 // we'll create a fake element. 7080 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), 7081 padding: arrowPadding, 7082 offsetParent: "floating" 7083 }), [arrowPadding]), { 7084 name: "transformOrigin", 7085 fn(state) { 7086 const { 7087 elements: elements2, 7088 middlewareData: middlewareData2, 7089 placement: renderedPlacement2, 7090 rects, 7091 y: y2 7092 } = state; 7093 const currentRenderedSide = getSide(renderedPlacement2); 7094 const currentRenderedAxis = getSideAxis(currentRenderedSide); 7095 const arrowEl = arrowRef.current; 7096 const arrowX = middlewareData2.arrow?.x || 0; 7097 const arrowY = middlewareData2.arrow?.y || 0; 7098 const arrowWidth = arrowEl?.clientWidth || 0; 7099 const arrowHeight = arrowEl?.clientHeight || 0; 7100 const transformX = arrowX + arrowWidth / 2; 7101 const transformY = arrowY + arrowHeight / 2; 7102 const shiftY = Math.abs(middlewareData2.shift?.y || 0); 7103 const halfAnchorHeight = rects.reference.height / 2; 7104 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; 7105 const isOverlappingAnchor = shiftY > sideOffsetValue; 7106 const adjacentTransformOrigin = { 7107 top: `$transformX}px calc(100% + $sideOffsetValue}px)`, 7108 bottom: `$transformX}px ${-sideOffsetValue}px`, 7109 left: `calc(100% + $sideOffsetValue}px) $transformY}px`, 7110 right: `${-sideOffsetValue}px $transformY}px` 7111 }[currentRenderedSide]; 7112 const overlapTransformOrigin = `$transformX}px $rects.reference.y + halfAnchorHeight - y2}px`; 7113 elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin); 7114 return {}; 7115 } 7116 }, hide4, adaptiveOrigin2); 7117 useIsoLayoutEffect(() => { 7118 if (!mounted && floatingRootContext) { 7119 floatingRootContext.update({ 7120 referenceElement: null, 7121 floatingElement: null, 7122 domReferenceElement: null, 7123 positionReference: null 7124 }); 7125 } 7126 }, [mounted, floatingRootContext]); 7127 const autoUpdateOptions = React33.useMemo(() => ({ 7128 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 7129 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 7130 }), [disableAnchorTracking]); 7131 const { 7132 refs, 7133 elements, 7134 x, 7135 y, 7136 middlewareData, 7137 update: update2, 7138 placement: renderedPlacement, 7139 context, 7140 isPositioned, 7141 floatingStyles: originalFloatingStyles 7142 } = useFloating2({ 7143 rootContext: floatingRootContext, 7144 open: keepMounted ? mounted : void 0, 7145 placement, 7146 middleware, 7147 strategy: positionMethod, 7148 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 7149 nodeId, 7150 externalTree 7151 }); 7152 const { 7153 sideX, 7154 sideY 7155 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 7156 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 7157 const floatingStyles = React33.useMemo(() => { 7158 const base = adaptiveOrigin2 ? { 7159 position: resolvedPosition, 7160 [sideX]: x, 7161 [sideY]: y 7162 } : { 7163 position: resolvedPosition, 7164 ...originalFloatingStyles 7165 }; 7166 if (!isPositioned) { 7167 base.opacity = 0; 7168 } 7169 return base; 7170 }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]); 7171 const registeredPositionReferenceRef = React33.useRef(null); 7172 useIsoLayoutEffect(() => { 7173 if (!mounted) { 7174 return; 7175 } 7176 const anchorValue = anchorValueRef.current; 7177 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 7178 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 7179 const finalAnchor = unwrappedElement || null; 7180 if (finalAnchor !== registeredPositionReferenceRef.current) { 7181 refs.setPositionReference(finalAnchor); 7182 registeredPositionReferenceRef.current = finalAnchor; 7183 } 7184 }, [mounted, refs, anchorDep, anchorValueRef]); 7185 React33.useEffect(() => { 7186 if (!mounted) { 7187 return; 7188 } 7189 const anchorValue = anchorValueRef.current; 7190 if (typeof anchorValue === "function") { 7191 return; 7192 } 7193 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 7194 refs.setPositionReference(anchorValue.current); 7195 registeredPositionReferenceRef.current = anchorValue.current; 7196 } 7197 }, [mounted, refs, anchorDep, anchorValueRef]); 7198 React33.useEffect(() => { 7199 if (keepMounted && mounted && elements.domReference && elements.floating) { 7200 return autoUpdate(elements.domReference, elements.floating, update2, autoUpdateOptions); 7201 } 7202 return void 0; 7203 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); 7204 const renderedSide = getSide(renderedPlacement); 7205 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 7206 const renderedAlign = getAlignment(renderedPlacement) || "center"; 7207 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden); 7208 useIsoLayoutEffect(() => { 7209 if (lazyFlip && mounted && isPositioned) { 7210 setMountSide(renderedSide); 7211 } 7212 }, [lazyFlip, mounted, isPositioned, renderedSide]); 7213 const arrowStyles = React33.useMemo(() => ({ 7214 position: "absolute", 7215 top: middlewareData.arrow?.y, 7216 left: middlewareData.arrow?.x 7217 }), [middlewareData.arrow]); 7218 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 7219 return React33.useMemo(() => ({ 7220 positionerStyles: floatingStyles, 7221 arrowStyles, 7222 arrowRef, 7223 arrowUncentered, 7224 side: logicalRenderedSide, 7225 align: renderedAlign, 7226 physicalSide: renderedSide, 7227 anchorHidden, 7228 refs, 7229 context, 7230 isPositioned, 7231 update: update2 7232 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]); 7233 } 7234 function isRef(param) { 7235 return param != null && "current" in param; 7236 } 7237 7238 // node_modules/@base-ui/react/esm/utils/getDisabledMountTransitionStyles.js 7239 function getDisabledMountTransitionStyles(transitionStatus) { 7240 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; 7241 } 7242 7243 // node_modules/@base-ui/react/esm/utils/usePositioner.js 7244 function usePositioner(componentProps, state, { 7245 styles, 7246 transitionStatus, 7247 props, 7248 refs, 7249 hidden, 7250 inert = false 7251 }) { 7252 const style = { 7253 ...styles 7254 }; 7255 if (inert) { 7256 style.pointerEvents = "none"; 7257 } 7258 return useRenderElement("div", componentProps, { 7259 state, 7260 ref: refs, 7261 props: [{ 7262 role: "presentation", 7263 hidden, 7264 style 7265 }, getDisabledMountTransitionStyles(transitionStatus), props], 7266 stateAttributesMapping: popupStateMapping 7267 }); 7268 } 7269 7270 // node_modules/@base-ui/react/esm/button/Button.js 7271 var React34 = __toESM(require_react(), 1); 7272 var Button = /* @__PURE__ */ React34.forwardRef(function Button2(componentProps, forwardedRef) { 7273 const { 7274 render, 7275 className, 7276 disabled: disabled2 = false, 7277 focusableWhenDisabled = false, 7278 nativeButton = true, 7279 style, 7280 ...elementProps 7281 } = componentProps; 7282 const { 7283 getButtonProps, 7284 buttonRef 7285 } = useButton({ 7286 disabled: disabled2, 7287 focusableWhenDisabled, 7288 native: nativeButton 7289 }); 7290 const state = { 7291 disabled: disabled2 7292 }; 7293 return useRenderElement("button", componentProps, { 7294 state, 7295 ref: [forwardedRef, buttonRef], 7296 props: [elementProps, getButtonProps] 7297 }); 7298 }); 7299 if (true) Button.displayName = "Button"; 7300 7301 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js 7302 var React37 = __toESM(require_react(), 1); 7303 var ReactDOM5 = __toESM(require_react_dom(), 1); 7304 7305 // node_modules/@base-ui/utils/esm/usePreviousValue.js 7306 var React35 = __toESM(require_react(), 1); 7307 function usePreviousValue(value) { 7308 const [state, setState] = React35.useState({ 7309 current: value, 7310 previous: null 7311 }); 7312 if (value !== state.current) { 7313 setState({ 7314 current: value, 7315 previous: state.current 7316 }); 7317 } 7318 return state.previous; 7319 } 7320 7321 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js 7322 var React36 = __toESM(require_react(), 1); 7323 7324 // node_modules/@base-ui/react/esm/utils/getCssDimensions.js 7325 function getCssDimensions2(element) { 7326 const css = getComputedStyle2(element); 7327 let width = parseFloat(css.width) || 0; 7328 let height = parseFloat(css.height) || 0; 7329 const hasOffset = isHTMLElement(element); 7330 const offsetWidth = hasOffset ? element.offsetWidth : width; 7331 const offsetHeight = hasOffset ? element.offsetHeight : height; 7332 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 7333 if (shouldFallback) { 7334 width = offsetWidth; 7335 height = offsetHeight; 7336 } 7337 return { 7338 width, 7339 height 7340 }; 7341 } 7342 7343 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js 7344 var DEFAULT_ENABLED = () => true; 7345 function usePopupAutoResize(parameters) { 7346 const { 7347 popupElement, 7348 positionerElement, 7349 content, 7350 mounted, 7351 enabled = DEFAULT_ENABLED, 7352 onMeasureLayout: onMeasureLayoutParam, 7353 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 7354 side, 7355 direction 7356 } = parameters; 7357 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false); 7358 const animationFrame = useAnimationFrame(); 7359 const committedDimensionsRef = React36.useRef(null); 7360 const liveDimensionsRef = React36.useRef(null); 7361 const isInitialRenderRef = React36.useRef(true); 7362 const restoreAnchoringStylesRef = React36.useRef(NOOP); 7363 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 7364 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 7365 const anchoringStyles = React36.useMemo(() => { 7366 let isOriginSide = side === "top"; 7367 let isPhysicalLeft = side === "left"; 7368 if (direction === "rtl") { 7369 isOriginSide = isOriginSide || side === "inline-end"; 7370 isPhysicalLeft = isPhysicalLeft || side === "inline-end"; 7371 } else { 7372 isOriginSide = isOriginSide || side === "inline-start"; 7373 isPhysicalLeft = isPhysicalLeft || side === "inline-start"; 7374 } 7375 return isOriginSide ? { 7376 position: "absolute", 7377 [side === "top" ? "bottom" : "top"]: "0", 7378 [isPhysicalLeft ? "right" : "left"]: "0" 7379 } : EMPTY_OBJECT; 7380 }, [side, direction]); 7381 useIsoLayoutEffect(() => { 7382 if (!mounted || !enabled() || typeof ResizeObserver !== "function") { 7383 restoreAnchoringStylesRef.current = NOOP; 7384 isInitialRenderRef.current = true; 7385 committedDimensionsRef.current = null; 7386 liveDimensionsRef.current = null; 7387 return void 0; 7388 } 7389 if (!popupElement || !positionerElement) { 7390 return void 0; 7391 } 7392 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); 7393 const observer = new ResizeObserver((entries) => { 7394 const entry = entries[0]; 7395 if (entry) { 7396 liveDimensionsRef.current = { 7397 width: Math.ceil(entry.borderBoxSize[0].inlineSize), 7398 height: Math.ceil(entry.borderBoxSize[0].blockSize) 7399 }; 7400 } 7401 }); 7402 observer.observe(popupElement); 7403 setPopupCssSize(popupElement, "auto"); 7404 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 7405 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 7406 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 7407 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 7408 "--available-width": "max-content", 7409 "--available-height": "max-content" 7410 }); 7411 function restoreMeasurementOverrides() { 7412 restorePopupPosition(); 7413 restorePopupTransform(); 7414 restorePositionerAvailableSize(); 7415 } 7416 function restoreMeasurementOverridesIncludingScale() { 7417 restoreMeasurementOverrides(); 7418 restorePopupScale(); 7419 } 7420 onMeasureLayout?.(); 7421 if (isInitialRenderRef.current || committedDimensionsRef.current === null) { 7422 setPositionerCssSize(positionerElement, "max-content"); 7423 const dimensions = getCssDimensions2(popupElement); 7424 committedDimensionsRef.current = dimensions; 7425 setPositionerCssSize(positionerElement, dimensions); 7426 restoreMeasurementOverridesIncludingScale(); 7427 onMeasureLayoutComplete?.(null, dimensions); 7428 isInitialRenderRef.current = false; 7429 return () => { 7430 observer.disconnect(); 7431 restoreAnchoringStylesRef.current(); 7432 restoreAnchoringStylesRef.current = NOOP; 7433 }; 7434 } 7435 setPopupCssSize(popupElement, "auto"); 7436 setPositionerCssSize(positionerElement, "max-content"); 7437 const previousDimensions = committedDimensionsRef.current ?? liveDimensionsRef.current; 7438 const newDimensions = getCssDimensions2(popupElement); 7439 committedDimensionsRef.current = newDimensions; 7440 if (!previousDimensions) { 7441 setPositionerCssSize(positionerElement, newDimensions); 7442 restoreMeasurementOverridesIncludingScale(); 7443 onMeasureLayoutComplete?.(null, newDimensions); 7444 return () => { 7445 observer.disconnect(); 7446 animationFrame.cancel(); 7447 restoreAnchoringStylesRef.current(); 7448 restoreAnchoringStylesRef.current = NOOP; 7449 }; 7450 } 7451 setPopupCssSize(popupElement, previousDimensions); 7452 restoreMeasurementOverridesIncludingScale(); 7453 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 7454 setPositionerCssSize(positionerElement, newDimensions); 7455 const abortController = new AbortController(); 7456 animationFrame.request(() => { 7457 setPopupCssSize(popupElement, newDimensions); 7458 runOnceAnimationsFinish(() => { 7459 popupElement.style.setProperty("--popup-width", "auto"); 7460 popupElement.style.setProperty("--popup-height", "auto"); 7461 }, abortController.signal); 7462 }); 7463 return () => { 7464 observer.disconnect(); 7465 abortController.abort(); 7466 animationFrame.cancel(); 7467 restoreAnchoringStylesRef.current(); 7468 restoreAnchoringStylesRef.current = NOOP; 7469 }; 7470 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, enabled, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 7471 } 7472 function overrideElementStyle(element, property, value) { 7473 const originalValue = element.style.getPropertyValue(property); 7474 element.style.setProperty(property, value); 7475 return () => { 7476 element.style.setProperty(property, originalValue); 7477 }; 7478 } 7479 function applyElementStyles(element, styles) { 7480 const restorers = []; 7481 for (const [key, value] of Object.entries(styles)) { 7482 restorers.push(overrideElementStyle(element, key, value)); 7483 } 7484 return restorers.length ? () => { 7485 restorers.forEach((restore) => restore()); 7486 } : NOOP; 7487 } 7488 function setPopupCssSize(popupElement, size4) { 7489 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 7490 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 7491 popupElement.style.setProperty("--popup-width", width); 7492 popupElement.style.setProperty("--popup-height", height); 7493 } 7494 function setPositionerCssSize(positionerElement, size4) { 7495 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 7496 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 7497 positionerElement.style.setProperty("--positioner-width", width); 7498 positionerElement.style.setProperty("--positioner-height", height); 7499 } 7500 7501 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js 7502 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 7503 function usePopupViewport(parameters) { 7504 const { 7505 store: store2, 7506 side, 7507 cssVars, 7508 children 7509 } = parameters; 7510 const direction = useDirection(); 7511 const activeTrigger = store2.useState("activeTriggerElement"); 7512 const activeTriggerId = store2.useState("activeTriggerId"); 7513 const open = store2.useState("open"); 7514 const payload = store2.useState("payload"); 7515 const mounted = store2.useState("mounted"); 7516 const popupElement = store2.useState("popupElement"); 7517 const positionerElement = store2.useState("positionerElement"); 7518 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null); 7519 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 7520 const capturedNodeRef = React37.useRef(null); 7521 const [previousContentNode, setPreviousContentNode] = React37.useState(null); 7522 const [newTriggerOffset, setNewTriggerOffset] = React37.useState(null); 7523 const currentContainerRef = React37.useRef(null); 7524 const previousContainerRef = React37.useRef(null); 7525 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false); 7526 const cleanupFrame = useAnimationFrame(); 7527 const [previousContentDimensions, setPreviousContentDimensions] = React37.useState(null); 7528 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React37.useState(false); 7529 useIsoLayoutEffect(() => { 7530 store2.set("hasViewport", true); 7531 return () => { 7532 store2.set("hasViewport", false); 7533 }; 7534 }, [store2]); 7535 const handleMeasureLayout = useStableCallback(() => { 7536 currentContainerRef.current?.style.setProperty("animation", "none"); 7537 currentContainerRef.current?.style.setProperty("transition", "none"); 7538 previousContainerRef.current?.style.setProperty("display", "none"); 7539 }); 7540 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 7541 currentContainerRef.current?.style.removeProperty("animation"); 7542 currentContainerRef.current?.style.removeProperty("transition"); 7543 previousContainerRef.current?.style.removeProperty("display"); 7544 if (previousDimensions) { 7545 setPreviousContentDimensions(previousDimensions); 7546 } 7547 }); 7548 const lastHandledTriggerRef = React37.useRef(null); 7549 useIsoLayoutEffect(() => { 7550 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 7551 setPreviousContentNode(capturedNodeRef.current); 7552 setShowStartingStyleAttribute(true); 7553 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 7554 setNewTriggerOffset(offset4); 7555 cleanupFrame.request(() => { 7556 ReactDOM5.flushSync(() => { 7557 setShowStartingStyleAttribute(false); 7558 }); 7559 onAnimationsFinished(() => { 7560 setPreviousContentNode(null); 7561 setPreviousContentDimensions(null); 7562 capturedNodeRef.current = null; 7563 }); 7564 }); 7565 lastHandledTriggerRef.current = activeTrigger; 7566 } 7567 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]); 7568 useIsoLayoutEffect(() => { 7569 const source = currentContainerRef.current; 7570 if (!source) { 7571 return; 7572 } 7573 const wrapper = ownerDocument(source).createElement("div"); 7574 for (const child of Array.from(source.childNodes)) { 7575 wrapper.appendChild(child.cloneNode(true)); 7576 } 7577 capturedNodeRef.current = wrapper; 7578 }); 7579 const isTransitioning = previousContentNode != null; 7580 let childrenToRender; 7581 if (!isTransitioning) { 7582 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7583 "data-current": true, 7584 ref: currentContainerRef, 7585 children 7586 }, currentContentKey); 7587 } else { 7588 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(React37.Fragment, { 7589 children: [/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7590 "data-previous": true, 7591 inert: inertValue(true), 7592 ref: previousContainerRef, 7593 style: { 7594 ...previousContentDimensions ? { 7595 [cssVars.popupWidth]: `$previousContentDimensions.width}px`, 7596 [cssVars.popupHeight]: `$previousContentDimensions.height}px` 7597 } : null, 7598 position: "absolute" 7599 }, 7600 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 7601 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { 7602 "data-current": true, 7603 ref: currentContainerRef, 7604 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 7605 children 7606 }, currentContentKey)] 7607 }); 7608 } 7609 useIsoLayoutEffect(() => { 7610 const container = previousContainerRef.current; 7611 if (!container || !previousContentNode) { 7612 return; 7613 } 7614 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 7615 }, [previousContentNode]); 7616 usePopupAutoResize({ 7617 popupElement, 7618 positionerElement, 7619 mounted, 7620 content: payload, 7621 onMeasureLayout: handleMeasureLayout, 7622 onMeasureLayoutComplete: handleMeasureLayoutComplete, 7623 side, 7624 direction 7625 }); 7626 const state = { 7627 activationDirection: getActivationDirection(newTriggerOffset), 7628 transitioning: isTransitioning 7629 }; 7630 return { 7631 children: childrenToRender, 7632 state 7633 }; 7634 } 7635 function getActivationDirection(offset4) { 7636 if (!offset4) { 7637 return void 0; 7638 } 7639 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 7640 } 7641 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 7642 if (value > tolerance) { 7643 return positiveLabel; 7644 } 7645 if (value < -tolerance) { 7646 return negativeLabel; 7647 } 7648 return ""; 7649 } 7650 function calculateRelativePosition(from, to) { 7651 const fromRect = from.getBoundingClientRect(); 7652 const toRect = to.getBoundingClientRect(); 7653 const fromCenter = { 7654 x: fromRect.left + fromRect.width / 2, 7655 y: fromRect.top + fromRect.height / 2 7656 }; 7657 const toCenter = { 7658 x: toRect.left + toRect.width / 2, 7659 y: toRect.top + toRect.height / 2 7660 }; 7661 return { 7662 horizontal: toCenter.x - fromCenter.x, 7663 vertical: toCenter.y - fromCenter.y 7664 }; 7665 } 7666 function usePopupContentKey(activeTriggerId, payload) { 7667 const [contentKey, setContentKey] = React37.useState(0); 7668 const previousActiveTriggerIdRef = React37.useRef(activeTriggerId); 7669 const previousPayloadRef = React37.useRef(payload); 7670 const pendingPayloadUpdateRef = React37.useRef(false); 7671 useIsoLayoutEffect(() => { 7672 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 7673 const previousPayload = previousPayloadRef.current; 7674 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 7675 const payloadChanged = payload !== previousPayload; 7676 if (triggerIdChanged) { 7677 setContentKey((value) => value + 1); 7678 pendingPayloadUpdateRef.current = !payloadChanged; 7679 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 7680 setContentKey((value) => value + 1); 7681 pendingPayloadUpdateRef.current = false; 7682 } 7683 previousActiveTriggerIdRef.current = activeTriggerId; 7684 previousPayloadRef.current = payload; 7685 }, [activeTriggerId, payload]); 7686 return `$activeTriggerId ?? "current"}-$contentKey}`; 7687 } 7688 7689 // node_modules/@base-ui/react/esm/utils/FloatingPortalLite.js 7690 var React38 = __toESM(require_react(), 1); 7691 var ReactDOM6 = __toESM(require_react_dom(), 1); 7692 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 7693 var FloatingPortalLite = /* @__PURE__ */ React38.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 7694 const { 7695 children, 7696 container, 7697 className, 7698 render, 7699 style, 7700 ...elementProps 7701 } = componentProps; 7702 const { 7703 portalNode, 7704 portalSubtree 7705 } = useFloatingPortalNode({ 7706 container, 7707 ref: forwardedRef, 7708 componentProps, 7709 elementProps 7710 }); 7711 if (!portalSubtree && !portalNode) { 7712 return null; 7713 } 7714 return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React38.Fragment, { 7715 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM6.createPortal(children, portalNode)] 7716 }); 7717 }); 7718 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 7719 7720 // node_modules/@base-ui/react/esm/tooltip/index.parts.js 7721 var index_parts_exports = {}; 7722 __export(index_parts_exports, { 7723 Arrow: () => TooltipArrow, 7724 Handle: () => TooltipHandle, 7725 Popup: () => TooltipPopup, 7726 Portal: () => TooltipPortal, 7727 Positioner: () => TooltipPositioner, 7728 Provider: () => TooltipProvider, 7729 Root: () => TooltipRoot, 7730 Trigger: () => TooltipTrigger, 7731 Viewport: () => TooltipViewport, 7732 createHandle: () => createTooltipHandle 7733 }); 7734 7735 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js 7736 var React41 = __toESM(require_react(), 1); 7737 7738 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRootContext.js 7739 var React39 = __toESM(require_react(), 1); 7740 var TooltipRootContext = /* @__PURE__ */ React39.createContext(void 0); 7741 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 7742 function useTooltipRootContext(optional) { 7743 const context = React39.useContext(TooltipRootContext); 7744 if (context === void 0 && !optional) { 7745 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 7746 } 7747 return context; 7748 } 7749 7750 // node_modules/@base-ui/react/esm/tooltip/store/TooltipStore.js 7751 var React40 = __toESM(require_react(), 1); 7752 var ReactDOM7 = __toESM(require_react_dom(), 1); 7753 var selectors2 = { 7754 ...popupStoreSelectors, 7755 disabled: createSelector((state) => state.disabled), 7756 instantType: createSelector((state) => state.instantType), 7757 isInstantPhase: createSelector((state) => state.isInstantPhase), 7758 trackCursorAxis: createSelector((state) => state.trackCursorAxis), 7759 disableHoverablePopup: createSelector((state) => state.disableHoverablePopup), 7760 lastOpenChangeReason: createSelector((state) => state.openChangeReason), 7761 closeOnClick: createSelector((state) => state.closeOnClick), 7762 closeDelay: createSelector((state) => state.closeDelay), 7763 hasViewport: createSelector((state) => state.hasViewport) 7764 }; 7765 var TooltipStore = class _TooltipStore extends ReactStore { 7766 constructor(initialState, floatingId, nested = false) { 7767 const triggerElements = new PopupTriggerMap(); 7768 const state = { 7769 ...createInitialState(), 7770 ...initialState 7771 }; 7772 state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested); 7773 super(state, { 7774 popupRef: /* @__PURE__ */ React40.createRef(), 7775 onOpenChange: void 0, 7776 onOpenChangeComplete: void 0, 7777 triggerElements 7778 }, selectors2); 7779 } 7780 setOpen = (nextOpen, eventDetails) => { 7781 const reason = eventDetails.reason; 7782 const isHover = reason === reason_parts_exports.triggerHover; 7783 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 7784 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 7785 eventDetails.preventUnmountOnClose = () => { 7786 this.set("preventUnmountingOnClose", true); 7787 }; 7788 this.context.onOpenChange?.(nextOpen, eventDetails); 7789 if (eventDetails.isCanceled) { 7790 return; 7791 } 7792 this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 7793 const changeState = () => { 7794 const updatedState = { 7795 open: nextOpen, 7796 openChangeReason: reason 7797 }; 7798 if (isFocusOpen) { 7799 updatedState.instantType = "focus"; 7800 } else if (isDismissClose) { 7801 updatedState.instantType = "dismiss"; 7802 } else if (reason === reason_parts_exports.triggerHover) { 7803 updatedState.instantType = void 0; 7804 } 7805 setOpenTriggerState(updatedState, nextOpen, eventDetails.trigger); 7806 this.update(updatedState); 7807 }; 7808 if (isHover) { 7809 ReactDOM7.flushSync(changeState); 7810 } else { 7811 changeState(); 7812 } 7813 }; 7814 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. 7815 cancelPendingOpen(event) { 7816 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); 7817 } 7818 static useStore(externalStore, initialState) { 7819 const store2 = usePopupStore(externalStore, (floatingId, nested) => new _TooltipStore(initialState, floatingId, nested)).store; 7820 return store2; 7821 } 7822 }; 7823 function createInitialState() { 7824 return { 7825 ...createInitialPopupStoreState(), 7826 disabled: false, 7827 instantType: void 0, 7828 isInstantPhase: false, 7829 trackCursorAxis: "none", 7830 disableHoverablePopup: false, 7831 openChangeReason: null, 7832 closeOnClick: true, 7833 closeDelay: 0, 7834 hasViewport: false 7835 }; 7836 } 7837 7838 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js 7839 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 7840 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 7841 const { 7842 disabled: disabled2 = false, 7843 defaultOpen = false, 7844 open: openProp, 7845 disableHoverablePopup = false, 7846 trackCursorAxis = "none", 7847 actionsRef, 7848 onOpenChange, 7849 onOpenChangeComplete, 7850 handle, 7851 triggerId: triggerIdProp, 7852 defaultTriggerId: defaultTriggerIdProp = null, 7853 children 7854 } = props; 7855 const store2 = TooltipStore.useStore(handle?.store, { 7856 open: defaultOpen, 7857 openProp, 7858 activeTriggerId: defaultTriggerIdProp, 7859 triggerIdProp 7860 }); 7861 useOnFirstRender(() => { 7862 if (openProp === void 0 && store2.state.open === false && defaultOpen === true) { 7863 store2.update({ 7864 open: true, 7865 activeTriggerId: defaultTriggerIdProp 7866 }); 7867 } 7868 }); 7869 store2.useControlledProp("openProp", openProp); 7870 store2.useControlledProp("triggerIdProp", triggerIdProp); 7871 store2.useContextCallback("onOpenChange", onOpenChange); 7872 store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 7873 const openState = store2.useState("open"); 7874 const open = !disabled2 && openState; 7875 const activeTriggerId = store2.useState("activeTriggerId"); 7876 const mounted = store2.useState("mounted"); 7877 const payload = store2.useState("payload"); 7878 store2.useSyncedValues({ 7879 trackCursorAxis, 7880 disableHoverablePopup 7881 }); 7882 store2.useSyncedValue("disabled", disabled2); 7883 useImplicitActiveTrigger(store2); 7884 const { 7885 forceUnmount, 7886 transitionStatus 7887 } = useOpenStateTransitions(open, store2); 7888 const isInstantPhase = store2.useState("isInstantPhase"); 7889 const instantType = store2.useState("instantType"); 7890 const lastOpenChangeReason = store2.useState("lastOpenChangeReason"); 7891 const previousInstantTypeRef = React41.useRef(null); 7892 useIsoLayoutEffect(() => { 7893 if (openState && disabled2) { 7894 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 7895 } 7896 }, [openState, disabled2, store2]); 7897 useIsoLayoutEffect(() => { 7898 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 7899 if (instantType !== "delay") { 7900 previousInstantTypeRef.current = instantType; 7901 } 7902 store2.set("instantType", "delay"); 7903 } else if (previousInstantTypeRef.current !== null) { 7904 store2.set("instantType", previousInstantTypeRef.current); 7905 previousInstantTypeRef.current = null; 7906 } 7907 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]); 7908 useIsoLayoutEffect(() => { 7909 if (open) { 7910 if (activeTriggerId == null) { 7911 store2.set("payload", void 0); 7912 } 7913 } 7914 }, [store2, activeTriggerId, open]); 7915 const handleImperativeClose = React41.useCallback(() => { 7916 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 7917 }, [store2]); 7918 React41.useImperativeHandle(actionsRef, () => ({ 7919 unmount: forceUnmount, 7920 close: handleImperativeClose 7921 }), [forceUnmount, handleImperativeClose]); 7922 const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none"; 7923 return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(TooltipRootContext.Provider, { 7924 value: store2, 7925 children: [shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipInteractions, { 7926 store: store2, 7927 disabled: disabled2, 7928 trackCursorAxis 7929 }), typeof children === "function" ? children({ 7930 payload 7931 }) : children] 7932 }); 7933 }); 7934 if (true) TooltipRoot.displayName = "TooltipRoot"; 7935 function TooltipInteractions({ 7936 store: store2, 7937 disabled: disabled2, 7938 trackCursorAxis 7939 }) { 7940 const floatingRootContext = store2.useState("floatingRootContext"); 7941 const dismiss = useDismiss(floatingRootContext, { 7942 enabled: !disabled2, 7943 referencePress: () => store2.select("closeOnClick") 7944 }); 7945 const clientPoint = useClientPoint(floatingRootContext, { 7946 enabled: !disabled2 && trackCursorAxis !== "none", 7947 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 7948 }); 7949 const activeTriggerProps = React41.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); 7950 const inactiveTriggerProps = React41.useMemo(() => mergeProps(clientPoint.trigger, dismiss.trigger), [clientPoint.trigger, dismiss.trigger]); 7951 const popupProps = React41.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [clientPoint.floating, dismiss.floating]); 7952 usePopupInteractionProps(store2, { 7953 activeTriggerProps, 7954 inactiveTriggerProps, 7955 popupProps 7956 }); 7957 return null; 7958 } 7959 7960 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js 7961 var React43 = __toESM(require_react(), 1); 7962 7963 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProviderContext.js 7964 var React42 = __toESM(require_react(), 1); 7965 var TooltipProviderContext = /* @__PURE__ */ React42.createContext(void 0); 7966 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 7967 function useTooltipProviderContext() { 7968 return React42.useContext(TooltipProviderContext); 7969 } 7970 7971 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTriggerDataAttributes.js 7972 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) { 7973 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen"; 7974 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled"; 7975 return TooltipTriggerDataAttributes2; 7976 })({}); 7977 7978 // node_modules/@base-ui/react/esm/tooltip/utils/constants.js 7979 var OPEN_DELAY = 600; 7980 7981 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js 7982 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; 7983 function getTargetElement(event) { 7984 if ("composedPath" in event) { 7985 const path = event.composedPath(); 7986 for (let i = 0; i < path.length; i += 1) { 7987 const element = path[i]; 7988 if (isElement(element)) { 7989 return element; 7990 } 7991 } 7992 } 7993 const target = event.target; 7994 if (isElement(target)) { 7995 return target; 7996 } 7997 return null; 7998 } 7999 function closestEnabledTooltipTrigger(element) { 8000 let current = element; 8001 while (current) { 8002 if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) { 8003 return current; 8004 } 8005 const parentElement = current.parentElement; 8006 if (parentElement) { 8007 current = parentElement; 8008 continue; 8009 } 8010 const root = current.getRootNode(); 8011 current = "host" in root && isElement(root.host) ? root.host : null; 8012 } 8013 return null; 8014 } 8015 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 8016 const { 8017 render, 8018 className, 8019 style, 8020 handle, 8021 payload, 8022 disabled: disabledProp, 8023 delay, 8024 closeOnClick = true, 8025 closeDelay, 8026 id: idProp, 8027 ...elementProps 8028 } = componentProps; 8029 const rootContext = useTooltipRootContext(true); 8030 const store2 = handle?.store ?? rootContext; 8031 if (!store2) { 8032 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)); 8033 } 8034 const thisTriggerId = useBaseUiId(idProp); 8035 const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId); 8036 const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId); 8037 const floatingRootContext = store2.useState("floatingRootContext"); 8038 const triggerElementRef = React43.useRef(null); 8039 const delayWithDefault = delay ?? OPEN_DELAY; 8040 const closeDelayWithDefault = closeDelay ?? 0; 8041 const { 8042 registerTrigger, 8043 isMountedByThisTrigger 8044 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, { 8045 payload, 8046 closeOnClick, 8047 closeDelay: closeDelayWithDefault 8048 }); 8049 const providerContext = useTooltipProviderContext(); 8050 const { 8051 delayRef, 8052 isInstantPhase, 8053 hasProvider 8054 } = useDelayGroup(floatingRootContext, { 8055 open: isOpenedByThisTrigger 8056 }); 8057 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); 8058 store2.useSyncedValue("isInstantPhase", isInstantPhase); 8059 const rootDisabled = store2.useState("disabled"); 8060 const disabled2 = disabledProp ?? rootDisabled; 8061 const disabledRef = useValueAsRef(disabled2); 8062 const trackCursorAxis = store2.useState("trackCursorAxis"); 8063 const disableHoverablePopup = store2.useState("disableHoverablePopup"); 8064 const isNestedTriggerHoveredRef = React43.useRef(false); 8065 const nestedTriggerOpenTimeout = useTimeout(); 8066 const pointerTypeRef = React43.useRef(void 0); 8067 function getOpenDelay() { 8068 const providerDelay = providerContext?.delay; 8069 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0; 8070 let computedOpenDelay = delayWithDefault; 8071 if (hasProvider) { 8072 if (groupOpenValue !== 0) { 8073 computedOpenDelay = delay ?? providerDelay ?? delayWithDefault; 8074 } else { 8075 computedOpenDelay = 0; 8076 } 8077 } 8078 return computedOpenDelay; 8079 } 8080 function isEnabledNestedTriggerTarget(target) { 8081 const triggerEl = triggerElementRef.current; 8082 if (!triggerEl || !target) { 8083 return false; 8084 } 8085 const nearestTrigger = closestEnabledTooltipTrigger(target); 8086 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); 8087 } 8088 function detectNestedTriggerHover(target) { 8089 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); 8090 isNestedTriggerHoveredRef.current = nestedTriggerHovered; 8091 if (nestedTriggerHovered) { 8092 hoverInteraction.openChangeTimeout.clear(); 8093 hoverInteraction.restTimeout.clear(); 8094 hoverInteraction.restTimeoutPending = false; 8095 nestedTriggerOpenTimeout.clear(); 8096 } 8097 return nestedTriggerHovered; 8098 } 8099 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 8100 enabled: !disabled2, 8101 mouseOnly: true, 8102 move: false, 8103 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 8104 restMs: getOpenDelay, 8105 delay() { 8106 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0; 8107 let computedCloseDelay = closeDelayWithDefault; 8108 if (closeDelay == null && hasProvider) { 8109 computedCloseDelay = closeValue; 8110 } 8111 return { 8112 close: computedCloseDelay 8113 }; 8114 }, 8115 triggerElementRef, 8116 isActiveTrigger: isTriggerActive, 8117 isClosing: () => store2.select("transitionStatus") === "ending", 8118 shouldOpen() { 8119 return !isNestedTriggerHoveredRef.current; 8120 } 8121 }); 8122 const focusProps = useFocus(floatingRootContext, { 8123 enabled: !disabled2 8124 }).reference; 8125 const handleNestedTriggerHover = (event) => { 8126 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; 8127 const target = getTargetElement(event); 8128 const nestedTriggerHovered = detectNestedTriggerHover(target); 8129 const triggerEl = triggerElementRef.current; 8130 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); 8131 if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { 8132 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8133 return; 8134 } 8135 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. 8136 isMouseLikePointerType(pointerTypeRef.current)) { 8137 const open = () => { 8138 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) { 8139 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); 8140 } 8141 }; 8142 const openDelay = getOpenDelay(); 8143 if (openDelay === 0) { 8144 nestedTriggerOpenTimeout.clear(); 8145 open(); 8146 } else { 8147 nestedTriggerOpenTimeout.start(openDelay, open); 8148 } 8149 } 8150 }; 8151 const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger); 8152 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; 8153 const state = { 8154 open: isOpenedByThisTrigger 8155 }; 8156 const element = useRenderElement("button", componentProps, { 8157 state, 8158 ref: [forwardedRef, registerTrigger, triggerElementRef], 8159 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { 8160 onMouseOver(event) { 8161 handleNestedTriggerHover(event.nativeEvent); 8162 }, 8163 onFocus(event) { 8164 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { 8165 event.preventBaseUIHandler(); 8166 } 8167 }, 8168 onMouseLeave() { 8169 isNestedTriggerHoveredRef.current = false; 8170 nestedTriggerOpenTimeout.clear(); 8171 pointerTypeRef.current = void 0; 8172 }, 8173 onPointerEnter(event) { 8174 pointerTypeRef.current = event.pointerType; 8175 }, 8176 onPointerDown(event) { 8177 pointerTypeRef.current = event.pointerType; 8178 store2.set("closeOnClick", closeOnClick); 8179 if (closeOnClick && !store2.select("open")) { 8180 store2.cancelPendingOpen(event.nativeEvent); 8181 } 8182 }, 8183 onClick(event) { 8184 if (closeOnClick && !store2.select("open")) { 8185 store2.cancelPendingOpen(event.nativeEvent); 8186 } 8187 }, 8188 id: thisTriggerId, 8189 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0, 8190 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" 8191 }, elementProps], 8192 stateAttributesMapping: triggerOpenStateMapping 8193 }); 8194 return element; 8195 }); 8196 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 8197 8198 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js 8199 var React45 = __toESM(require_react(), 1); 8200 8201 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortalContext.js 8202 var React44 = __toESM(require_react(), 1); 8203 var TooltipPortalContext = /* @__PURE__ */ React44.createContext(void 0); 8204 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 8205 function useTooltipPortalContext() { 8206 const value = React44.useContext(TooltipPortalContext); 8207 if (value === void 0) { 8208 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 8209 } 8210 return value; 8211 } 8212 8213 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js 8214 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 8215 var TooltipPortal = /* @__PURE__ */ React45.forwardRef(function TooltipPortal2(props, forwardedRef) { 8216 const { 8217 keepMounted = false, 8218 ...portalProps 8219 } = props; 8220 const store2 = useTooltipRootContext(); 8221 const mounted = store2.useState("mounted"); 8222 const shouldRender = mounted || keepMounted; 8223 if (!shouldRender) { 8224 return null; 8225 } 8226 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipPortalContext.Provider, { 8227 value: keepMounted, 8228 children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FloatingPortalLite, { 8229 ref: forwardedRef, 8230 ...portalProps 8231 }) 8232 }); 8233 }); 8234 if (true) TooltipPortal.displayName = "TooltipPortal"; 8235 8236 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js 8237 var React47 = __toESM(require_react(), 1); 8238 8239 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositionerContext.js 8240 var React46 = __toESM(require_react(), 1); 8241 var TooltipPositionerContext = /* @__PURE__ */ React46.createContext(void 0); 8242 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 8243 function useTooltipPositionerContext() { 8244 const context = React46.useContext(TooltipPositionerContext); 8245 if (context === void 0) { 8246 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 8247 } 8248 return context; 8249 } 8250 8251 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js 8252 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 8253 var TooltipPositioner = /* @__PURE__ */ React47.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 8254 const { 8255 render, 8256 className, 8257 anchor, 8258 positionMethod = "absolute", 8259 side = "top", 8260 align = "center", 8261 sideOffset = 0, 8262 alignOffset = 0, 8263 collisionBoundary = "clipping-ancestors", 8264 collisionPadding = 5, 8265 arrowPadding = 5, 8266 sticky = false, 8267 disableAnchorTracking = false, 8268 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 8269 style, 8270 ...elementProps 8271 } = componentProps; 8272 const store2 = useTooltipRootContext(); 8273 const keepMounted = useTooltipPortalContext(); 8274 const open = store2.useState("open"); 8275 const mounted = store2.useState("mounted"); 8276 const trackCursorAxis = store2.useState("trackCursorAxis"); 8277 const disableHoverablePopup = store2.useState("disableHoverablePopup"); 8278 const floatingRootContext = store2.useState("floatingRootContext"); 8279 const instantType = store2.useState("instantType"); 8280 const transitionStatus = store2.useState("transitionStatus"); 8281 const hasViewport = store2.useState("hasViewport"); 8282 const positioning = useAnchorPositioning({ 8283 anchor, 8284 positionMethod, 8285 floatingRootContext, 8286 mounted, 8287 side, 8288 sideOffset, 8289 align, 8290 alignOffset, 8291 collisionBoundary, 8292 collisionPadding, 8293 sticky, 8294 arrowPadding, 8295 disableAnchorTracking, 8296 keepMounted, 8297 collisionAvoidance, 8298 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0 8299 }); 8300 const state = React47.useMemo(() => ({ 8301 open, 8302 side: positioning.side, 8303 align: positioning.align, 8304 anchorHidden: positioning.anchorHidden, 8305 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 8306 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 8307 const element = usePositioner(componentProps, state, { 8308 styles: positioning.positionerStyles, 8309 transitionStatus, 8310 props: elementProps, 8311 refs: [forwardedRef, store2.useStateSetter("positionerElement")], 8312 hidden: !mounted, 8313 inert: !open || trackCursorAxis === "both" || disableHoverablePopup 8314 }); 8315 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPositionerContext.Provider, { 8316 value: positioning, 8317 children: element 8318 }); 8319 }); 8320 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 8321 8322 // node_modules/@base-ui/react/esm/tooltip/popup/TooltipPopup.js 8323 var React48 = __toESM(require_react(), 1); 8324 var stateAttributesMapping = { 8325 ...popupStateMapping, 8326 ...transitionStatusMapping 8327 }; 8328 var TooltipPopup = /* @__PURE__ */ React48.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 8329 const { 8330 render, 8331 className, 8332 style, 8333 ...elementProps 8334 } = componentProps; 8335 const store2 = useTooltipRootContext(); 8336 const { 8337 side, 8338 align 8339 } = useTooltipPositionerContext(); 8340 const open = store2.useState("open"); 8341 const instantType = store2.useState("instantType"); 8342 const transitionStatus = store2.useState("transitionStatus"); 8343 const popupProps = store2.useState("popupProps"); 8344 const floatingContext = store2.useState("floatingRootContext"); 8345 const disabled2 = store2.useState("disabled"); 8346 const closeDelay = store2.useState("closeDelay"); 8347 useOpenChangeComplete({ 8348 open, 8349 ref: store2.context.popupRef, 8350 onComplete() { 8351 if (open) { 8352 store2.context.onOpenChangeComplete?.(true); 8353 } 8354 } 8355 }); 8356 useHoverFloatingInteraction(floatingContext, { 8357 enabled: !disabled2, 8358 closeDelay 8359 }); 8360 const setPopupElement = store2.useStateSetter("popupElement"); 8361 const state = { 8362 open, 8363 side, 8364 align, 8365 instant: instantType, 8366 transitionStatus 8367 }; 8368 const element = useRenderElement("div", componentProps, { 8369 state, 8370 ref: [forwardedRef, store2.context.popupRef, setPopupElement], 8371 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 8372 stateAttributesMapping 8373 }); 8374 return element; 8375 }); 8376 if (true) TooltipPopup.displayName = "TooltipPopup"; 8377 8378 // node_modules/@base-ui/react/esm/tooltip/arrow/TooltipArrow.js 8379 var React49 = __toESM(require_react(), 1); 8380 var TooltipArrow = /* @__PURE__ */ React49.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 8381 const { 8382 render, 8383 className, 8384 style, 8385 ...elementProps 8386 } = componentProps; 8387 const store2 = useTooltipRootContext(); 8388 const { 8389 arrowRef, 8390 side, 8391 align, 8392 arrowUncentered, 8393 arrowStyles 8394 } = useTooltipPositionerContext(); 8395 const open = store2.useState("open"); 8396 const instantType = store2.useState("instantType"); 8397 const state = { 8398 open, 8399 side, 8400 align, 8401 uncentered: arrowUncentered, 8402 instant: instantType 8403 }; 8404 const element = useRenderElement("div", componentProps, { 8405 state, 8406 ref: [forwardedRef, arrowRef], 8407 props: [{ 8408 style: arrowStyles, 8409 "aria-hidden": true 8410 }, elementProps], 8411 stateAttributesMapping: popupStateMapping 8412 }); 8413 return element; 8414 }); 8415 if (true) TooltipArrow.displayName = "TooltipArrow"; 8416 8417 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProvider.js 8418 var React50 = __toESM(require_react(), 1); 8419 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 8420 var TooltipProvider = function TooltipProvider2(props) { 8421 const { 8422 delay, 8423 closeDelay, 8424 timeout = 400 8425 } = props; 8426 const contextValue = React50.useMemo(() => ({ 8427 delay, 8428 closeDelay 8429 }), [delay, closeDelay]); 8430 const delayValue = React50.useMemo(() => ({ 8431 open: delay, 8432 close: closeDelay 8433 }), [delay, closeDelay]); 8434 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipProviderContext.Provider, { 8435 value: contextValue, 8436 children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FloatingDelayGroup, { 8437 delay: delayValue, 8438 timeoutMs: timeout, 8439 children: props.children 8440 }) 8441 }); 8442 }; 8443 if (true) TooltipProvider.displayName = "TooltipProvider"; 8444 8445 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js 8446 var React51 = __toESM(require_react(), 1); 8447 8448 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewportCssVars.js 8449 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) { 8450 TooltipViewportCssVars2["popupWidth"] = "--popup-width"; 8451 TooltipViewportCssVars2["popupHeight"] = "--popup-height"; 8452 return TooltipViewportCssVars2; 8453 })({}); 8454 8455 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js 8456 var stateAttributesMapping2 = { 8457 activationDirection: (value) => value ? { 8458 "data-activation-direction": value 8459 } : null 8460 }; 8461 var TooltipViewport = /* @__PURE__ */ React51.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 8462 const { 8463 render, 8464 className, 8465 style, 8466 children, 8467 ...elementProps 8468 } = componentProps; 8469 const store2 = useTooltipRootContext(); 8470 const positioner = useTooltipPositionerContext(); 8471 const instantType = store2.useState("instantType"); 8472 const { 8473 children: childrenToRender, 8474 state: viewportState 8475 } = usePopupViewport({ 8476 store: store2, 8477 side: positioner.side, 8478 cssVars: TooltipViewportCssVars, 8479 children 8480 }); 8481 const state = { 8482 activationDirection: viewportState.activationDirection, 8483 transitioning: viewportState.transitioning, 8484 instant: instantType 8485 }; 8486 return useRenderElement("div", componentProps, { 8487 state, 8488 ref: forwardedRef, 8489 props: [elementProps, { 8490 children: childrenToRender 8491 }], 8492 stateAttributesMapping: stateAttributesMapping2 8493 }); 8494 }); 8495 if (true) TooltipViewport.displayName = "TooltipViewport"; 8496 8497 // node_modules/@base-ui/react/esm/tooltip/store/TooltipHandle.js 8498 var TooltipHandle = class { 8499 /** 8500 * Internal store holding the tooltip state. 8501 * @internal 8502 */ 8503 constructor() { 8504 this.store = new TooltipStore(); 8505 } 8506 /** 8507 * Opens the tooltip and associates it with the trigger with the given ID. 8508 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop. 8509 * 8510 * This method should only be called in an event handler or an effect (not during rendering). 8511 * 8512 * @param triggerId ID of the trigger to associate with the tooltip. 8513 */ 8514 open(triggerId) { 8515 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; 8516 if (triggerId && !triggerElement) { 8517 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "$triggerId}".` : formatErrorMessage_default(81, triggerId)); 8518 } 8519 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 8520 } 8521 /** 8522 * Closes the tooltip. 8523 */ 8524 close() { 8525 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); 8526 } 8527 /** 8528 * Indicates whether the tooltip is currently open. 8529 */ 8530 get isOpen() { 8531 return this.store.select("open"); 8532 } 8533 }; 8534 function createTooltipHandle() { 8535 return new TooltipHandle(); 8536 } 8537 8538 // node_modules/@base-ui/react/esm/use-render/useRender.js 8539 function useRender(params) { 8540 return useRenderElement(params.defaultTagName ?? "div", params, params); 8541 } 8542 8543 // packages/ui/build-module/text/text.mjs 8544 var import_element10 = __toESM(require_element(), 1); 8545 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 8546 function getRuntime() { 8547 const globalScope = globalThis; 8548 if (globalScope.__wpStyleRuntime) { 8549 return globalScope.__wpStyleRuntime; 8550 } 8551 globalScope.__wpStyleRuntime = { 8552 documents: /* @__PURE__ */ new Map(), 8553 styles: /* @__PURE__ */ new Map(), 8554 injectedStyles: /* @__PURE__ */ new WeakMap() 8555 }; 8556 if (typeof document !== "undefined") { 8557 registerDocument(document); 8558 } 8559 return globalScope.__wpStyleRuntime; 8560 } 8561 function documentContainsStyleHash(targetDocument, hash) { 8562 if (!targetDocument.head) { 8563 return false; 8564 } 8565 for (const style of targetDocument.head.querySelectorAll( 8566 `style[$STYLE_HASH_ATTRIBUTE}]` 8567 )) { 8568 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 8569 return true; 8570 } 8571 } 8572 return false; 8573 } 8574 function injectStyle(targetDocument, hash, css) { 8575 if (!targetDocument.head) { 8576 return; 8577 } 8578 const runtime = getRuntime(); 8579 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8580 if (!injectedStyles) { 8581 injectedStyles = /* @__PURE__ */ new Set(); 8582 runtime.injectedStyles.set(targetDocument, injectedStyles); 8583 } 8584 if (injectedStyles.has(hash)) { 8585 return; 8586 } 8587 if (documentContainsStyleHash(targetDocument, hash)) { 8588 injectedStyles.add(hash); 8589 return; 8590 } 8591 const style = targetDocument.createElement("style"); 8592 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 8593 style.appendChild(targetDocument.createTextNode(css)); 8594 targetDocument.head.appendChild(style); 8595 injectedStyles.add(hash); 8596 } 8597 function registerDocument(targetDocument) { 8598 const runtime = getRuntime(); 8599 runtime.documents.set( 8600 targetDocument, 8601 (runtime.documents.get(targetDocument) ?? 0) + 1 8602 ); 8603 for (const [hash, css] of runtime.styles) { 8604 injectStyle(targetDocument, hash, css); 8605 } 8606 return () => { 8607 const count = runtime.documents.get(targetDocument); 8608 if (count === void 0) { 8609 return; 8610 } 8611 if (count <= 1) { 8612 runtime.documents.delete(targetDocument); 8613 return; 8614 } 8615 runtime.documents.set(targetDocument, count - 1); 8616 }; 8617 } 8618 function registerStyle(hash, css) { 8619 const runtime = getRuntime(); 8620 runtime.styles.set(hash, css); 8621 for (const targetDocument of runtime.documents.keys()) { 8622 injectStyle(targetDocument, hash, css); 8623 } 8624 } 8625 if (typeof process === "undefined" || true) { 8626 registerStyle("0c5702ddca", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); 8627 } 8628 var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" }; 8629 if (typeof process === "undefined" || true) { 8630 registerStyle("d5c1b736fd", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); 8631 } 8632 var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" }; 8633 var Text = (0, import_element10.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) { 8634 const element = useRender({ 8635 render, 8636 defaultTagName: "span", 8637 ref, 8638 props: mergeProps(props, { 8639 className: clsx_default( 8640 style_default.text, 8641 global_css_defense_default.heading, 8642 global_css_defense_default.p, 8643 style_default[variant], 8644 className 8645 ) 8646 }) 8647 }); 8648 return element; 8649 }); 8650 8651 // packages/ui/build-module/badge/badge.mjs 8652 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 8653 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 8654 function getRuntime2() { 8655 const globalScope = globalThis; 8656 if (globalScope.__wpStyleRuntime) { 8657 return globalScope.__wpStyleRuntime; 8658 } 8659 globalScope.__wpStyleRuntime = { 8660 documents: /* @__PURE__ */ new Map(), 8661 styles: /* @__PURE__ */ new Map(), 8662 injectedStyles: /* @__PURE__ */ new WeakMap() 8663 }; 8664 if (typeof document !== "undefined") { 8665 registerDocument2(document); 8666 } 8667 return globalScope.__wpStyleRuntime; 8668 } 8669 function documentContainsStyleHash2(targetDocument, hash) { 8670 if (!targetDocument.head) { 8671 return false; 8672 } 8673 for (const style of targetDocument.head.querySelectorAll( 8674 `style[$STYLE_HASH_ATTRIBUTE2}]` 8675 )) { 8676 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 8677 return true; 8678 } 8679 } 8680 return false; 8681 } 8682 function injectStyle2(targetDocument, hash, css) { 8683 if (!targetDocument.head) { 8684 return; 8685 } 8686 const runtime = getRuntime2(); 8687 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8688 if (!injectedStyles) { 8689 injectedStyles = /* @__PURE__ */ new Set(); 8690 runtime.injectedStyles.set(targetDocument, injectedStyles); 8691 } 8692 if (injectedStyles.has(hash)) { 8693 return; 8694 } 8695 if (documentContainsStyleHash2(targetDocument, hash)) { 8696 injectedStyles.add(hash); 8697 return; 8698 } 8699 const style = targetDocument.createElement("style"); 8700 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 8701 style.appendChild(targetDocument.createTextNode(css)); 8702 targetDocument.head.appendChild(style); 8703 injectedStyles.add(hash); 8704 } 8705 function registerDocument2(targetDocument) { 8706 const runtime = getRuntime2(); 8707 runtime.documents.set( 8708 targetDocument, 8709 (runtime.documents.get(targetDocument) ?? 0) + 1 8710 ); 8711 for (const [hash, css] of runtime.styles) { 8712 injectStyle2(targetDocument, hash, css); 8713 } 8714 return () => { 8715 const count = runtime.documents.get(targetDocument); 8716 if (count === void 0) { 8717 return; 8718 } 8719 if (count <= 1) { 8720 runtime.documents.delete(targetDocument); 8721 return; 8722 } 8723 runtime.documents.set(targetDocument, count - 1); 8724 }; 8725 } 8726 function registerStyle2(hash, css) { 8727 const runtime = getRuntime2(); 8728 runtime.styles.set(hash, css); 8729 for (const targetDocument of runtime.documents.keys()) { 8730 injectStyle2(targetDocument, hash, css); 8731 } 8732 } 8733 if (typeof process === "undefined" || true) { 8734 registerStyle2("9d817a6077", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._96e6251aad1a6136__badge{border-radius:var(--wpds-border-radius-lg,8px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wpds-dimension-padding-sm,8px)}._99f7158cb520f750__is-high-intent{background-color:var(--wpds-color-bg-surface-error,#f6e6e3);color:var(--wpds-color-fg-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-bg-surface-warning,#fde6be);color:var(--wpds-color-fg-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-bg-surface-caution,#fee995);color:var(--wpds-color-fg-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-bg-surface-success,#c6f7cd);color:var(--wpds-color-fg-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-bg-surface-info,#deebfa);color:var(--wpds-color-fg-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-fg-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);color:var(--wpds-color-fg-content-neutral,#1e1e1e);padding-block:calc(var(--wpds-dimension-padding-xs, 4px) - var(--wpds-border-width-xs, 1px));padding-inline:calc(var(--wpds-dimension-padding-sm, 8px) - var(--wpds-border-width-xs, 1px))}}}"); 8735 } 8736 var style_default2 = { "badge": "_96e6251aad1a6136__badge", "is-high-intent": "_99f7158cb520f750__is-high-intent", "is-medium-intent": "c20ebef2365bc8b7__is-medium-intent", "is-low-intent": "_365e1626c6202e52__is-low-intent", "is-stable-intent": "_33f8198127ddf4ef__is-stable-intent", "is-informational-intent": "_04c1aca8fc449412__is-informational-intent", "is-draft-intent": "_90726e69d495ec19__is-draft-intent", "is-none-intent": "_898f4a544993bd39__is-none-intent" }; 8737 var Badge = (0, import_element11.forwardRef)(function Badge2({ intent = "none", className, ...props }, ref) { 8738 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 8739 Text, 8740 { 8741 ref, 8742 className: clsx_default( 8743 style_default2.badge, 8744 style_default2[`is-$intent}-intent`], 8745 className 8746 ), 8747 ...props, 8748 variant: "body-sm" 8749 } 8750 ); 8751 }); 8752 8753 // packages/ui/build-module/button/button.mjs 8754 var import_element12 = __toESM(require_element(), 1); 8755 var import_i18n = __toESM(require_i18n(), 1); 8756 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 8757 import { speak } from "@wordpress/a11y"; 8758 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 8759 function getRuntime3() { 8760 const globalScope = globalThis; 8761 if (globalScope.__wpStyleRuntime) { 8762 return globalScope.__wpStyleRuntime; 8763 } 8764 globalScope.__wpStyleRuntime = { 8765 documents: /* @__PURE__ */ new Map(), 8766 styles: /* @__PURE__ */ new Map(), 8767 injectedStyles: /* @__PURE__ */ new WeakMap() 8768 }; 8769 if (typeof document !== "undefined") { 8770 registerDocument3(document); 8771 } 8772 return globalScope.__wpStyleRuntime; 8773 } 8774 function documentContainsStyleHash3(targetDocument, hash) { 8775 if (!targetDocument.head) { 8776 return false; 8777 } 8778 for (const style of targetDocument.head.querySelectorAll( 8779 `style[$STYLE_HASH_ATTRIBUTE3}]` 8780 )) { 8781 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 8782 return true; 8783 } 8784 } 8785 return false; 8786 } 8787 function injectStyle3(targetDocument, hash, css) { 8788 if (!targetDocument.head) { 8789 return; 8790 } 8791 const runtime = getRuntime3(); 8792 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8793 if (!injectedStyles) { 8794 injectedStyles = /* @__PURE__ */ new Set(); 8795 runtime.injectedStyles.set(targetDocument, injectedStyles); 8796 } 8797 if (injectedStyles.has(hash)) { 8798 return; 8799 } 8800 if (documentContainsStyleHash3(targetDocument, hash)) { 8801 injectedStyles.add(hash); 8802 return; 8803 } 8804 const style = targetDocument.createElement("style"); 8805 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 8806 style.appendChild(targetDocument.createTextNode(css)); 8807 targetDocument.head.appendChild(style); 8808 injectedStyles.add(hash); 8809 } 8810 function registerDocument3(targetDocument) { 8811 const runtime = getRuntime3(); 8812 runtime.documents.set( 8813 targetDocument, 8814 (runtime.documents.get(targetDocument) ?? 0) + 1 8815 ); 8816 for (const [hash, css] of runtime.styles) { 8817 injectStyle3(targetDocument, hash, css); 8818 } 8819 return () => { 8820 const count = runtime.documents.get(targetDocument); 8821 if (count === void 0) { 8822 return; 8823 } 8824 if (count <= 1) { 8825 runtime.documents.delete(targetDocument); 8826 return; 8827 } 8828 runtime.documents.set(targetDocument, count - 1); 8829 }; 8830 } 8831 function registerStyle3(hash, css) { 8832 const runtime = getRuntime3(); 8833 runtime.styles.set(hash, css); 8834 for (const targetDocument of runtime.documents.keys()) { 8835 injectStyle3(targetDocument, hash, css); 8836 } 8837 } 8838 if (typeof process === "undefined" || true) { 8839 registerStyle3("459f56a7b7", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:499;--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:40px;--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:-4px;--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:padding-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;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(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:24px}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:32px}._914b42f315c0e580__is-loading{color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}'); 8840 } 8841 var style_default3 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" }; 8842 if (typeof process === "undefined" || true) { 8843 registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 8844 } 8845 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 8846 if (typeof process === "undefined" || true) { 8847 registerStyle3("693cd16544", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid transparent;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}}"); 8848 } 8849 var focus_default = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; 8850 if (typeof process === "undefined" || true) { 8851 registerStyle3("d5c1b736fd", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); 8852 } 8853 var global_css_defense_default2 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" }; 8854 var Button3 = (0, import_element12.forwardRef)( 8855 function Button22({ 8856 tone = "brand", 8857 variant = "solid", 8858 size: size4 = "default", 8859 className, 8860 focusableWhenDisabled = true, 8861 disabled: disabled2, 8862 loading, 8863 loadingAnnouncement = (0, import_i18n.__)("Loading"), 8864 children, 8865 ...props 8866 }, ref) { 8867 const mergedClassName = clsx_default( 8868 global_css_defense_default2.button, 8869 resets_default["box-sizing"], 8870 focus_default["outset-ring--focus-except-active"], 8871 variant !== "unstyled" && style_default3.button, 8872 style_default3[`is-$tone}`], 8873 style_default3[`is-$variant}`], 8874 style_default3[`is-$size4}`], 8875 loading && style_default3["is-loading"], 8876 className 8877 ); 8878 (0, import_element12.useEffect)(() => { 8879 if (loading && loadingAnnouncement) { 8880 speak(loadingAnnouncement); 8881 } 8882 }, [loading, loadingAnnouncement]); 8883 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 8884 Button, 8885 { 8886 ref, 8887 className: mergedClassName, 8888 focusableWhenDisabled, 8889 disabled: disabled2 ?? loading, 8890 ...props, 8891 children 8892 } 8893 ); 8894 } 8895 ); 8896 8897 // packages/ui/build-module/button/icon.mjs 8898 var import_element14 = __toESM(require_element(), 1); 8899 8900 // packages/ui/build-module/icon/icon.mjs 8901 var import_element13 = __toESM(require_element(), 1); 8902 var import_primitives = __toESM(require_primitives(), 1); 8903 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 8904 var Icon = (0, import_element13.forwardRef)(function Icon2({ icon, size: size4 = 24, ...restProps }, ref) { 8905 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 8906 import_primitives.SVG, 8907 { 8908 ref, 8909 fill: "currentColor", 8910 ...icon.props, 8911 ...restProps, 8912 width: size4, 8913 height: size4 8914 } 8915 ); 8916 }); 8917 8918 // packages/ui/build-module/button/icon.mjs 8919 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 8920 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 8921 function getRuntime4() { 8922 const globalScope = globalThis; 8923 if (globalScope.__wpStyleRuntime) { 8924 return globalScope.__wpStyleRuntime; 8925 } 8926 globalScope.__wpStyleRuntime = { 8927 documents: /* @__PURE__ */ new Map(), 8928 styles: /* @__PURE__ */ new Map(), 8929 injectedStyles: /* @__PURE__ */ new WeakMap() 8930 }; 8931 if (typeof document !== "undefined") { 8932 registerDocument4(document); 8933 } 8934 return globalScope.__wpStyleRuntime; 8935 } 8936 function documentContainsStyleHash4(targetDocument, hash) { 8937 if (!targetDocument.head) { 8938 return false; 8939 } 8940 for (const style of targetDocument.head.querySelectorAll( 8941 `style[$STYLE_HASH_ATTRIBUTE4}]` 8942 )) { 8943 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 8944 return true; 8945 } 8946 } 8947 return false; 8948 } 8949 function injectStyle4(targetDocument, hash, css) { 8950 if (!targetDocument.head) { 8951 return; 8952 } 8953 const runtime = getRuntime4(); 8954 let injectedStyles = runtime.injectedStyles.get(targetDocument); 8955 if (!injectedStyles) { 8956 injectedStyles = /* @__PURE__ */ new Set(); 8957 runtime.injectedStyles.set(targetDocument, injectedStyles); 8958 } 8959 if (injectedStyles.has(hash)) { 8960 return; 8961 } 8962 if (documentContainsStyleHash4(targetDocument, hash)) { 8963 injectedStyles.add(hash); 8964 return; 8965 } 8966 const style = targetDocument.createElement("style"); 8967 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 8968 style.appendChild(targetDocument.createTextNode(css)); 8969 targetDocument.head.appendChild(style); 8970 injectedStyles.add(hash); 8971 } 8972 function registerDocument4(targetDocument) { 8973 const runtime = getRuntime4(); 8974 runtime.documents.set( 8975 targetDocument, 8976 (runtime.documents.get(targetDocument) ?? 0) + 1 8977 ); 8978 for (const [hash, css] of runtime.styles) { 8979 injectStyle4(targetDocument, hash, css); 8980 } 8981 return () => { 8982 const count = runtime.documents.get(targetDocument); 8983 if (count === void 0) { 8984 return; 8985 } 8986 if (count <= 1) { 8987 runtime.documents.delete(targetDocument); 8988 return; 8989 } 8990 runtime.documents.set(targetDocument, count - 1); 8991 }; 8992 } 8993 function registerStyle4(hash, css) { 8994 const runtime = getRuntime4(); 8995 runtime.styles.set(hash, css); 8996 for (const targetDocument of runtime.documents.keys()) { 8997 injectStyle4(targetDocument, hash, css); 8998 } 8999 } 9000 if (typeof process === "undefined" || true) { 9001 registerStyle4("459f56a7b7", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:499;--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:40px;--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:-4px;--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:padding-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;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(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:24px}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:32px}._914b42f315c0e580__is-loading{color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}'); 9002 } 9003 var style_default4 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" }; 9004 var ButtonIcon = (0, import_element14.forwardRef)( 9005 function ButtonIcon2({ className, icon, ...props }, ref) { 9006 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( 9007 Icon, 9008 { 9009 ref, 9010 icon, 9011 className: clsx_default(style_default4.icon, className), 9012 size: 24, 9013 ...props 9014 } 9015 ); 9016 } 9017 ); 9018 9019 // packages/ui/build-module/button/index.mjs 9020 ButtonIcon.displayName = "Button.Icon"; 9021 var Button4 = Object.assign(Button3, { 9022 /** 9023 * An icon component specifically designed to work well when rendered inside 9024 * a `Button` component. 9025 */ 9026 Icon: ButtonIcon 9027 }); 9028 9029 // packages/icons/build-module/library/caution.mjs 9030 var import_primitives2 = __toESM(require_primitives(), 1); 9031 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 9032 var caution_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives2.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" }) }); 9033 9034 // packages/icons/build-module/library/close-small.mjs 9035 var import_primitives3 = __toESM(require_primitives(), 1); 9036 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 9037 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives3.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); 9038 9039 // packages/icons/build-module/library/error.mjs 9040 var import_primitives4 = __toESM(require_primitives(), 1); 9041 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 9042 var error_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives4.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z" }) }); 9043 9044 // packages/icons/build-module/library/info.mjs 9045 var import_primitives5 = __toESM(require_primitives(), 1); 9046 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 9047 var info_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives5.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" }) }); 9048 9049 // packages/icons/build-module/library/published.mjs 9050 var import_primitives6 = __toESM(require_primitives(), 1); 9051 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 9052 var published_default = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives6.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" }) }); 9053 9054 // packages/ui/build-module/utils/render-slot-with-children.mjs 9055 var import_element15 = __toESM(require_element(), 1); 9056 function renderSlotWithChildren(slot, defaultSlot, children) { 9057 return (0, import_element15.cloneElement)(slot ?? defaultSlot, { children }); 9058 } 9059 9060 // packages/ui/build-module/lock-unlock.mjs 9061 var import_private_apis = __toESM(require_private_apis(), 1); 9062 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 9063 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 9064 "@wordpress/ui" 9065 ); 9066 9067 // packages/ui/build-module/stack/stack.mjs 9068 var import_element16 = __toESM(require_element(), 1); 9069 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 9070 function getRuntime5() { 9071 const globalScope = globalThis; 9072 if (globalScope.__wpStyleRuntime) { 9073 return globalScope.__wpStyleRuntime; 9074 } 9075 globalScope.__wpStyleRuntime = { 9076 documents: /* @__PURE__ */ new Map(), 9077 styles: /* @__PURE__ */ new Map(), 9078 injectedStyles: /* @__PURE__ */ new WeakMap() 9079 }; 9080 if (typeof document !== "undefined") { 9081 registerDocument5(document); 9082 } 9083 return globalScope.__wpStyleRuntime; 9084 } 9085 function documentContainsStyleHash5(targetDocument, hash) { 9086 if (!targetDocument.head) { 9087 return false; 9088 } 9089 for (const style of targetDocument.head.querySelectorAll( 9090 `style[$STYLE_HASH_ATTRIBUTE5}]` 9091 )) { 9092 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 9093 return true; 9094 } 9095 } 9096 return false; 9097 } 9098 function injectStyle5(targetDocument, hash, css) { 9099 if (!targetDocument.head) { 9100 return; 9101 } 9102 const runtime = getRuntime5(); 9103 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9104 if (!injectedStyles) { 9105 injectedStyles = /* @__PURE__ */ new Set(); 9106 runtime.injectedStyles.set(targetDocument, injectedStyles); 9107 } 9108 if (injectedStyles.has(hash)) { 9109 return; 9110 } 9111 if (documentContainsStyleHash5(targetDocument, hash)) { 9112 injectedStyles.add(hash); 9113 return; 9114 } 9115 const style = targetDocument.createElement("style"); 9116 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 9117 style.appendChild(targetDocument.createTextNode(css)); 9118 targetDocument.head.appendChild(style); 9119 injectedStyles.add(hash); 9120 } 9121 function registerDocument5(targetDocument) { 9122 const runtime = getRuntime5(); 9123 runtime.documents.set( 9124 targetDocument, 9125 (runtime.documents.get(targetDocument) ?? 0) + 1 9126 ); 9127 for (const [hash, css] of runtime.styles) { 9128 injectStyle5(targetDocument, hash, css); 9129 } 9130 return () => { 9131 const count = runtime.documents.get(targetDocument); 9132 if (count === void 0) { 9133 return; 9134 } 9135 if (count <= 1) { 9136 runtime.documents.delete(targetDocument); 9137 return; 9138 } 9139 runtime.documents.set(targetDocument, count - 1); 9140 }; 9141 } 9142 function registerStyle5(hash, css) { 9143 const runtime = getRuntime5(); 9144 runtime.styles.set(hash, css); 9145 for (const targetDocument of runtime.documents.keys()) { 9146 injectStyle5(targetDocument, hash, css); 9147 } 9148 } 9149 if (typeof process === "undefined" || true) { 9150 registerStyle5("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); 9151 } 9152 var style_default5 = { "stack": "_19ce0419607e1896__stack" }; 9153 var gapTokens = { 9154 xs: "var(--wpds-dimension-gap-xs, 4px)", 9155 sm: "var(--wpds-dimension-gap-sm, 8px)", 9156 md: "var(--wpds-dimension-gap-md, 12px)", 9157 lg: "var(--wpds-dimension-gap-lg, 16px)", 9158 xl: "var(--wpds-dimension-gap-xl, 24px)", 9159 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 9160 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 9161 }; 9162 var Stack = (0, import_element16.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { 9163 const style = { 9164 gap: gap && gapTokens[gap], 9165 alignItems: align, 9166 justifyContent: justify, 9167 flexDirection: direction, 9168 flexWrap: wrap 9169 }; 9170 const element = useRender({ 9171 render, 9172 ref, 9173 props: mergeProps(props, { style, className: style_default5.stack }) 9174 }); 9175 return element; 9176 }); 9177 9178 // packages/ui/build-module/icon-button/icon-button.mjs 9179 var import_element21 = __toESM(require_element(), 1); 9180 9181 // packages/ui/build-module/tooltip/popup.mjs 9182 var import_element19 = __toESM(require_element(), 1); 9183 var import_theme = __toESM(require_theme(), 1); 9184 9185 // packages/ui/build-module/tooltip/portal.mjs 9186 var import_element17 = __toESM(require_element(), 1); 9187 9188 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 9189 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; 9190 function getRuntime6() { 9191 const globalScope = globalThis; 9192 if (globalScope.__wpStyleRuntime) { 9193 return globalScope.__wpStyleRuntime; 9194 } 9195 globalScope.__wpStyleRuntime = { 9196 documents: /* @__PURE__ */ new Map(), 9197 styles: /* @__PURE__ */ new Map(), 9198 injectedStyles: /* @__PURE__ */ new WeakMap() 9199 }; 9200 if (typeof document !== "undefined") { 9201 registerDocument6(document); 9202 } 9203 return globalScope.__wpStyleRuntime; 9204 } 9205 function documentContainsStyleHash6(targetDocument, hash) { 9206 if (!targetDocument.head) { 9207 return false; 9208 } 9209 for (const style of targetDocument.head.querySelectorAll( 9210 `style[$STYLE_HASH_ATTRIBUTE6}]` 9211 )) { 9212 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { 9213 return true; 9214 } 9215 } 9216 return false; 9217 } 9218 function injectStyle6(targetDocument, hash, css) { 9219 if (!targetDocument.head) { 9220 return; 9221 } 9222 const runtime = getRuntime6(); 9223 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9224 if (!injectedStyles) { 9225 injectedStyles = /* @__PURE__ */ new Set(); 9226 runtime.injectedStyles.set(targetDocument, injectedStyles); 9227 } 9228 if (injectedStyles.has(hash)) { 9229 return; 9230 } 9231 if (documentContainsStyleHash6(targetDocument, hash)) { 9232 injectedStyles.add(hash); 9233 return; 9234 } 9235 const style = targetDocument.createElement("style"); 9236 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); 9237 style.appendChild(targetDocument.createTextNode(css)); 9238 targetDocument.head.appendChild(style); 9239 injectedStyles.add(hash); 9240 } 9241 function registerDocument6(targetDocument) { 9242 const runtime = getRuntime6(); 9243 runtime.documents.set( 9244 targetDocument, 9245 (runtime.documents.get(targetDocument) ?? 0) + 1 9246 ); 9247 for (const [hash, css] of runtime.styles) { 9248 injectStyle6(targetDocument, hash, css); 9249 } 9250 return () => { 9251 const count = runtime.documents.get(targetDocument); 9252 if (count === void 0) { 9253 return; 9254 } 9255 if (count <= 1) { 9256 runtime.documents.delete(targetDocument); 9257 return; 9258 } 9259 runtime.documents.set(targetDocument, count - 1); 9260 }; 9261 } 9262 function registerStyle6(hash, css) { 9263 const runtime = getRuntime6(); 9264 runtime.styles.set(hash, css); 9265 for (const targetDocument of runtime.documents.keys()) { 9266 injectStyle6(targetDocument, hash, css); 9267 } 9268 } 9269 if (typeof process === "undefined" || true) { 9270 registerStyle6("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}}}"); 9271 } 9272 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 9273 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 9274 function resolveOwnerDocument() { 9275 return typeof document === "undefined" ? null : document; 9276 } 9277 function isInWordPressEnvironment() { 9278 let topWp; 9279 try { 9280 topWp = window.top?.wp; 9281 } catch { 9282 } 9283 const wp = topWp ?? window.wp; 9284 return typeof wp?.components === "object" && wp.components !== null; 9285 } 9286 var cachedSlot = null; 9287 function createSlot(ownerDocument2) { 9288 const element = ownerDocument2.createElement("div"); 9289 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 9290 if (wp_compat_overlay_slot_default.slot) { 9291 element.classList.add(wp_compat_overlay_slot_default.slot); 9292 } 9293 ownerDocument2.body.appendChild(element); 9294 return element; 9295 } 9296 function getWpCompatOverlaySlot() { 9297 if (typeof window === "undefined") { 9298 return void 0; 9299 } 9300 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 9301 return void 0; 9302 } 9303 const ownerDocument2 = resolveOwnerDocument(); 9304 if (!ownerDocument2 || !ownerDocument2.body) { 9305 return void 0; 9306 } 9307 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 9308 return cachedSlot; 9309 } 9310 const existing = ownerDocument2.querySelector( 9311 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 9312 ); 9313 if (existing instanceof HTMLDivElement) { 9314 cachedSlot = existing; 9315 return existing; 9316 } 9317 if (cachedSlot?.isConnected) { 9318 cachedSlot.remove(); 9319 } 9320 cachedSlot = createSlot(ownerDocument2); 9321 return cachedSlot; 9322 } 9323 9324 // packages/ui/build-module/tooltip/portal.mjs 9325 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 9326 var Portal = (0, import_element17.forwardRef)( 9327 function TooltipPortal3({ container, ...restProps }, ref) { 9328 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( 9329 index_parts_exports.Portal, 9330 { 9331 container: container ?? getWpCompatOverlaySlot(), 9332 ...restProps, 9333 ref 9334 } 9335 ); 9336 } 9337 ); 9338 9339 // packages/ui/build-module/tooltip/positioner.mjs 9340 var import_element18 = __toESM(require_element(), 1); 9341 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 9342 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; 9343 function getRuntime7() { 9344 const globalScope = globalThis; 9345 if (globalScope.__wpStyleRuntime) { 9346 return globalScope.__wpStyleRuntime; 9347 } 9348 globalScope.__wpStyleRuntime = { 9349 documents: /* @__PURE__ */ new Map(), 9350 styles: /* @__PURE__ */ new Map(), 9351 injectedStyles: /* @__PURE__ */ new WeakMap() 9352 }; 9353 if (typeof document !== "undefined") { 9354 registerDocument7(document); 9355 } 9356 return globalScope.__wpStyleRuntime; 9357 } 9358 function documentContainsStyleHash7(targetDocument, hash) { 9359 if (!targetDocument.head) { 9360 return false; 9361 } 9362 for (const style of targetDocument.head.querySelectorAll( 9363 `style[$STYLE_HASH_ATTRIBUTE7}]` 9364 )) { 9365 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { 9366 return true; 9367 } 9368 } 9369 return false; 9370 } 9371 function injectStyle7(targetDocument, hash, css) { 9372 if (!targetDocument.head) { 9373 return; 9374 } 9375 const runtime = getRuntime7(); 9376 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9377 if (!injectedStyles) { 9378 injectedStyles = /* @__PURE__ */ new Set(); 9379 runtime.injectedStyles.set(targetDocument, injectedStyles); 9380 } 9381 if (injectedStyles.has(hash)) { 9382 return; 9383 } 9384 if (documentContainsStyleHash7(targetDocument, hash)) { 9385 injectedStyles.add(hash); 9386 return; 9387 } 9388 const style = targetDocument.createElement("style"); 9389 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); 9390 style.appendChild(targetDocument.createTextNode(css)); 9391 targetDocument.head.appendChild(style); 9392 injectedStyles.add(hash); 9393 } 9394 function registerDocument7(targetDocument) { 9395 const runtime = getRuntime7(); 9396 runtime.documents.set( 9397 targetDocument, 9398 (runtime.documents.get(targetDocument) ?? 0) + 1 9399 ); 9400 for (const [hash, css] of runtime.styles) { 9401 injectStyle7(targetDocument, hash, css); 9402 } 9403 return () => { 9404 const count = runtime.documents.get(targetDocument); 9405 if (count === void 0) { 9406 return; 9407 } 9408 if (count <= 1) { 9409 runtime.documents.delete(targetDocument); 9410 return; 9411 } 9412 runtime.documents.set(targetDocument, count - 1); 9413 }; 9414 } 9415 function registerStyle7(hash, css) { 9416 const runtime = getRuntime7(); 9417 runtime.styles.set(hash, css); 9418 for (const targetDocument of runtime.documents.keys()) { 9419 injectStyle7(targetDocument, hash, css); 9420 } 9421 } 9422 if (typeof process === "undefined" || true) { 9423 registerStyle7("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 9424 } 9425 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 9426 if (typeof process === "undefined" || true) { 9427 registerStyle7("4811d023d1", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); 9428 } 9429 var style_default6 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 9430 var Positioner = (0, import_element18.forwardRef)( 9431 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 9432 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( 9433 index_parts_exports.Positioner, 9434 { 9435 ref, 9436 align, 9437 side, 9438 sideOffset, 9439 ...props, 9440 className: clsx_default( 9441 resets_default2["box-sizing"], 9442 style_default6.positioner, 9443 className 9444 ) 9445 } 9446 ); 9447 } 9448 ); 9449 9450 // packages/ui/build-module/tooltip/popup.mjs 9451 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 9452 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; 9453 function getRuntime8() { 9454 const globalScope = globalThis; 9455 if (globalScope.__wpStyleRuntime) { 9456 return globalScope.__wpStyleRuntime; 9457 } 9458 globalScope.__wpStyleRuntime = { 9459 documents: /* @__PURE__ */ new Map(), 9460 styles: /* @__PURE__ */ new Map(), 9461 injectedStyles: /* @__PURE__ */ new WeakMap() 9462 }; 9463 if (typeof document !== "undefined") { 9464 registerDocument8(document); 9465 } 9466 return globalScope.__wpStyleRuntime; 9467 } 9468 function documentContainsStyleHash8(targetDocument, hash) { 9469 if (!targetDocument.head) { 9470 return false; 9471 } 9472 for (const style of targetDocument.head.querySelectorAll( 9473 `style[$STYLE_HASH_ATTRIBUTE8}]` 9474 )) { 9475 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { 9476 return true; 9477 } 9478 } 9479 return false; 9480 } 9481 function injectStyle8(targetDocument, hash, css) { 9482 if (!targetDocument.head) { 9483 return; 9484 } 9485 const runtime = getRuntime8(); 9486 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9487 if (!injectedStyles) { 9488 injectedStyles = /* @__PURE__ */ new Set(); 9489 runtime.injectedStyles.set(targetDocument, injectedStyles); 9490 } 9491 if (injectedStyles.has(hash)) { 9492 return; 9493 } 9494 if (documentContainsStyleHash8(targetDocument, hash)) { 9495 injectedStyles.add(hash); 9496 return; 9497 } 9498 const style = targetDocument.createElement("style"); 9499 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); 9500 style.appendChild(targetDocument.createTextNode(css)); 9501 targetDocument.head.appendChild(style); 9502 injectedStyles.add(hash); 9503 } 9504 function registerDocument8(targetDocument) { 9505 const runtime = getRuntime8(); 9506 runtime.documents.set( 9507 targetDocument, 9508 (runtime.documents.get(targetDocument) ?? 0) + 1 9509 ); 9510 for (const [hash, css] of runtime.styles) { 9511 injectStyle8(targetDocument, hash, css); 9512 } 9513 return () => { 9514 const count = runtime.documents.get(targetDocument); 9515 if (count === void 0) { 9516 return; 9517 } 9518 if (count <= 1) { 9519 runtime.documents.delete(targetDocument); 9520 return; 9521 } 9522 runtime.documents.set(targetDocument, count - 1); 9523 }; 9524 } 9525 function registerStyle8(hash, css) { 9526 const runtime = getRuntime8(); 9527 runtime.styles.set(hash, css); 9528 for (const targetDocument of runtime.documents.keys()) { 9529 injectStyle8(targetDocument, hash, css); 9530 } 9531 } 9532 if (typeof process === "undefined" || true) { 9533 registerStyle8("4811d023d1", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); 9534 } 9535 var style_default7 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 9536 var ThemeProvider = unlock(import_theme.privateApis).ThemeProvider; 9537 var POPUP_COLOR = { background: "#1e1e1e" }; 9538 var Popup = (0, import_element19.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 9539 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( 9540 index_parts_exports.Popup, 9541 { 9542 ref, 9543 className: clsx_default(style_default7.popup, className), 9544 ...props, 9545 children 9546 } 9547 ) }); 9548 const positionedPopup = renderSlotWithChildren( 9549 positioner, 9550 /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Positioner, {}), 9551 popupContent 9552 ); 9553 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Portal, {}), positionedPopup); 9554 }); 9555 9556 // packages/ui/build-module/tooltip/trigger.mjs 9557 var import_element20 = __toESM(require_element(), 1); 9558 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 9559 var Trigger = (0, import_element20.forwardRef)( 9560 function TooltipTrigger3(props, ref) { 9561 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(index_parts_exports.Trigger, { ref, ...props }); 9562 } 9563 ); 9564 9565 // packages/ui/build-module/tooltip/root.mjs 9566 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 9567 function Root(props) { 9568 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(index_parts_exports.Root, { ...props }); 9569 } 9570 9571 // packages/ui/build-module/tooltip/provider.mjs 9572 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 9573 function Provider({ ...props }) { 9574 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(index_parts_exports.Provider, { ...props }); 9575 } 9576 9577 // packages/ui/build-module/icon-button/icon-button.mjs 9578 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 9579 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; 9580 function getRuntime9() { 9581 const globalScope = globalThis; 9582 if (globalScope.__wpStyleRuntime) { 9583 return globalScope.__wpStyleRuntime; 9584 } 9585 globalScope.__wpStyleRuntime = { 9586 documents: /* @__PURE__ */ new Map(), 9587 styles: /* @__PURE__ */ new Map(), 9588 injectedStyles: /* @__PURE__ */ new WeakMap() 9589 }; 9590 if (typeof document !== "undefined") { 9591 registerDocument9(document); 9592 } 9593 return globalScope.__wpStyleRuntime; 9594 } 9595 function documentContainsStyleHash9(targetDocument, hash) { 9596 if (!targetDocument.head) { 9597 return false; 9598 } 9599 for (const style of targetDocument.head.querySelectorAll( 9600 `style[$STYLE_HASH_ATTRIBUTE9}]` 9601 )) { 9602 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { 9603 return true; 9604 } 9605 } 9606 return false; 9607 } 9608 function injectStyle9(targetDocument, hash, css) { 9609 if (!targetDocument.head) { 9610 return; 9611 } 9612 const runtime = getRuntime9(); 9613 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9614 if (!injectedStyles) { 9615 injectedStyles = /* @__PURE__ */ new Set(); 9616 runtime.injectedStyles.set(targetDocument, injectedStyles); 9617 } 9618 if (injectedStyles.has(hash)) { 9619 return; 9620 } 9621 if (documentContainsStyleHash9(targetDocument, hash)) { 9622 injectedStyles.add(hash); 9623 return; 9624 } 9625 const style = targetDocument.createElement("style"); 9626 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); 9627 style.appendChild(targetDocument.createTextNode(css)); 9628 targetDocument.head.appendChild(style); 9629 injectedStyles.add(hash); 9630 } 9631 function registerDocument9(targetDocument) { 9632 const runtime = getRuntime9(); 9633 runtime.documents.set( 9634 targetDocument, 9635 (runtime.documents.get(targetDocument) ?? 0) + 1 9636 ); 9637 for (const [hash, css] of runtime.styles) { 9638 injectStyle9(targetDocument, hash, css); 9639 } 9640 return () => { 9641 const count = runtime.documents.get(targetDocument); 9642 if (count === void 0) { 9643 return; 9644 } 9645 if (count <= 1) { 9646 runtime.documents.delete(targetDocument); 9647 return; 9648 } 9649 runtime.documents.set(targetDocument, count - 1); 9650 }; 9651 } 9652 function registerStyle9(hash, css) { 9653 const runtime = getRuntime9(); 9654 runtime.styles.set(hash, css); 9655 for (const targetDocument of runtime.documents.keys()) { 9656 injectStyle9(targetDocument, hash, css); 9657 } 9658 } 9659 if (typeof process === "undefined" || true) { 9660 registerStyle9("65cec4cf71", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}}"); 9661 } 9662 var style_default8 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" }; 9663 var IconButton = (0, import_element21.forwardRef)( 9664 function IconButton2({ 9665 label, 9666 className, 9667 // Prevent accidental forwarding of `children` 9668 children: _children, 9669 disabled: disabled2, 9670 focusableWhenDisabled = true, 9671 icon, 9672 size: size4, 9673 shortcut, 9674 positioner, 9675 ...restProps 9676 }, ref) { 9677 const classes = clsx_default(style_default8["icon-button"], className); 9678 return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Provider, { delay: 0, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Root, { children: [ 9679 /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( 9680 Trigger, 9681 { 9682 ref, 9683 disabled: disabled2 && !focusableWhenDisabled, 9684 render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( 9685 Button4, 9686 { 9687 ...restProps, 9688 size: size4, 9689 "aria-label": label, 9690 "aria-keyshortcuts": shortcut?.ariaKeyShortcut, 9691 disabled: disabled2, 9692 focusableWhenDisabled 9693 } 9694 ), 9695 className: classes, 9696 children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( 9697 Icon, 9698 { 9699 icon, 9700 size: 24, 9701 className: style_default8.icon 9702 } 9703 ) 9704 } 9705 ), 9706 /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Popup, { positioner, children: [ 9707 label, 9708 shortcut && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [ 9709 " ", 9710 /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { "aria-hidden": "true", children: shortcut.displayShortcut }) 9711 ] }) 9712 ] }) 9713 ] }) }); 9714 } 9715 ); 9716 9717 // packages/ui/build-module/link/link.mjs 9718 var import_element22 = __toESM(require_element(), 1); 9719 var import_i18n2 = __toESM(require_i18n(), 1); 9720 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 9721 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; 9722 function getRuntime10() { 9723 const globalScope = globalThis; 9724 if (globalScope.__wpStyleRuntime) { 9725 return globalScope.__wpStyleRuntime; 9726 } 9727 globalScope.__wpStyleRuntime = { 9728 documents: /* @__PURE__ */ new Map(), 9729 styles: /* @__PURE__ */ new Map(), 9730 injectedStyles: /* @__PURE__ */ new WeakMap() 9731 }; 9732 if (typeof document !== "undefined") { 9733 registerDocument10(document); 9734 } 9735 return globalScope.__wpStyleRuntime; 9736 } 9737 function documentContainsStyleHash10(targetDocument, hash) { 9738 if (!targetDocument.head) { 9739 return false; 9740 } 9741 for (const style of targetDocument.head.querySelectorAll( 9742 `style[$STYLE_HASH_ATTRIBUTE10}]` 9743 )) { 9744 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { 9745 return true; 9746 } 9747 } 9748 return false; 9749 } 9750 function injectStyle10(targetDocument, hash, css) { 9751 if (!targetDocument.head) { 9752 return; 9753 } 9754 const runtime = getRuntime10(); 9755 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9756 if (!injectedStyles) { 9757 injectedStyles = /* @__PURE__ */ new Set(); 9758 runtime.injectedStyles.set(targetDocument, injectedStyles); 9759 } 9760 if (injectedStyles.has(hash)) { 9761 return; 9762 } 9763 if (documentContainsStyleHash10(targetDocument, hash)) { 9764 injectedStyles.add(hash); 9765 return; 9766 } 9767 const style = targetDocument.createElement("style"); 9768 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); 9769 style.appendChild(targetDocument.createTextNode(css)); 9770 targetDocument.head.appendChild(style); 9771 injectedStyles.add(hash); 9772 } 9773 function registerDocument10(targetDocument) { 9774 const runtime = getRuntime10(); 9775 runtime.documents.set( 9776 targetDocument, 9777 (runtime.documents.get(targetDocument) ?? 0) + 1 9778 ); 9779 for (const [hash, css] of runtime.styles) { 9780 injectStyle10(targetDocument, hash, css); 9781 } 9782 return () => { 9783 const count = runtime.documents.get(targetDocument); 9784 if (count === void 0) { 9785 return; 9786 } 9787 if (count <= 1) { 9788 runtime.documents.delete(targetDocument); 9789 return; 9790 } 9791 runtime.documents.set(targetDocument, count - 1); 9792 }; 9793 } 9794 function registerStyle10(hash, css) { 9795 const runtime = getRuntime10(); 9796 runtime.styles.set(hash, css); 9797 for (const targetDocument of runtime.documents.keys()) { 9798 injectStyle10(targetDocument, hash, css); 9799 } 9800 } 9801 if (typeof process === "undefined" || true) { 9802 registerStyle10("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 9803 } 9804 var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 9805 if (typeof process === "undefined" || true) { 9806 registerStyle10("693cd16544", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid transparent;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}}"); 9807 } 9808 var focus_default2 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; 9809 if (typeof process === "undefined" || true) { 9810 registerStyle10("9f01019e30", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d4250949359b05ce__link{text-decoration-thickness:from-font;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}._0cb411afac4c86c7__link-icon{display:inline-block;font-weight:var(--wpds-typography-font-weight-regular,400);line-height:1;margin-inline-start:var(--wpds-dimension-padding-xs,4px);text-decoration:none}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}}'); 9811 } 9812 var style_default9 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" }; 9813 if (typeof process === "undefined" || true) { 9814 registerStyle10("d5c1b736fd", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); 9815 } 9816 var global_css_defense_default3 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" }; 9817 var Link = (0, import_element22.forwardRef)(function Link2({ 9818 children, 9819 variant = "default", 9820 tone = "brand", 9821 openInNewTab = false, 9822 render, 9823 className, 9824 ...props 9825 }, ref) { 9826 const element = useRender({ 9827 render, 9828 defaultTagName: "a", 9829 ref, 9830 props: mergeProps(props, { 9831 className: clsx_default( 9832 global_css_defense_default3.a, 9833 resets_default3["box-sizing"], 9834 focus_default2["outset-ring--focus"], 9835 variant !== "unstyled" && style_default9.link, 9836 variant !== "unstyled" && style_default9[`is-$tone}`], 9837 variant === "unstyled" && style_default9["is-unstyled"], 9838 className 9839 ), 9840 target: openInNewTab ? "_blank" : void 0, 9841 children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [ 9842 children, 9843 openInNewTab && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( 9844 "span", 9845 { 9846 className: style_default9["link-icon"], 9847 role: "img", 9848 "aria-label": ( 9849 /* translators: accessibility text appended to link text */ 9850 (0, import_i18n2.__)("(opens in a new tab)") 9851 ) 9852 } 9853 ) 9854 ] }) 9855 }) 9856 }); 9857 return element; 9858 }); 9859 9860 // packages/ui/build-module/notice/index.mjs 9861 var notice_exports = {}; 9862 __export(notice_exports, { 9863 ActionButton: () => ActionButton, 9864 ActionLink: () => ActionLink, 9865 Actions: () => Actions, 9866 CloseIcon: () => CloseIcon, 9867 Description: () => Description, 9868 Root: () => Root2, 9869 Title: () => Title 9870 }); 9871 9872 // packages/ui/build-module/notice/root.mjs 9873 var import_element23 = __toESM(require_element(), 1); 9874 import { speak as speak2 } from "@wordpress/a11y"; 9875 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 9876 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; 9877 function getRuntime11() { 9878 const globalScope = globalThis; 9879 if (globalScope.__wpStyleRuntime) { 9880 return globalScope.__wpStyleRuntime; 9881 } 9882 globalScope.__wpStyleRuntime = { 9883 documents: /* @__PURE__ */ new Map(), 9884 styles: /* @__PURE__ */ new Map(), 9885 injectedStyles: /* @__PURE__ */ new WeakMap() 9886 }; 9887 if (typeof document !== "undefined") { 9888 registerDocument11(document); 9889 } 9890 return globalScope.__wpStyleRuntime; 9891 } 9892 function documentContainsStyleHash11(targetDocument, hash) { 9893 if (!targetDocument.head) { 9894 return false; 9895 } 9896 for (const style of targetDocument.head.querySelectorAll( 9897 `style[$STYLE_HASH_ATTRIBUTE11}]` 9898 )) { 9899 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { 9900 return true; 9901 } 9902 } 9903 return false; 9904 } 9905 function injectStyle11(targetDocument, hash, css) { 9906 if (!targetDocument.head) { 9907 return; 9908 } 9909 const runtime = getRuntime11(); 9910 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9911 if (!injectedStyles) { 9912 injectedStyles = /* @__PURE__ */ new Set(); 9913 runtime.injectedStyles.set(targetDocument, injectedStyles); 9914 } 9915 if (injectedStyles.has(hash)) { 9916 return; 9917 } 9918 if (documentContainsStyleHash11(targetDocument, hash)) { 9919 injectedStyles.add(hash); 9920 return; 9921 } 9922 const style = targetDocument.createElement("style"); 9923 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); 9924 style.appendChild(targetDocument.createTextNode(css)); 9925 targetDocument.head.appendChild(style); 9926 injectedStyles.add(hash); 9927 } 9928 function registerDocument11(targetDocument) { 9929 const runtime = getRuntime11(); 9930 runtime.documents.set( 9931 targetDocument, 9932 (runtime.documents.get(targetDocument) ?? 0) + 1 9933 ); 9934 for (const [hash, css] of runtime.styles) { 9935 injectStyle11(targetDocument, hash, css); 9936 } 9937 return () => { 9938 const count = runtime.documents.get(targetDocument); 9939 if (count === void 0) { 9940 return; 9941 } 9942 if (count <= 1) { 9943 runtime.documents.delete(targetDocument); 9944 return; 9945 } 9946 runtime.documents.set(targetDocument, count - 1); 9947 }; 9948 } 9949 function registerStyle11(hash, css) { 9950 const runtime = getRuntime11(); 9951 runtime.styles.set(hash, css); 9952 for (const targetDocument of runtime.documents.keys()) { 9953 injectStyle11(targetDocument, hash, css); 9954 } 9955 } 9956 if (typeof process === "undefined" || true) { 9957 registerStyle11("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 9958 } 9959 var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 9960 if (typeof process === "undefined" || true) { 9961 registerStyle11("80d31bc171", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#a9c6e7);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bc7c);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#94d29e);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#dab1aa);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}}"); 9962 } 9963 var style_default10 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 9964 var icons = { 9965 neutral: null, 9966 info: info_default, 9967 warning: caution_default, 9968 success: published_default, 9969 error: error_default 9970 }; 9971 function getDefaultPoliteness(intent) { 9972 return intent === "error" ? "assertive" : "polite"; 9973 } 9974 function safeRenderToString(message) { 9975 if (!message) { 9976 return void 0; 9977 } 9978 if (typeof message === "string") { 9979 return message; 9980 } 9981 try { 9982 return (0, import_element23.renderToString)(message); 9983 } catch { 9984 return void 0; 9985 } 9986 } 9987 function useSpokenMessage(message, politeness) { 9988 const spokenMessage = safeRenderToString(message); 9989 (0, import_element23.useEffect)(() => { 9990 if (spokenMessage) { 9991 speak2(spokenMessage, politeness); 9992 } 9993 }, [spokenMessage, politeness]); 9994 } 9995 var Root2 = (0, import_element23.forwardRef)(function Notice({ 9996 intent = "neutral", 9997 children, 9998 icon, 9999 spokenMessage = children, 10000 politeness = getDefaultPoliteness(intent), 10001 render, 10002 ...restProps 10003 }, ref) { 10004 useSpokenMessage(spokenMessage, politeness); 10005 const iconElement = icon === null ? null : icon ?? icons[intent]; 10006 const mergedClassName = clsx_default( 10007 style_default10.notice, 10008 style_default10[`is-$intent}`], 10009 resets_default4["box-sizing"] 10010 ); 10011 const element = useRender({ 10012 defaultTagName: "div", 10013 render, 10014 ref, 10015 props: mergeProps( 10016 { 10017 className: mergedClassName, 10018 children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [ 10019 children, 10020 iconElement && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 10021 Icon, 10022 { 10023 className: style_default10.icon, 10024 icon: iconElement 10025 } 10026 ) 10027 ] }) 10028 }, 10029 restProps 10030 ) 10031 }); 10032 return element; 10033 }); 10034 10035 // packages/ui/build-module/notice/title.mjs 10036 var import_element24 = __toESM(require_element(), 1); 10037 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 10038 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; 10039 function getRuntime12() { 10040 const globalScope = globalThis; 10041 if (globalScope.__wpStyleRuntime) { 10042 return globalScope.__wpStyleRuntime; 10043 } 10044 globalScope.__wpStyleRuntime = { 10045 documents: /* @__PURE__ */ new Map(), 10046 styles: /* @__PURE__ */ new Map(), 10047 injectedStyles: /* @__PURE__ */ new WeakMap() 10048 }; 10049 if (typeof document !== "undefined") { 10050 registerDocument12(document); 10051 } 10052 return globalScope.__wpStyleRuntime; 10053 } 10054 function documentContainsStyleHash12(targetDocument, hash) { 10055 if (!targetDocument.head) { 10056 return false; 10057 } 10058 for (const style of targetDocument.head.querySelectorAll( 10059 `style[$STYLE_HASH_ATTRIBUTE12}]` 10060 )) { 10061 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { 10062 return true; 10063 } 10064 } 10065 return false; 10066 } 10067 function injectStyle12(targetDocument, hash, css) { 10068 if (!targetDocument.head) { 10069 return; 10070 } 10071 const runtime = getRuntime12(); 10072 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10073 if (!injectedStyles) { 10074 injectedStyles = /* @__PURE__ */ new Set(); 10075 runtime.injectedStyles.set(targetDocument, injectedStyles); 10076 } 10077 if (injectedStyles.has(hash)) { 10078 return; 10079 } 10080 if (documentContainsStyleHash12(targetDocument, hash)) { 10081 injectedStyles.add(hash); 10082 return; 10083 } 10084 const style = targetDocument.createElement("style"); 10085 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); 10086 style.appendChild(targetDocument.createTextNode(css)); 10087 targetDocument.head.appendChild(style); 10088 injectedStyles.add(hash); 10089 } 10090 function registerDocument12(targetDocument) { 10091 const runtime = getRuntime12(); 10092 runtime.documents.set( 10093 targetDocument, 10094 (runtime.documents.get(targetDocument) ?? 0) + 1 10095 ); 10096 for (const [hash, css] of runtime.styles) { 10097 injectStyle12(targetDocument, hash, css); 10098 } 10099 return () => { 10100 const count = runtime.documents.get(targetDocument); 10101 if (count === void 0) { 10102 return; 10103 } 10104 if (count <= 1) { 10105 runtime.documents.delete(targetDocument); 10106 return; 10107 } 10108 runtime.documents.set(targetDocument, count - 1); 10109 }; 10110 } 10111 function registerStyle12(hash, css) { 10112 const runtime = getRuntime12(); 10113 runtime.styles.set(hash, css); 10114 for (const targetDocument of runtime.documents.keys()) { 10115 injectStyle12(targetDocument, hash, css); 10116 } 10117 } 10118 if (typeof process === "undefined" || true) { 10119 registerStyle12("80d31bc171", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#a9c6e7);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bc7c);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#94d29e);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#dab1aa);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}}"); 10120 } 10121 var style_default11 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 10122 var Title = (0, import_element24.forwardRef)( 10123 function NoticeTitle({ className, ...props }, ref) { 10124 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( 10125 Text, 10126 { 10127 ref, 10128 variant: "heading-md", 10129 className: clsx_default(style_default11.title, className), 10130 ...props 10131 } 10132 ); 10133 } 10134 ); 10135 10136 // packages/ui/build-module/notice/description.mjs 10137 var import_element25 = __toESM(require_element(), 1); 10138 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 10139 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; 10140 function getRuntime13() { 10141 const globalScope = globalThis; 10142 if (globalScope.__wpStyleRuntime) { 10143 return globalScope.__wpStyleRuntime; 10144 } 10145 globalScope.__wpStyleRuntime = { 10146 documents: /* @__PURE__ */ new Map(), 10147 styles: /* @__PURE__ */ new Map(), 10148 injectedStyles: /* @__PURE__ */ new WeakMap() 10149 }; 10150 if (typeof document !== "undefined") { 10151 registerDocument13(document); 10152 } 10153 return globalScope.__wpStyleRuntime; 10154 } 10155 function documentContainsStyleHash13(targetDocument, hash) { 10156 if (!targetDocument.head) { 10157 return false; 10158 } 10159 for (const style of targetDocument.head.querySelectorAll( 10160 `style[$STYLE_HASH_ATTRIBUTE13}]` 10161 )) { 10162 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { 10163 return true; 10164 } 10165 } 10166 return false; 10167 } 10168 function injectStyle13(targetDocument, hash, css) { 10169 if (!targetDocument.head) { 10170 return; 10171 } 10172 const runtime = getRuntime13(); 10173 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10174 if (!injectedStyles) { 10175 injectedStyles = /* @__PURE__ */ new Set(); 10176 runtime.injectedStyles.set(targetDocument, injectedStyles); 10177 } 10178 if (injectedStyles.has(hash)) { 10179 return; 10180 } 10181 if (documentContainsStyleHash13(targetDocument, hash)) { 10182 injectedStyles.add(hash); 10183 return; 10184 } 10185 const style = targetDocument.createElement("style"); 10186 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); 10187 style.appendChild(targetDocument.createTextNode(css)); 10188 targetDocument.head.appendChild(style); 10189 injectedStyles.add(hash); 10190 } 10191 function registerDocument13(targetDocument) { 10192 const runtime = getRuntime13(); 10193 runtime.documents.set( 10194 targetDocument, 10195 (runtime.documents.get(targetDocument) ?? 0) + 1 10196 ); 10197 for (const [hash, css] of runtime.styles) { 10198 injectStyle13(targetDocument, hash, css); 10199 } 10200 return () => { 10201 const count = runtime.documents.get(targetDocument); 10202 if (count === void 0) { 10203 return; 10204 } 10205 if (count <= 1) { 10206 runtime.documents.delete(targetDocument); 10207 return; 10208 } 10209 runtime.documents.set(targetDocument, count - 1); 10210 }; 10211 } 10212 function registerStyle13(hash, css) { 10213 const runtime = getRuntime13(); 10214 runtime.styles.set(hash, css); 10215 for (const targetDocument of runtime.documents.keys()) { 10216 injectStyle13(targetDocument, hash, css); 10217 } 10218 } 10219 if (typeof process === "undefined" || true) { 10220 registerStyle13("80d31bc171", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#a9c6e7);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bc7c);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#94d29e);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#dab1aa);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}}"); 10221 } 10222 var style_default12 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 10223 var Description = (0, import_element25.forwardRef)( 10224 function NoticeDescription({ className, ...props }, ref) { 10225 return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( 10226 Text, 10227 { 10228 ref, 10229 variant: "body-md", 10230 className: clsx_default(style_default12.description, className), 10231 ...props 10232 } 10233 ); 10234 } 10235 ); 10236 10237 // packages/ui/build-module/notice/actions.mjs 10238 var import_element26 = __toESM(require_element(), 1); 10239 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; 10240 function getRuntime14() { 10241 const globalScope = globalThis; 10242 if (globalScope.__wpStyleRuntime) { 10243 return globalScope.__wpStyleRuntime; 10244 } 10245 globalScope.__wpStyleRuntime = { 10246 documents: /* @__PURE__ */ new Map(), 10247 styles: /* @__PURE__ */ new Map(), 10248 injectedStyles: /* @__PURE__ */ new WeakMap() 10249 }; 10250 if (typeof document !== "undefined") { 10251 registerDocument14(document); 10252 } 10253 return globalScope.__wpStyleRuntime; 10254 } 10255 function documentContainsStyleHash14(targetDocument, hash) { 10256 if (!targetDocument.head) { 10257 return false; 10258 } 10259 for (const style of targetDocument.head.querySelectorAll( 10260 `style[$STYLE_HASH_ATTRIBUTE14}]` 10261 )) { 10262 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { 10263 return true; 10264 } 10265 } 10266 return false; 10267 } 10268 function injectStyle14(targetDocument, hash, css) { 10269 if (!targetDocument.head) { 10270 return; 10271 } 10272 const runtime = getRuntime14(); 10273 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10274 if (!injectedStyles) { 10275 injectedStyles = /* @__PURE__ */ new Set(); 10276 runtime.injectedStyles.set(targetDocument, injectedStyles); 10277 } 10278 if (injectedStyles.has(hash)) { 10279 return; 10280 } 10281 if (documentContainsStyleHash14(targetDocument, hash)) { 10282 injectedStyles.add(hash); 10283 return; 10284 } 10285 const style = targetDocument.createElement("style"); 10286 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); 10287 style.appendChild(targetDocument.createTextNode(css)); 10288 targetDocument.head.appendChild(style); 10289 injectedStyles.add(hash); 10290 } 10291 function registerDocument14(targetDocument) { 10292 const runtime = getRuntime14(); 10293 runtime.documents.set( 10294 targetDocument, 10295 (runtime.documents.get(targetDocument) ?? 0) + 1 10296 ); 10297 for (const [hash, css] of runtime.styles) { 10298 injectStyle14(targetDocument, hash, css); 10299 } 10300 return () => { 10301 const count = runtime.documents.get(targetDocument); 10302 if (count === void 0) { 10303 return; 10304 } 10305 if (count <= 1) { 10306 runtime.documents.delete(targetDocument); 10307 return; 10308 } 10309 runtime.documents.set(targetDocument, count - 1); 10310 }; 10311 } 10312 function registerStyle14(hash, css) { 10313 const runtime = getRuntime14(); 10314 runtime.styles.set(hash, css); 10315 for (const targetDocument of runtime.documents.keys()) { 10316 injectStyle14(targetDocument, hash, css); 10317 } 10318 } 10319 if (typeof process === "undefined" || true) { 10320 registerStyle14("80d31bc171", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#a9c6e7);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bc7c);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#94d29e);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#dab1aa);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}}"); 10321 } 10322 var style_default13 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 10323 var Actions = (0, import_element26.forwardRef)( 10324 function NoticeActions({ render, ...props }, ref) { 10325 const element = useRender({ 10326 defaultTagName: "div", 10327 render, 10328 ref, 10329 props: mergeProps( 10330 { 10331 className: style_default13.actions 10332 }, 10333 props 10334 ) 10335 }); 10336 return element; 10337 } 10338 ); 10339 10340 // packages/ui/build-module/notice/close-icon.mjs 10341 var import_element27 = __toESM(require_element(), 1); 10342 var import_i18n3 = __toESM(require_i18n(), 1); 10343 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 10344 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; 10345 function getRuntime15() { 10346 const globalScope = globalThis; 10347 if (globalScope.__wpStyleRuntime) { 10348 return globalScope.__wpStyleRuntime; 10349 } 10350 globalScope.__wpStyleRuntime = { 10351 documents: /* @__PURE__ */ new Map(), 10352 styles: /* @__PURE__ */ new Map(), 10353 injectedStyles: /* @__PURE__ */ new WeakMap() 10354 }; 10355 if (typeof document !== "undefined") { 10356 registerDocument15(document); 10357 } 10358 return globalScope.__wpStyleRuntime; 10359 } 10360 function documentContainsStyleHash15(targetDocument, hash) { 10361 if (!targetDocument.head) { 10362 return false; 10363 } 10364 for (const style of targetDocument.head.querySelectorAll( 10365 `style[$STYLE_HASH_ATTRIBUTE15}]` 10366 )) { 10367 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { 10368 return true; 10369 } 10370 } 10371 return false; 10372 } 10373 function injectStyle15(targetDocument, hash, css) { 10374 if (!targetDocument.head) { 10375 return; 10376 } 10377 const runtime = getRuntime15(); 10378 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10379 if (!injectedStyles) { 10380 injectedStyles = /* @__PURE__ */ new Set(); 10381 runtime.injectedStyles.set(targetDocument, injectedStyles); 10382 } 10383 if (injectedStyles.has(hash)) { 10384 return; 10385 } 10386 if (documentContainsStyleHash15(targetDocument, hash)) { 10387 injectedStyles.add(hash); 10388 return; 10389 } 10390 const style = targetDocument.createElement("style"); 10391 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); 10392 style.appendChild(targetDocument.createTextNode(css)); 10393 targetDocument.head.appendChild(style); 10394 injectedStyles.add(hash); 10395 } 10396 function registerDocument15(targetDocument) { 10397 const runtime = getRuntime15(); 10398 runtime.documents.set( 10399 targetDocument, 10400 (runtime.documents.get(targetDocument) ?? 0) + 1 10401 ); 10402 for (const [hash, css] of runtime.styles) { 10403 injectStyle15(targetDocument, hash, css); 10404 } 10405 return () => { 10406 const count = runtime.documents.get(targetDocument); 10407 if (count === void 0) { 10408 return; 10409 } 10410 if (count <= 1) { 10411 runtime.documents.delete(targetDocument); 10412 return; 10413 } 10414 runtime.documents.set(targetDocument, count - 1); 10415 }; 10416 } 10417 function registerStyle15(hash, css) { 10418 const runtime = getRuntime15(); 10419 runtime.styles.set(hash, css); 10420 for (const targetDocument of runtime.documents.keys()) { 10421 injectStyle15(targetDocument, hash, css); 10422 } 10423 } 10424 if (typeof process === "undefined" || true) { 10425 registerStyle15("80d31bc171", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#a9c6e7);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bc7c);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#94d29e);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#dab1aa);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}}"); 10426 } 10427 var style_default14 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 10428 var CloseIcon = (0, import_element27.forwardRef)( 10429 function NoticeCloseIcon({ className, icon = close_small_default, label = (0, import_i18n3.__)("Dismiss"), ...props }, ref) { 10430 return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 10431 IconButton, 10432 { 10433 ...props, 10434 ref, 10435 className: clsx_default(style_default14["close-icon"], className), 10436 variant: "minimal", 10437 size: "small", 10438 tone: "neutral", 10439 icon, 10440 label 10441 } 10442 ); 10443 } 10444 ); 10445 10446 // packages/ui/build-module/notice/action-button.mjs 10447 var import_element28 = __toESM(require_element(), 1); 10448 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 10449 var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash"; 10450 function getRuntime16() { 10451 const globalScope = globalThis; 10452 if (globalScope.__wpStyleRuntime) { 10453 return globalScope.__wpStyleRuntime; 10454 } 10455 globalScope.__wpStyleRuntime = { 10456 documents: /* @__PURE__ */ new Map(), 10457 styles: /* @__PURE__ */ new Map(), 10458 injectedStyles: /* @__PURE__ */ new WeakMap() 10459 }; 10460 if (typeof document !== "undefined") { 10461 registerDocument16(document); 10462 } 10463 return globalScope.__wpStyleRuntime; 10464 } 10465 function documentContainsStyleHash16(targetDocument, hash) { 10466 if (!targetDocument.head) { 10467 return false; 10468 } 10469 for (const style of targetDocument.head.querySelectorAll( 10470 `style[$STYLE_HASH_ATTRIBUTE16}]` 10471 )) { 10472 if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) { 10473 return true; 10474 } 10475 } 10476 return false; 10477 } 10478 function injectStyle16(targetDocument, hash, css) { 10479 if (!targetDocument.head) { 10480 return; 10481 } 10482 const runtime = getRuntime16(); 10483 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10484 if (!injectedStyles) { 10485 injectedStyles = /* @__PURE__ */ new Set(); 10486 runtime.injectedStyles.set(targetDocument, injectedStyles); 10487 } 10488 if (injectedStyles.has(hash)) { 10489 return; 10490 } 10491 if (documentContainsStyleHash16(targetDocument, hash)) { 10492 injectedStyles.add(hash); 10493 return; 10494 } 10495 const style = targetDocument.createElement("style"); 10496 style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash); 10497 style.appendChild(targetDocument.createTextNode(css)); 10498 targetDocument.head.appendChild(style); 10499 injectedStyles.add(hash); 10500 } 10501 function registerDocument16(targetDocument) { 10502 const runtime = getRuntime16(); 10503 runtime.documents.set( 10504 targetDocument, 10505 (runtime.documents.get(targetDocument) ?? 0) + 1 10506 ); 10507 for (const [hash, css] of runtime.styles) { 10508 injectStyle16(targetDocument, hash, css); 10509 } 10510 return () => { 10511 const count = runtime.documents.get(targetDocument); 10512 if (count === void 0) { 10513 return; 10514 } 10515 if (count <= 1) { 10516 runtime.documents.delete(targetDocument); 10517 return; 10518 } 10519 runtime.documents.set(targetDocument, count - 1); 10520 }; 10521 } 10522 function registerStyle16(hash, css) { 10523 const runtime = getRuntime16(); 10524 runtime.styles.set(hash, css); 10525 for (const targetDocument of runtime.documents.keys()) { 10526 injectStyle16(targetDocument, hash, css); 10527 } 10528 } 10529 if (typeof process === "undefined" || true) { 10530 registerStyle16("80d31bc171", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#a9c6e7);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bc7c);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#94d29e);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#dab1aa);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}}"); 10531 } 10532 var style_default15 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 10533 var ActionButton = (0, import_element28.forwardRef)( 10534 function NoticeActionButton({ className, loading, loadingAnnouncement, variant, ...props }, ref) { 10535 const loadingProps = loading !== void 0 ? { loading, loadingAnnouncement: loadingAnnouncement ?? "" } : {}; 10536 return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 10537 Button4, 10538 { 10539 ...props, 10540 ...loadingProps, 10541 ref, 10542 size: "compact", 10543 tone: "neutral", 10544 variant, 10545 className: clsx_default( 10546 style_default15["action-button"], 10547 style_default15[`is-action-button-$variant}`], 10548 className 10549 ) 10550 } 10551 ); 10552 } 10553 ); 10554 10555 // packages/ui/build-module/notice/action-link.mjs 10556 var import_element29 = __toESM(require_element(), 1); 10557 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 10558 var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash"; 10559 function getRuntime17() { 10560 const globalScope = globalThis; 10561 if (globalScope.__wpStyleRuntime) { 10562 return globalScope.__wpStyleRuntime; 10563 } 10564 globalScope.__wpStyleRuntime = { 10565 documents: /* @__PURE__ */ new Map(), 10566 styles: /* @__PURE__ */ new Map(), 10567 injectedStyles: /* @__PURE__ */ new WeakMap() 10568 }; 10569 if (typeof document !== "undefined") { 10570 registerDocument17(document); 10571 } 10572 return globalScope.__wpStyleRuntime; 10573 } 10574 function documentContainsStyleHash17(targetDocument, hash) { 10575 if (!targetDocument.head) { 10576 return false; 10577 } 10578 for (const style of targetDocument.head.querySelectorAll( 10579 `style[$STYLE_HASH_ATTRIBUTE17}]` 10580 )) { 10581 if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) { 10582 return true; 10583 } 10584 } 10585 return false; 10586 } 10587 function injectStyle17(targetDocument, hash, css) { 10588 if (!targetDocument.head) { 10589 return; 10590 } 10591 const runtime = getRuntime17(); 10592 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10593 if (!injectedStyles) { 10594 injectedStyles = /* @__PURE__ */ new Set(); 10595 runtime.injectedStyles.set(targetDocument, injectedStyles); 10596 } 10597 if (injectedStyles.has(hash)) { 10598 return; 10599 } 10600 if (documentContainsStyleHash17(targetDocument, hash)) { 10601 injectedStyles.add(hash); 10602 return; 10603 } 10604 const style = targetDocument.createElement("style"); 10605 style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash); 10606 style.appendChild(targetDocument.createTextNode(css)); 10607 targetDocument.head.appendChild(style); 10608 injectedStyles.add(hash); 10609 } 10610 function registerDocument17(targetDocument) { 10611 const runtime = getRuntime17(); 10612 runtime.documents.set( 10613 targetDocument, 10614 (runtime.documents.get(targetDocument) ?? 0) + 1 10615 ); 10616 for (const [hash, css] of runtime.styles) { 10617 injectStyle17(targetDocument, hash, css); 10618 } 10619 return () => { 10620 const count = runtime.documents.get(targetDocument); 10621 if (count === void 0) { 10622 return; 10623 } 10624 if (count <= 1) { 10625 runtime.documents.delete(targetDocument); 10626 return; 10627 } 10628 runtime.documents.set(targetDocument, count - 1); 10629 }; 10630 } 10631 function registerStyle17(hash, css) { 10632 const runtime = getRuntime17(); 10633 runtime.styles.set(hash, css); 10634 for (const targetDocument of runtime.documents.keys()) { 10635 injectStyle17(targetDocument, hash, css); 10636 } 10637 } 10638 if (typeof process === "undefined" || true) { 10639 registerStyle17("80d31bc171", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#a9c6e7);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bc7c);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#94d29e);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#dab1aa);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}}"); 10640 } 10641 var style_default16 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 10642 var ActionLink = (0, import_element29.forwardRef)( 10643 function NoticeActionLink({ className, render, ...props }, ref) { 10644 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 10645 Text, 10646 { 10647 ref, 10648 className: clsx_default(style_default16["action-link"], className), 10649 ...props, 10650 variant: "body-md", 10651 render: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Link, { tone: "neutral", variant: "default", render }) 10652 } 10653 ); 10654 } 10655 ); 10656 10657 // packages/admin-ui/build-module/navigable-region/index.mjs 10658 var import_element30 = __toESM(require_element(), 1); 10659 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 10660 var NavigableRegion = (0, import_element30.forwardRef)( 10661 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 10662 return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( 10663 Tag, 10664 { 10665 ref, 10666 className: clsx_default("admin-ui-navigable-region", className), 10667 "aria-label": ariaLabel, 10668 role: "region", 10669 tabIndex: "-1", 10670 ...props, 10671 children 10672 } 10673 ); 10674 } 10675 ); 10676 NavigableRegion.displayName = "NavigableRegion"; 10677 var navigable_region_default = NavigableRegion; 10678 10679 // packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs 10680 var import_components = __toESM(require_components(), 1); 10681 var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components.createSlotFill)("SidebarToggle"); 10682 10683 // packages/admin-ui/build-module/page/header.mjs 10684 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 10685 var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash"; 10686 function getRuntime18() { 10687 const globalScope = globalThis; 10688 if (globalScope.__wpStyleRuntime) { 10689 return globalScope.__wpStyleRuntime; 10690 } 10691 globalScope.__wpStyleRuntime = { 10692 documents: /* @__PURE__ */ new Map(), 10693 styles: /* @__PURE__ */ new Map(), 10694 injectedStyles: /* @__PURE__ */ new WeakMap() 10695 }; 10696 if (typeof document !== "undefined") { 10697 registerDocument18(document); 10698 } 10699 return globalScope.__wpStyleRuntime; 10700 } 10701 function documentContainsStyleHash18(targetDocument, hash) { 10702 if (!targetDocument.head) { 10703 return false; 10704 } 10705 for (const style of targetDocument.head.querySelectorAll( 10706 `style[$STYLE_HASH_ATTRIBUTE18}]` 10707 )) { 10708 if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) { 10709 return true; 10710 } 10711 } 10712 return false; 10713 } 10714 function injectStyle18(targetDocument, hash, css) { 10715 if (!targetDocument.head) { 10716 return; 10717 } 10718 const runtime = getRuntime18(); 10719 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10720 if (!injectedStyles) { 10721 injectedStyles = /* @__PURE__ */ new Set(); 10722 runtime.injectedStyles.set(targetDocument, injectedStyles); 10723 } 10724 if (injectedStyles.has(hash)) { 10725 return; 10726 } 10727 if (documentContainsStyleHash18(targetDocument, hash)) { 10728 injectedStyles.add(hash); 10729 return; 10730 } 10731 const style = targetDocument.createElement("style"); 10732 style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash); 10733 style.appendChild(targetDocument.createTextNode(css)); 10734 targetDocument.head.appendChild(style); 10735 injectedStyles.add(hash); 10736 } 10737 function registerDocument18(targetDocument) { 10738 const runtime = getRuntime18(); 10739 runtime.documents.set( 10740 targetDocument, 10741 (runtime.documents.get(targetDocument) ?? 0) + 1 10742 ); 10743 for (const [hash, css] of runtime.styles) { 10744 injectStyle18(targetDocument, hash, css); 10745 } 10746 return () => { 10747 const count = runtime.documents.get(targetDocument); 10748 if (count === void 0) { 10749 return; 10750 } 10751 if (count <= 1) { 10752 runtime.documents.delete(targetDocument); 10753 return; 10754 } 10755 runtime.documents.set(targetDocument, count - 1); 10756 }; 10757 } 10758 function registerStyle18(hash, css) { 10759 const runtime = getRuntime18(); 10760 runtime.styles.set(hash, css); 10761 for (const targetDocument of runtime.documents.keys()) { 10762 injectStyle18(targetDocument, hash, css); 10763 } 10764 } 10765 if (typeof process === "undefined" || true) { 10766 registerStyle18("683dd16f2c", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-bg-surface-neutral,#fcfcfc);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-bg-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:calc(var(--wpds-dimension-base, 4px)*8)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:calc(var(--wpds-dimension-base, 4px)*6);width:calc(var(--wpds-dimension-base, 4px)*6);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-fg-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}"); 10767 } 10768 var style_default17 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" }; 10769 function Header({ 10770 headingLevel = 1, 10771 breadcrumbs, 10772 badges, 10773 visual, 10774 title, 10775 subTitle, 10776 actions, 10777 showSidebarToggle = true 10778 }) { 10779 const HeadingTag = `h$headingLevel}`; 10780 return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Stack, { direction: "column", className: style_default17.header, children: [ 10781 /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)( 10782 Stack, 10783 { 10784 className: style_default17["header-content"], 10785 direction: "row", 10786 gap: "sm", 10787 justify: "space-between", 10788 children: [ 10789 /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", justify: "start", children: [ 10790 showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 10791 SidebarToggleSlot, 10792 { 10793 bubblesVirtually: true, 10794 className: style_default17["sidebar-toggle-slot"] 10795 } 10796 ), 10797 visual && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 10798 "div", 10799 { 10800 className: style_default17["header-visual"], 10801 "aria-hidden": "true", 10802 children: visual 10803 } 10804 ), 10805 title && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 10806 Text, 10807 { 10808 className: style_default17["header-title"], 10809 render: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(HeadingTag, {}), 10810 variant: "heading-lg", 10811 children: title 10812 } 10813 ), 10814 breadcrumbs, 10815 badges 10816 ] }), 10817 actions && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 10818 Stack, 10819 { 10820 align: "center", 10821 className: style_default17["header-actions"], 10822 direction: "row", 10823 gap: "sm", 10824 children: actions 10825 } 10826 ) 10827 ] 10828 } 10829 ), 10830 subTitle && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 10831 Text, 10832 { 10833 render: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", {}), 10834 variant: "body-md", 10835 className: style_default17["header-subtitle"], 10836 children: subTitle 10837 } 10838 ) 10839 ] }); 10840 } 10841 10842 // packages/admin-ui/build-module/page/index.mjs 10843 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 10844 var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash"; 10845 function getRuntime19() { 10846 const globalScope = globalThis; 10847 if (globalScope.__wpStyleRuntime) { 10848 return globalScope.__wpStyleRuntime; 10849 } 10850 globalScope.__wpStyleRuntime = { 10851 documents: /* @__PURE__ */ new Map(), 10852 styles: /* @__PURE__ */ new Map(), 10853 injectedStyles: /* @__PURE__ */ new WeakMap() 10854 }; 10855 if (typeof document !== "undefined") { 10856 registerDocument19(document); 10857 } 10858 return globalScope.__wpStyleRuntime; 10859 } 10860 function documentContainsStyleHash19(targetDocument, hash) { 10861 if (!targetDocument.head) { 10862 return false; 10863 } 10864 for (const style of targetDocument.head.querySelectorAll( 10865 `style[$STYLE_HASH_ATTRIBUTE19}]` 10866 )) { 10867 if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) { 10868 return true; 10869 } 10870 } 10871 return false; 10872 } 10873 function injectStyle19(targetDocument, hash, css) { 10874 if (!targetDocument.head) { 10875 return; 10876 } 10877 const runtime = getRuntime19(); 10878 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10879 if (!injectedStyles) { 10880 injectedStyles = /* @__PURE__ */ new Set(); 10881 runtime.injectedStyles.set(targetDocument, injectedStyles); 10882 } 10883 if (injectedStyles.has(hash)) { 10884 return; 10885 } 10886 if (documentContainsStyleHash19(targetDocument, hash)) { 10887 injectedStyles.add(hash); 10888 return; 10889 } 10890 const style = targetDocument.createElement("style"); 10891 style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash); 10892 style.appendChild(targetDocument.createTextNode(css)); 10893 targetDocument.head.appendChild(style); 10894 injectedStyles.add(hash); 10895 } 10896 function registerDocument19(targetDocument) { 10897 const runtime = getRuntime19(); 10898 runtime.documents.set( 10899 targetDocument, 10900 (runtime.documents.get(targetDocument) ?? 0) + 1 10901 ); 10902 for (const [hash, css] of runtime.styles) { 10903 injectStyle19(targetDocument, hash, css); 10904 } 10905 return () => { 10906 const count = runtime.documents.get(targetDocument); 10907 if (count === void 0) { 10908 return; 10909 } 10910 if (count <= 1) { 10911 runtime.documents.delete(targetDocument); 10912 return; 10913 } 10914 runtime.documents.set(targetDocument, count - 1); 10915 }; 10916 } 10917 function registerStyle19(hash, css) { 10918 const runtime = getRuntime19(); 10919 runtime.styles.set(hash, css); 10920 for (const targetDocument of runtime.documents.keys()) { 10921 injectStyle19(targetDocument, hash, css); 10922 } 10923 } 10924 if (typeof process === "undefined" || true) { 10925 registerStyle19("683dd16f2c", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-bg-surface-neutral,#fcfcfc);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-bg-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:calc(var(--wpds-dimension-base, 4px)*8)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:calc(var(--wpds-dimension-base, 4px)*6);width:calc(var(--wpds-dimension-base, 4px)*6);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-fg-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}"); 10926 } 10927 var style_default18 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" }; 10928 function Page({ 10929 headingLevel, 10930 breadcrumbs, 10931 badges, 10932 visual, 10933 title, 10934 subTitle, 10935 children, 10936 className, 10937 actions, 10938 ariaLabel, 10939 hasPadding = false, 10940 showSidebarToggle = true 10941 }) { 10942 const classes = clsx_default(style_default18.page, className); 10943 const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : ""); 10944 return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(navigable_region_default, { className: classes, ariaLabel: effectiveAriaLabel, children: [ 10945 (title || breadcrumbs || badges || actions || visual) && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 10946 Header, 10947 { 10948 headingLevel, 10949 breadcrumbs, 10950 badges, 10951 visual, 10952 title, 10953 subTitle, 10954 actions, 10955 showSidebarToggle 10956 } 10957 ), 10958 hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( 10959 "div", 10960 { 10961 className: clsx_default( 10962 style_default18.content, 10963 style_default18["has-padding"] 10964 ), 10965 children 10966 } 10967 ) : children 10968 ] }); 10969 } 10970 Page.SidebarToggleFill = SidebarToggleFill; 10971 var page_default = Page; 10972 10973 // routes/connectors-home/stage.tsx 10974 var import_components4 = __toESM(require_components()); 10975 var import_data4 = __toESM(require_data()); 10976 var import_element34 = __toESM(require_element()); 10977 var import_i18n7 = __toESM(require_i18n()); 10978 var import_core_data3 = __toESM(require_core_data()); 10979 import { 10980 privateApis as connectorsPrivateApis2 10981 } from "@wordpress/connectors"; 10982 10983 // routes/connectors-home/style.scss 10984 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='09e9b056ea']")) { 10985 const style = document.createElement("style"); 10986 style.setAttribute("data-wp-hash", "09e9b056ea"); 10987 style.appendChild(document.createTextNode(".connectors-page{box-sizing:border-box;margin:0 auto;max-width:680px;padding:24px;width:100%}.connectors-page .components-item{background:#fff;border:1px solid #ddd;border-radius:8px;overflow:hidden;padding:20px;scroll-margin-top:120px}.connectors-page .connector-settings__error{color:#cc1818}.connectors-page .connector-settings .components-text-control__input{font-family:monospace;scroll-margin-top:120px}.connectors-page__file-mods-notice{margin-bottom:16px}.connectors-page--empty{align-items:center;display:flex;flex-direction:column;flex-grow:1;gap:32px;justify-content:center;text-align:center}.connectors-page .ai-plugin-callout{background-color:#e7d4e4;background-image:radial-gradient(ellipse 70% 120% at 18% 115%,rgba(202,158,198,.75) 0,rgba(202,158,198,0) 60%),radial-gradient(ellipse 55% 110% at 92% -15%,rgba(208,175,217,.7) 0,rgba(208,175,217,0) 65%),radial-gradient(ellipse 40% 85% at 58% -10%,rgba(170,130,184,.45) 0,rgba(170,130,184,0) 70%);border-radius:8px;overflow:hidden;padding:24px;padding-inline-end:150px;position:relative}[dir=rtl] .connectors-page .ai-plugin-callout{background-image:radial-gradient(ellipse 70% 120% at 82% 115%,rgba(202,158,198,.75) 0,rgba(202,158,198,0) 60%),radial-gradient(ellipse 55% 110% at 8% -15%,rgba(208,175,217,.7) 0,rgba(208,175,217,0) 65%),radial-gradient(ellipse 40% 85% at 42% -10%,rgba(170,130,184,.45) 0,rgba(170,130,184,0) 70%)}.connectors-page .ai-plugin-callout__content{align-items:flex-start;display:flex;flex-direction:column;gap:12px;padding-top:2px}.connectors-page .ai-plugin-callout__content p{font-size:13px;line-height:20px;margin:0}.connectors-page .ai-plugin-callout__decoration{height:110px;inset-inline-end:16px;position:absolute;top:12px;width:110px}.connectors-page>p{color:#949494}@media (max-width:680px){.connectors-page .ai-plugin-callout{padding:12px;padding-inline-end:100px}.connectors-page .ai-plugin-callout__decoration{height:75px;inset-inline-end:8px;top:8px;width:75px}}@media (max-width:480px){.connectors-page{padding:8px}.connectors-page .ai-plugin-callout{padding-inline-end:130px}.connectors-page .components-item{padding:12px}.connectors-page .components-item>.components-v-stack>.components-h-stack:first-child svg{height:32px;width:32px}.connectors-page .components-item>.components-v-stack>.components-h-stack:first-child>.components-h-stack:last-child{align-items:flex-end;flex-direction:column}}")); 10988 document.head.appendChild(style); 10989 } 10990 10991 // routes/connectors-home/ai-plugin-callout.tsx 10992 var import_components3 = __toESM(require_components()); 10993 var import_core_data2 = __toESM(require_core_data()); 10994 var import_data3 = __toESM(require_data()); 10995 var import_element33 = __toESM(require_element()); 10996 var import_i18n6 = __toESM(require_i18n()); 10997 var import_notices2 = __toESM(require_notices()); 10998 var import_url = __toESM(require_url()); 10999 11000 // routes/connectors-home/default-connectors.tsx 11001 var import_components2 = __toESM(require_components()); 11002 var import_element32 = __toESM(require_element()); 11003 var import_data2 = __toESM(require_data()); 11004 var import_i18n5 = __toESM(require_i18n()); 11005 import { 11006 __experimentalRegisterConnector as registerConnector, 11007 __experimentalConnectorItem as ConnectorItem, 11008 __experimentalDefaultConnectorSettings as DefaultConnectorSettings, 11009 privateApis as connectorsPrivateApis 11010 } from "@wordpress/connectors"; 11011 11012 // routes/lock-unlock.ts 11013 var import_private_apis2 = __toESM(require_private_apis()); 11014 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 11015 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 11016 "@wordpress/routes" 11017 ); 11018 11019 // routes/connectors-home/use-connector-plugin.ts 11020 var import_core_data = __toESM(require_core_data()); 11021 var import_data = __toESM(require_data()); 11022 var import_element31 = __toESM(require_element()); 11023 var import_i18n4 = __toESM(require_i18n()); 11024 var import_notices = __toESM(require_notices()); 11025 function useConnectorPlugin({ 11026 file: pluginFileFromServer, 11027 settingName, 11028 connectorName, 11029 isInstalled, 11030 isActivated, 11031 keySource = "none", 11032 initialIsConnected = false 11033 }) { 11034 const [isExpanded, setIsExpanded] = (0, import_element31.useState)(false); 11035 const [isBusy, setIsBusy] = (0, import_element31.useState)(false); 11036 const [connectedState, setConnectedState] = (0, import_element31.useState)(initialIsConnected); 11037 const [pluginStatusOverride, setPluginStatusOverride] = (0, import_element31.useState)(null); 11038 const pluginBasename = pluginFileFromServer?.replace(/\.php$/, ""); 11039 const pluginSlug = pluginBasename?.includes("/") ? pluginBasename.split("/")[0] : pluginBasename; 11040 const { 11041 derivedPluginStatus, 11042 canManagePlugins, 11043 currentApiKey, 11044 canInstallPlugins 11045 } = (0, import_data.useSelect)( 11046 (select2) => { 11047 const store2 = select2(import_core_data.store); 11048 const siteSettings = store2.getEntityRecord("root", "site"); 11049 const apiKey = siteSettings?.[settingName] ?? ""; 11050 const canCreate = !!store2.canUser("create", { 11051 kind: "root", 11052 name: "plugin" 11053 }); 11054 if (!pluginFileFromServer) { 11055 const hasLoaded = store2.hasFinishedResolution( 11056 "getEntityRecord", 11057 ["root", "site"] 11058 ); 11059 return { 11060 derivedPluginStatus: hasLoaded ? "active" : "checking", 11061 canManagePlugins: void 0, 11062 currentApiKey: apiKey, 11063 canInstallPlugins: canCreate 11064 }; 11065 } 11066 const plugin = store2.getEntityRecord( 11067 "root", 11068 "plugin", 11069 pluginBasename 11070 ); 11071 const hasFinished = store2.hasFinishedResolution( 11072 "getEntityRecord", 11073 ["root", "plugin", pluginBasename] 11074 ); 11075 if (!hasFinished) { 11076 return { 11077 derivedPluginStatus: "checking", 11078 canManagePlugins: void 0, 11079 currentApiKey: apiKey, 11080 canInstallPlugins: canCreate 11081 }; 11082 } 11083 if (plugin) { 11084 const isPluginActive = plugin.status === "active" || plugin.status === "network-active"; 11085 return { 11086 derivedPluginStatus: isPluginActive ? "active" : "inactive", 11087 canManagePlugins: true, 11088 currentApiKey: apiKey, 11089 canInstallPlugins: canCreate 11090 }; 11091 } 11092 let status = "not-installed"; 11093 if (isActivated) { 11094 status = "active"; 11095 } else if (isInstalled) { 11096 status = "inactive"; 11097 } 11098 return { 11099 derivedPluginStatus: status, 11100 canManagePlugins: false, 11101 currentApiKey: apiKey, 11102 canInstallPlugins: canCreate 11103 }; 11104 }, 11105 [pluginBasename, settingName, isInstalled, isActivated] 11106 ); 11107 const pluginStatus = pluginStatusOverride ?? derivedPluginStatus; 11108 const canActivatePlugins = canManagePlugins; 11109 const isConnected = pluginStatus === "active" && connectedState || // After install/activate, if settings re-fetch reveals an existing key, 11110 // update connected state (mirrors what the server would report on page load). 11111 pluginStatusOverride === "active" && !!currentApiKey; 11112 const { saveEntityRecord, invalidateResolution } = (0, import_data.useDispatch)(import_core_data.store); 11113 const { createSuccessNotice, createErrorNotice } = (0, import_data.useDispatch)(import_notices.store); 11114 const installPlugin = async () => { 11115 if (!pluginSlug) { 11116 return; 11117 } 11118 setIsBusy(true); 11119 try { 11120 await saveEntityRecord( 11121 "root", 11122 "plugin", 11123 { slug: pluginSlug, status: "active" }, 11124 { throwOnError: true } 11125 ); 11126 setPluginStatusOverride("active"); 11127 invalidateResolution("getEntityRecord", ["root", "site"]); 11128 setIsExpanded(true); 11129 createSuccessNotice( 11130 (0, import_i18n4.sprintf)( 11131 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 11132 (0, import_i18n4.__)("Plugin for %s installed and activated successfully."), 11133 connectorName 11134 ), 11135 { 11136 id: "connector-plugin-install-success", 11137 type: "snackbar" 11138 } 11139 ); 11140 } catch { 11141 createErrorNotice( 11142 (0, import_i18n4.sprintf)( 11143 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 11144 (0, import_i18n4.__)("Failed to install plugin for %s."), 11145 connectorName 11146 ), 11147 { 11148 id: "connector-plugin-install-error", 11149 type: "snackbar" 11150 } 11151 ); 11152 } finally { 11153 setIsBusy(false); 11154 } 11155 }; 11156 const activatePlugin = async () => { 11157 if (!pluginFileFromServer) { 11158 return; 11159 } 11160 setIsBusy(true); 11161 try { 11162 await saveEntityRecord( 11163 "root", 11164 "plugin", 11165 { 11166 plugin: pluginBasename, 11167 status: "active" 11168 }, 11169 { throwOnError: true } 11170 ); 11171 setPluginStatusOverride("active"); 11172 invalidateResolution("getEntityRecord", ["root", "site"]); 11173 setIsExpanded(true); 11174 createSuccessNotice( 11175 (0, import_i18n4.sprintf)( 11176 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 11177 (0, import_i18n4.__)("Plugin for %s activated successfully."), 11178 connectorName 11179 ), 11180 { 11181 id: "connector-plugin-activate-success", 11182 type: "snackbar" 11183 } 11184 ); 11185 } catch { 11186 createErrorNotice( 11187 (0, import_i18n4.sprintf)( 11188 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 11189 (0, import_i18n4.__)("Failed to activate plugin for %s."), 11190 connectorName 11191 ), 11192 { 11193 id: "connector-plugin-activate-error", 11194 type: "snackbar" 11195 } 11196 ); 11197 } finally { 11198 setIsBusy(false); 11199 } 11200 }; 11201 const handleButtonClick = () => { 11202 if (pluginStatus === "not-installed") { 11203 if (canInstallPlugins === false) { 11204 return; 11205 } 11206 installPlugin(); 11207 } else if (pluginStatus === "inactive") { 11208 if (canActivatePlugins === false) { 11209 return; 11210 } 11211 activatePlugin(); 11212 } else { 11213 setIsExpanded(!isExpanded); 11214 } 11215 }; 11216 const getButtonLabel = () => { 11217 if (isBusy) { 11218 return pluginStatus === "not-installed" ? (0, import_i18n4.__)("Installing\u2026") : (0, import_i18n4.__)("Activating\u2026"); 11219 } 11220 if (isExpanded) { 11221 return (0, import_i18n4.__)("Cancel"); 11222 } 11223 if (isConnected) { 11224 return (0, import_i18n4.__)("Edit"); 11225 } 11226 switch (pluginStatus) { 11227 case "checking": 11228 return (0, import_i18n4.__)("Checking\u2026"); 11229 case "not-installed": 11230 return (0, import_i18n4.__)("Install"); 11231 case "inactive": 11232 return (0, import_i18n4.__)("Activate"); 11233 case "active": 11234 return (0, import_i18n4.__)("Set up"); 11235 } 11236 }; 11237 const saveApiKey = async (apiKey) => { 11238 const previousApiKey = currentApiKey; 11239 try { 11240 const updatedRecord = await saveEntityRecord( 11241 "root", 11242 "site", 11243 { [settingName]: apiKey }, 11244 { throwOnError: true } 11245 ); 11246 const record = updatedRecord; 11247 const returnedKey = record?.[settingName]; 11248 if (apiKey && (returnedKey === previousApiKey || !returnedKey)) { 11249 throw new Error( 11250 "It was not possible to connect to the provider using this key." 11251 ); 11252 } 11253 setConnectedState(true); 11254 createSuccessNotice( 11255 (0, import_i18n4.sprintf)( 11256 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 11257 (0, import_i18n4.__)("%s connected successfully."), 11258 connectorName 11259 ), 11260 { 11261 id: "connector-connect-success", 11262 type: "snackbar" 11263 } 11264 ); 11265 } catch (error2) { 11266 console.error("Failed to save API key:", error2); 11267 throw error2; 11268 } 11269 }; 11270 const removeApiKey = async () => { 11271 try { 11272 await saveEntityRecord( 11273 "root", 11274 "site", 11275 { [settingName]: "" }, 11276 { throwOnError: true } 11277 ); 11278 setConnectedState(false); 11279 createSuccessNotice( 11280 (0, import_i18n4.sprintf)( 11281 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 11282 (0, import_i18n4.__)("%s disconnected."), 11283 connectorName 11284 ), 11285 { 11286 id: "connector-disconnect-success", 11287 type: "snackbar" 11288 } 11289 ); 11290 } catch (error2) { 11291 console.error("Failed to remove API key:", error2); 11292 createErrorNotice( 11293 (0, import_i18n4.sprintf)( 11294 /* translators: %s: Name of the connector (e.g. "OpenAI"). */ 11295 (0, import_i18n4.__)("Failed to disconnect %s."), 11296 connectorName 11297 ), 11298 { 11299 id: "connector-disconnect-error", 11300 type: "snackbar" 11301 } 11302 ); 11303 throw error2; 11304 } 11305 }; 11306 return { 11307 pluginStatus, 11308 canInstallPlugins, 11309 canActivatePlugins, 11310 isExpanded, 11311 setIsExpanded, 11312 isBusy, 11313 isConnected, 11314 currentApiKey, 11315 keySource, 11316 handleButtonClick, 11317 getButtonLabel, 11318 saveApiKey, 11319 removeApiKey 11320 }; 11321 } 11322 11323 // routes/connectors-home/logos.tsx 11324 var OpenAILogo = () => /* @__PURE__ */ React.createElement( 11325 "svg", 11326 { 11327 width: "40", 11328 height: "40", 11329 viewBox: "0 0 24 24", 11330 fill: "none", 11331 xmlns: "http://www.w3.org/2000/svg", 11332 "aria-hidden": "true" 11333 }, 11334 /* @__PURE__ */ React.createElement( 11335 "path", 11336 { 11337 d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364l2.0201-1.1685a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.4043-.6813zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z", 11338 fill: "currentColor" 11339 } 11340 ) 11341 ); 11342 var ClaudeLogo = () => /* @__PURE__ */ React.createElement( 11343 "svg", 11344 { 11345 width: "40", 11346 height: "40", 11347 viewBox: "0 0 32 32", 11348 fill: "none", 11349 xmlns: "http://www.w3.org/2000/svg", 11350 "aria-hidden": "true" 11351 }, 11352 /* @__PURE__ */ React.createElement( 11353 "path", 11354 { 11355 d: "M6.2 21.024L12.416 17.536L12.52 17.232L12.416 17.064H12.112L11.072 17L7.52 16.904L4.44 16.776L1.456 16.616L0.704 16.456L0 15.528L0.072 15.064L0.704 14.64L1.608 14.72L3.608 14.856L6.608 15.064L8.784 15.192L12.008 15.528H12.52L12.592 15.32L12.416 15.192L12.28 15.064L9.176 12.96L5.816 10.736L4.056 9.456L3.104 8.808L2.624 8.2L2.416 6.872L3.28 5.92L4.44 6L4.736 6.08L5.912 6.984L8.424 8.928L11.704 11.344L12.184 11.744L12.376 11.608L12.4 11.512L12.184 11.152L10.4 7.928L8.496 4.648L7.648 3.288L7.424 2.472C7.344 2.136 7.288 1.856 7.288 1.512L8.272 0.176L8.816 0L10.128 0.176L10.68 0.656L11.496 2.52L12.816 5.456L14.864 9.448L15.464 10.632L15.784 11.728L15.904 12.064H16.112V11.872L16.28 9.624L16.592 6.864L16.896 3.312L17 2.312L17.496 1.112L18.48 0.464L19.248 0.832L19.88 1.736L19.792 2.32L19.416 4.76L18.68 8.584L18.2 11.144H18.48L18.8 10.824L20.096 9.104L22.272 6.384L23.232 5.304L24.352 4.112L25.072 3.544H26.432L27.432 5.032L26.984 6.568L25.584 8.344L24.424 9.848L22.76 12.088L21.72 13.88L21.816 14.024L22.064 14L25.824 13.2L27.856 12.832L30.28 12.416L31.376 12.928L31.496 13.448L31.064 14.512L28.472 15.152L25.432 15.76L20.904 16.832L20.848 16.872L20.912 16.952L22.952 17.144L23.824 17.192H25.96L29.936 17.488L30.976 18.176L31.6 19.016L31.496 19.656L29.896 20.472L27.736 19.96L22.696 18.76L20.968 18.328H20.728V18.472L22.168 19.88L24.808 22.264L28.112 25.336L28.28 26.096L27.856 26.696L27.408 26.632L24.504 24.448L23.384 23.464L20.848 21.328H20.68V21.552L21.264 22.408L24.352 27.048L24.512 28.472L24.288 28.936L23.488 29.216L22.608 29.056L20.8 26.52L18.936 23.664L17.432 21.104L17.248 21.208L16.36 30.768L15.944 31.256L14.984 31.624L14.184 31.016L13.76 30.032L14.184 28.088L14.696 25.552L15.112 23.536L15.488 21.032L15.712 20.2L15.696 20.144L15.512 20.168L13.624 22.76L10.752 26.64L8.48 29.072L7.936 29.288L6.992 28.8L7.08 27.928L7.608 27.152L10.752 23.152L12.648 20.672L13.872 19.24L13.864 19.032H13.792L5.44 24.456L3.952 24.648L3.312 24.048L3.392 23.064L3.696 22.744L6.208 21.016L6.2 21.024Z", 11356 fill: "#D97757" 11357 } 11358 ) 11359 ); 11360 var DefaultConnectorLogo = () => /* @__PURE__ */ React.createElement( 11361 "svg", 11362 { 11363 width: "40", 11364 height: "40", 11365 viewBox: "0 0 32 32", 11366 fill: "none", 11367 xmlns: "http://www.w3.org/2000/svg", 11368 "aria-hidden": "true" 11369 }, 11370 /* @__PURE__ */ React.createElement( 11371 "path", 11372 { 11373 d: "M0 4C0 1.79086 1.79086 0 4 0H28C30.2091 0 32 1.79086 32 4V28C32 30.2091 30.2091 32 28 32H4C1.79086 32 0 30.2091 0 28V4Z", 11374 fill: "#F0F0F0" 11375 } 11376 ), 11377 /* @__PURE__ */ React.createElement( 11378 "path", 11379 { 11380 d: "M14.5 8V12H17.5V8H19V12H20.5C20.7652 12 21.0196 12.1054 21.2071 12.2929C21.3946 12.4804 21.5 12.7348 21.5 13V17L18.5 21V23C18.5 23.2652 18.3946 23.5196 18.2071 23.7071C18.0196 23.8946 17.7652 24 17.5 24H14.5C14.2348 24 13.9804 23.8946 13.7929 23.7071C13.6054 23.5196 13.5 23.2652 13.5 23V21L10.5 17V13C10.5 12.7348 10.6054 12.4804 10.7929 12.2929C10.9804 12.1054 11.2348 12 11.5 12H13V8H14.5ZM15 20.5V22.5H17V20.5L20 16.5V13.5H12V16.5L15 20.5Z", 11381 fill: "#949494" 11382 } 11383 ) 11384 ); 11385 var AkismetLogo = () => /* @__PURE__ */ React.createElement( 11386 "svg", 11387 { 11388 width: "40", 11389 height: "40", 11390 viewBox: "0 0 44 44", 11391 fill: "none", 11392 xmlns: "http://www.w3.org/2000/svg", 11393 "aria-hidden": "true" 11394 }, 11395 /* @__PURE__ */ React.createElement("rect", { width: "44", height: "44", fill: "#357B49", rx: "6" }), 11396 /* @__PURE__ */ React.createElement( 11397 "path", 11398 { 11399 fill: "#fff", 11400 fillRule: "evenodd", 11401 d: "m29.746 28.31-6.392-16.797c-.152-.397-.305-.672-.789-.675-.673 0-1.408.611-1.746 1.316l-7.378 16.154c-.072.16-.143.311-.214.454-.5.995-1.045 1.546-2.357 1.626a.399.399 0 0 0-.16.033l-.01.004a.399.399 0 0 0-.23.392v.01c0 .054.01.106.03.155l.004.01a.416.416 0 0 0 .394.252h6.212a.417.417 0 0 0 .307-.12.416.416 0 0 0 .124-.305.398.398 0 0 0-.105-.302.399.399 0 0 0-.294-.127c-.757 0-2.197-.062-2.197-1.164.02-.318.103-.63.245-.916l1.399-3.152c.52-1.163 1.654-1.163 2.572-1.163h5.843c.023 0 .044 0 .062.003.13.014.16.081.214.242l1.534 4.07a2.857 2.857 0 0 1 .216 1.04c0 .054-.003.104-.01.153-.09.726-.831.887-1.49.887a.4.4 0 0 0-.294.127l-.007.008-.007.008a.401.401 0 0 0-.092.286v.01c0 .054.01.106.03.155l.005.01a.42.42 0 0 0 .395.252h7.011a.413.413 0 0 0 .279-.13.412.412 0 0 0 .11-.297.387.387 0 0 0-.09-.294.388.388 0 0 0-.277-.135c-1.448-.122-2.295-.643-2.847-2.08Zm-11.985-5.844 2.847-6.304c.361-.728.659-1.486.889-2.265 0-.06.03-.092.06-.092s.061.032.061.091c.02.122.045.247.073.374.197.888.584 1.878.914 2.723l.176.453 1.684 4.529a.927.927 0 0 1 .092.4.473.473 0 0 1-.009.094c-.041.202-.228.272-.602.272h-6.063c-.122 0-.184-.03-.184-.092a.36.36 0 0 1 .062-.183Zm17.107-.721c0 .786-.446 1.231-1.25 1.231-.806 0-1.125-.409-1.125-1.034 0-.786.465-1.231 1.25-1.231.785 0 1.125.427 1.125 1.034ZM9.629 23.002c.803 0 1.25-.447 1.25-1.231 0-.607-.343-1.036-1.128-1.036-.785 0-1.25.447-1.25 1.231 0 .625.325 1.036 1.128 1.036Z", 11402 clipRule: "evenodd" 11403 } 11404 ) 11405 ); 11406 var GeminiLogo = () => /* @__PURE__ */ React.createElement( 11407 "svg", 11408 { 11409 width: "40", 11410 height: "40", 11411 style: { flex: "none", lineHeight: 1 }, 11412 viewBox: "0 0 24 24", 11413 xmlns: "http://www.w3.org/2000/svg", 11414 "aria-hidden": "true" 11415 }, 11416 /* @__PURE__ */ React.createElement( 11417 "path", 11418 { 11419 d: "M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z", 11420 fill: "#3186FF" 11421 } 11422 ), 11423 /* @__PURE__ */ React.createElement( 11424 "path", 11425 { 11426 d: "M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z", 11427 fill: "url(#lobe-icons-gemini-fill-0)" 11428 } 11429 ), 11430 /* @__PURE__ */ React.createElement( 11431 "path", 11432 { 11433 d: "M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z", 11434 fill: "url(#lobe-icons-gemini-fill-1)" 11435 } 11436 ), 11437 /* @__PURE__ */ React.createElement( 11438 "path", 11439 { 11440 d: "M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z", 11441 fill: "url(#lobe-icons-gemini-fill-2)" 11442 } 11443 ), 11444 /* @__PURE__ */ React.createElement("defs", null, /* @__PURE__ */ React.createElement( 11445 "linearGradient", 11446 { 11447 gradientUnits: "userSpaceOnUse", 11448 id: "lobe-icons-gemini-fill-0", 11449 x1: "7", 11450 x2: "11", 11451 y1: "15.5", 11452 y2: "12" 11453 }, 11454 /* @__PURE__ */ React.createElement("stop", { stopColor: "#08B962" }), 11455 /* @__PURE__ */ React.createElement("stop", { offset: "1", stopColor: "#08B962", stopOpacity: "0" }) 11456 ), /* @__PURE__ */ React.createElement( 11457 "linearGradient", 11458 { 11459 gradientUnits: "userSpaceOnUse", 11460 id: "lobe-icons-gemini-fill-1", 11461 x1: "8", 11462 x2: "11.5", 11463 y1: "5.5", 11464 y2: "11" 11465 }, 11466 /* @__PURE__ */ React.createElement("stop", { stopColor: "#F94543" }), 11467 /* @__PURE__ */ React.createElement("stop", { offset: "1", stopColor: "#F94543", stopOpacity: "0" }) 11468 ), /* @__PURE__ */ React.createElement( 11469 "linearGradient", 11470 { 11471 gradientUnits: "userSpaceOnUse", 11472 id: "lobe-icons-gemini-fill-2", 11473 x1: "3.5", 11474 x2: "17.5", 11475 y1: "13.5", 11476 y2: "12" 11477 }, 11478 /* @__PURE__ */ React.createElement("stop", { stopColor: "#FABC12" }), 11479 /* @__PURE__ */ React.createElement("stop", { offset: ".46", stopColor: "#FABC12", stopOpacity: "0" }) 11480 )) 11481 ); 11482 11483 // routes/connectors-home/default-connectors.tsx 11484 var { store: connectorsStore } = unlock2(connectorsPrivateApis); 11485 function getConnectorScriptModuleData() { 11486 try { 11487 return JSON.parse( 11488 document.getElementById( 11489 "wp-script-module-data-options-connectors-wp-admin" 11490 )?.textContent ?? "{}" 11491 ); 11492 } catch { 11493 return {}; 11494 } 11495 } 11496 function getConnectorData() { 11497 return getConnectorScriptModuleData().connectors ?? {}; 11498 } 11499 function getIsFileModDisabled() { 11500 return !!getConnectorScriptModuleData().isFileModDisabled; 11501 } 11502 var CONNECTOR_LOGOS = { 11503 google: GeminiLogo, 11504 openai: OpenAILogo, 11505 anthropic: ClaudeLogo, 11506 akismet: AkismetLogo 11507 }; 11508 function getConnectorLogo(connectorId, logoUrl) { 11509 if (logoUrl) { 11510 return /* @__PURE__ */ React.createElement("img", { src: logoUrl, alt: "", width: 40, height: 40 }); 11511 } 11512 const Logo = CONNECTOR_LOGOS[connectorId]; 11513 if (Logo) { 11514 return /* @__PURE__ */ React.createElement(Logo, null); 11515 } 11516 return /* @__PURE__ */ React.createElement(DefaultConnectorLogo, null); 11517 } 11518 var ConnectedBadge = () => /* @__PURE__ */ React.createElement( 11519 "span", 11520 { 11521 style: { 11522 color: "#345b37", 11523 backgroundColor: "#eff8f0", 11524 padding: "4px 12px", 11525 borderRadius: "2px", 11526 fontSize: "13px", 11527 fontWeight: 500, 11528 whiteSpace: "nowrap" 11529 } 11530 }, 11531 (0, import_i18n5.__)("Connected") 11532 ); 11533 var PluginDirectoryLink = ({ slug }) => /* @__PURE__ */ React.createElement( 11534 Link, 11535 { 11536 href: (0, import_i18n5.sprintf)( 11537 /* translators: %s: plugin slug. */ 11538 (0, import_i18n5.__)("https://wordpress.org/plugins/%s/"), 11539 slug 11540 ), 11541 openInNewTab: true 11542 }, 11543 (0, import_i18n5.__)("Learn more") 11544 ); 11545 var UnavailableActionBadge = () => /* @__PURE__ */ React.createElement(Badge, null, (0, import_i18n5.__)("Not available")); 11546 function ApiKeyConnector({ 11547 name, 11548 description, 11549 logo, 11550 authentication, 11551 plugin 11552 }) { 11553 const auth = authentication?.method === "api_key" ? authentication : void 0; 11554 const settingName = auth?.settingName ?? ""; 11555 const helpUrl = auth?.credentialsUrl ?? void 0; 11556 const pluginFile = plugin?.file?.replace(/\.php$/, ""); 11557 const pluginSlug = pluginFile?.includes("/") ? pluginFile.split("/")[0] : pluginFile; 11558 let helpLabel; 11559 try { 11560 if (helpUrl) { 11561 helpLabel = new URL(helpUrl).hostname; 11562 } 11563 } catch { 11564 } 11565 const { 11566 pluginStatus, 11567 canInstallPlugins, 11568 canActivatePlugins, 11569 isExpanded, 11570 setIsExpanded, 11571 isBusy, 11572 isConnected, 11573 currentApiKey, 11574 keySource, 11575 handleButtonClick, 11576 getButtonLabel, 11577 saveApiKey, 11578 removeApiKey 11579 } = useConnectorPlugin({ 11580 file: plugin?.file, 11581 settingName, 11582 connectorName: name, 11583 isInstalled: plugin?.isInstalled, 11584 isActivated: plugin?.isActivated, 11585 keySource: auth?.keySource, 11586 initialIsConnected: auth?.isConnected 11587 }); 11588 const isExternallyConfigured = keySource === "env" || keySource === "constant"; 11589 const showUnavailableBadge = pluginStatus === "not-installed" && canInstallPlugins === false || pluginStatus === "inactive" && canActivatePlugins === false; 11590 const showActionButton = !showUnavailableBadge; 11591 const actionButtonRef = (0, import_element32.useRef)(null); 11592 return /* @__PURE__ */ React.createElement( 11593 ConnectorItem, 11594 { 11595 className: pluginSlug ? `connector-item--$pluginSlug}` : void 0, 11596 logo, 11597 name, 11598 description, 11599 actionArea: /* @__PURE__ */ React.createElement(import_components2.__experimentalHStack, { spacing: 3, expanded: false }, isConnected && /* @__PURE__ */ React.createElement(ConnectedBadge, null), showUnavailableBadge && (pluginSlug ? /* @__PURE__ */ React.createElement(PluginDirectoryLink, { slug: pluginSlug }) : /* @__PURE__ */ React.createElement(UnavailableActionBadge, null)), showActionButton && /* @__PURE__ */ React.createElement( 11600 import_components2.Button, 11601 { 11602 ref: actionButtonRef, 11603 variant: isExpanded || isConnected ? "tertiary" : "secondary", 11604 size: "compact", 11605 onClick: handleButtonClick, 11606 disabled: pluginStatus === "checking" || isBusy, 11607 isBusy, 11608 accessibleWhenDisabled: true 11609 }, 11610 getButtonLabel() 11611 )) 11612 }, 11613 isExpanded && pluginStatus === "active" && /* @__PURE__ */ React.createElement( 11614 DefaultConnectorSettings, 11615 { 11616 key: isConnected ? "connected" : "setup", 11617 initialValue: isExternallyConfigured ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : currentApiKey, 11618 helpUrl, 11619 helpLabel, 11620 readOnly: isConnected || isExternallyConfigured, 11621 keySource, 11622 onRemove: isExternallyConfigured ? void 0 : async () => { 11623 await removeApiKey(); 11624 actionButtonRef.current?.focus(); 11625 }, 11626 onSave: async (apiKey) => { 11627 await saveApiKey(apiKey); 11628 setIsExpanded(false); 11629 actionButtonRef.current?.focus(); 11630 } 11631 } 11632 ) 11633 ); 11634 } 11635 function registerDefaultConnectors() { 11636 const connectors = getConnectorData(); 11637 const sanitize = (s) => s.replace(/[^a-z0-9-_]/gi, "-"); 11638 for (const [connectorId, data] of Object.entries(connectors)) { 11639 if (connectorId === "akismet" && !data.plugin?.isInstalled) { 11640 continue; 11641 } 11642 const { authentication } = data; 11643 const connectorName = sanitize(connectorId); 11644 const args = { 11645 name: data.name, 11646 description: data.description, 11647 type: data.type, 11648 logo: getConnectorLogo(connectorId, data.logoUrl), 11649 authentication, 11650 plugin: data.plugin 11651 }; 11652 const existing = unlock2((0, import_data2.select)(connectorsStore)).getConnector( 11653 connectorName 11654 ); 11655 if (authentication.method === "api_key" && !existing?.render) { 11656 args.render = ApiKeyConnector; 11657 } 11658 registerConnector(connectorName, args); 11659 } 11660 } 11661 11662 // routes/connectors-home/wp-logo-decoration.tsx 11663 function WpLogoDecoration() { 11664 return /* @__PURE__ */ React.createElement("div", { className: "ai-plugin-callout__decoration", "aria-hidden": "true" }, /* @__PURE__ */ React.createElement( 11665 "svg", 11666 { 11667 viewBox: "0 0 248 248", 11668 xmlns: "http://www.w3.org/2000/svg", 11669 xmlnsXlink: "http://www.w3.org/1999/xlink", 11670 focusable: "false", 11671 style: { width: "100%", height: "100%" } 11672 }, 11673 /* @__PURE__ */ React.createElement( 11674 "image", 11675 { 11676 href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAQAElEQVR4AezdC3ojWW5tYflOzPbIbI/M9sh8+WdrdZ+KpiiKL5FB5KedwN7AeSFIpHRYmfX/PubXVGAqMBV4kQpMw3qRBzXbnApMBT4+pmHNq2AqMBV4mQpMw3qZR3X9RmeGqcCrV2Aa1qs/wdn/VOCNKjAN640e9hx1KvDqFZiG9epPcPY/FThWgZ1q07B2+mDnWFOBPVZgGtYen+qcaSqw0wpMw9rpg51jTQX2WIFpWMee6mhTganAU1ZgGtZTPpbZ1FRgKnCsAtOwjlVltKnAVOApKzAN6ykfy2zqcRWYlV6pAtOwXulpzV6nAm9egWlYb/4CmONPBV6pAtOwXulpve9e//Nw9P/7xL8d7Hy9aQWubFhvWrU59qMr8D+HBcPBna93rcA0rHd98q91bs3q3w9bBv7Bna93rMA0rHd86nPmqcCLVmAa1os+uF/Y9m8u6Q7rvw8bgLnDOhTiXb+mYb3rk3+tc//rYbsaVTjQP18amct4+h9hftt3BaZh7fv57v107rNg7+ec831WYBrWZyHGPHUF/vewu//6xNqg+HMRfyjMrb+edb5pWM/6ZGZfawX86Bc0qTU2/htVYBrWGz3sOepU4NUrMA3r1Z/g7H8q8EYVmIZ1h4c9U04FpgL3qcA0rPvUdWadCkwF7lCBaVh3KOpMORWYCtynAtOw7lPXmfVdKjDnfGgFpmE9tNyz2FRgKnBNBaZhXVO9GTsVmAo8tALTsB5a7llsKjAVuKYCv9uwrtn5jJ0KTAXergLTsN7ukc+BpwKvW4FpWK/77GbnU4G3q8A0rLd75L914Fl3KnB9BaZhXV/DmWEqMBV4UAWmYT2o0LPMVGAqcH0FpmFdX8OZYSowFfhrBe7GpmHdrbQz8VRgKnDrCkzDunVFZ76pwFTgbhWYhnW30s7EU4GpwK0rMA3r1hW9fr6ZYSowFfiiAtOwvijMyFOBqcDzVWAa1vM9k9nRVGAq8EUFpmF9UZiRpwKPqMCs8bMKTMP6Wb0meyowFfjFCkzD+sXiz9JTganAzyowDetn9ZrsqcBU4Bcr8NIN6xfrNktPBaYCv1CBaVi/UPRZciowFbisAtOwLqvbjJoKTAV+oQLTsH6h6LPkBRWYIVOBQwWmYR2KMF9TganAa1RgGtZrPKfZ5VRgKnCowDSsQxHmayowFXimCny9l2lYX9dmIlOBqcCTVWAa1pM9kNnOVGAq8HUFpmF9XZuJTAWmAk9WgWlYT/ZArt/OzDAV2G8FpmHt99nOyaYCu6vANKzdPdK7HOjfDrP+9yf4B/fP138efoeDma+pwP0rMA3r/jXewwqaVFjP8x8HAmIHd74eXIG3W24a1ts98pse+H8Os8HBzNdU4P4VmIZ1/xrvYQU/9v3L4SCwNqh/P2iwagdpvqYC96nANKz71HVmnQpMBe5QgXduWHco526n9B3W9tJ91fi7Pfwc7HkqMA3reZ7FM+/kXw+bc7EeDvTPV1z8jzC/TQXuWYFpWPes7sw9FZgK3LQC07BuWs7dTva/h5P91ye6YGfT2EP4eb9mZ/uowDSsfTzHe5/CHVXQqKzHbjX6YCpwtwpMw7pbaX808f8dsoN7oQOdr6nAVGBbgWlY24o8hvvEzXcnp1YTl3cq51ExTdRe7GldE6ev2vhTgbtV4KyGdbfV33diDeC7T9bE5T1LlezFntb94PRVG38qcLcKTMO6W2lPTuy/GPdfiJfED+6G6Lg8/m/Dnuxne7lOe5Y9/naNZv0HVGAa1gOKfMYSGkI4I/1XUp59f79SlFn0sRWYhvXYereaex/3PyunQT9iiePlPMbOKlOBJ67ANKzfeTiakvufVsdDmjgtPnYq8PYVmIb1Oy8B9z7uf06tLi7vVM7EpgJvVYFpWM/xuF1mB3dFz7Gr2cXOK/B6x5uG9RzPzH1VeI4dzS6mAk9YgWlYT/hQZktTganA8QpMwzpel1GnAlOBJ6zANKyLH8oMnApMBR5dgWlYj674rDcVmApcXIFpWBeXbgZOBaYCj67ANKxHV3zWe8UKzJ6fpALTsJ7kQcw2pgJTge8rMA3r+xpNxlRgKvAkFZiG9SQPYrYxFZgKfF+BRzSs73cxGVOBqcBU4IwKTMM6o0iTMhWYCjxHBaZhPcdzmF1MBaYCZ1RgGtYZRXrSFP9Wln/gD/htEwd/mTqNT4Nyj2ny+7/3sDgYh4NxNBYHcdrH4Tc8HOifL/E044hsmjgN0tj2Ko6DcfLE8EADcfmAg1w64IMXrcA0rNd5cN6Y3njrjnE4pvkHANP58iCNxQO+B3x11v84HA6c9+DO1ytWYBrW6zw1/6Df/FtZlz8vtYPLZ5iRv16BaVi//gjO3sD2zYb7F0mB30Q4aHBpfBqU68cjHPjl4iHNPy5oDljH4yBeLh7SxNN+Mr7cY+PFmpNtLf52/2suv9yx11TgF8ZOw/qFor/gkt7kKzrCJZox9xzf3GN3WIFpWK/xUN27hHbsuyIXyyBGZ/FAgzgrh7aO59PE5AQaiKfJ2WriNCiPPZabxsqBa8ebw9rAD9agmX+r0QcvVoFpWK/xwLzxvOFcGq87pof0OHtKE5MDLqpxwAMO4mksDfggjgMecBBPY2lsEKdBGouDOB5oEGdx4Ac8pLFpY1+sAtOwfuuBXb+uN/H1s9x2hm0zWH/8u+1KM9tbVmAa1ms8dj/SuEh2odyOXUSHtTGksadyjZETjuWm/e/BKc+4A/1g09iPw69j2kH+OHe8XHMF89GOjaeXx+LAD41nt5rcwYtVYBrWiz2wZbvehBoZ8IVYPNAgzuKw5vK32prLD8dy08xRHosDP5TLbrVtLg7lscbRWDzQIM7isObyaYMXrMA0rBd8aN9s2Y9lodQ4m/ZK1r7Duu80Np0f0n7ZzvK3qsA0rFtV8vHzeFP6r9+Bbwesy/lAgzgrh8YaC+t3I3SclRdoEGflbDU6TYwfaBBn5Ww1fN2nPB820ECcZiweaLDmyqGBcSunDV6sAtOwXuyBPWC73tTe9NulaNuLfhqsuY1nV13eOeONMRb4t4Q93HK+mevBFZiG9eCC33i5ay+S3efAui3fibjc3+o06625OH3VjKOZZ9V9aCB/1XC5q2YczTyrfq7vgt5YWMc076qN/2IVeIGG9WIVfdx2vSG9CaFVaRpDSI+zcuisxgDrHMXYFfLhO018m0eDrY6D2AoapNmjvUN7FcdDueLyQU762B1UYBrWDh7iHGEq8C4VmIa1vyfdJbTvNDqdi/Ww3g3JgfKe1TpT+2+/zpHGtne6HEgbu5MKTMPayYNcjuENC9sL7iXl765LaPi78MvOLZZ3dmc65/y3WG/meGAFpmE9sNhPuJQ7HhffT7i1i7fkTODy/eJJZuBzVmAa1nM+l2t21SW0S+fm4Qdv5lV/hR+dNNXt/p0jje1M6a9wrvY89swKTMM6s1AvnuZNHF7xKO092xnibNrYF6nAJduchnVJ1Z57jO8sQjt1aR3c8aS/inWe7f6dI43tLPSQNnYnFZiGtZMHuRzDhTOsl869gdkl9cOna7Bqz+g7i72H9hhnV00DU4O0sTupwDSsnTzIOcZU4B0qMA3rRZ/yiW27gAYX1aXxw3rf0wV9ec9qfeJ3bP9pbHv346NzqUHa2J1UYBrWTh7kcgwNKSR7E4e0V7LtnXU2e2fxQBvsvALTsHb+gD+P544nfEovZdo7u24cD6s+/k4rMA1rfw/WJTq4eO50/OANvtXjz2pdoLd/31HZp3OksTQQx1n89TEn+HsFpmH9vRRv6XjTw94O70w+Wdzbud7+PNOw9vcScLcDLqq/O52Lafgu75Xizu5M60X8K+1/9nqiAtOwThTnRUPerLD+SORTs+AN3dH4EH9W6zztv3PZdxrb3ukhbexOKrD/hrWTBzXHmApMBT4+pmHt71Xgwhn6TsQJXcIH9zs04AP/meE87b9z2Xca2/7pciBt7E4qMA1rJw9yOYY3LJxz6awRwDL85V1n96niOed/+cO+2wGmYb3bE//reXd21/PncJ3pnA8d/gyY316nAtOwXudZnbvTfzkkgovqg/vnix+8of+Ih9/SDu5Tf/nEr722fzaN7QDp8yNhFdmRnYa1o4d54ijexOFE2tOG2nu2jcbZtLE7rsA0rP09XN9ZhE7nniq440l/Fes82/07Rxr7KmeZfV5RgaVhXTHLDH2mCrhwhvXS2Zs7rHutEazaM/rO0v7Z9sgPac7kU8NpYlVkR3Ya1o4e5hzlLxWYS/e/lGMfZBrWPp7jeoouqNl0fljve3w3sl5Yl/9sVvM5tv80tj07kw8d2LSxO6nANKydPMjlGN6omhIk0wLt1dDe2c7F4uHVzjT7vaAC07AuKNoLDumeh33B7X/Yd/hYfqWxizzuXiswDWt/T9aFM6yXzvywvrnTnr0KPkRor76jsl/nSGNpII6z+GBHFZiGtaOHecFRvOnhgqFPPcSZfLL41Jt81Ob2tM40rD09zb+dxd0OuKj+m/L17y7c4euM14v4zsqZ1ov41zvF7PhoBaZhHS3LS4verOCN20F8ahY0s3Q+xJ/VOk/771z2ncauexeDVRt/BxWYhrWDhzhHmAq8SwWmYX3zpF8w7MIZ+k7EEVzCB/c7NOAD/5nhPO2/c9l3Gtv+6XIgbexOKjANaycPcjmGNyycc+msEcAy/OVdZ/ep4jnnf/nDvtsBpmG92xP/63nd88Bf1ddmzgPnfOjw2id9w91Pw9rfQ3cBDS6qOx0/eDNv9fizWp/4bffvHGlse0//+Y+EzTD2aSswDetpH81NN+ZNHG468YMma+/Zlo2zaWN3XIFpWPt7uL6zCJ0uzrrjSX+Utaa1gW9dFg+0r7Dm8strLJs2dscVmIa1v4frwhnWS2c8rCf26Rqs2j381mZrOCwO617pPghg24uckM6mseVqXs5kjrSxO6nA7RrWTgoyx3iaCmhIT7OZ2chzVGAa1nM8h1vuwgV1aN44u973uJyH8u5lfWJnbWh9Fg+tTXeJ7jultGPjxRrL4mCcM5kDH+yoAtOwdvQwP4/iDQve+J/SBx4+fuFXa7Pti8WBf2pbckK5bBp7avzEdlKBaVg7eZDfHMOPV+Gb1HPCP85pbbbB/BXpx+xXeV/px+YYbQcVmIa1g4e4OYILZ1gvnfnBm7wh8mDVil1jfcezzulSvPXFzC2eJk4DcTqLgzgN0tfxdHkgjrP4YEcVmIa1o4f5w6N4w/9wyFnp5tVgzkr+Iskc6yeHX6R9KV87/suJJ/C7FZiG9bv1v8fq7nbARfWp+eW4rIZTeT+NmdeFN/vTsfKNsyfAf4prx/90vb3nP9X5pmE91eO4yWY0C1h/JPKpWfCGbiE5sGrFrrHb+eyn9a1nbjZNnAbGirE4iJcrRhNPY2lAl8Pigx1VYBrWjh7mHGUqsPcKTMPa3xN24Qy+y+h0LtaD+x06Kwfwe8Ia9gTWtRaLgzjtK8hpoPtu7gAAEABJREFU/+Uan8Y2li4H0sbupALTsO77IH9jdm9YOOfS2uU4yL/3Xq0B6zo4nLPXddwp33zOdMs5T603sQdWYBrWA4s9Sz2kAu6u4LsPHR6ymVnkthWYhnXbej7DbC6gwUV1++EHb2Y6Kw/4tHvBj2fWgdZi29N3nwiKl2ucfbJpLA3SrYkPdlSBaVg7epgnjuJNHE6kPTzUnthTi4uvKPeYVuzhdha8fwWmYd2/xo9ewR0OrN9h8INYe+JD/FmtPR7bfxr7rHuffd2wAtOwbljMJ5nKJ2qwXjq7hA5tUxOQB/z0Z7TtnW2vLB7at+blU0PnShu7kwpMw9rJg5xjTAXeoQJP07DeodgPOqML6tCSx+56aC6rgV/uM1qf+NkjrPvDQ7rvsJxJDdLG7qQC07B28iCXY3jDgjdysjdwWHU+lPes1nnaP98+7TuNpQUxiI/dSQWmYe3kQX5zDPc94ZvUpwy3d3bdIB5WffydVmAa1v4erAtnWC+d+cEb3KlZecCnPQY/X8XFevvvOyx7TmObVRxn08bupALTsHbyIOcYf6mAZrZ+SvqX4JDXrcA0rNd9dl/t3N0NuKj+Kocux8U04HvBXs+1l+dz1TmmYV1Vvqcc7AIa1h+J/JWY4A3dxuXAqhV7Jus87d9+7c2e01ga0OWw+OBXK3Dbxadh3baeM9tUYCpwxwpMw7pjcR8wtbsaaCm+S/SQHmflpL+K9R2Ti3Ro/6zzhM4iJ8hJH7uDCkzDeu2H2Bvz0lNoBHDp+EeO03zCqXXLYU/lTewFKzAN66kf2rebc08D3yZ+kaBZXTP+i2lHngrcpwLTsO5T10fN6jIaWk/zwUN6nJWTzm457dmgsdo7tF8WD+05zspJH7uDCkzD2sFD3BzBmzQUirNpr2btPbT3OHtKKzb2xSswDet1H6A7Gt95AL+T4CFNPKTtwXZOtvPwgzNv9VUr9gx29nBGBaZhnVGkJ03xxvNXVoBvmyweaEC/9oLePM8EZ+qc63/Vnsa2Xw0MB+PSx75YBaZhvdgDm+1OBd65AtOwXvfpu7cJ6ynS2HTfYbiEhrQ9WH+tKHQe515Bx8vj0wYvWIG9NKwXLP3VW/bG04BAQzLhqtFpQQzir26dxbmB33mcO6SJywN++tgXq8A0rBd7YMt23cWERf5IYz/u+Mv8K1rqmFbsEfbY+se0R+xl1rhxBaZh3bigd5rOhfn2r6B4E9LBdw6WXjU67RZo3tYxZ5p1XGbTAA84GNf+jaMBH/iXwFhzs41vbTadxUF+uXScTRv7xBWYhvXED+fJtuZNvX4ad4vtmVMT+dFcS7Lxa7NcQme5144/a5FJul0FpmHdrpb3nMm/beXuBe65zqm5u7Q+lXMqZu+w5vjuZv2nYdbYOb753Fex5+Rvc6x/zfjtfMPvXIFpWHcu8I2m743lzdWUNG924NO9cfFAuwXMaw22+fDWWfeVxq65cmCdo/il1lywjrduKLbulb/ml7Nq4z9pBaZhPemDmW1NBaYCHx8fmyJMw9oU5AmoexXfBbBtpwtrNl2O+x9IK/8aay5Y57CGtcG6YiwO4jTAAw7iacbRrEGHNPq1MJc5oblop9Zfcxsz9gkrMA3r+R6KS2Twhv5ud3JCubg3aPyn1nhvYPanY3+abw245WW+ucwJ3+1HTvgud+JPUIFpWE/wEDZb6IJ9I59N3cnA2QM2ica6YGc3oaFTgd+twDSs363/sdV9d+Rymi2OhxqJ+FYr/285sZ9ZY829jtLAtmvJSRMvP41NE8fB/HQWB3HaLWAuc0LzrXu1Lp2VE2iDJ6/ANKwnf0Cf2/PmCp/SH5PG/hHu9Jv5V7TMJZoxp8YXu9SaP6xzpLHp/JA29okrMA3r+R6O7wZCu4uz7lzS+RC/hbVGaD5rpPHpbBpLA37AYc3lbzX5tHvBmtYAfuvgIU08jZ8+9gkqMA3rdx+CNwS0C74L95AeZ9PkuhwHfvq11hqhueJsa7E4uOg+lntMM47OGgvrePqtz2RO6wB/uz6dBvyAvwjeY5vTsH73OXvzwLFd+FHlmH5P7au93HPNY3PbBxyLjfbGFZiG9bsPvx891l1oVODTwnQ8rFoXxmLp11qX1qG57MUakMYP4sf0NPFy0+Ks+Kr7L9XVJu1aa43OxG8+fkizl2O5xcf+YgWmYf1i8Y8s7c1TE1rfsGmsnIbyIX6tNZd1Q/Ph1gY+XS4OaXQ84CCexqd9NV7s1rCWdYFvfrY9sTSQE/DBE1VgGtafh/FUv/lRKLSxOJt2L2uN0Bpx9pj2lX4q15gV5T7SHlv/mPbIPc1aJyowDetEce4c8qf4uX9dxCV08IZqa3yIX2vN1Tps87mExsG+6WuuOA3kBBzE04yjsWniNDA/ncVvAWtVa745WesEGsRZOTTg33JP5hz8sALTsH5YsCdL9yaCJ9vWVdvxiaEzsVdNdOPBmirceNqZ7icVmIb1k2rdNtcdSrh0Zn/iw6Xjn3GcS291YW+5P3PCpXO6iF/vui6dZ8ZdUYFpWFcU78qh3jzeAFDTofmELLREnJWTfmtrbmuE5rfHtPbKpomXm8amieNgHJ3FQZwGdJzFbwHnMifwzclaO9AgzsqhAR/4g1+qwDSsXyr8LDsVmAr8vALTsH5es0tGuJPxHQM0nu9iF8TpLB5oEGfl0G453lzmNLc1Ag3E0+RsNXEalMfiII7DT8Yfy01jzResA3FWDu3Y+mJygjyIs3Jo63g+bfALFfhpw/qFLe5iSZe1sF4k870hQgeNs6c0MTkBhziLAz/gIc1etppYmjge0uPiW00sTRwP6XHxrSaWJo6H9Dh7ShOTE3CIszjwAx7S7CVt7IMrMA3rwQWf5aYCU4HLKzAN6/La/WSky16XuGzj+tSJ1mUui4dy46wcuh9NcEhj8SAP4qwc2jreXmhicgINxNPk0I6Np5fH4nDp+NY6Nl7MGsE6EGfl0Na9prFygjyIs3Jo63h7oQ1+oQLTsH6h6J9LejOs+JQ/ztU+Dr/OzT2Wdxj+cUz/u/bxj1+rxi/CD+dq8s/NPZZ3yXjzGBdwiLM48AMe0ti0sQ+uwDSsxxTcn9DBXYhV2a1GT2Nx4AfjaOxWo6exOPCDcTQ2jaUBP+Cw5vK3mnwa8AMOxqTxaZDG4sAP5bJbbZuLQ3mscTQWBz4N8IBDnC2XxYM8iLP44M4VmIZ15wJ/Tu/CPXxKH3HWG4LO4oEGcRaHNZe/1dZcfpAHxqR1kbxqYvKAH+TQ2LTG09NYOV9p3uRy4KvxxoKc0JxsGisP+AGHNZe/1eTTgB9wMCbtu73KH9ypAtOw7lTYN53WG/tNj/7ix36R7U/DesyDcu+xwqr+6kkaHtLYn2ryjQs4xFkc+MFeaJDG4iCOAw78IL7VitHFV06Ls+I0wAMO4luNnsbiwA84xFk84OFczV7KdQEf0sbesQLTsO5Y3GVqnziFZD8SpfHp3jxpLA34QQ6NTbv3ePOfWkvcnqA8FgdxHPi0Y/unywlyaMak8WliaSwN+EEOjU271XjzmivggztXYBrWnQv8Ob0flcKn9BHPfnz+irOf0gc/fCy/0thkfjiliZXH4sAPOMSzNIizOPADDvEsDeIsDvyAQzxLgziLAz/gIY39qSbfuIBDnMUHd67ANKxbFPgfc3jh9u8u+ZO3iL/mEeTQXeJuNbE0Vh7wgxya+beaWBorD/hBDm0dby80sfJYGojjIId2bDxdTsDh0vGtdWy8WOuw1gF+kENb95rGlsfKA36QQ1vH2wtNrDyWFsTyx96wAtOwbljMmWoq8FkBDUyT+6RjblWBaVi3quQ/5nFfEv6hjvdOFfC3GrwG3unMDznrNKzbltmLtMtdfrN7AYd0eWn9aSyWxp4ab4wc4Mu9dLy9nBovbh1oLRYHceMBDziIpxlHY9PEaZDGOg9NHAfjaGJ4oEGclUMzBgc+TQwPNIizcmjG4P/y8fFhLzSxNJa2Qnzl49+gAtOwblDEmWIqMBV4TAWmYV1XZ5er0Cz+JHZ/Afx0PJQvvtXE0thHjbcXa321vrj9gBy5q8angZyAg3jaT8Yfy01jm5O1DvCDHNqx9cXKY+UBP8ihreP5NLHyWBqI4yCHNrhRBaZhXV5IL0Yvyj41aiY6rH+FAw/liaex6fxwShMrj8WBH3CIs3jAwV62Gj1NHA/pcfGtJpYmjof0uPhWE0sTx0N6nD2lickJOMRZHPgBD2n2stXE0sRxSBt7owo8uGHdaNfPM417ivW/fH6enc1OpgI7rMA0rMsfqmblAtaPAM1C669qsOn8IIeu0W01epq5cUhjG8/iwJcHOPxkvHxjgR9wOLZXa5bHygN+wOHS8db4ajy9dVgc+KHx7Fbb5uJQHmscjcUDDeIsDny1B+NogxtVYBrWjQr5OY0XqAYG/E/5Aw8fn7/ibLksDvzP1A88fHz+Ek/jk9mtRk9jcTiWu2prLj/I+Wo8vTwWB364x3hzWwf4AQdrpvG3mhgN+AEHY9L4W02MBuIBH9ywAtOwLi+mOwovVOCbicUDDeKsHBqLA58GeMAhzpbL4sCXB3jAIc6Wy+JBHsRZHNZc/lZbc/kA8sAYHPhbjU4DfjiWm7bNxaGxbLksDnx5gAcc4my5LB7kQZzFYc3lb7U1V2zwgwpMw/pBsTapLtvD+sJMc/nakDT2mHZs/Fe5jTdGDvDpLB5oEGdxWHPb66qtufwg56vx9PJYHPjhHuPNbR3gBxysmcbfamI04AccjEm7Za3MPfhBBaZh/aBYkzoVmAr8bgWmYV1efxfJ27uKOCve7HhIE99qYmksDvyAQ5zFAx7O1ezlVK74qTnFHz3eeu2JxYEfcIizeMDDudotz9qaL28fdYBpWJdX2l2ET4KAbyYvfhzS6HiQQxNP49PE0lga8IMcGpt27/HmP7WWuD1BeSwO4jjwacf2T5cT5NCMSePTxNJYGvCDHBqbdu/x5j+1lrg9DS6owDSsC4r2OcS9xopP+eMSzZiPz1/88Cl9xNmP5RcekuPsKU1MTsAhzuLAX0GDSzRjjAV+wCHO4sBfQYNztZ/kHpvz0vHmMhb4AR9cUIFpWOcVzZ+K/qt2thEuYWnghUgXx0GcBngoV3yriaWxxgI/yKGta6Wx5bHygB/k0Nbx9kITK4+lgTgOcmjHxtPlBBwuHd9ax8aLtQ5rHeAHObR1r2lseaw84Ac5tHW8vdDEymNpII6DHNqx8fTBDyswDeu8gvlkyIuPPW/ED7Im9a0r4B98fOsC/OTw07DOq5aLVvcg7HkjJmsqcF4Fjv3TNOeNfMOsaVjnPXTf0rtIZRuBe7FBOouDeLl40Pjo4mnG0cTSWBrwgxyaMWl8mlgaSwN+kEMzJs1eaGJpLA3EcTCOxuIgTgM84CCeZhyNTROnQRprPzRxHIyjieGBBnFWDs0YHPg0MTzQIM7KoRmDg73QxPBAA/E042hsmjhtcEEFpmFdUFjYef8AAA5ZSURBVLQZMhW4uAIz8KoKTMP65/K5q4I14gI1FPOn5ilNvDnKY0+NF5MTHjW+vX61vnh7kmNfq8anQXksDuI4/GT8sdw01nzBOhBn5dCOrS8mJ8iDOCuHto7n08TkBBqIp8nZauI0KI/FB99UYBrWPxfIiwd6scngBxxcwKexNOCDOA54wEE8jaUBP+AQZ/GAh59q8htrLziksTiI44EGcXEc0lgcxPFAg7g4DmksDuJ4oEGcxYEf8JDG/lSTbxzYCw54wEE8jaUBH8RxwAM++KYC07C+KdCEpwJTgeepwGs1rMfUrctRl6qt6N84Cuk+MdxqYmnsT8fLNw7Wy1k8WEMeu9XoaSwO/GAcjU1jacAPOFx6VmPh0vH2+NV4evtkceCD+jWepQFfHuABhzhbLosHeRBncfjJWe0xGDv4pgLTsL4p0GfYvUP4lD7irBf0x+EXiwP/IP35wsMf4fBbnC2XxYF/SPvzhYc/wuE38TT+Qfpg09iPz1/88Cl9rLn8j8Mvtjz2IP354gc5RHar0dNYHPjBOBq71ehpLA78YByNTWNpwAdxHPg04G81Og34AQdj0vhbTYwG/HAsN00uP+CDbyowDeuvBXKf0IuNLcoPcujsVqOnsTjwg3E0dqvR01gc+ME4GrvV6GksDvxgHI1NY2nADzisufytJp8G/ICDMWl8GqSxOPBDuexW2+biUB5rHI3FgU8DPOAgnsbfamI04AccjEnjbzUxGvADDsYEfLBUYBrWUoyD64Xir1bAejmKh0Pan684axzRiw+HS8abx9hgToizOKy5/K225vKDPDAmrb2umpg84Ac5NDat8fQ0Fgd+MI72Ta0+5MsDfmg8m8bKA37AYc3lbzX5NOAHHIxJ66yrJiYP+EEOjU1rPD2NxUGuD30AHywVmIa1FONM17fwZ6ZO2gtWQMN4wW2/x5anYf31OWtGweVp0TQ2TRyHNH4QP6aniZebxqaxOPADDnEWD3g4V7OXU7nip+YUf/R467UnFgd+wCHO4gEP52r3Pqv9uMSH9jT2swLTsD4L8Wm8WPrUxo8sn/Kf/z15epp4Gp9+zng5co05NV5MHvBD49k0c8lbNTEa8IMcGpv23XjxU7ni5oTyWBzEceDTjq1PlxPk0IxJ49PE0lga8IMcGpt27/HmP7WWuD1BeSwO9ioH8HfA2WechvXPpfIjQSgaZ49pX+nHco9pl4w3j3EBhziLAz/gIY09V/tJ7rE5f2O8fVg34BBnceAHPKSx52o/yT025zq++Fvbd29Y/hSDXgR8l52wXoTioVzxtF5Y54wv99h4seZkW4sf5NDXtdLY8lh5wA9yaOt4e6GJlcfSQBwHObRj4+lyAg6Xjm+tY+PFWoe1DvCDHNq61zS2PFYeHFtrHS8u79rx5rBuwMH8adagDT4r8M4Ny4vBi2P91OazLGOmAlOBZ6zAOzcsz8PFJvBfFbPv21bAH2S3nXFmu1kF3rlhdbnJVlDf+vdXc9aL0DS2XHEcjKOzOIjTAA+tJ55mnDyxNJYG/CCHZkwanyaWxtKAH+TQjEmzF5pYGksDcRyMo7E4iNMADziIpxlHY9PEaZDG2g9NHAfjaGJ4oEGclUMzBgc+TQwPNIizcmjG4GAvNDE80EA8zTgamyZOgzQWB3EcjKMNPivwzg3rswRjpgJTgVepwDs3LH96bS83V43fcyyPTRPHoR8jVo1frpxwLDeNLY991Pj2+tX64vYDcuxr1fg0kBNwEE/7yfhjuWlsc7LWAX6QQzu2vlh5rDw4lrtqfHnXjjeHdQMO5k+zBg3o/3lwVu1A3+vrnRuWy3YPP/Tk4+JbTSxNHA/pcfGtJpYmjof0OHtKE5MTcIizOPADHtLsZauJpYnjIT0uvtXE0sTxkB4X32piaeJ4SI+zpzQxOQGHOIvDuhYe5ID4VqOnieMhPS6+1cTSxPGQ7gMioKe9nX3nhvV2D3sOfFYF3rohnFWhX0x654blr1j4hBBcoHoMLB5oEGdxuHS8Nb4aT7dGwCHONp7FgS8P8IBDnC2XxYM8iLM4XHpWY+HS8fb41Xi6PQYc4i6vG8+m8+VBGosDP5TLprHygB9wuPSsxsKx8XSX8OBHQ/wt8VYNa/OEPfjgBSnMbjV6GosDPxhHY7caPY3FgR+Mo7FpLA34AYc1l7/V5NOAH3AwJo2/1cRowA/HctO2uTg0li2XxYEvD/CAQ5wtl8WDPIiL48Df6qsmJg/4AYc1l7/V5NOAH47lpm1zcWgsu+aKvT3epWH5Nj/00HEvCuDTWTzQIM7KobE48LcanQb8cCw3bZuLQ2PZclkc+PIADzjE2XJZPMiDOIvDmsvfamsuP8gDY9L4W02MBvxwLDdtm4tDY9lyWRz48gAPOIin8beaGA34AQdj0vhbTYwG/ICDMWn8rSZGe0u8S8PqUxe2B+0CM6wvjDSXn8dyj2n3GG8fx9ZKs6Yc4NNZPNAgzuKw5nbWVVtz+UHOV+Pp5bE48MM9xpvbOsAPOFgzjb/VxGjgNYIDDsbg8Ey1sre3wrs0rLd6qHPYj4+PKcIuK/AuDauLUbYH6XLTHQGk8YP4MT1NvNy0OCt+TE8TlwdpLB5wiLM48AMe0thzNXs5lStuPjiWJ35MTxM3FtL4QfyYniZebhqbxuLADzjEWTzg4VzNXk7lip+aU/xW45vnbey7NCw/94ceLu6TJODTvdBwSKPjQQ5NPI1PE9tq9DRWDs0YHPg0MTzQIM7KobE43Hu8+a0D/K/Wp8sJOBiTxqcd2z+9PFYOzRgc+DQxPNAgzsqhsTjce7z5rQP8r9anywk4GJPGpx3bP/3t8C4N6+0e7Bx4KrDHChxvWPs7qYtU6E8sJ8T/7+BAOouD+CH85wsPLmCJ4mnG0dg0cRqksafGi8kJxkKclUNb1+LTxOQEGsRZOTRjcGivYniQB+JpxtHYNHEapLE4iONgHI3FQZwGeLAfmniacTSxNJYG/CCHZkwanyaWxtKAH+TQjEmzF5pYGksDcRyMo7E4iNMADziIpxlHY9PEaW+Jd2lYXlzQJzxv+bDn0FOBV6/AuzQsdwCwXni++rOb/U8F3q4C79KwtpeYHjTNX3UA33LTWBzEaYAHjY8mnmYcjU0Tp0Eae2q8mJxgLMRZObR1LT5NTE6gQZyVQzPmXz4+PmjtVQwP8kA8zTgamyZOgzQWB3EcjKOxOIjTAA/2QxNPM44mlsbSgB/k0IxJ49PE0lga8IMcmjFp9kITS2NpII6DcTQWB3Ea4AEH8TTjaGyaOO0t8S4N6y0f7hx6KrC3Crxzw/KnlgtMcL/l2a4anwZywrHcNLa8a8ebx9rAD9agmX+riaWx8oAf5NDW8XyaWHksDcRxkLPVxGkgJ+AgnvaT8cdy09jmZK0D/CCHdmx9sfJYecAPcmjreD5NrDyWBuI4yNlq4jSQE3AQT2s8nQ/8t8U7NywX8F4AsL4AcBBPx0OaeBpLZ4M4DdJYHMTxQIM4iwM/4CGN/akm3ziwFxzwgIN4GksDPojjgAccxNNYGvBBHAc84CCextKAH3CIs3jAw081+Y21FxzSWBzE8UCDuDgOaSwO4niggb8WpJHR8Uvw8mPeuWG9/MObA7xVBXxg5N7srQ69Pew7Nyx/TccFJvRCYOmhesVZOXQvIBzSWDzIgzgrh3ZsPF1OwCHONp7FgS8PcHAuHPBQLpvGygN+wOHYXh8x3hpfrU9vnywO/NB4dqttc3EojzWOxuKBBnEWh3vUyrx+VPRM7QV/S7xzw/LgQw8f98IAfjoejmnlsuXxj+Ue08plG88ey01bc/l01jjg0wAPOIin8beaGA344Vhu2jYXh8ay5bI48OUBHnCIs+WyeJAHcRaHNZe/1dZcfpAHxqTxt5oYDfjhWG7aNheHxrJrrtjb450b1rGH735gRTlePEGczp7SxOQBPxhHY7caPY3FgR+Mo7FbjZ7G4sAPxtHYNJYG/IDDmsvfavJpwA84GJPG32piNOCHY7lp21wcGsuWy+LAlwd4wCHOlsviQR7EWRzWXP5WW3P5QR4YE/DBUoFpWEsxDq4XiotNcMl5kP588cMf4fBbnDXuIH2wOLg8/fj8hYdP6SPOGkdn8UCDOIvDmsvfamsuP8gDY9La66qJyQN+kENj0xpPT2Nx4AfjaGzatePNY07gBxzWtfhbTT4N+AEHY9La66qJyQN+kENj0xpPT2NxkOv1B3za4LMC07A+CzFmKjAVeP4KTMP66zNyZxBcnhZNY9PEcUjjB/Fjepp4uWlsGosDP+AQZ/GAh3M1ezmVK35qTvFHj7dee2Jx4Acc4iwe8PAX7UDoB/Pnix/ufVbruMQH/p8NzG9/q8A0rL/Vod+9QHwSA+4W0vEghy6exqeJbTV6GiuHZgwOfJoYHmgQZ+XQWBzuPd781gH+V+vT5QQcjEnj047tn14eK4dmDA58mhgeaBBn5dBYHO493vzWAf5X69PlBBzs1TjAB0sFpmEtxRh3KjAVeO4KTMN67ufzTLv7yQXwT3Kf6YyzlyevwF0a1pOfebZ3ugKajX8sbpvlkyyxVceP/ejiE641b/ypwE0qMA3rJmXc1STuUPxTJttDuWsRW3X8WMM6Nn4dN/5U4KIKTMO6qGwzaCowFfiNCkzD+o2q72nNOctU4IEVmIb1wGLPUlOBqcB1FZiGdV39ZvRUYCrwwApMw3pgsWepqcBrV+D3dz8N6/efwexgKjAVOLMC07DOLNSkTQWmAr9fgWlYv/8MZgdTganAmRWYhnVmoa5PmxmmAlOBayswDevaCs74qcBU4GEVmIb1sFLPQlOBqcC1FZiGdW0FZ/xU4J8rMMqdKjAN606FnWmnAlOB21dgGtbtazozTgWmAneqwDSsOxV2pp0KTAVuX4H/DwAA//9sB2hHAAAABklEQVQDAB9QlitZA9bLAAAAAElFTkSuQmCC", 11677 width: "248", 11678 height: "248", 11679 style: { mixBlendMode: "multiply" } 11680 } 11681 ) 11682 )); 11683 } 11684 11685 // routes/connectors-home/ai-plugin-callout.tsx 11686 var AI_PLUGIN_SLUG = "ai"; 11687 var AI_PLUGIN_PAGE_SLUG = "ai-wp-admin"; 11688 var AI_PLUGIN_ID = "ai/ai"; 11689 var AI_PLUGIN_URL = "https://wordpress.org/plugins/ai/"; 11690 var connectorDataValues = Object.values(getConnectorData()); 11691 var hasAiProviders = connectorDataValues.some( 11692 (c) => c.type === "ai_provider" 11693 ); 11694 var aiProviderSettingNames = []; 11695 for (const c of connectorDataValues) { 11696 if (c.type === "ai_provider" && c.authentication.method === "api_key") { 11697 aiProviderSettingNames.push(c.authentication.settingName); 11698 } 11699 } 11700 function AiPluginCallout() { 11701 const [isBusy, setIsBusy] = (0, import_element33.useState)(false); 11702 const [justActivated, setJustActivated] = (0, import_element33.useState)(false); 11703 const actionButtonRef = (0, import_element33.useRef)(null); 11704 (0, import_element33.useEffect)(() => { 11705 if (justActivated) { 11706 actionButtonRef.current?.focus(); 11707 } 11708 }, [justActivated]); 11709 const initialHasConnectedProvider = (0, import_element33.useRef)( 11710 connectorDataValues.some( 11711 (c) => c.type === "ai_provider" && c.authentication.method === "api_key" && c.authentication.isConnected 11712 ) 11713 ).current; 11714 const { 11715 pluginStatus, 11716 canInstallPlugins, 11717 canManagePlugins, 11718 hasConnectedProvider 11719 } = (0, import_data3.useSelect)((select2) => { 11720 const store2 = select2(import_core_data2.store); 11721 const canCreate = !!store2.canUser("create", { 11722 kind: "root", 11723 name: "plugin" 11724 }); 11725 const siteSettings = store2.getEntityRecord("root", "site"); 11726 const hasConnected = initialHasConnectedProvider || aiProviderSettingNames.some( 11727 (name) => !!siteSettings?.[name] 11728 ); 11729 const plugin = store2.getEntityRecord( 11730 "root", 11731 "plugin", 11732 AI_PLUGIN_ID 11733 ); 11734 const hasFinished = store2.hasFinishedResolution("getEntityRecord", [ 11735 "root", 11736 "plugin", 11737 AI_PLUGIN_ID 11738 ]); 11739 if (!hasFinished) { 11740 return { 11741 pluginStatus: "checking", 11742 canInstallPlugins: canCreate, 11743 canManagePlugins: void 0, 11744 hasConnectedProvider: hasConnected 11745 }; 11746 } 11747 if (!plugin) { 11748 return { 11749 pluginStatus: "not-installed", 11750 canInstallPlugins: canCreate, 11751 canManagePlugins: canCreate, 11752 hasConnectedProvider: hasConnected 11753 }; 11754 } 11755 return { 11756 pluginStatus: plugin.status === "active" ? "active" : "inactive", 11757 canInstallPlugins: canCreate, 11758 canManagePlugins: true, 11759 hasConnectedProvider: hasConnected 11760 }; 11761 }, []); 11762 const { saveEntityRecord } = (0, import_data3.useDispatch)(import_core_data2.store); 11763 const { createSuccessNotice, createErrorNotice } = (0, import_data3.useDispatch)(import_notices2.store); 11764 const installPlugin = async () => { 11765 setIsBusy(true); 11766 try { 11767 await saveEntityRecord( 11768 "root", 11769 "plugin", 11770 { slug: AI_PLUGIN_SLUG, status: "active" }, 11771 { throwOnError: true } 11772 ); 11773 setJustActivated(true); 11774 createSuccessNotice( 11775 (0, import_i18n6.__)("AI plugin installed and activated successfully."), 11776 { 11777 id: "ai-plugin-install-success", 11778 type: "snackbar" 11779 } 11780 ); 11781 } catch { 11782 createErrorNotice((0, import_i18n6.__)("Failed to install the AI plugin."), { 11783 id: "ai-plugin-install-error", 11784 type: "snackbar" 11785 }); 11786 } finally { 11787 setIsBusy(false); 11788 } 11789 }; 11790 const activatePlugin = async () => { 11791 setIsBusy(true); 11792 try { 11793 await saveEntityRecord( 11794 "root", 11795 "plugin", 11796 { plugin: AI_PLUGIN_ID, status: "active" }, 11797 { throwOnError: true } 11798 ); 11799 setJustActivated(true); 11800 createSuccessNotice((0, import_i18n6.__)("AI plugin activated successfully."), { 11801 id: "ai-plugin-activate-success", 11802 type: "snackbar" 11803 }); 11804 } catch { 11805 createErrorNotice((0, import_i18n6.__)("Failed to activate the AI plugin."), { 11806 id: "ai-plugin-activate-error", 11807 type: "snackbar" 11808 }); 11809 } finally { 11810 setIsBusy(false); 11811 } 11812 }; 11813 if (!hasAiProviders) { 11814 return null; 11815 } 11816 if (pluginStatus === "checking") { 11817 return null; 11818 } 11819 if (pluginStatus === "active" && initialHasConnectedProvider && !justActivated) { 11820 return null; 11821 } 11822 if (pluginStatus === "inactive" && canManagePlugins === false) { 11823 return null; 11824 } 11825 const isActiveNoProvider = pluginStatus === "active" && !hasConnectedProvider; 11826 const isJustConnected = pluginStatus === "active" && hasConnectedProvider && (!initialHasConnectedProvider || justActivated); 11827 const showInstallActivate = pluginStatus === "not-installed" || pluginStatus === "inactive"; 11828 const hideButtons = pluginStatus === "not-installed" && canInstallPlugins === false; 11829 const getMessage = () => { 11830 if (isJustConnected) { 11831 return (0, import_i18n6.__)( 11832 "The <strong>AI plugin</strong> is ready to use. You can use it to generate featured images, alt text, titles, excerpts and more. <a>Learn more</a>" 11833 ); 11834 } 11835 if (isActiveNoProvider) { 11836 return (0, import_i18n6.__)( 11837 "The <strong>AI plugin</strong> is installed. Connect an AI provider below to generate featured images, alt text, titles, excerpts, and more. <a>Learn more</a>" 11838 ); 11839 } 11840 return (0, import_i18n6.__)( 11841 "The <strong>AI plugin</strong> can use your AI connectors to generate featured images, alt text, titles, excerpts and more. <a>Learn more</a>" 11842 ); 11843 }; 11844 const getPrimaryButtonProps = () => { 11845 if (pluginStatus === "not-installed") { 11846 return { 11847 label: isBusy ? (0, import_i18n6.__)("Installing\u2026") : (0, import_i18n6.__)("Install the AI plugin"), 11848 disabled: isBusy, 11849 onClick: isBusy ? void 0 : installPlugin 11850 }; 11851 } 11852 return { 11853 label: isBusy ? (0, import_i18n6.__)("Activating\u2026") : (0, import_i18n6.__)("Activate the AI plugin"), 11854 disabled: isBusy, 11855 onClick: isBusy ? void 0 : activatePlugin 11856 }; 11857 }; 11858 return /* @__PURE__ */ React.createElement("div", { className: "ai-plugin-callout" }, /* @__PURE__ */ React.createElement("div", { className: "ai-plugin-callout__content" }, /* @__PURE__ */ React.createElement("p", null, (0, import_element33.createInterpolateElement)(getMessage(), { 11859 strong: /* @__PURE__ */ React.createElement("strong", null), 11860 // @ts-ignore children are injected by createInterpolateElement at runtime. 11861 a: /* @__PURE__ */ React.createElement(import_components3.ExternalLink, { href: AI_PLUGIN_URL }) 11862 })), !hideButtons && (showInstallActivate ? /* @__PURE__ */ React.createElement( 11863 import_components3.Button, 11864 { 11865 variant: "primary", 11866 size: "compact", 11867 isBusy, 11868 disabled: getPrimaryButtonProps().disabled, 11869 accessibleWhenDisabled: true, 11870 onClick: getPrimaryButtonProps().onClick 11871 }, 11872 getPrimaryButtonProps().label 11873 ) : /* @__PURE__ */ React.createElement( 11874 import_components3.Button, 11875 { 11876 ref: actionButtonRef, 11877 variant: "secondary", 11878 size: "compact", 11879 href: (0, import_url.addQueryArgs)("options-general.php", { 11880 page: AI_PLUGIN_PAGE_SLUG 11881 }) 11882 }, 11883 (0, import_i18n6.__)("Control features in the AI plugin") 11884 ))), /* @__PURE__ */ React.createElement(WpLogoDecoration, null)); 11885 } 11886 11887 // routes/connectors-home/stage.tsx 11888 var { store } = unlock2(connectorsPrivateApis2); 11889 registerDefaultConnectors(); 11890 function ConnectorsPage() { 11891 const isFileModDisabled = getIsFileModDisabled(); 11892 const { connectors, canInstallPlugins, isAiPluginInstalled } = (0, import_data4.useSelect)( 11893 (select2) => { 11894 const coreSelect = select2(import_core_data3.store); 11895 const aiPlugin = coreSelect.getEntityRecord( 11896 "root", 11897 "plugin", 11898 "ai/ai" 11899 ); 11900 return { 11901 connectors: unlock2(select2(store)).getConnectors(), 11902 canInstallPlugins: coreSelect.canUser("create", { 11903 kind: "root", 11904 name: "plugin" 11905 }), 11906 isAiPluginInstalled: !!aiPlugin 11907 }; 11908 }, 11909 [] 11910 ); 11911 const renderableConnectors = connectors.filter( 11912 (connector) => connector.render 11913 ); 11914 const aiProviderPluginSlugs = Array.from( 11915 new Set( 11916 connectors.filter( 11917 (connector) => connector.type === "ai_provider" 11918 ).map( 11919 (connector) => connector.plugin?.file?.split("/")[0] 11920 ).filter((slug) => !!slug) 11921 ) 11922 ).sort(); 11923 const installedPluginSlugs = new Set( 11924 connectors.filter( 11925 (connector) => connector.plugin?.isInstalled 11926 ).map( 11927 (connector) => connector.plugin?.file?.split("/")[0] 11928 ).filter((slug) => !!slug) 11929 ); 11930 if (isAiPluginInstalled) { 11931 installedPluginSlugs.add("ai"); 11932 } 11933 const manualInstallPluginSlugs = ["ai", ...aiProviderPluginSlugs].filter( 11934 (slug) => !installedPluginSlugs.has(slug) 11935 ); 11936 const isEmpty = renderableConnectors.length === 0; 11937 return /* @__PURE__ */ React.createElement( 11938 page_default, 11939 { 11940 title: (0, import_i18n7.__)("Connectors"), 11941 subTitle: (0, import_i18n7.__)( 11942 "All of your API keys and credentials are stored here and shared across plugins. Configure once and use everywhere." 11943 ) 11944 }, 11945 /* @__PURE__ */ React.createElement( 11946 "div", 11947 { 11948 className: `connectors-page$isEmpty ? " connectors-page--empty" : ""}` 11949 }, 11950 manualInstallPluginSlugs.length > 0 && (isFileModDisabled || !canInstallPlugins) && /* @__PURE__ */ React.createElement( 11951 notice_exports.Root, 11952 { 11953 intent: "info", 11954 className: "connectors-page__file-mods-notice" 11955 }, 11956 /* @__PURE__ */ React.createElement(notice_exports.Description, null, isFileModDisabled ? (0, import_i18n7.__)( 11957 "Plugins cannot be installed here due to your site configuration. Install them manually using your normal deployment workflow." 11958 ) : (0, import_i18n7.__)( 11959 "You do not have permission to install plugins. Please ask a site administrator to install them for you." 11960 )) 11961 ), 11962 isEmpty ? /* @__PURE__ */ React.createElement( 11963 import_components4.__experimentalVStack, 11964 { 11965 alignment: "center", 11966 spacing: 3, 11967 style: { maxWidth: 480 } 11968 }, 11969 /* @__PURE__ */ React.createElement(import_components4.__experimentalVStack, { alignment: "center", spacing: 2 }, /* @__PURE__ */ React.createElement(import_components4.__experimentalHeading, { level: 2, size: 15, weight: 600 }, (0, import_i18n7.__)("No connectors yet")), /* @__PURE__ */ React.createElement(import_components4.__experimentalText, { size: 12 }, (0, import_i18n7.__)( 11970 "Connectors appear here when you install plugins that use external services. Each plugin registers the API keys it needs, and you manage them all in one place." 11971 ))), 11972 /* @__PURE__ */ React.createElement( 11973 import_components4.Button, 11974 { 11975 variant: "secondary", 11976 href: "plugin-install.php", 11977 __next40pxDefaultSize: true 11978 }, 11979 (0, import_i18n7.__)("Learn more") 11980 ) 11981 ) : /* @__PURE__ */ React.createElement(import_components4.__experimentalVStack, { spacing: 3 }, /* @__PURE__ */ React.createElement(AiPluginCallout, null), /* @__PURE__ */ React.createElement(import_components4.__experimentalVStack, { spacing: 3, role: "list" }, connectors.map( 11982 (connector) => { 11983 if (connector.render) { 11984 return /* @__PURE__ */ React.createElement( 11985 connector.render, 11986 { 11987 key: connector.slug, 11988 slug: connector.slug, 11989 name: connector.name, 11990 description: connector.description, 11991 type: connector.type, 11992 logo: connector.logo, 11993 authentication: connector.authentication, 11994 plugin: connector.plugin 11995 } 11996 ); 11997 } 11998 return null; 11999 } 12000 ))), 12001 canInstallPlugins && !isFileModDisabled && /* @__PURE__ */ React.createElement("p", null, (0, import_element34.createInterpolateElement)( 12002 (0, import_i18n7.__)( 12003 "If the connector you need is not listed, <a>search the plugin directory</a> to see if a connector is available." 12004 ), 12005 { 12006 a: ( 12007 // eslint-disable-next-line jsx-a11y/anchor-has-content 12008 /* @__PURE__ */ React.createElement("a", { href: "plugin-install.php?s=connector&tab=search&type=tag" }) 12009 ) 12010 } 12011 )) 12012 ) 12013 ); 12014 } 12015 function Stage() { 12016 return /* @__PURE__ */ React.createElement(ConnectorsPage, null); 12017 } 12018 var stage = Stage; 12019 export { 12020 stage 12021 }; 12022 /*! Bundled license information: 12023 12024 use-sync-external-store/cjs/use-sync-external-store-shim.development.js: 12025 (** 12026 * @license React 12027 * use-sync-external-store-shim.development.js 12028 * 12029 * Copyright (c) Meta Platforms, Inc. and affiliates. 12030 * 12031 * This source code is licensed under the MIT license found in the 12032 * LICENSE file in the root directory of this source tree. 12033 *) 12034 12035 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: 12036 (** 12037 * @license React 12038 * use-sync-external-store-shim/with-selector.development.js 12039 * 12040 * Copyright (c) Meta Platforms, Inc. and affiliates. 12041 * 12042 * This source code is licensed under the MIT license found in the 12043 * LICENSE file in the root directory of this source tree. 12044 *) 12045 */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Fri Jul 3 08:20:12 2026 | Cross-referenced by PHPXref |