| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 var wp; 2 (wp ||= {}).commands = (() => { 3 var __create = Object.create; 4 var __defProp = Object.defineProperty; 5 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 6 var __getOwnPropNames = Object.getOwnPropertyNames; 7 var __getProtoOf = Object.getPrototypeOf; 8 var __hasOwnProp = Object.prototype.hasOwnProperty; 9 var __commonJS = (cb, mod) => function __require() { 10 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 11 }; 12 var __export = (target, all) => { 13 for (var name in all) 14 __defProp(target, name, { get: all[name], enumerable: true }); 15 }; 16 var __copyProps = (to, from, except, desc) => { 17 if (from && typeof from === "object" || typeof from === "function") { 18 for (let key of __getOwnPropNames(from)) 19 if (!__hasOwnProp.call(to, key) && key !== except) 20 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 21 } 22 return to; 23 }; 24 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 25 // If the importer is in node compatibility mode or this is not an ESM 26 // file that has been converted to a CommonJS file using a Babel- 27 // compatible transform (i.e. "__esModule" has not been set), then set 28 // "default" to the CommonJS "module.exports" for node compatibility. 29 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 30 mod 31 )); 32 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 33 34 // vendor-external:react 35 var require_react = __commonJS({ 36 "vendor-external:react"(exports, module) { 37 module.exports = window.React; 38 } 39 }); 40 41 // vendor-external:react/jsx-runtime 42 var require_jsx_runtime = __commonJS({ 43 "vendor-external:react/jsx-runtime"(exports, module) { 44 module.exports = window.ReactJSXRuntime; 45 } 46 }); 47 48 // vendor-external:react-dom 49 var require_react_dom = __commonJS({ 50 "vendor-external:react-dom"(exports, module) { 51 module.exports = window.ReactDOM; 52 } 53 }); 54 55 // package-external:@wordpress/data 56 var require_data = __commonJS({ 57 "package-external:@wordpress/data"(exports, module) { 58 module.exports = window.wp.data; 59 } 60 }); 61 62 // package-external:@wordpress/element 63 var require_element = __commonJS({ 64 "package-external:@wordpress/element"(exports, module) { 65 module.exports = window.wp.element; 66 } 67 }); 68 69 // package-external:@wordpress/i18n 70 var require_i18n = __commonJS({ 71 "package-external:@wordpress/i18n"(exports, module) { 72 module.exports = window.wp.i18n; 73 } 74 }); 75 76 // package-external:@wordpress/components 77 var require_components = __commonJS({ 78 "package-external:@wordpress/components"(exports, module) { 79 module.exports = window.wp.components; 80 } 81 }); 82 83 // package-external:@wordpress/keyboard-shortcuts 84 var require_keyboard_shortcuts = __commonJS({ 85 "package-external:@wordpress/keyboard-shortcuts"(exports, module) { 86 module.exports = window.wp.keyboardShortcuts; 87 } 88 }); 89 90 // package-external:@wordpress/primitives 91 var require_primitives = __commonJS({ 92 "package-external:@wordpress/primitives"(exports, module) { 93 module.exports = window.wp.primitives; 94 } 95 }); 96 97 // package-external:@wordpress/private-apis 98 var require_private_apis = __commonJS({ 99 "package-external:@wordpress/private-apis"(exports, module) { 100 module.exports = window.wp.privateApis; 101 } 102 }); 103 104 // packages/commands/build-module/index.mjs 105 var index_exports = {}; 106 __export(index_exports, { 107 CommandMenu: () => CommandMenu, 108 privateApis: () => privateApis, 109 store: () => store, 110 useCommand: () => useCommand, 111 useCommandLoader: () => useCommandLoader, 112 useCommands: () => useCommands 113 }); 114 115 // node_modules/cmdk/dist/chunk-NZJY6EH4.mjs 116 var U = 1; 117 var Y = 0.9; 118 var H = 0.8; 119 var J = 0.17; 120 var p = 0.1; 121 var u = 0.999; 122 var $ = 0.9999; 123 var k = 0.99; 124 var m = /[\\\/_+.#"@\[\(\{&]/; 125 var B = /[\\\/_+.#"@\[\(\{&]/g; 126 var K = /[\s-]/; 127 var X = /[\s-]/g; 128 function G(_, C, h, P2, A, f, O) { 129 if (f === C.length) return A === _.length ? U : k; 130 var T2 = `$A},$f}`; 131 if (O[T2] !== void 0) return O[T2]; 132 for (var L2 = P2.charAt(f), c = h.indexOf(L2, A), S = 0, E, N2, R, M; c >= 0; ) E = G(_, C, h, P2, c + 1, f + 1, O), E > S && (c === A ? E *= U : m.test(_.charAt(c - 1)) ? (E *= H, R = _.slice(A, c - 1).match(B), R && A > 0 && (E *= Math.pow(u, R.length))) : K.test(_.charAt(c - 1)) ? (E *= Y, M = _.slice(A, c - 1).match(X), M && A > 0 && (E *= Math.pow(u, M.length))) : (E *= J, A > 0 && (E *= Math.pow(u, c - A))), _.charAt(c) !== C.charAt(f) && (E *= $)), (E < p && h.charAt(c - 1) === P2.charAt(f + 1) || P2.charAt(f + 1) === P2.charAt(f) && h.charAt(c - 1) !== P2.charAt(f)) && (N2 = G(_, C, h, P2, c + 1, f + 2, O), N2 * p > E && (E = N2 * p)), E > S && (S = E), c = h.indexOf(L2, c + 1); 133 return O[T2] = S, S; 134 } 135 function D(_) { 136 return _.toLowerCase().replace(X, " "); 137 } 138 function W(_, C, h) { 139 return _ = h && h.length > 0 ? `$_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {}); 140 } 141 142 // node_modules/@radix-ui/react-dialog/dist/index.mjs 143 var React37 = __toESM(require_react(), 1); 144 145 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.mjs 146 var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement); 147 function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) { 148 return function handleEvent(event) { 149 originalEventHandler?.(event); 150 if (checkForDefaultPrevented === false || !event.defaultPrevented) { 151 return ourEventHandler?.(event); 152 } 153 }; 154 } 155 156 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.mjs 157 var React = __toESM(require_react(), 1); 158 function setRef(ref, value) { 159 if (typeof ref === "function") { 160 return ref(value); 161 } else if (ref !== null && ref !== void 0) { 162 ref.current = value; 163 } 164 } 165 function composeRefs(...refs) { 166 return (node) => { 167 let hasCleanup = false; 168 const cleanups = refs.map((ref) => { 169 const cleanup = setRef(ref, node); 170 if (!hasCleanup && typeof cleanup == "function") { 171 hasCleanup = true; 172 } 173 return cleanup; 174 }); 175 if (hasCleanup) { 176 return () => { 177 for (let i = 0; i < cleanups.length; i++) { 178 const cleanup = cleanups[i]; 179 if (typeof cleanup == "function") { 180 cleanup(); 181 } else { 182 setRef(refs[i], null); 183 } 184 } 185 }; 186 } 187 }; 188 } 189 function useComposedRefs(...refs) { 190 return React.useCallback(composeRefs(...refs), refs); 191 } 192 193 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.mjs 194 var React2 = __toESM(require_react(), 1); 195 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 196 function createContext2(rootComponentName, defaultContext) { 197 const Context = React2.createContext(defaultContext); 198 const Provider = (props) => { 199 const { children, ...context2 } = props; 200 const value = React2.useMemo(() => context2, Object.values(context2)); 201 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children }); 202 }; 203 Provider.displayName = rootComponentName + "Provider"; 204 function useContext22(consumerName) { 205 const context2 = React2.useContext(Context); 206 if (context2) return context2; 207 if (defaultContext !== void 0) return defaultContext; 208 throw new Error(`\`$consumerName}\` must be used within \`$rootComponentName}\``); 209 } 210 return [Provider, useContext22]; 211 } 212 function createContextScope(scopeName, createContextScopeDeps = []) { 213 let defaultContexts = []; 214 function createContext32(rootComponentName, defaultContext) { 215 const BaseContext = React2.createContext(defaultContext); 216 const index = defaultContexts.length; 217 defaultContexts = [...defaultContexts, defaultContext]; 218 const Provider = (props) => { 219 const { scope, children, ...context2 } = props; 220 const Context = scope?.[scopeName]?.[index] || BaseContext; 221 const value = React2.useMemo(() => context2, Object.values(context2)); 222 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children }); 223 }; 224 Provider.displayName = rootComponentName + "Provider"; 225 function useContext22(consumerName, scope) { 226 const Context = scope?.[scopeName]?.[index] || BaseContext; 227 const context2 = React2.useContext(Context); 228 if (context2) return context2; 229 if (defaultContext !== void 0) return defaultContext; 230 throw new Error(`\`$consumerName}\` must be used within \`$rootComponentName}\``); 231 } 232 return [Provider, useContext22]; 233 } 234 const createScope = () => { 235 const scopeContexts = defaultContexts.map((defaultContext) => { 236 return React2.createContext(defaultContext); 237 }); 238 return function useScope(scope) { 239 const contexts = scope?.[scopeName] || scopeContexts; 240 return React2.useMemo( 241 () => ({ [`__scope$scopeName}`]: { ...scope, [scopeName]: contexts } }), 242 [scope, contexts] 243 ); 244 }; 245 }; 246 createScope.scopeName = scopeName; 247 return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)]; 248 } 249 function composeContextScopes(...scopes) { 250 const baseScope = scopes[0]; 251 if (scopes.length === 1) return baseScope; 252 const createScope = () => { 253 const scopeHooks = scopes.map((createScope2) => ({ 254 useScope: createScope2(), 255 scopeName: createScope2.scopeName 256 })); 257 return function useComposedScopes(overrideScopes) { 258 const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => { 259 const scopeProps = useScope(overrideScopes); 260 const currentScope = scopeProps[`__scope$scopeName}`]; 261 return { ...nextScopes2, ...currentScope }; 262 }, {}); 263 return React2.useMemo(() => ({ [`__scope$baseScope.scopeName}`]: nextScopes }), [nextScopes]); 264 }; 265 }; 266 createScope.scopeName = baseScope.scopeName; 267 return createScope; 268 } 269 270 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.mjs 271 var React4 = __toESM(require_react(), 1); 272 273 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs 274 var React3 = __toESM(require_react(), 1); 275 var useLayoutEffect2 = globalThis?.document ? React3.useLayoutEffect : () => { 276 }; 277 278 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.mjs 279 var useReactId = React4[" useId ".trim().toString()] || (() => void 0); 280 var count = 0; 281 function useId(deterministicId) { 282 const [id, setId] = React4.useState(useReactId()); 283 useLayoutEffect2(() => { 284 if (!deterministicId) setId((reactId) => reactId ?? String(count++)); 285 }, [deterministicId]); 286 return deterministicId || (id ? `radix-$id}` : ""); 287 } 288 289 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs 290 var React5 = __toESM(require_react(), 1); 291 var React22 = __toESM(require_react(), 1); 292 var useInsertionEffect = React5[" useInsertionEffect ".trim().toString()] || useLayoutEffect2; 293 function useControllableState({ 294 prop, 295 defaultProp, 296 onChange = () => { 297 }, 298 caller 299 }) { 300 const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({ 301 defaultProp, 302 onChange 303 }); 304 const isControlled = prop !== void 0; 305 const value = isControlled ? prop : uncontrolledProp; 306 if (true) { 307 const isControlledRef = React5.useRef(prop !== void 0); 308 React5.useEffect(() => { 309 const wasControlled = isControlledRef.current; 310 if (wasControlled !== isControlled) { 311 const from = wasControlled ? "controlled" : "uncontrolled"; 312 const to = isControlled ? "controlled" : "uncontrolled"; 313 console.warn( 314 `$caller} is changing from $from} to $to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.` 315 ); 316 } 317 isControlledRef.current = isControlled; 318 }, [isControlled, caller]); 319 } 320 const setValue = React5.useCallback( 321 (nextValue) => { 322 if (isControlled) { 323 const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue; 324 if (value2 !== prop) { 325 onChangeRef.current?.(value2); 326 } 327 } else { 328 setUncontrolledProp(nextValue); 329 } 330 }, 331 [isControlled, prop, setUncontrolledProp, onChangeRef] 332 ); 333 return [value, setValue]; 334 } 335 function useUncontrolledState({ 336 defaultProp, 337 onChange 338 }) { 339 const [value, setValue] = React5.useState(defaultProp); 340 const prevValueRef = React5.useRef(value); 341 const onChangeRef = React5.useRef(onChange); 342 useInsertionEffect(() => { 343 onChangeRef.current = onChange; 344 }, [onChange]); 345 React5.useEffect(() => { 346 if (prevValueRef.current !== value) { 347 onChangeRef.current?.(value); 348 prevValueRef.current = value; 349 } 350 }, [value, prevValueRef]); 351 return [value, setValue, onChangeRef]; 352 } 353 function isFunction(value) { 354 return typeof value === "function"; 355 } 356 357 // node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs 358 var React11 = __toESM(require_react(), 1); 359 360 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/primitive/dist/index.mjs 361 var canUseDOM2 = !!(typeof window !== "undefined" && window.document && window.document.createElement); 362 function composeEventHandlers2(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) { 363 return function handleEvent(event) { 364 originalEventHandler?.(event); 365 if (checkForDefaultPrevented === false || !event.defaultPrevented) { 366 return ourEventHandler?.(event); 367 } 368 }; 369 } 370 371 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive/dist/index.mjs 372 var React8 = __toESM(require_react(), 1); 373 var ReactDOM = __toESM(require_react_dom(), 1); 374 375 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-slot/dist/index.mjs 376 var React7 = __toESM(require_react(), 1); 377 378 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-compose-refs/dist/index.mjs 379 var React6 = __toESM(require_react(), 1); 380 function setRef2(ref, value) { 381 if (typeof ref === "function") { 382 return ref(value); 383 } else if (ref !== null && ref !== void 0) { 384 ref.current = value; 385 } 386 } 387 function composeRefs2(...refs) { 388 return (node) => { 389 let hasCleanup = false; 390 const cleanups = refs.map((ref) => { 391 const cleanup = setRef2(ref, node); 392 if (!hasCleanup && typeof cleanup == "function") { 393 hasCleanup = true; 394 } 395 return cleanup; 396 }); 397 if (hasCleanup) { 398 return () => { 399 for (let i = 0; i < cleanups.length; i++) { 400 const cleanup = cleanups[i]; 401 if (typeof cleanup == "function") { 402 cleanup(); 403 } else { 404 setRef2(refs[i], null); 405 } 406 } 407 }; 408 } 409 }; 410 } 411 function useComposedRefs2(...refs) { 412 return React6.useCallback(composeRefs2(...refs), refs); 413 } 414 415 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-slot/dist/index.mjs 416 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 417 // @__NO_SIDE_EFFECTS__ 418 function createSlot(ownerName) { 419 const SlotClone = /* @__PURE__ */ createSlotClone(ownerName); 420 const Slot2 = React7.forwardRef((props, forwardedRef) => { 421 const { children, ...slotProps } = props; 422 const childrenArray = React7.Children.toArray(children); 423 const slottable = childrenArray.find(isSlottable); 424 if (slottable) { 425 const newElement = slottable.props.children; 426 const newChildren = childrenArray.map((child) => { 427 if (child === slottable) { 428 if (React7.Children.count(newElement) > 1) return React7.Children.only(null); 429 return React7.isValidElement(newElement) ? newElement.props.children : null; 430 } else { 431 return child; 432 } 433 }); 434 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React7.isValidElement(newElement) ? React7.cloneElement(newElement, void 0, newChildren) : null }); 435 } 436 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children }); 437 }); 438 Slot2.displayName = `$ownerName}.Slot`; 439 return Slot2; 440 } 441 // @__NO_SIDE_EFFECTS__ 442 function createSlotClone(ownerName) { 443 const SlotClone = React7.forwardRef((props, forwardedRef) => { 444 const { children, ...slotProps } = props; 445 if (React7.isValidElement(children)) { 446 const childrenRef = getElementRef(children); 447 const props2 = mergeProps(slotProps, children.props); 448 if (children.type !== React7.Fragment) { 449 props2.ref = forwardedRef ? composeRefs2(forwardedRef, childrenRef) : childrenRef; 450 } 451 return React7.cloneElement(children, props2); 452 } 453 return React7.Children.count(children) > 1 ? React7.Children.only(null) : null; 454 }); 455 SlotClone.displayName = `$ownerName}.SlotClone`; 456 return SlotClone; 457 } 458 var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable"); 459 function isSlottable(child) { 460 return React7.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER; 461 } 462 function mergeProps(slotProps, childProps) { 463 const overrideProps = { ...childProps }; 464 for (const propName in childProps) { 465 const slotPropValue = slotProps[propName]; 466 const childPropValue = childProps[propName]; 467 const isHandler = /^on[A-Z]/.test(propName); 468 if (isHandler) { 469 if (slotPropValue && childPropValue) { 470 overrideProps[propName] = (...args) => { 471 const result = childPropValue(...args); 472 slotPropValue(...args); 473 return result; 474 }; 475 } else if (slotPropValue) { 476 overrideProps[propName] = slotPropValue; 477 } 478 } else if (propName === "style") { 479 overrideProps[propName] = { ...slotPropValue, ...childPropValue }; 480 } else if (propName === "className") { 481 overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" "); 482 } 483 } 484 return { ...slotProps, ...overrideProps }; 485 } 486 function getElementRef(element) { 487 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get; 488 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 489 if (mayWarn) { 490 return element.ref; 491 } 492 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get; 493 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 494 if (mayWarn) { 495 return element.props.ref; 496 } 497 return element.props.ref || element.ref; 498 } 499 500 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive/dist/index.mjs 501 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 502 var NODES = [ 503 "a", 504 "button", 505 "div", 506 "form", 507 "h2", 508 "h3", 509 "img", 510 "input", 511 "label", 512 "li", 513 "nav", 514 "ol", 515 "p", 516 "select", 517 "span", 518 "svg", 519 "ul" 520 ]; 521 var Primitive = NODES.reduce((primitive, node) => { 522 const Slot2 = createSlot(`Primitive.$node}`); 523 const Node2 = React8.forwardRef((props, forwardedRef) => { 524 const { asChild, ...primitiveProps } = props; 525 const Comp = asChild ? Slot2 : node; 526 if (typeof window !== "undefined") { 527 window[/* @__PURE__ */ Symbol.for("radix-ui")] = true; 528 } 529 return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Comp, { ...primitiveProps, ref: forwardedRef }); 530 }); 531 Node2.displayName = `Primitive.$node}`; 532 return { ...primitive, [node]: Node2 }; 533 }, {}); 534 function dispatchDiscreteCustomEvent(target, event) { 535 if (target) ReactDOM.flushSync(() => target.dispatchEvent(event)); 536 } 537 538 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs 539 var React9 = __toESM(require_react(), 1); 540 function useCallbackRef(callback) { 541 const callbackRef = React9.useRef(callback); 542 React9.useEffect(() => { 543 callbackRef.current = callback; 544 }); 545 return React9.useMemo(() => (...args) => callbackRef.current?.(...args), []); 546 } 547 548 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs 549 var React10 = __toESM(require_react(), 1); 550 function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) { 551 const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp); 552 React10.useEffect(() => { 553 const handleKeyDown = (event) => { 554 if (event.key === "Escape") { 555 onEscapeKeyDown(event); 556 } 557 }; 558 ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true }); 559 return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true }); 560 }, [onEscapeKeyDown, ownerDocument]); 561 } 562 563 // node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs 564 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 565 var DISMISSABLE_LAYER_NAME = "DismissableLayer"; 566 var CONTEXT_UPDATE = "dismissableLayer.update"; 567 var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside"; 568 var FOCUS_OUTSIDE = "dismissableLayer.focusOutside"; 569 var originalBodyPointerEvents; 570 var DismissableLayerContext = React11.createContext({ 571 layers: /* @__PURE__ */ new Set(), 572 layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(), 573 branches: /* @__PURE__ */ new Set() 574 }); 575 var DismissableLayer = React11.forwardRef( 576 (props, forwardedRef) => { 577 const { 578 disableOutsidePointerEvents = false, 579 onEscapeKeyDown, 580 onPointerDownOutside, 581 onFocusOutside, 582 onInteractOutside, 583 onDismiss, 584 ...layerProps 585 } = props; 586 const context2 = React11.useContext(DismissableLayerContext); 587 const [node, setNode] = React11.useState(null); 588 const ownerDocument = node?.ownerDocument ?? globalThis?.document; 589 const [, force] = React11.useState({}); 590 const composedRefs = useComposedRefs2(forwardedRef, (node2) => setNode(node2)); 591 const layers = Array.from(context2.layers); 592 const [highestLayerWithOutsidePointerEventsDisabled] = [...context2.layersWithOutsidePointerEventsDisabled].slice(-1); 593 const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); 594 const index = node ? layers.indexOf(node) : -1; 595 const isBodyPointerEventsDisabled = context2.layersWithOutsidePointerEventsDisabled.size > 0; 596 const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex; 597 const pointerDownOutside = usePointerDownOutside((event) => { 598 const target = event.target; 599 const isPointerDownOnBranch = [...context2.branches].some((branch) => branch.contains(target)); 600 if (!isPointerEventsEnabled || isPointerDownOnBranch) return; 601 onPointerDownOutside?.(event); 602 onInteractOutside?.(event); 603 if (!event.defaultPrevented) onDismiss?.(); 604 }, ownerDocument); 605 const focusOutside = useFocusOutside((event) => { 606 const target = event.target; 607 const isFocusInBranch = [...context2.branches].some((branch) => branch.contains(target)); 608 if (isFocusInBranch) return; 609 onFocusOutside?.(event); 610 onInteractOutside?.(event); 611 if (!event.defaultPrevented) onDismiss?.(); 612 }, ownerDocument); 613 useEscapeKeydown((event) => { 614 const isHighestLayer = index === context2.layers.size - 1; 615 if (!isHighestLayer) return; 616 onEscapeKeyDown?.(event); 617 if (!event.defaultPrevented && onDismiss) { 618 event.preventDefault(); 619 onDismiss(); 620 } 621 }, ownerDocument); 622 React11.useEffect(() => { 623 if (!node) return; 624 if (disableOutsidePointerEvents) { 625 if (context2.layersWithOutsidePointerEventsDisabled.size === 0) { 626 originalBodyPointerEvents = ownerDocument.body.style.pointerEvents; 627 ownerDocument.body.style.pointerEvents = "none"; 628 } 629 context2.layersWithOutsidePointerEventsDisabled.add(node); 630 } 631 context2.layers.add(node); 632 dispatchUpdate(); 633 return () => { 634 if (disableOutsidePointerEvents && context2.layersWithOutsidePointerEventsDisabled.size === 1) { 635 ownerDocument.body.style.pointerEvents = originalBodyPointerEvents; 636 } 637 }; 638 }, [node, ownerDocument, disableOutsidePointerEvents, context2]); 639 React11.useEffect(() => { 640 return () => { 641 if (!node) return; 642 context2.layers.delete(node); 643 context2.layersWithOutsidePointerEventsDisabled.delete(node); 644 dispatchUpdate(); 645 }; 646 }, [node, context2]); 647 React11.useEffect(() => { 648 const handleUpdate = () => force({}); 649 document.addEventListener(CONTEXT_UPDATE, handleUpdate); 650 return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate); 651 }, []); 652 return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( 653 Primitive.div, 654 { 655 ...layerProps, 656 ref: composedRefs, 657 style: { 658 pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0, 659 ...props.style 660 }, 661 onFocusCapture: composeEventHandlers2(props.onFocusCapture, focusOutside.onFocusCapture), 662 onBlurCapture: composeEventHandlers2(props.onBlurCapture, focusOutside.onBlurCapture), 663 onPointerDownCapture: composeEventHandlers2( 664 props.onPointerDownCapture, 665 pointerDownOutside.onPointerDownCapture 666 ) 667 } 668 ); 669 } 670 ); 671 DismissableLayer.displayName = DISMISSABLE_LAYER_NAME; 672 var BRANCH_NAME = "DismissableLayerBranch"; 673 var DismissableLayerBranch = React11.forwardRef((props, forwardedRef) => { 674 const context2 = React11.useContext(DismissableLayerContext); 675 const ref = React11.useRef(null); 676 const composedRefs = useComposedRefs2(forwardedRef, ref); 677 React11.useEffect(() => { 678 const node = ref.current; 679 if (node) { 680 context2.branches.add(node); 681 return () => { 682 context2.branches.delete(node); 683 }; 684 } 685 }, [context2.branches]); 686 return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Primitive.div, { ...props, ref: composedRefs }); 687 }); 688 DismissableLayerBranch.displayName = BRANCH_NAME; 689 function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) { 690 const handlePointerDownOutside = useCallbackRef(onPointerDownOutside); 691 const isPointerInsideReactTreeRef = React11.useRef(false); 692 const handleClickRef = React11.useRef(() => { 693 }); 694 React11.useEffect(() => { 695 const handlePointerDown = (event) => { 696 if (event.target && !isPointerInsideReactTreeRef.current) { 697 let handleAndDispatchPointerDownOutsideEvent2 = function() { 698 handleAndDispatchCustomEvent( 699 POINTER_DOWN_OUTSIDE, 700 handlePointerDownOutside, 701 eventDetail, 702 { discrete: true } 703 ); 704 }; 705 var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2; 706 const eventDetail = { originalEvent: event }; 707 if (event.pointerType === "touch") { 708 ownerDocument.removeEventListener("click", handleClickRef.current); 709 handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2; 710 ownerDocument.addEventListener("click", handleClickRef.current, { once: true }); 711 } else { 712 handleAndDispatchPointerDownOutsideEvent2(); 713 } 714 } else { 715 ownerDocument.removeEventListener("click", handleClickRef.current); 716 } 717 isPointerInsideReactTreeRef.current = false; 718 }; 719 const timerId = window.setTimeout(() => { 720 ownerDocument.addEventListener("pointerdown", handlePointerDown); 721 }, 0); 722 return () => { 723 window.clearTimeout(timerId); 724 ownerDocument.removeEventListener("pointerdown", handlePointerDown); 725 ownerDocument.removeEventListener("click", handleClickRef.current); 726 }; 727 }, [ownerDocument, handlePointerDownOutside]); 728 return { 729 // ensures we check React component tree (not just DOM tree) 730 onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true 731 }; 732 } 733 function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) { 734 const handleFocusOutside = useCallbackRef(onFocusOutside); 735 const isFocusInsideReactTreeRef = React11.useRef(false); 736 React11.useEffect(() => { 737 const handleFocus = (event) => { 738 if (event.target && !isFocusInsideReactTreeRef.current) { 739 const eventDetail = { originalEvent: event }; 740 handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, { 741 discrete: false 742 }); 743 } 744 }; 745 ownerDocument.addEventListener("focusin", handleFocus); 746 return () => ownerDocument.removeEventListener("focusin", handleFocus); 747 }, [ownerDocument, handleFocusOutside]); 748 return { 749 onFocusCapture: () => isFocusInsideReactTreeRef.current = true, 750 onBlurCapture: () => isFocusInsideReactTreeRef.current = false 751 }; 752 } 753 function dispatchUpdate() { 754 const event = new CustomEvent(CONTEXT_UPDATE); 755 document.dispatchEvent(event); 756 } 757 function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) { 758 const target = detail.originalEvent.target; 759 const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail }); 760 if (handler) target.addEventListener(name, handler, { once: true }); 761 if (discrete) { 762 dispatchDiscreteCustomEvent(target, event); 763 } else { 764 target.dispatchEvent(event); 765 } 766 } 767 768 // node_modules/@radix-ui/react-focus-scope/dist/index.mjs 769 var React16 = __toESM(require_react(), 1); 770 771 // node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.mjs 772 var React12 = __toESM(require_react(), 1); 773 function setRef3(ref, value) { 774 if (typeof ref === "function") { 775 return ref(value); 776 } else if (ref !== null && ref !== void 0) { 777 ref.current = value; 778 } 779 } 780 function composeRefs3(...refs) { 781 return (node) => { 782 let hasCleanup = false; 783 const cleanups = refs.map((ref) => { 784 const cleanup = setRef3(ref, node); 785 if (!hasCleanup && typeof cleanup == "function") { 786 hasCleanup = true; 787 } 788 return cleanup; 789 }); 790 if (hasCleanup) { 791 return () => { 792 for (let i = 0; i < cleanups.length; i++) { 793 const cleanup = cleanups[i]; 794 if (typeof cleanup == "function") { 795 cleanup(); 796 } else { 797 setRef3(refs[i], null); 798 } 799 } 800 }; 801 } 802 }; 803 } 804 function useComposedRefs3(...refs) { 805 return React12.useCallback(composeRefs3(...refs), refs); 806 } 807 808 // node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.mjs 809 var React14 = __toESM(require_react(), 1); 810 var ReactDOM2 = __toESM(require_react_dom(), 1); 811 812 // node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-slot/dist/index.mjs 813 var React13 = __toESM(require_react(), 1); 814 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 815 // @__NO_SIDE_EFFECTS__ 816 function createSlot2(ownerName) { 817 const SlotClone = /* @__PURE__ */ createSlotClone2(ownerName); 818 const Slot2 = React13.forwardRef((props, forwardedRef) => { 819 const { children, ...slotProps } = props; 820 const childrenArray = React13.Children.toArray(children); 821 const slottable = childrenArray.find(isSlottable2); 822 if (slottable) { 823 const newElement = slottable.props.children; 824 const newChildren = childrenArray.map((child) => { 825 if (child === slottable) { 826 if (React13.Children.count(newElement) > 1) return React13.Children.only(null); 827 return React13.isValidElement(newElement) ? newElement.props.children : null; 828 } else { 829 return child; 830 } 831 }); 832 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React13.isValidElement(newElement) ? React13.cloneElement(newElement, void 0, newChildren) : null }); 833 } 834 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children }); 835 }); 836 Slot2.displayName = `$ownerName}.Slot`; 837 return Slot2; 838 } 839 // @__NO_SIDE_EFFECTS__ 840 function createSlotClone2(ownerName) { 841 const SlotClone = React13.forwardRef((props, forwardedRef) => { 842 const { children, ...slotProps } = props; 843 if (React13.isValidElement(children)) { 844 const childrenRef = getElementRef2(children); 845 const props2 = mergeProps2(slotProps, children.props); 846 if (children.type !== React13.Fragment) { 847 props2.ref = forwardedRef ? composeRefs3(forwardedRef, childrenRef) : childrenRef; 848 } 849 return React13.cloneElement(children, props2); 850 } 851 return React13.Children.count(children) > 1 ? React13.Children.only(null) : null; 852 }); 853 SlotClone.displayName = `$ownerName}.SlotClone`; 854 return SlotClone; 855 } 856 var SLOTTABLE_IDENTIFIER2 = /* @__PURE__ */ Symbol("radix.slottable"); 857 function isSlottable2(child) { 858 return React13.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER2; 859 } 860 function mergeProps2(slotProps, childProps) { 861 const overrideProps = { ...childProps }; 862 for (const propName in childProps) { 863 const slotPropValue = slotProps[propName]; 864 const childPropValue = childProps[propName]; 865 const isHandler = /^on[A-Z]/.test(propName); 866 if (isHandler) { 867 if (slotPropValue && childPropValue) { 868 overrideProps[propName] = (...args) => { 869 const result = childPropValue(...args); 870 slotPropValue(...args); 871 return result; 872 }; 873 } else if (slotPropValue) { 874 overrideProps[propName] = slotPropValue; 875 } 876 } else if (propName === "style") { 877 overrideProps[propName] = { ...slotPropValue, ...childPropValue }; 878 } else if (propName === "className") { 879 overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" "); 880 } 881 } 882 return { ...slotProps, ...overrideProps }; 883 } 884 function getElementRef2(element) { 885 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get; 886 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 887 if (mayWarn) { 888 return element.ref; 889 } 890 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get; 891 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 892 if (mayWarn) { 893 return element.props.ref; 894 } 895 return element.props.ref || element.ref; 896 } 897 898 // node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.mjs 899 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 900 var NODES2 = [ 901 "a", 902 "button", 903 "div", 904 "form", 905 "h2", 906 "h3", 907 "img", 908 "input", 909 "label", 910 "li", 911 "nav", 912 "ol", 913 "p", 914 "select", 915 "span", 916 "svg", 917 "ul" 918 ]; 919 var Primitive2 = NODES2.reduce((primitive, node) => { 920 const Slot2 = createSlot2(`Primitive.$node}`); 921 const Node2 = React14.forwardRef((props, forwardedRef) => { 922 const { asChild, ...primitiveProps } = props; 923 const Comp = asChild ? Slot2 : node; 924 if (typeof window !== "undefined") { 925 window[/* @__PURE__ */ Symbol.for("radix-ui")] = true; 926 } 927 return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Comp, { ...primitiveProps, ref: forwardedRef }); 928 }); 929 Node2.displayName = `Primitive.$node}`; 930 return { ...primitive, [node]: Node2 }; 931 }, {}); 932 933 // node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs 934 var React15 = __toESM(require_react(), 1); 935 function useCallbackRef2(callback) { 936 const callbackRef = React15.useRef(callback); 937 React15.useEffect(() => { 938 callbackRef.current = callback; 939 }); 940 return React15.useMemo(() => (...args) => callbackRef.current?.(...args), []); 941 } 942 943 // node_modules/@radix-ui/react-focus-scope/dist/index.mjs 944 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 945 var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount"; 946 var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount"; 947 var EVENT_OPTIONS = { bubbles: false, cancelable: true }; 948 var FOCUS_SCOPE_NAME = "FocusScope"; 949 var FocusScope = React16.forwardRef((props, forwardedRef) => { 950 const { 951 loop = false, 952 trapped = false, 953 onMountAutoFocus: onMountAutoFocusProp, 954 onUnmountAutoFocus: onUnmountAutoFocusProp, 955 ...scopeProps 956 } = props; 957 const [container, setContainer] = React16.useState(null); 958 const onMountAutoFocus = useCallbackRef2(onMountAutoFocusProp); 959 const onUnmountAutoFocus = useCallbackRef2(onUnmountAutoFocusProp); 960 const lastFocusedElementRef = React16.useRef(null); 961 const composedRefs = useComposedRefs3(forwardedRef, (node) => setContainer(node)); 962 const focusScope = React16.useRef({ 963 paused: false, 964 pause() { 965 this.paused = true; 966 }, 967 resume() { 968 this.paused = false; 969 } 970 }).current; 971 React16.useEffect(() => { 972 if (trapped) { 973 let handleFocusIn2 = function(event) { 974 if (focusScope.paused || !container) return; 975 const target = event.target; 976 if (container.contains(target)) { 977 lastFocusedElementRef.current = target; 978 } else { 979 focus(lastFocusedElementRef.current, { select: true }); 980 } 981 }, handleFocusOut2 = function(event) { 982 if (focusScope.paused || !container) return; 983 const relatedTarget = event.relatedTarget; 984 if (relatedTarget === null) return; 985 if (!container.contains(relatedTarget)) { 986 focus(lastFocusedElementRef.current, { select: true }); 987 } 988 }, handleMutations2 = function(mutations) { 989 const focusedElement = document.activeElement; 990 if (focusedElement !== document.body) return; 991 for (const mutation of mutations) { 992 if (mutation.removedNodes.length > 0) focus(container); 993 } 994 }; 995 var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2; 996 document.addEventListener("focusin", handleFocusIn2); 997 document.addEventListener("focusout", handleFocusOut2); 998 const mutationObserver = new MutationObserver(handleMutations2); 999 if (container) mutationObserver.observe(container, { childList: true, subtree: true }); 1000 return () => { 1001 document.removeEventListener("focusin", handleFocusIn2); 1002 document.removeEventListener("focusout", handleFocusOut2); 1003 mutationObserver.disconnect(); 1004 }; 1005 } 1006 }, [trapped, container, focusScope.paused]); 1007 React16.useEffect(() => { 1008 if (container) { 1009 focusScopesStack.add(focusScope); 1010 const previouslyFocusedElement = document.activeElement; 1011 const hasFocusedCandidate = container.contains(previouslyFocusedElement); 1012 if (!hasFocusedCandidate) { 1013 const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS); 1014 container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus); 1015 container.dispatchEvent(mountEvent); 1016 if (!mountEvent.defaultPrevented) { 1017 focusFirst(removeLinks(getTabbableCandidates(container)), { select: true }); 1018 if (document.activeElement === previouslyFocusedElement) { 1019 focus(container); 1020 } 1021 } 1022 } 1023 return () => { 1024 container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus); 1025 setTimeout(() => { 1026 const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS); 1027 container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); 1028 container.dispatchEvent(unmountEvent); 1029 if (!unmountEvent.defaultPrevented) { 1030 focus(previouslyFocusedElement ?? document.body, { select: true }); 1031 } 1032 container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); 1033 focusScopesStack.remove(focusScope); 1034 }, 0); 1035 }; 1036 } 1037 }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]); 1038 const handleKeyDown = React16.useCallback( 1039 (event) => { 1040 if (!loop && !trapped) return; 1041 if (focusScope.paused) return; 1042 const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey; 1043 const focusedElement = document.activeElement; 1044 if (isTabKey && focusedElement) { 1045 const container2 = event.currentTarget; 1046 const [first, last] = getTabbableEdges(container2); 1047 const hasTabbableElementsInside = first && last; 1048 if (!hasTabbableElementsInside) { 1049 if (focusedElement === container2) event.preventDefault(); 1050 } else { 1051 if (!event.shiftKey && focusedElement === last) { 1052 event.preventDefault(); 1053 if (loop) focus(first, { select: true }); 1054 } else if (event.shiftKey && focusedElement === first) { 1055 event.preventDefault(); 1056 if (loop) focus(last, { select: true }); 1057 } 1058 } 1059 } 1060 }, 1061 [loop, trapped, focusScope.paused] 1062 ); 1063 return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Primitive2.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown }); 1064 }); 1065 FocusScope.displayName = FOCUS_SCOPE_NAME; 1066 function focusFirst(candidates, { select = false } = {}) { 1067 const previouslyFocusedElement = document.activeElement; 1068 for (const candidate of candidates) { 1069 focus(candidate, { select }); 1070 if (document.activeElement !== previouslyFocusedElement) return; 1071 } 1072 } 1073 function getTabbableEdges(container) { 1074 const candidates = getTabbableCandidates(container); 1075 const first = findVisible(candidates, container); 1076 const last = findVisible(candidates.reverse(), container); 1077 return [first, last]; 1078 } 1079 function getTabbableCandidates(container) { 1080 const nodes = []; 1081 const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { 1082 acceptNode: (node) => { 1083 const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden"; 1084 if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; 1085 return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; 1086 } 1087 }); 1088 while (walker.nextNode()) nodes.push(walker.currentNode); 1089 return nodes; 1090 } 1091 function findVisible(elements, container) { 1092 for (const element of elements) { 1093 if (!isHidden(element, { upTo: container })) return element; 1094 } 1095 } 1096 function isHidden(node, { upTo }) { 1097 if (getComputedStyle(node).visibility === "hidden") return true; 1098 while (node) { 1099 if (upTo !== void 0 && node === upTo) return false; 1100 if (getComputedStyle(node).display === "none") return true; 1101 node = node.parentElement; 1102 } 1103 return false; 1104 } 1105 function isSelectableInput(element) { 1106 return element instanceof HTMLInputElement && "select" in element; 1107 } 1108 function focus(element, { select = false } = {}) { 1109 if (element && element.focus) { 1110 const previouslyFocusedElement = document.activeElement; 1111 element.focus({ preventScroll: true }); 1112 if (element !== previouslyFocusedElement && isSelectableInput(element) && select) 1113 element.select(); 1114 } 1115 } 1116 var focusScopesStack = createFocusScopesStack(); 1117 function createFocusScopesStack() { 1118 let stack = []; 1119 return { 1120 add(focusScope) { 1121 const activeFocusScope = stack[0]; 1122 if (focusScope !== activeFocusScope) { 1123 activeFocusScope?.pause(); 1124 } 1125 stack = arrayRemove(stack, focusScope); 1126 stack.unshift(focusScope); 1127 }, 1128 remove(focusScope) { 1129 stack = arrayRemove(stack, focusScope); 1130 stack[0]?.resume(); 1131 } 1132 }; 1133 } 1134 function arrayRemove(array, item) { 1135 const updatedArray = [...array]; 1136 const index = updatedArray.indexOf(item); 1137 if (index !== -1) { 1138 updatedArray.splice(index, 1); 1139 } 1140 return updatedArray; 1141 } 1142 function removeLinks(items) { 1143 return items.filter((item) => item.tagName !== "A"); 1144 } 1145 1146 // node_modules/@radix-ui/react-portal/dist/index.mjs 1147 var React21 = __toESM(require_react(), 1); 1148 var import_react_dom = __toESM(require_react_dom(), 1); 1149 1150 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-primitive/dist/index.mjs 1151 var React19 = __toESM(require_react(), 1); 1152 var ReactDOM3 = __toESM(require_react_dom(), 1); 1153 1154 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-slot/dist/index.mjs 1155 var React18 = __toESM(require_react(), 1); 1156 1157 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-compose-refs/dist/index.mjs 1158 var React17 = __toESM(require_react(), 1); 1159 function setRef4(ref, value) { 1160 if (typeof ref === "function") { 1161 return ref(value); 1162 } else if (ref !== null && ref !== void 0) { 1163 ref.current = value; 1164 } 1165 } 1166 function composeRefs4(...refs) { 1167 return (node) => { 1168 let hasCleanup = false; 1169 const cleanups = refs.map((ref) => { 1170 const cleanup = setRef4(ref, node); 1171 if (!hasCleanup && typeof cleanup == "function") { 1172 hasCleanup = true; 1173 } 1174 return cleanup; 1175 }); 1176 if (hasCleanup) { 1177 return () => { 1178 for (let i = 0; i < cleanups.length; i++) { 1179 const cleanup = cleanups[i]; 1180 if (typeof cleanup == "function") { 1181 cleanup(); 1182 } else { 1183 setRef4(refs[i], null); 1184 } 1185 } 1186 }; 1187 } 1188 }; 1189 } 1190 1191 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-slot/dist/index.mjs 1192 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 1193 // @__NO_SIDE_EFFECTS__ 1194 function createSlot3(ownerName) { 1195 const SlotClone = /* @__PURE__ */ createSlotClone3(ownerName); 1196 const Slot2 = React18.forwardRef((props, forwardedRef) => { 1197 const { children, ...slotProps } = props; 1198 const childrenArray = React18.Children.toArray(children); 1199 const slottable = childrenArray.find(isSlottable3); 1200 if (slottable) { 1201 const newElement = slottable.props.children; 1202 const newChildren = childrenArray.map((child) => { 1203 if (child === slottable) { 1204 if (React18.Children.count(newElement) > 1) return React18.Children.only(null); 1205 return React18.isValidElement(newElement) ? newElement.props.children : null; 1206 } else { 1207 return child; 1208 } 1209 }); 1210 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React18.isValidElement(newElement) ? React18.cloneElement(newElement, void 0, newChildren) : null }); 1211 } 1212 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children }); 1213 }); 1214 Slot2.displayName = `$ownerName}.Slot`; 1215 return Slot2; 1216 } 1217 // @__NO_SIDE_EFFECTS__ 1218 function createSlotClone3(ownerName) { 1219 const SlotClone = React18.forwardRef((props, forwardedRef) => { 1220 const { children, ...slotProps } = props; 1221 if (React18.isValidElement(children)) { 1222 const childrenRef = getElementRef3(children); 1223 const props2 = mergeProps3(slotProps, children.props); 1224 if (children.type !== React18.Fragment) { 1225 props2.ref = forwardedRef ? composeRefs4(forwardedRef, childrenRef) : childrenRef; 1226 } 1227 return React18.cloneElement(children, props2); 1228 } 1229 return React18.Children.count(children) > 1 ? React18.Children.only(null) : null; 1230 }); 1231 SlotClone.displayName = `$ownerName}.SlotClone`; 1232 return SlotClone; 1233 } 1234 var SLOTTABLE_IDENTIFIER3 = /* @__PURE__ */ Symbol("radix.slottable"); 1235 function isSlottable3(child) { 1236 return React18.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER3; 1237 } 1238 function mergeProps3(slotProps, childProps) { 1239 const overrideProps = { ...childProps }; 1240 for (const propName in childProps) { 1241 const slotPropValue = slotProps[propName]; 1242 const childPropValue = childProps[propName]; 1243 const isHandler = /^on[A-Z]/.test(propName); 1244 if (isHandler) { 1245 if (slotPropValue && childPropValue) { 1246 overrideProps[propName] = (...args) => { 1247 const result = childPropValue(...args); 1248 slotPropValue(...args); 1249 return result; 1250 }; 1251 } else if (slotPropValue) { 1252 overrideProps[propName] = slotPropValue; 1253 } 1254 } else if (propName === "style") { 1255 overrideProps[propName] = { ...slotPropValue, ...childPropValue }; 1256 } else if (propName === "className") { 1257 overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" "); 1258 } 1259 } 1260 return { ...slotProps, ...overrideProps }; 1261 } 1262 function getElementRef3(element) { 1263 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get; 1264 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 1265 if (mayWarn) { 1266 return element.ref; 1267 } 1268 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get; 1269 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 1270 if (mayWarn) { 1271 return element.props.ref; 1272 } 1273 return element.props.ref || element.ref; 1274 } 1275 1276 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-primitive/dist/index.mjs 1277 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 1278 var NODES3 = [ 1279 "a", 1280 "button", 1281 "div", 1282 "form", 1283 "h2", 1284 "h3", 1285 "img", 1286 "input", 1287 "label", 1288 "li", 1289 "nav", 1290 "ol", 1291 "p", 1292 "select", 1293 "span", 1294 "svg", 1295 "ul" 1296 ]; 1297 var Primitive3 = NODES3.reduce((primitive, node) => { 1298 const Slot2 = createSlot3(`Primitive.$node}`); 1299 const Node2 = React19.forwardRef((props, forwardedRef) => { 1300 const { asChild, ...primitiveProps } = props; 1301 const Comp = asChild ? Slot2 : node; 1302 if (typeof window !== "undefined") { 1303 window[/* @__PURE__ */ Symbol.for("radix-ui")] = true; 1304 } 1305 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Comp, { ...primitiveProps, ref: forwardedRef }); 1306 }); 1307 Node2.displayName = `Primitive.$node}`; 1308 return { ...primitive, [node]: Node2 }; 1309 }, {}); 1310 1311 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs 1312 var React20 = __toESM(require_react(), 1); 1313 var useLayoutEffect22 = globalThis?.document ? React20.useLayoutEffect : () => { 1314 }; 1315 1316 // node_modules/@radix-ui/react-portal/dist/index.mjs 1317 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 1318 var PORTAL_NAME = "Portal"; 1319 var Portal = React21.forwardRef((props, forwardedRef) => { 1320 const { container: containerProp, ...portalProps } = props; 1321 const [mounted, setMounted] = React21.useState(false); 1322 useLayoutEffect22(() => setMounted(true), []); 1323 const container = containerProp || mounted && globalThis?.document?.body; 1324 return container ? import_react_dom.default.createPortal(/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Primitive3.div, { ...portalProps, ref: forwardedRef }), container) : null; 1325 }); 1326 Portal.displayName = PORTAL_NAME; 1327 1328 // node_modules/@radix-ui/react-presence/dist/index.mjs 1329 var React25 = __toESM(require_react(), 1); 1330 1331 // node_modules/@radix-ui/react-presence/node_modules/@radix-ui/react-compose-refs/dist/index.mjs 1332 var React23 = __toESM(require_react(), 1); 1333 function setRef5(ref, value) { 1334 if (typeof ref === "function") { 1335 return ref(value); 1336 } else if (ref !== null && ref !== void 0) { 1337 ref.current = value; 1338 } 1339 } 1340 function composeRefs5(...refs) { 1341 return (node) => { 1342 let hasCleanup = false; 1343 const cleanups = refs.map((ref) => { 1344 const cleanup = setRef5(ref, node); 1345 if (!hasCleanup && typeof cleanup == "function") { 1346 hasCleanup = true; 1347 } 1348 return cleanup; 1349 }); 1350 if (hasCleanup) { 1351 return () => { 1352 for (let i = 0; i < cleanups.length; i++) { 1353 const cleanup = cleanups[i]; 1354 if (typeof cleanup == "function") { 1355 cleanup(); 1356 } else { 1357 setRef5(refs[i], null); 1358 } 1359 } 1360 }; 1361 } 1362 }; 1363 } 1364 function useComposedRefs4(...refs) { 1365 return React23.useCallback(composeRefs5(...refs), refs); 1366 } 1367 1368 // node_modules/@radix-ui/react-presence/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs 1369 var React24 = __toESM(require_react(), 1); 1370 var useLayoutEffect23 = globalThis?.document ? React24.useLayoutEffect : () => { 1371 }; 1372 1373 // node_modules/@radix-ui/react-presence/dist/index.mjs 1374 var React26 = __toESM(require_react(), 1); 1375 function useStateMachine(initialState, machine) { 1376 return React26.useReducer((state, event) => { 1377 const nextState = machine[state][event]; 1378 return nextState ?? state; 1379 }, initialState); 1380 } 1381 var Presence = (props) => { 1382 const { present, children } = props; 1383 const presence = usePresence(present); 1384 const child = typeof children === "function" ? children({ present: presence.isPresent }) : React25.Children.only(children); 1385 const ref = useComposedRefs4(presence.ref, getElementRef4(child)); 1386 const forceMount = typeof children === "function"; 1387 return forceMount || presence.isPresent ? React25.cloneElement(child, { ref }) : null; 1388 }; 1389 Presence.displayName = "Presence"; 1390 function usePresence(present) { 1391 const [node, setNode] = React25.useState(); 1392 const stylesRef = React25.useRef(null); 1393 const prevPresentRef = React25.useRef(present); 1394 const prevAnimationNameRef = React25.useRef("none"); 1395 const initialState = present ? "mounted" : "unmounted"; 1396 const [state, send] = useStateMachine(initialState, { 1397 mounted: { 1398 UNMOUNT: "unmounted", 1399 ANIMATION_OUT: "unmountSuspended" 1400 }, 1401 unmountSuspended: { 1402 MOUNT: "mounted", 1403 ANIMATION_END: "unmounted" 1404 }, 1405 unmounted: { 1406 MOUNT: "mounted" 1407 } 1408 }); 1409 React25.useEffect(() => { 1410 const currentAnimationName = getAnimationName(stylesRef.current); 1411 prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none"; 1412 }, [state]); 1413 useLayoutEffect23(() => { 1414 const styles = stylesRef.current; 1415 const wasPresent = prevPresentRef.current; 1416 const hasPresentChanged = wasPresent !== present; 1417 if (hasPresentChanged) { 1418 const prevAnimationName = prevAnimationNameRef.current; 1419 const currentAnimationName = getAnimationName(styles); 1420 if (present) { 1421 send("MOUNT"); 1422 } else if (currentAnimationName === "none" || styles?.display === "none") { 1423 send("UNMOUNT"); 1424 } else { 1425 const isAnimating = prevAnimationName !== currentAnimationName; 1426 if (wasPresent && isAnimating) { 1427 send("ANIMATION_OUT"); 1428 } else { 1429 send("UNMOUNT"); 1430 } 1431 } 1432 prevPresentRef.current = present; 1433 } 1434 }, [present, send]); 1435 useLayoutEffect23(() => { 1436 if (node) { 1437 let timeoutId; 1438 const ownerWindow = node.ownerDocument.defaultView ?? window; 1439 const handleAnimationEnd = (event) => { 1440 const currentAnimationName = getAnimationName(stylesRef.current); 1441 const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName)); 1442 if (event.target === node && isCurrentAnimation) { 1443 send("ANIMATION_END"); 1444 if (!prevPresentRef.current) { 1445 const currentFillMode = node.style.animationFillMode; 1446 node.style.animationFillMode = "forwards"; 1447 timeoutId = ownerWindow.setTimeout(() => { 1448 if (node.style.animationFillMode === "forwards") { 1449 node.style.animationFillMode = currentFillMode; 1450 } 1451 }); 1452 } 1453 } 1454 }; 1455 const handleAnimationStart = (event) => { 1456 if (event.target === node) { 1457 prevAnimationNameRef.current = getAnimationName(stylesRef.current); 1458 } 1459 }; 1460 node.addEventListener("animationstart", handleAnimationStart); 1461 node.addEventListener("animationcancel", handleAnimationEnd); 1462 node.addEventListener("animationend", handleAnimationEnd); 1463 return () => { 1464 ownerWindow.clearTimeout(timeoutId); 1465 node.removeEventListener("animationstart", handleAnimationStart); 1466 node.removeEventListener("animationcancel", handleAnimationEnd); 1467 node.removeEventListener("animationend", handleAnimationEnd); 1468 }; 1469 } else { 1470 send("ANIMATION_END"); 1471 } 1472 }, [node, send]); 1473 return { 1474 isPresent: ["mounted", "unmountSuspended"].includes(state), 1475 ref: React25.useCallback((node2) => { 1476 stylesRef.current = node2 ? getComputedStyle(node2) : null; 1477 setNode(node2); 1478 }, []) 1479 }; 1480 } 1481 function getAnimationName(styles) { 1482 return styles?.animationName || "none"; 1483 } 1484 function getElementRef4(element) { 1485 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get; 1486 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 1487 if (mayWarn) { 1488 return element.ref; 1489 } 1490 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get; 1491 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 1492 if (mayWarn) { 1493 return element.props.ref; 1494 } 1495 return element.props.ref || element.ref; 1496 } 1497 1498 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.mjs 1499 var React28 = __toESM(require_react(), 1); 1500 var ReactDOM5 = __toESM(require_react_dom(), 1); 1501 1502 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot/dist/index.mjs 1503 var React27 = __toESM(require_react(), 1); 1504 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 1505 // @__NO_SIDE_EFFECTS__ 1506 function createSlot4(ownerName) { 1507 const SlotClone = /* @__PURE__ */ createSlotClone4(ownerName); 1508 const Slot2 = React27.forwardRef((props, forwardedRef) => { 1509 const { children, ...slotProps } = props; 1510 const childrenArray = React27.Children.toArray(children); 1511 const slottable = childrenArray.find(isSlottable4); 1512 if (slottable) { 1513 const newElement = slottable.props.children; 1514 const newChildren = childrenArray.map((child) => { 1515 if (child === slottable) { 1516 if (React27.Children.count(newElement) > 1) return React27.Children.only(null); 1517 return React27.isValidElement(newElement) ? newElement.props.children : null; 1518 } else { 1519 return child; 1520 } 1521 }); 1522 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React27.isValidElement(newElement) ? React27.cloneElement(newElement, void 0, newChildren) : null }); 1523 } 1524 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children }); 1525 }); 1526 Slot2.displayName = `$ownerName}.Slot`; 1527 return Slot2; 1528 } 1529 // @__NO_SIDE_EFFECTS__ 1530 function createSlotClone4(ownerName) { 1531 const SlotClone = React27.forwardRef((props, forwardedRef) => { 1532 const { children, ...slotProps } = props; 1533 if (React27.isValidElement(children)) { 1534 const childrenRef = getElementRef5(children); 1535 const props2 = mergeProps4(slotProps, children.props); 1536 if (children.type !== React27.Fragment) { 1537 props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef; 1538 } 1539 return React27.cloneElement(children, props2); 1540 } 1541 return React27.Children.count(children) > 1 ? React27.Children.only(null) : null; 1542 }); 1543 SlotClone.displayName = `$ownerName}.SlotClone`; 1544 return SlotClone; 1545 } 1546 var SLOTTABLE_IDENTIFIER4 = /* @__PURE__ */ Symbol("radix.slottable"); 1547 function isSlottable4(child) { 1548 return React27.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER4; 1549 } 1550 function mergeProps4(slotProps, childProps) { 1551 const overrideProps = { ...childProps }; 1552 for (const propName in childProps) { 1553 const slotPropValue = slotProps[propName]; 1554 const childPropValue = childProps[propName]; 1555 const isHandler = /^on[A-Z]/.test(propName); 1556 if (isHandler) { 1557 if (slotPropValue && childPropValue) { 1558 overrideProps[propName] = (...args) => { 1559 const result = childPropValue(...args); 1560 slotPropValue(...args); 1561 return result; 1562 }; 1563 } else if (slotPropValue) { 1564 overrideProps[propName] = slotPropValue; 1565 } 1566 } else if (propName === "style") { 1567 overrideProps[propName] = { ...slotPropValue, ...childPropValue }; 1568 } else if (propName === "className") { 1569 overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" "); 1570 } 1571 } 1572 return { ...slotProps, ...overrideProps }; 1573 } 1574 function getElementRef5(element) { 1575 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get; 1576 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 1577 if (mayWarn) { 1578 return element.ref; 1579 } 1580 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get; 1581 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 1582 if (mayWarn) { 1583 return element.props.ref; 1584 } 1585 return element.props.ref || element.ref; 1586 } 1587 1588 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.mjs 1589 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 1590 var NODES4 = [ 1591 "a", 1592 "button", 1593 "div", 1594 "form", 1595 "h2", 1596 "h3", 1597 "img", 1598 "input", 1599 "label", 1600 "li", 1601 "nav", 1602 "ol", 1603 "p", 1604 "select", 1605 "span", 1606 "svg", 1607 "ul" 1608 ]; 1609 var Primitive4 = NODES4.reduce((primitive, node) => { 1610 const Slot2 = createSlot4(`Primitive.$node}`); 1611 const Node2 = React28.forwardRef((props, forwardedRef) => { 1612 const { asChild, ...primitiveProps } = props; 1613 const Comp = asChild ? Slot2 : node; 1614 if (typeof window !== "undefined") { 1615 window[/* @__PURE__ */ Symbol.for("radix-ui")] = true; 1616 } 1617 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Comp, { ...primitiveProps, ref: forwardedRef }); 1618 }); 1619 Node2.displayName = `Primitive.$node}`; 1620 return { ...primitive, [node]: Node2 }; 1621 }, {}); 1622 1623 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-guards/dist/index.mjs 1624 var React29 = __toESM(require_react(), 1); 1625 var count2 = 0; 1626 function useFocusGuards() { 1627 React29.useEffect(() => { 1628 const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]"); 1629 document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard()); 1630 document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard()); 1631 count2++; 1632 return () => { 1633 if (count2 === 1) { 1634 document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove()); 1635 } 1636 count2--; 1637 }; 1638 }, []); 1639 } 1640 function createFocusGuard() { 1641 const element = document.createElement("span"); 1642 element.setAttribute("data-radix-focus-guard", ""); 1643 element.tabIndex = 0; 1644 element.style.outline = "none"; 1645 element.style.opacity = "0"; 1646 element.style.position = "fixed"; 1647 element.style.pointerEvents = "none"; 1648 return element; 1649 } 1650 1651 // node_modules/tslib/tslib.es6.mjs 1652 var __assign = function() { 1653 __assign = Object.assign || function __assign2(t2) { 1654 for (var s, i = 1, n = arguments.length; i < n; i++) { 1655 s = arguments[i]; 1656 for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2)) t2[p2] = s[p2]; 1657 } 1658 return t2; 1659 }; 1660 return __assign.apply(this, arguments); 1661 }; 1662 function __rest(s, e) { 1663 var t2 = {}; 1664 for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2) && e.indexOf(p2) < 0) 1665 t2[p2] = s[p2]; 1666 if (s != null && typeof Object.getOwnPropertySymbols === "function") 1667 for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++) { 1668 if (e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i])) 1669 t2[p2[i]] = s[p2[i]]; 1670 } 1671 return t2; 1672 } 1673 function __spreadArray(to, from, pack) { 1674 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 1675 if (ar || !(i in from)) { 1676 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 1677 ar[i] = from[i]; 1678 } 1679 } 1680 return to.concat(ar || Array.prototype.slice.call(from)); 1681 } 1682 1683 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js 1684 var React36 = __toESM(require_react()); 1685 1686 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js 1687 var React32 = __toESM(require_react()); 1688 1689 // node_modules/react-remove-scroll-bar/dist/es2015/constants.js 1690 var zeroRightClassName = "right-scroll-bar-position"; 1691 var fullWidthClassName = "width-before-scroll-bar"; 1692 var noScrollbarsClassName = "with-scroll-bars-hidden"; 1693 var removedBarSizeVariable = "--removed-body-scroll-bar-size"; 1694 1695 // node_modules/use-callback-ref/dist/es2015/assignRef.js 1696 function assignRef(ref, value) { 1697 if (typeof ref === "function") { 1698 ref(value); 1699 } else if (ref) { 1700 ref.current = value; 1701 } 1702 return ref; 1703 } 1704 1705 // node_modules/use-callback-ref/dist/es2015/useRef.js 1706 var import_react = __toESM(require_react()); 1707 function useCallbackRef3(initialValue, callback) { 1708 var ref = (0, import_react.useState)(function() { 1709 return { 1710 // value 1711 value: initialValue, 1712 // last callback 1713 callback, 1714 // "memoized" public interface 1715 facade: { 1716 get current() { 1717 return ref.value; 1718 }, 1719 set current(value) { 1720 var last = ref.value; 1721 if (last !== value) { 1722 ref.value = value; 1723 ref.callback(value, last); 1724 } 1725 } 1726 } 1727 }; 1728 })[0]; 1729 ref.callback = callback; 1730 return ref.facade; 1731 } 1732 1733 // node_modules/use-callback-ref/dist/es2015/useMergeRef.js 1734 var React30 = __toESM(require_react()); 1735 var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React30.useLayoutEffect : React30.useEffect; 1736 var currentValues = /* @__PURE__ */ new WeakMap(); 1737 function useMergeRefs(refs, defaultValue) { 1738 var callbackRef = useCallbackRef3(defaultValue || null, function(newValue) { 1739 return refs.forEach(function(ref) { 1740 return assignRef(ref, newValue); 1741 }); 1742 }); 1743 useIsomorphicLayoutEffect(function() { 1744 var oldValue = currentValues.get(callbackRef); 1745 if (oldValue) { 1746 var prevRefs_1 = new Set(oldValue); 1747 var nextRefs_1 = new Set(refs); 1748 var current_1 = callbackRef.current; 1749 prevRefs_1.forEach(function(ref) { 1750 if (!nextRefs_1.has(ref)) { 1751 assignRef(ref, null); 1752 } 1753 }); 1754 nextRefs_1.forEach(function(ref) { 1755 if (!prevRefs_1.has(ref)) { 1756 assignRef(ref, current_1); 1757 } 1758 }); 1759 } 1760 currentValues.set(callbackRef, refs); 1761 }, [refs]); 1762 return callbackRef; 1763 } 1764 1765 // node_modules/use-sidecar/dist/es2015/medium.js 1766 function ItoI(a) { 1767 return a; 1768 } 1769 function innerCreateMedium(defaults, middleware) { 1770 if (middleware === void 0) { 1771 middleware = ItoI; 1772 } 1773 var buffer = []; 1774 var assigned = false; 1775 var medium = { 1776 read: function() { 1777 if (assigned) { 1778 throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`."); 1779 } 1780 if (buffer.length) { 1781 return buffer[buffer.length - 1]; 1782 } 1783 return defaults; 1784 }, 1785 useMedium: function(data) { 1786 var item = middleware(data, assigned); 1787 buffer.push(item); 1788 return function() { 1789 buffer = buffer.filter(function(x) { 1790 return x !== item; 1791 }); 1792 }; 1793 }, 1794 assignSyncMedium: function(cb) { 1795 assigned = true; 1796 while (buffer.length) { 1797 var cbs = buffer; 1798 buffer = []; 1799 cbs.forEach(cb); 1800 } 1801 buffer = { 1802 push: function(x) { 1803 return cb(x); 1804 }, 1805 filter: function() { 1806 return buffer; 1807 } 1808 }; 1809 }, 1810 assignMedium: function(cb) { 1811 assigned = true; 1812 var pendingQueue = []; 1813 if (buffer.length) { 1814 var cbs = buffer; 1815 buffer = []; 1816 cbs.forEach(cb); 1817 pendingQueue = buffer; 1818 } 1819 var executeQueue = function() { 1820 var cbs2 = pendingQueue; 1821 pendingQueue = []; 1822 cbs2.forEach(cb); 1823 }; 1824 var cycle = function() { 1825 return Promise.resolve().then(executeQueue); 1826 }; 1827 cycle(); 1828 buffer = { 1829 push: function(x) { 1830 pendingQueue.push(x); 1831 cycle(); 1832 }, 1833 filter: function(filter) { 1834 pendingQueue = pendingQueue.filter(filter); 1835 return buffer; 1836 } 1837 }; 1838 } 1839 }; 1840 return medium; 1841 } 1842 function createSidecarMedium(options) { 1843 if (options === void 0) { 1844 options = {}; 1845 } 1846 var medium = innerCreateMedium(null); 1847 medium.options = __assign({ async: true, ssr: false }, options); 1848 return medium; 1849 } 1850 1851 // node_modules/use-sidecar/dist/es2015/exports.js 1852 var React31 = __toESM(require_react()); 1853 var SideCar = function(_a) { 1854 var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]); 1855 if (!sideCar) { 1856 throw new Error("Sidecar: please provide `sideCar` property to import the right car"); 1857 } 1858 var Target = sideCar.read(); 1859 if (!Target) { 1860 throw new Error("Sidecar medium not found"); 1861 } 1862 return React31.createElement(Target, __assign({}, rest)); 1863 }; 1864 SideCar.isSideCarExport = true; 1865 function exportSidecar(medium, exported) { 1866 medium.useMedium(exported); 1867 return SideCar; 1868 } 1869 1870 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/medium.js 1871 var effectCar = createSidecarMedium(); 1872 1873 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js 1874 var nothing = function() { 1875 return; 1876 }; 1877 var RemoveScroll = React32.forwardRef(function(props, parentRef) { 1878 var ref = React32.useRef(null); 1879 var _a = React32.useState({ 1880 onScrollCapture: nothing, 1881 onWheelCapture: nothing, 1882 onTouchMoveCapture: nothing 1883 }), callbacks = _a[0], setCallbacks = _a[1]; 1884 var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]); 1885 var SideCar2 = sideCar; 1886 var containerRef = useMergeRefs([ref, parentRef]); 1887 var containerProps = __assign(__assign({}, rest), callbacks); 1888 return React32.createElement( 1889 React32.Fragment, 1890 null, 1891 enabled && React32.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }), 1892 forwardProps ? React32.cloneElement(React32.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React32.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children) 1893 ); 1894 }); 1895 RemoveScroll.defaultProps = { 1896 enabled: true, 1897 removeScrollBar: true, 1898 inert: false 1899 }; 1900 RemoveScroll.classNames = { 1901 fullWidth: fullWidthClassName, 1902 zeroRight: zeroRightClassName 1903 }; 1904 1905 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js 1906 var React35 = __toESM(require_react()); 1907 1908 // node_modules/react-remove-scroll-bar/dist/es2015/component.js 1909 var React34 = __toESM(require_react()); 1910 1911 // node_modules/react-style-singleton/dist/es2015/hook.js 1912 var React33 = __toESM(require_react()); 1913 1914 // node_modules/get-nonce/dist/es2015/index.js 1915 var currentNonce; 1916 var getNonce = function() { 1917 if (currentNonce) { 1918 return currentNonce; 1919 } 1920 if (typeof __webpack_nonce__ !== "undefined") { 1921 return __webpack_nonce__; 1922 } 1923 return void 0; 1924 }; 1925 1926 // node_modules/react-style-singleton/dist/es2015/singleton.js 1927 function makeStyleTag() { 1928 if (!document) 1929 return null; 1930 var tag = document.createElement("style"); 1931 tag.type = "text/css"; 1932 var nonce = getNonce(); 1933 if (nonce) { 1934 tag.setAttribute("nonce", nonce); 1935 } 1936 return tag; 1937 } 1938 function injectStyles(tag, css) { 1939 if (tag.styleSheet) { 1940 tag.styleSheet.cssText = css; 1941 } else { 1942 tag.appendChild(document.createTextNode(css)); 1943 } 1944 } 1945 function insertStyleTag(tag) { 1946 var head = document.head || document.getElementsByTagName("head")[0]; 1947 head.appendChild(tag); 1948 } 1949 var stylesheetSingleton = function() { 1950 var counter = 0; 1951 var stylesheet = null; 1952 return { 1953 add: function(style) { 1954 if (counter == 0) { 1955 if (stylesheet = makeStyleTag()) { 1956 injectStyles(stylesheet, style); 1957 insertStyleTag(stylesheet); 1958 } 1959 } 1960 counter++; 1961 }, 1962 remove: function() { 1963 counter--; 1964 if (!counter && stylesheet) { 1965 stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet); 1966 stylesheet = null; 1967 } 1968 } 1969 }; 1970 }; 1971 1972 // node_modules/react-style-singleton/dist/es2015/hook.js 1973 var styleHookSingleton = function() { 1974 var sheet = stylesheetSingleton(); 1975 return function(styles, isDynamic) { 1976 React33.useEffect(function() { 1977 sheet.add(styles); 1978 return function() { 1979 sheet.remove(); 1980 }; 1981 }, [styles && isDynamic]); 1982 }; 1983 }; 1984 1985 // node_modules/react-style-singleton/dist/es2015/component.js 1986 var styleSingleton = function() { 1987 var useStyle = styleHookSingleton(); 1988 var Sheet = function(_a) { 1989 var styles = _a.styles, dynamic = _a.dynamic; 1990 useStyle(styles, dynamic); 1991 return null; 1992 }; 1993 return Sheet; 1994 }; 1995 1996 // node_modules/react-remove-scroll-bar/dist/es2015/utils.js 1997 var zeroGap = { 1998 left: 0, 1999 top: 0, 2000 right: 0, 2001 gap: 0 2002 }; 2003 var parse = function(x) { 2004 return parseInt(x || "", 10) || 0; 2005 }; 2006 var getOffset = function(gapMode) { 2007 var cs = window.getComputedStyle(document.body); 2008 var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"]; 2009 var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"]; 2010 var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"]; 2011 return [parse(left), parse(top), parse(right)]; 2012 }; 2013 var getGapWidth = function(gapMode) { 2014 if (gapMode === void 0) { 2015 gapMode = "margin"; 2016 } 2017 if (typeof window === "undefined") { 2018 return zeroGap; 2019 } 2020 var offsets = getOffset(gapMode); 2021 var documentWidth = document.documentElement.clientWidth; 2022 var windowWidth = window.innerWidth; 2023 return { 2024 left: offsets[0], 2025 top: offsets[1], 2026 right: offsets[2], 2027 gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]) 2028 }; 2029 }; 2030 2031 // node_modules/react-remove-scroll-bar/dist/es2015/component.js 2032 var Style = styleSingleton(); 2033 var lockAttribute = "data-scroll-locked"; 2034 var getStyles = function(_a, allowRelative, gapMode, important) { 2035 var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap; 2036 if (gapMode === void 0) { 2037 gapMode = "margin"; 2038 } 2039 return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([ 2040 allowRelative && "position: relative ".concat(important, ";"), 2041 gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "), 2042 gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";") 2043 ].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n"); 2044 }; 2045 var getCurrentUseCounter = function() { 2046 var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10); 2047 return isFinite(counter) ? counter : 0; 2048 }; 2049 var useLockAttribute = function() { 2050 React34.useEffect(function() { 2051 document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString()); 2052 return function() { 2053 var newCounter = getCurrentUseCounter() - 1; 2054 if (newCounter <= 0) { 2055 document.body.removeAttribute(lockAttribute); 2056 } else { 2057 document.body.setAttribute(lockAttribute, newCounter.toString()); 2058 } 2059 }; 2060 }, []); 2061 }; 2062 var RemoveScrollBar = function(_a) { 2063 var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b; 2064 useLockAttribute(); 2065 var gap = React34.useMemo(function() { 2066 return getGapWidth(gapMode); 2067 }, [gapMode]); 2068 return React34.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") }); 2069 }; 2070 2071 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js 2072 var passiveSupported = false; 2073 if (typeof window !== "undefined") { 2074 try { 2075 options = Object.defineProperty({}, "passive", { 2076 get: function() { 2077 passiveSupported = true; 2078 return true; 2079 } 2080 }); 2081 window.addEventListener("test", options, options); 2082 window.removeEventListener("test", options, options); 2083 } catch (err) { 2084 passiveSupported = false; 2085 } 2086 } 2087 var options; 2088 var nonPassive = passiveSupported ? { passive: false } : false; 2089 2090 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/handleScroll.js 2091 var alwaysContainsScroll = function(node) { 2092 return node.tagName === "TEXTAREA"; 2093 }; 2094 var elementCanBeScrolled = function(node, overflow) { 2095 if (!(node instanceof Element)) { 2096 return false; 2097 } 2098 var styles = window.getComputedStyle(node); 2099 return ( 2100 // not-not-scrollable 2101 styles[overflow] !== "hidden" && // contains scroll inside self 2102 !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible") 2103 ); 2104 }; 2105 var elementCouldBeVScrolled = function(node) { 2106 return elementCanBeScrolled(node, "overflowY"); 2107 }; 2108 var elementCouldBeHScrolled = function(node) { 2109 return elementCanBeScrolled(node, "overflowX"); 2110 }; 2111 var locationCouldBeScrolled = function(axis, node) { 2112 var ownerDocument = node.ownerDocument; 2113 var current = node; 2114 do { 2115 if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) { 2116 current = current.host; 2117 } 2118 var isScrollable = elementCouldBeScrolled(axis, current); 2119 if (isScrollable) { 2120 var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2]; 2121 if (scrollHeight > clientHeight) { 2122 return true; 2123 } 2124 } 2125 current = current.parentNode; 2126 } while (current && current !== ownerDocument.body); 2127 return false; 2128 }; 2129 var getVScrollVariables = function(_a) { 2130 var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight; 2131 return [ 2132 scrollTop, 2133 scrollHeight, 2134 clientHeight 2135 ]; 2136 }; 2137 var getHScrollVariables = function(_a) { 2138 var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth; 2139 return [ 2140 scrollLeft, 2141 scrollWidth, 2142 clientWidth 2143 ]; 2144 }; 2145 var elementCouldBeScrolled = function(axis, node) { 2146 return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node); 2147 }; 2148 var getScrollVariables = function(axis, node) { 2149 return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node); 2150 }; 2151 var getDirectionFactor = function(axis, direction) { 2152 return axis === "h" && direction === "rtl" ? -1 : 1; 2153 }; 2154 var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) { 2155 var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction); 2156 var delta = directionFactor * sourceDelta; 2157 var target = event.target; 2158 var targetInLock = endTarget.contains(target); 2159 var shouldCancelScroll = false; 2160 var isDeltaPositive = delta > 0; 2161 var availableScroll = 0; 2162 var availableScrollTop = 0; 2163 do { 2164 if (!target) { 2165 break; 2166 } 2167 var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2]; 2168 var elementScroll = scroll_1 - capacity - directionFactor * position; 2169 if (position || elementScroll) { 2170 if (elementCouldBeScrolled(axis, target)) { 2171 availableScroll += elementScroll; 2172 availableScrollTop += position; 2173 } 2174 } 2175 var parent_1 = target.parentNode; 2176 target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1; 2177 } while ( 2178 // portaled content 2179 !targetInLock && target !== document.body || // self content 2180 targetInLock && (endTarget.contains(target) || endTarget === target) 2181 ); 2182 if (isDeltaPositive && (noOverscroll && Math.abs(availableScroll) < 1 || !noOverscroll && delta > availableScroll)) { 2183 shouldCancelScroll = true; 2184 } else if (!isDeltaPositive && (noOverscroll && Math.abs(availableScrollTop) < 1 || !noOverscroll && -delta > availableScrollTop)) { 2185 shouldCancelScroll = true; 2186 } 2187 return shouldCancelScroll; 2188 }; 2189 2190 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js 2191 var getTouchXY = function(event) { 2192 return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0]; 2193 }; 2194 var getDeltaXY = function(event) { 2195 return [event.deltaX, event.deltaY]; 2196 }; 2197 var extractRef = function(ref) { 2198 return ref && "current" in ref ? ref.current : ref; 2199 }; 2200 var deltaCompare = function(x, y) { 2201 return x[0] === y[0] && x[1] === y[1]; 2202 }; 2203 var generateStyle = function(id) { 2204 return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); 2205 }; 2206 var idCounter = 0; 2207 var lockStack = []; 2208 function RemoveScrollSideCar(props) { 2209 var shouldPreventQueue = React35.useRef([]); 2210 var touchStartRef = React35.useRef([0, 0]); 2211 var activeAxis = React35.useRef(); 2212 var id = React35.useState(idCounter++)[0]; 2213 var Style2 = React35.useState(styleSingleton)[0]; 2214 var lastProps = React35.useRef(props); 2215 React35.useEffect(function() { 2216 lastProps.current = props; 2217 }, [props]); 2218 React35.useEffect(function() { 2219 if (props.inert) { 2220 document.body.classList.add("block-interactivity-".concat(id)); 2221 var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean); 2222 allow_1.forEach(function(el) { 2223 return el.classList.add("allow-interactivity-".concat(id)); 2224 }); 2225 return function() { 2226 document.body.classList.remove("block-interactivity-".concat(id)); 2227 allow_1.forEach(function(el) { 2228 return el.classList.remove("allow-interactivity-".concat(id)); 2229 }); 2230 }; 2231 } 2232 return; 2233 }, [props.inert, props.lockRef.current, props.shards]); 2234 var shouldCancelEvent = React35.useCallback(function(event, parent) { 2235 if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) { 2236 return !lastProps.current.allowPinchZoom; 2237 } 2238 var touch = getTouchXY(event); 2239 var touchStart = touchStartRef.current; 2240 var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0]; 2241 var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1]; 2242 var currentAxis; 2243 var target = event.target; 2244 var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v"; 2245 if ("touches" in event && moveDirection === "h" && target.type === "range") { 2246 return false; 2247 } 2248 var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target); 2249 if (!canBeScrolledInMainDirection) { 2250 return true; 2251 } 2252 if (canBeScrolledInMainDirection) { 2253 currentAxis = moveDirection; 2254 } else { 2255 currentAxis = moveDirection === "v" ? "h" : "v"; 2256 canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target); 2257 } 2258 if (!canBeScrolledInMainDirection) { 2259 return false; 2260 } 2261 if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) { 2262 activeAxis.current = currentAxis; 2263 } 2264 if (!currentAxis) { 2265 return true; 2266 } 2267 var cancelingAxis = activeAxis.current || currentAxis; 2268 return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true); 2269 }, []); 2270 var shouldPrevent = React35.useCallback(function(_event) { 2271 var event = _event; 2272 if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) { 2273 return; 2274 } 2275 var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event); 2276 var sourceEvent = shouldPreventQueue.current.filter(function(e) { 2277 return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta); 2278 })[0]; 2279 if (sourceEvent && sourceEvent.should) { 2280 if (event.cancelable) { 2281 event.preventDefault(); 2282 } 2283 return; 2284 } 2285 if (!sourceEvent) { 2286 var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) { 2287 return node.contains(event.target); 2288 }); 2289 var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation; 2290 if (shouldStop) { 2291 if (event.cancelable) { 2292 event.preventDefault(); 2293 } 2294 } 2295 } 2296 }, []); 2297 var shouldCancel = React35.useCallback(function(name, delta, target, should) { 2298 var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) }; 2299 shouldPreventQueue.current.push(event); 2300 setTimeout(function() { 2301 shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) { 2302 return e !== event; 2303 }); 2304 }, 1); 2305 }, []); 2306 var scrollTouchStart = React35.useCallback(function(event) { 2307 touchStartRef.current = getTouchXY(event); 2308 activeAxis.current = void 0; 2309 }, []); 2310 var scrollWheel = React35.useCallback(function(event) { 2311 shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current)); 2312 }, []); 2313 var scrollTouchMove = React35.useCallback(function(event) { 2314 shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current)); 2315 }, []); 2316 React35.useEffect(function() { 2317 lockStack.push(Style2); 2318 props.setCallbacks({ 2319 onScrollCapture: scrollWheel, 2320 onWheelCapture: scrollWheel, 2321 onTouchMoveCapture: scrollTouchMove 2322 }); 2323 document.addEventListener("wheel", shouldPrevent, nonPassive); 2324 document.addEventListener("touchmove", shouldPrevent, nonPassive); 2325 document.addEventListener("touchstart", scrollTouchStart, nonPassive); 2326 return function() { 2327 lockStack = lockStack.filter(function(inst) { 2328 return inst !== Style2; 2329 }); 2330 document.removeEventListener("wheel", shouldPrevent, nonPassive); 2331 document.removeEventListener("touchmove", shouldPrevent, nonPassive); 2332 document.removeEventListener("touchstart", scrollTouchStart, nonPassive); 2333 }; 2334 }, []); 2335 var removeScrollBar = props.removeScrollBar, inert = props.inert; 2336 return React35.createElement( 2337 React35.Fragment, 2338 null, 2339 inert ? React35.createElement(Style2, { styles: generateStyle(id) }) : null, 2340 removeScrollBar ? React35.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null 2341 ); 2342 } 2343 function getOutermostShadowParent(node) { 2344 var shadowParent = null; 2345 while (node !== null) { 2346 if (node instanceof ShadowRoot) { 2347 shadowParent = node.host; 2348 node = node.host; 2349 } 2350 node = node.parentNode; 2351 } 2352 return shadowParent; 2353 } 2354 2355 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/sidecar.js 2356 var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar); 2357 2358 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js 2359 var ReactRemoveScroll = React36.forwardRef(function(props, ref) { 2360 return React36.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default })); 2361 }); 2362 ReactRemoveScroll.classNames = RemoveScroll.classNames; 2363 var Combination_default = ReactRemoveScroll; 2364 2365 // node_modules/aria-hidden/dist/es2015/index.js 2366 var getDefaultParent = function(originalTarget) { 2367 if (typeof document === "undefined") { 2368 return null; 2369 } 2370 var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget; 2371 return sampleTarget.ownerDocument.body; 2372 }; 2373 var counterMap = /* @__PURE__ */ new WeakMap(); 2374 var uncontrolledNodes = /* @__PURE__ */ new WeakMap(); 2375 var markerMap = {}; 2376 var lockCount = 0; 2377 var unwrapHost = function(node) { 2378 return node && (node.host || unwrapHost(node.parentNode)); 2379 }; 2380 var correctTargets = function(parent, targets) { 2381 return targets.map(function(target) { 2382 if (parent.contains(target)) { 2383 return target; 2384 } 2385 var correctedTarget = unwrapHost(target); 2386 if (correctedTarget && parent.contains(correctedTarget)) { 2387 return correctedTarget; 2388 } 2389 console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing"); 2390 return null; 2391 }).filter(function(x) { 2392 return Boolean(x); 2393 }); 2394 }; 2395 var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) { 2396 var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]); 2397 if (!markerMap[markerName]) { 2398 markerMap[markerName] = /* @__PURE__ */ new WeakMap(); 2399 } 2400 var markerCounter = markerMap[markerName]; 2401 var hiddenNodes = []; 2402 var elementsToKeep = /* @__PURE__ */ new Set(); 2403 var elementsToStop = new Set(targets); 2404 var keep = function(el) { 2405 if (!el || elementsToKeep.has(el)) { 2406 return; 2407 } 2408 elementsToKeep.add(el); 2409 keep(el.parentNode); 2410 }; 2411 targets.forEach(keep); 2412 var deep = function(parent) { 2413 if (!parent || elementsToStop.has(parent)) { 2414 return; 2415 } 2416 Array.prototype.forEach.call(parent.children, function(node) { 2417 if (elementsToKeep.has(node)) { 2418 deep(node); 2419 } else { 2420 try { 2421 var attr = node.getAttribute(controlAttribute); 2422 var alreadyHidden = attr !== null && attr !== "false"; 2423 var counterValue = (counterMap.get(node) || 0) + 1; 2424 var markerValue = (markerCounter.get(node) || 0) + 1; 2425 counterMap.set(node, counterValue); 2426 markerCounter.set(node, markerValue); 2427 hiddenNodes.push(node); 2428 if (counterValue === 1 && alreadyHidden) { 2429 uncontrolledNodes.set(node, true); 2430 } 2431 if (markerValue === 1) { 2432 node.setAttribute(markerName, "true"); 2433 } 2434 if (!alreadyHidden) { 2435 node.setAttribute(controlAttribute, "true"); 2436 } 2437 } catch (e) { 2438 console.error("aria-hidden: cannot operate on ", node, e); 2439 } 2440 } 2441 }); 2442 }; 2443 deep(parentNode); 2444 elementsToKeep.clear(); 2445 lockCount++; 2446 return function() { 2447 hiddenNodes.forEach(function(node) { 2448 var counterValue = counterMap.get(node) - 1; 2449 var markerValue = markerCounter.get(node) - 1; 2450 counterMap.set(node, counterValue); 2451 markerCounter.set(node, markerValue); 2452 if (!counterValue) { 2453 if (!uncontrolledNodes.has(node)) { 2454 node.removeAttribute(controlAttribute); 2455 } 2456 uncontrolledNodes.delete(node); 2457 } 2458 if (!markerValue) { 2459 node.removeAttribute(markerName); 2460 } 2461 }); 2462 lockCount--; 2463 if (!lockCount) { 2464 counterMap = /* @__PURE__ */ new WeakMap(); 2465 counterMap = /* @__PURE__ */ new WeakMap(); 2466 uncontrolledNodes = /* @__PURE__ */ new WeakMap(); 2467 markerMap = {}; 2468 } 2469 }; 2470 }; 2471 var hideOthers = function(originalTarget, parentNode, markerName) { 2472 if (markerName === void 0) { 2473 markerName = "data-aria-hidden"; 2474 } 2475 var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]); 2476 var activeParentNode = parentNode || getDefaultParent(originalTarget); 2477 if (!activeParentNode) { 2478 return function() { 2479 return null; 2480 }; 2481 } 2482 targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script"))); 2483 return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden"); 2484 }; 2485 2486 // node_modules/@radix-ui/react-dialog/dist/index.mjs 2487 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 2488 var DIALOG_NAME = "Dialog"; 2489 var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME); 2490 var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME); 2491 var Dialog = (props) => { 2492 const { 2493 __scopeDialog, 2494 children, 2495 open: openProp, 2496 defaultOpen, 2497 onOpenChange, 2498 modal = true 2499 } = props; 2500 const triggerRef = React37.useRef(null); 2501 const contentRef = React37.useRef(null); 2502 const [open2, setOpen] = useControllableState({ 2503 prop: openProp, 2504 defaultProp: defaultOpen ?? false, 2505 onChange: onOpenChange, 2506 caller: DIALOG_NAME 2507 }); 2508 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 2509 DialogProvider, 2510 { 2511 scope: __scopeDialog, 2512 triggerRef, 2513 contentRef, 2514 contentId: useId(), 2515 titleId: useId(), 2516 descriptionId: useId(), 2517 open: open2, 2518 onOpenChange: setOpen, 2519 onOpenToggle: React37.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]), 2520 modal, 2521 children 2522 } 2523 ); 2524 }; 2525 Dialog.displayName = DIALOG_NAME; 2526 var TRIGGER_NAME = "DialogTrigger"; 2527 var DialogTrigger = React37.forwardRef( 2528 (props, forwardedRef) => { 2529 const { __scopeDialog, ...triggerProps } = props; 2530 const context2 = useDialogContext(TRIGGER_NAME, __scopeDialog); 2531 const composedTriggerRef = useComposedRefs(forwardedRef, context2.triggerRef); 2532 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 2533 Primitive4.button, 2534 { 2535 type: "button", 2536 "aria-haspopup": "dialog", 2537 "aria-expanded": context2.open, 2538 "aria-controls": context2.contentId, 2539 "data-state": getState(context2.open), 2540 ...triggerProps, 2541 ref: composedTriggerRef, 2542 onClick: composeEventHandlers(props.onClick, context2.onOpenToggle) 2543 } 2544 ); 2545 } 2546 ); 2547 DialogTrigger.displayName = TRIGGER_NAME; 2548 var PORTAL_NAME2 = "DialogPortal"; 2549 var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, { 2550 forceMount: void 0 2551 }); 2552 var DialogPortal = (props) => { 2553 const { __scopeDialog, forceMount, children, container } = props; 2554 const context2 = useDialogContext(PORTAL_NAME2, __scopeDialog); 2555 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PortalProvider, { scope: __scopeDialog, forceMount, children: React37.Children.map(children, (child) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Presence, { present: forceMount || context2.open, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Portal, { asChild: true, container, children: child }) })) }); 2556 }; 2557 DialogPortal.displayName = PORTAL_NAME2; 2558 var OVERLAY_NAME = "DialogOverlay"; 2559 var DialogOverlay = React37.forwardRef( 2560 (props, forwardedRef) => { 2561 const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog); 2562 const { forceMount = portalContext.forceMount, ...overlayProps } = props; 2563 const context2 = useDialogContext(OVERLAY_NAME, props.__scopeDialog); 2564 return context2.modal ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Presence, { present: forceMount || context2.open, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null; 2565 } 2566 ); 2567 DialogOverlay.displayName = OVERLAY_NAME; 2568 var Slot = createSlot4("DialogOverlay.RemoveScroll"); 2569 var DialogOverlayImpl = React37.forwardRef( 2570 (props, forwardedRef) => { 2571 const { __scopeDialog, ...overlayProps } = props; 2572 const context2 = useDialogContext(OVERLAY_NAME, __scopeDialog); 2573 return ( 2574 // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll` 2575 // ie. when `Overlay` and `Content` are siblings 2576 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Combination_default, { as: Slot, allowPinchZoom: true, shards: [context2.contentRef], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 2577 Primitive4.div, 2578 { 2579 "data-state": getState(context2.open), 2580 ...overlayProps, 2581 ref: forwardedRef, 2582 style: { pointerEvents: "auto", ...overlayProps.style } 2583 } 2584 ) }) 2585 ); 2586 } 2587 ); 2588 var CONTENT_NAME = "DialogContent"; 2589 var DialogContent = React37.forwardRef( 2590 (props, forwardedRef) => { 2591 const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog); 2592 const { forceMount = portalContext.forceMount, ...contentProps } = props; 2593 const context2 = useDialogContext(CONTENT_NAME, props.__scopeDialog); 2594 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Presence, { present: forceMount || context2.open, children: context2.modal ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) }); 2595 } 2596 ); 2597 DialogContent.displayName = CONTENT_NAME; 2598 var DialogContentModal = React37.forwardRef( 2599 (props, forwardedRef) => { 2600 const context2 = useDialogContext(CONTENT_NAME, props.__scopeDialog); 2601 const contentRef = React37.useRef(null); 2602 const composedRefs = useComposedRefs(forwardedRef, context2.contentRef, contentRef); 2603 React37.useEffect(() => { 2604 const content = contentRef.current; 2605 if (content) return hideOthers(content); 2606 }, []); 2607 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 2608 DialogContentImpl, 2609 { 2610 ...props, 2611 ref: composedRefs, 2612 trapFocus: context2.open, 2613 disableOutsidePointerEvents: true, 2614 onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => { 2615 event.preventDefault(); 2616 context2.triggerRef.current?.focus(); 2617 }), 2618 onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => { 2619 const originalEvent = event.detail.originalEvent; 2620 const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true; 2621 const isRightClick = originalEvent.button === 2 || ctrlLeftClick; 2622 if (isRightClick) event.preventDefault(); 2623 }), 2624 onFocusOutside: composeEventHandlers( 2625 props.onFocusOutside, 2626 (event) => event.preventDefault() 2627 ) 2628 } 2629 ); 2630 } 2631 ); 2632 var DialogContentNonModal = React37.forwardRef( 2633 (props, forwardedRef) => { 2634 const context2 = useDialogContext(CONTENT_NAME, props.__scopeDialog); 2635 const hasInteractedOutsideRef = React37.useRef(false); 2636 const hasPointerDownOutsideRef = React37.useRef(false); 2637 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 2638 DialogContentImpl, 2639 { 2640 ...props, 2641 ref: forwardedRef, 2642 trapFocus: false, 2643 disableOutsidePointerEvents: false, 2644 onCloseAutoFocus: (event) => { 2645 props.onCloseAutoFocus?.(event); 2646 if (!event.defaultPrevented) { 2647 if (!hasInteractedOutsideRef.current) context2.triggerRef.current?.focus(); 2648 event.preventDefault(); 2649 } 2650 hasInteractedOutsideRef.current = false; 2651 hasPointerDownOutsideRef.current = false; 2652 }, 2653 onInteractOutside: (event) => { 2654 props.onInteractOutside?.(event); 2655 if (!event.defaultPrevented) { 2656 hasInteractedOutsideRef.current = true; 2657 if (event.detail.originalEvent.type === "pointerdown") { 2658 hasPointerDownOutsideRef.current = true; 2659 } 2660 } 2661 const target = event.target; 2662 const targetIsTrigger = context2.triggerRef.current?.contains(target); 2663 if (targetIsTrigger) event.preventDefault(); 2664 if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) { 2665 event.preventDefault(); 2666 } 2667 } 2668 } 2669 ); 2670 } 2671 ); 2672 var DialogContentImpl = React37.forwardRef( 2673 (props, forwardedRef) => { 2674 const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props; 2675 const context2 = useDialogContext(CONTENT_NAME, __scopeDialog); 2676 const contentRef = React37.useRef(null); 2677 const composedRefs = useComposedRefs(forwardedRef, contentRef); 2678 useFocusGuards(); 2679 return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [ 2680 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 2681 FocusScope, 2682 { 2683 asChild: true, 2684 loop: true, 2685 trapped: trapFocus, 2686 onMountAutoFocus: onOpenAutoFocus, 2687 onUnmountAutoFocus: onCloseAutoFocus, 2688 children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 2689 DismissableLayer, 2690 { 2691 role: "dialog", 2692 id: context2.contentId, 2693 "aria-describedby": context2.descriptionId, 2694 "aria-labelledby": context2.titleId, 2695 "data-state": getState(context2.open), 2696 ...contentProps, 2697 ref: composedRefs, 2698 onDismiss: () => context2.onOpenChange(false) 2699 } 2700 ) 2701 } 2702 ), 2703 /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [ 2704 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TitleWarning, { titleId: context2.titleId }), 2705 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DescriptionWarning, { contentRef, descriptionId: context2.descriptionId }) 2706 ] }) 2707 ] }); 2708 } 2709 ); 2710 var TITLE_NAME = "DialogTitle"; 2711 var DialogTitle = React37.forwardRef( 2712 (props, forwardedRef) => { 2713 const { __scopeDialog, ...titleProps } = props; 2714 const context2 = useDialogContext(TITLE_NAME, __scopeDialog); 2715 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Primitive4.h2, { id: context2.titleId, ...titleProps, ref: forwardedRef }); 2716 } 2717 ); 2718 DialogTitle.displayName = TITLE_NAME; 2719 var DESCRIPTION_NAME = "DialogDescription"; 2720 var DialogDescription = React37.forwardRef( 2721 (props, forwardedRef) => { 2722 const { __scopeDialog, ...descriptionProps } = props; 2723 const context2 = useDialogContext(DESCRIPTION_NAME, __scopeDialog); 2724 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Primitive4.p, { id: context2.descriptionId, ...descriptionProps, ref: forwardedRef }); 2725 } 2726 ); 2727 DialogDescription.displayName = DESCRIPTION_NAME; 2728 var CLOSE_NAME = "DialogClose"; 2729 var DialogClose = React37.forwardRef( 2730 (props, forwardedRef) => { 2731 const { __scopeDialog, ...closeProps } = props; 2732 const context2 = useDialogContext(CLOSE_NAME, __scopeDialog); 2733 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 2734 Primitive4.button, 2735 { 2736 type: "button", 2737 ...closeProps, 2738 ref: forwardedRef, 2739 onClick: composeEventHandlers(props.onClick, () => context2.onOpenChange(false)) 2740 } 2741 ); 2742 } 2743 ); 2744 DialogClose.displayName = CLOSE_NAME; 2745 function getState(open2) { 2746 return open2 ? "open" : "closed"; 2747 } 2748 var TITLE_WARNING_NAME = "DialogTitleWarning"; 2749 var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, { 2750 contentName: CONTENT_NAME, 2751 titleName: TITLE_NAME, 2752 docsSlug: "dialog" 2753 }); 2754 var TitleWarning = ({ titleId }) => { 2755 const titleWarningContext = useWarningContext(TITLE_WARNING_NAME); 2756 const MESSAGE = `\`$titleWarningContext.contentName}\` requires a \`$titleWarningContext.titleName}\` for the component to be accessible for screen reader users. 2757 2758 If you want to hide the \`$titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component. 2759 2760 For more information, see https://radix-ui.com/primitives/docs/components/$titleWarningContext.docsSlug}`; 2761 React37.useEffect(() => { 2762 if (titleId) { 2763 const hasTitle = document.getElementById(titleId); 2764 if (!hasTitle) console.error(MESSAGE); 2765 } 2766 }, [MESSAGE, titleId]); 2767 return null; 2768 }; 2769 var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning"; 2770 var DescriptionWarning = ({ contentRef, descriptionId }) => { 2771 const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME); 2772 const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {$descriptionWarningContext.contentName}}.`; 2773 React37.useEffect(() => { 2774 const describedById = contentRef.current?.getAttribute("aria-describedby"); 2775 if (descriptionId && describedById) { 2776 const hasDescription = document.getElementById(descriptionId); 2777 if (!hasDescription) console.warn(MESSAGE); 2778 } 2779 }, [MESSAGE, contentRef, descriptionId]); 2780 return null; 2781 }; 2782 var Root = Dialog; 2783 var Portal2 = DialogPortal; 2784 var Overlay = DialogOverlay; 2785 var Content = DialogContent; 2786 2787 // node_modules/cmdk/dist/index.mjs 2788 var t = __toESM(require_react(), 1); 2789 2790 // node_modules/cmdk/node_modules/@radix-ui/react-primitive/dist/index.mjs 2791 var React40 = __toESM(require_react(), 1); 2792 var ReactDOM6 = __toESM(require_react_dom(), 1); 2793 2794 // node_modules/cmdk/node_modules/@radix-ui/react-slot/dist/index.mjs 2795 var React39 = __toESM(require_react(), 1); 2796 2797 // node_modules/cmdk/node_modules/@radix-ui/react-compose-refs/dist/index.mjs 2798 var React38 = __toESM(require_react(), 1); 2799 function setRef6(ref, value) { 2800 if (typeof ref === "function") { 2801 return ref(value); 2802 } else if (ref !== null && ref !== void 0) { 2803 ref.current = value; 2804 } 2805 } 2806 function composeRefs6(...refs) { 2807 return (node) => { 2808 let hasCleanup = false; 2809 const cleanups = refs.map((ref) => { 2810 const cleanup = setRef6(ref, node); 2811 if (!hasCleanup && typeof cleanup == "function") { 2812 hasCleanup = true; 2813 } 2814 return cleanup; 2815 }); 2816 if (hasCleanup) { 2817 return () => { 2818 for (let i = 0; i < cleanups.length; i++) { 2819 const cleanup = cleanups[i]; 2820 if (typeof cleanup == "function") { 2821 cleanup(); 2822 } else { 2823 setRef6(refs[i], null); 2824 } 2825 } 2826 }; 2827 } 2828 }; 2829 } 2830 2831 // node_modules/cmdk/node_modules/@radix-ui/react-slot/dist/index.mjs 2832 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 2833 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 2834 var use = React39[" use ".trim().toString()]; 2835 function isPromiseLike(value) { 2836 return typeof value === "object" && value !== null && "then" in value; 2837 } 2838 function isLazyComponent(element) { 2839 return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload); 2840 } 2841 // @__NO_SIDE_EFFECTS__ 2842 function createSlot5(ownerName) { 2843 const SlotClone = /* @__PURE__ */ createSlotClone5(ownerName); 2844 const Slot2 = React39.forwardRef((props, forwardedRef) => { 2845 let { children, ...slotProps } = props; 2846 if (isLazyComponent(children) && typeof use === "function") { 2847 children = use(children._payload); 2848 } 2849 const childrenArray = React39.Children.toArray(children); 2850 const slottable = childrenArray.find(isSlottable5); 2851 if (slottable) { 2852 const newElement = slottable.props.children; 2853 const newChildren = childrenArray.map((child) => { 2854 if (child === slottable) { 2855 if (React39.Children.count(newElement) > 1) return React39.Children.only(null); 2856 return React39.isValidElement(newElement) ? newElement.props.children : null; 2857 } else { 2858 return child; 2859 } 2860 }); 2861 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React39.isValidElement(newElement) ? React39.cloneElement(newElement, void 0, newChildren) : null }); 2862 } 2863 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children }); 2864 }); 2865 Slot2.displayName = `$ownerName}.Slot`; 2866 return Slot2; 2867 } 2868 // @__NO_SIDE_EFFECTS__ 2869 function createSlotClone5(ownerName) { 2870 const SlotClone = React39.forwardRef((props, forwardedRef) => { 2871 let { children, ...slotProps } = props; 2872 if (isLazyComponent(children) && typeof use === "function") { 2873 children = use(children._payload); 2874 } 2875 if (React39.isValidElement(children)) { 2876 const childrenRef = getElementRef6(children); 2877 const props2 = mergeProps5(slotProps, children.props); 2878 if (children.type !== React39.Fragment) { 2879 props2.ref = forwardedRef ? composeRefs6(forwardedRef, childrenRef) : childrenRef; 2880 } 2881 return React39.cloneElement(children, props2); 2882 } 2883 return React39.Children.count(children) > 1 ? React39.Children.only(null) : null; 2884 }); 2885 SlotClone.displayName = `$ownerName}.SlotClone`; 2886 return SlotClone; 2887 } 2888 var SLOTTABLE_IDENTIFIER5 = /* @__PURE__ */ Symbol("radix.slottable"); 2889 function isSlottable5(child) { 2890 return React39.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER5; 2891 } 2892 function mergeProps5(slotProps, childProps) { 2893 const overrideProps = { ...childProps }; 2894 for (const propName in childProps) { 2895 const slotPropValue = slotProps[propName]; 2896 const childPropValue = childProps[propName]; 2897 const isHandler = /^on[A-Z]/.test(propName); 2898 if (isHandler) { 2899 if (slotPropValue && childPropValue) { 2900 overrideProps[propName] = (...args) => { 2901 const result = childPropValue(...args); 2902 slotPropValue(...args); 2903 return result; 2904 }; 2905 } else if (slotPropValue) { 2906 overrideProps[propName] = slotPropValue; 2907 } 2908 } else if (propName === "style") { 2909 overrideProps[propName] = { ...slotPropValue, ...childPropValue }; 2910 } else if (propName === "className") { 2911 overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" "); 2912 } 2913 } 2914 return { ...slotProps, ...overrideProps }; 2915 } 2916 function getElementRef6(element) { 2917 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get; 2918 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 2919 if (mayWarn) { 2920 return element.ref; 2921 } 2922 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get; 2923 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning; 2924 if (mayWarn) { 2925 return element.props.ref; 2926 } 2927 return element.props.ref || element.ref; 2928 } 2929 2930 // node_modules/cmdk/node_modules/@radix-ui/react-primitive/dist/index.mjs 2931 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 2932 var NODES5 = [ 2933 "a", 2934 "button", 2935 "div", 2936 "form", 2937 "h2", 2938 "h3", 2939 "img", 2940 "input", 2941 "label", 2942 "li", 2943 "nav", 2944 "ol", 2945 "p", 2946 "select", 2947 "span", 2948 "svg", 2949 "ul" 2950 ]; 2951 var Primitive5 = NODES5.reduce((primitive, node) => { 2952 const Slot2 = createSlot5(`Primitive.$node}`); 2953 const Node2 = React40.forwardRef((props, forwardedRef) => { 2954 const { asChild, ...primitiveProps } = props; 2955 const Comp = asChild ? Slot2 : node; 2956 if (typeof window !== "undefined") { 2957 window[/* @__PURE__ */ Symbol.for("radix-ui")] = true; 2958 } 2959 return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Comp, { ...primitiveProps, ref: forwardedRef }); 2960 }); 2961 Node2.displayName = `Primitive.$node}`; 2962 return { ...primitive, [node]: Node2 }; 2963 }, {}); 2964 2965 // node_modules/cmdk/node_modules/@radix-ui/react-id/dist/index.mjs 2966 var React42 = __toESM(require_react(), 1); 2967 2968 // node_modules/cmdk/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs 2969 var React41 = __toESM(require_react(), 1); 2970 var useLayoutEffect24 = globalThis?.document ? React41.useLayoutEffect : () => { 2971 }; 2972 2973 // node_modules/cmdk/node_modules/@radix-ui/react-id/dist/index.mjs 2974 var useReactId2 = React42[" useId ".trim().toString()] || (() => void 0); 2975 var count3 = 0; 2976 function useId2(deterministicId) { 2977 const [id, setId] = React42.useState(useReactId2()); 2978 useLayoutEffect24(() => { 2979 if (!deterministicId) setId((reactId) => reactId ?? String(count3++)); 2980 }, [deterministicId]); 2981 return deterministicId || (id ? `radix-$id}` : ""); 2982 } 2983 2984 // node_modules/cmdk/dist/index.mjs 2985 var N = '[cmdk-group=""]'; 2986 var Y2 = '[cmdk-group-items=""]'; 2987 var be = '[cmdk-group-heading=""]'; 2988 var le = '[cmdk-item=""]'; 2989 var ce = `$le}:not([aria-disabled="true"])`; 2990 var Z = "cmdk-item-select"; 2991 var T = "data-value"; 2992 var Re = (r2, o, n) => W(r2, o, n); 2993 var ue = t.createContext(void 0); 2994 var K2 = () => t.useContext(ue); 2995 var de = t.createContext(void 0); 2996 var ee = () => t.useContext(de); 2997 var fe = t.createContext(void 0); 2998 var me = t.forwardRef((r2, o) => { 2999 let n = L(() => { 3000 var e, a; 3001 return { search: "", value: (a = (e = r2.value) != null ? e : r2.defaultValue) != null ? a : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } }; 3002 }), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r2), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r2, $2 = useId2(), q = useId2(), _ = useId2(), I = t.useRef(null), v = ke(); 3003 k2(() => { 3004 if (R !== void 0) { 3005 let e = R.trim(); 3006 n.current.value = e, E.emit(); 3007 } 3008 }, [R]), k2(() => { 3009 v(6, ne); 3010 }, []); 3011 let E = t.useMemo(() => ({ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)), snapshot: () => n.current, setState: (e, a, s) => { 3012 var i, l, g, y; 3013 if (!Object.is(n.current[e], a)) { 3014 if (n.current[e] = a, e === "search") J2(), z(), v(1, W2); 3015 else if (e === "value") { 3016 if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) { 3017 let h = document.getElementById(_); 3018 h ? h.focus() : (i = document.getElementById($2)) == null || i.focus(); 3019 } 3020 if (v(7, () => { 3021 var h; 3022 n.current.selectedItemId = (h = M()) == null ? void 0 : h.id, E.emit(); 3023 }), s || v(5, ne), ((l = p2.current) == null ? void 0 : l.value) !== void 0) { 3024 let h = a != null ? a : ""; 3025 (y = (g = p2.current).onValueChange) == null || y.call(g, h); 3026 return; 3027 } 3028 } 3029 E.emit(); 3030 } 3031 }, emit: () => { 3032 f.current.forEach((e) => e()); 3033 } }), []), U2 = t.useMemo(() => ({ value: (e, a, s) => { 3034 var i; 3035 a !== ((i = d.current.get(e)) == null ? void 0 : i.value) && (d.current.set(e, { value: a, keywords: s }), n.current.filtered.items.set(e, te(a, s)), v(2, () => { 3036 z(), E.emit(); 3037 })); 3038 }, item: (e, a) => (u2.current.add(e), a && (c.current.has(a) ? c.current.get(a).add(e) : c.current.set(a, /* @__PURE__ */ new Set([e]))), v(3, () => { 3039 J2(), z(), n.current.value || W2(), E.emit(); 3040 }), () => { 3041 d.current.delete(e), u2.current.delete(e), n.current.filtered.items.delete(e); 3042 let s = M(); 3043 v(4, () => { 3044 J2(), (s == null ? void 0 : s.getAttribute("id")) === e && W2(), E.emit(); 3045 }); 3046 }), group: (e) => (c.current.has(e) || c.current.set(e, /* @__PURE__ */ new Set()), () => { 3047 d.current.delete(e), c.current.delete(e); 3048 }), filter: () => p2.current.shouldFilter, label: b || r2["aria-label"], getDisablePointerSelection: () => p2.current.disablePointerSelection, listId: $2, inputId: _, labelId: q, listInnerRef: I }), []); 3049 function te(e, a) { 3050 var i, l; 3051 let s = (l = (i = p2.current) == null ? void 0 : i.filter) != null ? l : Re; 3052 return e ? s(e, n.current.search, a) : 0; 3053 } 3054 function z() { 3055 if (!n.current.search || p2.current.shouldFilter === false) return; 3056 let e = n.current.filtered.items, a = []; 3057 n.current.filtered.groups.forEach((i) => { 3058 let l = c.current.get(i), g = 0; 3059 l.forEach((y) => { 3060 let h = e.get(y); 3061 g = Math.max(h, g); 3062 }), a.push([i, g]); 3063 }); 3064 let s = I.current; 3065 V().sort((i, l) => { 3066 var h, F; 3067 let g = i.getAttribute("id"), y = l.getAttribute("id"); 3068 return ((h = e.get(y)) != null ? h : 0) - ((F = e.get(g)) != null ? F : 0); 3069 }).forEach((i) => { 3070 let l = i.closest(Y2); 3071 l ? l.appendChild(i.parentElement === l ? i : i.closest(`$Y2} > *`)) : s.appendChild(i.parentElement === s ? i : i.closest(`$Y2} > *`)); 3072 }), a.sort((i, l) => l[1] - i[1]).forEach((i) => { 3073 var g; 3074 let l = (g = I.current) == null ? void 0 : g.querySelector(`$N}[$T}="$encodeURIComponent(i[0])}"]`); 3075 l == null || l.parentElement.appendChild(l); 3076 }); 3077 } 3078 function W2() { 3079 let e = V().find((s) => s.getAttribute("aria-disabled") !== "true"), a = e == null ? void 0 : e.getAttribute(T); 3080 E.setState("value", a || void 0); 3081 } 3082 function J2() { 3083 var a, s, i, l; 3084 if (!n.current.search || p2.current.shouldFilter === false) { 3085 n.current.filtered.count = u2.current.size; 3086 return; 3087 } 3088 n.current.filtered.groups = /* @__PURE__ */ new Set(); 3089 let e = 0; 3090 for (let g of u2.current) { 3091 let y = (s = (a = d.current.get(g)) == null ? void 0 : a.value) != null ? s : "", h = (l = (i = d.current.get(g)) == null ? void 0 : i.keywords) != null ? l : [], F = te(y, h); 3092 n.current.filtered.items.set(g, F), F > 0 && e++; 3093 } 3094 for (let [g, y] of c.current) for (let h of y) if (n.current.filtered.items.get(h) > 0) { 3095 n.current.filtered.groups.add(g); 3096 break; 3097 } 3098 n.current.filtered.count = e; 3099 } 3100 function ne() { 3101 var a, s, i; 3102 let e = M(); 3103 e && (((a = e.parentElement) == null ? void 0 : a.firstChild) === e && ((i = (s = e.closest(N)) == null ? void 0 : s.querySelector(be)) == null || i.scrollIntoView({ block: "nearest" })), e.scrollIntoView({ block: "nearest" })); 3104 } 3105 function M() { 3106 var e; 3107 return (e = I.current) == null ? void 0 : e.querySelector(`$le}[aria-selected="true"]`); 3108 } 3109 function V() { 3110 var e; 3111 return Array.from(((e = I.current) == null ? void 0 : e.querySelectorAll(ce)) || []); 3112 } 3113 function X2(e) { 3114 let s = V()[e]; 3115 s && E.setState("value", s.getAttribute(T)); 3116 } 3117 function Q(e) { 3118 var g; 3119 let a = M(), s = V(), i = s.findIndex((y) => y === a), l = s[i + e]; 3120 (g = p2.current) != null && g.loop && (l = i + e < 0 ? s[s.length - 1] : i + e === s.length ? s[0] : s[i + e]), l && E.setState("value", l.getAttribute(T)); 3121 } 3122 function re(e) { 3123 let a = M(), s = a == null ? void 0 : a.closest(N), i; 3124 for (; s && !i; ) s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce); 3125 i ? E.setState("value", i.getAttribute(T)) : Q(e); 3126 } 3127 let oe = () => X2(V().length - 1), ie = (e) => { 3128 e.preventDefault(), e.metaKey ? oe() : e.altKey ? re(1) : Q(1); 3129 }, se = (e) => { 3130 e.preventDefault(), e.metaKey ? X2(0) : e.altKey ? re(-1) : Q(-1); 3131 }; 3132 return t.createElement(Primitive5.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => { 3133 var s; 3134 (s = O.onKeyDown) == null || s.call(O, e); 3135 let a = e.nativeEvent.isComposing || e.keyCode === 229; 3136 if (!(e.defaultPrevented || a)) switch (e.key) { 3137 case "n": 3138 case "j": { 3139 j && e.ctrlKey && ie(e); 3140 break; 3141 } 3142 case "ArrowDown": { 3143 ie(e); 3144 break; 3145 } 3146 case "p": 3147 case "k": { 3148 j && e.ctrlKey && se(e); 3149 break; 3150 } 3151 case "ArrowUp": { 3152 se(e); 3153 break; 3154 } 3155 case "Home": { 3156 e.preventDefault(), X2(0); 3157 break; 3158 } 3159 case "End": { 3160 e.preventDefault(), oe(); 3161 break; 3162 } 3163 case "Enter": { 3164 e.preventDefault(); 3165 let i = M(); 3166 if (i) { 3167 let l = new Event(Z); 3168 i.dispatchEvent(l); 3169 } 3170 } 3171 } 3172 } }, t.createElement("label", { "cmdk-label": "", htmlFor: U2.inputId, id: U2.labelId, style: Te }, b), B2(r2, (e) => t.createElement(de.Provider, { value: E }, t.createElement(ue.Provider, { value: U2 }, e)))); 3173 }); 3174 var he = t.forwardRef((r2, o) => { 3175 var _, I; 3176 let n = useId2(), u2 = t.useRef(null), c = t.useContext(fe), d = K2(), f = pe(r2), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount; 3177 k2(() => { 3178 if (!p2) return d.item(n, c == null ? void 0 : c.id); 3179 }, [p2]); 3180 let b = ve(n, u2, [r2.value, r2.children, u2], r2.keywords), m2 = ee(), R = P((v) => v.value && v.value === b.current), x = P((v) => p2 || d.filter() === false ? true : v.search ? v.filtered.items.get(n) > 0 : true); 3181 t.useEffect(() => { 3182 let v = u2.current; 3183 if (!(!v || r2.disabled)) return v.addEventListener(Z, C), () => v.removeEventListener(Z, C); 3184 }, [x, r2.onSelect, r2.disabled]); 3185 function C() { 3186 var v, E; 3187 S(), (E = (v = f.current).onSelect) == null || E.call(v, b.current); 3188 } 3189 function S() { 3190 m2.setState("value", b.current, true); 3191 } 3192 if (!x) return null; 3193 let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $2, ...q } = r2; 3194 return t.createElement(Primitive5.div, { ref: composeRefs6(u2, o), ...q, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!A, "aria-selected": !!R, "data-disabled": !!A, "data-selected": !!R, onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S, onClick: A ? void 0 : C }, r2.children); 3195 }); 3196 var Ee = t.forwardRef((r2, o) => { 3197 let { heading: n, children: u2, forceMount: c, ...d } = r2, f = useId2(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId2(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true); 3198 k2(() => R.group(f), []), ve(f, p2, [r2.value, r2.heading, b]); 3199 let C = t.useMemo(() => ({ id: f, forceMount: c }), [c]); 3200 return t.createElement(Primitive5.div, { ref: composeRefs6(p2, o), ...d, "cmdk-group": "", role: "presentation", hidden: x ? void 0 : true }, n && t.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": true, id: m2 }, n), B2(r2, (S) => t.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t.createElement(fe.Provider, { value: C }, S)))); 3201 }); 3202 var ye = t.forwardRef((r2, o) => { 3203 let { alwaysRender: n, ...u2 } = r2, c = t.useRef(null), d = P((f) => !f.search); 3204 return !n && !d ? null : t.createElement(Primitive5.div, { ref: composeRefs6(c, o), ...u2, "cmdk-separator": "", role: "separator" }); 3205 }); 3206 var Se = t.forwardRef((r2, o) => { 3207 let { onValueChange: n, ...u2 } = r2, c = r2.value != null, d = ee(), f = P((m2) => m2.search), p2 = P((m2) => m2.selectedItemId), b = K2(); 3208 return t.useEffect(() => { 3209 r2.value != null && d.setState("search", r2.value); 3210 }, [r2.value]), t.createElement(Primitive5.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": p2, id: b.inputId, type: "text", value: c ? r2.value : f, onChange: (m2) => { 3211 c || d.setState("search", m2.target.value), n == null || n(m2.target.value); 3212 } }); 3213 }); 3214 var Ce = t.forwardRef((r2, o) => { 3215 let { children: n, label: u2 = "Suggestions", ...c } = r2, d = t.useRef(null), f = t.useRef(null), p2 = P((m2) => m2.selectedItemId), b = K2(); 3216 return t.useEffect(() => { 3217 if (f.current && d.current) { 3218 let m2 = f.current, R = d.current, x, C = new ResizeObserver(() => { 3219 x = requestAnimationFrame(() => { 3220 let S = m2.offsetHeight; 3221 R.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px"); 3222 }); 3223 }); 3224 return C.observe(m2), () => { 3225 cancelAnimationFrame(x), C.unobserve(m2); 3226 }; 3227 } 3228 }, []), t.createElement(Primitive5.div, { ref: composeRefs6(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r2, (m2) => t.createElement("div", { ref: composeRefs6(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2))); 3229 }); 3230 var xe = t.forwardRef((r2, o) => { 3231 let { open: n, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r2; 3232 return t.createElement(Root, { open: n, onOpenChange: u2 }, t.createElement(Portal2, { container: f }, t.createElement(Overlay, { "cmdk-overlay": "", className: c }), t.createElement(Content, { "aria-label": r2.label, "cmdk-dialog": "", className: d }, t.createElement(me, { ref: o, ...p2 })))); 3233 }); 3234 var Ie = t.forwardRef((r2, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive5.div, { ref: o, ...r2, "cmdk-empty": "", role: "presentation" }) : null); 3235 var Pe = t.forwardRef((r2, o) => { 3236 let { progress: n, children: u2, label: c = "Loading...", ...d } = r2; 3237 return t.createElement(Primitive5.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r2, (f) => t.createElement("div", { "aria-hidden": true }, f))); 3238 }); 3239 var _e = Object.assign(me, { List: Ce, Item: he, Input: Se, Group: Ee, Separator: ye, Dialog: xe, Empty: Ie, Loading: Pe }); 3240 function we(r2, o) { 3241 let n = r2.nextElementSibling; 3242 for (; n; ) { 3243 if (n.matches(o)) return n; 3244 n = n.nextElementSibling; 3245 } 3246 } 3247 function De(r2, o) { 3248 let n = r2.previousElementSibling; 3249 for (; n; ) { 3250 if (n.matches(o)) return n; 3251 n = n.previousElementSibling; 3252 } 3253 } 3254 function pe(r2) { 3255 let o = t.useRef(r2); 3256 return k2(() => { 3257 o.current = r2; 3258 }), o; 3259 } 3260 var k2 = typeof window == "undefined" ? t.useEffect : t.useLayoutEffect; 3261 function L(r2) { 3262 let o = t.useRef(); 3263 return o.current === void 0 && (o.current = r2()), o; 3264 } 3265 function P(r2) { 3266 let o = ee(), n = () => r2(o.snapshot()); 3267 return t.useSyncExternalStore(o.subscribe, n, n); 3268 } 3269 function ve(r2, o, n, u2 = []) { 3270 let c = t.useRef(), d = K2(); 3271 return k2(() => { 3272 var b; 3273 let f = (() => { 3274 var m2; 3275 for (let R of n) { 3276 if (typeof R == "string") return R.trim(); 3277 if (typeof R == "object" && "current" in R) return R.current ? (m2 = R.current.textContent) == null ? void 0 : m2.trim() : c.current; 3278 } 3279 })(), p2 = u2.map((m2) => m2.trim()); 3280 d.value(r2, f, p2), (b = o.current) == null || b.setAttribute(T, f), c.current = f; 3281 }), c; 3282 } 3283 var ke = () => { 3284 let [r2, o] = t.useState(), n = L(() => /* @__PURE__ */ new Map()); 3285 return k2(() => { 3286 n.current.forEach((u2) => u2()), n.current = /* @__PURE__ */ new Map(); 3287 }, [r2]), (u2, c) => { 3288 n.current.set(u2, c), o({}); 3289 }; 3290 }; 3291 function Me(r2) { 3292 let o = r2.type; 3293 return typeof o == "function" ? o(r2.props) : "render" in o ? o.render(r2.props) : r2; 3294 } 3295 function B2({ asChild: r2, children: o }, n) { 3296 return r2 && t.isValidElement(o) ? t.cloneElement(Me(o), { ref: o.ref }, n(o.props.children)) : n(o); 3297 } 3298 var Te = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" }; 3299 3300 // node_modules/clsx/dist/clsx.mjs 3301 function r(e) { 3302 var t2, f, n = ""; 3303 if ("string" == typeof e || "number" == typeof e) n += e; 3304 else if ("object" == typeof e) if (Array.isArray(e)) { 3305 var o = e.length; 3306 for (t2 = 0; t2 < o; t2++) e[t2] && (f = r(e[t2])) && (n && (n += " "), n += f); 3307 } else for (f in e) e[f] && (n && (n += " "), n += f); 3308 return n; 3309 } 3310 function clsx() { 3311 for (var e, t2, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t2 = r(e)) && (n && (n += " "), n += t2); 3312 return n; 3313 } 3314 var clsx_default = clsx; 3315 3316 // packages/commands/build-module/components/command-menu.mjs 3317 var import_data4 = __toESM(require_data(), 1); 3318 var import_element2 = __toESM(require_element(), 1); 3319 var import_i18n = __toESM(require_i18n(), 1); 3320 var import_components = __toESM(require_components(), 1); 3321 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); 3322 3323 // packages/icons/build-module/icon/index.mjs 3324 var import_element = __toESM(require_element(), 1); 3325 var icon_default = (0, import_element.forwardRef)( 3326 ({ icon, size = 24, ...props }, ref) => { 3327 return (0, import_element.cloneElement)(icon, { 3328 width: size, 3329 height: size, 3330 ...props, 3331 ref 3332 }); 3333 } 3334 ); 3335 3336 // packages/icons/build-module/library/arrow-right.mjs 3337 var import_primitives = __toESM(require_primitives(), 1); 3338 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 3339 var arrow_right_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) }); 3340 3341 // packages/icons/build-module/library/search.mjs 3342 var import_primitives2 = __toESM(require_primitives(), 1); 3343 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 3344 var search_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives2.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) }); 3345 3346 // packages/commands/build-module/store/index.mjs 3347 var import_data3 = __toESM(require_data(), 1); 3348 3349 // packages/commands/build-module/store/reducer.mjs 3350 var import_data = __toESM(require_data(), 1); 3351 function commands(state = {}, action) { 3352 switch (action.type) { 3353 case "REGISTER_COMMAND": 3354 return { 3355 ...state, 3356 [action.name]: { 3357 name: action.name, 3358 label: action.label, 3359 searchLabel: action.searchLabel, 3360 context: action.context, 3361 category: action.category, 3362 callback: action.callback, 3363 icon: action.icon, 3364 keywords: action.keywords 3365 } 3366 }; 3367 case "UNREGISTER_COMMAND": { 3368 const { [action.name]: _, ...remainingState } = state; 3369 return remainingState; 3370 } 3371 } 3372 return state; 3373 } 3374 function commandLoaders(state = {}, action) { 3375 switch (action.type) { 3376 case "REGISTER_COMMAND_LOADER": 3377 return { 3378 ...state, 3379 [action.name]: { 3380 name: action.name, 3381 context: action.context, 3382 category: action.category, 3383 hook: action.hook 3384 } 3385 }; 3386 case "UNREGISTER_COMMAND_LOADER": { 3387 const { [action.name]: _, ...remainingState } = state; 3388 return remainingState; 3389 } 3390 } 3391 return state; 3392 } 3393 function isOpen(state = false, action) { 3394 switch (action.type) { 3395 case "OPEN": 3396 return true; 3397 case "CLOSE": 3398 return false; 3399 } 3400 return state; 3401 } 3402 function context(state = "root", action) { 3403 switch (action.type) { 3404 case "SET_CONTEXT": 3405 return action.context; 3406 } 3407 return state; 3408 } 3409 var reducer = (0, import_data.combineReducers)({ 3410 commands, 3411 commandLoaders, 3412 isOpen, 3413 context 3414 }); 3415 var reducer_default = reducer; 3416 3417 // packages/commands/build-module/store/actions.mjs 3418 var actions_exports = {}; 3419 __export(actions_exports, { 3420 close: () => close, 3421 open: () => open, 3422 registerCommand: () => registerCommand, 3423 registerCommandLoader: () => registerCommandLoader, 3424 unregisterCommand: () => unregisterCommand, 3425 unregisterCommandLoader: () => unregisterCommandLoader 3426 }); 3427 var REGISTERABLE_CATEGORIES = /* @__PURE__ */ new Set([ 3428 "command", 3429 "view", 3430 "edit", 3431 "action" 3432 ]); 3433 function registerCommand(config) { 3434 let { category } = config; 3435 if (!category || !REGISTERABLE_CATEGORIES.has(category)) { 3436 category = "action"; 3437 } 3438 return { 3439 type: "REGISTER_COMMAND", 3440 ...config, 3441 category 3442 }; 3443 } 3444 function unregisterCommand(name) { 3445 return { 3446 type: "UNREGISTER_COMMAND", 3447 name 3448 }; 3449 } 3450 function registerCommandLoader(config) { 3451 let { category } = config; 3452 if (!category || !REGISTERABLE_CATEGORIES.has(category)) { 3453 category = "action"; 3454 } 3455 return { 3456 type: "REGISTER_COMMAND_LOADER", 3457 ...config, 3458 category 3459 }; 3460 } 3461 function unregisterCommandLoader(name) { 3462 return { 3463 type: "UNREGISTER_COMMAND_LOADER", 3464 name 3465 }; 3466 } 3467 function open() { 3468 return { 3469 type: "OPEN" 3470 }; 3471 } 3472 function close() { 3473 return { 3474 type: "CLOSE" 3475 }; 3476 } 3477 3478 // packages/commands/build-module/store/selectors.mjs 3479 var selectors_exports = {}; 3480 __export(selectors_exports, { 3481 getCommandLoaders: () => getCommandLoaders, 3482 getCommands: () => getCommands, 3483 getContext: () => getContext, 3484 isOpen: () => isOpen2 3485 }); 3486 var import_data2 = __toESM(require_data(), 1); 3487 var getCommands = (0, import_data2.createSelector)( 3488 (state, contextual = false) => Object.values(state.commands).filter((command) => { 3489 const isContextual = command.context && command.context === state.context; 3490 return contextual ? isContextual : !isContextual; 3491 }), 3492 (state) => [state.commands, state.context] 3493 ); 3494 var getCommandLoaders = (0, import_data2.createSelector)( 3495 (state, contextual = false) => Object.values(state.commandLoaders).filter((loader) => { 3496 const isContextual = loader.context && loader.context === state.context; 3497 return contextual ? isContextual : !isContextual; 3498 }), 3499 (state) => [state.commandLoaders, state.context] 3500 ); 3501 function isOpen2(state) { 3502 return state.isOpen; 3503 } 3504 function getContext(state) { 3505 return state.context; 3506 } 3507 3508 // packages/commands/build-module/store/private-actions.mjs 3509 var private_actions_exports = {}; 3510 __export(private_actions_exports, { 3511 setContext: () => setContext 3512 }); 3513 function setContext(context2) { 3514 return { 3515 type: "SET_CONTEXT", 3516 context: context2 3517 }; 3518 } 3519 3520 // packages/commands/build-module/lock-unlock.mjs 3521 var import_private_apis = __toESM(require_private_apis(), 1); 3522 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 3523 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 3524 "@wordpress/commands" 3525 ); 3526 3527 // packages/commands/build-module/store/index.mjs 3528 var STORE_NAME = "core/commands"; 3529 var store = (0, import_data3.createReduxStore)(STORE_NAME, { 3530 reducer: reducer_default, 3531 actions: actions_exports, 3532 selectors: selectors_exports 3533 }); 3534 (0, import_data3.register)(store); 3535 unlock(store).registerPrivateActions(private_actions_exports); 3536 3537 // packages/commands/build-module/components/command-menu.mjs 3538 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 3539 var { withIgnoreIMEEvents } = unlock(import_components.privateApis); 3540 var inputLabel = (0, import_i18n.__)("Search commands and settings"); 3541 var CATEGORY_ICONS = { 3542 view: arrow_right_default 3543 }; 3544 var CATEGORY_LABELS = { 3545 command: (0, import_i18n.__)("Command"), 3546 view: (0, import_i18n.__)("View"), 3547 edit: (0, import_i18n.__)("Edit"), 3548 action: (0, import_i18n.__)("Action"), 3549 workflow: (0, import_i18n.__)("Workflow") 3550 }; 3551 function isValidIcon(icon) { 3552 return !!icon && (typeof icon === "string" || (0, import_element2.isValidElement)(icon) || typeof icon === "function" || icon instanceof import_element2.Component); 3553 } 3554 function CommandMenuLoader({ 3555 name, 3556 search, 3557 hook, 3558 setLoader, 3559 close: close2, 3560 category 3561 }) { 3562 const { isLoading, commands: commands2 = [] } = hook({ search }) ?? {}; 3563 (0, import_element2.useEffect)(() => { 3564 setLoader(name, isLoading); 3565 }, [setLoader, name, isLoading]); 3566 if (!commands2.length) { 3567 return null; 3568 } 3569 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: commands2.map((command) => { 3570 const commandCategory = command.category ?? category; 3571 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3572 _e.Item, 3573 { 3574 value: command.searchLabel ?? command.label, 3575 keywords: command.keywords, 3576 onSelect: () => command.callback({ close: close2 }), 3577 id: command.name, 3578 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)( 3579 import_components.__experimentalHStack, 3580 { 3581 alignment: "left", 3582 className: clsx_default("commands-command-menu__item", { 3583 "has-icon": CATEGORY_ICONS[commandCategory] || command.icon 3584 }), 3585 children: [ 3586 CATEGORY_ICONS[commandCategory] && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3587 icon_default, 3588 { 3589 icon: CATEGORY_ICONS[commandCategory] 3590 } 3591 ), 3592 !CATEGORY_ICONS[commandCategory] && isValidIcon(command.icon) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(icon_default, { icon: command.icon }), 3593 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "commands-command-menu__item-label", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3594 import_components.TextHighlight, 3595 { 3596 text: command.label, 3597 highlight: search 3598 } 3599 ) }), 3600 CATEGORY_LABELS[commandCategory] && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "commands-command-menu__item-category", children: CATEGORY_LABELS[commandCategory] }) 3601 ] 3602 } 3603 ) 3604 }, 3605 command.name 3606 ); 3607 }) }); 3608 } 3609 function CommandMenuLoaderWrapper({ 3610 hook, 3611 search, 3612 setLoader, 3613 close: close2, 3614 category 3615 }) { 3616 const currentLoaderRef = (0, import_element2.useRef)(hook); 3617 const [key, setKey] = (0, import_element2.useState)(0); 3618 (0, import_element2.useEffect)(() => { 3619 if (currentLoaderRef.current !== hook) { 3620 currentLoaderRef.current = hook; 3621 setKey((prevKey) => prevKey + 1); 3622 } 3623 }, [hook]); 3624 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3625 CommandMenuLoader, 3626 { 3627 hook: currentLoaderRef.current, 3628 search, 3629 setLoader, 3630 close: close2, 3631 category 3632 }, 3633 key 3634 ); 3635 } 3636 function CommandMenuGroup({ isContextual, search, setLoader, close: close2 }) { 3637 const { commands: commands2, loaders } = (0, import_data4.useSelect)( 3638 (select) => { 3639 const { getCommands: getCommands2, getCommandLoaders: getCommandLoaders2 } = select(store); 3640 return { 3641 commands: getCommands2(isContextual), 3642 loaders: getCommandLoaders2(isContextual) 3643 }; 3644 }, 3645 [isContextual] 3646 ); 3647 if (!commands2.length && !loaders.length) { 3648 return null; 3649 } 3650 return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(_e.Group, { children: [ 3651 commands2.map((command) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3652 _e.Item, 3653 { 3654 value: command.searchLabel ?? command.label, 3655 keywords: command.keywords, 3656 onSelect: () => command.callback({ close: close2 }), 3657 id: command.name, 3658 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)( 3659 import_components.__experimentalHStack, 3660 { 3661 alignment: "left", 3662 className: clsx_default("commands-command-menu__item", { 3663 "has-icon": CATEGORY_ICONS[command.category] || command.icon 3664 }), 3665 children: [ 3666 CATEGORY_ICONS[command.category] ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(icon_default, { icon: CATEGORY_ICONS[command.category] }) : command.icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(icon_default, { icon: command.icon }), 3667 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3668 import_components.TextHighlight, 3669 { 3670 text: command.label, 3671 highlight: search 3672 } 3673 ) }), 3674 CATEGORY_LABELS[command.category] && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "commands-command-menu__item-category", children: CATEGORY_LABELS[command.category] }) 3675 ] 3676 } 3677 ) 3678 }, 3679 command.name 3680 )), 3681 loaders.map((loader) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3682 CommandMenuLoaderWrapper, 3683 { 3684 hook: loader.hook, 3685 search, 3686 setLoader, 3687 close: close2, 3688 category: loader.category 3689 }, 3690 loader.name 3691 )) 3692 ] }); 3693 } 3694 function CommandInput({ isOpen: isOpen3, search, setSearch }) { 3695 const commandMenuInput = (0, import_element2.useRef)(); 3696 const _value = P((state) => state.value); 3697 const selectedItemId = (0, import_element2.useMemo)(() => { 3698 const item = document.querySelector( 3699 `[cmdk-item=""][data-value="$_value}"]` 3700 ); 3701 return item?.getAttribute("id"); 3702 }, [_value]); 3703 (0, import_element2.useEffect)(() => { 3704 if (isOpen3) { 3705 commandMenuInput.current.focus(); 3706 } 3707 }, [isOpen3]); 3708 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3709 _e.Input, 3710 { 3711 ref: commandMenuInput, 3712 value: search, 3713 onValueChange: setSearch, 3714 placeholder: inputLabel, 3715 "aria-activedescendant": selectedItemId 3716 } 3717 ); 3718 } 3719 function CommandMenu() { 3720 const { registerShortcut } = (0, import_data4.useDispatch)(import_keyboard_shortcuts.store); 3721 const [search, setSearch] = (0, import_element2.useState)(""); 3722 const isOpen3 = (0, import_data4.useSelect)( 3723 (select) => select(store).isOpen(), 3724 [] 3725 ); 3726 const { open: open2, close: close2 } = (0, import_data4.useDispatch)(store); 3727 const [loaders, setLoaders] = (0, import_element2.useState)({}); 3728 (0, import_element2.useEffect)(() => { 3729 registerShortcut({ 3730 name: "core/commands", 3731 category: "global", 3732 description: (0, import_i18n.__)("Open the command palette."), 3733 keyCombination: { 3734 modifier: "primary", 3735 character: "k" 3736 } 3737 }); 3738 }, [registerShortcut]); 3739 (0, import_keyboard_shortcuts.useShortcut)( 3740 "core/commands", 3741 /** @type {React.KeyboardEventHandler} */ 3742 withIgnoreIMEEvents((event) => { 3743 if (event.defaultPrevented) { 3744 return; 3745 } 3746 event.preventDefault(); 3747 if (isOpen3) { 3748 close2(); 3749 } else { 3750 open2(); 3751 } 3752 }), 3753 { 3754 bindGlobal: true 3755 } 3756 ); 3757 const setLoader = (0, import_element2.useCallback)( 3758 (name, value) => setLoaders((current) => ({ 3759 ...current, 3760 [name]: value 3761 })), 3762 [] 3763 ); 3764 const closeAndReset = () => { 3765 setSearch(""); 3766 close2(); 3767 }; 3768 if (!isOpen3) { 3769 return false; 3770 } 3771 const isLoading = Object.values(loaders).some(Boolean); 3772 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3773 import_components.Modal, 3774 { 3775 className: "commands-command-menu", 3776 overlayClassName: "commands-command-menu__overlay", 3777 onRequestClose: closeAndReset, 3778 __experimentalHideHeader: true, 3779 contentLabel: (0, import_i18n.__)("Command palette"), 3780 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "commands-command-menu__container", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(_e, { label: inputLabel, children: [ 3781 /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "commands-command-menu__header", children: [ 3782 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3783 icon_default, 3784 { 3785 className: "commands-command-menu__header-search-icon", 3786 icon: search_default 3787 } 3788 ), 3789 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3790 CommandInput, 3791 { 3792 search, 3793 setSearch, 3794 isOpen: isOpen3 3795 } 3796 ) 3797 ] }), 3798 /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(_e.List, { label: (0, import_i18n.__)("Command suggestions"), children: [ 3799 search && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(_e.Empty, { children: (0, import_i18n.__)("No results found.") }), 3800 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3801 CommandMenuGroup, 3802 { 3803 search, 3804 setLoader, 3805 close: closeAndReset, 3806 isContextual: true 3807 } 3808 ), 3809 search && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 3810 CommandMenuGroup, 3811 { 3812 search, 3813 setLoader, 3814 close: closeAndReset 3815 } 3816 ) 3817 ] }) 3818 ] }) }) 3819 } 3820 ); 3821 } 3822 3823 // packages/commands/build-module/hooks/use-command-context.mjs 3824 var import_element3 = __toESM(require_element(), 1); 3825 var import_data5 = __toESM(require_data(), 1); 3826 function useCommandContext(context2) { 3827 const { getContext: getContext2 } = (0, import_data5.useSelect)(store); 3828 const initialContext = (0, import_element3.useRef)(getContext2()); 3829 const { setContext: setContext2 } = unlock((0, import_data5.useDispatch)(store)); 3830 (0, import_element3.useEffect)(() => { 3831 setContext2(context2); 3832 }, [context2, setContext2]); 3833 (0, import_element3.useEffect)(() => { 3834 const initialContextRef = initialContext.current; 3835 return () => setContext2(initialContextRef); 3836 }, [setContext2]); 3837 } 3838 3839 // packages/commands/build-module/private-apis.mjs 3840 var privateApis = {}; 3841 lock(privateApis, { 3842 useCommandContext 3843 }); 3844 3845 // packages/commands/build-module/hooks/use-command.mjs 3846 var import_element4 = __toESM(require_element(), 1); 3847 var import_data6 = __toESM(require_data(), 1); 3848 function useCommand(command) { 3849 const { registerCommand: registerCommand2, unregisterCommand: unregisterCommand2 } = (0, import_data6.useDispatch)(store); 3850 const currentCallbackRef = (0, import_element4.useRef)(command.callback); 3851 (0, import_element4.useEffect)(() => { 3852 currentCallbackRef.current = command.callback; 3853 }, [command.callback]); 3854 (0, import_element4.useEffect)(() => { 3855 if (command.disabled) { 3856 return; 3857 } 3858 registerCommand2({ 3859 name: command.name, 3860 context: command.context, 3861 category: command.category, 3862 label: command.label, 3863 searchLabel: command.searchLabel, 3864 icon: command.icon, 3865 keywords: command.keywords, 3866 callback: (...args) => currentCallbackRef.current(...args) 3867 }); 3868 return () => { 3869 unregisterCommand2(command.name); 3870 }; 3871 }, [ 3872 command.name, 3873 command.label, 3874 command.searchLabel, 3875 command.icon, 3876 command.context, 3877 command.category, 3878 command.keywords, 3879 command.disabled, 3880 registerCommand2, 3881 unregisterCommand2 3882 ]); 3883 } 3884 function useCommands(commands2) { 3885 const { registerCommand: registerCommand2, unregisterCommand: unregisterCommand2 } = (0, import_data6.useDispatch)(store); 3886 const currentCallbacksRef = (0, import_element4.useRef)({}); 3887 (0, import_element4.useEffect)(() => { 3888 if (!commands2) { 3889 return; 3890 } 3891 commands2.forEach((command) => { 3892 if (command.callback) { 3893 currentCallbacksRef.current[command.name] = command.callback; 3894 } 3895 }); 3896 }, [commands2]); 3897 (0, import_element4.useEffect)(() => { 3898 if (!commands2) { 3899 return; 3900 } 3901 commands2.forEach((command) => { 3902 if (command.disabled) { 3903 return; 3904 } 3905 registerCommand2({ 3906 name: command.name, 3907 context: command.context, 3908 category: command.category, 3909 label: command.label, 3910 searchLabel: command.searchLabel, 3911 icon: command.icon, 3912 keywords: command.keywords, 3913 callback: (...args) => { 3914 const callback = currentCallbacksRef.current[command.name]; 3915 if (callback) { 3916 callback(...args); 3917 } 3918 } 3919 }); 3920 }); 3921 return () => { 3922 commands2.forEach((command) => { 3923 unregisterCommand2(command.name); 3924 }); 3925 }; 3926 }, [commands2, registerCommand2, unregisterCommand2]); 3927 } 3928 3929 // packages/commands/build-module/hooks/use-command-loader.mjs 3930 var import_element5 = __toESM(require_element(), 1); 3931 var import_data7 = __toESM(require_data(), 1); 3932 function useCommandLoader(loader) { 3933 const { registerCommandLoader: registerCommandLoader2, unregisterCommandLoader: unregisterCommandLoader2 } = (0, import_data7.useDispatch)(store); 3934 (0, import_element5.useEffect)(() => { 3935 if (loader.disabled) { 3936 return; 3937 } 3938 registerCommandLoader2({ 3939 name: loader.name, 3940 hook: loader.hook, 3941 context: loader.context, 3942 category: loader.category 3943 }); 3944 return () => { 3945 unregisterCommandLoader2(loader.name); 3946 }; 3947 }, [ 3948 loader.name, 3949 loader.hook, 3950 loader.context, 3951 loader.category, 3952 loader.disabled, 3953 registerCommandLoader2, 3954 unregisterCommandLoader2 3955 ]); 3956 } 3957 return __toCommonJS(index_exports); 3958 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sat Jun 27 08:20:12 2026 | Cross-referenced by PHPXref |