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